@remotion/lambda 4.0.0-copy.4 → 4.0.0-esm.17

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 (100) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/admin/bundle-lambda.js +20 -4
  3. package/dist/admin/generate-etag-list.d.ts +1 -0
  4. package/dist/admin/generate-etag-list.js +14 -0
  5. package/dist/admin/make-layer-public.js +23 -1
  6. package/dist/api/deploy-function.js +3 -1
  7. package/dist/api/deploy-site.d.ts +5 -0
  8. package/dist/api/deploy-site.js +39 -21
  9. package/dist/api/get-aws-client.d.ts +2 -0
  10. package/dist/api/get-aws-client.js +2 -0
  11. package/dist/api/get-buckets.js +26 -9
  12. package/dist/api/get-compositions-on-lambda.d.ts +2 -1
  13. package/dist/api/get-compositions-on-lambda.js +1 -3
  14. package/dist/api/get-or-create-bucket.js +2 -7
  15. package/dist/api/get-regions.d.ts +5 -1
  16. package/dist/api/get-regions.js +5 -2
  17. package/dist/api/iam-validation/simulate-rule.js +0 -22
  18. package/dist/api/iam-validation/simulate.js +24 -5
  19. package/dist/api/iam-validation/user-permissions.js +0 -8
  20. package/dist/api/render-media-on-lambda.d.ts +2 -1
  21. package/dist/api/render-media-on-lambda.js +6 -10
  22. package/dist/api/render-still-on-lambda.d.ts +2 -1
  23. package/dist/api/render-still-on-lambda.js +1 -3
  24. package/dist/api/upload-dir.d.ts +4 -3
  25. package/dist/api/upload-dir.js +33 -19
  26. package/dist/cli/args.d.ts +1 -0
  27. package/dist/cli/commands/compositions/index.js +1 -3
  28. package/dist/cli/commands/regions.js +5 -1
  29. package/dist/cli/commands/render/progress.d.ts +6 -3
  30. package/dist/cli/commands/render/progress.js +49 -39
  31. package/dist/cli/commands/render/render.js +17 -4
  32. package/dist/cli/commands/sites/create.js +12 -4
  33. package/dist/cli/commands/still.js +5 -9
  34. package/dist/cli/helpers/progress-bar.d.ts +9 -3
  35. package/dist/cli/helpers/progress-bar.js +19 -3
  36. package/dist/cli/index.js +6 -1
  37. package/dist/functions/compositions.js +10 -3
  38. package/dist/functions/helpers/concat-videos.d.ts +10 -6
  39. package/dist/functions/helpers/concat-videos.js +8 -25
  40. package/dist/functions/helpers/create-post-render-data.js +0 -12
  41. package/dist/functions/helpers/expected-out-name.js +1 -1
  42. package/dist/functions/helpers/get-chromium-executable-path.js +2 -1
  43. package/dist/functions/helpers/get-current-region.d.ts +1 -1
  44. package/dist/functions/helpers/get-encoding-metadata.d.ts +4 -8
  45. package/dist/functions/helpers/get-encoding-metadata.js +4 -18
  46. package/dist/functions/helpers/get-final-encoding-status.d.ts +2 -4
  47. package/dist/functions/helpers/get-final-encoding-status.js +1 -4
  48. package/dist/functions/helpers/get-lambdas-invoked-stats.d.ts +1 -5
  49. package/dist/functions/helpers/get-lambdas-invoked-stats.js +1 -9
  50. package/dist/functions/helpers/get-overall-progress.d.ts +2 -1
  51. package/dist/functions/helpers/get-overall-progress.js +7 -5
  52. package/dist/functions/helpers/get-progress.js +40 -26
  53. package/dist/functions/helpers/get-rendered-frames-progress.d.ts +8 -0
  54. package/dist/functions/helpers/get-rendered-frames-progress.js +37 -0
  55. package/dist/functions/launch.js +50 -38
  56. package/dist/functions/renderer.js +19 -24
  57. package/dist/functions/start.js +9 -2
  58. package/dist/functions/still.js +16 -5
  59. package/dist/index.d.ts +9 -2
  60. package/dist/index.js +10 -2
  61. package/dist/pricing/aws-regions.d.ts +2 -1
  62. package/dist/pricing/aws-regions.js +31 -1
  63. package/dist/pricing/price-per-1-s.js +413 -39
  64. package/dist/shared/aws-clients.d.ts +3 -0
  65. package/dist/shared/aws-clients.js +75 -13
  66. package/dist/shared/check-credentials.js +3 -0
  67. package/dist/shared/chunk-progress.d.ts +9 -0
  68. package/dist/shared/chunk-progress.js +2034 -0
  69. package/dist/shared/constants.d.ts +13 -12
  70. package/dist/shared/convert-to-serve-url.d.ts +5 -1
  71. package/dist/shared/convert-to-serve-url.js +1 -5
  72. package/dist/shared/deserialize-input-props.d.ts +1 -1
  73. package/dist/shared/deserialize-input-props.js +1 -1
  74. package/dist/shared/function-zip-path.d.ts +2 -1
  75. package/dist/shared/function-zip-path.js +3 -2
  76. package/dist/shared/get-account-id.js +4 -6
  77. package/dist/shared/get-etag.d.ts +1 -0
  78. package/dist/shared/get-etag.js +24 -0
  79. package/dist/shared/get-s3-operations.d.ts +10 -0
  80. package/dist/shared/get-s3-operations.js +36 -0
  81. package/dist/shared/hosted-layers.js +368 -60
  82. package/dist/shared/invoke-webhook.d.ts +2 -0
  83. package/dist/shared/parse-chunk-key.d.ts +4 -0
  84. package/dist/shared/parse-chunk-key.js +14 -0
  85. package/dist/shared/read-dir.d.ts +9 -0
  86. package/dist/shared/read-dir.js +57 -0
  87. package/dist/shared/validate-bucketname.d.ts +5 -0
  88. package/dist/shared/validate-bucketname.js +19 -1
  89. package/dist/shared/validate-lambda-codec.d.ts +1 -1
  90. package/dist/shared/validate-lambda-codec.js +0 -1
  91. package/package.json +18 -14
  92. package/remotionlambda-arm64.zip +0 -0
  93. package/remotionlambda-x64.zip +0 -0
  94. package/remotionlambda.zip +0 -0
  95. package/.prettierrc.js +0 -14
  96. package/dist/api/enable-s3-website.d.ts +0 -5
  97. package/dist/api/enable-s3-website.js +0 -16
  98. package/dist/shared/get-cloudwatch-stream-url.d.ts +0 -8
  99. package/dist/shared/get-cloudwatch-stream-url.js +0 -7
  100. package/tsconfig.json +0 -16
