Compare commits

...
11 Commits
Author SHA1 Message Date
Rodrigo Zamboni 2b162bd0a7 Merge pull request #68 from dadosfera/beta
Beta
2022-04-25 17:06:59 -03:00
Victor Radael 829f7611e2 Merge pull request #67 from dadosfera/alpha
Alpha
2022-04-25 16:49:04 -03:00
Rodrigo Zamboni b986cf3281 Merge pull request #66 from dadosfera/addHelmet
FIX: added helmet package to protect headers security
2022-04-25 16:35:59 -03:00
rodrigo.zamboni 75c7602e13 FIX: added helmet package to protect headers security 2022-04-25 16:25:42 -03:00
Victor Radael 710105a4a8 Merge pull request #65 from dadosfera/addHelmet
added helmet package to protect headers security
2022-04-25 16:16:07 -03:00
rodrigo.zamboni 30b048f776 added helmet package to protect headers security 2022-04-25 16:11:50 -03:00
Victor Radael 845b95b112 Merge pull request #64 from dadosfera/beta
Beta ->  main
2022-04-21 17:15:16 -03:00
Victor Radael 6d6b024884 Merge pull request #63 from dadosfera/alpha
Alpha -> Beta
2022-04-21 16:18:51 -03:00
Rodrigo Zamboni a4282a0dc5 Merge pull request #62 from dadosfera/feat/nimbusImplementation
Feat/nimbus implementation
2022-04-21 16:05:37 -03:00
rodrigo.zamboni 4672ecb6b3 FIX: Fixed maestro after protospack lib att 2022-04-21 16:02:11 -03:00
rodrigo.zamboni 6160107d75 FIX: Downgrade protospack lib 2022-04-20 16:22:26 -03:00
17 changed files with 109 additions and 48 deletions
+21 -7
View File
@@ -18,10 +18,11 @@
"@nestjs/microservices": "^8.4.3", "@nestjs/microservices": "^8.4.3",
"@nestjs/platform-express": "^8.4.3", "@nestjs/platform-express": "^8.4.3",
"@nestjs/swagger": "^5.2.1", "@nestjs/swagger": "^5.2.1",
"@victorradael/protospack": "^1.4.5", "@victorradael/protospack": "^1.5.5",
"axios": "^0.25.0", "axios": "^0.25.0",
"dotenv": "^14.2.0", "dotenv": "^14.2.0",
"grpc": "^1.24.11", "grpc": "^1.24.11",
"helmet": "^5.0.2",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"jwk-to-pem": "^2.0.5", "jwk-to-pem": "^2.0.5",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
@@ -2372,9 +2373,9 @@
} }
}, },
"node_modules/@victorradael/protospack": { "node_modules/@victorradael/protospack": {
"version": "1.4.5", "version": "1.5.5",
"resolved": "https://registry.npmjs.org/@victorradael/protospack/-/protospack-1.4.5.tgz", "resolved": "https://registry.npmjs.org/@victorradael/protospack/-/protospack-1.5.5.tgz",
"integrity": "sha512-xYJyN+C5GRwCfSbZOZyUcswBQZO99y1koMNnIIZHEY1TgHnMjehMTQv3F8lKmUelvsfUBhTebrrptjRoxhh4Vg==", "integrity": "sha512-5yGW/EuZDY9N56CVMXJW1IrBkkv6KpalBepu0LLQvM5Y+Pr8lwY2i1p/1rlsjHo6Gk1RODKuWSXAL870jQEAdg==",
"dependencies": { "dependencies": {
"rxjs": "^7.5.5" "rxjs": "^7.5.5"
} }
@@ -5232,6 +5233,14 @@
"minimalistic-assert": "^1.0.1" "minimalistic-assert": "^1.0.1"
} }
}, },
"node_modules/helmet": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/helmet/-/helmet-5.0.2.tgz",
"integrity": "sha512-QWlwUZZ8BtlvwYVTSDTBChGf8EOcQ2LkGMnQJxSzD1mUu8CCjXJZq/BXP8eWw4kikRnzlhtYo3lCk0ucmYA3Vg==",
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/hexoid": { "node_modules/hexoid": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz", "resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz",
@@ -11386,9 +11395,9 @@
} }
}, },
"@victorradael/protospack": { "@victorradael/protospack": {
"version": "1.4.5", "version": "1.5.5",
"resolved": "https://registry.npmjs.org/@victorradael/protospack/-/protospack-1.4.5.tgz", "resolved": "https://registry.npmjs.org/@victorradael/protospack/-/protospack-1.5.5.tgz",
"integrity": "sha512-xYJyN+C5GRwCfSbZOZyUcswBQZO99y1koMNnIIZHEY1TgHnMjehMTQv3F8lKmUelvsfUBhTebrrptjRoxhh4Vg==", "integrity": "sha512-5yGW/EuZDY9N56CVMXJW1IrBkkv6KpalBepu0LLQvM5Y+Pr8lwY2i1p/1rlsjHo6Gk1RODKuWSXAL870jQEAdg==",
"requires": { "requires": {
"rxjs": "^7.5.5" "rxjs": "^7.5.5"
} }
@@ -13620,6 +13629,11 @@
"minimalistic-assert": "^1.0.1" "minimalistic-assert": "^1.0.1"
} }
}, },
"helmet": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/helmet/-/helmet-5.0.2.tgz",
"integrity": "sha512-QWlwUZZ8BtlvwYVTSDTBChGf8EOcQ2LkGMnQJxSzD1mUu8CCjXJZq/BXP8eWw4kikRnzlhtYo3lCk0ucmYA3Vg=="
},
"hexoid": { "hexoid": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz", "resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz",
+2 -1
View File
@@ -30,10 +30,11 @@
"@nestjs/microservices": "^8.4.3", "@nestjs/microservices": "^8.4.3",
"@nestjs/platform-express": "^8.4.3", "@nestjs/platform-express": "^8.4.3",
"@nestjs/swagger": "^5.2.1", "@nestjs/swagger": "^5.2.1",
"@victorradael/protospack": "^1.4.5", "@victorradael/protospack": "^1.5.5",
"axios": "^0.25.0", "axios": "^0.25.0",
"dotenv": "^14.2.0", "dotenv": "^14.2.0",
"grpc": "^1.24.11", "grpc": "^1.24.11",
"helmet": "^5.0.2",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"jwk-to-pem": "^2.0.5", "jwk-to-pem": "^2.0.5",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
+2 -2
View File
@@ -1,7 +1,7 @@
import { credentials } from '@grpc/grpc-js'; import { credentials } from '@grpc/grpc-js';
import { ClientOptions, Transport } from '@nestjs/microservices'; import { ClientOptions, Transport } from '@nestjs/microservices';
import { DucProtoFilePath } from '@victorradael/protospack'; import { DucProtoFilePath, DucPackages } from '@victorradael/protospack';
export class AuthClient { export class AuthClient {
config(): ClientOptions { config(): ClientOptions {
@@ -9,7 +9,7 @@ export class AuthClient {
transport: Transport.GRPC, transport: Transport.GRPC,
options: { options: {
url: process.env.DUC_URL, url: process.env.DUC_URL,
package: 'duc', package: DucPackages,
credentials: credentials.createSsl(), credentials: credentials.createSsl(),
protoPath: DucProtoFilePath, protoPath: DucProtoFilePath,
loader: { loader: {
+9 -6
View File
@@ -1,27 +1,30 @@
import { OnModuleInit, Inject } from '@nestjs/common'; import { OnModuleInit, Inject } from '@nestjs/common';
import { ClientGrpc } from '@nestjs/microservices'; import { ClientGrpc } from '@nestjs/microservices';
import { CognitoServiceInterface } from '@victorradael/protospack'; import {
AuthServiceInterface,
DucServicesNames,
} from '@victorradael/protospack';
import { ILogin } from './interfaces'; import { ILogin } from './interfaces';
export class AuthClientService implements OnModuleInit { export class AuthClientService implements OnModuleInit {
private cognitoService: CognitoServiceInterface; private authService: AuthServiceInterface;
constructor( constructor(
@Inject('AUTH_PACKAGE') private readonly grpcClient: ClientGrpc, @Inject('AUTH_PACKAGE') private readonly grpcClient: ClientGrpc,
) {} ) {}
onModuleInit() { onModuleInit() {
this.cognitoService = this.grpcClient.getService<CognitoServiceInterface>( this.authService = this.grpcClient.getService<AuthServiceInterface>(
'CognitoProtoService', DucServicesNames.AuthProtoService,
); );
} }
async signIn({ username, password }: ILogin): Promise<any> { async signIn({ username, password }: ILogin): Promise<any> {
console.log('CognitoClientService', 'SignIn'); console.log('AuthClientService', 'SignIn');
const tokens = await new Promise((resolve, reject) => { const tokens = await new Promise((resolve, reject) => {
this.cognitoService.signIn({ username, password }).subscribe({ this.authService.signIn({ username, password }).subscribe({
next(x) { next(x) {
resolve(x); resolve(x);
}, },
+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 { ClientOptions, Transport } from '@nestjs/microservices';
import { credentials } from '@grpc/grpc-js'; import { credentials } from '@grpc/grpc-js';
@@ -8,9 +8,9 @@ export class OutputsClientConfiguration {
transport: Transport.GRPC, transport: Transport.GRPC,
options: { options: {
url: process.env.OTFACTORY_URL, url: process.env.OTFACTORY_URL,
package: 'output', package: OutputPackages,
credentials: credentials.createSsl(), credentials: credentials.createSsl(),
protoPath: OutputProtofile, protoPath: OutputProtoFilePath,
loader: { loader: {
enums: String, enums: String,
objects: true, objects: true,
+7 -3
View File
@@ -1,6 +1,9 @@
import { Controller, Inject, OnModuleInit } from '@nestjs/common'; import { Controller, Inject, OnModuleInit } from '@nestjs/common';
import { ClientGrpc, Payload } from '@nestjs/microservices'; import { ClientGrpc, Payload } from '@nestjs/microservices';
import { OutputsServiceInterface } from '@victorradael/protospack'; import {
OutputServicesNames,
OutputsServiceInterface,
} from '@victorradael/protospack';
import { import {
objectCamelToSnake, objectCamelToSnake,
objectSnakeToCamel, objectSnakeToCamel,
@@ -19,8 +22,9 @@ export class OutputsClientService implements OnModuleInit {
) {} ) {}
onModuleInit() { onModuleInit() {
this.outputService = this.outputService = this.grpcClient.getService<OutputsServiceInterface>(
this.grpcClient.getService<OutputsServiceInterface>('OutputService'); OutputServicesNames.OutputService,
);
} }
async create(@Payload() createOutputDto: ICreateOutputRequest) { async create(@Payload() createOutputDto: ICreateOutputRequest) {
+6 -3
View File
@@ -1,5 +1,8 @@
import { ClientOptions, Transport } from '@nestjs/microservices'; import { ClientOptions, Transport } from '@nestjs/microservices';
import { PipelineProtofile } from '@victorradael/protospack'; import {
PipelinePackages,
PipelineProtoFilePath,
} from '@victorradael/protospack';
import { credentials } from '@grpc/grpc-js'; import { credentials } from '@grpc/grpc-js';
export class PipelinesClientConfiguration { export class PipelinesClientConfiguration {
@@ -8,9 +11,9 @@ export class PipelinesClientConfiguration {
transport: Transport.GRPC, transport: Transport.GRPC,
options: { options: {
url: process.env.PIFACTORY_URL, url: process.env.PIFACTORY_URL,
package: 'pipeline', package: PipelinePackages,
credentials: credentials.createSsl(), credentials: credentials.createSsl(),
protoPath: PipelineProtofile, protoPath: PipelineProtoFilePath,
loader: { loader: {
enums: String, enums: String,
objects: true, objects: true,
+13 -9
View File
@@ -1,13 +1,15 @@
import { Inject, OnModuleInit } from '@nestjs/common'; import { Inject, OnModuleInit } from '@nestjs/common';
import { ClientGrpc, Payload } from '@nestjs/microservices'; import { ClientGrpc, Payload } from '@nestjs/microservices';
import { PipelinesServiceInterface } from '@victorradael/protospack'; import {
PipelineServicesNames,
PipelinesServiceInterface,
} from '@victorradael/protospack';
import { import {
objectCamelToSnake, objectCamelToSnake,
objectSnakeToCamel, objectSnakeToCamel,
} from 'src/utils/CaseConverter'; } from 'src/utils/CaseConverter';
import { import {
ICreatePipelineDto, ICreatePipelineDto,
IdRequest,
IGetPipelineLogsRequest, IGetPipelineLogsRequest,
IIdRequest, IIdRequest,
IUpdatePipelineRequest, IUpdatePipelineRequest,
@@ -21,7 +23,9 @@ export class PipelinesClientService implements OnModuleInit {
onModuleInit() { onModuleInit() {
this.pipelineService = this.pipelineService =
this.grpcClient.getService<PipelinesServiceInterface>('PipelineService'); this.grpcClient.getService<PipelinesServiceInterface>(
PipelineServicesNames.PipelineService,
);
} }
async create(@Payload() createPipelineDto: ICreatePipelineDto) { async create(@Payload() createPipelineDto: ICreatePipelineDto) {
@@ -29,7 +33,7 @@ export class PipelinesClientService implements OnModuleInit {
const createPipelineResponse = await new Promise((resolve, reject) => { const createPipelineResponse = await new Promise((resolve, reject) => {
this.pipelineService this.pipelineService
.create(objectSnakeToCamel(createPipelineDto)) .Create(objectSnakeToCamel(createPipelineDto))
.subscribe({ .subscribe({
next(x) { next(x) {
resolve(x); resolve(x);
@@ -55,7 +59,7 @@ export class PipelinesClientService implements OnModuleInit {
console.log('PipelinesClientService', 'FindAll'); console.log('PipelinesClientService', 'FindAll');
const findAllPipelineResponse = await new Promise((resolve, reject) => { const findAllPipelineResponse = await new Promise((resolve, reject) => {
this.pipelineService.findAll(objectSnakeToCamel(data)).subscribe({ this.pipelineService.FindAll(objectSnakeToCamel(data)).subscribe({
next(x) { next(x) {
resolve(x); resolve(x);
}, },
@@ -80,7 +84,7 @@ export class PipelinesClientService implements OnModuleInit {
console.log('PipelinesClientService', 'FindOne'); console.log('PipelinesClientService', 'FindOne');
const findOnePipelineResponse = await new Promise((resolve, reject) => { const findOnePipelineResponse = await new Promise((resolve, reject) => {
this.pipelineService.findOne(objectSnakeToCamel(data)).subscribe({ this.pipelineService.FindOne(objectSnakeToCamel(data)).subscribe({
next(x) { next(x) {
resolve(x); resolve(x);
}, },
@@ -106,7 +110,7 @@ export class PipelinesClientService implements OnModuleInit {
const updatePipelineResponse = await new Promise((resolve, reject) => { const updatePipelineResponse = await new Promise((resolve, reject) => {
this.pipelineService this.pipelineService
.update(objectSnakeToCamel(UpdatePipelineRequest)) .Update(objectSnakeToCamel(UpdatePipelineRequest))
.subscribe({ .subscribe({
next(x) { next(x) {
resolve(x); resolve(x);
@@ -178,11 +182,11 @@ export class PipelinesClientService implements OnModuleInit {
return logsPipelineResponse; return logsPipelineResponse;
} }
async getPipelineStatus({ id }: IdRequest) { async getPipelineStatus(data: IIdRequest) {
console.log('PipelinesClientService', 'GetPipelineStatus'); console.log('PipelinesClientService', 'GetPipelineStatus');
const statusPipelineResponse = await new Promise((resolve, reject) => { const statusPipelineResponse = await new Promise((resolve, reject) => {
this.pipelineService.getPipelineStatus({ id }).subscribe({ this.pipelineService.getPipelineStatus(data).subscribe({
next(x) { next(x) {
resolve(x); resolve(x);
}, },
+6 -3
View File
@@ -1,5 +1,8 @@
import { ClientOptions, Transport } from '@nestjs/microservices'; import { ClientOptions, Transport } from '@nestjs/microservices';
import { TransformationProtofile } from '@victorradael/protospack'; import {
TransformationPackages,
TransformationProtoFilePath,
} from '@victorradael/protospack';
import { credentials } from '@grpc/grpc-js'; import { credentials } from '@grpc/grpc-js';
export class TransformationsClientConfiguration { export class TransformationsClientConfiguration {
@@ -8,9 +11,9 @@ export class TransformationsClientConfiguration {
transport: Transport.GRPC, transport: Transport.GRPC,
options: { options: {
url: process.env.TRFACTORY_URL, url: process.env.TRFACTORY_URL,
package: 'transformation', package: TransformationPackages,
credentials: credentials.createSsl(), credentials: credentials.createSsl(),
protoPath: TransformationProtofile, protoPath: TransformationProtoFilePath,
loader: { loader: {
enums: String, enums: String,
objects: true, objects: true,
@@ -28,7 +28,7 @@ export class TransformationsClientService implements OnModuleInit {
const createTransformationResponse = await new Promise( const createTransformationResponse = await new Promise(
(resolve, reject) => { (resolve, reject) => {
this.transformationService this.transformationService
.create(objectSnakeToCamel(createTransformationsDto)) .Create(objectSnakeToCamel(createTransformationsDto))
.subscribe({ .subscribe({
next(x) { next(x) {
resolve(x); resolve(x);
@@ -62,7 +62,7 @@ export class TransformationsClientService implements OnModuleInit {
const findAllTransformationResponse = await new Promise( const findAllTransformationResponse = await new Promise(
(resolve, reject) => { (resolve, reject) => {
this.transformationService.findAll(objectSnakeToCamel(data)).subscribe({ this.transformationService.FindAll(objectSnakeToCamel(data)).subscribe({
next(x) { next(x) {
resolve(x); resolve(x);
}, },
@@ -93,7 +93,7 @@ export class TransformationsClientService implements OnModuleInit {
const findOneTransformationResponse = await new Promise( const findOneTransformationResponse = await new Promise(
(resolve, reject) => { (resolve, reject) => {
this.transformationService.findOne(objectSnakeToCamel(data)).subscribe({ this.transformationService.FindOne(objectSnakeToCamel(data)).subscribe({
next(x) { next(x) {
resolve(x); resolve(x);
}, },
@@ -121,7 +121,7 @@ export class TransformationsClientService implements OnModuleInit {
const updateTransformationResponse = await new Promise( const updateTransformationResponse = await new Promise(
(resolve, reject) => { (resolve, reject) => {
this.transformationService this.transformationService
.update(objectSnakeToCamel(updateTransformationDTO)) .Update(objectSnakeToCamel(updateTransformationDTO))
.subscribe({ .subscribe({
next(x) { next(x) {
resolve(x); resolve(x);
@@ -149,7 +149,7 @@ export class TransformationsClientService implements OnModuleInit {
const removeTransformationResponse = await new Promise( const removeTransformationResponse = await new Promise(
(resolve, reject) => { (resolve, reject) => {
this.transformationService.remove(objectSnakeToCamel(data)).subscribe({ this.transformationService.Remove(objectSnakeToCamel(data)).subscribe({
next(x) { next(x) {
resolve(x); resolve(x);
}, },
+3
View File
@@ -1,6 +1,7 @@
import { NestFactory } from '@nestjs/core'; import { NestFactory } from '@nestjs/core';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { writeFileSync } from 'fs'; import { writeFileSync } from 'fs';
import helmet from 'helmet';
import { AppModule } from './app.module'; import { AppModule } from './app.module';
@@ -14,6 +15,8 @@ async function bootstrap() {
}, },
}); });
app.use(helmet());
const config = new DocumentBuilder() const config = new DocumentBuilder()
.setTitle('Maestro Grpc Documentation') .setTitle('Maestro Grpc Documentation')
.setDescription('Documentation for Maestro gateway') .setDescription('Documentation for Maestro gateway')
+11
View File
@@ -241,6 +241,17 @@ export class CatalogController {
return res; 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') @Delete('table-tags')
async deleteTableTags(@Param() params, @Body() body) { async deleteTableTags(@Param() params, @Body() body) {
console.log(`/catalog`, 'ON CREATE TABLE TAGS ROUTE'); console.log(`/catalog`, 'ON CREATE TABLE TAGS ROUTE');
+13
View File
@@ -232,6 +232,19 @@ class CatalogService {
return data; 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) { async deleteTags(id, body) {
const customer = const customer =
body.info.customer.toLowerCase() === 'dadosfera' body.info.customer.toLowerCase() === 'dadosfera'
@@ -31,15 +31,17 @@ export class PipelinesController {
} }
@Get(':id/status') @Get(':id/status')
async getPipelineStatus(@Param() params) { async getPipelineStatus(@Body() body, @Param() params) {
const { id } = params; const { id } = params;
body.id = id;
console.log( console.log(
process.env.DEV_URL + `/pipeline/${id}`, process.env.DEV_URL + `/pipeline/${id}`,
'ON GET PIPELINE STATUS ROUTE', 'ON GET PIPELINE STATUS ROUTE',
); );
const pipelineService = new PipelinesService(this.pipelinesClientService); const pipelineService = new PipelinesService(this.pipelinesClientService);
const response = await pipelineService.getPipelineStatus(id); const response = await pipelineService.getPipelineStatus(body);
return response; return response;
} }
+2 -2
View File
@@ -74,10 +74,10 @@ export class PipelinesService {
} }
} }
async getPipelineStatus(id: string) { async getPipelineStatus(data: IIdRequest) {
try { try {
const pipelineStatusResponse = const pipelineStatusResponse =
await this.pipelineClient.getPipelineStatus({ id }); await this.pipelineClient.getPipelineStatus(data);
return objectCamelToSnake(pipelineStatusResponse); return objectCamelToSnake(pipelineStatusResponse);
} catch (err) { } catch (err) {
+1 -1
View File
File diff suppressed because one or more lines are too long