/** * 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 { JSONValue } from "@fluencelabs/interfaces"; import { FluencePeer } from "../jsPeer/FluencePeer.js"; import { CallServiceData, GenericCallServiceHandler, ResultCodes } from "../jsServiceHost/interfaces.js"; import { Particle } from "../particle/Particle.js"; import { ServiceImpl } from "./types.js"; export interface ServiceDescription { serviceId: string; fnName: string; handler: GenericCallServiceHandler; } /** * Creates a service which injects relay's peer id into aqua space */ export declare const injectRelayService: (peer: FluencePeer) => { serviceId: string; fnName: string; handler: () => { retCode: ResultCodes; result: string; }; }; /** * Creates a service which injects plain value into aqua space */ export declare const injectValueService: (serviceId: string, fnName: string, value: JSONValue) => { serviceId: string; fnName: string; handler: () => { retCode: ResultCodes; result: JSONValue; }; }; /** * Creates a service which is used to return value from aqua function into typescript space */ export declare const responseService: (resolveCallback: (val: JSONValue) => void) => { serviceId: string; fnName: string; handler: (req: CallServiceData) => { retCode: ResultCodes; result: {}; }; }; /** * Creates a service which is used to return errors from aqua function into typescript space */ export declare const errorHandlingService: (rejectCallback: (err: JSONValue) => void) => { serviceId: string; fnName: string; handler: (req: CallServiceData) => { retCode: ResultCodes; result: {}; }; }; /** * Creates a service for user-defined service function handler */ export declare const userHandlerService: (serviceId: string, fnName: string, userHandler: ServiceImpl[string]) => { serviceId: string; fnName: string; handler: (req: CallServiceData) => Promise<{ retCode: ResultCodes; result: JSONValue; }>; }; export declare const registerParticleScopeService: (peer: FluencePeer, particle: Particle, service: ServiceDescription) => void; export declare const registerGlobalService: (peer: FluencePeer, service: ServiceDescription) => void;