/*! Copyright (c) 2018 Siemens AG. Licensed under the MIT License. */ import { CoatyObject } from "./object"; /** * Type alias for all framework core types. This type is used for the * coreType property of objects based on the CoatyObject interface. */ export declare type CoreType = "CoatyObject" | "User" | "Annotation" | "Task" | "IoContext" | "IoNode" | "IoSource" | "IoActor" | "Identity" | "Log" | "Location" | "Snapshot"; /** * Provides utility methods and constants for core object types. */ export declare class CoreTypes { static readonly OBJECT_TYPE_PREFIX = "coaty."; static readonly OBJECT_TYPE_OBJECT: string; static readonly OBJECT_TYPE_USER: string; static readonly OBJECT_TYPE_ANNOTATION: string; static readonly OBJECT_TYPE_TASK: string; static readonly OBJECT_TYPE_IO_CONTEXT: string; static readonly OBJECT_TYPE_IO_NODE: string; static readonly OBJECT_TYPE_IO_SOURCE: string; static readonly OBJECT_TYPE_IO_ACTOR: string; static readonly OBJECT_TYPE_IDENTITY: string; static readonly OBJECT_TYPE_LOG: string; static readonly OBJECT_TYPE_LOCATION: string; static readonly OBJECT_TYPE_SNAPSHOT: string; private static readonly _coreTypesMap; /** * Determines whether the given object has the shape of a concrete subtype * of CoatyObject, i.e. satisfies either the concrete interface defined by the * object's coreType property or the specified coreType parameter. * @param obj any * @param coreType a framework core type to check for (optional) */ static isObject(obj: any, coreType?: CoreType): boolean; /** * Returns the given object if has the shape of a concrete subtype * of CoatyObject, i.e. satisfies the concrete interface defined by the * object's coreType property or the specified coreType parameter. * Otherwise, undefined is returned. * @param obj any * @param coreType a framework core type to check for (optional) */ static asObject(obj: any, coreType?: CoreType): CoatyObject; /** * Determines whether the specified value is an array of non-empty strings. * @param obj any */ static isStringArray(obj: any): boolean; /** * Determines whether the specified value is an array of CoreType strings. * @param obj */ static isCoreTypeArray(obj: any): boolean; /** * Determines whether the specified value is an array of objects * of the given core type(s) or of the core type specified on each object. * @param obj any * @param coreType a framework core type or an array of core types */ static isObjectArray(obj: any, coreType?: CoreType | CoreType[]): boolean; /** * Gets an array of all defined framework core types. */ static getCoreTypes(): any[]; /** * Gets the object type for the given core type. * @param coreType a core type */ static getObjectTypeFor(coreType: CoreType): string; /** * Gets the core type for the given core object type, or * `undefined` if the given object type doesn't represent a * core object. * * @param objectType an object type string */ static getCoreTypeFor(objectType: string): string; /** * Determines whether the given type string defines a framework core type. * @param type a type string */ static isCoreType(type: string): boolean; /** * Determines whether the given type string defines a framework core object type. * @param type a type string */ static isCoreObjectType(type: string): boolean; /** * Returns a deep copy of the specified `CoatyObject` according to JSON conventions. If the object passed in * is `undefined`, `undefined` is returned. Note that all (own and inherited) enumerable properties of the * given object are copied, not only the properties defined in the interface definition of the corresponding * core type. Properties are copied according to JSON data type conventions. In effect, this clone method * always yields the same result as `JSON.parse(JSON.stringify(obj))`. * * Note: by default the passed in argument is validated to conform to a framework core type. * This method throws a TypeError if the given argument is not a valid CoatyObject. * To skip this validation test, use the `shouldSkipValidation` argument. * * @param obj a CoatyObject to clone or undefined */ static clone(obj: T, shouldSkipValidation?: boolean): T; /** * Determines wether the given parameter is a Date * @param obj any */ static isDate(obj: any): boolean; /** * Determines whether the given object has the shape of the given subtype * of CoatyObject, i.e. satisfies the concrete interface defined by the * object's coreType property. * @param obj any * @param coreType a framework core type */ private static _isAssignable; /** * Returns the given object if it is assignable to the given * framework core type. Otherwise, undefined is returned. * @param obj any * @param coreType a framework core type */ private static _assignableAs; private static _isObject; private static _isUser; private static _isScimNames; private static _isScimMultiValuedAttribute; private static _isScimMultiValuedAttributes; private static _isScimAddresses; private static _isIoContext; private static _isIoNode; private static _isAnnotation; private static _isTask; private static _isIoSource; private static _isIoActor; private static _isIdentity; private static _isLog; private static _isLogHost; private static _isAgentInfo; private static _isLocation; private static _isSnapshot; }