@@ -201,7 +201,7 @@ export declare type LambdaPayloads = {
201
201
  inputProps: SerializedInputProps;
202
202
  renderId: string;
203
203
  imageFormat: ImageFormat;
204
- codec: Exclude<Codec, 'h264'>;
204
+ codec: LambdaCodec;
205
205
  crf: number | undefined;
206
206
  proResProfile: ProResProfile | undefined;
207
207
  pixelFormat: PixelFormat | undefined;
@@ -254,9 +254,6 @@ export declare type LambdaPayloads = {
254
254
  export declare type LambdaPayload = LambdaPayloads[LambdaRoutines];
255
255
  export declare type EncodingProgress = {
256
256
  framesEncoded: number;
257
- totalFrames: number | null;
258
- doneIn: number | null;
259
- timeToInvoke: number | null;
260
257
  };
261
258
  export declare type RenderMetadata = {
262
259
  siteId: string;
@@ -277,14 +274,17 @@ export declare type RenderMetadata = {
277
274
  renderId: string;
278
275
  outName: OutNameInputWithoutCredentials | undefined;
279
276
  privacy: Privacy;
277
+ frameRange: [number, number];
278
+ everyNthFrame: number;
279
+ };
280
+ export declare type AfterRenderCost = {
281
+ estimatedCost: number;
282
+ estimatedDisplayCost: string;
283
+ currency: string;
284
+ disclaimer: string;
280
285
  };
281
286
  export declare type PostRenderData = {
282
- cost: {
283
- estimatedCost: number;
284
- estimatedDisplayCost: string;
285
- currency: string;
286
- disclaimer: string;
287
- };
287
+ cost: AfterRenderCost;
288
288
  outputFile: string;
289
289
  outputSize: number;
290
290
  renderSize: number;
@@ -297,7 +297,6 @@ export declare type PostRenderData = {
297
297
  timeToEncode: number;
298
298
  timeToCleanUp: number;
299
299
  timeToRenderChunks: number;
300
- timeToInvokeLambdas: number;
301
300
  retriesInfo: ChunkRetry[];
302
301
  mostExpensiveFrameRanges: ExpensiveChunk[] | undefined;
303
302
  };
@@ -331,10 +330,12 @@ export declare type RenderProgress = {
331
330
  lambdasInvoked: number;
332
331
  cleanup: CleanupInfo | null;
333
332
  timeToFinishChunks: number | null;
334
- timeToInvokeLambdas: number | null;
333
+ timeToEncode: number | null;
335
334
  overallProgress: number;
336
335
  retriesInfo: ChunkRetry[];
337
336
  mostExpensiveFrameRanges: ExpensiveChunk[] | null;
337
+ framesRendered: number;
338
+ outputSizeInBytes: number | null;
338
339
  };
339
340
  export declare type Privacy = 'public' | 'private' | 'no-acl';
340
341
  export declare const LAMBDA_CONCURRENCY_LIMIT_QUOTA = "L-B99A9384";
@@ -1,2 +1,6 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
- export declare const convertToServeUrl: (urlOrId: string, region: AwsRegion) => Promise<string>;
2
+ export declare const convertToServeUrl: ({ urlOrId, region, bucketName, }: {
3
+ urlOrId: string;
4
+ region: AwsRegion;
5
+ bucketName: string;
6
+ }) => string;
@@ -1,18 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convertToServeUrl = void 0;
4
- const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
5
4
  const docs_url_1 = require("./docs-url");
6
- const convertToServeUrl = async (urlOrId, region) => {
5
+ const convertToServeUrl = ({ urlOrId, region, bucketName, }) => {
7
6
  if (urlOrId.startsWith('src/')) {
8
7
  throw new Error(`Remotion Lambda can only render based on a URL in the cloud. It seems like you passed a local file: ${urlOrId}. Read the setup guide for Remotion Lambda ${docs_url_1.DOCS_URL}/docs/lambda/setup`);
9
8
  }
10
9
  if (urlOrId.startsWith('http://') || urlOrId.startsWith('https://')) {
11
10
  return urlOrId;
12
11
  }
13
- const { bucketName } = await (0, get_or_create_bucket_1.getOrCreateBucket)({
14
- region,
15
- });
16
12
  return `https://${bucketName}.s3.${region}.amazonaws.com/sites/${urlOrId}/index.html`;
17
13
  };
18
14
  exports.convertToServeUrl = convertToServeUrl;
@@ -5,4 +5,4 @@ export declare const deserializeInputProps: ({ serialized, region, bucketName, e
5
5
  region: AwsRegion;
6
6
  bucketName: string;
7
7
  expectedBucketOwner: string;
8
- }) => Promise<unknown>;
8
+ }) => Promise<object>;
@@ -20,7 +20,7 @@ const deserializeInputProps = async ({ serialized, region, bucketName, expectedB
20
20
  return payload;
21
21
  }
22
22
  catch (err) {
23
- throw new Error('Failed to parse input props that were');
23
+ throw new Error(`Failed to parse input props that were serialized: ${err.stack}`);
24
24
  }
25
25
  };
26
26
  exports.deserializeInputProps = deserializeInputProps;
@@ -1 +1,2 @@
1
- export declare const FUNCTION_ZIP: string;
1
+ export declare const FUNCTION_ZIP_ARM64: string;
2
+ export declare const FUNCTION_ZIP_X86_64: string;
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FUNCTION_ZIP = void 0;
6
+ exports.FUNCTION_ZIP_X86_64 = exports.FUNCTION_ZIP_ARM64 = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
- exports.FUNCTION_ZIP = path_1.default.join(path_1.default.resolve(__dirname, '..', '..'), `remotionlambda.zip`);
8
+ exports.FUNCTION_ZIP_ARM64 = path_1.default.join(path_1.default.resolve(__dirname, '..', '..'), `remotionlambda-arm64.zip`);
9
+ exports.FUNCTION_ZIP_X86_64 = path_1.default.join(path_1.default.resolve(__dirname, '..', '..'), `remotionlambda-x64.zip`);
@@ -1,17 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAccountId = void 0;
4
- const client_iam_1 = require("@aws-sdk/client-iam");
4
+ const client_sts_1 = require("@aws-sdk/client-sts");
5
5
  const aws_clients_1 = require("./aws-clients");
6
6
  const validate_aws_region_1 = require("./validate-aws-region");
7
7
  const getAccountId = async (options) => {
8
- var _a, _b;
9
8
  (0, validate_aws_region_1.validateAwsRegion)(options.region);
10
- const user = await (0, aws_clients_1.getIamClient)(options.region).send(new client_iam_1.GetUserCommand({}));
11
- const accountId = (_b = (_a = user.User) === null || _a === void 0 ? void 0 : _a.Arn) === null || _b === void 0 ? void 0 : _b.match(/aws:iam::([0-9]+)/);
12
- if (!accountId) {
9
+ const callerIdentity = await (0, aws_clients_1.getStsClient)(options.region).send(new client_sts_1.GetCallerIdentityCommand({}));
10
+ if (!callerIdentity.Account) {
13
11
  throw new Error('Cannot get account ID');
14
12
  }
15
- return accountId[1];
13
+ return callerIdentity.Account;
16
14
  };
17
15
  exports.getAccountId = getAccountId;
@@ -0,0 +1 @@
1
+ export declare const getEtagOfFile: (filePath: string) => Promise<string>;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getEtagOfFile = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const crypto_1 = __importDefault(require("crypto"));
9
+ const chunk = 1024 * 1024 * 5; // 5MB
10
+ const md5 = (data) => crypto_1.default.createHash('md5').update(data).digest('hex');
11
+ const getEtagOfFile = async (filePath) => {
12
+ const stream = await fs_1.default.promises.readFile(filePath);
13
+ if (stream.length <= chunk) {
14
+ return `"${md5(stream)}"`;
15
+ }
16
+ const md5Chunks = [];
17
+ const chunksNumber = Math.ceil(stream.length / chunk);
18
+ for (let i = 0; i < chunksNumber; i++) {
19
+ const chunkStream = stream.slice(i * chunk, (i + 1) * chunk);
20
+ md5Chunks.push(md5(chunkStream));
21
+ }
22
+ return `"${md5(Buffer.from(md5Chunks.join(''), 'hex'))}-${chunksNumber}"`;
23
+ };
24
+ exports.getEtagOfFile = getEtagOfFile;
@@ -0,0 +1,10 @@
1
+ import type { _Object } from '@aws-sdk/client-s3';
2
+ export declare const getS3DiffOperations: ({ objects, bundle, prefix, }: {
3
+ objects: _Object[];
4
+ bundle: string;
5
+ prefix: string;
6
+ }) => Promise<{
7
+ toDelete: _Object[];
8
+ toUpload: string[];
9
+ existingCount: number;
10
+ }>;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getS3DiffOperations = void 0;
4
+ const read_dir_1 = require("./read-dir");
5
+ const getS3DiffOperations = async ({ objects, bundle, prefix, }) => {
6
+ const dir = await (0, read_dir_1.readDirectory)({
7
+ dir: bundle,
8
+ etags: {},
9
+ originalDir: bundle,
10
+ });
11
+ const filesOnS3ButNotLocal = objects.filter((fileOnS3) => {
12
+ var _a;
13
+ const key = (_a = fileOnS3.Key) === null || _a === void 0 ? void 0 : _a.substring(prefix.length + 1);
14
+ return !dir[key];
15
+ });
16
+ const localFilesNotOnS3 = Object.keys(dir).filter((d) => {
17
+ return !objects.find((o) => {
18
+ var _a;
19
+ const key = (_a = o.Key) === null || _a === void 0 ? void 0 : _a.substring(prefix.length + 1);
20
+ return key === d && o.ETag === dir[d];
21
+ });
22
+ });
23
+ const existing = Object.keys(dir).filter((d) => {
24
+ return objects.find((o) => {
25
+ var _a;
26
+ const key = (_a = o.Key) === null || _a === void 0 ? void 0 : _a.substring(prefix.length + 1);
27
+ return key === d && o.ETag === dir[d];
28
+ });
29
+ });
30
+ return {
31
+ toDelete: filesOnS3ButNotLocal,
32
+ toUpload: localFilesNotOnS3,
33
+ existingCount: existing.length,
34
+ };
35
+ };
36
+ exports.getS3DiffOperations = getS3DiffOperations;