@anticrm/model Package

Packages > @anticrm/model

Classes

List of classes contained in this package or namespace
Class Description
Builder

Functions

List of functions contained in this package or namespace
Function Description
ArrayOf$() Mark attribute as collection, if attribute already had type, it will be wrapped inside.
BagOf$()
Class$(id, _extends, domain)
Enum$(id)
EnumOf$(of)
extendIds(a, b)
getAttribute(target, propertyKey)
getClass(target)
getEnum(target)
getEnumLiteral(target, propertyKey)
InstanceOf$(of)
isKindOf(target, kind)
Literal(enumVal) Construct a enum literal
loadClassifier(target)
loadClassifierChild(target, propertyKey)
mergeIds(a, b)
Mixin$(id, _extends)
Primary()
Prop(type) Construct a property
RefTo$(to)
verifyTranslation(ids, translations)
withMixin(_class, obj)

Interfaces

List of interfaces contained in this package or namespace
Interface Description
ClassifierDefinition

Variables

List of variables contained in this package or namespace
Variable Description
modelIds

Type Aliases

List of type aliases contained in this package or namespace
Type Alias Description
ClassifierPostProcessing

Functions

ArrayOf$

Mark attribute as collection, if attribute already had type, it will be wrapped inside.

Signature:

export declare function ArrayOf$(): (target: any, propertyKey: string) => void;

Returns:

(target: any, propertyKey: string) => void

BagOf$

Signature:

export declare function BagOf$(): (target: any, propertyKey: string) => void;

Returns:

(target: any, propertyKey: string) => void

Class$

Signature:

export declare function Class$<E extends Obj, T extends E>(id: Ref<Class<T>>, _extends: Ref<Class<E>>, domain?: string): <C extends new () => T>(constructor: C) => void;

Parameters

List of parameters
Parameter Type Description
id Ref<Class>
_extends Ref<Class>
domain string

Returns:

<C extends new () => T>(constructor: C) => void

Enum$

Signature:

export declare function Enum$<T extends EnumLiterals<E, EnumLiteral>, E extends EnumKey>(id: Ref<Enum<E>>): <C extends new () => T>(constructor: C) => void;

Parameters

List of parameters
Parameter Type Description
id Ref<Enum>

Returns:

<C extends new () => T>(constructor: C) => void

EnumOf$

Signature:

export declare function EnumOf$(of: Ref<Enum<any>>): (target: any, propertyKey: string) => void;

Parameters

List of parameters
Parameter Type Description
of Ref<Enum>

Returns:

(target: any, propertyKey: string) => void

extendIds

Signature:

export declare function extendIds<P extends Service, X extends PluginDependencies, D extends PluginDescriptor<P, X>, N extends Namespace>(a: D, b: N): D & N;

Parameters

List of parameters
Parameter Type Description
a D
b N

Returns:

D & N

getAttribute

Signature:

export declare function getAttribute(target: any, propertyKey: string): Attribute;

Parameters

List of parameters
Parameter Type Description
target any
propertyKey string

Returns:

Attribute

getClass

Signature:

export declare function getClass(target: any): ClassifierDefinition<Class<Obj>>;

Parameters

List of parameters
Parameter Type Description
target any

Returns:

ClassifierDefinition<Class<Obj>>

getEnum

Signature:

export declare function getEnum(target: any): ClassifierDefinition<Enum<any>>;

Parameters

List of parameters
Parameter Type Description
target any

Returns:

ClassifierDefinition<Enum<any>>

getEnumLiteral

Signature:

export declare function getEnumLiteral(target: any, propertyKey: string): EnumLiteral;

Parameters

List of parameters
Parameter Type Description
target any
propertyKey string

Returns:

EnumLiteral

InstanceOf$

Signature:

export declare function InstanceOf$<T extends Emb>(of: Ref<Class<T>>): (target: any, propertyKey: string) => void;

Parameters

List of parameters
Parameter Type Description
of Ref<Class>

Returns:

(target: any, propertyKey: string) => void

isKindOf

Signature:

export declare function isKindOf(target: any, kind: ClassifierKind): boolean;

Parameters

List of parameters
Parameter Type Description
target any
kind ClassifierKind

Returns:

boolean

Literal

Construct a enum literal

Signature:

export declare function Literal(enumVal: any): (target: any, propertyKey: string) => void;

Parameters

List of parameters
Parameter Type Description
enumVal any

Returns:

(target: any, propertyKey: string) => void

loadClassifier

Signature:

export declare function loadClassifier<T extends Doc>(target: any): ClassifierDefinition<T>;

