@concile/values
v0.1.5
Published
Concile's value system: the `v` validator builder, `defineSchema`/`defineTable` schema builders, document `Id` types, and the canonical value model every other Concile package builds on.
Readme
@concile/values
Concile's value system: the v validator builder, defineSchema/defineTable schema builders, document Id types, and the canonical value model every other Concile package builds on.
Most users should install the umbrella package concile instead — it re-exports this package as concile/values.
bun add concile # or: npm install concileUsage
// concile/schema.ts
import { defineSchema, defineTable, v } from "@concile/values";
export default defineSchema({
conversations: defineTable({
title: v.string(),
}),
messages: defineTable({
conversationId: v.id("conversations"),
author: v.string(),
body: v.string(),
}).index("by_conversation", ["conversationId"]),
});The same v validators declare function arguments, and the engine enforces both at runtime: a write that does not match the table's schema, or a call whose arguments do not match the function's args, is rejected with a typed error.
Features
vvalidator builder:v.string(),v.number(),v.boolean(),v.id(table),v.object,v.array,v.union,v.literal,v.optional, and more.defineSchema/defineTablewith.index(name, fields)(including unique indexes) — schema drives both runtime validation and generatedDoc/Idtypes.Infer<typeof validator>extracts the TypeScript type a validator describes.- Typed document ids:
Id<"messages">is a distinct type per table, andv.id("conversations")makes cross-table references type-checked. - A total order over all values (
compareValues) and a canonical JSON transport encoding, shared by the engine, the wire protocol, and the client. - Zero runtime dependencies; safe to import in server functions, the browser, and tooling alike.
Part of Concile — docs at https://concile-six.vercel.app/docs
License: FSL-1.1-Apache-2.0
