// SITE SCHEMA export interface ScSiteSchema { languages: string[]; defaultLanguage: string; isMultilingual: boolean; languageRoutingMode: "prefixSecondary" | "prefixAll"; nodeTypes: { _site: ScSiteType; home: ScRoutingDocumentType; [typeName: string]: ScNodeType; }; mediaPolicies: { default: ScDefaultMediaPolicy; [policyName: string]: ScMediaPolicy; }; imageQualityPolicy: ScImageCompressionQualityPolicyStep[]; languageLabels: { [language: string]: string }; l10n: ScSchemaLocales; } export interface ScLocalizedString { [language: string]: string | undefined; } export interface ScSchemaLocales { [language: string]: ScSchemaTranslations; } export interface ScSchemaTranslations { languageLabel: string; siteTheme?: string; nodeTypes: { [typeName: string]: ScTranslations }; } export interface ScTranslations { [key: string]: string | ScTranslations; } // NODE TYPES export type ScNodeType = ScSiteType | ScDocumentType | ScPartType; export interface ScSiteType { kind: "site"; typeName: "_site"; fields: ScFieldType[]; mediaPolicy?: string; } export type ScDocumentType = ScRoutingDocumentType | ScRegularDocumentType; export type ScDocumentKind = ScDocumentType["documentKind"]; export interface ScDocumentTypeBase { typeName: string; kind: "document"; kebabName: string; ogType?: string; jsonLdType?: string; withFeaturedImage?: boolean; fields?: ScFieldType[]; mediaPolicy?: string; lists?: ScListType[]; /** Type names of child routing documents */ routingChildren?: string[]; /** Type names of child regular documents */ regularChildren?: string[]; regularChildrenSorting?: ScSorting; childLimit?: number; hasFrontendApp?: boolean; useUrlQuery?: boolean; templateNames: string[]; /** Cluster configuration for this document type */ cluster?: ScClusterType; adminUi?: ScDocumentAdminUiSettings; } export interface ScClusterType { autoCreate?: boolean; } export type ScSorting = ScSortRule[] | "manual"; export interface ScSortRule { fieldName: string; direction: "asc" | "desc"; } export interface ScRoutingDocumentType extends ScDocumentTypeBase { documentKind: "routing"; redirectTo?: "parent"; /** * This is the URL segment of the document. It is defined for all the routing documents except for * the home. */ route?: ScLocalizedString; } export interface ScDocumentAdminUiSettings { defaultTab?: ScDocumentTabName; /** Used by routing documents only. Default value is `"default"`. */ menuPlacement?: "default" | "popup"; /** * The package name of the plugin providing the panel that replaces the standard inputs in the * document creation dialog. Used by regular documents only. */ creationPanel?: string; } export type ScDocumentTabName = "auto" | "edit" | "childDocuments" | "parts"; export interface ScRegularDocumentType extends ScDocumentTypeBase { documentKind: "regular"; redirectTo?: undefined; route: string; relativeIdGenerator?: ScRelativeIdGeneratorType; autoPublish?: boolean; } export type ScRelativeIdGeneratorType = [makerName: string, ...args: any[]]; // PART TYPES export interface ScListType { listName: string; sorting: ScSorting; /** The list of part type names. */ parts: string[]; limit?: number; } export interface ScPartType { kind: "part"; typeName: string; kebabName: string; fields?: ScFieldType[]; mediaPolicy?: string; list?: ScListType; } // FIELD TYPES export type ScFieldType = | ScMainDbFieldType | ScMediaDbFieldType | ScLabelingFieldType | ScPartFieldType; export type ScFieldDataType = ScFieldType["dataType"]; export type ScFieldStoredAs = ScFieldType["storedAs"]; export interface ScFieldTypeBase { name: string; qualifiedName: string; readOnly?: boolean; pluginName?: string; withGallery?: boolean; useAsDefaultImage?: number; renderAs?: "html"; useAsExcerpt?: number; adminUi?: ScFieldAdminUiSettings; } export interface ScFieldAdminUiSettings { /** Default is `"auto"`. */ showInCard?: boolean | "auto"; [key: string]: any; } export interface ScLocalizableFieldTypeBase extends ScFieldTypeBase { localized: boolean; normalizeTypography?: boolean; } export interface ScLabelingFieldType extends ScFieldTypeBase { localized: false; storedAs: "labeling"; dataType: "labeling"; taxonomy: string; multiple?: boolean; } export interface ScPartFieldType extends ScFieldTypeBase { localized: false; storedAs: "partField"; dataType: "partField"; /** The type name of the wrapped part. */ partType: string; } export type ScMainDbFieldType = | ScNumberFieldType | ScBooleanFieldType | ScDateFieldType | ScDateTimeFieldType | ScTimeFieldType | ScStringFieldType | ScJsonFieldType; export interface ScNumberFieldType extends ScLocalizableFieldTypeBase { storedAs: "varchar"; dataType: "number"; currency?: string; enum?: number[]; } export interface ScBooleanFieldType extends ScLocalizableFieldTypeBase { storedAs: "varchar"; dataType: "boolean"; } export interface ScDateFieldType extends ScLocalizableFieldTypeBase { storedAs: "varchar"; dataType: "date"; } export interface ScDateTimeFieldType extends ScLocalizableFieldTypeBase { storedAs: "varchar"; dataType: "dateTime"; } export interface ScTimeFieldType extends ScLocalizableFieldTypeBase { storedAs: "varchar"; dataType: "time"; } export interface ScStringFieldType extends ScLocalizableFieldTypeBase { storedAs: "text" | "varchar"; dataType: "string"; multiline?: boolean; enum?: string[]; } export interface ScJsonFieldType extends ScLocalizableFieldTypeBase { storedAs: "text" | "varchar"; dataType: "json"; } export type ScMediaDbFieldType = ScGalleryFieldType | ScMediaFieldType; export interface ScGalleryFieldType extends ScLocalizableFieldTypeBase { storedAs: "mediaHandle"; dataType: "gallery"; accept: string; refuse?: string; } export interface ScMediaFieldType extends ScLocalizableFieldTypeBase { storedAs: "mediaHandle"; dataType: "media"; accept: string; refuse?: string; } // MEDIA POLICIES export interface ScMediaPolicy { policyName: string; mediaLimitPerDocument?: number; mediaLimitPerPart?: number; attachedDocument?: ScAttachedDocumentPolicy; image?: ScImagePolicy; } export interface ScDefaultMediaPolicy extends Omit { image: ScImagePolicy; } export interface ScAttachedDocumentPolicy { siteWeightLimitB?: number; } export interface ScImagePolicy { weightLimitB?: number; areaLimitPx?: number; } export interface ScImageCompressionQualityPolicyStep { areaLimitPx?: number; quality: number; }