//#region src/schema/types.d.ts /** * Schema Registry Types * * These types represent the schema definitions stored in D1. * They are the source of truth for all collections and fields. */ /** * Supported field types */ type FieldType = "string" | "text" | "url" | "number" | "integer" | "boolean" | "datetime" | "select" | "multiSelect" | "portableText" | "image" | "file" | "reference" | "json" | "slug" | "repeater"; /** * SQLite column types that map from field types */ type ColumnType = "TEXT" | "REAL" | "INTEGER" | "JSON"; /** * Map field types to their SQLite column types */ declare const FIELD_TYPE_TO_COLUMN: Record; /** * Features a collection can support */ type CollectionSupport = "drafts" | "revisions" | "preview" | "scheduling" | "search" | "seo"; /** * Sources for how a collection was created */ /** * Where a collection's entries live: the database (default) or the site's * git repo as `content//.json` (admin saves are commits). */ type CollectionStorage = "db" | "git"; type CollectionSource = `template:${string}` | `import:${string}` | "manual" | "discovered" | "seed"; /** * Validation rules for a field */ /** Sub-field definition for repeater fields */ interface RepeaterSubField { slug: string; type: "string" | "text" | "url" | "number" | "integer" | "boolean" | "datetime" | "select" | "image"; label: string; required?: boolean; options?: string[]; } interface FieldValidation { required?: boolean; min?: number; max?: number; minLength?: number; maxLength?: number; pattern?: string; options?: string[]; subFields?: RepeaterSubField[]; minItems?: number; maxItems?: number; allowedMimeTypes?: string[]; } /** * Widget options for field rendering */ interface FieldWidgetOptions { rows?: number; showPreview?: boolean; collection?: string; allowMultiple?: boolean; [key: string]: unknown; } /** Collection-level admin presentation options. */ interface CollectionAdminConfig { /** Custom field slugs to show in the content list. */ listColumns?: string[]; } /** * A collection definition */ interface Collection { id: string; slug: string; label: string; labelSingular?: string; description?: string; icon?: string; admin?: CollectionAdminConfig; supports: CollectionSupport[]; source?: CollectionSource; storage: CollectionStorage; /** Whether this collection has SEO metadata fields enabled */ hasSeo: boolean; /** Field slug powering the admin list Title column. Defaults to the standard title display. */ titleField?: string; /** Field slug powering the admin list Date column. Must be a `datetime` field. Defaults to last-updated. */ dateField?: string; /** URL pattern with {slug} placeholder (e.g. "/{slug}", "/blog/{slug}") */ urlPattern?: string; /** Whether published entries require a public slug. Defaults to true. */ routable?: boolean; /** * Omit this collection's auto-generated entry from the admin sidebar. * The collection stays fully functional everywhere else (API, MCP, hooks, * direct `/content/:collection` URLs) — this only hides the nav link, so a * plugin that owns the collection can point editors at its own admin UI. */ hidden: boolean; /** * Explicit position in the admin sidebar. Collections with a `sortOrder` * come first, in ascending order; the rest keep the alphabetical-by-slug * order and follow. `undefined` means "no explicit position". */ sortOrder?: number; /** Whether comments are enabled for this collection */ commentsEnabled: boolean; /** Moderation strategy: "all" | "first_time" | "none" */ commentsModeration: "all" | "first_time" | "none"; /** Auto-close comments after N days. 0 = never close. */ commentsClosedAfterDays: number; /** Auto-approve comments from authenticated CMS users */ commentsAutoApproveUsers: boolean; createdAt: string; updatedAt: string; } /** * A field definition */ interface Field { id: string; collectionId: string; slug: string; label: string; type: FieldType; columnType: ColumnType; required: boolean; unique: boolean; defaultValue?: unknown; validation?: FieldValidation; widget?: string; options?: FieldWidgetOptions; sortOrder: number; searchable: boolean; /** Whether this field has a physical index for structured list queries. */ indexed: boolean; /** Whether this field is translatable (default true). Non-translatable fields are synced across locales. */ translatable: boolean; createdAt: string; } /** * Input for creating a collection */ interface CreateCollectionInput { slug: string; label: string; labelSingular?: string; description?: string; icon?: string; admin?: CollectionAdminConfig; supports?: CollectionSupport[]; source?: CollectionSource; storage?: CollectionStorage; urlPattern?: string; routable?: boolean; hasSeo?: boolean; /** Omit the auto-generated admin sidebar entry (defaults to false) */ hidden?: boolean; /** Explicit admin sidebar position (omit for the alphabetical fallback) */ sortOrder?: number | null; commentsEnabled?: boolean; } /** * Input for updating a collection */ interface UpdateCollectionInput { label?: string; labelSingular?: string; description?: string; icon?: string; admin?: CollectionAdminConfig; supports?: CollectionSupport[]; storage?: CollectionStorage; urlPattern?: string | null; routable?: boolean; hasSeo?: boolean; /** Omit the auto-generated admin sidebar entry */ hidden?: boolean; /** Explicit admin sidebar position; `null` clears it back to alphabetical */ sortOrder?: number | null; commentsEnabled?: boolean; commentsModeration?: "all" | "first_time" | "none"; commentsClosedAfterDays?: number; commentsAutoApproveUsers?: boolean; /** Field slug for the Title column; `null`/`""` clears back to the default. */ titleField?: string | null; /** Datetime field slug for the Date column; `null`/`""` clears back to the default. */ dateField?: string | null; } /** * Input for creating a field */ interface CreateFieldInput { slug: string; label: string; type: FieldType; required?: boolean; unique?: boolean; defaultValue?: unknown; validation?: FieldValidation | null; widget?: string; options?: FieldWidgetOptions; sortOrder?: number; /** Whether this field should be indexed for search */ searchable?: boolean; /** Create a physical index for structured sorting. */ indexed?: boolean; /** Whether this field is translatable (default true). Non-translatable fields are synced across locales. */ translatable?: boolean; } /** * Input for updating a field */ interface UpdateFieldInput { label?: string; /** * Change the field's type. Only storage-compatible text aliases (`string`, * `text`, and `slug`) can be changed in place. Other changes require an * explicit content migration. Omit to keep the current type. */ type?: FieldType; required?: boolean; unique?: boolean; defaultValue?: unknown; validation?: FieldValidation | null; widget?: string; options?: FieldWidgetOptions; sortOrder?: number; /** Whether this field should be indexed for search */ searchable?: boolean; /** Create or remove the physical index used by structured sorting. */ indexed?: boolean; /** Whether this field is translatable (default true). Non-translatable fields are synced across locales. */ translatable?: boolean; } /** * A collection with its fields */ interface CollectionWithFields extends Collection { fields: Field[]; } /** * Reserved field slugs that cannot be used. * * Includes names reserved for runtime hydration (`terms`, `bylines`, `byline`) * so user-defined fields never shadow the auto-hydrated values on entry.data. */ declare const RESERVED_FIELD_SLUGS: string[]; /** * Reserved collection slugs that cannot be used */ declare const RESERVED_COLLECTION_SLUGS: string[]; /** * Runtime value type for a byline custom field. The narrow union mirrors * what the five v1 field types can produce: `string`/`text`/`url`/`select` * → string, `boolean` → boolean, plus `null` for cleared values. */ type CustomFieldValue = string | boolean | null; //#endregion export { UpdateCollectionInput as _, CollectionWithFields as a, CreateFieldInput as c, Field as d, FieldType as f, RESERVED_FIELD_SLUGS as g, RESERVED_COLLECTION_SLUGS as h, CollectionSupport as i, CustomFieldValue as l, FieldWidgetOptions as m, CollectionAdminConfig as n, ColumnType as o, FieldValidation as p, CollectionSource as r, CreateCollectionInput as s, Collection as t, FIELD_TYPE_TO_COLUMN as u, UpdateFieldInput as v }; //# sourceMappingURL=types-BjBDp25t.d.mts.map