TypeScript client
Package: @eelden/client (clients/typescript).
Export paths
| Import | Role |
|---|---|
@eelden/client | eelden tagged template, EeldenQuery, EeldenParam, EeldenExecutor |
@eelden/client/money | Money class |
@eelden/client/shape | Typecheck JSON contract (EeldenType, EeldenShape, decode) |
@eelden/client/codegen | Escape-hatch tagged-template codegen (generateTypes) |
@eelden/client/named-codegen | Named-query codegen (generateNamedQueryModules) |
@eelden/client/config | eelden.config.json parse + glob helper (parseConfig, DEFAULT_CONFIG) |
CLI bin: eelden-codegen (also registered as weft-codegen for one release).
Deprecated weft* aliases (weft, WeftQuery, WeftExecutor, WeftParam, WeftShape, …) remain for one release — prefer the eelden / Eelden* names.
Preferred path — named queries
- Write schemas + named queries as
.eel - Run
eelden-codegen --config eelden.config.json - Import generated functions; pass them to an
EeldenExecutor
import { GetPaid } from "./generated/users.queries";
import { Money } from "@eelden/client/money";
const rows = await exec.execute(
GetPaid({ min_balance: Money.minor(50_00n, "USD") }),
);
// rows typed from the query's select shapeMoney constructors that exist today:
import { Money } from "@eelden/client/money";
Money.minor(4999n, "USD"); // minor units (cents)
Money.parse("49.99", "USD"); // decimal string only — not a numberThere is no Money.usd. Cross-currency arithmetic is rejected at runtime — same doctrine as the language.
See Named queries and Examples (examples/eelden.config.json).
Config
eelden.config.json fields (@eelden/client/config):
| Field | Meaning | Default |
|---|---|---|
schemas | Schema .eel paths (merged in order) | ["schemas.eel"] |
queries | Glob(s) for named-query .eel files | ["src/queries/**/*.eel"] |
outDir | Generated TypeScript modules | "src/generated" |
moneyImport | Optional Money import path override | @eelden/client/money |
Codegen shells out to the eelden binary (typecheck-queries). Set EELDEN_BINARY if it is not on PATH. WEFT_BINARY is deprecated (honored for one release).
Escape hatch
import { eelden } from "@eelden/client";
import type { EeldenExecutor, EeldenQuery } from "@eelden/client";
const q: EeldenQuery = eelden`users |> select { id, name }`;
// await exec.execute(q)Tagged-template codegen (legacy):
eelden-codegen <schemas.eel> <output.ts> <src1.ts> [src2.ts ...]Use for one-offs and tests — not day-to-day app queries. Until a build plugin lands, the bare eelden…`` template returns EeldenQuery with result types defaulting to unknown[] unless escape-hatch codegen wraps them.
EeldenExecutor
interface EeldenExecutor {
execute<TRows>(
q: EeldenQuery<TRows>,
opts?: { tenant?: string },
): Promise<TRows[]>;
atomic<TRowses extends unknown[]>(
qs: { [K in keyof TRowses]: EeldenQuery<TRowses[K]> },
opts?: { tenant?: string },
): Promise<TRowses>;
}Transport reality
EeldenExecutor is the contract. A shipping HTTP/IPC driver is not in the package yet. Today you:
- drive the engine via
eelden run/ Studio / wasm ABI, or - implement
EeldenExecutoragainsteelden serve's/queryfor experiments.
See Status.