FIX: Fixed maestro after protospack lib att

This commit is contained in:
rodrigo.zamboni
2022-04-21 16:02:11 -03:00
parent 6160107d75
commit 4672ecb6b3
16 changed files with 95 additions and 51 deletions
+7 -7
View File
@@ -18,7 +18,7 @@
"@nestjs/microservices": "^8.4.3",
"@nestjs/platform-express": "^8.4.3",
"@nestjs/swagger": "^5.2.1",
"@victorradael/protospack": "^1.4.2",
"@victorradael/protospack": "^1.5.5",
"axios": "^0.25.0",
"dotenv": "^14.2.0",
"grpc": "^1.24.11",
@@ -2372,9 +2372,9 @@
}
},
"node_modules/@victorradael/protospack": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/@victorradael/protospack/-/protospack-1.4.2.tgz",
"integrity": "sha512-UWEjCVtFag0uHoMLxb55JXG7Qfz0fn8Pk7v1H5dgZcBMLDhs9VARBVNq1JT4P6ypMyrnTbOyq08CoMukF8GHbQ==",
"version": "1.5.5",
"resolved": "https://registry.npmjs.org/@victorradael/protospack/-/protospack-1.5.5.tgz",
"integrity": "sha512-5yGW/EuZDY9N56CVMXJW1IrBkkv6KpalBepu0LLQvM5Y+Pr8lwY2i1p/1rlsjHo6Gk1RODKuWSXAL870jQEAdg==",
"dependencies": {
"rxjs": "^7.5.5"
}
@@ -11386,9 +11386,9 @@
}
},
"@victorradael/protospack": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/@victorradael/protospack/-/protospack-1.4.2.tgz",
"integrity": "sha512-UWEjCVtFag0uHoMLxb55JXG7Qfz0fn8Pk7v1H5dgZcBMLDhs9VARBVNq1JT4P6ypMyrnTbOyq08CoMukF8GHbQ==",
"version": "1.5.5",
"resolved": "https://registry.npmjs.org/@victorradael/protospack/-/protospack-1.5.5.tgz",
"integrity": "sha512-5yGW/EuZDY9N56CVMXJW1IrBkkv6KpalBepu0LLQvM5Y+Pr8lwY2i1p/1rlsjHo6Gk1RODKuWSXAL870jQEAdg==",
"requires": {
"rxjs": "^7.5.5"
}
+1 -1
View File
@@ -30,7 +30,7 @@
"@nestjs/microservices": "^8.4.3",
"@nestjs/platform-express": "^8.4.3",
"@nestjs/swagger": "^5.2.1",
"@victorradael/protospack": "^1.4.2",
"@victorradael/protospack": "^1.5.5",
"axios": "^0.25.0",
"dotenv": "^14.2.0",
"grpc": "^1.24.11",
+3 -3
View File
@@ -1,7 +1,7 @@
import { credentials } from '@grpc/grpc-js';
import { ClientOptions, Transport } from '@nestjs/microservices';
import { DucProtofile } from '@victorradael/protospack';
import { DucProtoFilePath, DucPackages } from '@victorradael/protospack';
export class AuthClient {
config(): ClientOptions {
@@ -9,9 +9,9 @@ export class AuthClient {
transport: Transport.GRPC,
options: {
url: process.env.DUC_URL,
package: 'duc',
package: DucPackages,
credentials: credentials.createSsl(),
protoPath: DucProtofile,
protoPath: DucProtoFilePath,
loader: {
enums: String,
objects: true,
+9 -6
View File
@@ -1,27 +1,30 @@
import { OnModuleInit, Inject } from '@nestjs/common';
import { ClientGrpc } from '@nestjs/microservices';
import { CognitoServiceInterface } from '@victorradael/protospack';
import {
AuthServiceInterface,
DucServicesNames,
} from '@victorradael/protospack';
import { ILogin } from './interfaces';
export class AuthClientService implements OnModuleInit {
private cognitoService: CognitoServiceInterface;
private authService: AuthServiceInterface;
constructor(
@Inject('AUTH_PACKAGE') private readonly grpcClient: ClientGrpc,
) {}
onModuleInit() {
this.cognitoService = this.grpcClient.getService<CognitoServiceInterface>(
'CognitoProtoService',
this.authService = this.grpcClient.getService<AuthServiceInterface>(
DucServicesNames.AuthProtoService,
);
}
async signIn({ username, password }: ILogin): Promise<any> {
console.log('CognitoClientService', 'SignIn');
console.log('AuthClientService', 'SignIn');
const tokens = await new Promise((resolve, reject) => {
this.cognitoService.signIn({ username, password }).subscribe({
this.authService.signIn({ username, password }).subscribe({
next(x) {
resolve(x);
},
+3 -3
View File
@@ -1,7 +1,7 @@
import { credentials } from '@grpc/grpc-js';
import { ClientOptions, Transport } from '@nestjs/microservices';
import { InputProtofile } from '@victorradael/protospack';
import { InputPackages, InputProtoFilePath } from '@victorradael/protospack';
export class InputsClientConfiguration {
config(): ClientOptions {
@@ -9,9 +9,9 @@ export class InputsClientConfiguration {
transport: Transport.GRPC,
options: {
url: process.env.INFACTORY_URL,
package: 'input',
package: InputPackages,
credentials: credentials.createSsl(),
protoPath: InputProtofile,
protoPath: InputProtoFilePath,
loader: {
enums: String,
objects: true,
+3 -3
View File
@@ -1,4 +1,4 @@
import { OutputProtofile } from '@victorradael/protospack';
import { OutputPackages, OutputProtoFilePath } from '@victorradael/protospack';
import { ClientOptions, Transport } from '@nestjs/microservices';
import { credentials } from '@grpc/grpc-js';
@@ -8,9 +8,9 @@ export class OutputsClientConfiguration {
transport: Transport.GRPC,
options: {
url: process.env.OTFACTORY_URL,
package: 'output',
package: OutputPackages,
credentials: credentials.createSsl(),
protoPath: OutputProtofile,
protoPath: OutputProtoFilePath,
loader: {
enums: String,
objects: true,
+7 -3
View File
@@ -1,6 +1,9 @@
import { Controller, Inject, OnModuleInit } from '@nestjs/common';
import { ClientGrpc, Payload } from '@nestjs/microservices';
import { OutputsServiceInterface } from '@victorradael/protospack';
import {
OutputServicesNames,
OutputsServiceInterface,
} from '@victorradael/protospack';
import {
objectCamelToSnake,
objectSnakeToCamel,
@@ -19,8 +22,9 @@ export class OutputsClientService implements OnModuleInit {
) {}
onModuleInit() {
this.outputService =
this.grpcClient.getService<OutputsServiceInterface>('OutputService');
this.outputService = this.grpcClient.getService<OutputsServiceInterface>(
OutputServicesNames.OutputService,
);
}
async create(@Payload() createOutputDto: ICreateOutputRequest) {
+6 -3
View File
@@ -1,5 +1,8 @@
import { ClientOptions, Transport } from '@nestjs/microservices';
import { PipelineProtofile } from '@victorradael/protospack';
import {
PipelinePackages,
PipelineProtoFilePath,
} from '@victorradael/protospack';
import { credentials } from '@grpc/grpc-js';
export class PipelinesClientConfiguration {
@@ -8,9 +11,9 @@ export class PipelinesClientConfiguration {
transport: Transport.GRPC,
options: {
url: process.env.PIFACTORY_URL,
package: 'pipeline',
package: PipelinePackages,
credentials: credentials.createSsl(),
protoPath: PipelineProtofile,
protoPath: PipelineProtoFilePath,
loader: {
enums: String,
objects: true,
+13 -9
View File
@@ -1,13 +1,15 @@
import { Inject, OnModuleInit } from '@nestjs/common';
import { ClientGrpc, Payload } from '@nestjs/microservices';
import { PipelinesServiceInterface } from '@victorradael/protospack';
import {
PipelineServicesNames,
PipelinesServiceInterface,
} from '@victorradael/protospack';
import {
objectCamelToSnake,
objectSnakeToCamel,
} from 'src/utils/CaseConverter';
import {
ICreatePipelineDto,
IdRequest,
IGetPipelineLogsRequest,
IIdRequest,
IUpdatePipelineRequest,
@@ -21,7 +23,9 @@ export class PipelinesClientService implements OnModuleInit {
onModuleInit() {
this.pipelineService =
this.grpcClient.getService<PipelinesServiceInterface>('PipelineService');
this.grpcClient.getService<PipelinesServiceInterface>(
PipelineServicesNames.PipelineService,
);
}
async create(@Payload() createPipelineDto: ICreatePipelineDto) {
@@ -29,7 +33,7 @@ export class PipelinesClientService implements OnModuleInit {
const createPipelineResponse = await new Promise((resolve, reject) => {
this.pipelineService
.create(objectSnakeToCamel(createPipelineDto))
.Create(objectSnakeToCamel(createPipelineDto))
.subscribe({
next(x) {
resolve(x);
@@ -55,7 +59,7 @@ export class PipelinesClientService implements OnModuleInit {
console.log('PipelinesClientService', 'FindAll');
const findAllPipelineResponse = await new Promise((resolve, reject) => {
this.pipelineService.findAll(objectSnakeToCamel(data)).subscribe({
this.pipelineService.FindAll(objectSnakeToCamel(data)).subscribe({
next(x) {
resolve(x);
},
@@ -80,7 +84,7 @@ export class PipelinesClientService implements OnModuleInit {
console.log('PipelinesClientService', 'FindOne');
const findOnePipelineResponse = await new Promise((resolve, reject) => {
this.pipelineService.findOne(objectSnakeToCamel(data)).subscribe({
this.pipelineService.FindOne(objectSnakeToCamel(data)).subscribe({
next(x) {
resolve(x);
},
@@ -106,7 +110,7 @@ export class PipelinesClientService implements OnModuleInit {
const updatePipelineResponse = await new Promise((resolve, reject) => {
this.pipelineService
.update(objectSnakeToCamel(UpdatePipelineRequest))
.Update(objectSnakeToCamel(UpdatePipelineRequest))
.subscribe({
next(x) {
resolve(x);
@@ -178,11 +182,11 @@ export class PipelinesClientService implements OnModuleInit {
return logsPipelineResponse;
}
async getPipelineStatus({ id }: IdRequest) {
async getPipelineStatus(data: IIdRequest) {
console.log('PipelinesClientService', 'GetPipelineStatus');
const statusPipelineResponse = await new Promise((resolve, reject) => {
this.pipelineService.getPipelineStatus({ id }).subscribe({
this.pipelineService.getPipelineStatus(data).subscribe({
next(x) {
resolve(x);
},
+6 -3
View File
@@ -1,5 +1,8 @@
import { ClientOptions, Transport } from '@nestjs/microservices';
import { TransformationProtofile } from '@victorradael/protospack';
import {
TransformationPackages,
TransformationProtoFilePath,
} from '@victorradael/protospack';
import { credentials } from '@grpc/grpc-js';
export class TransformationsClientConfiguration {
@@ -8,9 +11,9 @@ export class TransformationsClientConfiguration {
transport: Transport.GRPC,
options: {
url: process.env.TRFACTORY_URL,
package: 'transformation',
package: TransformationPackages,
credentials: credentials.createSsl(),
protoPath: TransformationProtofile,
protoPath: TransformationProtoFilePath,
loader: {
enums: String,
objects: true,
@@ -28,7 +28,7 @@ export class TransformationsClientService implements OnModuleInit {
const createTransformationResponse = await new Promise(
(resolve, reject) => {
this.transformationService
.create(objectSnakeToCamel(createTransformationsDto))
.Create(objectSnakeToCamel(createTransformationsDto))
.subscribe({
next(x) {
resolve(x);
@@ -62,7 +62,7 @@ export class TransformationsClientService implements OnModuleInit {
const findAllTransformationResponse = await new Promise(
(resolve, reject) => {
this.transformationService.findAll(objectSnakeToCamel(data)).subscribe({
this.transformationService.FindAll(objectSnakeToCamel(data)).subscribe({
next(x) {
resolve(x);
},
@@ -93,7 +93,7 @@ export class TransformationsClientService implements OnModuleInit {
const findOneTransformationResponse = await new Promise(
(resolve, reject) => {
this.transformationService.findOne(objectSnakeToCamel(data)).subscribe({
this.transformationService.FindOne(objectSnakeToCamel(data)).subscribe({
next(x) {
resolve(x);
},
@@ -121,7 +121,7 @@ export class TransformationsClientService implements OnModuleInit {
const updateTransformationResponse = await new Promise(
(resolve, reject) => {
this.transformationService
.update(objectSnakeToCamel(updateTransformationDTO))
.Update(objectSnakeToCamel(updateTransformationDTO))
.subscribe({
next(x) {
resolve(x);
@@ -149,7 +149,7 @@ export class TransformationsClientService implements OnModuleInit {
const removeTransformationResponse = await new Promise(
(resolve, reject) => {
this.transformationService.remove(objectSnakeToCamel(data)).subscribe({
this.transformationService.Remove(objectSnakeToCamel(data)).subscribe({
next(x) {
resolve(x);
},
+11
View File
@@ -241,6 +241,17 @@ export class CatalogController {
return res;
}
@Get('table-tags')
async getAllTableTags(@Body() body) {
console.log(`/catalog`, 'ON GET ALL TABLE TAGS ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.findAllTableTags(body);
return res;
}
@Delete('table-tags')
async deleteTableTags(@Param() params, @Body() body) {
console.log(`/catalog`, 'ON CREATE TABLE TAGS ROUTE');
+14
View File
@@ -232,6 +232,20 @@ class CatalogService {
return data;
}
async findAllTableTags(body) {
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.get(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/table-tags/`,
body,
);
return data;
}
async deleteTags(id, body) {
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
@@ -31,15 +31,17 @@ export class PipelinesController {
}
@Get(':id/status')
async getPipelineStatus(@Param() params) {
async getPipelineStatus(@Body() body, @Param() params) {
const { id } = params;
body.id = id;
console.log(
process.env.DEV_URL + `/pipeline/${id}`,
'ON GET PIPELINE STATUS ROUTE',
);
const pipelineService = new PipelinesService(this.pipelinesClientService);
const response = await pipelineService.getPipelineStatus(id);
const response = await pipelineService.getPipelineStatus(body);
return response;
}
+2 -2
View File
@@ -74,10 +74,10 @@ export class PipelinesService {
}
}
async getPipelineStatus(id: string) {
async getPipelineStatus(data: IIdRequest) {
try {
const pipelineStatusResponse =
await this.pipelineClient.getPipelineStatus({ id });
await this.pipelineClient.getPipelineStatus(data);
return objectCamelToSnake(pipelineStatusResponse);
} catch (err) {
+1 -1
View File
File diff suppressed because one or more lines are too long