Scripting
Built-in TypeScript modules
Import the packages included with Varc using static ESM syntax, editor completion, and no installation step.
Varc ships familiar packages inside the app so a saved script remains portable and bounded:
import { z } from "zod";
import { formatISO } from "date-fns";
import _ from "lodash";
const input = z.object({ createdAt: z.string() }).parse({
createdAt: "2026-08-18T10:30:00Z",
});
return {
createdAt: formatISO(new Date(input.createdAt)),
keys: _.sortBy(["customer:2", "customer:1"]),
};
Imports use standard static TypeScript/ESM syntax. They look like npm package imports, but Varc supports only the package roots included with the application.
Supported import forms
Use named, default, namespace, aliased, or type-only static imports when the package exports them:
import Decimal from "decimal.js";
import * as YAML from "yaml";
import { v4 as createUuid } from "uuid";
import { z } from "zod";
import type { ZodType } from "zod";
const schema: ZodType<string> = z.string();
const config = YAML.parse('mode: "strict"');
return { id: createUuid(), total: new Decimal("0.1").plus("0.2").toString(), config, schema };
Imports must stay at the top level. Authored export declarations are rejected because a saved script is one executable entry body, not a package for another script to load.
Package catalog
This catalog lists the exact versions, licenses, upstream links, and execution-class availability included with the current Varc release.
| Module | Use it for | Version | Available in | License | Upstream |
|---|---|---|---|---|---|
| @msgpack/msgpack | Encode and decode MessagePack payloads. | 3.1.3 | Scripts, Macros, Transformers, Dashboards | ISC | Project site |
| chai | Write familiar assertions inside scripts and fixtures. | 6.2.2 | Scripts, Macros, Transformers, Dashboards | MIT | Project site |
| date-fns | Parse, compare, and format dates without mutable date wrappers. | 4.4.0 | Scripts, Macros, Transformers, Dashboards | MIT | Project site |
| decimal.js | Perform decimal arithmetic without binary floating-point surprises. | 10.6.0 | Scripts, Macros, Transformers, Dashboards | MIT | Project site |
| fast-json-patch | Create and apply RFC 6902 JSON Patch operations. | 3.1.1 | Scripts, Macros, Transformers, Dashboards | MIT | Project site |
| fast-xml-parser | Parse XML into JavaScript objects and build XML output. | 5.11.0 | Scripts, Macros, Transformers, Dashboards | MIT | Project site |
| jsonpath-plus | Select values from JSON documents with JSONPath expressions. | 10.4.0 | Scripts, Macros, Transformers, Dashboards | MIT | Project site |
| lodash | Transform, group, sort, and compare collections and objects. | 4.18.1 | Scripts, Macros, Transformers, Dashboards | MIT | Project site |
| nanoid | Generate compact URL-friendly random identifiers. | 6.0.1 | Scripts, Macros, Transformers, Dashboards | MIT | Project site |
| papaparse | Parse and produce CSV data. | 5.6.0 | Scripts, Macros, Transformers, Dashboards | MIT | Project site |
| semver | Parse, compare, and test semantic versions and ranges. | 7.8.5 | Scripts, Macros, Transformers, Dashboards | ISC | Project site |
| uuid | Generate and validate UUID values. | 14.0.1 | Scripts, Macros, Transformers, Dashboards | MIT | Project site |
| yaml | Parse and stringify YAML documents. | 2.9.0 | Scripts, Macros, Transformers, Dashboards | ISC | Project site |
| zod | Validate unknown data and infer TypeScript-friendly result shapes. | 4.4.3 | Scripts, Macros, Transformers, Dashboards | MIT | Project site |
Every app release pins one exact version. Saved scripts do not carry their own dependency lockfile. Package upgrades are application changes with compatibility tests and release notes.
Only the documented package-root exports are available. Node-only entry points, command-line tools, filesystem adapters, and undocumented subpaths are not included merely because the upstream npm package contains them.
Common recipes
Validate unknown JSON
import { z } from "zod";
const payload = z
.object({ id: z.string().uuid(), enabled: z.boolean().default(false) })
.parse(JSON.parse((await redis.get("feature:payload")) ?? "{}"));
return payload;
Parse CSV and XML
import Papa from "papaparse";
import { XMLParser } from "fast-xml-parser";
const csv = Papa.parse<{ name: string }>("name\nAda", { header: true });
const xml = new XMLParser().parse("<person><name>Ada</name></person>");
return { csv: csv.data, xml };
Compare structured data
import { expect } from "chai";
import { compare } from "fast-json-patch";
import { JSONPath } from "jsonpath-plus";
const before = { users: [{ id: 1, active: false }] };
const after = { users: [{ id: 1, active: true }] };
const active = JSONPath({ path: "$.users[?(@.active)]", json: after });
expect(active).to.have.length(1);
return compare(before, after);
Encode MessagePack
import { encode, decode } from "@msgpack/msgpack";
const bytes = encode({ status: "ready", attempts: 2 });
return { bytes, decoded: decode(bytes) };
Editor completion and diagnostics
Varc embeds a declaration bundle beside every module. The editor uses those declarations without consulting your machine’s node_modules.
- Begin a module string after
from "to complete allowed package roots. - Complete named exports inside
{ ... }and members on imported namespaces or values. - Hover an import or exported API for declaration documentation and follow it to its embedded declaration.
- Use aliased imports and
import type; both participate in diagnostics and navigation. - Importing a missing export or passing the wrong types produces a TypeScript diagnostic before the run.
Varc does not currently add an import automatically when you type an otherwise unimported symbol. Write the import declaration first, then use completion within it.
Screenshot plannedComplete an embedded module importThe Varc TypeScript editor showing package-root completion in an import and hover documentation for a named export.
External libraries and unsupported imports
There is no install step and no developer mode that opens Node.js resolution. Varc deliberately rejects:
require("zod"); // CommonJS
await import("zod"); // dynamic import
import helper from "./helper.js"; // relative filesystem path
import data from "/tmp/data.js"; // absolute filesystem path
import parse from "yaml/parse-cst"; // package subpath
import fs from "node:fs"; // Node built-in
import lib from "https://example/lib"; // remote module
Unknown package roots fail before execution. Varc never searches a project directory, reads package.json, contacts an npm registry, follows an import map, or loads a remote URL.
If a workflow needs a package that is not in the catalog, use the existing supported primitives or propose it as a reviewed catalog addition. Arbitrary npm installation, Axios, CommonJS, user-defined modules, and remote imports are outside this release.
Declaration-only packages
The editor uses declarations derived from @types/lodash@4.17.25, @types/semver@7.8.0, @types/papaparse@5.5.2, and @types/chai@5.2.3 for the corresponding packages above.
Those @types names are editor metadata, not available imports. They are MIT-licensed type inputs from DefinitelyTyped.
Network access is a global API
Importing a package never grants network access. Use the global fetch only in a saved script or macro with Network enabled. Transformers and dashboard scripts can import every pure catalog module but cannot reach Fetch.