@atls/nestjs-grpc-http-proxy 0.0.5 → 0.0.6

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.
@@ -0,0 +1,8 @@
1
+ import { Request } from 'express';
2
+ import { Response } from 'express';
3
+ import { GrpcHttpProxyModuleOptions } from '../module/grpc-http-proxy-module-options.interface';
4
+ export declare class AuthenticationService {
5
+ private readonly options;
6
+ constructor(options: GrpcHttpProxyModuleOptions);
7
+ authenticate(req: Request, res: Response): Promise<string | null> | null;
8
+ }
@@ -0,0 +1,5 @@
1
+ import { Request } from 'express';
2
+ import { Response } from 'express';
3
+ export interface Authenticator {
4
+ execute(req: Request, res: Response): Promise<string | null>;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { Request } from 'express';
2
+ import { Authenticator } from './authenticator.interface';
3
+ export declare class HeaderAuthenticator implements Authenticator {
4
+ execute(req: Request): Promise<string | null>;
5
+ }
@@ -0,0 +1,4 @@
1
+ export * from './authenticator.interface';
2
+ export * from './authentication.service';
3
+ export * from './private-key.authenticator';
4
+ export * from './header.authenticator';
@@ -0,0 +1,8 @@
1
+ import { Request } from 'express';
2
+ import { Response } from 'express';
3
+ import { Authenticator } from './authenticator.interface';
4
+ export declare class PrivateKeyAuthenticator implements Authenticator {
5
+ private readonly privateKey?;
6
+ constructor(privateKey?: string | undefined);
7
+ execute(req: Request, res: Response): Promise<string | null>;
8
+ }
@@ -0,0 +1,8 @@
1
+ import { AuthenticationService } from '../authenticators';
2
+ import { ProtoRegistry } from '../proto';
3
+ export declare class GrpcHttpProxyController {
4
+ private readonly protoRegistry;
5
+ private readonly authenticator;
6
+ constructor(protoRegistry: ProtoRegistry, authenticator: AuthenticationService);
7
+ call(service: any, method: any, body: any, req: any, res: any): Promise<void>;
8
+ }
@@ -0,0 +1 @@
1
+ export * from './grpc-http-proxy.controller';
@@ -0,0 +1,2 @@
1
+ export * from './authenticators';
2
+ export * from './module';
@@ -0,0 +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';
5
+ export interface GrpcHttpProxyModuleOptions {
6
+ options: GrpcOptions['options'];
7
+ authenticator?: Authenticator;
8
+ }
9
+ export interface GrpcHttpProxyOptionsFactory {
10
+ createGrpcHttpProxyOptions(): Promise<GrpcHttpProxyModuleOptions> | GrpcHttpProxyModuleOptions;
11
+ }
12
+ export interface GrpcHttpProxyModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
13
+ useExisting?: Type<GrpcHttpProxyOptionsFactory>;
14
+ useClass?: Type<GrpcHttpProxyOptionsFactory>;
15
+ useFactory?: (...args: any[]) => Promise<GrpcHttpProxyModuleOptions> | GrpcHttpProxyModuleOptions;
16
+ inject?: any[];
17
+ }
@@ -0,0 +1 @@
1
+ export declare const GRPC_HTTP_PROXY_MODULE_OPTIONS = "GRPC_HTTP_PROXY_MODULE_OPTIONS";
@@ -0,0 +1,9 @@
1
+ import { DynamicModule } from '@nestjs/common';
2
+ import { GrpcHttpProxyModuleAsyncOptions } from './grpc-http-proxy-module-options.interface';
3
+ import { GrpcHttpProxyModuleOptions } from './grpc-http-proxy-module-options.interface';
4
+ export declare class GrpcHttpProxyModule {
5
+ static register(options: GrpcHttpProxyModuleOptions): DynamicModule;
6
+ static registerAsync(options: GrpcHttpProxyModuleAsyncOptions): DynamicModule;
7
+ private static createAsyncProviders;
8
+ private static createAsyncOptionsProvider;
9
+ }
@@ -0,0 +1,5 @@
1
+ import { Provider } from '@nestjs/common';
2
+ import { GrpcHttpProxyModuleOptions } from './grpc-http-proxy-module-options.interface';
3
+ export declare const createGrpcHttpProxyOptionsProvider: (options: GrpcHttpProxyModuleOptions) => Provider[];
4
+ export declare const createGrpcHttpProxyProvider: () => Provider[];
5
+ export declare const createGrpcHttpProxyExportsProvider: () => Provider[];
@@ -0,0 +1,3 @@
1
+ export * from './grpc-http-proxy-module-options.interface';
2
+ export * from './grpc-http-proxy.constants';
3
+ export * from './grpc-http-proxy.module';
@@ -0,0 +1 @@
1
+ export * from './proto.registry';
@@ -0,0 +1,7 @@
1
+ import { Client } from '@grpc/grpc-js';
2
+ export declare class ProtoClient {
3
+ private readonly client;
4
+ constructor(client: Client);
5
+ static create(url: string | undefined, ServiceClient: any): ProtoClient;
6
+ call(method: string, request: any, meta?: {}): Promise<unknown>;
7
+ }
@@ -0,0 +1,10 @@
1
+ import { OnApplicationBootstrap } from '@nestjs/common';
2
+ import { GrpcHttpProxyModuleOptions } from '../module';
3
+ import { ProtoClient } from './proto.client';
4
+ export declare class ProtoRegistry implements OnApplicationBootstrap {
5
+ private readonly options;
6
+ private definitions;
7
+ constructor(options: GrpcHttpProxyModuleOptions);
8
+ onApplicationBootstrap(): Promise<void>;
9
+ getClient(serviceName: string): ProtoClient;
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atls/nestjs-grpc-http-proxy",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "license": "BSD-3-Clause",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -12,39 +12,39 @@
12
12
  "postpack": "rm -rf dist"
13
13
  },
