@remotion/lambda-client 4.0.378 → 4.0.380

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 (141) hide show
  1. package/dist/app-router-webhook.d.ts +10 -0
  2. package/dist/app-router-webhook.js +43 -0
  3. package/dist/apply-lifecycle.d.ts +8 -0
  4. package/dist/apply-lifecycle.js +18 -0
  5. package/dist/aws-clients.d.ts +12 -0
  6. package/dist/aws-clients.js +56 -0
  7. package/dist/aws-provider.d.ts +27 -0
  8. package/dist/aws-provider.js +94 -0
  9. package/dist/bucket-exists.d.ts +3 -0
  10. package/dist/bucket-exists.js +27 -0
  11. package/dist/call-lambda-async.d.ts +2 -0
  12. package/dist/call-lambda-async.js +20 -0
  13. package/dist/call-lambda-streaming.d.ts +6 -0
  14. package/dist/call-lambda-streaming.js +126 -0
  15. package/dist/call-lambda-sync.d.ts +2 -0
  16. package/dist/call-lambda-sync.js +30 -0
  17. package/dist/check-credentials.d.ts +1 -0
  18. package/dist/check-credentials.js +39 -0
  19. package/dist/cjs/index.js +36 -33
  20. package/dist/clean-items.d.ts +17 -0
  21. package/dist/clean-items.js +26 -0
  22. package/dist/constants.d.ts +25 -0
  23. package/dist/constants.js +26 -0
  24. package/dist/content-disposition-header.d.ts +2 -0
  25. package/dist/content-disposition-header.js +50 -0
  26. package/dist/convert-to-serve-url.d.ts +6 -0
  27. package/dist/convert-to-serve-url.js +14 -0
  28. package/dist/create-bucket.d.ts +3 -0
  29. package/dist/create-bucket.js +65 -0
  30. package/dist/delete-file.d.ts +3 -0
  31. package/dist/delete-file.js +17 -0
  32. package/dist/delete-function.d.ts +7 -0
  33. package/dist/delete-function.js +15 -0
  34. package/dist/delete-render.d.ts +22 -0
  35. package/dist/delete-render.js +90 -0
  36. package/dist/encode-aws-url-params.d.ts +1 -0
  37. package/dist/encode-aws-url-params.js +7 -0
  38. package/dist/esm/index.mjs +23 -20
  39. package/dist/estimate-price.d.ts +17 -0
  40. package/dist/estimate-price.js +45 -0
  41. package/dist/express-webhook.d.ts +3 -0
  42. package/dist/express-webhook.js +46 -0
  43. package/dist/get-account-id.d.ts +3 -0
  44. package/dist/get-account-id.js +15 -0
  45. package/dist/get-aws-client.d.ts +32 -0
  46. package/dist/get-aws-client.js +67 -0
  47. package/dist/get-aws-urls.d.ts +25 -0
  48. package/dist/get-aws-urls.js +31 -0
  49. package/dist/get-buckets.d.ts +9 -0
  50. package/dist/get-buckets.js +64 -0
  51. package/dist/get-compositions-on-lambda.d.ts +20 -0
  52. package/dist/get-compositions-on-lambda.js +62 -0
  53. package/dist/get-credentials.d.ts +9 -0
  54. package/dist/get-credentials.js +55 -0
  55. package/dist/get-env-variable.d.ts +1 -0
  56. package/dist/get-env-variable.js +15 -0
  57. package/dist/get-function-name.d.ts +8 -0
  58. package/dist/get-function-name.js +17 -0
  59. package/dist/get-function-version.d.ts +9 -0
  60. package/dist/get-function-version.js +35 -0
  61. package/dist/get-functions.d.ts +10 -0
  62. package/dist/get-functions.js +80 -0
  63. package/dist/get-output-url-from-metadata.d.ts +3 -0
  64. package/dist/get-output-url-from-metadata.js +18 -0
  65. package/dist/get-render-progress.d.ts +17 -0
  66. package/dist/get-render-progress.js +47 -0
  67. package/dist/get-s3-client.d.ts +11 -0
  68. package/dist/get-s3-client.js +15 -0
  69. package/dist/get-service-client.d.ts +25 -0
  70. package/dist/get-service-client.js +131 -0
  71. package/dist/get-sites.d.ts +31 -0
  72. package/dist/get-sites.js +83 -0
  73. package/dist/head-file.d.ts +3 -0
  74. package/dist/head-file.js +18 -0
  75. package/dist/index.d.ts +129 -0
  76. package/dist/index.js +108 -0
  77. package/dist/is-cli.d.ts +2 -0
  78. package/dist/is-cli.js +10 -0
  79. package/dist/is-flaky-error.d.ts +1 -0
  80. package/dist/is-flaky-error.js +78 -0
  81. package/dist/is-in-lambda.d.ts +1 -0
  82. package/dist/is-in-lambda.js +9 -0
  83. package/dist/is-likely-to-have-aws-profile.d.ts +1 -0
  84. package/dist/is-likely-to-have-aws-profile.js +50 -0
  85. package/dist/lambda-version-string.d.ts +1 -0
  86. package/dist/lambda-version-string.js +7 -0
  87. package/dist/lifecycle-rules.d.ts +12 -0
  88. package/dist/lifecycle-rules.js +73 -0
  89. package/dist/lifecycle.d.ts +7 -0
  90. package/dist/lifecycle.js +24 -0
  91. package/dist/list-objects.d.ts +3 -0
  92. package/dist/list-objects.js +70 -0
  93. package/dist/make-lambda-payload.d.ts +59 -0
  94. package/dist/make-lambda-payload.js +150 -0
  95. package/dist/make-s3-url.d.ts +6 -0
  96. package/dist/make-s3-url.js +7 -0
  97. package/dist/p-limit.d.ts +1 -0
  98. package/dist/p-limit.js +57 -0
  99. package/dist/pages-router-webhook.d.ts +5 -0
  100. package/dist/pages-router-webhook.js +48 -0
  101. package/dist/parse-function-name.d.ts +8 -0
  102. package/dist/parse-function-name.js +17 -0
  103. package/dist/presign-url.d.ts +17 -0
  104. package/dist/presign-url.js +66 -0
  105. package/dist/price-per-1s.d.ts +37 -0
  106. package/dist/price-per-1s.js +822 -0
  107. package/dist/random-hash.d.ts +1 -0
  108. package/dist/random-hash.js +13 -0
  109. package/dist/read-file.d.ts +11 -0
  110. package/dist/read-file.js +19 -0
  111. package/dist/regions.d.ts +3 -0
  112. package/dist/regions.js +48 -0
  113. package/dist/render-media-on-lambda.d.ts +66 -0
  114. package/dist/render-media-on-lambda.js +133 -0
  115. package/dist/render-still-on-lambda.d.ts +61 -0
  116. package/dist/render-still-on-lambda.js +121 -0
  117. package/dist/runtime-preference.d.ts +2 -0
  118. package/dist/runtime-preference.js +8 -0
  119. package/dist/speculate-function-name.d.ts +7 -0
  120. package/dist/speculate-function-name.js +39 -0
  121. package/dist/types.d.ts +4 -0
  122. package/dist/types.js +2 -0
  123. package/dist/validate-aws-region.d.ts +2 -0
  124. package/dist/validate-aws-region.js +9 -0
  125. package/dist/validate-bucketname.d.ts +4 -0
  126. package/dist/validate-bucketname.js +15 -0
  127. package/dist/validate-disk-size-in-mb.d.ts +1 -0
  128. package/dist/validate-disk-size-in-mb.js +23 -0
  129. package/dist/validate-lambda-codec.d.ts +2 -0
  130. package/dist/validate-lambda-codec.js +21 -0
  131. package/dist/validate-memory-size.d.ts +1 -0
  132. package/dist/validate-memory-size.js +22 -0
  133. package/dist/validate-presign-expiration.d.ts +1 -0
  134. package/dist/validate-presign-expiration.js +29 -0
  135. package/dist/validate-serveurl.d.ts +1 -0
  136. package/dist/validate-serveurl.js +9 -0
  137. package/dist/validate-webhook-signature.d.ts +5 -0
  138. package/dist/validate-webhook-signature.js +28 -0
  139. package/dist/write-file.d.ts +5 -0
  140. package/dist/write-file.js +83 -0
  141. package/package.json +3 -3
