@compass-framework/plugin 1.0.1 → 1.0.3

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.
@@ -0,0 +1,13 @@
1
+ import {Context} from "@compass-framework/core";
2
+ import {Platform} from "./Platform";
3
+ import {Identifier} from "./Identifier";
4
+
5
+ export declare interface Environment {
6
+ exportAPIs(apis: object): void;
7
+
8
+ importAPIs<T>(key: Identifier<T>): T;
9
+
10
+ getContext(): Context;
11
+
12
+ getPlatform(): Platform;
13
+ }
@@ -0,0 +1,11 @@
1
+ export declare class Identifier<API = void> {
2
+ groupId: string;
3
+ name: string;
4
+ artifactId: string;
5
+
6
+ public constructor({groupId, name, artifactId,}: {
7
+ groupId: string
8
+ name: string
9
+ artifactId: string
10
+ });
11
+ }
@@ -0,0 +1,4 @@
1
+ export enum Platform {
2
+ Web,
3
+ Nodejs,
4
+ }
@@ -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): 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/EnvironmentProperty";
3
- export * from "./@types/Service";
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compass-framework/plugin",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "@compass-framework/plugin public api",
5
5
  "types": "./index.d.ts",
6
6
  "main": "./index.js",
@@ -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
- }
@@ -1,3 +0,0 @@
1
- export interface EnvironmentProperty {
2
-
3
- }
package/@types/Feature.ts DELETED
@@ -1,3 +0,0 @@
1
- export interface Feature {
2
-
3
- }
@@ -1,7 +0,0 @@
1
- import { Plugin } from "./Plugin";
2
-
3
- export declare class Installer {
4
- public usePlugin(plugin: Plugin): void;
5
-
6
- public unUsePlugin(plugin: Plugin): void;
7
- }
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
- }
@@ -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
- }
@@ -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
@@ -1,11 +0,0 @@
1
- import { Feature } from "./Feature";
2
-
3
- export declare class Service<T = Feature> {
4
- public getFeatures(): T;
5
-
6
- public getGroupId(): string;
7
-
8
- public getVersion(): string;
9
-
10
- public getArtifactId(): string;
11
- }
@@ -1,5 +0,0 @@
1
- import { Service } from "./Service";
2
-
3
- export declare class ServiceDependency {
4
- public getService<T>(groupId: string, artifactId: string): Service<T>;
5
- }