@hyperframes/aws-lambda 0.8.189 → 0.8.190-hdr.1

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.
@@ -345,6 +345,11 @@ function getS3Client() {
345
345
  return cachedS3Client;
346
346
  }
347
347
  async function handler(event, deps) {
348
+ if (event.Action === "warm") {
349
+ primeRuntimeEnv();
350
+ await ensureChromePath(deps);
351
+ return { Action: "warm" };
352
+ }
348
353
  const unwrapped = unwrapEvent(event);
349
354
  validatePlanProtocolShape(unwrapped);
350
355
  validateEventS3Uris(unwrapped);
package/dist/events.d.ts CHANGED
@@ -19,6 +19,9 @@ import type { DistributedFormat, SerializableDistributedRenderConfig } from "@hy
19
19
  export type { SerializableDistributedRenderConfig } from "@hyperframes/producer/distributed";
20
20
  /** Discriminator for the three roles the one Lambda image fulfills. */
21
21
  export type LambdaAction = "plan" | "audio" | "renderChunk" | "assemble";
22
+ export interface WarmEvent {
23
+ Action: "warm";
24
+ }
22
25
  /** Transport protocol selected for one complete distributed render. */
23
26
  export type LambdaPlanProtocol = "v1" | "v2";
24
27
  /**
@@ -29,7 +32,7 @@ export type LambdaPlanProtocol = "v1" | "v2";
29
32
  * handler unwraps both `event.Payload` and `event.Input` before
30
33
  * dispatching.
31
34
  */
32
- export type LambdaEvent = PlanEvent | AudioEvent | RenderChunkEvent | AssembleEvent | {
35
+ export type LambdaEvent = PlanEvent | AudioEvent | RenderChunkEvent | AssembleEvent | WarmEvent | {
33
36
  Payload: LambdaEvent;
34
37
  } | {
35
38
  Input: LambdaEvent;
@@ -199,4 +202,7 @@ export interface AssembleLambdaResult {
199
202
  FileSize: number;
200
203
  DurationMs: number;
201
204
  }
202
- export type LambdaResult = PlanLambdaResult | AudioLambdaResult | RenderChunkLambdaResult | AssembleLambdaResult;
205
+ export interface WarmLambdaResult {
206
+ Action: "warm";
207
+ }
208
+ export type LambdaResult = WarmLambdaResult | PlanLambdaResult | AudioLambdaResult | RenderChunkLambdaResult | AssembleLambdaResult;
package/dist/handler.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  handler,
3
3
  unwrapEvent
4
- } from "./_chunks/chunk-ROTCAPRH.js";
4
+ } from "./_chunks/chunk-Z7KVGDNN.js";
5
5
  import "./_chunks/chunk-CKQ6SAJX.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-ROTCAPRH.js";
9
+ } from "./_chunks/chunk-Z7KVGDNN.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.189",
3
+ "version": "0.8.190-hdr.1",
4
4
  "description": "AWS Lambda adapter for HyperFrames distributed rendering — handler, client-side SDK, and CDK construct.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -52,7 +52,7 @@
52
52
  "ffprobe-static": "^3.1.0",
53
53
  "puppeteer-core": "^25.8.0",
54
54
  "tar": "^7.4.3",
55
- "@hyperframes/producer": "^0.8.189"
55
+ "@hyperframes/producer": "^0.8.190-hdr.1"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/aws-lambda": "^8.10.146",
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.8.189",
3
- "url": "https://github.com/heygen-com/hyperframes/releases/download/v0.8.189/hyperframes-lambda-handler.zip",
4
- "sha256": "95078b7e47160ad95141a051ae8bf772909229c3d626eea59061ddcd5cfb764f",
5
- "bytes": 129250008
2
+ "version": "0.8.190-hdr.1",
3
+ "url": "https://github.com/heygen-com/hyperframes/releases/download/v0.8.190-hdr.1/hyperframes-lambda-handler.zip",
4
+ "sha256": "45746a2c2b6e01bce983221217461455b449e559bc9a53afe0dcd7105da45d82",
5
+ "bytes": 129254552
6
6
  }
@@ -254,6 +254,11 @@ Resources:
254
254
  SelectPlanProtocol:
255
255
  Type: Choice
256
256
  Choices:
257
+ # Only a stack with the arm64 video function has a cold x86 function to warm.
258
+ # Without one the compared value can never match.
259
+ - Variable: $.PlanProtocol
260
+ StringEquals: !If [HasVideoFunction, v2, v2-without-video-function]
261
+ Next: WarmRender
257
262
  - Variable: $.PlanProtocol
258
263
  StringEquals: v2
259
264
  Next: PlanV2
@@ -265,6 +270,23 @@ Resources:
265
270
  Next: UnsupportedPlanProtocol
266
271
  Default: PlanV2
267
272
 
273
+ # The audio task runs on this function once the plan is done; starting its container now hides the cold start.
274
+ WarmRender:
275
+ Type: Task
276
+ Resource: arn:aws:states:::lambda:invoke
277
+ Parameters:
278
+ FunctionName: !GetAtt RenderFunction.Arn
279
+ InvocationType: Event
280
+ Payload:
281
+ Action: warm
282
+ ResultPath: null
283
+ Catch:
284
+ - ErrorEquals:
285
+ - States.ALL
286
+ ResultPath: null
287
+ Next: PlanV2
288
+ Next: PlanV2
289
+
268
290
  UnsupportedPlanProtocol:
269
291
  Type: Fail
270
292
  Error: PLAN_PROTOCOL_UNSUPPORTED
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.8.189",
3
- "url": "https://github.com/heygen-com/hyperframes/releases/download/v0.8.189/hyperframes-lambda-video-arm64.oci.tar",
4
- "sha256": "f47d18971cccbdef020abc1e43fb1d5296ece69af7f02e0bde1f951db61aea73",
5
- "bytes": 244629504
2
+ "version": "0.8.190-hdr.1",
3
+ "url": "https://github.com/heygen-com/hyperframes/releases/download/v0.8.190-hdr.1/hyperframes-lambda-video-arm64.oci.tar",
4
+ "sha256": "bda6b62d0d72de5f5836d61992117068e5475e32346ee66a2b8f48cd393b3f4a",
5
+ "bytes": 244633600
6
6
  }