SDKs · Node / TypeScript

CAVS for Node tooling.

A Promise-first SDK over the same Rust core the CLI uses, bound through Node-API. Fully typed, with AbortSignal cancellation and progress events — for release dashboards, CI tools and orchestration. Published as @orelvis15/cavs-sdk.

Package

@orelvis15/cavs-sdk

Ships TypeScript types. Requires Node 20+ and a C toolchain-free install — the native binding loads a prebuilt library.

Native core

per-platform packages

The library resolves from @orelvis15/cavs-sdk-<os>-<arch> optional deps, or CAVS_SDK_LIBRARY.

API shape

Promise-first

Every operation returns a Promise. The non-progress path runs off the event loop; failures reject with CavsError.

Install

One install line.

The matching @orelvis15/cavs-sdk-<platform> package is pulled automatically. For a source checkout, npm run native stages the library locally.

bash — install copy
$ npm install @orelvis15/cavs-sdk@1.2.0
# source checkout: build & stage the native library
$ npm run native
Quickstart

Preview an update.

import { CavsClient } from "@orelvis15/cavs-sdk";

const cavs = new CavsClient();
try {
  const preview = await cavs.preview({
    oldPath: "Build_v1",
    newPath: "Build_v2",
    policy: "balanced",
  });
  console.log("Recommended route:", preview.recommendedRoute);
  for (const r of preview.routes) {
    console.log(`  ${r.name}: ${r.networkBytes} bytes`);
  }
} finally {
  cavs.close();
}
The API

Eight operations,
one client.

Every method returns a Promise and accepts an options object with onProgress and signal. Failures reject with a CavsError carrying a stable .code.

analyze({ oldPath, newPath })
Inspect an old→new transition: sizes, estimated update bytes, reuse ratios, worst files and layout findings with fixes.
packDirectory({ inputDir, outputCavs })
Package a directory tree into a deduplicated .cavs container. Profile, compression, signing and ignore globs.
preview({ oldPath, newPath, policy })
Estimate the wire cost across routes and recommend the cheapest.
createPlan({ oldPath, newPath, outputPlan })
Build a portable, BLAKE3-sealed .cavsplan. Returns reuse and operation counts.
applyPlan({ oldPath, planPath, outputPath })
Apply a plan with verification — atomic for artifacts, staged + journaled for directories.
verifyInstall({ target, signature })
Check an install against a .cavssig or manifest; reports modified / missing / extra.
benchmark({ oldPath, newPath })
A repeatable route-comparison report with measured diff/apply timings.
estimateSavings({ pricePerGb, monthlyDownloads, … })
Monthly egress cost of full downloads vs CAVS updates, and the savings.
Progress & cancellation

AbortSignal and
progress events.

import { CavsClient, CavsError, ErrorCode } from "@orelvis15/cavs-sdk";

const cavs = new CavsClient();
const ac = new AbortController();
setTimeout(() => ac.abort(), 30_000);

try {
  const plan = await cavs.createPlan(
    { oldPath: "Build_v1", newPath: "Build_v2", outputPlan: "update.cavsplan" },
    {
      signal: ac.signal,
      onProgress: (e) => console.log(`[${e.type}] ${e.phase ?? ""}`),
    },
  );
  console.log("reused bytes:", plan.reusedBytes);
} catch (err) {
  if (err instanceof CavsError && err.code === ErrorCode.PathNotFound) {
    console.error("old build not found");
  } else {
    throw err;
  }
} finally {
  cavs.close();
}

Enabling onProgress runs the operation synchronously so callbacks stay on the JS thread; the default (non-progress) path runs off the event loop and honors signal.

CI/CD

Feed a release
dashboard.

// release-preview.ts — run in CI, publish the report
const cavs = new CavsClient();
const preview = await cavs.preview({
  oldPath: process.env.OLD_BUILD!,
  newPath: process.env.NEW_BUILD!,
});
await uploadReport(preview);          // JSON straight to your dashboard
cavs.close();