@anticrm/platform Package
Plugin architecture and implementation
Enumerations
Enumeration | Description |
---|---|
PluginStatus |
Functions
Function | Description |
---|---|
createPlatform() | |
getResourceInfo(resource) | |
identify(pluginId, namespace) | |
plugin(id, deps, namespace) |
Interfaces
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
Variable | Description |
---|---|
PlatformStatus |
Type Aliases
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
Member | Value | Description |
---|---|---|
RUNNING | 1 |
|
STOPPED | 0 |
Functions
createPlatform
Signature:
export declare function createPlatform(): Platform;
Returns:
getResourceInfo
Signature:
export declare function getResourceInfo(resource: Resource<any>): ResourceInfo;
Parameters
Parameter | Type | Description |
---|---|---|
resource | Resource |
Returns:
identify
Signature:
export declare function identify<N extends Namespace>(pluginId: AnyPlugin, namespace: N): N;
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
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;
};