@hyperframes/aws-lambda 0.8.192 → 0.8.194

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.
@@ -10,6 +10,9 @@ function contentStoreUri(bucket, sha256) {
10
10
  }
11
11
  return `s3://${bucket}/${CONTENT_STORE_PREFIX}/${sha256.slice(0, 2)}/${sha256}`;
12
12
  }
13
+ function probeFactsUri(bucket, sha256) {
14
+ return `${contentStoreUri(bucket, sha256)}.probe.v2.json`;
15
+ }
13
16
  function audioSidecarUri(bucket, sha256) {
14
17
  return `${contentStoreUri(bucket, sha256)}.audio.m4a`;
15
18
  }
@@ -19,5 +22,6 @@ export {
19
22
  CONTENT_STORE_RETENTION_DAYS,
20
23
  CONTENT_STORE_REFRESH_AFTER_DAYS,
21
24
  contentStoreUri,
25
+ probeFactsUri,
22
26
  audioSidecarUri
23
27
  };
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  CONTENT_STORE_REFRESH_AFTER_DAYS,
3
3
  audioSidecarUri,
4
- contentStoreUri
5
- } from "./chunk-3UDA73TT.js";
4
+ contentStoreUri,
5
+ probeFactsUri
6
+ } from "./chunk-4CK3RKM2.js";
6
7
 
7
8
  // src/s3Transport.ts
