-
Notifications
You must be signed in to change notification settings - Fork 0
/
eligius-resource-importer.ts
42 lines (35 loc) · 1.12 KB
/
eligius-resource-importer.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import * as ctrls from '../controllers';
import { EligiusEngine } from '../eligius-engine';
import * as evtb from '../eventbus';
import * as ops from '../operation';
import { TOperation } from '../operation/types';
import * as prvdrs from '../timelineproviders';
import { IResourceImporter } from '../types';
const operations: Record<string, TOperation<any>> = ops as any;
const controllers: Record<string, any> = ctrls;
const providers: Record<string, any> = prvdrs;
const eventbus: Record<string, any> = evtb;
export class EligiusResourceImporter implements IResourceImporter {
engines = new Map();
constructor() {
this.engines.set('EligiusEngine', EligiusEngine);
}
getOperationNames(): string[] {
return Object.keys(operations);
}
getControllerNames(): string[] {
return Object.keys(controllers);
}
getProviderNames(): string[] {
return Object.keys(providers);
}
import(name: string): Record<string, any> {
const value =
operations[name] ??
controllers[name] ??
providers[name] ??
eventbus[name] ??
this.engines.get(name);
return { [name]: value };
}
}