import { AsyncLocalStorage } from 'node:async_hooks'; import { CallingOptions, Service, ServiceBroker, ServiceEvents } from 'moleculer'; import { MetricsService } from '@diia-inhouse/diia-metrics'; import { EnvService } from '@diia-inhouse/env'; import { RedlockService } from '@diia-inhouse/redis'; import { ActArguments, AlsData, CallActionNameVersion, Logger, OnDestroy, OnInit } from '@diia-inhouse/types'; import { ActionExecutor } from '../actionExecutor.js'; import { AppAction, AppApiService, BaseConfig } from '../interfaces/index.js'; export default class MoleculerService implements OnInit, OnDestroy { private readonly serviceName; private readonly systemServiceName; private readonly actionExecutor; private readonly actionList; private readonly config; private readonly asyncLocalStorage; private readonly logger; private readonly envService; private readonly metrics; private readonly moleculerEvents; private readonly apiService; private readonly redlock; serviceBroker: ServiceBroker; service: Service; constructor(serviceName: string, systemServiceName: string, actionExecutor: ActionExecutor, actionList: AppAction[], config: BaseConfig, asyncLocalStorage: AsyncLocalStorage, logger: Logger, envService: EnvService, metrics: MetricsService, moleculerEvents?: ServiceEvents, apiService?: AppApiService | null, redlock?: RedlockService | null); onInit(): Promise; onDestroy(): Promise; act(serviceName: string, { name, actionVersion }: CallActionNameVersion, args?: ActArguments, opts?: CallingOptions): Promise; tryToAct(serviceName: string, callActionNameVersion: CallActionNameVersion, args?: ActArguments, opts?: CallingOptions): Promise; private createBrokerOptions; private addApiService; private createActions; private addAction; }