@compass-framework/plugin 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/Environment.d.ts +15 -0
- package/@types/Identifier.d.ts +11 -0
- package/@types/Platform.d.ts +4 -0
- package/@types/Plugin.d.ts +10 -0
- package/@types/PluginManager.d.ts +10 -0
- package/index.d.ts +2 -4
- package/package.json +1 -1
- package/@types/Environment.ts +0 -11
- package/@types/EnvironmentProperty.ts +0 -3
- package/@types/Feature.ts +0 -3
- package/@types/Installer.ts +0 -7
- package/@types/Plugin.ts +0 -33
- package/@types/PluginMainfest.ts +0 -17
- package/@types/PluginManager.ts +0 -18
- package/@types/Service.ts +0 -11
- package/@types/ServiceDependency.ts +0 -5
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {Context} from "@compass-framework/core";
|
|
2
|
+
import {Platform} from "./Platform";
|
|
3
|
+
import {Identifier} from "./Identifier";
|
|
4
|
+
|
|
5
|
+
export declare interface Environment<Property> {
|
|
6
|
+
exportAPIs(apis: object): void;
|
|
7
|
+
|
|
8
|
+
importAPIs<T>(key: Identifier<T>): T;
|
|
9
|
+
|
|
10
|
+
getContext(): Context;
|
|
11
|
+
|
|
12
|
+
getProperty(): Property;
|
|
13
|
+
|
|
14
|
+
getPlatform(): Platform;
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {Environment} from "./Environment";
|
|
2
|
+
import {Identifier} from "./Identifier";
|
|
3
|
+
|
|
4
|
+
export declare abstract class Plugin {
|
|
5
|
+
public abstract onInstall<T>(env: Environment<T>): void;
|
|
6
|
+
|
|
7
|
+
public abstract onUninstall(): void;
|
|
8
|
+
|
|
9
|
+
public abstract getIdentifier(): Identifier;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {Context} from "@compass-framework/core";
|
|
2
|
+
import {Plugin} from "./Plugin";
|
|
3
|
+
|
|
4
|
+
export declare class PluginManager {
|
|
5
|
+
public constructor(context: Context, property: object);
|
|
6
|
+
|
|
7
|
+
public install(plugin: Plugin): void;
|
|
8
|
+
|
|
9
|
+
public uninstall(plugin: Plugin): void;
|
|
10
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export * from "./@types/Environment";
|
|
2
|
-
export * from "./@types/
|
|
3
|
-
export * from "./@types/
|
|
4
|
-
export * from "./@types/Feature";
|
|
2
|
+
export * from "./@types/Platform";
|
|
3
|
+
export * from "./@types/Identifier";
|
|
5
4
|
export * from "./@types/Plugin";
|
|
6
5
|
export * from "./@types/PluginManager";
|
|
7
|
-
export * from "./@types/PluginMainfest";
|
package/package.json
CHANGED
package/@types/Environment.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Context } from "@compass-framework/core";
|
|
2
|
-
import { EnvironmentProperty } from "./EnvironmentProperty";
|
|
3
|
-
import { Installer } from "./Installer";
|
|
4
|
-
import { ServiceDependency } from "./ServiceDependency";
|
|
5
|
-
|
|
6
|
-
export interface Environment<T = EnvironmentProperty> {
|
|
7
|
-
installer: Installer
|
|
8
|
-
property: T,
|
|
9
|
-
context: Context;
|
|
10
|
-
dependency: ServiceDependency;
|
|
11
|
-
}
|
package/@types/Feature.ts
DELETED
package/@types/Installer.ts
DELETED
package/@types/Plugin.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Consumer,
|
|
3
|
-
} from "@compass-framework/library";
|
|
4
|
-
|
|
5
|
-
import { Environment } from "./Environment";
|
|
6
|
-
import { Service } from "./Service";
|
|
7
|
-
import { PluginMainfest } from "./PluginMainfest";
|
|
8
|
-
|
|
9
|
-
export declare class Plugin<Feature = {}> {
|
|
10
|
-
protected constructor(mainfest: PluginMainfest);
|
|
11
|
-
|
|
12
|
-
public onInstall(environment: Environment, service: Consumer<Feature>): Promise<void>;
|
|
13
|
-
|
|
14
|
-
public isUsingGlobalContext(): boolean;
|
|
15
|
-
|
|
16
|
-
public onUninstall(): void;
|
|
17
|
-
|
|
18
|
-
public getPluginName(): string;
|
|
19
|
-
|
|
20
|
-
public getService<T>(index: number): Service<T>;
|
|
21
|
-
|
|
22
|
-
public getEnvironment<T>(): Environment<T>;
|
|
23
|
-
|
|
24
|
-
public getGroupId(): string;
|
|
25
|
-
|
|
26
|
-
public getVersion(): string;
|
|
27
|
-
|
|
28
|
-
public getArtifactId(): string;
|
|
29
|
-
|
|
30
|
-
public getDependence(): PluginMainfest.Dependence[];
|
|
31
|
-
|
|
32
|
-
public setUsingGlobalContext(using: boolean): void;
|
|
33
|
-
}
|
package/@types/PluginMainfest.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export type PluginMainfest = {
|
|
2
|
-
name: string,
|
|
3
|
-
artifactId: string,
|
|
4
|
-
version: string,
|
|
5
|
-
groupId: string,
|
|
6
|
-
dependencies?: PluginMainfest.Dependence[]
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export namespace PluginMainfest {
|
|
10
|
-
export type Dependence = {
|
|
11
|
-
name?: string,
|
|
12
|
-
required?: boolean,
|
|
13
|
-
version: string,
|
|
14
|
-
groupId: string,
|
|
15
|
-
artifactId: string,
|
|
16
|
-
};
|
|
17
|
-
}
|
package/@types/PluginManager.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Context } from "@compass-framework/core";
|
|
2
|
-
import { Plugin } from "./Plugin";
|
|
3
|
-
import { EnvironmentProperty } from "./EnvironmentProperty";
|
|
4
|
-
|
|
5
|
-
export declare class PluginManager {
|
|
6
|
-
public constructor(context: Context, options: PluginManager.Options);
|
|
7
|
-
|
|
8
|
-
public usePlugin(plugin: Plugin): Promise<void>;
|
|
9
|
-
|
|
10
|
-
public unUsePlugin(plugin: Plugin): void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export declare namespace PluginManager {
|
|
14
|
-
export interface Options {
|
|
15
|
-
repository: string;
|
|
16
|
-
property: EnvironmentProperty,
|
|
17
|
-
}
|
|
18
|
-
}
|
package/@types/Service.ts
DELETED