ObjectStackObjectStack

Dispatcher

Dispatcher protocol schemas

HttpDispatcher Protocol

Defines how the ObjectStack HttpDispatcher routes incoming API requests to the correct kernel service based on URL prefix matching.

The dispatcher is the central routing component that:

  1. Matches incoming request URLs against registered route prefixes
  2. Delegates to the corresponding CoreService implementation
  3. Returns 503 Service Unavailable when a service is not registered
  4. Serves prefixes registered by the kernel services above. Plugins that need a code handler mount it imperatively on the http.server service (resolve it from the plugin context on kernel:ready), NOT through the manifest's contributes.routes key — nothing reads that key, so an entry there parses cleanly and serves nothing.

Architecture alignment:

  • Kubernetes: API server aggregation layer
  • Eclipse: Extension registry routing
  • VS Code: Command palette routing

Source: packages/spec/src/api/dispatcher.zod.ts

TypeScript Usage

import { DispatcherConfigSchema, DispatcherErrorCode, DispatcherErrorResponseSchema, DispatcherRouteSchema } from '@objectstack/spec/api';
import type { DispatcherConfig, DispatcherErrorCode, DispatcherErrorResponse, DispatcherRoute } from '@objectstack/spec/api';

// Validate data
const result = DispatcherConfigSchema.parse(data);

DispatcherConfig

Properties

PropertyTypeRequiredDescription
routes{ prefix: string; service: Enum<'metadata' | 'data' | 'auth' | 'storage' | 'file-storage' | 'search' | 'cache' | …>; authRequired: boolean; criticality: Enum<'required' | 'core' | 'optional'>; … }[]Route-to-service mappings
fallbackEnum<'404' | 'proxy' | 'custom'>optional (default: "404")Behavior when no route matches
proxyTargetstringoptionalProxy target URL when fallback is "proxy"

DispatcherErrorCode

Route-resolution failure mode emitted in error.code

Allowed Values

  • ROUTE_NOT_FOUND
  • METHOD_NOT_ALLOWED
  • NOT_IMPLEMENTED
  • SERVICE_UNAVAILABLE

DispatcherErrorResponse

Properties

PropertyTypeRequiredDescription
successfalse
error{ code: string; message: string; httpStatus?: integer; route?: string; … }

DispatcherRoute

Properties

PropertyTypeRequiredDescription
prefixstringURL path prefix for routing (e.g. /api/v1/data)
serviceEnum<'metadata' | 'data' | 'auth' | 'storage' | 'file-storage' | 'search' | 'cache' | 'queue' | 'automation' | 'analytics' | 'realtime' | 'job' | 'notification' | 'ai' | 'i18n' | 'ui'>Target core service name
authRequiredbooleanoptional (default: true)Whether authentication is required
criticalityEnum<'required' | 'core' | 'optional'>optional (default: "optional")Service criticality level for unavailability handling
permissionsstring[]optionalRequired permissions for this route namespace

On this page