@remotion/lambda 3.3.6 → 3.3.8

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 (64) hide show
  1. package/dist/admin/generate-etag-list.d.ts +1 -0
  2. package/dist/admin/generate-etag-list.js +14 -0
  3. package/dist/admin/make-layer-public.js +23 -1
  4. package/dist/api/deploy-site.d.ts +5 -0
  5. package/dist/api/deploy-site.js +39 -16
  6. package/dist/api/get-aws-client.d.ts +2 -0
  7. package/dist/api/get-aws-client.js +2 -0
  8. package/dist/api/iam-validation/simulate-rule.js +0 -22
  9. package/dist/api/iam-validation/simulate.js +17 -5
  10. package/dist/api/iam-validation/user-permissions.js +0 -6
  11. package/dist/api/upload-dir.d.ts +4 -3
  12. package/dist/api/upload-dir.js +33 -19
  13. package/dist/cli/commands/render/progress.d.ts +6 -3
  14. package/dist/cli/commands/render/progress.js +49 -39
  15. package/dist/cli/commands/render/render.js +16 -1
  16. package/dist/cli/commands/sites/create.js +12 -2
  17. package/dist/cli/helpers/progress-bar.d.ts +8 -1
  18. package/dist/cli/helpers/progress-bar.js +17 -1
  19. package/dist/cli/index.js +6 -1
  20. package/dist/functions/helpers/concat-videos.d.ts +10 -6
  21. package/dist/functions/helpers/concat-videos.js +5 -21
  22. package/dist/functions/helpers/create-post-render-data.js +0 -12
  23. package/dist/functions/helpers/get-chromium-executable-path.js +2 -1
  24. package/dist/functions/helpers/get-chunk-progress.d.ts +0 -0
  25. package/dist/functions/helpers/get-chunk-progress.js +1 -0
  26. package/dist/functions/helpers/get-current-region.d.ts +1 -1
  27. package/dist/functions/helpers/get-encoding-metadata.d.ts +4 -8
  28. package/dist/functions/helpers/get-encoding-metadata.js +4 -18
  29. package/dist/functions/helpers/get-final-encoding-status.d.ts +2 -4
  30. package/dist/functions/helpers/get-final-encoding-status.js +1 -4
  31. package/dist/functions/helpers/get-lambdas-invoked-stats.d.ts +1 -5
  32. package/dist/functions/helpers/get-lambdas-invoked-stats.js +1 -9
  33. package/dist/functions/helpers/get-overall-progress.d.ts +2 -1
  34. package/dist/functions/helpers/get-overall-progress.js +7 -5
  35. package/dist/functions/helpers/get-progress.js +37 -25
  36. package/dist/functions/helpers/get-rendered-frames-progress.d.ts +8 -0
  37. package/dist/functions/helpers/get-rendered-frames-progress.js +37 -0
  38. package/dist/functions/launch.js +48 -37
  39. package/dist/functions/renderer.js +15 -22
  40. package/dist/functions/still.js +2 -0
  41. package/dist/pricing/aws-regions.d.ts +1 -1
  42. package/dist/pricing/aws-regions.js +11 -0
  43. package/dist/pricing/price-per-1-s.js +413 -39
  44. package/dist/shared/aws-clients.d.ts +3 -0
  45. package/dist/shared/aws-clients.js +9 -1
  46. package/dist/shared/chunk-progress.d.ts +9 -0
  47. package/dist/shared/chunk-progress.js +2034 -0
  48. package/dist/shared/constants.d.ts +4 -5
  49. package/dist/shared/get-account-id.js +4 -6
  50. package/dist/shared/get-chunk-progress.d.ts +0 -0
  51. package/dist/shared/get-chunk-progress.js +1 -0
  52. package/dist/shared/get-etag.d.ts +1 -0
  53. package/dist/shared/get-etag.js +24 -0
  54. package/dist/shared/get-s3-operations.d.ts +10 -0
  55. package/dist/shared/get-s3-operations.js +36 -0
  56. package/dist/shared/hosted-layers.js +368 -60
  57. package/dist/shared/parse-chunk-key.d.ts +4 -0
  58. package/dist/shared/parse-chunk-key.js +14 -0
  59. package/dist/shared/read-dir.d.ts +9 -0
  60. package/dist/shared/read-dir.js +57 -0
  61. package/package.json +7 -6
  62. package/remotionlambda.zip +0 -0
  63. package/dist/shared/get-cloudwatch-stream-url.d.ts +0 -8
  64. package/dist/shared/get-cloudwatch-stream-url.js +0 -7
@@ -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,6 +274,8 @@ export declare type RenderMetadata = {
277
274
  renderId: string;
278
275
  outName: OutNameInputWithoutCredentials | undefined;
279
276
  privacy: Privacy;
277
+ frameRange: [number, number];
278
+ everyNthFrame: number;
280
279
  };
281
280
  export declare type PostRenderData = {
282
281
  cost: {
@@ -297,7 +296,6 @@ export declare type PostRenderData = {
297
296
  timeToEncode: number;
298
297
  timeToCleanUp: number;
299
298
  timeToRenderChunks: number;
300
- timeToInvokeLambdas: number;
301
299
  retriesInfo: ChunkRetry[];
302
300
  mostExpensiveFrameRanges: ExpensiveChunk[] | undefined;
303
301
  };
@@ -331,10 +329,11 @@ export declare type RenderProgress = {
331
329
  lambdasInvoked: number;
332
330
  cleanup: CleanupInfo | null;
333
331
  timeToFinishChunks: number | null;
334
- timeToInvokeLambdas: number | null;
332
+ timeToEncode: number | null;
335
333
  overallProgress: number;
336
334
  retriesInfo: ChunkRetry[];
337
335
  mostExpensiveFrameRanges: ExpensiveChunk[] | null;
336
+ framesRendered: number;
338
337
  };
339
338
  export declare type Privacy = 'public' | 'private' | 'no-acl';
340
339
  export declare const LAMBDA_CONCURRENCY_LIMIT_QUOTA = "L-B99A9384";
@@ -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;
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -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;