@adobe/aem-spa-page-model-manager
Version:
An interpreter between AEM Editor and the AEM SPA Editor.
84 lines • 2.93 kB
TypeScript
import { Model } from './Model';
/**
* The ModelStore is in charge of providing access to the data model. It provides the CRUD operations over the model.
* To protect the integrity of the data it initially returns immutable data. If needed, you can request a mutable object.
*/
export declare class ModelStore {
private _pageContentDelimiter;
private _data;
private _rootPath;
/**
* @param [rootPath] Root path of the model.
* @param [data] Initial model.
* @private
*/
constructor(rootPath?: string, data?: Model);
/**
* Initializes the the ModelManager.
* @param rootPath Model root path.
* @param data Initial model.
* @private
*/
initialize(rootPath: string, data: Model): void;
/**
* Returns the current root path.
* @returns Model root path.
*/
get rootPath(): string;
/**
* Returns page model.
* @returns Page model.
*/
get dataMap(): any;
/**
* Replaces the data in the given location.
* @param path Path of the data.
* @param newData New data to be set.
* @private
*/
setData(path: string, newData?: any): void;
/**
* Returns the data for the given path. If no path is provided, it returns the whole data.
* @param [path] Path to the data.
* @param [immutable=true] Indicates whether a data clone should be returned.
* @return Data for given path, whole data or `undefined`.
*/
getData<M extends Model>(path?: string | null, immutable?: boolean): M | undefined;
/**
* Insert the provided data at the location of the given path. If no sibling name is provided the data is added at the end of the list.
* @param path Path to the data.
* @param data Data to be inserted.
* @param [siblingName] Name of the item before or after which to add the data.
* @param [insertBefore=false] Should the data be inserted before the sibling.
* @private
*/
insertData(path: string, data: Model, siblingName?: string | null, insertBefore?: boolean): void;
/**
* Removes the data located at the provided location.
* @param path Path of the data.
* @private
* @return {string|null} Path to the parent item initially containing the removed data.
*/
removeData(path: string): string | null;
/**
* @private
*/
destroy(): void;
/**
* Retrieves the item and eventually returns the data wrapped with the parent information.
* @param path Path of the item.
* @param [data=_data] Data to be explored (must not be null!)
* @param [parent] Parent data.
* @param [parentPath=''] Path of the parent data.
* @private
* @return
*/
private _findItemData;
/**
* @param pagePath Path of the page.
* @private
* @return Data of the page.
*/
private _getPageData;
}
//# sourceMappingURL=ModelStore.d.ts.map