Skip to content

Commit

Permalink
initial types + create jwt logic
Browse files Browse the repository at this point in the history
  • Loading branch information
SamratSahoo committed Oct 25, 2023
1 parent 1d2335e commit eb52ca4
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 153 deletions.
68 changes: 32 additions & 36 deletions packages/api-gateway/src/auth-service/gen/api_key.ts
Original file line number Diff line number Diff line change
@@ -1,68 +1,64 @@
/* eslint-disable */
import { GrpcMethod, GrpcStreamMethod } from '@nestjs/microservices';
import { Observable } from 'rxjs';
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
import { Observable } from "rxjs";

export const protobufPackage = 'authservice.api_key';
export const protobufPackage = "authservice.api_key";

export interface IssueApiKeyRequest {}
export interface IssueApiKeyRequest {
}

export interface IssueApiKeyResponse {
}

export interface RevokeApiKeyRequest {
}

export interface IssueApiKeyResponse {}
export interface RevokeApiKeyResponse {
}

export interface RevokeApiKeyRequest {}
export interface IsValidApiKeyRequest {
}

export interface RevokeApiKeyResponse {}
export interface IsValidApiKeyResponse {
}

export const AUTHSERVICE_API_KEY_PACKAGE_NAME = 'authservice.api_key';
export const AUTHSERVICE_API_KEY_PACKAGE_NAME = "authservice.api_key";

export interface ApiKeyServiceClient {
issueApiKey(request: IssueApiKeyRequest): Observable<IssueApiKeyResponse>;

revokeApiKey(request: RevokeApiKeyRequest): Observable<RevokeApiKeyResponse>;

isValidApiKey(request: IsValidApiKeyRequest): Observable<IsValidApiKeyResponse>;
}

export interface ApiKeyServiceController {
issueApiKey(
request: IssueApiKeyRequest,
):
| Promise<IssueApiKeyResponse>
| Observable<IssueApiKeyResponse>
| IssueApiKeyResponse;
): Promise<IssueApiKeyResponse> | Observable<IssueApiKeyResponse> | IssueApiKeyResponse;

revokeApiKey(
request: RevokeApiKeyRequest,
):
| Promise<RevokeApiKeyResponse>
| Observable<RevokeApiKeyResponse>
| RevokeApiKeyResponse;
): Promise<RevokeApiKeyResponse> | Observable<RevokeApiKeyResponse> | RevokeApiKeyResponse;

isValidApiKey(
request: IsValidApiKeyRequest,
): Promise<IsValidApiKeyResponse> | Observable<IsValidApiKeyResponse> | IsValidApiKeyResponse;
}

export function ApiKeyServiceControllerMethods() {
return function (constructor: Function) {
const grpcMethods: string[] = ['issueApiKey', 'revokeApiKey'];
const grpcMethods: string[] = ["issueApiKey", "revokeApiKey", "isValidApiKey"];
for (const method of grpcMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(
constructor.prototype,
method,
);
GrpcMethod('ApiKeyService', method)(
constructor.prototype[method],
method,
descriptor,
);
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcMethod("ApiKeyService", method)(constructor.prototype[method], method, descriptor);
}
const grpcStreamMethods: string[] = [];
for (const method of grpcStreamMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(
constructor.prototype,
method,
);
GrpcStreamMethod('ApiKeyService', method)(
constructor.prototype[method],
method,
descriptor,
);
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcStreamMethod("ApiKeyService", method)(constructor.prototype[method], method, descriptor);
}
};
}

export const API_KEY_SERVICE_NAME = 'ApiKeyService';
export const API_KEY_SERVICE_NAME = "ApiKeyService";
66 changes: 28 additions & 38 deletions packages/api-gateway/src/auth-service/gen/jwt.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
/* eslint-disable */
import { GrpcMethod, GrpcStreamMethod } from '@nestjs/microservices';
import { Observable } from 'rxjs';
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
import { Observable } from "rxjs";

export const protobufPackage = 'authservice.jwt';
export const protobufPackage = "authservice.jwt";

export interface CreateJwtRequest {}
export interface CreateJwtRequestHeader {
XApiKey: string;
}

export interface CreateJwtRequest {
header: CreateJwtRequestHeader | undefined;
}

