@anticrm/foundation Package

Packages > @anticrm/foundation

Anticrm Platform Foundation Types

Classes

List of classes contained in this package or namespace
Class Description
PlatformError Error object wrapping Status
Status Status of an operation

Enumerations

List of enums contained in this package or namespace
Enumeration Description
Severity Status severity

Type Aliases

List of type aliases contained in this package or namespace
Type Alias Description
Resource Platform Resource Identifier (PRI)

Enumerations

Severity enum

Status severity

Signature:

export declare enum Severity 

Enumeration Members

List of members in use in this enum
Member Value Description
ERROR 3
INFO 1
OK 0
WARNING 2

Type Aliases

Resource

Platform Resource Identifier (PRI)

Signature:

export declare type Resource<T> = string & {
    __resource: T;
};

Remarks

Almost anything in the Anticrm Platform is a Resource. Resources referenced by Platform Resource Identifier (PRI).

TODO: understand Resource better. Is this just a platform thing or should be in core as well

‘Resource’ is simply any JavaScript object. There is a plugin exists, which ‘resolve’ PRI into actual object. This is a difference from Metadata. Metadata object ‘resolved’ by Platform instance, so we may consider Metadata as a Resource, provided by Platform itself. Because there is always a plugin, which resolve Resource resolution is asynchronous process.

Resource is a string of kind:plugin.id format. Since Metadata is a kind of Resource. Metadata also can be resolved using resource API.

Example

  `class:contact.Person` as Resource<Class<Person>> // database object with id === `class:contact.Person`
  `string:class.ClassLabel` as Resource<string> // translated string according to current language and i18n settings
  `asset:ui.Icons` as Resource<URL> // URL to SVG sprites
  `easyscript:2+2` as Resource<() => number> // function