@@ -4713,7 +4713,7 @@ var require_protocols = __commonJS((exports) => {
4713
4713
  });
4714
4714
  }
4715
4715
  async loadEventStreamCapability() {
4716
- const { EventStreamSerde } = await Promise.resolve().then(() => __toESM(require_event_streams()));
4716
+ const { EventStreamSerde } = await Promise.resolve().then(() => __toESM(require_event_streams(), 1));
4717
4717
  return new EventStreamSerde({
4718
4718
  marshaller: this.getEventStreamMarshaller(),
4719
4719
  serializer: this.serializer,
@@ -16896,7 +16896,7 @@ var require_dist_cjs48 = __commonJS((exports) => {
16896
16896
  }
16897
16897
  if (!process.env[ENV_IMDS_DISABLED]) {
16898
16898
  try {
16899
- const { getInstanceMetadataEndpoint, httpRequest } = await Promise.resolve().then(() => __toESM(require_dist_cjs43()));
16899
+ const { getInstanceMetadataEndpoint, httpRequest } = await Promise.resolve().then(() => __toESM(require_dist_cjs43(), 1));
16900
16900
  const endpoint = await getInstanceMetadataEndpoint();
16901
16901
  return (await httpRequest({ ...endpoint, path: IMDS_REGION_PATH })).toString();
16902
16902
  } catch (e) {}
@@ -17618,7 +17618,7 @@ var require_dist_cjs50 = __commonJS((exports) => {
17618
17618
  var EXPIRE_WINDOW_MS = 5 * 60 * 1000;
17619
17619
  var REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`;
17620
17620
  var getSsoOidcClient = async (ssoRegion, init = {}) => {
17621
- const { SSOOIDCClient } = await Promise.resolve().then(() => __toESM(require_sso_oidc()));
17621
+ const { SSOOIDCClient } = await Promise.resolve().then(() => __toESM(require_sso_oidc(), 1));
17622
17622
  const coalesce = (prop) => init.clientConfig?.[prop] ?? init.parentClientConfig?.[prop];
17623
17623
  const ssoOidcClient = new SSOOIDCClient(Object.assign({}, init.clientConfig ?? {}, {
17624
17624
  region: ssoRegion ?? init.clientConfig?.region,
@@ -17628,7 +17628,7 @@ var require_dist_cjs50 = __commonJS((exports) => {
17628
17628
  return ssoOidcClient;
17629
17629
  };
17630
17630
  var getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}) => {
17631
- const { CreateTokenCommand } = await Promise.resolve().then(() => __toESM(require_sso_oidc()));
17631
+ const { CreateTokenCommand } = await Promise.resolve().then(() => __toESM(require_sso_oidc(), 1));
17632
17632
  const ssoOidcClient = await getSsoOidcClient(ssoRegion, init);
17633
17633
  return ssoOidcClient.send(new CreateTokenCommand({
17634
17634
  clientId: ssoToken.clientId,
@@ -19430,7 +19430,7 @@ var require_dist_cjs53 = __commonJS((exports) => {
19430
19430
  return this.profileData.login_session;
19431
19431
  }
19432
19432
  async refresh(token) {
19433
- const { SigninClient, CreateOAuth2TokenCommand } = await Promise.resolve().then(() => __toESM(require_signin()));
19433
+ const { SigninClient, CreateOAuth2TokenCommand } = await Promise.resolve().then(() => __toESM(require_signin(), 1));
19434
19434
  const { logger, userAgentAppId } = this.callerClientConfig ?? {};
19435
19435
  const isH2 = (requestHandler2) => {
19436
19436
  return requestHandler2?.metadata?.handlerProtocol === "h2";
@@ -20739,19 +20739,19 @@ var require_dist_cjs56 = __commonJS((exports) => {
20739
20739
  var resolveCredentialSource = (credentialSource, profileName, logger) => {
20740
20740
  const sourceProvidersMap = {
20741
20741
  EcsContainer: async (options) => {
20742
- const { fromHttp } = await Promise.resolve().then(() => __toESM(require_dist_cjs44()));
20743
- const { fromContainerMetadata } = await Promise.resolve().then(() => __toESM(require_dist_cjs43()));
20742
+ const { fromHttp } = await Promise.resolve().then(() => __toESM(require_dist_cjs44(), 1));
20743
+ const { fromContainerMetadata } = await Promise.resolve().then(() => __toESM(require_dist_cjs43(), 1));
20744
20744
  logger?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer");
20745
20745
  return async () => propertyProvider.chain(fromHttp(options ?? {}), fromContainerMetadata(options))().then(setNamedProvider);
20746
20746
  },
20747
20747
  Ec2InstanceMetadata: async (options) => {
20748
20748
  logger?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");
20749
- const { fromInstanceMetadata } = await Promise.resolve().then(() => __toESM(require_dist_cjs43()));
20749
+ const { fromInstanceMetadata } = await Promise.resolve().then(() => __toESM(require_dist_cjs43(), 1));
20750
20750
  return async () => fromInstanceMetadata(options)().then(setNamedProvider);
20751
20751
  },
20752
20752
  Environment: async (options) => {
20753
20753
  logger?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");
20754
- const { fromEnv } = await Promise.resolve().then(() => __toESM(require_dist_cjs42()));
20754
+ const { fromEnv } = await Promise.resolve().then(() => __toESM(require_dist_cjs42(), 1));
20755
20755
  return async () => fromEnv(options)().then(setNamedProvider);
20756
20756
  }
20757
20757
  };
@@ -20784,7 +20784,7 @@ var require_dist_cjs56 = __commonJS((exports) => {
20784
20784
  const profileData = profiles[profileName];
20785
20785
  const { source_profile, region } = profileData;
20786
20786
  if (!options.roleAssumer) {
20787
- const { getDefaultRoleAssumer } = await Promise.resolve().then(() => __toESM(require_sts()));
20787
+ const { getDefaultRoleAssumer } = await Promise.resolve().then(() => __toESM(require_sts(), 1));
20788
20788
  options.roleAssumer = getDefaultRoleAssumer({
20789
20789
  ...options.clientConfig,
20790
20790
  credentialProviderLogger: options.logger,
@@ -20837,12 +20837,12 @@ var require_dist_cjs56 = __commonJS((exports) => {
20837
20837
  return client.setCredentialFeature(credentials, "CREDENTIALS_PROFILE_LOGIN", "AC");
20838
20838
  };
20839
20839
  var isProcessProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.credential_process === "string";
20840
- var resolveProcessCredentials = async (options, profile) => Promise.resolve().then(() => __toESM(require_dist_cjs54())).then(({ fromProcess }) => fromProcess({
20840
+ var resolveProcessCredentials = async (options, profile) => Promise.resolve().then(() => __toESM(require_dist_cjs54(), 1)).then(({ fromProcess }) => fromProcess({
20841
20841
  ...options,
20842
20842
  profile
20843
20843
  })().then((creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_PROCESS", "v")));
20844
20844
  var resolveSsoCredentials = async (profile, profileData, options = {}) => {
20845
- const { fromSSO } = await Promise.resolve().then(() => __toESM(require_dist_cjs52()));
20845
+ const { fromSSO } = await Promise.resolve().then(() => __toESM(require_dist_cjs52(), 1));
20846
20846
  return fromSSO({
20847
20847
  profile,
20848
20848
  logger: options.logger,
@@ -20870,7 +20870,7 @@ var require_dist_cjs56 = __commonJS((exports) => {
20870
20870
  return client.setCredentialFeature(credentials, "CREDENTIALS_PROFILE", "n");
20871
20871
  };
20872
20872
  var isWebIdentityProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.web_identity_token_file === "string" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1;
20873
- var resolveWebIdentityCredentials = async (profile, options) => Promise.resolve().then(() => __toESM(require_dist_cjs55())).then(({ fromTokenFile }) => fromTokenFile({
20873
+ var resolveWebIdentityCredentials = async (profile, options) => Promise.resolve().then(() => __toESM(require_dist_cjs55(), 1)).then(({ fromTokenFile }) => fromTokenFile({
20874
20874
  webIdentityTokenFile: profile.web_identity_token_file,
20875
20875
  roleArn: profile.role_arn,
20876
20876
  roleSessionName: profile.role_session_name,
@@ -20927,10 +20927,10 @@ var require_dist_cjs57 = __commonJS((exports) => {
20927
20927
  var sharedIniFileLoader = require_dist_cjs36();
20928
20928
  var ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED";
20929
20929
  var remoteProvider = async (init) => {
20930
- const { ENV_CMDS_FULL_URI, ENV_CMDS_RELATIVE_URI, fromContainerMetadata, fromInstanceMetadata } = await Promise.resolve().then(() => __toESM(require_dist_cjs43()));
20930
+ const { ENV_CMDS_FULL_URI, ENV_CMDS_RELATIVE_URI, fromContainerMetadata, fromInstanceMetadata } = await Promise.resolve().then(() => __toESM(require_dist_cjs43(), 1));
20931
20931
  if (process.env[ENV_CMDS_RELATIVE_URI] || process.env[ENV_CMDS_FULL_URI]) {
20932
20932
  init.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata");
20933
- const { fromHttp } = await Promise.resolve().then(() => __toESM(require_dist_cjs44()));
20933
+ const { fromHttp } = await Promise.resolve().then(() => __toESM(require_dist_cjs44(), 1));
20934
20934
  return propertyProvider.chain(fromHttp(init), fromContainerMetadata(init));
20935
20935
  }
20936
20936
  if (process.env[ENV_IMDS_DISABLED] && process.env[ENV_IMDS_DISABLED] !== "false") {
@@ -21027,22 +21027,22 @@ var require_dist_cjs57 = __commonJS((exports) => {
21027
21027
  if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) {
21028
21028
  throw new propertyProvider.CredentialsProviderError("Skipping SSO provider in default chain (inputs do not include SSO fields).", { logger: init.logger });
21029
21029
  }
21030
- const { fromSSO } = await Promise.resolve().then(() => __toESM(require_dist_cjs52()));
21030
+ const { fromSSO } = await Promise.resolve().then(() => __toESM(require_dist_cjs52(), 1));
21031
21031
  return fromSSO(init)(awsIdentityProperties);
21032
21032
  },
21033
21033
  async (awsIdentityProperties) => {
21034
21034
  init.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni");
21035
- const { fromIni } = await Promise.resolve().then(() => __toESM(require_dist_cjs56()));
21035
+ const { fromIni } = await Promise.resolve().then(() => __toESM(require_dist_cjs56(), 1));
21036
21036
  return fromIni(init)(awsIdentityProperties);
21037
21037
  },
21038
21038
  async (awsIdentityProperties) => {
21039
21039
  init.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess");
21040
- const { fromProcess } = await Promise.resolve().then(() => __toESM(require_dist_cjs54()));
21040
+ const { fromProcess } = await Promise.resolve().then(() => __toESM(require_dist_cjs54(), 1));
21041
21041
  return fromProcess(init)(awsIdentityProperties);
21042
21042
  },
21043
21043
  async (awsIdentityProperties) => {
21044
21044
  init.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile");
21045
- const { fromTokenFile } = await Promise.resolve().then(() => __toESM(require_dist_cjs55()));
21045
+ const { fromTokenFile } = await Promise.resolve().then(() => __toESM(require_dist_cjs55(), 1));
21046
21046
  return fromTokenFile(init)(awsIdentityProperties);
21047
21047
  },
21048
21048
  async () => {
@@ -65898,7 +65898,7 @@ var validateDownloadBehavior = (downloadBehavior) => {
65898
65898
  }
65899
65899
  }
65900
65900
  };
65901
- var VERSION = "4.0.378";
65901
+ var VERSION = "4.0.380";
65902
65902
  var isColorSupported = () => {
65903
65903
  const env = process.env || {};
65904
65904
  const isForceDisabled = "NO_COLOR" in env;
@@ -69610,6 +69610,9 @@ var isFlakyError = (err) => {
69610
69610
  if (message.includes("ServiceException: We currently do not have sufficient capacity in the region you requested")) {
69611
69611
  return true;
69612
69612
  }
69613
+ if (message.includes("Page crashed!")) {
69614
+ return true;
69615
+ }
69613
69616
  return false;
69614
69617
  };
69615
69618
 
@@ -0,0 +1,17 @@
1
+ import type { AwsRegion } from './regions';
2
+ type Miliseconds = {
3
+ /**
4
+ * @deprecated Typo in property name. Use `durationInMilliseconds` instead.
5
+ */
6
+ durationInMiliseconds: number;
7
+ } | {
8
+ durationInMilliseconds: number;
9
+ };
10
+ export type EstimatePriceInput = {
11
+ region: AwsRegion;
12
+ memorySizeInMb: number;
13
+ diskSizeInMb: number;
14
+ lambdasInvoked: number;
15
+ } & Miliseconds;
16
+ export declare const estimatePrice: ({ region, memorySizeInMb, diskSizeInMb, lambdasInvoked, ...other }: EstimatePriceInput) => number;
17
+ export {};
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.estimatePrice = void 0;
4
+ const constants_1 = require("./constants");
5
+ const price_per_1s_1 = require("./price-per-1s");
6
+ const validate_aws_region_1 = require("./validate-aws-region");
7
+ const validate_disk_size_in_mb_1 = require("./validate-disk-size-in-mb");
8
+ const validate_memory_size_1 = require("./validate-memory-size");
9
+ /*
10
+ * @description Calculates the AWS costs incurred for AWS Lambda given the region, execution duration and memory size.
11
+ * @see [Documentation](https://remotion.dev/docs/lambda/estimateprice)
12
+ */
13
+ const estimatePrice = ({ region, memorySizeInMb, diskSizeInMb, lambdasInvoked, ...other }) => {
14
+ (0, validate_memory_size_1.validateMemorySize)(memorySizeInMb);
15
+ (0, validate_aws_region_1.validateAwsRegion)(region);
16
+ (0, validate_disk_size_in_mb_1.validateDiskSizeInMb)(diskSizeInMb);
17
+ const durationInMilliseconds = 'durationInMiliseconds' in other
18
+ ? other.durationInMiliseconds
19
+ : other.durationInMilliseconds;
20
+ if (typeof durationInMilliseconds !== 'number') {
21
+ throw new TypeError(`Parameter 'durationInMilliseconds' must be a number but got ${typeof durationInMilliseconds}`);
22
+ }
23
+ if (Number.isNaN(durationInMilliseconds)) {
24
+ throw new TypeError(`Parameter 'durationInMilliseconds' must not be NaN but it is.`);
25
+ }
26
+ if (!Number.isFinite(durationInMilliseconds)) {
27
+ throw new TypeError(`Parameter 'durationInMilliseconds' must be finite but it is ${durationInMilliseconds}`);
28
+ }
29
+ if (durationInMilliseconds < 0) {
30
+ throw new TypeError(`Parameter 'durationInMilliseconds' must be over 0 but it is ${durationInMilliseconds}.`);
31
+ }
32
+ const durationPrice = price_per_1s_1.pricing[region]['Lambda Duration-ARM'].price;
33
+ // In GB-second
34
+ const timeCostDollars = Number(durationPrice) *
35
+ ((memorySizeInMb * durationInMilliseconds) / 1000 / 1024);
36
+ const diskSizePrice = price_per_1s_1.pricing[region]['Lambda Storage-Duration-ARM'].price;
37
+ const chargedDiskSize = Math.max(0, diskSizeInMb - constants_1.MIN_EPHEMERAL_STORAGE_IN_MB);
38
+ // In GB-second
39
+ const diskSizeDollars = chargedDiskSize *
40
+ Number(diskSizePrice) *
41
+ (durationInMilliseconds / 1000 / 1024);
42
+ const invocationCost = Number(price_per_1s_1.pricing[region]['Lambda Requests'].price) * lambdasInvoked;
43
+ return Number((timeCostDollars + diskSizeDollars + invocationCost).toFixed(5));
44
+ };
45
+ exports.estimatePrice = estimatePrice;
@@ -0,0 +1,3 @@
1
+ import type { Request, Response } from 'express';
2
+ import type { NextWebhookArgs } from './app-router-webhook';
3
+ export declare const expressWebhook: (options: NextWebhookArgs) => (req: Request, res: Response) => void;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.expressWebhook = void 0;
4
+ const pages_router_webhook_1 = require("./pages-router-webhook");
5
+ const validate_webhook_signature_1 = require("./validate-webhook-signature");
6
+ const expressWebhook = (options) => {
7
+ const { testing, extraHeaders, secret, onSuccess, onTimeout, onError } = options;
8
+ return (req, res) => {
9
+ // add headers to enable testing
10
+ if (testing) {
11
+ const testingheaders = {
12
+ 'Access-Control-Allow-Origin': 'https://www.remotion.dev',
13
+ 'Access-Control-Allow-Headers': 'X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, X-Remotion-Status, X-Remotion-Signature, X-Remotion-Mode',
14
+ 'Access-Control-Allow-Methods': 'OPTIONS,POST',
15
+ };
16
+ (0, pages_router_webhook_1.addHeaders)(res, testingheaders);
17
+ }
18
+ // add extra headers
19
+ (0, pages_router_webhook_1.addHeaders)(res, extraHeaders || {});
20
+ // dont go forward if just testing
21
+ if (req.method === 'OPTIONS') {
22
+ res.status(200).end();
23
+ return;
24
+ }
25
+ // validate the webhook signature
26
+ (0, validate_webhook_signature_1.validateWebhookSignature)({
27
+ signatureHeader: req.header('X-Remotion-Signature'),
28
+ body: req.body,
29
+ secret,
30
+ });
31
+ // custom logic
32
+ const payload = req.body;
33
+ if (payload.type === 'success' && onSuccess) {
34
+ onSuccess(payload);
35
+ }
36
+ else if (payload.type === 'error' && onError) {
37
+ onError(payload);
38
+ }
39
+ else if (payload.type === 'timeout' && onTimeout) {
40
+ onTimeout(payload);
41
+ }
42
+ // send response
43
+ res.status(200).json({ success: true });
44
+ };
45
+ };
46
+ exports.expressWebhook = expressWebhook;
@@ -0,0 +1,3 @@
1
+ import type { GetAccountId } from '@remotion/serverless-client';
2
+ import type { AwsProvider } from './aws-provider';
3
+ export declare const getAccountIdImplementation: GetAccountId<AwsProvider>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAccountIdImplementation = void 0;
4
+ const client_sts_1 = require("@aws-sdk/client-sts");
5
+ const aws_clients_1 = require("./aws-clients");
6
+ const validate_aws_region_1 = require("./validate-aws-region");
7
+ const getAccountIdImplementation = async (options) => {
8
+ (0, validate_aws_region_1.validateAwsRegion)(options.region);
9
+ const callerIdentity = await (0, aws_clients_1.getStsClient)(options.region, null).send(new client_sts_1.GetCallerIdentityCommand({}));
10
+ if (!callerIdentity.Account) {
11
+ throw new Error('Cannot get account ID');
12
+ }
13
+ return callerIdentity.Account;
14
+ };
15
+ exports.getAccountIdImplementation = getAccountIdImplementation;
@@ -0,0 +1,32 @@
1
+ import * as CloudWatchSDK from '@aws-sdk/client-cloudwatch-logs';
2
+ import * as IamSdk from '@aws-sdk/client-iam';
3
+ import * as LambdaSDK from '@aws-sdk/client-lambda';
4
+ import * as S3SDK from '@aws-sdk/client-s3';
5
+ import * as ServiceQuotasSDK from '@aws-sdk/client-service-quotas';
6
+ import * as StsSdk from '@aws-sdk/client-sts';
7
+ import type { CustomCredentials } from '@remotion/serverless-client';
8
+ import type { AwsProvider } from './aws-provider';
9
+ import { type ServiceMapping } from './get-service-client';
10
+ import type { AwsRegion } from './regions';
11
+ import type { RequestHandler } from './types';
12
+ export type GetAwsClientInput<T extends keyof ServiceMapping> = {
13
+ region: AwsRegion;
14
+ service: T;
15
+ customCredentials?: CustomCredentials<AwsProvider> | null;
16
+ forcePathStyle?: boolean;
17
+ requestHandler?: RequestHandler;
18
+ };
19
+ type SdkMapping = {
20
+ s3: typeof S3SDK;
21
+ cloudwatch: typeof CloudWatchSDK;
22
+ iam: typeof IamSdk;
23
+ lambda: typeof LambdaSDK;
24
+ servicequotas: typeof ServiceQuotasSDK;
25
+ sts: typeof StsSdk;
26
+ };
27
+ export type GetAwsClientOutput<T extends keyof ServiceMapping> = {
28
+ client: ServiceMapping[T];
29
+ sdk: SdkMapping[T];
30
+ };
31
+ export declare const getAwsClient: <T extends keyof ServiceMapping>({ region, service, customCredentials, forcePathStyle, requestHandler, }: GetAwsClientInput<T>) => GetAwsClientOutput<T>;
32
+ export {};
@@ -0,0 +1,67 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.getAwsClient = void 0;
37
+ const CloudWatchSDK = __importStar(require("@aws-sdk/client-cloudwatch-logs"));
38
+ const IamSdk = __importStar(require("@aws-sdk/client-iam"));
39
+ const LambdaSDK = __importStar(require("@aws-sdk/client-lambda"));
40
+ const S3SDK = __importStar(require("@aws-sdk/client-s3"));
41
+ const ServiceQuotasSDK = __importStar(require("@aws-sdk/client-service-quotas"));
42
+ const StsSdk = __importStar(require("@aws-sdk/client-sts"));
43
+ const get_service_client_1 = require("./get-service-client");
44
+ /*
45
+ * @description Exposes full access to the AWS SDK used by Remotion, allowing interaction with AWS infrastructure beyond provided functionalities.
46
+ * @see [Documentation](https://remotion.dev/docs/lambda/getawsclient)
47
+ */
48
+ const getAwsClient = ({ region, service, customCredentials, forcePathStyle, requestHandler, }) => {
49
+ return {
50
+ client: (0, get_service_client_1.getServiceClient)({
51
+ region,
52
+ service,
53
+ customCredentials: customCredentials !== null && customCredentials !== void 0 ? customCredentials : null,
54
+ forcePathStyle: forcePathStyle !== null && forcePathStyle !== void 0 ? forcePathStyle : false,
55
+ requestHandler,
56
+ }),
57
+ sdk: {
58
+ lambda: LambdaSDK,
59
+ cloudwatch: CloudWatchSDK,
60
+ iam: IamSdk,
61
+ s3: S3SDK,
62
+ servicequotas: ServiceQuotasSDK,
63
+ sts: StsSdk,
64
+ }[service],
65
+ };
66
+ };
67
+ exports.getAwsClient = getAwsClient;
@@ -0,0 +1,25 @@
1
+ import type { GetLoggingUrlForRendererFunction, ServerlessRoutines } from '@remotion/serverless-client';
2
+ import type { AwsProvider } from './aws-provider';
3
+ import type { AwsRegion } from './regions';
4
+ export declare const getCloudwatchMethodUrl: ({ region, functionName, renderId, rendererFunctionName, method, }: {
5
+ region: AwsRegion;
6
+ functionName: string;
7
+ method: ServerlessRoutines;
8
+ rendererFunctionName: string | null;
9
+ renderId: string;
10
+ }) => string;
11
+ export declare const getLambdaInsightsUrl: ({ region, functionName, }: {
12
+ region: AwsRegion;
13
+ functionName: string;
14
+ }) => string;
15
+ export declare const getCloudwatchRendererUrl: GetLoggingUrlForRendererFunction<AwsProvider>;
16
+ export declare const getS3RenderUrl: ({ renderId, region, bucketName, }: {
17
+ renderId: string;
18
+ region: AwsRegion;
19
+ bucketName: string;
20
+ }) => string;
21
+ export declare const getProgressJsonUrl: ({ region, bucketName, renderId, }: {
22
+ region: AwsRegion;
23
+ bucketName: string;
24
+ renderId: string;
25
+ }) => string;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProgressJsonUrl = exports.getS3RenderUrl = exports.getCloudwatchRendererUrl = exports.getLambdaInsightsUrl = exports.getCloudwatchMethodUrl = void 0;
4
+ const encode_aws_url_params_1 = require("./encode-aws-url-params");
5
+ const cloudWatchUrlWithQuery = ({ region, functionNameToUse, query, }) => {
6
+ return `https://${region}.console.aws.amazon.com/cloudwatch/home?region=${region}#logsV2:log-groups/log-group/$252Faws$252Flambda$252F${functionNameToUse}/log-events$3FfilterPattern$3D${(0, encode_aws_url_params_1.encodeAwsUrlParams)(query)}`;
7
+ };
8
+ const getCloudwatchMethodUrl = ({ region, functionName, renderId, rendererFunctionName, method, }) => {
9
+ const functionNameToUse = rendererFunctionName !== null && rendererFunctionName !== void 0 ? rendererFunctionName : functionName;
10
+ const query = `"method=${method},renderId=${renderId}"`;
11
+ return cloudWatchUrlWithQuery({ region, functionNameToUse, query });
12
+ };
13
+ exports.getCloudwatchMethodUrl = getCloudwatchMethodUrl;
14
+ const getLambdaInsightsUrl = ({ region, functionName, }) => {
15
+ return `https://${region}.console.aws.amazon.com/cloudwatch/home?region=${region}#lambda-insights:functions/${functionName}`;
16
+ };
17
+ exports.getLambdaInsightsUrl = getLambdaInsightsUrl;
18
+ const getCloudwatchRendererUrl = ({ region, functionName, renderId, rendererFunctionName, chunk }) => {
19
+ const functionNameToUse = rendererFunctionName !== null && rendererFunctionName !== void 0 ? rendererFunctionName : functionName;
20
+ const query = `"method=renderer,renderId=${renderId}${chunk === null ? '' : `,chunk=${chunk},`}"`;
21
+ return cloudWatchUrlWithQuery({ region, functionNameToUse, query });
22
+ };
23
+ exports.getCloudwatchRendererUrl = getCloudwatchRendererUrl;
24
+ const getS3RenderUrl = ({ renderId, region, bucketName, }) => {
25
+ return `https://s3.console.aws.amazon.com/s3/buckets/${bucketName}?region=${region}&prefix=renders/${renderId}/`;
26
+ };
27
+ exports.getS3RenderUrl = getS3RenderUrl;
28
+ const getProgressJsonUrl = ({ region, bucketName, renderId, }) => {
29
+ return `https://${region}.console.aws.amazon.com/s3/object/${bucketName}?region=${region}&bucketType=general&prefix=renders/${renderId}/progress.json`;
30
+ };
31
+ exports.getProgressJsonUrl = getProgressJsonUrl;
@@ -0,0 +1,9 @@
1
+ import type { ProviderSpecifics } from '@remotion/serverless-client';
2
+ import type { AwsProvider } from './aws-provider';
3
+ import type { AwsRegion } from './regions';
4
+ export type BucketWithLocation = {
5
+ name: string;
6
+ creationDate: number;
7
+ region: AwsRegion;
8
+ };
9
+ export declare const getRemotionBuckets: ProviderSpecifics<AwsProvider>['getBuckets'];
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRemotionBuckets = void 0;
4
+ const client_s3_1 = require("@aws-sdk/client-s3");
5
+ const constants_1 = require("./constants");
6
+ const get_s3_client_1 = require("./get-s3-client");
7
+ const validate_bucketname_1 = require("./validate-bucketname");
8
+ const getRemotionBuckets = async ({ region, forceBucketName, forcePathStyle, requestHandler, }) => {
9
+ const { Buckets } = await (0, get_s3_client_1.getS3Client)({
10
+ region,
11
+ customCredentials: null,
12
+ forcePathStyle,
13
+ requestHandler,
14
+ }).send(new client_s3_1.ListBucketsCommand({}));
15
+ if (!Buckets) {
16
+ return [];
17
+ }
18
+ const remotionBuckets = Buckets.filter((b) => {
19
+ var _a;
20
+ if (forceBucketName) {
21
+ return b.Name === forceBucketName;
22
+ }
23
+ return (_a = b.Name) === null || _a === void 0 ? void 0 : _a.startsWith(constants_1.REMOTION_BUCKET_PREFIX);
24
+ });
25
+ const locations = await Promise.all(remotionBuckets.map(async (bucket) => {
26
+ var _a, _b;
27
+ const { region: parsedRegion } = (0, validate_bucketname_1.parseBucketName)(bucket.Name);
28
+ if (parsedRegion) {
29
+ return parsedRegion;
30
+ }
31
+ try {
32
+ const result = await (0, get_s3_client_1.getS3Client)({
33
+ region,
34
+ customCredentials: null,
35
+ forcePathStyle,
36
+ requestHandler,
37
+ }).send(new client_s3_1.GetBucketLocationCommand({
38
+ Bucket: bucket.Name,
39
+ }));
40
+ // AWS docs: Buckets in Region us-east-1 have a LocationConstraint of null!!
41
+ return (_a = result.LocationConstraint) !== null && _a !== void 0 ? _a : 'us-east-1';
42
+ }
43
+ catch (err) {
44
+ // Sometimes the API returns a bucket even if it was deleted before
45
+ if ((_b = err.stack) === null || _b === void 0 ? void 0 : _b.includes('NoSuchBucket')) {
46
+ return null;
47
+ }
48
+ throw err;
49
+ }
50
+ }));
51
+ const bucketsWithLocation = remotionBuckets
52
+ .map((bucket, i) => {
53
+ return {
54
+ creationDate: bucket.CreationDate.getTime(),
55
+ name: bucket.Name,
56
+ region: locations[i],
57
+ };
58
+ })
59
+ .filter((b) => b.region);
60
+ return bucketsWithLocation.filter((bucket) => {
61
+ return bucket.region === region;
62
+ });
63
+ };
64
+ exports.getRemotionBuckets = getRemotionBuckets;
@@ -0,0 +1,20 @@
1
+ import type { BrowserSafeApis, ChromiumOptions, ToOptions, VideoConfig } from '@remotion/serverless-client';
2
+ import type { AwsRegion } from './regions';
3
+ import type { RequestHandler } from './types';
4
+ export type GetCompositionsOnLambdaInput = {
5
+ chromiumOptions?: ChromiumOptions;
6
+ region: AwsRegion;
7
+ inputProps: Record<string, unknown>;
8
+ functionName: string;
9
+ serveUrl: string;
10
+ envVariables?: Record<string, string>;
11
+ forceBucketName?: string;
12
+ /**
13
+ * @deprecated in favor of `logLevel`: true
14
+ */
15
+ dumpBrowserLogs?: boolean;
16
+ forcePathStyle?: boolean;
17
+ requestHandler?: RequestHandler | null;
18
+ } & Partial<ToOptions<typeof BrowserSafeApis.optionsMap.getCompositionsOnLambda>>;
19
+ export type GetCompositionsOnLambdaOutput = VideoConfig[];
20
+ export declare const getCompositionsOnLambda: ({ chromiumOptions, serveUrl, region, inputProps, functionName, envVariables, logLevel, timeoutInMilliseconds, forceBucketName: bucketName, dumpBrowserLogs, offthreadVideoCacheSizeInBytes, forcePathStyle, requestHandler, mediaCacheSizeInBytes, }: GetCompositionsOnLambdaInput) => Promise<GetCompositionsOnLambdaOutput>;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCompositionsOnLambda = void 0;
4
+ const serverless_client_1 = require("@remotion/serverless-client");
5
+ const aws_provider_1 = require("./aws-provider");
6
+ /*
7
+ * @description Gets the compositions inside a Lambda function.
8
+ * @see [Documentation](https://remotion.dev/docs/lambda/getcompositionsonlambda)
9
+ */
10
+ const getCompositionsOnLambda = async ({ chromiumOptions, serveUrl, region, inputProps, functionName, envVariables, logLevel, timeoutInMilliseconds, forceBucketName: bucketName, dumpBrowserLogs, offthreadVideoCacheSizeInBytes, forcePathStyle, requestHandler, mediaCacheSizeInBytes, }) => {
11
+ var _a;
12
+ const stringifiedInputProps = (0, serverless_client_1.serializeOrThrow)(inputProps, 'input-props');
13
+ const serializedInputProps = await (0, serverless_client_1.compressInputProps)({
14
+ stringifiedInputProps,
15
+ region,
16
+ userSpecifiedBucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
17
+ propsType: 'input-props',
18
+ needsToUpload: (0, serverless_client_1.getNeedsToUpload)({
19
+ type: 'video-or-audio',
20
+ sizes: [
21
+ stringifiedInputProps.length,
22
+ JSON.stringify(envVariables).length,
23
+ ],
24
+ providerSpecifics: aws_provider_1.awsImplementation,
25
+ }),
26
+ providerSpecifics: aws_provider_1.awsImplementation,
27
+ forcePathStyle: forcePathStyle !== null && forcePathStyle !== void 0 ? forcePathStyle : false,
28
+ skipPutAcl: false,
29
+ requestHandler,
30
+ });
31
+ try {
32
+ const res = await aws_provider_1.awsImplementation.callFunctionSync({
33
+ functionName,
34
+ type: serverless_client_1.ServerlessRoutines.compositions,
35
+ payload: {
36
+ type: serverless_client_1.ServerlessRoutines.compositions,
37
+ chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
38
+ serveUrl,
39
+ envVariables,
40
+ inputProps: serializedInputProps,
41
+ logLevel: dumpBrowserLogs ? 'verbose' : (logLevel !== null && logLevel !== void 0 ? logLevel : 'info'),
42
+ timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : 30000,
43
+ version: serverless_client_1.VERSION,
44
+ bucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
45
+ offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes !== null && offthreadVideoCacheSizeInBytes !== void 0 ? offthreadVideoCacheSizeInBytes : null,
46
+ forcePathStyle: forcePathStyle !== null && forcePathStyle !== void 0 ? forcePathStyle : false,
47
+ mediaCacheSizeInBytes: mediaCacheSizeInBytes !== null && mediaCacheSizeInBytes !== void 0 ? mediaCacheSizeInBytes : null,
48
+ },
49
+ region,
50
+ timeoutInTest: 120000,
51
+ requestHandler,
52
+ });
53
+ return res.compositions;
54
+ }
55
+ catch (err) {
56
+ if ((_a = err.stack) === null || _a === void 0 ? void 0 : _a.includes('UnrecognizedClientException')) {
57
+ 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');
58
+ }
59
+ throw err;
60
+ }
61
+ };
62
+ exports.getCompositionsOnLambda = getCompositionsOnLambda;
@@ -0,0 +1,9 @@
1
+ import { fromIni } from '@aws-sdk/credential-provider-ini';
2
+ type CredentialPair = {
3
+ accessKeyId: string;
4
+ secretAccessKey: string;
5
+ sessionToken?: string;
6
+ };
7
+ type AwsCredentialIdentityProvider = ReturnType<typeof fromIni>;
8
+ export declare const getCredentials: () => CredentialPair | AwsCredentialIdentityProvider | undefined;
9
+ export {};