/** * @file This file provides a function that generically creates the config for a page of a FE v2 app (function getConfigForPage). * This process is also called 'import'. * Thereby, the page specific schema for this page is heavily used. It is assumed that this schema was generated using * the tools provided in file ../generate/schemaAdaptation.ts. * Unit tests for this class are located in test.unit.genericSchemaHandling.importPage.test.ts. */ import type { AccessorPath, CommonImportParameters, ConversionExitProvider, PageConfig } from '@sap/ux-specification-types'; /** * An instance of this type gives type information for a property in a type from a schema of a page. * * @property propertyName - the name of the property * @property propertyType - name of the global type of the property as defined in the generic schema of the page which is currently processed. */ export type PropertyTypeInfo = { propertyName: string; propertyType: string; }; /** * An instance of this type provides empty instances for a specified property within a config of a given page type. * * @param propertyTypePath - a path of property specifications that leads from the root of a config to the specified property. An empty array * indicates that an empty instance of the config itself should be returned. * @returns a new (empty) instance for the specified property. Note: If the path is not empty the type name contained in the * last entry of propertyTypePath will normally already provide sufficient type information to create this instance. All other information is * only provided for completeness. If the path is empty, the type information of the instance to be created anyway must be derived from the * type of the page currently processed. */ export type PropertyInstanceProvider = (propertyTypePath: PropertyTypeInfo[]) => object; /** * An instance of this type contains the type information that is needed for creating the config for a given page type (in addition to the specific schema). * * @property propertyInstanceProvider - provides empty instances of the config and its child objects on demand */ export type ImportConfigInfo = { propertyInstanceProvider: PropertyInstanceProvider; conversionExitProvider?: ConversionExitProvider; }; /** * An instance of this type provides instances of ImportConfigInfo based on the FE component name for the page type to be processed. * * @param componentName - fully qualified name of the FE v2 component that specifies the page type * @returns the ImportConfigInfo to be used to execute an import for any page of the specified page type */ export type ImportConfigInfoProvider = (componentName: string) => ImportConfigInfo | undefined; /** * This function creates and returns a config for a page of an FE v2 app (executes the 'import'). * * @param importParameters - required information from the app * @param pagePath - specifies the page within the app. Note that importParameters.jsonSchema must be * consistent with this path. That means that this schema must be the schema that is generated by getAdaptedSchema * in schemaAdaptation.ts for this page. This function does not check this consistency. * @param getConfigInfo - a function that can provide the ImportConfigInfo to be used for the specified page type * @returns the (filled) config for the specified page */ export declare function getConfigForPage(importParameters: CommonImportParameters, pagePath: AccessorPath, getConfigInfo: ImportConfigInfoProvider): PageConfig | undefined; //# sourceMappingURL=importPage.d.ts.map