import { GrpcMessage, GrpcEvent, GrpcClientFactory, GrpcClient, GrpcMetadata, GrpcMessageClass } from '@ngx-grpc/common'; import { Observable } from 'rxjs'; import { Metadata } from 'grpc-web'; import * as i0 from '@angular/core'; import { ModuleWithProviders, InjectionToken } from '@angular/core'; /** @dynamic */ declare class GrpcWorkerGateway { private worker; private lastId; private connections; constructor(worker: Worker); configureServiceClient(serviceId: string, settings: GrpcWorkerClientSettings): void; callUnaryFromWorker(serviceId: string, path: string, request: Q, metadata: Metadata): Observable>; callServerStreamFromWorker(serviceId: string, path: string, request: Q, metadata: Metadata): Observable>; closeConnection(id: number): void; private createRequestId; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Settings for the chosen implementation of GrpcClient */ interface GrpcWorkerClientSettings { host: string; format?: string; suppressCorsPreflight?: boolean; withCredentials?: boolean; } /** * GrpcClientFactory implementation based on grpc-web running in worker */ declare class GrpcWorkerClientFactory implements GrpcClientFactory { private defaultSettings; private gateway; constructor(defaultSettings: GrpcWorkerClientSettings, gateway: GrpcWorkerGateway); createClient(serviceId: string, customSettings: GrpcWorkerClientSettings): GrpcWorkerClient; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * GrpcClient implementation based on grpc-web running in worker */ declare class GrpcWorkerClient implements GrpcClient { private serviceId; private settings; private gateway; constructor(serviceId: string, settings: GrpcWorkerClientSettings, gateway: GrpcWorkerGateway); getSettings(): GrpcWorkerClientSettings; unary(path: string, req: Q, metadata: GrpcMetadata, reqclss: GrpcMessageClass, resclss: GrpcMessageClass): Observable>; serverStream(path: string, req: Q, metadata: GrpcMetadata, reqclss: GrpcMessageClass, resclss: GrpcMessageClass): Observable>; clientStream: () => never; bidiStream: () => never; } interface GrpcWorkerClientRootOptions { worker?: Worker; settings?: GrpcWorkerClientSettings; } interface GrpcWorkerClientChildOptions { worker?: Worker; settings?: GrpcWorkerClientSettings; } declare class GrpcWorkerClientModule { /** * Create GrpcWorkerClientModule for using in AppModule (application root module) * You can provide the options here instead of injecting corresponding tokens separately */ static forRoot(options?: GrpcWorkerClientRootOptions): ModuleWithProviders; /** * Create GrpcWorkerClientModule for using in children modules (incl. lazy modules) * You can provide the options here instead of injecting corresponding tokens separately */ static forChild(options?: GrpcWorkerClientChildOptions): ModuleWithProviders; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } /** * Registers a worker implementation, generated by Angular CLI and implemented according documentation * * Example: * * ``` * providers: [ * { provide: GRPC_WORKER, useFactory: () => new Worker('./grpc.worker', { type: 'module' }) }, * ] * ``` */ declare const GRPC_WORKER: InjectionToken; /** * Default configuration for grpc-web clients running in worker. Will be used for every GrpcWorkerClient unless service-specific config is provided * * Example: * * ``` * providers: [ * { provide: GRPC_WORKER_CLIENT_DEFAULT_SETTINGS, useClass: { host: 'localhost:4321' } }, * ] * ``` */ declare const GRPC_WORKER_CLIENT_DEFAULT_SETTINGS: InjectionToken; export { GRPC_WORKER, GRPC_WORKER_CLIENT_DEFAULT_SETTINGS, GrpcWorkerClient, GrpcWorkerClientFactory, GrpcWorkerClientModule, GrpcWorkerGateway }; export type { GrpcWorkerClientChildOptions, GrpcWorkerClientRootOptions, GrpcWorkerClientSettings };