export interface CreateJwtResponse {}
export interface CreateJwtResponse {
success: boolean;
error: string;
jwt?: string | undefined;
}

export interface ValidateJwtRequest {}
export interface ValidateJwtRequest {
}

export interface ValidateJwtResponse {}
export interface ValidateJwtResponse {
}

export const AUTHSERVICE_JWT_PACKAGE_NAME = 'authservice.jwt';
export const AUTHSERVICE_JWT_PACKAGE_NAME = "authservice.jwt";

export interface JwtServiceClient {
createJwt(request: CreateJwtRequest): Observable<CreateJwtResponse>;
Expand All @@ -21,48 +33,26 @@ export interface JwtServiceClient {
}

export interface JwtServiceController {
createJwt(
request: CreateJwtRequest,
):
| Promise<CreateJwtResponse>
| Observable<CreateJwtResponse>
| CreateJwtResponse;
createJwt(request: CreateJwtRequest): Promise<CreateJwtResponse> | Observable<CreateJwtResponse> | CreateJwtResponse;

validateJwt(
request: ValidateJwtRequest,
):
| Promise<ValidateJwtResponse>
| Observable<ValidateJwtResponse>
| ValidateJwtResponse;
): Promise<ValidateJwtResponse> | Observable<ValidateJwtResponse> | ValidateJwtResponse;
}

export function JwtServiceControllerMethods() {
return function (constructor: Function) {
const grpcMethods: string[] = ['createJwt', 'validateJwt'];
const grpcMethods: string[] = ["createJwt", "validateJwt"];
for (const method of grpcMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(
constructor.prototype,
method,
);
GrpcMethod('JwtService', method)(
constructor.prototype[method],
method,
descriptor,
);
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcMethod("JwtService", method)(constructor.prototype[method], method, descriptor);
}
const grpcStreamMethods: string[] = [];
for (const method of grpcStreamMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(
constructor.prototype,
method,
);
GrpcStreamMethod('JwtService', method)(
constructor.prototype[method],
method,
descriptor,
);
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcStreamMethod("JwtService", method)(constructor.prototype[method], method, descriptor);
}
};
}

export const JWT_SERVICE_NAME = 'JwtService';
export const JWT_SERVICE_NAME = "JwtService";
68 changes: 32 additions & 36 deletions packages/auth-service/src/gen/api_key.ts
Original file line number Diff line number Diff line change
@@ -1,68 +1,64 @@
/* eslint-disable */
import { GrpcMethod, GrpcStreamMethod } from '@nestjs/microservices';
import { Observable } from 'rxjs';
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
import { Observable } from "rxjs";

export const protobufPackage = 'authservice.api_key';
export const protobufPackage = "authservice.api_key";

export interface IssueApiKeyRequest {}
export interface IssueApiKeyRequest {
}

export interface IssueApiKeyResponse {
}

export interface RevokeApiKeyRequest {
}

export interface IssueApiKeyResponse {}
export interface RevokeApiKeyResponse {
}

export interface RevokeApiKeyRequest {}
export interface IsValidApiKeyRequest {
}

export interface RevokeApiKeyResponse {}
export interface IsValidApiKeyResponse {
}

export const AUTHSERVICE_API_KEY_PACKAGE_NAME = 'authservice.api_key';
export const AUTHSERVICE_API_KEY_PACKAGE_NAME = "authservice.api_key";

export interface ApiKeyServiceClient {
issueApiKey(request: IssueApiKeyRequest): Observable<IssueApiKeyResponse>;

revokeApiKey(request: RevokeApiKeyRequest): Observable<RevokeApiKeyResponse>;

isValidApiKey(request: IsValidApiKeyRequest): Observable<IsValidApiKeyResponse>;
}

export interface ApiKeyServiceController {
issueApiKey(
request: IssueApiKeyRequest,
):
| Promise<IssueApiKeyResponse>
| Observable<IssueApiKeyResponse>
| IssueApiKeyResponse;
): Promise<IssueApiKeyResponse> | Observable<IssueApiKeyResponse> | IssueApiKeyResponse;

revokeApiKey(
request: RevokeApiKeyRequest,
):
| Promise<RevokeApiKeyResponse>
| Observable<RevokeApiKeyResponse>
| RevokeApiKeyResponse;
): Promise<RevokeApiKeyResponse> | Observable<RevokeApiKeyResponse> | RevokeApiKeyResponse;

