npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@hvakr/client

v0.39.0

Published

Official TypeScript/JavaScript SDK for the HVAKR API - HVAC load calculation and analysis

Readme

HVAKR SDK for TypeScript/JavaScript

A simple and easy to use client for the HVAKR API.

npm version

[!WARNING] Unstable API. HVAKR is pre-1.0 (v0). Response shapes, method arguments, and exported types may change in any release while we iterate. We do not maintain older versions in parallel — when we ship a breaking change, everyone upgrades.

Breaking changes ship in minor version bumps (0.x.0); patches (0.x.y) are backwards-compatible fixes. Pin an exact version (e.g. @hvakr/[email protected]) if you need stability, and read the CHANGELOG before upgrading.

Installation

npm install @hvakr/client

Usage

[!NOTE] You can get an access token from HVAKR with a Professional or Enterprise license at HVAKR -> Settings -> Access Tokens

Import and initialize a client using an access token.

import { HVAKRClient } from '@hvakr/client'

// Initializing a client
const hvakr = new HVAKRClient({
    accessToken: process.env.HVAKR_ACCESS_TOKEN,
    version: 'v0',
})

Make a request to any HVAKR API endpoint.

const { projects } = await hvakr.listProjects()

[!NOTE] See the complete list of endpoints in the API reference.

Each method returns a Promise that resolves the response.

console.log(projects)
;[
    {
        id: '5c6a2821-6bb1-4a7e-b6e1-c50111515c3d',
        name: 'Office Retrofit',
        number: '2024-014',
        address: 'Mansfield, TX, USA',
        status: 'inProgress',
        projectType: 'commercial',
        createdAt: 1714405200000,
        lastOpenTime: 1717084800000,
    },
    // ...
]

listProjects() is paginated. Pass limit to control the page size, and follow nextCursor while hasMore is true to page through every project.

const allProjects = []
let cursor: string | undefined

while (true) {
    const page = await hvakr.listProjects({ limit: 50, cursor })
    allProjects.push(...page.projects)
    if (!page.hasMore || !page.nextCursor) break
    cursor = page.nextCursor
}

Handling errors

If the API returns an unsuccessful response, the returned Promise rejects with a HVAKRClientError.

The error contains a message with the HTTP status code and optional metadata with additional details from the response.

import { HVAKRClient, HVAKRClientError } from '@hvakr/client'

try {
    const hvakr = new HVAKRClient({
        accessToken: process.env.HVAKR_ACCESS_TOKEN,
    })
    const project = await hvakr.getProject(projectId)
} catch (error) {
    if (error instanceof HVAKRClientError) {
        console.error('API Error:', error.message)
        console.error('Details:', error.metadata)
    } else {
        // Other error handling code
        console.error(error)
    }
}

Client options

The HVAKRClient supports the following options on initialization. These options are all keys in the single constructor parameter.

| Option | Default value | Type | Description | | ------------- | ------------------------- | -------- | -------------------------------------------------------------------------------------- | | accessToken | — | string | Required. Access token for authentication. Obtain from your HVAKR account. | | baseUrl | "https://api.hvakr.com" | string | The root URL for sending API requests. This can be changed to test with a mock server. | | version | "v0" | string | The API version to use. |

Version reporting

The client sends its version to the API on every request (X-HVAKR-Client: hvakr-client-ts/<version>). If your installed version is behind the minimum the API still supports, the response carries an X-HVAKR-Client-Warning header and the client logs a one-time console.warn telling you to upgrade — useful because breaking changes ship in minor bumps (see Versioning & stability).

API Reference

Projects

| Method | Description | | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | listProjects({ limit?, cursor?, search?, status?, projectType? }) | List a page of projects accessible to the authenticated user. Page with nextCursor while hasMore. Optional search (name/number/address), status, and projectType filters | | getProject(id, expand?) | Get a project by ID. Set expand: true for full project data, or pass an array of subcollection keys (e.g. ['spaces', 'zones', 'exports']) to expand only those | | createProject(data, opts?) | Create a new project. Optional data.setup runs setup jobs; the response returns their IDs in setupJobIds | | updateProject(id, data, opts?) | Update an existing project | | moveProject(id, folderId) | Move a project into a folder, or to the root with folderId: null. Returns { id, folderId } | | deleteProject(id) | Delete a project | | getProjectCalculations(id, { include? }) | Run the calculator and return the requested sections (loads, register_schedule, graph, ventilation, equipment, checksums, airflows). Omit include for all. |

