Compare commits

...
68 Commits
Author SHA1 Message Date
Rodrigo Zamboni 8a31e11445 Merge pull request #87 from dadosfera/beta
Beta
2022-04-28 17:23:54 -03:00
Rodrigo Zamboni 2013e97e20 Merge pull request #86 from dadosfera/alpha
Alpha
2022-04-28 17:12:53 -03:00
rodrigo.zamboni dd271205ba Merge branch 'alpha' of https://github.com/dadosfera/maestro into alpha 2022-04-28 17:00:44 -03:00
rodrigo.zamboni a1f9f14897 FIX: Fixing more catalog routes params 2022-04-28 17:00:08 -03:00
Gabriel Amorim b7efa2f58d Merge pull request #85 from dadosfera/beta
Beta -> Main
2022-04-28 16:04:10 -03:00
Gabriel Amorim 395e36581d Merge pull request #84 from dadosfera/alpha
Alpha -> Beta
2022-04-28 16:03:53 -03:00
rodrigo.zamboni 97a54f9267 Merge branch 'alpha' of https://github.com/dadosfera/maestro into alpha 2022-04-28 15:56:30 -03:00
rodrigo.zamboni 00b0e00bd0 FIX: fix iframe_url and pipeline status 2022-04-28 15:55:48 -03:00
Rodrigo Zamboni 9188536161 Merge pull request #83 from dadosfera/beta
Beta
2022-04-28 14:53:16 -03:00
Rodrigo Zamboni 1ae8151184 Merge pull request #82 from dadosfera/alpha
Alpha -> Beta
2022-04-28 14:40:14 -03:00
rodrigo.zamboni 3d77980dd2 CI: deploy 2022-04-28 14:24:28 -03:00
Rodrigo Zamboni 849b979e63 Merge pull request #81 from dadosfera/feat/CatalogFixes
Feat/catalog fixes
2022-04-28 14:19:31 -03:00
rodrigo.zamboni 28580782b1 FIX: catalog routes fix 2022-04-28 14:14:03 -03:00
Rodrigo Zamboni fc784e2d6d Merge pull request #79 from dadosfera/alpha
Alpha
2022-04-28 13:22:14 -03:00
rodrigo.zamboni c997e91912 FIX: fix table-metadata find one route 2022-04-28 12:59:35 -03:00
rodrigo.zamboni 22f493d48a FIX: fixing missing id on delete routes 2022-04-28 12:12:37 -03:00
rodrigo.zamboni 035213824b FIX: fixing missing id on delete routes 2022-04-28 12:00:19 -03:00
rodrigo.zamboni 1ffa9ade51 FIX: CI 2022-04-28 10:53:17 -03:00
Rodrigo Zamboni c91aa57344 Merge pull request #78 from dadosfera/beta
Beta
2022-04-27 17:36:54 -03:00
Rodrigo Zamboni 077a95cdbd Merge pull request #77 from dadosfera/alpha
Alpha
2022-04-27 17:16:09 -03:00
Rodrigo Zamboni f39108772b Merge pull request #76 from dadosfera/NewInput
FIX: fix pipeline activate route method
2022-04-27 16:57:56 -03:00
rodrigo.zamboni cdd8beee8f FIX: fix pipeline activate route method 2022-04-27 16:56:03 -03:00
rodrigo.zamboni 14331ed229 FIX: fix pipeline activate route method 2022-04-27 16:54:48 -03:00
Victor Radael 5f3db0cb43 Merge pull request #75 from dadosfera/beta
Beta -> Main
2022-04-27 11:42:18 -03:00
Rodrigo Zamboni 28f304c47c Merge pull request #74 from dadosfera/alpha
Alpha
2022-04-26 17:41:57 -03:00
Rodrigo Zamboni 0c1b62b2aa Merge pull request #73 from dadosfera/NewInput
FIX: Fix get-columns route method
2022-04-26 17:25:11 -03:00
rodrigo.zamboni 13f7e9d812 FIX: Fix get-columns route method 2022-04-26 17:19:18 -03:00
Gabriel Amorim 841dcfef06 Merge pull request #72 from dadosfera/alpha
Alpha
2022-04-26 16:30:31 -03:00
Gabriel Amorim f41ddc1483 Merge pull request #71 from dadosfera/NewInput
UPDATE: Implemented new Input format
2022-04-26 16:19:19 -03:00
rodrigo.zamboni 0a2c7c0a38 UPDATE: Implemented new Input format 2022-04-26 16:15:54 -03:00
Rodrigo Zamboni 87f4c17ca2 Merge pull request #70 from dadosfera/beta
Beta
2022-04-26 13:50:00 -03:00
Rodrigo Zamboni a89625c1e6 Merge pull request #69 from dadosfera/alpha
Alpha
2022-04-26 11:16:06 -03:00
rodrigo.zamboni 44211d5658 FIX: CI 2022-04-26 11:01:20 -03:00
rodrigo.zamboni d4e11b1935 FIX: CI 2022-04-26 10:48:57 -03:00
rodrigo.zamboni 5c5e940cf7 FIX: CI 2022-04-26 10:40:11 -03:00
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
Rodrigo Zamboni 589a1f9d51 Merge pull request #60 from dadosfera/feat/nimbusImplementation
Feat/nimbus implementation
2022-04-20 16:01:32 -03:00
rodrigo.zamboni cb929d9b60 FIX: FIX 2022-04-20 15:56:50 -03:00
rodrigo.zamboni 678bebef7e FIX: fix proto packages names 2022-04-20 15:52:26 -03:00
Rodrigo Zamboni b6d7d54f9c Merge pull request #58 from dadosfera/feat/nimbusImplementation
adding get all tags function
2022-04-20 15:30:40 -03:00
rodrigo.zamboni 5df8b2834c FIX: adding get all tags function 2022-04-20 15:08:51 -03:00
rodrigo.zamboni 76d9571f02 FIX: adding get all tags function 2022-04-20 14:51:04 -03:00
rodrigo.zamboni 0c51014ec9 adding get all tags function 2022-04-20 14:40:01 -03:00
Rodrigo Zamboni 7f1d8e4b2a Merge pull request #57 from dadosfera/beta
Beta
2022-04-19 18:29:16 -03:00
Victor Radael 92b78ff19d Merge pull request #56 from dadosfera/alpha
Alpha
2022-04-19 17:06:28 -03:00
Rodrigo Zamboni 1b328b9915 Merge pull request #55 from dadosfera/NimbusImplementation
UPDATE: Added Nimbus Catalog routes
2022-04-19 16:24:34 -03:00
rodrigo.zamboni e653aeea3c UPDATE: Added Nimbus Catalog routes 2022-04-19 15:56:29 -03:00
Rodrigo Zamboni b49633cbc2 Merge pull request #54 from dadosfera/beta
Beta
2022-04-18 13:58:14 -03:00
Rodrigo Zamboni 4d956e55c6 Merge pull request #53 from dadosfera/alpha
Alpha
2022-04-18 12:18:28 -03:00
Rodrigo Zamboni 735703bf3b Merge pull request #52 from dadosfera/feat/activatePipeline
Feat/activate pipeline
2022-04-18 11:54:43 -03:00
rodrigo.zamboni 93cdc3f030 UPDATE: remove unescessary console log 2022-04-18 11:50:17 -03:00
rodrigo.zamboni 12b8b5926c UPDATE: Created Trigger Pipeline route 2022-04-18 11:44:19 -03:00
rodrigo.zamboni 1643096d47 Created Trigger Pipeline route 2022-04-18 11:43:36 -03:00
Rodrigo Zamboni 8a519ac217 Merge pull request #51 from dadosfera/beta
Beta
2022-04-14 15:33:36 -03:00
Victor Radael ffa69a0cf5 Merge pull request #50 from dadosfera/alpha
Alpha
2022-04-14 15:14:12 -03:00
Rodrigo Zamboni 7722e380e3 Merge pull request #49 from dadosfera/authFix
FIX: using Unauth nest function
2022-04-14 15:01:18 -03:00
rodrigo.zamboni ecdc7b4eb6 FIX: using Unauth nest function 2022-04-14 14:56:18 -03:00
rodrigo.zamboni 7d14080ac1 FIX: Invalid auth credentials return 2022-04-14 14:48:40 -03:00
27 changed files with 10253 additions and 665 deletions
+7
View File
@@ -0,0 +1,7 @@
Resources:
AWSEBAutoScalingLaunchConfiguration:
Properties:
MetadataOptions:
HttpEndpoint: enabled
HttpPutResponseHopLimit: 2
HttpTokens: required
+25 -25
View File
@@ -23,19 +23,15 @@ jobs:
fi
id: extract_environment
deploy:
needs: extract_environment
runs-on:
[self-hosted, '${{ needs.extract_environment.outputs.environment }}']
semantic_release:
runs-on: ubuntu-latest
outputs:
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
steps:
- name: Checkout
uses: actions/checkout@v2
# Because Semantic Realese deleted the .npmrc file, it was necessary to insert two steps to backup the file.
- name: BKP .npmrc Step 1
run: |
cp .npmrc .npmrcbkp
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
id: semantic
@@ -60,40 +56,43 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# Because Semantic Realese deleted the .npmrc file, it was necessary to insert two steps to backup the file.
- name: BKP .npmrc Step 2
run: |
cp .npmrcbkp .npmrc
deploy:
needs: [extract_environment, semantic_release]
runs-on: [self-hosted, "${{ needs.extract_environment.outputs.environment }}"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Update Pip
if: steps.semantic.outputs.new_release_published == 'true'
if: needs.semantic_release.outputs.new_release_published == 'true'
run: |
python3 -m pip install --upgrade pip
- name: Install Docker Compose
if: steps.semantic.outputs.new_release_published == 'true'
if: needs.semantic_release.outputs.new_release_published == 'true'
run: |
python3 -m pip install docker-compose --upgrade
- name: Install AWS CLI
if: steps.semantic.outputs.new_release_published == 'true'
if: needs.semantic_release.outputs.new_release_published == 'true'
run: |
python3 -m pip install awscli --upgrade
- name: Install AWS Elastic Beanstalk CLI
if: steps.semantic.outputs.new_release_published == 'true'
if: needs.semantic_release.outputs.new_release_published == 'true'
run: |
python3 -m pip install awsebcli --upgrade
- name: Configure AWS Region
if: steps.semantic.outputs.new_release_published == 'true'
if: needs.semantic_release.outputs.new_release_published == 'true'
uses: aws-actions/configure-aws-credentials@v1
id: aws
with:
aws-region: us-east-1
- name: Extract Environment
if: steps.semantic.outputs.new_release_published == 'true'
if: needs.semantic_release.outputs.new_release_published == 'true'
shell: bash
run: |
if [ ${GITHUB_REF} == "refs/heads/main" ]; then
@@ -106,15 +105,15 @@ jobs:
id: extract_environment
- name: Login to AWS ECR
if: steps.semantic.outputs.new_release_published == 'true'
if: needs.semantic_release.outputs.new_release_published == 'true'
id: login_ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, Tag, and Push Image to AWS ECR
if: steps.semantic.outputs.new_release_published == 'true'
if: needs.semantic_release.outputs.new_release_published == 'true'
env:
ENV: ${{ steps.extract_environment.outputs.result }}
IMAGE_TAG: ${{ steps.semantic.outputs.new_release_version }}
IMAGE_TAG: ${{ needs.semantic_release.outputs.new_release_version }}
ACCOUNT_ID: ${{ steps.aws.outputs.aws-account-id }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
@@ -122,10 +121,10 @@ jobs:
docker-compose -f build.docker-compose.yml push
- name: Create ZIP file to Deploy AWS Beanstalk
if: steps.semantic.outputs.new_release_published == 'true'
if: needs.semantic_release.outputs.new_release_published == 'true'
env:
ENV: ${{ steps.extract_environment.outputs.result }}
IMAGE_TAG: ${{ steps.semantic.outputs.new_release_version }}
IMAGE_TAG: ${{ needs.semantic_release.outputs.new_release_version }}
ACCOUNT_ID: ${{ steps.aws.outputs.aws-account-id }}
run: |
sed -i -e "s/\${ENV}/$ENV/g" docker-compose.yml
@@ -134,13 +133,14 @@ jobs:
zip deploy.zip docker-compose.yml -r .ebextensions
- name: Deploy AWS Beanstalk
if: steps.semantic.outputs.new_release_published == 'true'
if: needs.semantic_release.outputs.new_release_published == 'true'
env:
ENV: ${{ steps.extract_environment.outputs.result }}
AWS_REGION: us-east-1
APP_NAME: maestro
run: |
eb use $APP_NAME-$ENV
echo -e "deploy:\n artifact: deploy.zip" >> .elasticbeanstalk/config.yml
eb deploy
- name: Remove Docker's Trash
+2 -2
View File
@@ -1,4 +1,4 @@
<p align="center">
<image src="./assets/maestro.svg" style="width:10rem">
<h1 align="center">Maestro</h1>
</p>
<h1 align="center">Maestro</h1>
</p>
+9300 -543
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -30,10 +30,10 @@
"@nestjs/microservices": "^8.4.3",
"@nestjs/platform-express": "^8.4.3",
"@nestjs/swagger": "^5.2.1",
"@victorradael/protospack": "^1.3.9",
"@victorradael/protospack": "^1.5.9",
"axios": "^0.25.0",
"dotenv": "^14.2.0",
"grpc": "^1.24.11",
"helmet": "^5.0.2",
"jsonwebtoken": "^8.5.1",
"jwk-to-pem": "^2.0.5",
"reflect-metadata": "^0.1.13",
+5
View File
@@ -29,6 +29,8 @@ import { TransformationsClientConfiguration } from './clients/transformations/cl
import { AuthClient } from './clients/auth/client.config';
import { InputsClientConfiguration } from './clients/inputs/client.config';
import { PipelinesClientConfiguration } from './clients/pipelines/client.config';
import { CatalogController } from './modules/catalog/catalog.controller';
import { CatalogService } from './modules/catalog/catalog.service';
const authClient = new AuthClient();
const inputClient = new InputsClientConfiguration();
@@ -44,6 +46,7 @@ const transformationClient = new TransformationsClientConfiguration();
PipelinesController,
AuthController,
HealthController,
CatalogController,
],
providers: [
InputsService,
@@ -57,6 +60,7 @@ const transformationClient = new TransformationsClientConfiguration();
OutputsClientService,
PipelinesClientService,
AuthClientService,
CatalogService,
],
imports: [
ConfigModule.forRoot({
@@ -97,6 +101,7 @@ export class AppModule implements NestModule {
TransformationsController,
OutputsController,
PipelinesController,
CatalogController,
);
}
}
+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,
+48 -22
View File
@@ -1,16 +1,16 @@
import { OnModuleInit, Inject } from '@nestjs/common';
import { ClientGrpc } from '@nestjs/microservices';
import { InputService } from '@victorradael/protospack';
import {
InputNewCreateRequest,
InputService,
TestConnectionGetColumnsRequest,
TestConnectionRequest,
} from '@victorradael/protospack';
import {
objectCamelToSnake,
objectSnakeToCamel,
} from 'src/utils/CaseConverter';
import {
ICreateInputRequest,
IIdRequest,
ITestConnectionRequest,
UpdateInputRequest,
} from './interfaces';
import { IIdRequest, UpdateInputRequest } from './interfaces';
export class InputsClientService implements OnModuleInit {
private inputService: InputService;
@@ -23,22 +23,24 @@ export class InputsClientService implements OnModuleInit {
this.grpcClient.getService<InputService>('InputService');
}
async create(createInputDto: ICreateInputRequest) {
async create(createInputDto: InputNewCreateRequest) {
console.log('InputClientService', 'Create');
const createInputResponse = await new Promise((resolve, reject) => {
this.inputService.Create(objectSnakeToCamel(createInputDto)).subscribe({
next(x) {
resolve(objectCamelToSnake(x));
},
error(err) {
console.log('Observable Error');
reject(err);
},
complete() {
console.log('done');
},
});
this.inputService
.NewCreate(objectSnakeToCamel(createInputDto))
.subscribe({
next(x) {
resolve(objectCamelToSnake(x));
},
error(err) {
console.log('Observable Error');
reject(err);
},
complete() {
console.log('done');
},
});
})
.then((res) => res)
.catch((err) => {
@@ -147,10 +149,10 @@ export class InputsClientService implements OnModuleInit {
return removeInputResponse;
}
async testConnection(data: ITestConnectionRequest) {
async testConnection(data: TestConnectionRequest) {
console.log('InputClientService', 'TestConnection');
const testConnectionResponse = await new Promise((resolve, reject) => {
this.inputService.TestConnection(objectSnakeToCamel(data)).subscribe({
this.inputService.NewTestConnection(objectSnakeToCamel(data)).subscribe({
next(x) {
resolve(objectCamelToSnake(x));
},
@@ -170,4 +172,28 @@ export class InputsClientService implements OnModuleInit {
return testConnectionResponse;
}
async getColumns(data: TestConnectionGetColumnsRequest) {
console.log('InputClientService', 'TestConnection/Get-Columns');
const getColumnsResponse = await new Promise((resolve, reject) => {
this.inputService.GetColumns(objectSnakeToCamel(data)).subscribe({
next(x) {
resolve(objectCamelToSnake(x));
},
error(err) {
console.log('Observable Error');
reject(err);
},
complete() {
console.log('done');
},
});
})
.then((res) => res)
.catch((err) => {
throw new Error(err);
});
return getColumnsResponse;
}
}
+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,
+58 -19
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,22 +182,57 @@ export class PipelinesClientService implements OnModuleInit {
return logsPipelineResponse;
}
async getPipelineStatus({ id }: IdRequest) {
async getPipelineStatus(data) {
console.log('PipelinesClientService', 'GetPipelineStatus');
const statusPipelineResponse = await new Promise((resolve, reject) => {
this.pipelineService.getPipelineStatus({ id }).subscribe({
next(x) {
resolve(x);
},
error(err) {
console.log('Observable Error');
reject(err);
},
complete() {
console.log('done');
},
this.pipelineService
.getPipelineStatus(objectSnakeToCamel(data))
.subscribe({
next(x) {
const statusArray = x.status.sort((a, b) => {
if (Date.parse(a.updated_at) < Date.parse(b.updated_at)) {
return 1;
} else {
return -1;
}
});
resolve(statusArray);
},
error(err) {
console.log('Observable Error');
reject(err);
},
complete() {
console.log('done');
},
});
})
.then((res) => res)
.catch((err) => {
throw new Error(err);
});
return statusPipelineResponse;
}
async runPipeline({ id, info }: IIdRequest) {
console.log('PipelinesClientService', 'RunPipeline');
const statusPipelineResponse = await new Promise((resolve, reject) => {
this.pipelineService
.triggerPipeline(objectSnakeToCamel({ id, info }))
.subscribe({
next(x) {
resolve(x);
},
error(err) {
console.log('Observable Error');
reject(err);
},
complete() {
console.log('done');
},
});
})
.then((res) => res)
.catch((err) => {
+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);
},
+3
View File
@@ -1,6 +1,7 @@
import { NestFactory } from '@nestjs/core';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { writeFileSync } from 'fs';
import helmet from 'helmet';
import { AppModule } from './app.module';
@@ -14,6 +15,8 @@ async function bootstrap() {
},
});
app.use(helmet());
const config = new DocumentBuilder()
.setTitle('Maestro Grpc Documentation')
.setDescription('Documentation for Maestro gateway')
+2 -1
View File
@@ -14,7 +14,6 @@ import { HttpExceptionFilter } from 'src/error/http-exception.filter';
@UseFilters(new HttpExceptionFilter())
export class LoggerMiddleware implements NestMiddleware {
use = async (request: Request, response: Response, next: NextFunction) => {
console.log('Middle', new Date());
const idToken = request.get('Dadosfera-User');
const accessToken = request.get('Authorization');
const privateKey = process.env.JWT_PRIVATE_KEY;
@@ -31,6 +30,7 @@ export class LoggerMiddleware implements NestMiddleware {
const permissions = jwtDecoded.user.permissions;
const clienId = jwtDecoded.user.customerId;
const customer = jwtDecoded.user.customer;
const userId = jwtDecoded.user.id;
await verifyToken(accessToken);
@@ -50,6 +50,7 @@ export class LoggerMiddleware implements NestMiddleware {
request.body.info = {
customer_id: clienId,
user_id: userId,
customer,
};
next();
+4 -2
View File
@@ -1,4 +1,4 @@
import { Body, Controller, Post } from '@nestjs/common';
import { Body, Controller, Post, UnauthorizedException } from '@nestjs/common';
import { AuthClientService } from 'src/clients/auth/client.service';
@@ -18,7 +18,9 @@ export class AuthController {
const tokens = await this.authClient
.signIn({ username, password })
.then((result) => result)
.catch((err) => console.log(err));
.catch((err) => {
throw new UnauthorizedException(err.message);
});
return tokens;
}
+322
View File
@@ -0,0 +1,322 @@
import {
Body,
Controller,
Delete,
Get,
Param,
Post,
Query,
} from '@nestjs/common';
import { CatalogService } from './catalog.service';
@Controller('catalog')
export class CatalogController {
constructor(private catalogService: CatalogService) {}
@Get('all')
async catalogAll(@Body() body) {
console.log(`/catalog`, 'ON CATALOG ALL ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.catalogAll(body);
return res;
}
@Get('data_apps')
async dataAppsAll(@Body() body) {
console.log(`/catalog`, 'ON FIND ALL DATA APPS ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.dataAppsAll(body);
return res;
}
@Delete('data_apps/:id')
async dataAppsOne(@Param() params, @Body() body) {
console.log(`/catalog`, 'ON FIND ONE DATA APP ROUTE');
const { id } = params;
const catalogService = new CatalogService();
const res = await catalogService.dataAppsOne(id, body);
return res;
}
@Get('dashboard-metabase')
async getAllDashboardMetabase(@Body() body) {
console.log(`/catalog`, 'ON GET ALL DASHBOARDS METABASE ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.getAllDashboardMetabase(body);
return res;
}
@Get('dashboard-metabase/:id')
async getOneDashboardMetabase(@Body() body, @Param() params) {
const { id } = params;
console.log(`/catalog`, 'ON GET ONE DASHBOARD METABASE ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.getOneDashboardMetabase(id, body);
return res;
}
@Get('table-metadata')
async getAllTableMetadata(@Body() body, @Query() query) {
console.log(`/catalog`, 'ON GET ALL TABLES METADATA ROUTE');
const catalogService = new CatalogService();
if (!query) {
const res = await catalogService.getAllTableMetadata(body);
return res;
} else {
const res = await catalogService.getOneTableMetadata(body, query);
return res;
}
}
@Delete('table-metadata/:id')
async deleteOneTableMetadata(@Param() params, @Body() body) {
const { id } = params;
console.log(`/catalog`, 'ON DELETE ONE TABLE METADATA ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.deleteOneTableMetadata(id, body);
return res;
}
@Get('column-metadata')
async getOneColumnMetadata(@Body() body, @Query() params) {
console.log(`/catalog`, 'ON GET ONE COLUMN METADATA ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.getOneColumnMetadata(body, params);
return res;
}
@Delete('column-metadata/:id')
async deleteOneColumnMetadata(@Param() params, @Body() body) {
console.log(`/catalog`, 'ON DELETE ONE COLUMN METADATA ROUTE');
const { id } = params;
const catalogService = new CatalogService();
const res = await catalogService.deleteOneColumnMetadata(id, body);
return res;
}
@Get('data-preview')
async getOneDataPreview(@Body() body, @Query() params) {
console.log(`/catalog`, 'ON GET ONE DATAPREVIEW ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.getOneDataPreview(body, params);
return res;
}
@Get('data-status')
async getDataStatus(@Body() body) {
console.log(`/catalog`, 'ON GET DATA STATUS ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.getDataStatus(body);
return res;
}
@Get('data-description')
async getDataDescription(@Body() body) {
console.log(`/catalog`, 'ON GET DATA DESCRIPTION ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.getDataDescription(body);
return res;
}
@Get('data-docs')
async getDataDocs(@Body() body) {
console.log(`/catalog`, 'ON GET DATA DOCS ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.getDataDocs(body);
return res;
}
@Get('data-rating')
async getDataRating(@Body() body) {
console.log(`/catalog`, 'ON GET DATA RATING ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.getDataRating(body);
return res;
}
@Post('data-rating')
async createDataRating(@Body() body) {
console.log(`/catalog`, 'ON GET DATA RATING ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.createDataRating(body);
return res;
}
@Get('summary-rating/:id')
async getSummaryRating(@Param() params, @Body() body) {
console.log(`/catalog`, 'ON GET SUMMARY RATING ROUTE');
const { id } = params;
const catalogService = new CatalogService();
const res = await catalogService.getSummaryRating(id, body);
return res;
}
@Get('data-comment')
async getDataComment(@Body() body) {
console.log(`/catalog`, 'ON GET DATA COMMENT ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.getDataComment(body);
return res;
}
@Post('data-comment')
async createDataComment(@Body() body) {
console.log(`/catalog`, 'ON GET DATA COMMENT ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.createDataComment(body);
return res;
}
@Get('data-review')
async getDataReview(@Body() body, @Query() params) {
console.log(`/catalog`, 'ON GET DATA REVIEW ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.getDataReview(body, params);
return res;
}
@Post('tags')
async createTags(@Body() body) {
console.log(`/catalog`, 'ON CREATE TAG ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.createTags(body);
return res;
}
@Get('tags')
async findAllTags(@Body() body) {
console.log(`/catalog`, 'ON FIND ALL TAGS ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.findAllTags(body);
return res;
}
@Delete('tags/:id')
async deleteTags(@Param() params, @Body() body) {
console.log(`/catalog`, 'ON DELETE TAG ROUTE');
const { id } = params;
const catalogService = new CatalogService();
const res = await catalogService.deleteTags(id, body);
return res;
}
@Post('table-tags')
async createTableTags(@Body() body) {
console.log(`/catalog`, 'ON CREATE TABLE TAG ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.createTableTags(body);
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/:id')
async deleteTableTags(@Param() params, @Body() body) {
console.log(`/catalog`, 'ON CREATE TABLE TAGS ROUTE');
const { id } = params;
const catalogService = new CatalogService();
const res = await catalogService.deleteTableTags(id, body);
return res;
}
@Get('table-rules')
async getTableRules(@Body() body) {
console.log(`/catalog`, 'ON GET TABLE RULES ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.getTableRules(body);
return res;
}
@Delete('table-rules/:id')
async deleteTableRules(@Param() params, @Body() body) {
console.log(`/catalog`, 'ON DELETE TABLE RULES ROUTE');
const { id } = params;
const catalogService = new CatalogService();
const res = await catalogService.deleteTableRules(id, body);
return res;
}
}
+358
View File
@@ -0,0 +1,358 @@
import axios from 'axios';
class CatalogService {
async catalogAll(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/all/`,
);
console.log(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/all/`,
);
return data;
}
async dataAppsAll(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/data_apps/`,
);
return data;
}
async dataAppsOne(id, body) {
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.delete(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/data_apps/${id}/`,
);
return data;
}
async getAllDashboardMetabase(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/dashboard-metabase/`,
);
return data;
}
async getOneDashboardMetabase(id, 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/dashboard-metabase/${id}`,
);
const [, path] = data.iframe_url.split('.dadosfera');
const host = `https://metabase-${body.info.customer.toLowerCase()}.dadosfera.ai`;
data.iframe_url = host + path;
return data;
}
async getAllTableMetadata(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-metadata/`,
);
return data;
}
async getOneTableMetadata(body, params) {
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-metadata/`,
{ params: params },
);
return data;
}
async deleteOneTableMetadata(id, body) {
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.delete(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/table-metadata/${id}`,
);
return data;
}
async getOneColumnMetadata(body, params) {
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/column-metadata/`,
{ params: params },
);
return data;
}
async deleteOneColumnMetadata(id, body) {
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.delete(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/column-metadata/${id}/`,
);
return data;
}
async getOneDataPreview(body, params) {
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/data-preview/`,
{ params: params },
);
return data;
}
async getDataStatus(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/data-status/`,
);
return data;
}
async getDataDescription(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/data-description/`,
);
return data;
}
async getDataDocs(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/data-docs/`,
);
return data;
}
async getDataRating(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/data-rating/`,
);
return data;
}
async createDataRating(body) {
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.post(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/data-rating/`,
body,
);
return data;
}
async getSummaryRating(id, 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/summary-rating/${id}`,
);
return data;
}
async getDataComment(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/data-comment/`,
);
return data;
}
async createDataComment(body) {
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.post(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/data-comment/`,
body,
);
return data;
}
async getDataReview(body, params) {
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/data-review/`,
{ params: params },
);
return data;
}
async createTags(body) {
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.post(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/tags/`,
body,
);
return data;
}
async findAllTags(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/tags/`,
body,
);
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'
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.delete(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/tags/${id}`,
);
return data;
}
async createTableTags(body) {
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.post(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/table-tags/`,
body,
);
return data;
}
async deleteTableTags(id, body) {
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.delete(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/table-tags/${id}`,
);
return data;
}
async getTableRules(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-rules/`,
body,
);
return data;
}
async deleteTableRules(id, body) {
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.delete(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/table-rules/${id}`,
);
return data;
}
}
export { CatalogService };
+16 -5
View File
@@ -9,10 +9,8 @@ import {
} from '@nestjs/common';
import { InputsService } from './inputs.service';
import { InputsClientService } from 'src/clients/inputs/client.service';
import {
ICreateInputRequest,
UpdateInputRequest,
} from 'src/clients/inputs/interfaces';
import { UpdateInputRequest } from 'src/clients/inputs/interfaces';
import { InputNewCreateRequest } from '@victorradael/protospack';
@Controller('inputs')
export class InputsController {
@@ -28,8 +26,21 @@ export class InputsController {
return response;
}
@Post('/test-connection/get-columns')
async getColumns(@Body() data) {
console.log(
`/test-connection/get-columns`,
'ON TEST CONNECTION GET COLUMNS ROUTE',
);
const inputService = new InputsService(this.inputsClientService);
const response = await inputService.getColumns(data);
return response;
}
@Post()
async create(@Body() createInputDto: ICreateInputRequest) {
async create(@Body() createInputDto: InputNewCreateRequest) {
console.log(`/input`, 'ON CREATE ROUTE');
const inputService = new InputsService(this.inputsClientService);
+14 -6
View File
@@ -1,16 +1,13 @@
import { Body, HttpException, HttpStatus, Injectable } from '@nestjs/common';
import { InputNewCreateRequest } from '@victorradael/protospack';
import { InputsClientService } from 'src/clients/inputs/client.service';
import {
ICreateInputRequest,
IIdRequest,
Info,
} from 'src/clients/inputs/interfaces';
import { IIdRequest, Info } from 'src/clients/inputs/interfaces';
@Injectable()
export class InputsService {
constructor(private inputClient: InputsClientService) {}
async create(@Body() data: ICreateInputRequest) {
async create(@Body() data: InputNewCreateRequest) {
try {
const createInputResponse = await this.inputClient.create(data);
@@ -74,4 +71,15 @@ export class InputsService {
throw new HttpException(err.message, HttpStatus.NOT_FOUND);
}
}
async getColumns(data) {
try {
const testConnectionGetColumnsResponse =
await this.inputClient.getColumns(data);
return testConnectionGetColumnsResponse;
} catch (err) {
throw new HttpException(err.message, HttpStatus.NOT_FOUND);
}
}
}
+21 -3
View File
@@ -14,16 +14,34 @@ import { PipelinesService } from './pipelines.service';
export class PipelinesController {
constructor(private pipelinesClientService: PipelinesClientService) {}
@Get(':id/status')
async getPipelineStatus(@Param() params) {
@Post('start/:id')
async activate(@Param() params, @Body() body) {
const { id } = params;
const { info } = body;
console.log(
process.env.DEV_URL + `/pipeline/start/${id}`,
'ON START PIPELINE ROUTE',
);
const pipelineService = new PipelinesService(this.pipelinesClientService);
const response = await pipelineService.runPipeline({ id, info });
return response;
}
@Get(':id/status')
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;
}
+15 -2
View File
@@ -74,14 +74,27 @@ 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) {
throw new HttpException(err.message, HttpStatus.NOT_FOUND);
}
}
async runPipeline({ id, info }: IIdRequest) {
try {
const triggerPipelineResponse = await this.pipelineClient.runPipeline({
id,
info,
});
return objectCamelToSnake(triggerPipelineResponse);
} catch (err) {
throw new HttpException(err.message, HttpStatus.NOT_FOUND);
}
}
}
@@ -11,15 +11,20 @@ export class TransformationsService {
constructor(private transformationClient: TransformationsClientService) {}
async create(createTransformationDto: ICreateTransformationsRequest) {
const { transformations, info } = createTransformationDto;
if (!transformations || transformations.length == 0) {
throw new HttpException('Missing transformations field.', 400);
}
try {
const convertedDTO = createTransformationDto.transformations.map((tr) => {
const convertedDTO = transformations.map((tr) => {
return trSnakeToCamel(tr);
});
const createTransformationResponse =
await this.transformationClient.create({
transformations: convertedDTO,
info: createTransformationDto.info,
info: info,
});
return createTransformationResponse;
+1 -1
View File
File diff suppressed because one or more lines are too long