8
9
  import {
@@ -479,6 +480,27 @@ async function untarDirectory(tarballPath, destDir) {
479
480
  mkdirSync(destDir, { recursive: true });
480
481
  await tar.extract({ file: tarballPath, cwd: destDir });
481
482
  }
483
+ async function putProbeFacts(client, localPath, bucket, sha256) {
484
+ const uri = probeFactsUri(bucket, sha256);
485
+ if (await s3ObjectExists(client, uri)) return "reused";
486
+ const { key } = parseS3Uri(uri);
487
+ const size = statSync(localPath).size;
488
+ try {
489
+ await putImmutableBody(
490
+ client,
491
+ localPath,
492
+ bucket,
493
+ key,
494
+ size,
495
+ await sha256File(localPath),
496
+ "application/json"
497
+ );
498
+ } catch (error) {
499
+ if (!isS3PreconditionFailed(error)) throw error;
500
+ return "reused";
501
+ }
502
+ return "uploaded";
503
+ }
482
504
 
483
505
  // src/formatExtension.ts
484
506
  var FORMAT_EXTENSIONS = {
@@ -539,9 +561,15 @@ async function downloadSiteFiles(s3, manifestUri, projectDir, leaveVideosRemote)
539
561
  const uri = contentStoreUri(bucket, sha256);
540
562
  if (leaveVideosRemote && VIDEO_EXTENSIONS_PLANNED_IN_PLACE.has(extname(path).toLowerCase())) {
541
563
  const sidecar = audioSidecarUri(bucket, sha256);
564
+ const facts = probeFactsUri(bucket, sha256);
565
+ const [hasSidecar, hasFacts] = await Promise.all([
566
+ s3ObjectExists(s3, sidecar),
567
+ s3ObjectExists(s3, facts)
568
+ ]);
542
569
  remoteFiles[path] = {
543
570
  url: await presignS3GetUrl(s3, uri, REMOTE_URL_TTL_SECONDS),
544
- ...await s3ObjectExists(s3, sidecar) ? { audioSidecarUrl: await presignS3GetUrl(s3, sidecar, REMOTE_URL_TTL_SECONDS) } : {},
571
+ ...hasSidecar ? { audioSidecarUrl: await presignS3GetUrl(s3, sidecar, REMOTE_URL_TTL_SECONDS) } : {},
572
+ ...hasFacts ? { probeFactsUrl: await presignS3GetUrl(s3, facts, REMOTE_URL_TTL_SECONDS) } : {},
545
573
  sha256,
546
574
  sizeBytes
547
575
  };
@@ -578,6 +606,7 @@ export {
578
606
  isS3NotFound,
579
607
  tarDirectory,
580
608
  untarDirectory,
609
+ putProbeFacts,
581
610
  formatExtension,
582
611
  SITE_MANIFEST_INVALID,
583
612
  siteManifestUri,
@@ -11,17 +11,19 @@ import {
11
11
  parseSiteManifest,
12
12
  putAudioSidecar,
13
13
  putContentStoreFile,
14
+ putProbeFacts,
14
15
  s3ObjectExists,
15
16
  serializeSiteManifest,
16
17
  sha256File,
17
18
  siteManifestUri,
18
19
  siteTarballUri,
19
20
  uploadContentAddressedFileToS3
20
- } from "./chunk-FQDVV4JA.js";
21
+ } from "./chunk-6TIVMKTV.js";
21
22
  import {
22
23
  CONTENT_STORE_RETENTION_DAYS,
23
- audioSidecarUri
24
- } from "./chunk-3UDA73TT.js";
24
+ audioSidecarUri,
25
+ probeFactsUri
26
+ } from "./chunk-4CK3RKM2.js";
25
27
 
26
28
  // src/sdk/deploySite.ts
27
29
  import { existsSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
@@ -30,9 +32,11 @@ import { join } from "node:path";
30
32
  import { S3Client } from "@aws-sdk/client-s3";
31
33
  import {
32
34
  buildAudioSidecar,
35
+ buildProbeFacts,
33
36
  hashProjectDir,
34
37
  listSiteFiles,
35
- wantsAudioSidecar
38
+ wantsAudioSidecar,
39
+ wantsProbeFacts
36
40
  } from "@hyperframes/producer/distributed";
37
41
  function siteHandleFromId(bucketName, siteId) {
38
42
  const projectS3Uri = siteManifestUri(bucketName, siteId);
@@ -104,6 +108,7 @@ async function deploySite(opts) {
104
108
  uploaded ||= outcome === "uploaded";
105
109
  });
106
110
  stored.sort((a, b) => a.path < b.path ? -1 : 1);
111
+ await storeProbeFacts(s3, opts, stored);
107
112
  await storeAudioSidecars(s3, opts, stored);
108
113
  const workdir = mkdtempSync(join(tmpdir(), "hf-deploy-site-"));
109
114
  try {
@@ -154,6 +159,29 @@ async function storeAudioSidecars(s3, opts, files) {
154
159
  );
155
160
  }
156
161
  }
162
+ async function storeProbeFacts(s3, opts, files) {
163
+ const videos = files.filter((file) => wantsProbeFacts(file.path));
164
+ if (videos.length === 0) return;
165
+ const workdir = mkdtempSync(join(tmpdir(), "hf-probe-facts-"));
166
+ let unavailable = false;
167
+ try {
168
+ await mapConcurrent(videos, 4, async ({ path, sha256 }) => {
169
+ if (unavailable || await s3ObjectExists(s3, probeFactsUri(opts.bucketName, sha256))) return;
170
+ const factsPath = join(workdir, `${sha256}.json`);
171
+ const outcome = await buildProbeFacts(join(opts.projectDir, path), factsPath);
172
+ if (outcome === "unavailable") unavailable = true;
173
+ if (outcome === "built") await putProbeFacts(s3, factsPath, opts.bucketName, sha256);
174
+ rmSync(factsPath, { force: true });
175
+ });
176
+ } finally {
177
+ rmSync(workdir, { recursive: true, force: true });
178
+ }
179
+ if (unavailable) {
180
+ opts.onNotice?.(
181
+ "ffprobe was not found on this machine, so what renders learn about your videos was not stored: renders will probe each video themselves and plan more slowly. Install ffmpeg and run `sites create` again."
182
+ );
183
+ }
184
+ }
157
185
 
158
186
  // src/sdk/validateConfig.ts
159
187
  import { InvalidConfigError } from "@hyperframes/producer/distributed";
@@ -15,10 +15,10 @@ import {
15
15
  untarDirectory,
16
16
  uploadContentAddressedFileToS3,
17
17
  uploadFileToS3
18
- } from "./chunk-FQDVV4JA.js";
18
+ } from "./chunk-6TIVMKTV.js";
19
19
  import {
20
20
  CONTENT_STORE_PREFIX
21
- } from "./chunk-3UDA73TT.js";
21
+ } from "./chunk-4CK3RKM2.js";
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";
package/dist/cdk/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  CONTENT_STORE_PREFIX,
3
3
  CONTENT_STORE_RETENTION_DAYS
4
- } from "../_chunks/chunk-3UDA73TT.js";
4
+ } from "../_chunks/chunk-4CK3RKM2.js";
5
5
 
6
6
  // src/cdk/HyperframesRenderStack.ts
7
7
  import { dirname, resolve } from "node:path";
@@ -3,4 +3,5 @@ export declare const CONTENT_STORE_RETENTION_DAYS = 30;
3
3
  /** Reusing an object at least this old rewrites it, so a plan's objects outlive it by 23+ days. */
4
4
  export declare const CONTENT_STORE_REFRESH_AFTER_DAYS = 7;
5
5
  export declare function contentStoreUri(bucket: string, sha256: string): string;
6
+ export declare function probeFactsUri(bucket: string, sha256: string): string;
6
7
  export declare function audioSidecarUri(bucket: string, sha256: string): string;
package/dist/handler.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  handler,
3
3
  unwrapEvent
