pi-mono/packages/chord/test/next/examples/53-app/app/v1.ts
Mario Zechner 072e413bf3 feat(chord): Chord v2 slice 13, the app kit
chord/next/app: startApp and startWorker with the fixed app layout, worker kinds,
AppInfo and WorkerInfo; sessions (hashed tokens, rolling cookies, bearer tokens),
the one-time owner link, the owner token file, device pairing; Files per host
with ordered chunked uploads; export and import per address; plugin roots,
installs and applyChanges; optional users, invite and ephemeral login facets.
HTTP: deny by default (public routes and sockets), remoteAddress,
readSignedCookie. Examples 53-55.
2026-11-02 15:13:37 +00:00

31 lines
1.2 KiB
TypeScript

// The notes app's API, version 1, shared by every host kind (`@notes/app/v1`): what its plugins import from their
// host. The part of Chord the app supports, the kit's start-data objects and files, the app's own host kind (a
// project, one worker per project) and its registry of home-page sections. The API only declares the registry: its
// provider is the home plugin of the app's required root, not base code. Examples 53 to 55 run this app; a real app
// keeps it in `src/api/v1.ts`.
import { defineRegistry, hostKind, str } from "../../../../../src/next/index.ts";
export {
arr,
constant,
defineFacet,
defineRegistry,
defineState,
defineTable,
int,
local,
method,
obj,
remote,
str,
} from "../../../../../src/next/index.ts";
export { AppInfo, Files, WorkerInfo } from "../../../../../src/next-node/app/index.ts";
/** A project of the app: its own worker process, store and files. */
export const Project = hostKind("project", { id: str() });
/** The home page's sections, one per contributing plugin (title and the path it links to). */
export const Sections = defineRegistry<{ readonly title: string; readonly path: string }, string[]>("notes.sections", {
version: 1,
});