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: { method: "completion_create" | "completion_progress" | "directory_create" | "diskfile_delete" | "diskfile_update" | "filer_change" | "ollama_copy" | ... 12 more ... | "toggle_main_menu"; ... 6 more ...; async: true; } | { ...; } | { ...; } | ZodType<...>): void

name
schema
type { method: "completion_create" | "completion_progress" | "directory_create" | "diskfile_delete" | "diskfile_update" | "filer_change" | "ollama_copy" | "ollama_create" | "ollama_delete" | ... 10 more ... | "toggle_main_menu"; ... 6 more ...; async: true; } | { ...; } | { ...; } | ZodType<...>
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: "completion_create" | "completion_progress" | "directory_create" | "diskfile_delete" | "diskfile_update" | "filer_change" | "ollama_copy" | "ollama_create" | "ollama_delete" | ... 10 more ... | "toggle_main_menu"): { ...; } | ... 2 more ... | undefined

method
type "completion_create" | "completion_progress" | "directory_create" | "diskfile_delete" | "diskfile_update" | "filer_change" | "ollama_copy" | "ollama_create" | "ollama_delete" | ... 10 more ... | "toggle_main_menu"
returns { method: "completion_create" | "completion_progress" | "directory_create" | "diskfile_delete" | "diskfile_update" | "filer_change" | "ollama_copy" | "ollama_create" | "ollama_delete" | ... 10 more ... | "toggle_main_menu"; ... 6 more ...; async: true; } | { ...; } | { ...; } | undefined

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
#