CRUDUI

Home > @polyspec/crudui-validator > ItemsSource

ItemsSource interface

Dynamic option source (dependency isolation: dynamic items → items sub). Collects the source descriptor in one place.

STRUCTURE ONLY. This type fixes the declared shape of a dynamic source; it does NOT load options. The supported shape (type: search) is a model (a name string OR a nested { table, relations, keys } query) plus a sibling api_server (a runtime HTTP-endpoint function reference) plus a placeholder static items. None of model/api_server/items is resolved here — the runtime calls api_server, runs the model query, and replaces the placeholder. Runtime resolution is out of scope (SPEC §6 R1).

Signature:

export interface ItemsSource 

Properties

Property

Modifiers

Type

Description

api_server?

string

(Optional) Runtime HTTP-endpoint function reference (an opaque source-callback string, e.g. "function() { return '/admin/user/search'; }"). Preserved verbatim; the engine never calls it — invoking the endpoint is runtime, out of scope.

items?

StaticItem[] | ChoiceList | ItemLabelMap

(Optional) Placeholder static items that coexists with the dynamic source: the pre-fetch choices the UI shows before api_server/model resolve (often the empty [] or a single { "": "Select" } prompt). A static array or a value→label map; the runtime replaces it with the fetched rows.

method?

string

(Optional) Method on the model invoked to fetch option rows.

model?

string | ItemsModel

(Optional) Data model the options are loaded from. Either a model-name string OR a nested { table, relations, keys } relational query.

relations?

unknown

(Optional) Relation descriptors used when loading options.

table?

string

(Optional) Table the options are loaded from (top-level shorthand of model.table).