Project setup

Set setup on create to run the same setup jobs as the HVAKR app:

const { id, setupJobIds } = await hvakr.createProject({
    name: 'Clinic',
    address: '1 Main St, Denver, CO',
    setup: {
        czMinimumEnvelopes: true,
        ductTypeTemplateIds: [ductTemplateId],
        mapTakeoff: true,
    },
})

// setupJobIds: { czEnvelopes, ductTypes, mapTakeoff }
const takeoff = await hvakr.getJob(id, setupJobIds.mapTakeoff!)

For a residential Title 24 project, set defaultTemplatesSource: 'TITLE_24' on the project and setup.envelopeBuildingCategory (singleFamily, multifamily, or hotelMotel) to pick the building category of the minimum envelope types that czMinimumEnvelopes imports.

mapTakeoff detects spaces from the map footprint at the address and also imports the climate zone envelopes. Its job is waiting until the envelope and space type imports complete. Sheet setup is not part of the API; upload PDFs with createSheetFile instead.

Project reads include every canonical project field, including server-owned state. The exported Zod schemas mark fields that normal project writes cannot change with disableUserWrite: true; fields without that metadata are writable by default. Create and patch schemas apply that policy recursively, including inside spaces, type collections, weather data, and sheet files. Exports remain job-created, and uploaded sheet-file data is read-only except for sheetFiles[id].name in project patches. Pages from uploaded sheet files are in the sheetFilePages subcollection. Patches cannot create or delete pages, and cannot change server-owned page fields. Project reads may include the server-owned defaultSystemPresetId, which is used to initialize equipment for new systems and zones.

folderId is the ID of the project folder that holds the project. It is absent for a project at the root. It is the one disableUserWrite field that createProject accepts, so you can create a project in a folder. Project reads return it, and updateProject rejects it. To move an existing project, call moveProject(id, folderId), or moveProject(id, null) to move it to the root. Filing a project into a folder needs MEMBER on that folder, and a move also needs ADMIN on the project. The project then inherits access from its folder.

Duct design settings use project.ductDesign, with optional fittings and sizingData fields. Project analytics use hasLayoutStarted and hasDuctsSized. To request the calculated graph, use getProjectCalculations(id, { include: ['graph'] }) and read result.graph. The graph metadata exports use the MetaGraph prefix; the calculation section schema and type are CalcGraphSectionSchema_v0 and CalcGraphSection_v0.

ventilationStandard is how outdoor air is calculated. Allowed values are ASHRAE 62.1 / 170 (2022), ASHRAE 62.1 / 170 (2025), and Title 24. ASHRAE 62.1 / 170 editions add the people and area rates and divide by Ez; the 2025 edition also applies air-density correction. Title 24 uses the greater of 15 CFM per person and the area rate, without Ez. The field is optional on create and patch. When a create omits it, the server uses Title 24 if defaultTemplatesSource is TITLE_24, and ASHRAE 62.1 / 170 (2025) otherwise. The client accepts and returns the standard and does not calculate outdoor air.

weatherSpec.source and weatherSpec.year select the weather dataset, for example { source: 'ASHRAE', year: 2021 }. When they are omitted, the server uses ASHRAE 2025. The server rejects a pair that does not name an available dataset, and it selects the nearest station when the dataset changes.

building.planRotation is the compass bearing that the top of the plan faces, in degrees clockwise from true north. A surface's compass azimuth is its drawn direction (0 = plan up) plus planRotation.

mapConfig is the georeferenced map background, centered on the project address. It has enabled (omitted means off), type (roadmap, satellite, or hybrid; omitted means satellite), and opacity from 0 to 1 (omitted means 1). It replaces the maps record of placed maps.

airflowIncrements sets the design airflow rounding increment per unit system, for example { IMPERIAL: 10, METRIC: 5 }. Each value is a positive integer in that unit system's flow rate unit (cfm for IMPERIAL, L/s for METRIC). A unit system with no value uses the default increment. It replaces the single airflowIncrement number.

diagnosticsAcknowledgements holds the Diagnostics warnings that an engineer reviewed on purpose, keyed by finding key. Each entry has an optional reason. A patch treats {} as no change, so send reason: '' to acknowledge a warning with no reason. An acknowledged warning stays listed but no longer counts as open. Only warnings can be acknowledged. To remove an acknowledgement, set its entry to null in updateProject:

