Files
Automata/packages/cli/src/InternalHooksManager.ts
कारतोफ्फेलस्क्रिप्ट™ 698d96a617 refactor: Setup typescript project references across workflow, core, and cli (#4519)
* refactor: use consistent folder structure across workflow, core, and cli

* setup typescript project references across workflow, core, and cli
2022-11-09 15:25:00 +01:00

29 lines
748 B
TypeScript

import { INodeTypes } from 'n8n-workflow';
import { InternalHooksClass } from '@/InternalHooks';
import { Telemetry } from '@/telemetry';
export class InternalHooksManager {
private static internalHooksInstance: InternalHooksClass;
static getInstance(): InternalHooksClass {
if (this.internalHooksInstance) {
return this.internalHooksInstance;
}
throw new Error('InternalHooks not initialized');
}
static init(instanceId: string, versionCli: string, nodeTypes: INodeTypes): InternalHooksClass {
if (!this.internalHooksInstance) {
this.internalHooksInstance = new InternalHooksClass(
new Telemetry(instanceId, versionCli),
instanceId,
versionCli,
nodeTypes,
);
}
return this.internalHooksInstance;
}
}