@hyperframes/aws-lambda 0.8.183 → 0.8.185

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.
@@ -22,7 +22,7 @@ import {
22
22
 
23
23
  // src/handler.ts
24
24
  import { existsSync as existsSync2, mkdirSync as mkdirSync2, mkdtempSync as mkdtempSync2, readFileSync, rmSync as rmSync2, statSync as statSync2 } from "node:fs";
25
- import { tmpdir as tmpdir2 } from "node:os";
25
+ import { availableParallelism, tmpdir as tmpdir2 } from "node:os";
26
26
  import { basename, join as join2 } from "node:path";
27
27
  import { GetAccountSettingsCommand, LambdaClient } from "@aws-sdk/client-lambda";
28
28
  import { S3Client } from "@aws-sdk/client-s3";
@@ -670,6 +670,13 @@ async function handleAudio(event, deps) {
670
670
  cleanupDir(work);
671
671
  }
672
672
  }
673
+ var LAMBDA_MB_PER_CAPTURE_BROWSER = 2048;
674
+ function lambdaMaxCaptureWorkers() {
675
+ const memoryMb = Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE);
676
+ if (!(memoryMb > 0)) return void 0;
677
+ const byMemory = Math.floor(memoryMb / LAMBDA_MB_PER_CAPTURE_BROWSER);
678
+ return Math.max(1, Math.min(byMemory, availableParallelism() - 1));
679
+ }
673
680
  async function handleRenderChunk(event, deps) {
674
681
  if (event.PlanProtocol !== "v1") {
675
682
  return handleRenderChunkV2(event, deps);
@@ -689,7 +696,15 @@ async function handleRenderChunk(event, deps) {
689
696
  work,
690
697
  event.Format === "png-sequence" ? `chunk-${pad(event.ChunkIndex)}` : `chunk-${pad(event.ChunkIndex)}${formatExtension(event.Format)}`
691
698
  );
692
- const result = await primitive(planDir, event.ChunkIndex, chunkOutputBase);
699
+ const result = await primitive(planDir, event.ChunkIndex, chunkOutputBase, {
700
+ maxCaptureWorkers: lambdaMaxCaptureWorkers()
701
+ });
702
+ logEvent({
703
+ event: "chunk_capture",
704
+ chunkIndex: event.ChunkIndex,
705
+ workers: result.workers,
706
+ captureMode: result.captureMode
707
+ });
693
708
  const chunkUri = await uploadChunkOutput(
694
709
  s3,
695
710
  result,
@@ -726,7 +741,15 @@ async function handleRenderChunkV2(event, deps) {
726
741
  work,
727
742
  event.Format === "png-sequence" ? `chunk-${pad(event.ChunkIndex)}` : `chunk-${pad(event.ChunkIndex)}${formatExtension(event.Format)}`
728
743
  );
729
- const result = await primitive(planDir, event.ChunkIndex, chunkOutputBase);
744
+ const result = await primitive(planDir, event.ChunkIndex, chunkOutputBase, {
745
+ maxCaptureWorkers: lambdaMaxCaptureWorkers()
746
+ });
747
+ logEvent({
748
+ event: "chunk_capture",
749
+ chunkIndex: event.ChunkIndex,
750
+ workers: result.workers,
751
+ captureMode: result.captureMode
752
+ });
730
753
  const chunkUri = await uploadChunkOutput(
731
754
  s3,
732
755
  result,
package/dist/handler.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  handler,
3
3
  unwrapEvent
4
- } from "./_chunks/chunk-MPNOI2CS.js";
4
+ } from "./_chunks/chunk-QCYPNODV.js";
5
5
  import "./_chunks/chunk-SGNVVPIS.js";
6
6
  import "./_chunks/chunk-YS3KY3C5.js";
7
7
  export {
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  resolveChromeExecutablePath,
7
7
  resolveChromeSource,
8
8
  unwrapEvent
9
- } from "./_chunks/chunk-MPNOI2CS.js";
9
+ } from "./_chunks/chunk-QCYPNODV.js";
10
10
  import {
11
11
  InvalidConfigError,
12
12
  computeRenderCost,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/aws-lambda",
3
- "version": "0.8.183",
3
+ "version": "0.8.185",
4
4
  "description": "AWS Lambda adapter for HyperFrames distributed rendering — handler, client-side SDK, and CDK construct.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -49,7 +49,7 @@
49
49
  "ffprobe-static": "^3.1.0",
50
50
  "puppeteer-core": "^25.8.0",
51
51
  "tar": "^7.4.3",
52
- "@hyperframes/producer": "^0.8.183"
52
+ "@hyperframes/producer": "^0.8.185"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/aws-lambda": "^8.10.146",
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.8.183",
3
- "url": "https://github.com/heygen-com/hyperframes/releases/download/v0.8.183/hyperframes-lambda-handler.zip",
4
- "sha256": "1194f61df575fddc48692ca4807ed5d3765e357518a87e20b2086371a25d203f",
5
- "bytes": 129235569
2
+ "version": "0.8.185",
3
+ "url": "https://github.com/heygen-com/hyperframes/releases/download/v0.8.185/hyperframes-lambda-handler.zip",
4
+ "sha256": "b9e2f239accb1c0a50cd402981ce93e4c7533bcc93c5d3483e7d8d5ae1de2884",
5
+ "bytes": 129243460
6
6
  }