await client.updateProject(projectId, {
    diagnosticsAcknowledgements: {
        'exhaustWithinSupply|space-1|||': {
            reason: 'Exhaust fan serves the shared toilet room',
        },
        'exhaustWithinSupply|space-2|||': { reason: '' },
        'exhaustWithinSupply|space-3|||': null,
    },
})

Annotations are a project subcollection. Read them with getProject(id, ['annotations']) or getProject(id, true); the response has an annotations record keyed by annotation ID. Its entries use AnnotationData_v0. Create and update requests accept the same top-level record. Set an entry to null to delete that annotation. Set an optional field to null to clear it:

await hvakr.updateProject('project-id', {
    annotations: {
        'note-1': {
            text: 'Verify diffuser location',
            shape: 'cloud',
            width: 240,
        },
        'note-2': null,
    },
})

Annotation style fields are optional: size (small, medium, large), align (left, center, right), shape (none, box, cloud, hexagon), and color. width must be positive and controls text wrapping.

Projects can also store flat, user-writable metadata for external-system linking and application-specific context. Metadata values may be strings, numbers, or booleans; nested objects and arrays are intentionally excluded. Set an individual metadata key to null in updateProject to delete it.

Project sharing is returned in project.access. access.direct.users holds the members granted on the project, keyed by Firebase UID, each with an accessLevel numeric value and a denormalized email for display; access.direct.userGroups and access.direct.organization hold the other direct grants. access.inherited has the same shape and carries the grants the project inherits from its folder. access._atLeastAccess is a server-derived index. The whole access field is server-owned, as is userPresence, which is keyed by Firebase UID and holds each user's last open time and profile.

Building floor-level data is represented by the project's levels collection; the building object does not include a floor count.

Jobs

| Method | Description | | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | createJob(id, body, opts?) | Create a job (export, auto-group, check, auto-takeoff, auto-route, or size-graph). Sync jobs return status: "completed"; async jobs return queued | | getJob(id, jobId) | Get a job's current state. Poll async jobs until status leaves queued/running |

APIJobSchema_v0 parses a full job and narrows its result by type. APIJobResultSchema_v0 parses a standalone result payload and preserves its fields.

A check job runs Diagnostics and returns APICheckReport_v0. Each finding has a required step (validated by APICheckStepSchema_v0), and entityType can be space, spaceType, zone, system, equipment, wallType, roofType, slabType, doorType, or windowType. The required steps record contains every Diagnostics step: weather, building, spaces, envelopeTypes, spaceTypes, loads, zones, systems, modes, airflows, ventilation, and equipment. Each status is complete, warning, error, or blocked. tiers always has three entries. Calculated-result findings in blocked steps are omitted; tier-1 missing-input findings remain. Info findings do not prevent a step from being complete.

Each finding names one object. When it applies, field names the input field to fix (dotted for a nested project field, such as weatherSpec.selectedStationId) or the calculated field a result check read, and modeId and componentId name the equipment mode and component. getProjectCalculations returns the same findings for its run in result.findings, next to result.errors.

In 0.28.0, consumers constructing check reports must provide step and steps. Explicit schema validation rejects older payloads without these fields; the client itself does not parse responses automatically.

Create PDF/CSV/ZIP output with an export job. definition accepts load-calculation, basis-of-design, ventilation-csv, or hourly-loads-csv:

let job = await hvakr.createJob(projectId, {
    type: 'export',
    definition: 'load-calculation',
    name: 'Issued Loads Export',
})

while (job.status === 'queued' || job.status === 'running') {
    await new Promise((resolve) => setTimeout(resolve, 1_000))
    job = await hvakr.getJob(projectId, job.jobId)
}

if (job.type === 'export' && job.status === 'completed') {
    console.log(job.result?.export?.downloadUrl)
}

Project exports also hold files made by the HVAKR AI agent, so a stored export's definition.fileType and outputFileType can be any ExportFileTypeSchema_v0 value: PDF, CSV, DOCX, ZIP, XML, JSON, XLSX, PNG, JPG, SVG, DXF, TXT, MD, or HTML.

Sheet files

| Method | Description | | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | createSheetFile(id, { file, fileName, name? }, opts?) | Upload one PDF (up to 30 MiB) and receive a multipart-only sheet-upload job. Poll it with getJob; name is display-only. | | createSheetUpload(id, { name? }?) | Mint a single-use, 15-minute upload token for one PDF. Returns uploadUrl, uploadToken, appUploadUrl, and expiresAt. | | uploadSheetFileWithToken({ uploadUrl, uploadToken }, { file, fileName, name? }) | Package export, not a client method. Upload one PDF with an upload token and no access token. Returns the same sheet-upload job as createSheetFile. |