14
14
  "dependencies": {
15
- "@atls/grpc-error-status": "^0.0.3",
16
- "@grpc/grpc-js": "^1.3.7",
17
- "@grpc/proto-loader": "^0.6.4",
18
- "buffer-json": "^2.0.0",
19
- "class-transformer": "^0.4.0",
20
- "cookie": "^0.4.1",
21
- "jsonwebtoken": "^8.5.1",
22
- "lodash.get": "^4.4.2",
23
- "uuid": "^8.3.2"
15
+ "@atls/grpc-error-status": "0.0.3",
16
+ "@grpc/grpc-js": "1.9.0",
17
+ "@grpc/proto-loader": "0.7.8",
18
+ "buffer-json": "2.0.0",
19
+ "class-transformer": "0.5.1",
20
+ "cookie": "0.5.0",
21
+ "jsonwebtoken": "9.0.1",
22
+ "lodash.get": "4.4.2",
23
+ "uuid": "9.0.0"
24
24
  },
25
25
  "devDependencies": {
26
- "@nestjs/common": "^8.0.5",
27
- "@nestjs/core": "^8.0.5",
28
- "@nestjs/microservices": "^8.0.5",
29
- "@nestjs/testing": "^8.0.5",
30
- "@types/cookie": "^0.4.1",
31
- "@types/express": "^4.17.13",
32
- "@types/jsonwebtoken": "^8.5.8",
33
- "@types/lodash.get": "^4.4.6",
34
- "@types/uuid": "^8.3.4",
35
- "express": "^4.17.3",
36
- "get-port": "^5.1.1",
37
- "protobufjs": "^6.11.2",
26
+ "@nestjs/common": "10.1.3",
27
+ "@nestjs/core": "10.1.3",
28
+ "@nestjs/microservices": "10.1.3",
29
+ "@nestjs/testing": "10.1.3",
30
+ "@types/cookie": "0.5.1",
31
+ "@types/express": "4.17.13",
32
+ "@types/jsonwebtoken": "9.0.2",
33
+ "@types/lodash.get": "4.4.7",
34
+ "@types/uuid": "9.0.2",
35
+ "express": "4.18.2",
36
+ "get-port": "6.1.2",
37
+ "protobufjs": "7.2.4",
38
38
  "reflect-metadata": "0.1.13",
39
- "rxjs": "7.5.4",
40
- "supertest": "^6.2.2"
39
+ "rxjs": "7.8.1",
40
+ "supertest": "6.3.3"
41
41
  },
42
42
  "peerDependencies": {
43
- "@nestjs/common": "^8.0.0",
44
- "@nestjs/core": "^8.0.0",
45
- "@nestjs/microservices": "^8.0.0",
46
- "reflect-metadata": "^0.1.12",
47
- "rxjs": "^6.3.3"
43
+ "@nestjs/common": "10.1.3",
44
+ "@nestjs/core": "10.1.3",
45
+ "@nestjs/microservices": "10.1.3",
46
+ "reflect-metadata": "0.1.13",
47
+ "rxjs": "7.8.1"
48
48
  },
49
49
  "publishConfig": {
50
50
  "main": "dist/index.js",