@serenity-ultimex/sdk
v0.1.0
Published
Typed access to the Serenity Ultimex open product source-of-truth. Reads carry provenance by default. Data: CC-BY-4.0, attribute Serenity Ultimex.
Readme
@serenity-ultimex/sdk
Typed access to the Serenity Ultimex open product source-of-truth. Reads carry provenance by default — every value arrives with its status, confidence, sources, competing-claim count, and a trace URL to the full evidence. Data is CC-BY-4.0 (attribute Serenity Ultimex).
import { createClient, implementsInterface } from "@serenity-ultimex/sdk";
const client = createClient({ apiKey: process.env.SERENITY_KEY }); // key optional for open data
// Provenance-default read: the value AND the reasons to trust it
const read = await client.products.get("airpods-3");
read.attributes.battery_life_h;
// { value: "6", unit: "h", status: "resolved", confidence: 0.95,
// competingClaims: 0, sources: ["manufacturer"],
// traceUrl: "/api/facts/airpods-3/battery_life_h", believedFrom: "2026-07-03…" }
// Saved object sets — typed names, tx-stamped freshness
const page = await client.objectSets.query({ from: "orphan-products", filters: [{ property: "category", op: "=", value: "headphones" }] });
if (page.objectSet.nextPageToken) await client.objectSets.fetchPage({ from: "orphan-products" }, page.objectSet.nextPageToken);
// Interfaces: the contracts object types provably implement
implementsInterface("product", "CommerceItem"); // true
// Deep trace + temporal replay
await client.facts.trace("airpods-3", "battery_life_h", { asOf: "2026-07-01T00:00:00Z" });
// The governed write path — a claim, not a fact; the resolver decides
await client.actions.contributeClaim({ slug: "airpods-3", attribute: "color", value: "white" });src/generated.ts is emitted from the live ontology registries (npm run sdk:gen
in the web workspace). Regenerating after a registry change breaks stale consumer
code at compile time — by design. The runtime (src/client.ts) never needs
regeneration.
The full API is also described as OpenAPI 3.1 at GET /api/openapi.