const upload = await hvakr.createSheetFile(
    projectId,
    { file: pdfBytes, fileName: 'A-Plans.pdf', name: 'Architectural Plans' },
    { idempotencyKey: crypto.randomUUID() }
)

let job = upload
while (job.status === 'queued' || job.status === 'running') {
    await new Promise((resolve) => setTimeout(resolve, 1_000))
    job = await hvakr.getJob(projectId, job.jobId)
}

if (job.type === 'sheet-upload' && job.status === 'completed') {
    if (!job.result?.readyForTakeoff) {
        // Patch project.sheets to place an eligible page, then poll again.
    } else {
        await hvakr.createJob(projectId, { type: 'auto-takeoff' })
    }
}

auto-takeoff remains project-wide: it processes all active placed sheets and eligible maps, not only pages from this upload.

Single-use upload tokens

Use an upload token when the PDF upload happens somewhere that must not hold your access token, such as an AI agent's shell, a browser, or another service. Your server mints the token with the access token and passes on only uploadUrl and uploadToken:

// Server side, with the access token.
const { uploadUrl, uploadToken, appUploadUrl, expiresAt } =
    await hvakr.createSheetUpload(projectId, { name: 'Mechanical Plans' })
// Wherever the PDF is. No HVAKRClient or access token is needed.
import { uploadSheetFileWithToken } from '@hvakr/client'

const job = await uploadSheetFileWithToken(
    { uploadUrl, uploadToken },
    { file: pdfBytes, fileName: 'M-Plans.pdf' }
)
// The server polls hvakr.getJob(projectId, job.jobId) as in the example above.

Without the SDK, send the same multipart body to uploadUrl:

curl -sS -H "Authorization: Bearer $UPLOAD_TOKEN" -F [email protected] "$UPLOAD_URL"
  • Credential handling. Treat uploadToken as a secret: do not log it, put it in a URL, or show it to end users. It can upload one PDF to one project, as the user who minted it, until expiresAt (15 minutes). uploadUrl holds no credential. appUploadUrl opens the upload drawer in the HVAKR web app, for a user who uploads the PDF by hand.
  • Minting is not idempotent. Each createSheetUpload call returns a new token, and it takes no idempotencyKey. An unused token expires on its own, so it is safe to retry a failed mint.
  • Retries and replay. A token accepts one upload. Retry uploadSheetFileWithToken with the same token: while the first upload saves, it throws HVAKRClientError with status 409; after the PDF is saved, it returns the same job until the token expires. A failed upload (for example 415 or 422) releases the token, so you can fix the file and retry with it.
  • Expiry and errors. An expired token throws with status 410, and an unknown token with 401. Mint a new token with createSheetUpload. The 30 MiB limit is checked before the request.
  • A name sent with the upload overrides the name given to createSheetUpload.

By default, auto-takeoff adds the detected spaces to the project. Pass commit: false to write them as suggestions to review in the HVAKR app instead. The API cannot accept suggestions, and a later auto-takeoff deletes the pending suggestions on the levels it runs.

A completed auto-takeoff job returns result: { spaceCount, spaceIds }: the number of spaces the run wrote (committed, or as suggestions) and their IDs. APIAutoTakeoffResult_v0 also allows an error-only { error } result, so narrow with 'spaceCount' in job.result before you read the counts.

Each page has a detected drawing scale (real inches per paper inch: 48 for 1/4" = 1'-0", 96 for 1/8" = 1'-0"). Auto-takeoff converts sheet geometry with it. If the detected scale is wrong, patch the page before you run auto-takeoff. The page ID is job.result.pages[i].id:

await hvakr.updateProject(projectId, {
    sheetFilePages: { [pageId]: { scale: 48, customScaleInfo: null } },
})

Products

| Method | Description | | ----------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | searchProducts({ search?, type?, limit?, cursor? }) | Search a page of products accessible to the authenticated user (read-only). Returns slim cards (id, name, manufacturer, model, type). Filter by search (case-insensitive substring over name/manufacturer/model) and/or type (exact node type). Default page 20, max 100. | | getProduct(id) | Get a single product with its full specifications and file attachments |

