Files
Ekklesia/packages/module-sdk/src/index.ts
T
ekklesiaandClaude Opus 5.5 4671622b9d Add the module navigation contract: manifest v9, module routes, return-to-origin
Stage 1 PR 7 (ADR 0063). A module becomes a first-class part of the Dashboard.

- Manifest v9 = v8 plus optional `navigation`: a Lucide icon from the curated
  MODULE_NAVIGATION_ICONS set, and up to 12 primary pages (stable id, safe
  label, kebab-case path relative to the module root; no traversal, schemes,
  queries, duplicates, or nesting). Validated before activation.
- Version 8 stays accepted beside version 9, each read strictly as itself
  (discriminated union); no released manifest is rewritten. The template
  moves to v9; the released Signage 0.1.5 manifest is a test fixture.
- Real module routes: /<id> is the landing view, /<id>/<page> a declared
  page, anything beneath a page a module-owned detail route; anything else
  is not-found and mounts nothing. api/assets/display are never pages.
- Sidebar: declared icons, pages nested under an open module, one
  aria-current, collapsed and drawer behaviour; v8 modules unchanged.
- module-ui-sdk: ModuleUiHostContext.navigation (location, subscribe,
  navigate, link, settings), refusing anything outside the module's routes;
  undefined on the display host. Mount ABI unchanged.
- Return-to-origin: one `?return=` carrier on Settings URLs, validated by
  parseReturnTarget and against running modules' declared routes; Settings
  Back returns to exactly the originating module page, across refreshes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-15 08:21:50 -05:00

109 lines
3.5 KiB
TypeScript

/**
* `@ekklesia/module-sdk`: the supported module-author API (ADR 0053).
*
* Every export is chosen. The platform's internal contracts (identity parsing, authorization,
* lifecycle, manifest internals beyond what a module validates about itself) are not re-exported,
* and neither is the legacy Drizzle database facade. A module that uses a database declares
* `database: { abi: 1 }` and gets its database types and helpers from `@ekklesia/module-database`.
* Nothing here loads or requires Drizzle.
*/
export type {
Awaitable,
CapabilityId,
CapabilityRegistrar,
CapabilityResolver,
ModuleId,
RegisteredCapability,
} from "@ekklesia/contracts";
// HTTP routes (ADR 0015, ADR 0042).
// Who is calling (ADR 0013, ADR 0036): only what a route handler receives and branches on.
// Configuration (ADR 0029).
// Object storage (ADR 0030, ADR 0031).
// Realtime (ADR 0032).
// The module's own static artifacts, for a module's tests to validate them the way Core does.
export {
ANONYMOUS_PRINCIPAL,
type EkklesiaAnonymousPrincipal,
type EkklesiaAuthenticatedPrincipal,
type EkklesiaDeviceId,
type EkklesiaDevicePrincipal,
type EkklesiaPrincipal,
type EkklesiaUserId,
EMPTY_MODULE_CONFIGURATION,
EMPTY_MODULE_STORAGE,
isAnonymousPrincipal,
isAuthenticatedPrincipal,
isDevicePrincipal,
isModuleHttpMethod,
isModuleRouteBodyMode,
isModuleStorageError,
isValidModuleStorageKey,
isValidModuleStorageReadUrlFilename,
MODULE_HTTP_BODY_MODES,
MODULE_HTTP_METHODS,
MODULE_REALTIME_CHANNEL_MAX_LENGTH,
MODULE_REALTIME_ERROR_CODES,
MODULE_REALTIME_MAX_CHANNELS_PER_MODULE,
MODULE_REALTIME_MAX_PAYLOAD_BYTES,
MODULE_REALTIME_MAX_SUBSCRIBERS_PER_CHANNEL,
MODULE_ROUTE_ABSOLUTE_MAX_BODY_BYTES,
MODULE_ROUTE_MAX_BODY_BYTES_CEILING,
MODULE_ROUTE_STREAMED_MAX_BODY_BYTES_CEILING,
MODULE_STORAGE_ERROR_CODES,
MODULE_STORAGE_KEY_MAX_BYTES,
MODULE_STORAGE_READ_URL_DEFAULT_SECONDS,
MODULE_STORAGE_READ_URL_FILENAME_MAX_LENGTH,
MODULE_STORAGE_READ_URL_MAX_SECONDS,
MODULE_STORAGE_READ_URL_MIN_SECONDS,
type ModuleConfiguration,
type ModuleConfigurationValue,
type ModuleHttpMethod,
type ModuleManifest,
moduleManifestNavigation,
MODULE_NAVIGATION_ICONS,
type ModuleNavigationDeclaration,
type ModuleNavigationIcon,
type ModuleNavigationPage,
type ModuleRealtimeChannel,
type ModuleRealtimeChannelDefinitionInput,
type ModuleRealtimeChannelRegistrar,
ModuleRealtimeError,
type ModuleRealtimeErrorCode,
type ModuleRealtimeJsonPrimitive,
type ModuleRealtimeJsonValue,
type ModuleRealtimePublisher,
type ModuleRouteBodyMode,
type ModuleRoutePath,
type ModuleStorage,
type ModuleStorageBody,
type ModuleStorageBucket,
ModuleStorageError,
type ModuleStorageErrorCode,
type ModuleStorageListing,
type ModuleStorageListOptions,
type ModuleStorageObject,
type ModuleStorageObjectMetadata,
type ModuleStoragePutOptions,
type ModuleStorageReadUrl,
type ModuleStorageReadUrlOptions,
parseDrizzleMigrationJournal,
parseModuleManifest,
parseModuleMigrationPolicy,
} from "@ekklesia/contracts";
export {
defineModuleRuntime,
type ModuleRegistrationContext,
type ModuleRuntimeContext,
type ModuleRuntimeDefinition,
type ModuleRuntimeDefinitionWithDatabase,
type ModuleRuntimeDefinitionWithoutDatabase,
type ModuleRuntimeServices,
} from "./define-module-runtime.js";
export type {
ModuleHttpRouteRegistrar,
ModuleRouteDefinitionInput,
ModuleRouteHandler,
ModuleRouteHandlerContext,
} from "./http.js";