/** * Copyright 2023 Fluence Labs Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { CallServiceData, CallServiceResult, GenericCallServiceHandler, IJsServiceHost } from "./interfaces.js"; export declare class JsServiceHost implements IJsServiceHost { private particleScopeHandlers; private commonHandlers; /** * Returns true if any handler for the specified serviceId is registered */ hasService(serviceId: string): boolean; /** * Removes all handlers associated with the specified particle scope * @param particleId Particle ID to remove handlers for */ removeParticleScopeHandlers(particleId: string): void; /** * Find call service handler for specified particle * @param serviceId Service ID as specified in `call` air instruction * @param fnName Function name as specified in `call` air instruction * @param particleId Particle ID */ getHandler(serviceId: string, fnName: string, particleId: string): GenericCallServiceHandler | null; /** * Execute service call for specified call service data. Return null if no handler was found */ callService(req: CallServiceData): Promise; /** * Register handler for all particles */ registerGlobalHandler(serviceId: string, fnName: string, handler: GenericCallServiceHandler): void; /** * Register handler which will be called only for particle with the specific id */ registerParticleScopeHandler(particleId: string, serviceId: string, fnName: string, handler: GenericCallServiceHandler): void; }