products.page; the host decides what that name
means inside an authenticated context. This keeps storage, tenancy, and authorization on the server.
This guide follows the
0.1 API. The package requires Node.js 20 or newer. Confirm the latest
published version and migration notes before installing a newer 0.x release.Preserve authority
You need:- A Node.js 20 or newer application using Fetch
RequestandResponseobjects. - Existing authentication and tenancy resolution in the host route layer.
- A read service that accepts an
AbortSignal. - A frontend cache representation that can consume the returned JSON payload.
Register a resource
The registry is an allowlist, not a router. This example validates the page and derives the account from authenticated context:prediction.accepted. The resolver receives authenticated context, validated
parameters, request metadata, the host cache key, and a deadline-aware signal. The executor measures
serialized bytes when bytes is omitted; materialWork defaults to true.
Mount the operations
Cogni defines operations, not paths. Mount all three behind the host’s authentication middleware:AppContext from the same account, permissions, and read services as the foreground route.
All operations use POST; predictions stream NDJSON when requested and otherwise return JSON.
Connect the client
Initialize the client with the same route map:credentials: "same-origin". Cross-origin authentication and extra headers
remain host decisions.
Continue
- Registered resources covers validation, authorization, result metadata, and explicit failures.
- Bounded execution and streaming explains batch ordering, deadlines, cancellation, JSON, and NDJSON.
- Backend contract defines the language-neutral wire behavior.
- Server API reference lists the current Node exports.