schema_registry.ts

Declarations
#

3 declarations

view source

global_schema_registry
#

SchemaRegistry
#

schema_registry.ts view source

A central registry for schemas and actions. Provides a single source of truth for schema definitions.

schemas

All schemas, including model schemas, action params, and responses.

type Array<z.ZodType>

model_schemas

Model schemas are distinct from the action schemas. Models are the nouns compared to the Action verbs, and compared to Views they are data not Svelte components.

type Array<z.ZodType>

action_params_schemas

Action parameter schemas.

type Array<z.ZodType>

action_response_schemas

Action response schemas.

type Array<z.ZodType>

schema_by_name

Map of schema names to schemas.

type Map<VocabName, z.ZodType>

name_by_schema

Map of schemas to their names, for reverse lookup. Zod schemas don't have a name property and we don't want to abuse description.

type Map<z.ZodType, VocabName>

action_specs

Collection of all action specs.

type Array<ActionSpecUnion>

request_response_action_specs

Collection of 'request_response' action specs.

type Array<RequestResponseActionSpec>

remote_notification_action_specs

Collection of 'remote_notification' action specs.

type Array<RemoteNotificationActionSpec>

local_call_action_specs

Collection of 'local_call' action specs.

type Array<LocalCallActionSpec>

action_spec_by_name_map

Map of action spec names to action specs.

type Map<ActionMethod, ActionSpecUnion>

add_schema

Add a schema to the appropriate registries.

type (name: VocabName, schema: ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> | { method: string; initiator: "both" | "frontend" | "backend"; side_effects: true | null; ... 5 more ...; async: true; } | { ...; } | { ...; }): void

name
schema
type ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> | { method: string; initiator: "both" | "frontend" | "backend"; side_effects: true | null; input: ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>; ... 4 more ...; async: true; } | { ...; } | { ...; }
returns void

register_many

Register multiple schemas at once.

type (schemas: Record<string, any>): void

schemas
type Record<string, any>
returns void

lookup_schema_name

Lookup a schema name, guaranteed to return a string, or throws.

type (schema: ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>): VocabName

schema
type ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>
returns VocabName

get_action_spec

Get an action specification by method name.

type (method: "ping" | "session_load" | "filer_change" | "diskfile_update" | "diskfile_delete" | "directory_create" | "completion_create" | "completion_progress" | "ollama_progress" | ... 15 more ... | "terminal_close"): { ...; } | ... 2 more ... | undefined

method
type "ping" | "session_load" | "filer_change" | "diskfile_update" | "diskfile_delete" | "directory_create" | "completion_create" | "completion_progress" | "ollama_progress" | ... 15 more ... | "terminal_close"
returns { method: string; initiator: "both" | "frontend" | "backend"; side_effects: true | null; input: ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>; output: ZodType<unknown, unknown, $ZodTypeInternals<...>>; description: string; kind: "request_response"; auth: "public" | ... 2 more ... | { ...; }; async: ...

get_schema

Get a schema by name.

type (name: VocabName): ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> | undefined

name
returns ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> | undefined

VocabName
#