@atls/nestjs-grpc-http-proxy 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authenticators/authentication.service.d.ts +3 -3
- package/dist/authenticators/authentication.service.js +1 -1
- package/dist/authenticators/authenticator.interface.d.ts +3 -3
- package/dist/authenticators/header.authenticator.d.ts +2 -2
- package/dist/authenticators/private-key.authenticator.d.ts +3 -3
- package/dist/controllers/grpc-http-proxy.controller.d.ts +3 -1
- package/dist/module/grpc-http-proxy-module-options.interface.d.ts +7 -7
- package/dist/module/grpc-http-proxy.module.d.ts +3 -3
- package/dist/module/grpc-http-proxy.module.js +1 -1
- package/dist/module/grpc-http-proxy.providers.d.ts +5 -5
- package/dist/module/grpc-http-proxy.providers.js +4 -1
- package/dist/proto/proto.client.d.ts +1 -1
- package/dist/proto/proto.client.js +1 -1
- package/dist/proto/proto.registry.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Request } from 'express';
|
|
2
|
-
import { Response } from 'express';
|
|
1
|
+
import type { Request } from 'express';
|
|
2
|
+
import type { Response } from 'express';
|
|
3
3
|
import { GrpcHttpProxyModuleOptions } from '../module/index.js';
|
|
4
4
|
export declare class AuthenticationService {
|
|
5
5
|
private readonly options;
|
|
6
6
|
constructor(options: GrpcHttpProxyModuleOptions);
|
|
7
|
-
authenticate(req: Request, res: Response): Promise<string | null
|
|
7
|
+
authenticate(req: Request, res: Response): Promise<string | null>;
|
|
8
8
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Request } from 'express';
|
|
2
|
-
import { Response } from 'express';
|
|
1
|
+
import type { Request } from 'express';
|
|
2
|
+
import type { Response } from 'express';
|
|
3
3
|
export interface Authenticator {
|
|
4
|
-
execute(req: Request, res: Response)
|
|
4
|
+
execute: (req: Request, res: Response) => Promise<string | null>;
|
|
5
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Request } from 'express';
|
|
2
|
-
import { Authenticator } from './authenticator.interface.js';
|
|
1
|
+
import type { Request } from 'express';
|
|
2
|
+
import type { Authenticator } from './authenticator.interface.js';
|
|
3
3
|
export declare class HeaderAuthenticator implements Authenticator {
|
|
4
4
|
execute(req: Request): Promise<string | null>;
|
|
5
5
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Request } from 'express';
|
|
2
|
-
import { Response } from 'express';
|
|
3
|
-
import { Authenticator } from './authenticator.interface.js';
|
|
1
|
+
import type { Request } from 'express';
|
|
2
|
+
import type { Response } from 'express';
|
|
3
|
+
import type { Authenticator } from './authenticator.interface.js';
|
|
4
4
|
export declare class PrivateKeyAuthenticator implements Authenticator {
|
|
5
5
|
private readonly privateKey?;
|
|
6
6
|
constructor(privateKey?: string | undefined);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { Request } from 'express';
|
|
2
|
+
import { Response } from 'express';
|
|
1
3
|
import { AuthenticationService } from '../authenticators/index.js';
|
|
2
4
|
import { ProtoRegistry } from '../proto/index.js';
|
|
3
5
|
export declare class GrpcHttpProxyController {
|
|
4
6
|
private readonly protoRegistry;
|
|
5
7
|
private readonly authenticator;
|
|
6
8
|
constructor(protoRegistry: ProtoRegistry, authenticator: AuthenticationService);
|
|
7
|
-
call(service: any, method: any, body: any, req:
|
|
9
|
+
call(service: any, method: any, body: any, req: Request, res: Response): Promise<void>;
|
|
8
10
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ModuleMetadata } from '@nestjs/common/interfaces';
|
|
2
|
-
import { Type } from '@nestjs/common/interfaces';
|
|
3
|
-
import { GrpcOptions } from '@nestjs/microservices';
|
|
4
|
-
import { Authenticator } from '../authenticators/index.js';
|
|
1
|
+
import type { ModuleMetadata } from '@nestjs/common/interfaces';
|
|
2
|
+
import type { Type } from '@nestjs/common/interfaces';
|
|
3
|
+
import type { GrpcOptions } from '@nestjs/microservices';
|
|
4
|
+
import type { Authenticator } from '../authenticators/index.js';
|
|
5
5
|
export interface GrpcHttpProxyModuleOptions {
|
|
6
6
|
options: GrpcOptions['options'];
|
|
7
7
|
authenticator?: Authenticator;
|
|
8
8
|
}
|
|
9
9
|
export interface GrpcHttpProxyOptionsFactory {
|
|
10
|
-
createGrpcHttpProxyOptions()
|
|
10
|
+
createGrpcHttpProxyOptions: () => GrpcHttpProxyModuleOptions | Promise<GrpcHttpProxyModuleOptions>;
|
|
11
11
|
}
|
|
12
12
|
export interface GrpcHttpProxyModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
|
|
13
13
|
useExisting?: Type<GrpcHttpProxyOptionsFactory>;
|
|
14
14
|
useClass?: Type<GrpcHttpProxyOptionsFactory>;
|
|
15
|
-
useFactory?: (...args: any
|
|
16
|
-
inject?: any
|
|
15
|
+
useFactory?: (...args: Array<any>) => GrpcHttpProxyModuleOptions | Promise<GrpcHttpProxyModuleOptions>;
|
|
16
|
+
inject?: Array<any>;
|
|
17
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DynamicModule } from '@nestjs/common';
|
|
2
|
-
import { GrpcHttpProxyModuleAsyncOptions } from './grpc-http-proxy-module-options.interface.js';
|
|
3
|
-
import { GrpcHttpProxyModuleOptions } from './grpc-http-proxy-module-options.interface.js';
|
|
1
|
+
import type { DynamicModule } from '@nestjs/common';
|
|
2
|
+
import type { GrpcHttpProxyModuleAsyncOptions } from './grpc-http-proxy-module-options.interface.js';
|
|
3
|
+
import type { GrpcHttpProxyModuleOptions } from './grpc-http-proxy-module-options.interface.js';
|
|
4
4
|
export declare class GrpcHttpProxyModule {
|
|
5
5
|
static register(options: GrpcHttpProxyModuleOptions): DynamicModule;
|
|
6
6
|
static registerAsync(options: GrpcHttpProxyModuleAsyncOptions): DynamicModule;
|
|
@@ -56,7 +56,7 @@ let GrpcHttpProxyModule = GrpcHttpProxyModule_1 = class GrpcHttpProxyModule {
|
|
|
56
56
|
}
|
|
57
57
|
return {
|
|
58
58
|
provide: GRPC_HTTP_PROXY_MODULE_OPTIONS,
|
|
59
|
-
useFactory: (optionsFactory) => optionsFactory.createGrpcHttpProxyOptions(),
|
|
59
|
+
useFactory: async (optionsFactory) => optionsFactory.createGrpcHttpProxyOptions(),
|
|
60
60
|
inject: [options.useExisting || options.useClass],
|
|
61
61
|
};
|
|
62
62
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Provider } from '@nestjs/common';
|
|
2
|
-
import { GrpcHttpProxyModuleOptions } from './grpc-http-proxy-module-options.interface.js';
|
|
3
|
-
export declare const createGrpcHttpProxyOptionsProvider: (options: GrpcHttpProxyModuleOptions) => Provider
|
|
4
|
-
export declare const createGrpcHttpProxyProvider: () => Provider
|
|
5
|
-
export declare const createGrpcHttpProxyExportsProvider: () => Provider
|
|
1
|
+
import type { Provider } from '@nestjs/common';
|
|
2
|
+
import type { GrpcHttpProxyModuleOptions } from './grpc-http-proxy-module-options.interface.js';
|
|
3
|
+
export declare const createGrpcHttpProxyOptionsProvider: (options: GrpcHttpProxyModuleOptions) => Array<Provider>;
|
|
4
|
+
export declare const createGrpcHttpProxyProvider: () => Array<Provider>;
|
|
5
|
+
export declare const createGrpcHttpProxyExportsProvider: () => Array<Provider>;
|
|
@@ -7,5 +7,8 @@ export const createGrpcHttpProxyOptionsProvider = (options) => [
|
|
|
7
7
|
useValue: options,
|
|
8
8
|
},
|
|
9
9
|
];
|
|
10
|
-
export const createGrpcHttpProxyProvider = () => [
|
|
10
|
+
export const createGrpcHttpProxyProvider = () => [
|
|
11
|
+
ProtoRegistry,
|
|
12
|
+
AuthenticationService,
|
|
13
|
+
];
|
|
11
14
|
export const createGrpcHttpProxyExportsProvider = () => [];
|
|
@@ -8,7 +8,7 @@ export class ProtoClient {
|
|
|
8
8
|
static create(url = '0.0.0.0:50051', ServiceClient) {
|
|
9
9
|
return new ProtoClient(new ServiceClient(url, credentials.createInsecure(), {}));
|
|
10
10
|
}
|
|
11
|
-
call(method, request, meta = {}) {
|
|
11
|
+
async call(method, request, meta = {}) {
|
|
12
12
|
const metadata = new Metadata();
|
|
13
13
|
Object.keys(meta).forEach((key) => {
|
|
14
14
|
if (meta[key])
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OnApplicationBootstrap } from '@nestjs/common';
|
|
1
|
+
import type { OnApplicationBootstrap } from '@nestjs/common';
|
|
2
2
|
import { GrpcHttpProxyModuleOptions } from '../module/index.js';
|
|
3
3
|
import { ProtoClient } from './proto.client.js';
|
|
4
4
|
export declare class ProtoRegistry implements OnApplicationBootstrap {
|