@remotion/lambda 4.0.0-umungobongo.5 → 4.0.0-webhook.26

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 (99) hide show
  1. package/dist/admin/make-layer-public.js +5 -5
  2. package/dist/api/bucket-exists.js +1 -1
  3. package/dist/api/clean-items.js +1 -1
  4. package/dist/api/create-bucket.js +1 -1
  5. package/dist/api/delete-render.d.ts +19 -0
  6. package/dist/api/delete-render.js +66 -0
  7. package/dist/api/delete-site.js +0 -5
  8. package/dist/api/deploy-function.js +4 -2
  9. package/dist/api/deploy-site.d.ts +2 -0
  10. package/dist/api/deploy-site.js +2 -0
  11. package/dist/api/download-media.d.ts +13 -0
  12. package/dist/api/download-media.js +15 -3
  13. package/dist/api/enable-s3-website.js +1 -1
  14. package/dist/api/get-aws-client.d.ts +4 -2
  15. package/dist/api/get-aws-client.js +7 -2
  16. package/dist/api/get-buckets.js +2 -2
  17. package/dist/api/get-function-info.d.ts +1 -2
  18. package/dist/api/get-functions.js +2 -1
  19. package/dist/api/get-render-progress.d.ts +4 -1
  20. package/dist/api/get-render-progress.js +5 -1
  21. package/dist/api/mock-functions.d.ts +4 -5
  22. package/dist/api/presign-url.js +6 -1
  23. package/dist/api/render-media-on-lambda.d.ts +18 -10
  24. package/dist/api/render-media-on-lambda.js +65 -40
  25. package/dist/api/render-still-on-lambda.d.ts +1 -0
  26. package/dist/api/render-still-on-lambda.js +48 -30
  27. package/dist/api/upload-dir.js +1 -1
  28. package/dist/api/validate-webhook-signature.d.ts +13 -0
  29. package/dist/api/validate-webhook-signature.js +32 -0
  30. package/dist/cli/args.d.ts +2 -0
  31. package/dist/cli/commands/functions/deploy.js +2 -1
  32. package/dist/cli/commands/render/render.js +24 -15
  33. package/dist/cli/commands/still.js +20 -16
  34. package/dist/cli/get-aws-region.js +2 -1
  35. package/dist/cli/helpers/determine-image-format.d.ts +10 -0
  36. package/dist/cli/helpers/determine-image-format.js +47 -0
  37. package/dist/cli/helpers/find-function-name.js +3 -2
  38. package/dist/cli/helpers/webhook-types.d.ts +6 -0
  39. package/dist/cli/helpers/webhook-types.js +2 -0
  40. package/dist/cli/index.js +1 -1
  41. package/dist/client.d.ts +4 -2
  42. package/dist/client.js +3 -1
  43. package/dist/functions/chunk-optimization/can-use-optimization.js +2 -2
  44. package/dist/functions/chunk-optimization/s3-optimization-file.js +1 -0
  45. package/dist/functions/chunk-optimization/types.d.ts +1 -2
  46. package/dist/functions/helpers/check-if-render-exists.d.ts +3 -0
  47. package/dist/functions/helpers/check-if-render-exists.js +14 -0
  48. package/dist/functions/helpers/expected-out-name.d.ts +4 -2
  49. package/dist/functions/helpers/expected-out-name.js +26 -5
  50. package/dist/functions/helpers/find-output-file-in-bucket.d.ts +3 -1
  51. package/dist/functions/helpers/find-output-file-in-bucket.js +17 -13
  52. package/dist/functions/helpers/get-custom-out-name.d.ts +6 -0
  53. package/dist/functions/helpers/get-custom-out-name.js +31 -0
  54. package/dist/functions/helpers/get-files-to-delete.js +1 -1
  55. package/dist/functions/helpers/get-lambdas-invoked-stats.js +1 -1
  56. package/dist/functions/helpers/get-output-url-from-metadata.d.ts +2 -1
  57. package/dist/functions/helpers/get-output-url-from-metadata.js +2 -2
  58. package/dist/functions/helpers/get-progress.d.ts +4 -2
  59. package/dist/functions/helpers/get-progress.js +13 -6
  60. package/dist/functions/helpers/get-retry-stats.js +1 -1
  61. package/dist/functions/helpers/io.d.ts +17 -1
  62. package/dist/functions/helpers/io.js +21 -6
  63. package/dist/functions/helpers/read-with-progress.d.ts +3 -1
  64. package/dist/functions/helpers/read-with-progress.js +2 -2
  65. package/dist/functions/helpers/write-lambda-error.d.ts +1 -1
  66. package/dist/functions/helpers/write-lambda-error.js +1 -0
  67. package/dist/functions/helpers/write-post-render-data.js +1 -0
  68. package/dist/functions/index.js +4 -4
  69. package/dist/functions/info.d.ts +2 -2
  70. package/dist/functions/info.js +2 -1
  71. package/dist/functions/launch.js +206 -13
  72. package/dist/functions/progress.d.ts +1 -1
  73. package/dist/functions/progress.js +10 -1
  74. package/dist/functions/renderer.js +104 -74
  75. package/dist/functions/start.d.ts +5 -1
  76. package/dist/functions/start.js +23 -1
  77. package/dist/functions/still.js +17 -4
  78. package/dist/index.d.ts +6 -2
  79. package/dist/index.js +5 -1
  80. package/dist/shared/aws-clients.d.ts +13 -2
  81. package/dist/shared/aws-clients.js +56 -26
  82. package/dist/shared/bundle-site.d.ts +2 -1
  83. package/dist/shared/constants.d.ts +31 -6
  84. package/dist/shared/constants.js +14 -7
  85. package/dist/shared/get-cloudwatch-stream-url.d.ts +8 -0
  86. package/dist/shared/get-cloudwatch-stream-url.js +7 -0
  87. package/dist/shared/get-function-version.d.ts +1 -2
  88. package/dist/shared/hosted-layers.js +60 -60
  89. package/dist/shared/invoke-webhook.d.ts +59 -0
  90. package/dist/shared/invoke-webhook.js +103 -0
  91. package/dist/shared/is-in-lambda.js +5 -1
  92. package/dist/shared/lambda-version-string.d.ts +1 -0
  93. package/dist/shared/lambda-version-string.js +7 -0
  94. package/dist/shared/validate-frames-per-lambda.d.ts +4 -1
  95. package/dist/shared/validate-frames-per-lambda.js +4 -3
  96. package/dist/shared/validate-outname.d.ts +3 -2
  97. package/dist/shared/validate-outname.js +5 -1
  98. package/package.json +9 -9
  99. package/remotionlambda.zip +0 -0
