@anticrm/platform Package

Packages > @anticrm/platform

Plugin architecture and implementation

Enumerations

List of enums contained in this package or namespace
Enumeration Description
PluginStatus

Functions

List of functions contained in this package or namespace
Function Description
createPlatform()
getResourceInfo(resource)
identify(pluginId, namespace)
plugin(id, deps, namespace)

Interfaces

List of interfaces contained in this package or namespace
Interface Description
Platform
PluginDependencies A list of dependencies e.g. { core: core.id, ui: ui.id }.
PluginDescriptor A Plugin Descriptor, literally plugin ID + dependencies.
PluginInfo
ResourceInfo
Service Base interface for a plugin service.

Variables

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

Type Aliases

List of type aliases contained in this package or namespace
Type Alias Description
AnyPlugin
Metadata Platform Metadata Identifier (PMI).'Metadata' is simply any JavaScript object, which is used to configure platform, e.g. IP addresses. Another example of metadata is an asset URL. The logic behind providing asset URLs as metadata is we know URL at compile time only and URLs vary depending on deployment options.
Plugin_2 Plugin identifier.
PluginServices Convert list of dependencies to a list of provided services, e.g. PluginServices<{core: core.id}> === {core: CoreService}
ResourceKind

Enumerations

PluginStatus enum

Signature:

export declare enum PluginStatus 

Enumeration Members

List of members in use in this enum
Member Value Description
RUNNING 1
STOPPED 0

Functions

createPlatform

Signature:

export declare function createPlatform(): Platform;

Returns:

Platform

getResourceInfo

Signature:

export declare function getResourceInfo(resource: Resource<any>): ResourceInfo;

Parameters

List of parameters
Parameter Type Description
resource Resource

Returns:

ResourceInfo

identify

Signature:

export declare function identify<N extends Namespace>(pluginId: AnyPlugin, namespace: N): N;

Parameters

List of parameters
Parameter Type Description
pluginId AnyPlugin
namespace N

Returns:

N

plugin

Signature:

export declare function plugin<P extends Service, D extends PluginDependencies, N extends Namespace>(id: Plugin<P>, deps: D, namespace: N): PluginDescriptor<P, D> & N;

Parameters

List of parameters
Parameter Type Description
id Plugin

deps D
namespace N

Returns:

PluginDescriptor<P, D> & N

Variables

PlatformStatus

Signature:

PlatformStatus = "platform-status"

Type Aliases

AnyPlugin

Signature:

export declare type AnyPlugin = Plugin<Service>;

Metadata

Platform Metadata Identifier (PMI).

‘Metadata’ is simply any JavaScript object, which is used to configure platform, e.g. IP addresses. Another example of metadata is an asset URL. The logic behind providing asset URLs as metadata is we know URL at compile time only and URLs vary depending on deployment options.

Signature:

export declare type Metadata<T> = Resource<T> & {
    __metadata: true;
};

Plugin_2

Plugin identifier.

Signature:

export declare type Plugin<S extends Service> = Resource<S>;

PluginServices

Convert list of dependencies to a list of provided services, e.g. PluginServices<{core: core.id}> === {core: CoreService}

Signature:

export declare type PluginServices<T extends PluginDependencies> = {
    [P in keyof T]: T[P] extends Plugin<infer Service> ? Service : T[P];
};

ResourceKind

Signature:

export declare type ResourceKind = string & {
    __resourceKind: true;
};