1 | import { Monitor } from '@neo-one/monitor';
|
2 | import { ResourceType } from './ResourceType';
|
3 | import { TaskList } from './TaskList';
|
4 | import { CLIArgs, CLIHook, CreateHook, InteractiveCommand, PluginManager } from './types';
|
5 |
|
6 | export interface PluginOptions {
|
7 | readonly monitor: Monitor;
|
8 | }
|
9 |
|
10 | export interface CLIHookConfig {
|
11 | readonly name: string;
|
12 | readonly hook: CLIHook;
|
13 | }
|
14 |
|
15 | export interface CreateHookConfig {
|
16 | readonly plugin: string;
|
17 | readonly resourceType: string;
|
18 | readonly hook: CreateHook;
|
19 | }
|
20 |
|
21 | export class Plugin {
|
22 | public readonly monitor: Monitor;
|
23 |
|
24 | public constructor({ monitor }: PluginOptions) {
|
25 | this.monitor = monitor;
|
26 | }
|
27 |
|
28 |
|
29 | public async reset(): Promise<void> {
|
30 |
|
31 | }
|
32 |
|
33 |
|
34 |
|
35 | public get name(): string {
|
36 | throw new Error('Not Implemented');
|
37 | }
|
38 |
|
39 |
|
40 | public get names(): {
|
41 | readonly capital: string;
|
42 | readonly capitalPlural: string;
|
43 | readonly lower: string;
|
44 | readonly lowerPlural: string;
|
45 | } {
|
46 | throw new Error('Not Implemented');
|
47 | }
|
48 |
|
49 | public get resourceTypes(): ReadonlyArray<ResourceType> {
|
50 | return [];
|
51 | }
|
52 |
|
53 | public get resourceTypeByName(): { readonly [resourceType: string]: ResourceType } {
|
54 | return this.resourceTypes.reduce<{ readonly [resourceType: string]: ResourceType }>(
|
55 | (acc, resourceType) => ({
|
56 | ...acc,
|
57 | [resourceType.name]: resourceType,
|
58 | }),
|
59 | {},
|
60 | );
|
61 | }
|
62 |
|
63 |
|
64 |
|
65 | public get dependencies(): ReadonlyArray<string> {
|
66 | return [];
|
67 | }
|
68 |
|
69 |
|
70 | public get commands(): ReadonlyArray<(cliArgs: CLIArgs) => void> {
|
71 | return [];
|
72 | }
|
73 |
|
74 |
|
75 | public get interactive(): ReadonlyArray<InteractiveCommand> {
|
76 | return [];
|
77 | }
|
78 |
|
79 |
|
80 | public get createHooks(): ReadonlyArray<CreateHookConfig> {
|
81 | return [];
|
82 | }
|
83 |
|
84 |
|
85 | public get cliPreHooks(): ReadonlyArray<CLIHookConfig> {
|
86 | return [];
|
87 | }
|
88 |
|
89 |
|
90 | public get cliPostHooks(): ReadonlyArray<CLIHookConfig> {
|
91 | return [];
|
92 | }
|
93 |
|
94 | public executeTaskList(_pluginManager: PluginManager, _options: string): TaskList {
|
95 | throw new Error('Plugin does not define a way to execute task lists.');
|
96 | }
|
97 |
|
98 |
|
99 | public async request(_pluginManager: PluginManager, _options: string): Promise<any> {
|
100 | throw new Error('Plugin does not define a way to handle requests.');
|
101 | }
|
102 | }
|