Parameters

List of parameters
Parameter Type Description
target any

Returns:

ClassifierDefinition<T>

loadClassifierChild

Signature:

export declare function loadClassifierChild(target: any, propertyKey: string): Emb | undefined;

Parameters

List of parameters
Parameter Type Description
target any
propertyKey string

Returns:

Emb | undefined

mergeIds

Signature:

export declare function mergeIds<A extends PluginIds, B extends PluginIds>(a: A, b: B): A & B;

Parameters

List of parameters
Parameter Type Description
a A
b B

Returns:

A & B

Mixin$

Signature:

export declare function Mixin$<E extends Obj, T extends E>(id: Ref<Mixin<T>>, _extends: Ref<Class<E>>): <C extends new () => T>(constructor: C) => void;

Parameters

List of parameters
Parameter Type Description
id Ref<Mixin>
_extends Ref<Class>

Returns:

<C extends new () => T>(constructor: C) => void

Primary

Signature:

export declare function Primary(): (target: any, propertyKey: string) => void;

Returns:

(target: any, propertyKey: string) => void

Prop

Construct a property

Signature:

export declare function Prop(type?: Ref<Class<Type>>): (target: any, propertyKey: string) => void;

Parameters

List of parameters
Parameter Type Description
type Ref<Class<Type>>

Returns:

(target: any, propertyKey: string) => void

RefTo$

Signature:

export declare function RefTo$(to: Ref<Class<Doc>>): (target: any, propertyKey: string) => void;

Parameters

List of parameters
Parameter Type Description
to Ref<Class<Doc>>

Returns:

(target: any, propertyKey: string) => void

verifyTranslation

Signature:

export declare function verifyTranslation<T extends StringIds>(ids: T, translations: AsStrings<T>): {
    [key: string]: string;
};

Parameters

List of parameters
Parameter Type Description
ids T
translations AsStrings

Returns:

{ [key: string]: string; }

withMixin

Signature:

export declare function withMixin<T extends Obj>(_class: Ref<Mixin<T>>, obj: Partial<Omit<T, keyof Obj>>): (target: any, propertyKey: string) => void;

Parameters

List of parameters
Parameter Type Description
_class Ref<Mixin>
obj PartialObj>>

Returns:

(target: any, propertyKey: string) => void

Variables

modelIds

Signature:

modelIds: {
    class: {
        Obj: Ref<Class<Obj>>;
        Emb: Ref<Class<Emb>>;
        Doc: Ref<Class<Doc>>;
        Classifier: Ref<Class<Classifier>>;
        Attribute: Ref<Class<Attribute>>;
        Class: Ref<Class<Class<Obj>>>;
        Mixin: Ref<Class<Mixin<Obj>>>;
        EnumLiteral: Ref<Class<EnumLiteral>>;
        Enum: Ref<Class<Enum<any>>>;
        Type: Ref<Class<Type>>;
        String: Ref<Class<Type>>;
        Number: Ref<Class<Type>>;
        Boolean: Ref<Class<Type>>;
        Date: Ref<Class<Type>>;
        ArrayOf: Ref<Class<ArrayOf>>;
        RefTo: Ref<Class<RefTo<Doc>>>;
        BagOf: Ref<Class<BagOf>>;
        InstanceOf: Ref<Class<InstanceOf<Emb>>>;
        EnumOf: Ref<Class<EnumOf<EnumKey>>>;
        Tx: Ref<Class<Tx>>;
        ObjectTx: Ref<Class<ObjectTx>>;
        ObjectTxDetails: Ref<Class<ObjectTxDetails>>;
        CreateTx: Ref<Class<CreateTx>>;
        UpdateTx: Ref<Class<UpdateTx>>;
        ObjectSelector: Ref<Class<ObjectSelector>>;
        TxOperation: Ref<Class<TxOperation>>;
        DeleteTx: Ref<Class<DeleteTx>>;
        Title: Ref<Class<Title>>;
        VDoc: Ref<Class<VDoc>>;
        Space: Ref<Class<Space>>;
        SpaceUser: Ref<Class<SpaceUser>>;
        Reference: Ref<Class<Reference>>;
        Application: Ref<Class<Application>>;
    };
    mixin: {
        Indices: Ref<Mixin<Indices>>;
        ShortID: Ref<Mixin<ShortID>>;
    };
}

Type Aliases

ClassifierPostProcessing

Signature:

export declare type ClassifierPostProcessing<T extends Doc> = (model: Model, classifier: T) => void;