isValidApiKey(
request: IsValidApiKeyRequest,
): Promise<IsValidApiKeyResponse> | Observable<IsValidApiKeyResponse> | IsValidApiKeyResponse;
}

export function ApiKeyServiceControllerMethods() {
return function (constructor: Function) {
const grpcMethods: string[] = ['issueApiKey', 'revokeApiKey'];
const grpcMethods: string[] = ["issueApiKey", "revokeApiKey", "isValidApiKey"];
for (const method of grpcMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(
constructor.prototype,
method,
);
GrpcMethod('ApiKeyService', method)(
constructor.prototype[method],
method,
descriptor,
);
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcMethod("ApiKeyService", method)(constructor.prototype[method], method, descriptor);
}
const grpcStreamMethods: string[] = [];
for (const method of grpcStreamMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(
constructor.prototype,
method,
);
GrpcStreamMethod('ApiKeyService', method)(
constructor.prototype[method],
method,
descriptor,
);
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcStreamMethod("ApiKeyService", method)(constructor.prototype[method], method, descriptor);
}
};
}

export const API_KEY_SERVICE_NAME = 'ApiKeyService';
export const API_KEY_SERVICE_NAME = "ApiKeyService";
66 changes: 28 additions & 38 deletions packages/auth-service/src/gen/jwt.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
/* eslint-disable */
import { GrpcMethod, GrpcStreamMethod } from '@nestjs/microservices';
import { Observable } from 'rxjs';
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
import { Observable } from "rxjs";

export const protobufPackage = 'authservice.jwt';
export const protobufPackage = "authservice.jwt";

export interface CreateJwtRequest {}
export interface CreateJwtRequestHeader {
XApiKey: string;
}

export interface CreateJwtRequest {
header: CreateJwtRequestHeader | undefined;
}

export interface CreateJwtResponse {}
export interface CreateJwtResponse {
success: boolean;
error: string;
jwt?: string | undefined;
}

export interface ValidateJwtRequest {}
export interface ValidateJwtRequest {
}

export interface ValidateJwtResponse {}
export interface ValidateJwtResponse {
}

export const AUTHSERVICE_JWT_PACKAGE_NAME = 'authservice.jwt';
export const AUTHSERVICE_JWT_PACKAGE_NAME = "authservice.jwt";

export interface JwtServiceClient {
createJwt(request: CreateJwtRequest): Observable<CreateJwtResponse>;
Expand All @@ -21,48 +33,26 @@ export interface JwtServiceClient {
}

export interface JwtServiceController {
createJwt(
request: CreateJwtRequest,
):
| Promise<CreateJwtResponse>
| Observable<CreateJwtResponse>
| CreateJwtResponse;
createJwt(request: CreateJwtRequest): Promise<CreateJwtResponse> | Observable<CreateJwtResponse> | CreateJwtResponse;

validateJwt(
request: ValidateJwtRequest,
):
| Promise<ValidateJwtResponse>
| Observable<ValidateJwtResponse>
| ValidateJwtResponse;
): Promise<ValidateJwtResponse> | Observable<ValidateJwtResponse> | ValidateJwtResponse;
}

export function JwtServiceControllerMethods() {
return function (constructor: Function) {
const grpcMethods: string[] = ['createJwt', 'validateJwt'];
const grpcMethods: string[] = ["createJwt", "validateJwt"];
for (const method of grpcMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(
constructor.prototype,
method,
);
GrpcMethod('JwtService', method)(
constructor.prototype[method],
method,
descriptor,
);
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcMethod("JwtService", method)(constructor.prototype[method], method, descriptor);
}
const grpcStreamMethods: string[] = [];
for (const method of grpcStreamMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(
constructor.prototype,
method,
);
GrpcStreamMethod('JwtService', method)(
constructor.prototype[method],
method,
descriptor,
);
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcStreamMethod("JwtService", method)(constructor.prototype[method], method, descriptor);
}
};
}

export const JWT_SERVICE_NAME = 'JwtService';
export const JWT_SERVICE_NAME = "JwtService";
Loading

0 comments on commit eb52ca4

Please sign in to comment.