4
- } from "./_chunks/chunk-J3OLGMWP.js";
5
- import "./_chunks/chunk-FQDVV4JA.js";
6
- import "./_chunks/chunk-3UDA73TT.js";
4
+ } from "./_chunks/chunk-UVNF7N6T.js";
5
+ import "./_chunks/chunk-6TIVMKTV.js";
6
+ import "./_chunks/chunk-4CK3RKM2.js";
7
7
  export {
8
8
  handler,
9
9
  unwrapEvent
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  resolveChromeExecutablePath,
7
7
  resolveChromeSource,
8
8
  unwrapEvent
9
- } from "./_chunks/chunk-J3OLGMWP.js";
9
+ } from "./_chunks/chunk-UVNF7N6T.js";
10
10
  import {
11
11
  InvalidConfigError,
12
12
  computeRenderCost,
@@ -14,7 +14,7 @@ import {
14
14
  getRenderProgress,
15
15
  renderToLambda,
16
16
  validateDistributedRenderConfig
17
- } from "./_chunks/chunk-L4R3FJOR.js";
17
+ } from "./_chunks/chunk-Q6NRBJWH.js";
18
18
  import {
19
19
  downloadS3ObjectToFile,
20
20
  downloadS3ObjectToFileVerified,
@@ -24,8 +24,8 @@ import {
24
24
  untarDirectory,
25
25
  uploadContentAddressedFileToS3,
26
26
  uploadFileToS3
27
- } from "./_chunks/chunk-FQDVV4JA.js";
28
- import "./_chunks/chunk-3UDA73TT.js";
27
+ } from "./_chunks/chunk-6TIVMKTV.js";
28
+ import "./_chunks/chunk-4CK3RKM2.js";
29
29
  export {
30
30
  ChromeBinaryUnavailableError,
31
31
  InvalidConfigError,
@@ -85,3 +85,4 @@ export declare function tarDirectory(sourceDir: string, destTarball: string, fil
85
85
  * warm Lambda container.
86
86
  */
87
87
  export declare function untarDirectory(tarballPath: string, destDir: string): Promise<void>;
88
+ export declare function putProbeFacts(client: S3Client, localPath: string, bucket: string, sha256: string): Promise<"uploaded" | "reused">;
package/dist/sdk/index.js CHANGED
@@ -10,11 +10,11 @@ import {
10
10
  validateDistributedRenderConfig,
11
11
  validateStepFunctionsInputSize,
12
12
  validateVariablesPayload
13
- } from "../_chunks/chunk-L4R3FJOR.js";
13
+ } from "../_chunks/chunk-Q6NRBJWH.js";
14
14
  import {
15
15
  sha256File
16
- } from "../_chunks/chunk-FQDVV4JA.js";
17
- import "../_chunks/chunk-3UDA73TT.js";
16
+ } from "../_chunks/chunk-6TIVMKTV.js";
17
+ import "../_chunks/chunk-4CK3RKM2.js";
18
18
 
19
19
  // src/sdk/prebuiltHandler.ts
20
20
  import { existsSync, readFileSync } from "node:fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/aws-lambda",
3
- "version": "0.8.192",
3
+ "version": "0.8.194",
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.192"
55
+ "@hyperframes/producer": "^0.8.194"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/aws-lambda": "^8.10.146",
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.8.192",
3
- "url": "https://github.com/heygen-com/hyperframes/releases/download/v0.8.192/hyperframes-lambda-handler.zip",
4
- "sha256": "96ec79a65e6803ff0542daf1c5f4feb28890f53019df7aeffcedf27f2c185f99",
5
- "bytes": 129257853
2
+ "version": "0.8.194",
3
+ "url": "https://github.com/heygen-com/hyperframes/releases/download/v0.8.194/hyperframes-lambda-handler.zip",
4
+ "sha256": "ab7ad696f79592496083d483cb8aabec6a571bdab7ae5eef6ff4a73769d6f3ce",
5
+ "bytes": 129263749
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.8.192",
3
- "url": "https://github.com/heygen-com/hyperframes/releases/download/v0.8.192/hyperframes-lambda-video-arm64.oci.tar",
4
- "sha256": "904678eceb8c21d5ec2f5981b694c90fc776b4b9647ea3b11cdc09703356940c",
5
- "bytes": 244637696
2
+ "version": "0.8.194",
3
+ "url": "https://github.com/heygen-com/hyperframes/releases/download/v0.8.194/hyperframes-lambda-video-arm64.oci.tar",
4
+ "sha256": "7ad29f5b6c3cabe2a8a426b4753d40cf33bdd13592ad0f9a4ebc9497ec24fd09",
5
+ "bytes": 244642304
6
6
  }