2021-10-18 20:57:49 -07:00
|
|
|
/* eslint-disable import/no-cycle */
|
2022-01-07 08:14:59 -08:00
|
|
|
import { INodeTypes } from 'n8n-workflow';
|
2021-10-18 20:57:49 -07:00
|
|
|
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');
|
|
|
|
}
|
|
|
|
|
2022-01-07 08:14:59 -08:00
|
|
|
static init(instanceId: string, versionCli: string, nodeTypes: INodeTypes): InternalHooksClass {
|
2021-10-18 20:57:49 -07:00
|
|
|
if (!this.internalHooksInstance) {
|
2021-12-10 06:29:05 -08:00
|
|
|
this.internalHooksInstance = new InternalHooksClass(
|
|
|
|
new Telemetry(instanceId, versionCli),
|
|
|
|
versionCli,
|
2022-01-07 08:14:59 -08:00
|
|
|
nodeTypes,
|
2021-12-10 06:29:05 -08:00
|
|
|
);
|
2021-10-18 20:57:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return this.internalHooksInstance;
|
|
|
|
}
|
|
|
|
}
|