/*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ import { PathHelper } from "@fluid-experimental/property-changeset"; import { BaseProperty, REFERENCE_RESOLUTION_TYPE } from "@fluid-experimental/property-properties"; export declare type Property = BaseProperty | undefined; export interface IOptions { referenceResolutionMode?: REFERENCE_RESOLUTION_TYPE; } /** * Currently not exposed to the world * @hidden * @internal */ export declare class PropertyElement { _property: Property; _childToken: string | number | undefined; /** * Currently not exposed to the world * * @param in_property - * @param in_childToken - * @hidden */ constructor(in_property?: Property, in_childToken?: string | number | undefined); /** * Return the current property. If getChildToken is defined, then we are actually inspecting an element * of this.getProperty(), which by definition must be a container. * * @returns the property the PropertyElement represents, or the container */ getProperty(): BaseProperty | undefined; /** * Return the child token, in the case where the current property element is focused on an element * of a primitive container. If not defined, the property element represents this.getProperty(). * If defined, the property element represents this.getProperty()[this.getChildToken()] * * @returns the token in the container this.getProperty(), or undefined if not a * container element. */ getChildToken(): string | number | undefined; /** * Returns true if the element is currently representing a value within a primitive collection, e.g., * a string in an array of strings, a float in a map of floats... * * @returns true if the current element is part of a primitive collection. */ isPrimitiveCollectionElement(): boolean; /** * If this element is part of a primitive collection (e.g. a string in an array of strings), return the * context of the collection we are in (e.g., an array if a string in an array of strings) * * @returns the context of the parent container if this is a primitive collection element, * undefined otherwise. */ getPrimitiveCollectionContext(): string | undefined; /** * Return the value represented by this property element. If representing a property, it will return the * property value. If representing an element within a container, it will give that container element value. * * @returns the value of the property element represented. */ getValue(): undefined | any; /** * If representing a property, it will set the property value. If representing an element * within a container, it will set the container element value. * * @param value - the new value */ setValue(value: any): void; /** * Return the absolute path to this property element, including a container dereference if it * represents an element within a container * * @returns the path from the workspace root */ getAbsolutePath(): string; /** * Return the tokenized path to this property element, including a container dereference if it * represents an element within a container. * * @returns the tokenized path from the workspace root */ getTokenizedPath(): string[]; /** * Return the typeid of this property element. If representing an element of a container, it will be the * container element type. * * @returns the id of this property element. */ getTypeId(): string | undefined; /** * Return the context of this property element. If representing an element of a container, it will be the * container element context. * * @returns the context */ getContext(): string | undefined; /** * Get a console-friendly printout of the path represented by this property element. * * @returns the console-friendly printout */ toString(): string; /** * Return whether this represents a valid property or element within a container property. * * @returns true if a valid property element */ isValid(): boolean; /** * Make the property element invalid */ invalidate(): void; /** * Return whether the element is a reference. Note, this means that if this property element represents an element * within a primitive array/map of references, this will return true. * * @returns true if the value represents a reference, false if invalid or not a reference. */ isReference(): boolean; /** * Return whether the element represents a reference container. * * @returns true if the value represents a reference container, false if invalid or not a * reference container. */ isReferenceContainer(): boolean; /** * Returns whether the property element is currently representing a primitive collection. * * @returns true if we are representing a primitive collection. */ isPrimitiveCollection(): boolean; /** * Get the child ids of the property represented by this element. * * @returns the ids of the children, or undefined if not a container */ getChildIds(): string[] | undefined; /** * Return the child (token or tokenized path) * * @param in_child - the tokenized path, or single child * @param in_options - parameter object * @param in_tokensTypes - The types of tokens if in_child is tokenized path. * @returns the element representing the child. If it does not exist, * this.isValid() will return false */ getChild(in_child: string[] | string, in_options?: IOptions, in_tokensTypes?: PathHelper.TOKEN_TYPES[]): PropertyElement; /** * Become the child (token or tokenized path). If the child does not exist, then this.isValid() will * be false. * * @param in_child - the tokenized path, or single child * @param in_tokensTypes - The types of tokens if in_child is tokenized path. * @param in_options - parameter object * @returns Current property element */ becomeChild(in_child: string[] | string, in_options?: IOptions, in_tokensTypes?: Array): PropertyElement; /** * Follow the reference represented by the current state of the element * * @param options - resolution options * * @returns Current property element */ becomeDereference(options?: IOptions): PropertyElement; /** * Follow the reference represented by the current state of the element, and return a new PropertyElement * * @param options - resolution options * * @returns a new property element representing the dereferenced property */ getDereference(options?: IOptions): PropertyElement; /** * Get the parent. * * @returns a new property element representing the parent; may not be valid */ getParent(): PropertyElement; /** * Become the parent. If the parent does not exist, then this.isValid() will * be false. * * @returns The current property element */ becomeParent(): PropertyElement; clone(): PropertyElement; } //# sourceMappingURL=propertyElement.d.ts.map