UNPKG

@progress/sitefinity-nextjs-sdk

Version:

Provides OOB widgets developed using the Next.js framework, which includes an abstraction layer for Sitefinity communication. Additionally, it offers an expanded API, typings, and tools for further development and integration.

136 lines (135 loc) 5.59 kB
import { SdkItem } from './dto/sdk-item'; /** * ServiceMetadata is a static class that caches the service metadata definition and provides methods to access it. * It is used to fetch and store the metadata for the current Sitefinity CMS instance, including entity definitions and their properties. */ export declare class ServiceMetadata { static serviceMetadataCache: ServiceMetadataDefinition; static serviceMetadataHash: string; static taxonomies: SdkItem[]; /** * Requests the content type metadata and initializes the service. * @returns {ServiceMetadataDefinition} The full types metadata definition. */ static fetch(metadataHash: string, traceContext?: any): Promise<ServiceMetadataDefinition>; /** * Gets the default field name for a given item type. * @param typeFullName The full type name of the item type. * @returns The default field name for the specified type. */ static getDefaultFieldName(typeFullName: string): string; /** * Gets the full type name for a given set name. * e.g. newsitems -> Telerik.Sitefinity.News.Model.NewsItem * @param itemType The full type name of the item type. * @returns The full type name for the specified set. */ getTypeNameFromSetName(itemType: string): string; /** * Gets the set name for a given item full type name. * e.g. Telerik.Sitefinity.News.Model.NewsItem -> newsitems * @param itemType The full type name of the item type. * @returns The set name for the specified type if such is matched. */ static getSetNameFromType(itemType: string): string | undefined; /** * Gets the display name of a given item type by its full type name. * @param itemType The full type name of the item type. * @returns The display name of the item type if such is found. */ static getModuleDisplayName(itemType: string): string; /** * Gets the current item's parent full type name. * @param itemType The child full type name. * @returns The parent item full type name. */ static getParentType(itemType: string): string | null; static getChildTypes(itemType: string): Array<Array<string>>; static isPropertyACollection(type: string, propName: string): boolean; /** * Gets a type's related data field's item type name. * @param type The full content type name. * @param relationName The related data field name. * @returns The related data type. */ static getRelatedType(type: string, relationName: string): string | null; static serializeFilterValue(type: string, propName: string, value: any): any; /** * Gets the names of the properties of a given type that are not related types. * @param type The full type name of the item type. * @returns A collection of the names of the properties of the given type that are not related types. */ static getSimpleFields(type: string): string[]; /** * Gets the names of the properties of a given type that are related types. * @param type The full type name of the item type. * @returns A collection of the names of the properties of the given type that are related types. */ static getRelationFields(type: string): string[]; /** * Gets the name of the taxonomy field for a given type by taxonomy name if such field exists on the type. * @param type The full type name of the item type. * @param taxonomyName The taxonomy name. * @returns The field name of the taxonomy field for the given type and taxonomy name if such field exists. */ static getTaxonomyFieldName(type: string, taxonomyName: string): string | undefined; /** * Gets the field type of a given property of a given type. * @param type The full type name of the item type. * @param propName The property name. * @returns {FieldType} The field type of the property. */ static getFieldType(type: string, propName: string): FieldType; /** * Checks if a module is enabled in the service metadata. * @param moduleName The name of the module to check. * @returns True if the module is enabled, false otherwise. */ static isModuleEnabled(moduleName: string): boolean; private static getEntityDefinition; private static isRelatedProperty; private static isPrimitiveProperty; } export interface ServiceMetadataDefinition { definitions: { [key: string]: any; }; entityContainer: { entitySets: { [key: string]: any; }; }; modules?: { [key: string]: boolean; }; } /** * FieldType is an enumeration that defines the different types of fields that can be found in the Sitefinity CMS. * It is used to identify the type of field for a given property in the content type metadata. */ export declare enum FieldType { /** * Represents a text field, which can be either short or long text. */ TextField = 0, /** * Represents a choice field, which can be either a single choice or multiple choices. */ ChoiceField = 1, /** * Represents a number field, which can be used for numeric values. */ NumberField = 2, /** * Represents a classification field, which is used for taxonomy fields. */ ClassificationField = 3, /** * Represents a date-time field, which is used for date and time values. */ DatetimeField = 4, /** * Represents a boolean field, which can be either true or false. */ BooleanField = 5 }