export declare type UUID = string; export declare type Instant = string; export interface ItemError { fields?: string[]; message?: string; } export interface ValidityError extends ItemError { } export interface SecurityError extends ItemError { } export interface PersistenceError extends ItemError { } export interface ItemMeta { instanceId?: UUID; state?: State; validity?: Validity; security?: Security; persistence?: Persistence; validityErrors?: ValidityError[]; securityErrors?: SecurityError[]; persistenceErrors?: PersistenceError[]; } export declare enum State { OK = "OK", ERROR = "ERROR" } export declare enum Validity { VALID = "VALID", INVALID = "INVALID", UNKNOWN = "UNKNOWN" } export declare enum Security { ALLOWED = "ALLOWED", FORBIDDEN = "FORBIDDEN", UNKNOWN = "UNKNOWN" } export declare enum Persistence { NEW = "NEW", DIRTY = "DIRTY", SAVED = "SAVED", SAVE_ERROR = "SAVE_ERROR" } export declare type AbsentFromPatchProps = '_meta' | 'creationUser' | 'modificationUser'; export declare type NonNullablePatchProps = 'id' | 'version' | 'type'; export declare type NullablePatchProps = Exclude; export declare type Patch = { [P in NullablePatchProps]?: T[P] | null; } & { [P in NonNullablePatchProps]?: T[P]; }; /** * template type for item received from ozone */ export declare type FromOzone = T & { id: UUID; version: UUID; _meta: ItemMeta; tenant: UUID; type: string; }; /** * Transform an item to an object than can be saved. * undefined values (not be modify on ozone) * @param item */ export declare function toPatch(item: T): Patch; /** * Transform an item to an object than can be saved * undefined value will be set to null (erase on ozone) * @param item */ export declare function toPatchWithUndefinedAsNull(item: T): Patch; export declare class Item { id?: UUID; version?: UUID; type?: string; _meta?: ItemMeta; name?: string; deleted?: boolean; traits?: string[]; tenant?: UUID; creationUser?: UUID; modificationUser?: UUID; constructor(src?: Item); } export declare class GenericItem extends Item { [key: string]: any; } /** * Decorator for class that extend ozone item * @param typeIdentifier * @constructor */ export declare function OzoneType(typeIdentifier: string): {}>(constructor: T) => { new (...args: any[]): { type: string; }; } & T;