@manta-eu/horns-client
Reference for @manta-eu/horns-client 0.2.3, generated from its published types.
pnpm add @manta-eu/horns-client@0.2.3
Entry points
@manta-eu/horns-client, on this page@manta-eu/horns-client/component-api@manta-eu/horns-client/horn@manta-eu/horns-client/ldkit-source@manta-eu/horns-client/mount@manta-eu/horns-client/shape-catalog@manta-eu/horns-client/surface-declarations@manta-eu/horns-client/typecheck-fs@manta-eu/horns-client/typecheck-fs-source@manta-eu/horns-client/vite
Type Aliases
HornAboutProps
HornAboutProps =
object
Properties
about
about:
string
The thing to show: an action plan, a rule. Opaque — it is only ever passed on.
datastoreId
datastoreId:
string
explain?
optionalexplain?:HornSnapshotViewProps["explain"]
mode?
optionalmode?:HornSnapshotViewProps["mode"]
Defaults to embed, which draws the views without the page around them.
onVariableChange?
optionalonVariableChange?:HornSnapshotViewProps["onVariableChange"]
planActions?
optionalplanActions?:HornSnapshotViewProps["planActions"]
What the viewer may do with the plans behind a view. Without it a plan is shown and never run.
variables?
optionalvariables?:Record<string,unknown>
Narrows the Horn. A host with no URL to keep these in can hold them in state.
HornDrawnProps
HornDrawnProps =
HornDrawProps&object
One Horn, turned into rows by the worker and drawn.
Written views and catalog cards are bound here because they need @manta-eu/react, which the kit has
not got. Everything else a host wants to hang on it is a prop.
Type Declaration
cacheKey
cacheKey:
string
What a redraw keys on: the revision where there is one, or the thing the Horn was built for.
datastoreId
datastoreId:
string
horn
horn:
Horn
variables?
optionalvariables?:Record<string,unknown>
HornDrawProps
HornDrawProps =
object
What the drawing needs, apart from which Horn it is.
Properties
explain?
optionalexplain?:HornSnapshotViewProps["explain"]
mode?
optionalmode?:HornSnapshotViewProps["mode"]
onVariableChange?
optionalonVariableChange?:HornSnapshotViewProps["onVariableChange"]
planActions?
optionalplanActions?:HornSnapshotViewProps["planActions"]
HornReview
HornReview =
object
What the draw found: what a second model said about it, any view that would not draw at all, and why there is no advice when there is none.
unavailable matters: a reviewer that is simply not configured looks exactly like a reviewer that found
nothing wrong, and those are opposite things to know.
Properties
advice
advice:
string[]
problems
problems:
RenderProblem[]
unavailable?
optionalunavailable?:string
HornsAboutProps
HornsAboutProps =
HornDrawProps&object
Type Declaration
about
about:
string
The thing these are about: a rule, a plan, a campaign, a person. Opaque — only ever passed on.
datastoreId
datastoreId:
string
emptyHint?
optionalemptyHint?:string
What to say when nothing is about this thing yet.
hornHref?
optionalhornHref?: (slug) =>string
Where a Horn opens in full, where the host has somewhere to send a person. A plain href, not a route: the Horns UI may be another document, or another origin entirely.
Parameters
slug
string
Returns
string
limit?
optionallimit?:number
How many to draw. The worker caps it; leaving it off takes the worker’s default.
variables?
optionalvariables?:Record<string,unknown>
HornsNavItem
HornsNavItem =
object
Properties
icon
icon:
LucideIcon
isCurrent
isCurrent: (
pathname) =>boolean
Exact for a page that is one page, a prefix where the page has children.
Parameters
pathname
string
Returns
boolean
label
label:
string
to
to:
string
HornsNavSection
HornsNavSection =
object
Properties
items
items:
HornsNavItem[]
label
label:
string
HornsRoutesOptions
HornsRoutesOptions =
object
Horns’ routes as <Route> children, for a host that splices them into its own <Routes>. A nested
<Routes> would rebase every path on its parent’s match, so a host mounting Horns under a prefix would
push d/:datastoreId/... a segment too deep; spliced in, the paths are the ones paths.ts writes.
catchAll is for the host that gives Horns the whole URL space, as mountHorns does. A host with routes
of its own leaves it off and keeps its own 404.
shell is the layout the listed pages draw inside, defaulting to Horns’ own. A host that has a shell
already passes it, and a Horn then reads as one of that host’s pages rather than swapping the chrome for
Horns’. It is a layout route’s element, so it renders an <Outlet />; the Studio and a saved Horn ignore
it, because each is a whole screen with nothing beside it.
Properties
catchAll?
optionalcatchAll?:boolean
shell?
optionalshell?:ReactNode
ShapeCatalogSource
ShapeCatalogSource = (
realm) =>ShapeCatalog
Parameters
realm
Realm
Returns
ShapeCatalog
Variables
catalogCardView
constcatalogCardView:NonNullable<HornSnapshotViewProps["catalogCard"]>
hornPath
consthornPath: (slug) =>string
Parameters
slug
string
Returns
string
hornsPath
consthornsPath: () =>string
Returns
string
writtenHornView
constwrittenHornView: (content,view,context) =>ReactNode
Parameters
content
Extract<SnapshotView["content"], { lane: "sandbox"; }>
view
SnapshotView
context
WrittenViewContext
Returns
ReactNode
Functions
AppRoutes()
AppRoutes():
Element
Returns
Element
AppShell()
AppShell():
Element
Returns
Element
HornAbout()
HornAbout(
props):Element
The Horn for a thing, drawn wherever a host puts it.
A host with an IRI gets something to look at whether or not anyone has made a Horn for it: the worker answers with the kept one, or builds one from the plan or rule itself. So this needs no saved Horn, no route of the host’s and no Studio — it is the read-only half, for a plan shown beside its own screen.
Written views and catalog cards are bound here because they need @manta-eu/react, which the kit has not
got. Everything else a host wants to hang on it is a prop.
Parameters
props
Returns
Element
hornAboutPath()
hornAboutPath(
datastoreId,about):string
Where the worker answers for a thing. The IRI goes in a query parameter and is encoded: a plan’s carries
a #, which would otherwise end the URL and ask about nothing.
Parameters
datastoreId
string
about
string
Returns
string
HornDrawn()
HornDrawn(
props):Element
Parameters
props
Returns
Element
HornsAbout()
HornsAbout(
props):Element
Every Horn about one thing, drawn.
This is the whole of embedding Horns: a host that has an IRI — a rule, an action plan, a campaign, a person — puts this beside it and gets what Manta already knows about that thing, as pictures rather than links. It needs no saved Horn, no route of the host’s and no Studio: the worker answers with the kept ones, or builds one from the rule or plan itself.
The one thing a host must bring is the policy. A written view runs in the page’s own realm, so the
document has to carry connect-src 'self' and the rest of contentSecurityPolicy(); without it the
views still draw, but nothing fences the code they came from.
Parameters
props
Returns
Element
hornsAboutPath()
hornsAboutPath(
datastoreId,about,limit?):string
Where every Horn about a thing is listed.
Parameters
datastoreId
string
about
string
limit?
number
Returns
string
HornsApp()
HornsApp():
Element
The session gate, for a Horns that is the whole page. A host that has already gated mounts none of it.
Returns
Element
hornSnapshotPath()
hornSnapshotPath(
datastoreId):string
Where a Horn is turned into rows to draw.
Parameters
datastoreId
string
Returns
string
hornsNavSections()
hornsNavSections():
HornsNavSection[]
Where a person can go inside Horns, in one list.
AppShell draws it as its sidebar, and a host that supplies a shell of its own draws it wherever its
own chrome puts navigation — manta/agents renders it beside the page, the way Data Explorer does. Two
renderings of one list, so a page added here cannot go missing from the other.
Returns
hornsRoutes()
hornsRoutes(
__namedParameters?):Element
Parameters
__namedParameters?
Returns
Element
ldkitShapeCatalog()
ldkitShapeCatalog():
ShapeCatalog
The realm’s shapes, as the host supplied them.
Returns
ShapeCatalog
makeWrittenHornView()
makeWrittenHornView(
onError?): (content,view,context) =>ReactNode
Parameters
onError?
(problem) => void
Returns
(content, view, context) => ReactNode
provideShapeCatalog()
provideShapeCatalog(
next):void
Hand Horns the realm’s SHACL-derived shapes. A host builds them from its own @manta-eu/ldo schemas with
shapeCatalogFromLdkit, at build time, and passes the result here before mounting.
Horns ships no catalog of its own: the shapes describe a realm’s data model, so they belong to whoever deploys rather than to the library.
Parameters
next
Returns
void
rasterizeHorn()
rasterizeHorn(
snapshot):Promise<Rasterized>
The Horn drawn off-screen at the capture width, handed back as a PNG with whatever would not draw.
The problems come free: this is a real draw of every view, so a view that throws throws here. It is the only place the app draws a Horn where somebody is waiting for the answer.
Parameters
snapshot
generatedAt
string
horn
{ datastoreId: string; iri: string; realm: "hiremanta-com" | "journey-travel"; revision: number; slug: string; title: string; }
horn.datastoreId
string
horn.iri
string
horn.realm
"hiremanta-com" | "journey-travel"
horn.revision
number
horn.slug
string
horn.title
string
labels
z.ZodRecord<z.ZodString, z.ZodString>
layout
{ columns: 12; items: object[]; kind: "grid"; }
layout.columns
12
layout.items
object[]
layout.kind
"grid"
links
z.ZodRecord<z.ZodString, z.ZodString>
plans
object[]
snapshotVersion
1
style
{ accent?: "blue" | "orange" | "green" | "amber" | "pink" | "forest" | "indigo" | "red"; density?: "compact" | "comfortable"; radius?: "sharp" | "soft" | "round"; theme?: "light" | "dark"; }
style.accent?
"blue" | "orange" | "green" | "amber" | "pink" | "forest" | "indigo" | "red"
style.density?
"compact" | "comfortable"
style.radius?
"sharp" | "soft" | "round"
style.theme?
"light" | "dark"
variables
object[]
views
object[]
Returns
Promise<Rasterized>
reviewHorn()
reviewHorn(
args):Promise<HornReview>
Draw the Horn that was just made, look at it, and say what is wrong.
The browser is the only thing that can draw a Horn, so both answers come from one off-screen draw: a view that throws throws here, and the picture of the rest goes to a second model. Never throws — a Horn that changed has changed whether or not anyone managed to look at it.
Parameters
args
asked
string
datastoreId
string
horn
{ about?: string[]; actions: ({ id: string; ref: { hash: string; item: string; revision: string; }; } | { allowedClasses: string[]; allowedPredicates: string[]; confirm: true; criteria?: { ask: string; }; delete?: string; id: string; insert: string; kind: "kg-update"; label: string; params: object[]; where?: string; } | { actionShapeIri: string; confirm: true; criteria?: { ask: string; }; id: string; kind: "action-shape"; label: string; mapping: z.ZodRecord<z.ZodString, z.ZodString>; operation: "addition" | "update"; params: object[]; })[]; audience?: string; baseRevision?: number; datastoreId: string; dependencies: object[]; derivations: ({ id: string; ref: { hash: string; item: string; revision: string; }; } | { appliesTo: string; datatype: string; id: string; pattern: string; predicateIri: string; promotedRuleIri?: string; status: "query" | "staged" | "materialized"; })[]; iri: string; layout: { columns: 12; items: object[]; kind: "grid"; }; lock: { entries: object[]; lockVersion: 1; }; realm: "hiremanta-com" | "journey-travel"; revision: number; runtime: { kit: string; }; schemaVersion: 1; slug: string; style?: { accent?: "blue" | "orange" | "green" | "amber" | "pink" | "forest" | "indigo" | "red"; density?: "compact" | "comfortable"; radius?: "sharp" | "soft" | "round"; theme?: "light" | "dark"; }; summary?: string; title: string; variables: object[]; views: ({ id: string; ref: { hash: string; item: string; revision: string; }; } | { binding: { columns: object[]; derivations: string[]; kind: "select"; limit: number; params: string[]; sparql: string; } | { classIri: string; derivations: string[]; fields: object[]; kind: "lens"; limit: number; rows?: "entity" | "value"; } | { kind: "query"; limit: number; params: string[]; query: { hash: string; item: string; revision: string; }; }; emits?: object[]; id: string; render: { component: { hash: string; item: string; revision: string; }; kind: "component"; props: JSONType; } | { kind: "tsx"; reviewed?: { at: string; hash: string; }; source: string; }; title: string; })[]; }
horn.about?
string[]
horn.actions
({ id: string; ref: { hash: string; item: string; revision: string; }; } | { allowedClasses: string[]; allowedPredicates: string[]; confirm: true; criteria?: { ask: string; }; delete?: string; id: string; insert: string; kind: "kg-update"; label: string; params: object[]; where?: string; } | { actionShapeIri: string; confirm: true; criteria?: { ask: string; }; id: string; kind: "action-shape"; label: string; mapping: z.ZodRecord<z.ZodString, z.ZodString>; operation: "addition" | "update"; params: object[]; })[]
horn.audience?
string
horn.baseRevision?
number
horn.datastoreId
string
horn.dependencies
object[]
horn.derivations
({ id: string; ref: { hash: string; item: string; revision: string; }; } | { appliesTo: string; datatype: string; id: string; pattern: string; predicateIri: string; promotedRuleIri?: string; status: "query" | "staged" | "materialized"; })[]
horn.iri
string
horn.layout
{ columns: 12; items: object[]; kind: "grid"; }
horn.layout.columns
12
horn.layout.items
object[]
horn.layout.kind
"grid"
horn.lock
{ entries: object[]; lockVersion: 1; }
horn.lock.entries
object[]
horn.lock.lockVersion
1
horn.realm
"hiremanta-com" | "journey-travel"
horn.revision
number
horn.runtime
{ kit: string; }
horn.runtime.kit
string
horn.schemaVersion
1
horn.slug
string
horn.style?
{ accent?: "blue" | "orange" | "green" | "amber" | "pink" | "forest" | "indigo" | "red"; density?: "compact" | "comfortable"; radius?: "sharp" | "soft" | "round"; theme?: "light" | "dark"; }
horn.style.accent?
"blue" | "orange" | "green" | "amber" | "pink" | "forest" | "indigo" | "red"
horn.style.density?
"compact" | "comfortable"
horn.style.radius?
"sharp" | "soft" | "round"
horn.style.theme?
"light" | "dark"
horn.summary?
string
horn.title
string
horn.variables
object[]
horn.views
({ id: string; ref: { hash: string; item: string; revision: string; }; } | { binding: { columns: object[]; derivations: string[]; kind: "select"; limit: number; params: string[]; sparql: string; } | { classIri: string; derivations: string[]; fields: object[]; kind: "lens"; limit: number; rows?: "entity" | "value"; } | { kind: "query"; limit: number; params: string[]; query: { hash: string; item: string; revision: string; }; }; emits?: object[]; id: string; render: { component: { hash: string; item: string; revision: string; }; kind: "component"; props: JSONType; } | { kind: "tsx"; reviewed?: { at: string; hash: string; }; source: string; }; title: string; })[]
variables?
Readonly<Record<string, unknown>>
Returns
Promise<HornReview>
sendHornScreenshot()
sendHornScreenshot(
args):Promise<ScreenshotKept>
Take the picture and hand it to the worker, which stores it where Manta keeps files. Never throws: a Horn that saved is saved whether or not anyone managed to photograph it, so a caller after a save can ignore the answer and a caller who asked for it can show what went wrong.
Parameters
args
datastoreId
string
slug
string
snapshot
{ generatedAt: string; horn: { datastoreId: string; iri: string; realm: "hiremanta-com" | "journey-travel"; revision: number; slug: string; title: string; }; labels: z.ZodRecord<z.ZodString, z.ZodString>; layout: { columns: 12; items: object[]; kind: "grid"; }; links: z.ZodRecord<z.ZodString, z.ZodString>; plans: object[]; snapshotVersion: 1; style: { accent?: "blue" | "orange" | "green" | "amber" | "pink" | "forest" | "indigo" | "red"; density?: "compact" | "comfortable"; radius?: "sharp" | "soft" | "round"; theme?: "light" | "dark"; }; variables: object[]; views: object[]; }
snapshot.generatedAt
string
snapshot.horn
{ datastoreId: string; iri: string; realm: "hiremanta-com" | "journey-travel"; revision: number; slug: string; title: string; }
snapshot.horn.datastoreId
string
snapshot.horn.iri
string
snapshot.horn.realm
"hiremanta-com" | "journey-travel"
snapshot.horn.revision
number
snapshot.horn.slug
string
snapshot.horn.title
string
snapshot.labels
z.ZodRecord<z.ZodString, z.ZodString>
snapshot.layout
{ columns: 12; items: object[]; kind: "grid"; }
snapshot.layout.columns
12
snapshot.layout.items
object[]
snapshot.layout.kind
"grid"
snapshot.links
z.ZodRecord<z.ZodString, z.ZodString>
snapshot.plans
object[]
snapshot.snapshotVersion
1
snapshot.style
{ accent?: "blue" | "orange" | "green" | "amber" | "pink" | "forest" | "indigo" | "red"; density?: "compact" | "comfortable"; radius?: "sharp" | "soft" | "round"; theme?: "light" | "dark"; }
snapshot.style.accent?
"blue" | "orange" | "green" | "amber" | "pink" | "forest" | "indigo" | "red"
snapshot.style.density?
"compact" | "comfortable"
snapshot.style.radius?
"sharp" | "soft" | "round"
snapshot.style.theme?
"light" | "dark"
snapshot.variables
object[]
snapshot.views
object[]
Returns
Promise<ScreenshotKept>
shapesRealm()
shapesRealm():
"hiremanta-com"|"journey-travel"
Returns
"hiremanta-com" | "journey-travel"
signInHref()
signInHref(
redirect?):string
Horns’ own /login, which proxies to agents and stamps the marker a loop is diagnosed by.
Parameters
redirect?
string
Returns
string
useSparqlSelect()
useSparqlSelect():
SparqlSelect
The reader this app’s pages use. The datastore rides on the fetch, from the route.
Returns
SparqlSelect