searchProducts is paginated — it returns { products, hasMore, nextCursor }; page with nextCursor while hasMore. Each card is a slim projection meant for pickers and lists; call getProduct(id) for the full product record.

Product records include optional link, width, and height fields. These are the plan footprint in inches; registers use the face size. Picking a product copies its values onto the unit.

Since 0.22.0, REGISTER, CENTRAL_UNIT, TERMINAL_UNIT, and AIR_CLEANER graph nodes carry an optional productId product link and optional flat width and height in inches. Register types use the same flat width and height. A missing value uses the node type default: central unit 144×72, terminal unit 40×16, air cleaner 32×32, and register 12×12. On central and terminal units, selections holds legacy Cambridge heater selections; productId is the product link.

Air-cleaner graph nodes accept a tag and the IAQP settings cleaningAirflow (CFM), filterLocation, and filterEfficiencies. Set these node fields to null in a project patch to clear them.

Equipment modes and calculations

Projects use a shared equipmentModes registry. As of 0.29.0, equipment configuration lives directly on CENTRAL_UNIT and TERMINAL_UNIT graph nodes, not in a project equipment subcollection. systemId or zoneId identifies the scope served by each unit. Node IDs are independent of scope IDs. EquipmentConfigSchema_v0 / EquipmentConfig_v0 describe the configuration fields shared by these two node types.

Unit nodes can exist before placement on a floor plan. Omit both level and point for an unplaced unit; supply both for a placed unit. All other node types still require coordinates. Product links, selections, configuration, width, height, and optional nonnegative cost are stored on the unit node.

import {
    ComponentTypes_v0,
    DEFAULT_COOLING_MODE_ID_v0,
    OutsideAirMethods_v0,
} from '@hvakr/client'

const project = {
    systems: { 'system-1': { name: 'AHU-1', configured: true } },
    zones: {
        'zone-1': { name: 'VAV-1', configured: true, systemId: 'system-1' },
    },
    graph: {
        'unit-ahu-1': {
            id: 'unit-ahu-1',
            nodeType: 'CENTRAL_UNIT',
            systemId: 'system-1',
            adjacencies: [],
            components: [
                { id: 'oa', type: ComponentTypes_v0.OUTSIDE_AIR_INTAKE },
            ],
            componentConfigsByMode: {
                [DEFAULT_COOLING_MODE_ID_v0]: {
                    oa: {
                        enabled: true,
                        configuration: {
                            componentType: ComponentTypes_v0.OUTSIDE_AIR_INTAKE,
                            method: OutsideAirMethods_v0.SUM_OF_SPACES,
                        },
                    },
                },
            },
            outlet: { ductHeatGain: 2, ductLeakagePercent: 0.01 },
            energyConfiguration: { efficiency: { coolingSEER: 14 } },
            cost: 1200,
        },
        'unit-vav-1': {
            id: 'unit-vav-1',
            nodeType: 'TERMINAL_UNIT',
            zoneId: 'zone-1',
            adjacencies: [],
        },
    },
}

Expand graph with getProject(id, ['graph']). Use graph-node patches to update configuration. Set a nested optional field to null to clear it:

await client.updateProject(projectId, {
    graph: {
        'unit-ahu-1': {
            outlet: { ductHeatGain: 2 },
            energyConfiguration: { schedule: null },
        },
    },
})

Supply duct settings live at graph[nodeId].outlet and apply across all modes. ductHeatGain is a Fahrenheit temperature delta; ductLeakagePercent is a decimal fraction (0.01 = 1%). Coil targetTemperature is the coil leaving-air temperature, before outlet duct heat gain/loss. Return duct settings remain on the return-air intake component.

Inline IAQP filters use components[].filter on Outside Air or Return Air intakes, or outlet.filter on the central supply. A filter can set merv and efficiencies (fractions from 0 to 1 keyed by compound ID). An explicit PM2.5 efficiency ('88101'), including zero, takes precedence over MERV. To clear an outlet filter in a patch, send outlet: { filter: null }.

Calculation sections remain selectable with include. The equipment calculation section is still available. Its entries are keyed by unit graph node ID and carry scope: { type: 'system' | 'zone', id: string }. Each entry's modes map uses the project's equipment mode IDs, as do mode-specific airflow and checksum results. Each mode's summary.coilTotals sums the coils that match the mode's load condition. For cooling, latentCoilLoad is coilLoad - sensibleCoilLoad in BTU/h, negative like coilLoad, and is omitted when either value is missing.

