@anticrm/foundation Package
Packages > @anticrm/foundation
Anticrm Platform Foundation Types
Classes
Class | Description |
---|---|
PlatformError | Error object wrapping Status |
Status | Status of an operation |
Enumerations
Enumeration | Description |
---|---|
PlatformStatusCodes | |
Severity | Status severity |
Type Aliases
Type Alias | Description |
---|---|
Resource | Platform Resource Identifier (PRI) |
Enumerations
PlatformStatusCodes enum
Signature:
export declare enum PlatformStatusCodes
Enumeration Members
Member | Value | Description |
---|---|---|
ACCOUNT_DUPLICATE | 104 |
|
ACCOUNT_NOT_FOUND | 103 |
|
AUTHENTICATON_OK | 101 |
|
AUTHENTICATON_REQUIRED | 102 |
|
CLIENT_VALIDATE_REQUIRED | 109 |
|
FORBIDDEN | 106 |
|
INCORRECT_PASSWORD | 105 |
|
INCORRECT_SECOND_FACTOR_CODE | 110 |
|
WORKSPACE_ALREADY_EXISTS | 107 |
|
WORKSPACE_NOT_FOUND | 108 |
Severity enum
Status severity
Signature:
export declare enum Severity
Enumeration Members
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