@@ -2,20 +2,38 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.startHandler = void 0;
4
4
  const client_lambda_1 = require("@aws-sdk/client-lambda");
5
+ const version_1 = require("remotion/version");
5
6
  const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
6
7
  const aws_clients_1 = require("../shared/aws-clients");
7
8
  const constants_1 = require("../shared/constants");
8
9
  const random_hash_1 = require("../shared/random-hash");
9
10
  const get_current_region_1 = require("./helpers/get-current-region");
10
- const startHandler = async (params) => {
11
+ const io_1 = require("./helpers/io");
12
+ const startHandler = async (params, options) => {
11
13
  var _a;
12
14
  if (params.type !== constants_1.LambdaRoutines.start) {
13
15
  throw new TypeError('Expected type start');
14
16
  }
17
+ if (params.version !== version_1.VERSION) {
18
+ if (!params.version) {
19
+ throw new Error(`Version mismatch: When calling renderMediaOnLambda(), the deployed Lambda function had version ${version_1.VERSION} but the @remotion/lambda package is an older version. Align the versions.`);
20
+ }
21
+ throw new Error(`Version mismatch: When calling renderMediaOnLambda(), get deployed Lambda function had version ${version_1.VERSION} and the @remotion/lambda package has version ${params.version}. Align the versions.`);
22
+ }
15
23
  const { bucketName } = await (0, get_or_create_bucket_1.getOrCreateBucket)({
16
24
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
17
25
  });
18
26
  const renderId = (0, random_hash_1.randomHash)({ randomInTests: true });
27
+ const initialFile = (0, io_1.lambdaWriteFile)({
28
+ bucketName,
29
+ downloadBehavior: null,
30
+ region: (0, get_current_region_1.getCurrentRegionInFunction)(),
31
+ body: 'Render was initialized',
32
+ expectedBucketOwner: options.expectedBucketOwner,
33
+ key: (0, constants_1.initalizedMetadataKey)(renderId),
34
+ privacy: 'private',
35
+ customCredentials: null,
36
+ });
19
37
  const payload = {
20
38
  type: constants_1.LambdaRoutines.launch,
21
39
  framesPerLambda: params.framesPerLambda,
@@ -43,6 +61,9 @@ const startHandler = async (params) => {
43
61
  everyNthFrame: params.everyNthFrame,
44
62
  concurrencyPerLambda: params.concurrencyPerLambda,
45
63
  downloadBehavior: params.downloadBehavior,
64
+ muted: params.muted,
65
+ overwrite: params.overwrite,
66
+ webhook: params.webhook,
46
67
  };
47
68
  await (0, aws_clients_1.getLambdaClient)((0, get_current_region_1.getCurrentRegionInFunction)()).send(new client_lambda_1.InvokeCommand({
48
69
  FunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
@@ -50,6 +71,7 @@ const startHandler = async (params) => {
50
71
  Payload: JSON.stringify(payload),
51
72
  InvocationType: 'Event',
52
73
  }));
74
+ await initialFile;
53
75
  return {
54
76
  bucketName,
55
77
  renderId,
@@ -8,6 +8,7 @@ const client_lambda_1 = require("@aws-sdk/client-lambda");
8
8
  const renderer_1 = require("@remotion/renderer");
9
9
  const fs_1 = __importDefault(require("fs"));
10
10
  const path_1 = __importDefault(require("path"));
11
+ const version_1 = require("remotion/version");
11
12
  const estimate_price_1 = require("../api/estimate-price");
12
13
  const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
13
14
  const aws_clients_1 = require("../shared/aws-clients");
@@ -31,6 +32,12 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
31
32
  if (lambdaParams.type !== constants_1.LambdaRoutines.still) {
32
33
  throw new TypeError('Expected still type');
33
34
  }
35
+ if (lambdaParams.version !== version_1.VERSION) {
36
+ if (!lambdaParams.version) {
37
+ throw new Error(`Version mismatch: When calling renderStillOnLambda(), the deployed Lambda function had version ${version_1.VERSION} but the @remotion/lambda package is an older version. Align the versions.`);
38
+ }
39
+ throw new Error(`Version mismatch: When calling renderStillOnLambda(), get deployed Lambda function had version ${version_1.VERSION} and the @remotion/lambda package has version ${lambdaParams.version}. Align the versions.`);
40
+ }
34
41
  (0, validate_download_behavior_1.validateDownloadBehavior)(lambdaParams.downloadBehavior);
35
42
  (0, validate_privacy_1.validatePrivacy)(lambdaParams.privacy);
36
43
  (0, validate_outname_1.validateOutname)(lambdaParams.outName);
@@ -70,12 +77,13 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
70
77
  usesOptimizationProfile: false,
71
78
  imageFormat: lambdaParams.imageFormat,
72
79
  inputProps: lambdaParams.inputProps,
73
- lambdaVersion: constants_1.CURRENT_VERSION,
80
+ lambdaVersion: version_1.VERSION,
74
81
  framesPerLambda: 1,
75
82
  memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
76
83
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
77
84
  renderId,
78
85
  outName: (_b = lambdaParams.outName) !== null && _b !== void 0 ? _b : undefined,
86
+ privacy: lambdaParams.privacy,
79
87
  };
80
88
  await (0, io_1.lambdaWriteFile)({
81
89
  bucketName,
@@ -85,6 +93,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
85
93
  privacy: 'private',
86
94
  expectedBucketOwner: options.expectedBucketOwner,
87
95
  downloadBehavior: null,
96
+ customCredentials: null,
88
97
  });
89
98
  await (0, renderer_1.renderStill)({
90
99
  composition,
@@ -92,7 +101,10 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
92
101
  serveUrl: lambdaParams.serveUrl,
93
102
  dumpBrowserLogs: false,
94
103
  envVariables: lambdaParams.envVariables,
95
- frame: lambdaParams.frame,
104
+ frame: renderer_1.RenderInternals.convertToPositiveFrameIndex({
105
+ frame: lambdaParams.frame,
106
+ durationInFrames: composition.durationInFrames,
107
+ }),
96
108
  imageFormat: lambdaParams.imageFormat,
97
109
  inputProps: lambdaParams.inputProps,
98
110
  overwrite: false,
@@ -103,7 +115,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
103
115
  timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
104
116
  downloadMap,
105
117
  });
106
- const { key, renderBucketName } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, bucketName);
118
+ const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, bucketName, (0, expected_out_name_1.getCredentialsFromOutName)(lambdaParams.outName));
107
119
  const { size } = await fs_1.default.promises.stat(outputPath);
108
120
  await (0, io_1.lambdaWriteFile)({
109
121
  bucketName: renderBucketName,
@@ -113,6 +125,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
113
125
  expectedBucketOwner: options.expectedBucketOwner,
114
126
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
115
127
  downloadBehavior: lambdaParams.downloadBehavior,
128
+ customCredentials,
116
129
  });
117
130
  await fs_1.default.promises.rm(outputPath, { recursive: true });
118
131
  const estimatedPrice = (0, estimate_price_1.estimatePrice)({
@@ -126,7 +139,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
126
139
  diskSizeInMb: constants_1.MAX_EPHEMERAL_STORAGE_IN_MB,
127
140
  });
128
141
  return {
129
- output: (0, get_output_url_from_metadata_1.getOutputUrlFromMetadata)(renderMetadata, bucketName),
142
+ output: (0, get_output_url_from_metadata_1.getOutputUrlFromMetadata)(renderMetadata, bucketName, customCredentials),
130
143
  size,
131
144
  bucketName,
132
145
  estimatedPrice: (0, format_costs_info_1.formatCostsInfo)(estimatedPrice),
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { DeleteFunctionInput } from './api/delete-function';
2
2
  import { deleteFunction } from './api/delete-function';
3
+ import { deleteRender } from './api/delete-render';
3
4
  import type { DeleteSiteInput, DeleteSiteOutput } from './api/delete-site';
4
5
  import { deleteSite } from './api/delete-site';
5
6
  import type { DeployFunctionInput, DeployFunctionOutput } from './api/deploy-function';
@@ -31,10 +32,13 @@ import type { RenderMediaOnLambdaInput, RenderMediaOnLambdaOutput } from './api/
31
32
  import { renderMediaOnLambda, renderVideoOnLambda } from './api/render-media-on-lambda';
32
33
  import type { RenderStillOnLambdaInput, RenderStillOnLambdaOutput } from './api/render-still-on-lambda';
33
34
  import { renderStillOnLambda } from './api/render-still-on-lambda';
35
+ import { validateWebhookSignature } from './api/validate-webhook-signature';
34
36
  import type { LambdaLSInput, LambdaLsReturnType } from './functions/helpers/io';
35
37
  import { LambdaInternals } from './internals';
36
38
  import type { AwsRegion } from './pricing/aws-regions';
39
+ import type { CustomCredentials } from './shared/aws-clients';
37
40
  import type { RenderProgress } from './shared/constants';
41
+ import type { WebhookPayload } from './shared/invoke-webhook';
38
42
  import type { LambdaArchitecture } from './shared/validate-architecture';
39
- export { deleteSite, deployFunction, deploySite, downloadMedia, downloadVideo, getFunctions, getUserPolicy, getRolePolicy, getSites, getOrCreateBucket, getRenderProgress, renderVideoOnLambda, renderMediaOnLambda, simulatePermissions, deleteFunction, getFunctionInfo, estimatePrice, LambdaInternals, renderStillOnLambda, getRegions, getAwsClient, presignUrl, };
40
- 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, };
43
+ 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, };
44
+ 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, };
package/dist/index.js CHANGED
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- 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.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
+ const delete_render_1 = require("./api/delete-render");
7
+ Object.defineProperty(exports, "deleteRender", { enumerable: true, get: function () { return delete_render_1.deleteRender; } });
6
8
  const delete_site_1 = require("./api/delete-site");
