/settings~security
A section within a named page. The registry resolves the page and section together.
Technical reference · current source
Four route forms, explicit bindings, structured diagnostics.
Choose a form for what the route expresses. Ordinary resource URLs can stay ordinary URLs.
/settings~securityA section within a named page. The registry resolves the page and section together.
/~profile;42A symbolic key with positional arguments. The example binds 42 to a query parameter.
/~billing.invoice.listA namespaced symbolic destination. Dot-separated key tokens stay distinct from argument values.
/~search;q.routing;page.2Named values make bindings explicit. Unknown argument behavior is an application choice.
Normalize the input and identify a page, positional, dot, or named-argument instruction.
Check registered destinations, required arguments, argument limits and unknown named values.
Bind params, query values and a hash. Pass the result to your framework’s router after your application’s checks.
A route registry is not an authorization policy. Permission metadata does not enforce permissions. Validate access independently, and keep sensitive route mappings private.
The parser can throw an AnchorRouteError. The validator and resolver return structured diagnostics. Builders handle escaping; do not concatenate untrusted arguments into route strings.
import { buildIntentAnchor, parseAnchor, validateAnchor, resolveAnchor }
from '@nextera.one/anchor-routing-core';
const anchor = buildIntentAnchor('search', { q: 'route.registry', page: '2' });
// /~search;q.route%2Eregistry;page.2
const instruction = parseAnchor(anchor);
const check = validateAnchor(instruction, registry);
const result = resolveAnchor(instruction, registry);
// This example registry binds q and page into query values.
// Inspect result.success before handing it to a router.Reserved dots, tildes and semicolons inside values must be percent-escaped. Serialization preserves named-argument insertion order; it does not promise alphabetic canonical ordering. A resolved path is not automatic interpolation of :params; adapters may need an explicit mapping.
The core trims input, can extract the pathname from an absolute URL, removes query and fragment suffixes, and normalizes repeated or trailing slashes. It parses data; it does not fetch the URL.
Use the SDK’s own builders for literal values. Malformed percent escapes, duplicate named arguments, unknown registry entries and missing required arguments produce diagnostics. The current unpublished patch also rejects inherited object-property lookups; do not assume earlier npm artifacts contain that fix.
For targets with namedBind, unknown named arguments default to rejection. The ignore and keep policies change how extra names are treated; they do not grant access. The demo limits positional arguments to eight.
Declaration draft version 1 defines /.well-known/anchor-routing.json, its text counterpart, and optional /ar.txt. Core 0.2 added helpers for these declarations.
The current SDK parser is tolerant. A parsed declaration does not establish conformance, endpoint availability or trust.