Space design overrides live under designAirflowsByMode; ventilation and infiltration requirements live under airflowRequirementsByLoadCondition. Perimeter infiltration requirements are infiltrationPerimeterReq and infiltrationWinterPerimeterReq on space types and window types, and infiltrationPerimeterReq on a space airflow requirement. They pair with the PERIMETER value of infiltrationReqMethod.

See the 0.29.0 migration notes for the equipment-to-graph change, and the 0.14.0 migration notes for the infiltrationLfReq → infiltrationPerimeterReq rename. The API path remains /v0.

Account

| Method | Description | | ------ | ------------------------------------------------------------------------------------------------------------------------------------ | | me() | Return the authenticated caller's identity, organization memberships, plan, and rate-limit budget. A good first call to confirm auth |

Write methods (createProject, updateProject, createJob, createSheetFile) accept an optional opts argument with an idempotencyKey — retrying a request with the same key returns the original result instead of performing the action twice. moveProject takes no opts: it sets the target folder, so a retry has the same result.

Receiving webhooks

HVAKR can deliver real-time event notifications to an HTTPS endpoint you control. Each request includes an X-HVAKR-Event header and is signed with HMAC-SHA256 in the X-HVAKR-Signature header using a secret you receive when the webhook is created. Use constructWebhookEvent to verify the signature and parse the event in one step.

import { HVAKRWebhookError, constructWebhookEvent } from '@hvakr/client'

// Express example. Use a raw-body parser so the signature still matches —
// re-stringifying a parsed object will change the bytes.
app.post(
    '/webhooks/hvakr',
    express.raw({ type: 'application/json' }),
    (req, res) => {
        try {
            const event = constructWebhookEvent({
                payload: req.body, // Buffer of the raw bytes
                signature: req.header('X-HVAKR-Signature')!,
                secret: process.env.HVAKR_WEBHOOK_SECRET!,
            })

            switch (event.event) {
                case 'project.created':
                    console.log('New project:', event.data.id)
                    break
                case 'opportunity.created':
                    console.log('New opportunity:', event.data.email)
                    break
            }

            res.status(204).end()
        } catch (err) {
            if (err instanceof HVAKRWebhookError) {
                return res.status(400).send(err.message)
            }
            throw err
        }
    }
)

By default, constructWebhookEvent only accepts event types and payload shapes that this SDK version knows about, so TypeScript can narrow event.data safely inside each case. If you need forward compatibility with newer event types, pass allowUnknownEvents: true and validate event.data yourself for unknown events.

constructWebhookEvent throws HVAKRWebhookError when the signature is invalid, the payload is malformed, the event payload does not match the expected schema, or the timestamp is outside a 300-second tolerance window (configurable via the tolerance option).

See the API reference for the current API documentation.

TypeScript

This SDK is written in TypeScript and includes full type definitions. All API responses are typed using Zod schemas.

import { ExpandedProject_v0, HVAKRClient } from '@hvakr/client'

const hvakr = new HVAKRClient({ accessToken: process.env.HVAKR_ACCESS_TOKEN })

// TypeScript knows this is ExpandedProject_v0
const project = await hvakr.getProject('project-id', true)

See Also

Versioning & stability

This SDK is pre-1.0 and the API it wraps is still evolving. We deliberately stay on 0.x so we can move quickly, and we follow the SemVer 0.x convention:

| Bump | Example | Meaning | | ----------------- | ------------------- | --------------------------------------------------------------------------- | | Minor 0.x.0 | 0.1.16 → 0.2.0 | Breaking change — response shapes, arguments, or exported types changed | | Patch 0.x.y | 0.1.16 → 0.1.17 | Backwards-compatible fix or addition |

We do not version the API path beyond v0 or run multiple API versions in parallel. There is one current version; breaking changes apply to everyone. When the API surface stabilizes, we will cut a 1.0.0 release and adopt standard SemVer guarantees.

What this means for you:

  • Every breaking change is documented under its version in the CHANGELOG.
  • If you depend on stability, pin an exact version (@hvakr/[email protected]) rather than a range, and upgrade deliberately after reading the changelog.
  • A default caret range (^0.1.0) will not auto-upgrade you across a breaking minor bump, so you stay on a compatible line until you opt in.

Getting help

If you want to submit a feature request or are experiencing any issues with the API, please contact HVAKR support at [email protected]