7
9
  Object.defineProperty(exports, "deleteSite", { enumerable: true, get: function () { return delete_site_1.deleteSite; } });
8
10
  const deploy_function_1 = require("./api/deploy-function");
@@ -40,5 +42,7 @@ Object.defineProperty(exports, "renderMediaOnLambda", { enumerable: true, get: f
40
42
  Object.defineProperty(exports, "renderVideoOnLambda", { enumerable: true, get: function () { return render_media_on_lambda_1.renderVideoOnLambda; } });
41
43
  const render_still_on_lambda_1 = require("./api/render-still-on-lambda");
42
44
  Object.defineProperty(exports, "renderStillOnLambda", { enumerable: true, get: function () { return render_still_on_lambda_1.renderStillOnLambda; } });
45
+ const validate_webhook_signature_1 = require("./api/validate-webhook-signature");
46
+ Object.defineProperty(exports, "validateWebhookSignature", { enumerable: true, get: function () { return validate_webhook_signature_1.validateWebhookSignature; } });
43
47
  const internals_1 = require("./internals");
44
48
  Object.defineProperty(exports, "LambdaInternals", { enumerable: true, get: function () { return internals_1.LambdaInternals; } });
@@ -11,9 +11,20 @@ export declare type ServiceMapping = {
11
11
  lambda: LambdaClient;
12
12
  servicequotas: ServiceQuotasClient;
13
13
  };
14
- export declare const getServiceClient: <T extends keyof ServiceMapping>(region: AwsRegion, service: T) => ServiceMapping[T];
14
+ export declare type CustomCredentialsWithoutSensitiveData = {
15
+ endpoint: string;
16
+ };
17
+ export declare type CustomCredentials = CustomCredentialsWithoutSensitiveData & {
18
+ accessKeyId: string | null;
19
+ secretAccessKey: string | null;
20
+ };
21
+ export declare const getServiceClient: <T extends keyof ServiceMapping>({ region, service, customCredentials, }: {
22
+ region: AwsRegion;
23
+ service: T;
24
+ customCredentials: CustomCredentials | null;
25
+ }) => ServiceMapping[T];
15
26
  export declare const getCloudWatchLogsClient: (region: AwsRegion) => CloudWatchLogsClient;
16
- export declare const getS3Client: (region: AwsRegion) => S3Client;
27
+ export declare const getS3Client: (region: AwsRegion, customCredentials: CustomCredentials | null) => S3Client;
17
28
  export declare const getLambdaClient: (region: AwsRegion) => LambdaClient;
18
29
  export declare const getIamClient: (region: AwsRegion) => IAMClient;
19
30
  export declare const getServiceQuotasClient: (region: AwsRegion) => ServiceQuotasClient;
@@ -28,11 +28,17 @@ const getCredentials = () => {
28
28
  }
29
29
  return undefined;
30
30
  };
31
- const getCredentialsKey = () => JSON.stringify(getCredentials());
32
- const getServiceClient = (region, service) => {
33
- if (!_clients[region]) {
34
- _clients[region] = {};
35
- }
31
+ const getKey = ({ credentials, customCredentials, region, service, }) => [
32
+ credentials === null || credentials === void 0 ? void 0 : credentials.accessKeyId,
33
+ credentials === null || credentials === void 0 ? void 0 : credentials.secretAccessKey,
34
+ customCredentials === null || customCredentials === void 0 ? void 0 : customCredentials.accessKeyId,
35
+ customCredentials === null || customCredentials === void 0 ? void 0 : customCredentials.endpoint,
36
+ customCredentials === null || customCredentials === void 0 ? void 0 : customCredentials.secretAccessKey,
37
+ region,
38
+ service,
39
+ ].join('-');
40
+ const getServiceClient = ({ region, service, customCredentials, }) => {
41
+ var _a;
36
42
  const Client = (() => {
37
43
  if (service === 'cloudwatch') {
38
44
  return client_cloudwatch_logs_1.CloudWatchLogsClient;
@@ -49,43 +55,67 @@ const getServiceClient = (region, service) => {
49
55
  if (service === 'servicequotas') {
50
56
  return client_service_quotas_1.ServiceQuotasClient;
51
57
  }
58
+ throw new TypeError('unknown client ' + service);
52
59
  })();
53
- const key = getCredentialsKey();
54
- // @ts-expect-error
55
- if (!_clients[region][key]) {
56
- // @ts-expect-error
57
- _clients[region][key] = {};
58
- }
59
- // @ts-expect-error
60
- if (!_clients[region][key][service]) {
60
+ const key = getKey({
61
+ credentials: (_a = getCredentials()) !== null && _a !== void 0 ? _a : null,
62
+ region,
63
+ customCredentials,
64
+ service,
65
+ });
66
+ if (!_clients[key]) {
61
67
  (0, check_credentials_1.checkCredentials)();
62
- // @ts-expect-error
63
- _clients[region][key][service] = new Client({
64
- region,
65
- credentials: getCredentials(),
66
- });
68
+ if (customCredentials) {
69
+ _clients[key] = new Client({
70
+ region: 'us-east-1',
71
+ credentials: customCredentials.accessKeyId && customCredentials.secretAccessKey
72
+ ? {
73
+ accessKeyId: customCredentials.accessKeyId,
74
+ secretAccessKey: customCredentials.secretAccessKey,
75
+ }
76
+ : undefined,
77
+ endpoint: customCredentials.endpoint,
78
+ });
79
+ }
80
+ else {
81
+ _clients[key] = new Client({
82
+ region,
83
+ credentials: getCredentials(),
84
+ });
85
+ }
67
86
  }
68
- // @ts-expect-error
69
- return _clients[region][key][service];
87
+ return _clients[key];
70
88
  };
71
89
  exports.getServiceClient = getServiceClient;
72
90
  const getCloudWatchLogsClient = (region) => {
73
- return (0, exports.getServiceClient)(region, 'cloudwatch');
91
+ return (0, exports.getServiceClient)({
92
+ region,
93
+ service: 'cloudwatch',
94
+ customCredentials: null,
95
+ });
74
96
  };
75
97
  exports.getCloudWatchLogsClient = getCloudWatchLogsClient;
76
- const getS3Client = (region) => {
77
- return (0, exports.getServiceClient)(region, 's3');
98
+ const getS3Client = (region, customCredentials) => {
99
+ return (0, exports.getServiceClient)({ region, service: 's3', customCredentials });
78
100
  };
79
101
  exports.getS3Client = getS3Client;
80
102
  const getLambdaClient = (region) => {
81
- return (0, exports.getServiceClient)(region, 'lambda');
103
+ return (0, exports.getServiceClient)({
104
+ region,
105
+ service: 'lambda',
106
+ customCredentials: null,
107
+ });
82
108
  };
83
109
  exports.getLambdaClient = getLambdaClient;
84
110
  const getIamClient = (region) => {
85
- return (0, exports.getServiceClient)(region, 'iam');
111
+ return (0, exports.getServiceClient)({ region, service: 'iam', customCredentials: null });
86
112
  };
87
113
  exports.getIamClient = getIamClient;
88
114
  const getServiceQuotasClient = (region) => {
89
- return (0, exports.getServiceClient)(region, 'servicequotas');
115
+ return (0, exports.getServiceClient)({
116
+ region,
117
+ service: 'servicequotas',
118
+ customCredentials: null,
119
+ });
90
120
  };
91
121
  exports.getServiceQuotasClient = getServiceQuotasClient;
@@ -1 +1,2 @@
1
- export declare const bundleSite: (entryPoint: string, onProgressUpdate?: ((progress: number) => void) | undefined, options?: import("@remotion/bundler").BundleOptions | undefined) => Promise<string>;
1
+ import { bundle } from '@remotion/bundler';
2
+ export declare const bundleSite: typeof bundle;
@@ -3,6 +3,7 @@ import type { VideoConfig } from 'remotion';
3
3
  import type { ChunkRetry } from '../functions/helpers/get-retry-stats';
4
4
  import type { EnhancedErrorInfo } from '../functions/helpers/write-lambda-error';
5
5
  import type { AwsRegion } from '../pricing/aws-regions';
6
+ import type { CustomCredentials, CustomCredentialsWithoutSensitiveData } from './aws-clients';
6
7
  import type { DownloadBehavior } from './content-disposition-header';
7
8
  import type { ExpensiveChunk } from './get-most-expensive-chunks';
8
9
  import type { LambdaArchitecture } from './validate-architecture';
@@ -32,8 +33,9 @@ export declare const LOG_GROUP_PREFIX = "/aws/lambda/";
32
33
  export declare const rendersPrefix: (renderId: string) => string;
33
34
  export declare const encodingProgressKey: (renderId: string) => string;
34
35
  export declare const renderMetadataKey: (renderId: string) => string;
35
- export declare const lambdaInitializedPrefix: (renderId: string) => string;
36
- export declare const lambdaInitializedKey: ({ renderId, chunk, attempt, }: {
36
+ export declare const initalizedMetadataKey: (renderId: string) => string;
37
+ export declare const lambdaChunkInitializedPrefix: (renderId: string) => string;
38
+ export declare const lambdaChunkInitializedKey: ({ renderId, chunk, attempt, }: {
37
39
  attempt: number;
38
40
  renderId: string;
39
41
  chunk: number;
@@ -61,10 +63,17 @@ export declare const getErrorFileName: ({ renderId, chunk, attempt, }: {
61
63
  export declare type OutNameInput = string | {
62
64
  bucketName: string;
63
65
  key: string;
66
+ s3OutputProvider?: CustomCredentials;
67
+ };
68
+ export declare type OutNameInputWithoutCredentials = string | {
69
+ bucketName: string;
70
+ key: string;
71
+ s3OutputProvider?: CustomCredentialsWithoutSensitiveData;
64
72
  };
65
73
  export declare type OutNameOutput = {
66
74
  renderBucketName: string;
67
75
  key: string;
76
+ customCredentials: CustomCredentials | null;
68
77
  };
69
78
  export declare const optimizationProfile: (siteId: string, compositionId: string) => string;
70
79
  export declare const getSitesKey: (siteId: string) => string;
@@ -113,6 +122,13 @@ export declare type LambdaPayloads = {
113
122
  numberOfGifLoops: number | null;
114
123
  concurrencyPerLambda: number;
115
124
  downloadBehavior: DownloadBehavior;
125
+ muted: boolean;
126
+ version: string;
127
+ overwrite: boolean;
128
+ webhook: null | {
129
+ url: string;
130
+ secret: string | null;
131
+ };
116
132
  };
117
133
  launch: {
118
134
  type: LambdaRoutines.launch;
@@ -141,11 +157,19 @@ export declare type LambdaPayloads = {
141
157
  numberOfGifLoops: number | null;
142
158
  concurrencyPerLambda: number;
143
159
  downloadBehavior: DownloadBehavior;
160
+ muted: boolean;
161
+ overwrite: boolean;
162
+ webhook: null | {
163
+ url: string;
164
+ secret: string | null;
165
+ };
144
166
  };
145
167
  status: {
146
168
  type: LambdaRoutines.status;
147
169
  bucketName: string;
148
170
  renderId: string;
171
+ version: string;
172
+ s3OutputProvider?: CustomCredentials;
149
173
  };
150
174
  renderer: {
151
175
  concurrencyPerLambda: number;
@@ -176,6 +200,7 @@ export declare type LambdaPayloads = {
176
200
  chromiumOptions: ChromiumOptions;
177
201
  scale: number;
178
202
  everyNthFrame: number;
203
+ muted: boolean;
179
204
  };
180
205
  still: {
181
206
  type: LambdaRoutines.still;
@@ -195,6 +220,7 @@ export declare type LambdaPayloads = {
195
220
  chromiumOptions: ChromiumOptions;
196
221
  scale: number;
197
222
  downloadBehavior: DownloadBehavior | null;
223
+ version: string;
198
224
  };
199
225
  };
200
226
  export declare type LambdaPayload = LambdaPayloads[LambdaRoutines];
@@ -219,13 +245,12 @@ export declare type RenderMetadata = {
219
245
  inputProps: unknown;
220
246
  framesPerLambda: number;
221
247
  memorySizeInMb: number;
222
- lambdaVersion: LambdaVersions;
248
+ lambdaVersion: string;
223
249
  region: AwsRegion;
224
250
  renderId: string;
225
- outName: OutNameInput | undefined;
251
+ outName: OutNameInputWithoutCredentials | undefined;
252
+ privacy: Privacy;
226
253
  };
227
- export declare type LambdaVersions = '2022-08-07' | '2022-08-06' | '2022-08-04' | '2022-08-02' | '2022-08-01' | '2022-07-28' | '2022-07-27' | '2022-07-25' | '2022-07-23' | '2022-07-20' | '2022-07-18' | '2022-07-15' | '2022-07-14' | '2022-07-12' | '2022-07-10' | '2022-07-09' | '2022-07-08' | '2022-07-04' | '2022-06-30' | '2022-06-29' | '2022-06-25' | '2022-06-22' | '2022-06-21' | '2022-06-14' | '2022-06-08' | '2022-06-07' | '2022-06-02' | '2022-05-31' | '2022-05-28' | '2022-05-27' | '2022-05-19' | '2022-05-16' | '2022-05-11' | '2022-05-07' | '2022-05-06' | '2022-05-03' | '2022-04-20' | '2022-04-19' | '2022-04-18' | '2022-04-09' | '2022-04-08' | '2022-04-05' | '2022-04-02' | '2022-03-29' | '2022-03-17' | '2022-03-02' | '2022-03-01' | '2022-02-27' | '2022-02-14' | '2022-02-12' | '2022-02-09' | '2022-02-08' | '2022-02-07' | '2022-02-06' | '2022-02-05' | '2022-02-04' | '2022-02-03' | '2022-01-23' | '2022-01-19' | '2022-01-11' | '2022-01-10' | '2022-01-09' | '2022-01-06' | '2022-01-05' | '2021-12-22' | '2021-12-17' | '2021-12-16' | '2021-12-15' | '2021-12-14' | '2021-12-13' | '2021-12-11' | '2021-12-10' | '2021-12-04' | '2021-11-29' | '2021-11-27' | '2021-11-24' | '2021-11-22' | '2021-11-19' | '2021-11-18' | '2021-11-15' | '2021-11-12' | '2021-11-10' | '2021-11-01' | '2021-10-29' | '2021-10-27' | '2021-10-21' | '2021-10-19' | '2021-10-07' | '2021-10-03' | '2021-10-01' | '2021-09-15' | '2021-09-06' | '2021-08-06' | '2021-07-14' | '2021-07-05' | '2021-07-02' | '2021-06-23' | 'n/a';
228
- export declare const CURRENT_VERSION: LambdaVersions;
229
254
  export declare type PostRenderData = {
230
255
  cost: {
231
256
  estimatedCost: number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LAMBDA_BURST_LIMIT_QUOTA = exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = exports.CURRENT_VERSION = exports.LambdaRoutines = exports.REMOTION_FILELIST_TOKEN = exports.REMOTION_CONCATED_TOKEN = exports.CONCAT_FOLDER_TOKEN = exports.RENDERER_PATH_TOKEN = exports.postRenderDataKey = exports.customOutName = exports.outStillName = exports.outName = exports.getSitesKey = exports.optimizationProfile = exports.getErrorFileName = exports.getErrorKeyPrefix = exports.chunkKeyForIndex = exports.chunkKey = exports.lambdaTimingsKey = exports.lambdaLogsPrefix = exports.lambdaTimingsPrefixForChunk = exports.lambdaTimingsPrefix = exports.lambdaInitializedKey = exports.lambdaInitializedPrefix = exports.renderMetadataKey = exports.encodingProgressKey = exports.rendersPrefix = exports.LOG_GROUP_PREFIX = exports.RENDER_FN_PREFIX = exports.REMOTION_BUCKET_PREFIX = exports.DEFAULT_CLOUDWATCH_RETENTION_PERIOD = exports.DEFAULT_OUTPUT_PRIVACY = exports.MAX_EPHEMERAL_STORAGE_IN_MB = exports.MIN_EPHEMERAL_STORAGE_IN_MB = exports.DEFAULT_EPHEMERAL_STORAGE_IN_MB = exports.MAX_FUNCTIONS_PER_RENDER = exports.DEFAULT_MAX_RETRIES = exports.DEFAULT_REGION = exports.COMMAND_NOT_FOUND = exports.BINARY_NAME = exports.DEFAULT_FRAMES_PER_LAMBDA = exports.MINIMUM_FRAMES_PER_LAMBDA = exports.MAX_TIMEOUT = exports.MIN_TIMEOUT = exports.DEFAULT_TIMEOUT = exports.DEFAULT_ARCHITECTURE = exports.DEFAULT_MEMORY_SIZE = exports.MAX_MEMORY = exports.MIN_MEMORY = void 0;
3
+ exports.LAMBDA_BURST_LIMIT_QUOTA = exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = exports.LambdaRoutines = exports.REMOTION_FILELIST_TOKEN = exports.REMOTION_CONCATED_TOKEN = exports.CONCAT_FOLDER_TOKEN = exports.RENDERER_PATH_TOKEN = exports.postRenderDataKey = exports.customOutName = exports.outStillName = exports.outName = exports.getSitesKey = exports.optimizationProfile = exports.getErrorFileName = exports.getErrorKeyPrefix = exports.chunkKeyForIndex = exports.chunkKey = exports.lambdaTimingsKey = exports.lambdaLogsPrefix = exports.lambdaTimingsPrefixForChunk = exports.lambdaTimingsPrefix = exports.lambdaChunkInitializedKey = exports.lambdaChunkInitializedPrefix = exports.initalizedMetadataKey = exports.renderMetadataKey = exports.encodingProgressKey = exports.rendersPrefix = exports.LOG_GROUP_PREFIX = exports.RENDER_FN_PREFIX = exports.REMOTION_BUCKET_PREFIX = exports.DEFAULT_CLOUDWATCH_RETENTION_PERIOD = exports.DEFAULT_OUTPUT_PRIVACY = exports.MAX_EPHEMERAL_STORAGE_IN_MB = exports.MIN_EPHEMERAL_STORAGE_IN_MB = exports.DEFAULT_EPHEMERAL_STORAGE_IN_MB = exports.MAX_FUNCTIONS_PER_RENDER = exports.DEFAULT_MAX_RETRIES = exports.DEFAULT_REGION = exports.COMMAND_NOT_FOUND = exports.BINARY_NAME = exports.DEFAULT_FRAMES_PER_LAMBDA = exports.MINIMUM_FRAMES_PER_LAMBDA = exports.MAX_TIMEOUT = exports.MIN_TIMEOUT = exports.DEFAULT_TIMEOUT = exports.DEFAULT_ARCHITECTURE = exports.DEFAULT_MEMORY_SIZE = exports.MAX_MEMORY = exports.MIN_MEMORY = void 0;
4
4
  exports.MIN_MEMORY = 512;
5
5
  exports.MAX_MEMORY = 10240;
6
6
  exports.DEFAULT_MEMORY_SIZE = 2048;
@@ -29,10 +29,12 @@ const encodingProgressKey = (renderId) => `${(0, exports.rendersPrefix)(renderId
29
29
  exports.encodingProgressKey = encodingProgressKey;
30
30
  const renderMetadataKey = (renderId) => `${(0, exports.rendersPrefix)(renderId)}/pre-render-metadata.json`;
31
31
  exports.renderMetadataKey = renderMetadataKey;
32
- const lambdaInitializedPrefix = (renderId) => `${(0, exports.rendersPrefix)(renderId)}/lambda-initialized`;
33
- exports.lambdaInitializedPrefix = lambdaInitializedPrefix;
34
- const lambdaInitializedKey = ({ renderId, chunk, attempt, }) => `${(0, exports.lambdaInitializedPrefix)(renderId)}-chunk:${chunk}-attempt:${attempt}.txt`;
35
- exports.lambdaInitializedKey = lambdaInitializedKey;
32
+ const initalizedMetadataKey = (renderId) => `${(0, exports.rendersPrefix)(renderId)}/initialized.txt`;
33
+ exports.initalizedMetadataKey = initalizedMetadataKey;
34
+ const lambdaChunkInitializedPrefix = (renderId) => `${(0, exports.rendersPrefix)(renderId)}/lambda-initialized`;
35
+ exports.lambdaChunkInitializedPrefix = lambdaChunkInitializedPrefix;
36
+ const lambdaChunkInitializedKey = ({ renderId, chunk, attempt, }) => `${(0, exports.lambdaChunkInitializedPrefix)(renderId)}-chunk:${chunk}-attempt:${attempt}.txt`;
37
+ exports.lambdaChunkInitializedKey = lambdaChunkInitializedKey;
36
38
  const lambdaTimingsPrefix = (renderId) => `${(0, exports.rendersPrefix)(renderId)}/lambda-timings/chunk:`;
37
39
  exports.lambdaTimingsPrefix = lambdaTimingsPrefix;
38
40
  const lambdaTimingsPrefixForChunk = (renderId, chunk) => (0, exports.lambdaTimingsPrefix)(renderId) + String(chunk).padStart(8, '0');
@@ -58,13 +60,19 @@ exports.outName = outName;
58
60
  const outStillName = (renderId, imageFormat) => `${(0, exports.rendersPrefix)(renderId)}/out.${imageFormat}`;
59
61
  exports.outStillName = outStillName;
60
62
  const customOutName = (renderId, bucketName, name) => {
63
+ var _a;
61
64
  if (typeof name === 'string') {
62
65
  return {
63
66
  renderBucketName: bucketName,
64
67
  key: `${(0, exports.rendersPrefix)(renderId)}/${name}`,
68
+ customCredentials: null,
65
69
  };
66
70
  }
67
- return { key: name.key, renderBucketName: name.bucketName };
71
+ return {
72
+ key: name.key,
73
+ renderBucketName: name.bucketName,
74
+ customCredentials: (_a = name.s3OutputProvider) !== null && _a !== void 0 ? _a : null,
75
+ };
68
76
  };
69
77
  exports.customOutName = customOutName;
70
78
  const postRenderDataKey = (renderId) => {
@@ -84,6 +92,5 @@ var LambdaRoutines;
84
92
  LambdaRoutines["renderer"] = "renderer";
85
93
  LambdaRoutines["still"] = "still";
86
94
  })(LambdaRoutines = exports.LambdaRoutines || (exports.LambdaRoutines = {}));
87
- exports.CURRENT_VERSION = '2022-08-07';
88
95
  exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = 'L-B99A9384';
89
96
  exports.LAMBDA_BURST_LIMIT_QUOTA = 'L-548AE339';
@@ -0,0 +1,8 @@
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;
@@ -0,0 +1,7 @@
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;
@@ -1,6 +1,5 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
- import type { LambdaVersions } from './constants';
3
2
  export declare const getFunctionVersion: ({ functionName, region, }: {
4
3
  functionName: string;
5
4
  region: AwsRegion;
6
- }) => Promise<LambdaVersions>;
5
+ }) => Promise<string>;