diff --git a/.npmrc b/.npmrc deleted file mode 100644 index bd3327a..0000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -//registry.npmjs.org/:_authToken=${NPM_TOKEN} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 6f073d4..a7b9287 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,9 +3,12 @@ WORKDIR /packages ARG NPM_TOKEN COPY package.json . COPY package-lock.json . -COPY .npmrc . + +RUN apk update +RUN apk add --no-cache aws-cli +RUN aws codeartifact login --tool npm --repository dadosfera-npm --domain dadosfera --domain-owner 611330257153 --region us-east-1 + RUN npm install -RUN rm -f ./.npmrc FROM node:14.15.4-alpine3.12 WORKDIR /app diff --git a/package-lock.json b/package-lock.json index 75ef80e..4d4ae77 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,8 +21,6 @@ "@nestjs/platform-express": "^8.4.7", "@nestjs/schedule": "^1.1.0", "@nestjs/swagger": "^5.2.1", - "@victorradael/protospack": "2.5.0", - "@victorradael/protospack-v2": "1.1.1", "axios": "^0.25.0", "cron-parser": "^4.4.0", "dotenv": "^14.3.2", @@ -35,6 +33,8 @@ "passport-google-oauth20": "^2.0.0", "passport-hubspot-oauth2": "^1.0.3", "passport-mailchimp": "^1.1.0", + "protospack": "2.5.2", + "protospack-v2": "2.6.3", "reflect-metadata": "^0.1.13", "rimraf": "^3.0.2", "rxjs": "^7.5.5", @@ -3364,23 +3364,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@victorradael/protospack": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@victorradael/protospack/-/protospack-2.5.0.tgz", - "integrity": "sha512-DORlm3uHAYVH9dlcmwyOxjA4rk1UZWFyYUpD02k0bFfrH+uzSWe8qiPtTgZym9P8U9D8bXYRWeLlroasBj2Rdw==", - "dependencies": { - "rxjs": "^7.5.5" - } - }, - "node_modules/@victorradael/protospack-v2": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@victorradael/protospack-v2/-/protospack-v2-1.1.1.tgz", - "integrity": "sha512-K9SuHcCGa7wynbzTG1aVnODksajTKfr9+tDHw6qfFfPwBruJXv5HsbMMylizAg+HTgEr/D6h/L1PO05rygDJCw==", - "dependencies": { - "rxjs": "^7.5.5", - "ts-proto": "^1.112.2" - } - }, "node_modules/@webassemblyjs/ast": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz", @@ -5747,20 +5730,6 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -8604,6 +8573,23 @@ "pbts": "bin/pbts" } }, + "node_modules/protospack": { + "version": "2.5.2", + "resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/protospack/-/protospack-2.5.2.tgz", + "integrity": "sha512-t7NyWE4WDuAVixjL10SDUXHu8iW4H0azndTC3n/w335D/IodPgN47ebm3iMXbvoQTlQcCbjjc+HblaRa9oR8bA==", + "dependencies": { + "rxjs": "^7.5.5" + } + }, + "node_modules/protospack-v2": { + "version": "2.6.3", + "resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/protospack-v2/-/protospack-v2-2.6.3.tgz", + "integrity": "sha512-9mIEON2bUAVKoIysODlmaJqEjBhpN/exUyTM9snZBqO4ajB2yLIyAv1MTRB8ZepH7k9ZHKx8afrTJoLadz20pQ==", + "dependencies": { + "rxjs": "^7.5.5", + "ts-proto": "^1.112.2" + } + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -13040,23 +13026,6 @@ "eslint-visitor-keys": "^3.3.0" } }, - "@victorradael/protospack": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@victorradael/protospack/-/protospack-2.5.0.tgz", - "integrity": "sha512-DORlm3uHAYVH9dlcmwyOxjA4rk1UZWFyYUpD02k0bFfrH+uzSWe8qiPtTgZym9P8U9D8bXYRWeLlroasBj2Rdw==", - "requires": { - "rxjs": "^7.5.5" - } - }, - "@victorradael/protospack-v2": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@victorradael/protospack-v2/-/protospack-v2-1.1.1.tgz", - "integrity": "sha512-K9SuHcCGa7wynbzTG1aVnODksajTKfr9+tDHw6qfFfPwBruJXv5HsbMMylizAg+HTgEr/D6h/L1PO05rygDJCw==", - "requires": { - "rxjs": "^7.5.5", - "ts-proto": "^1.112.2" - } - }, "@webassemblyjs/ast": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz", @@ -14894,13 +14863,6 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "optional": true - }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -17055,6 +17017,23 @@ "long": "^4.0.0" } }, + "protospack": { + "version": "2.5.2", + "resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/protospack/-/protospack-2.5.2.tgz", + "integrity": "sha512-t7NyWE4WDuAVixjL10SDUXHu8iW4H0azndTC3n/w335D/IodPgN47ebm3iMXbvoQTlQcCbjjc+HblaRa9oR8bA==", + "requires": { + "rxjs": "^7.5.5" + } + }, + "protospack-v2": { + "version": "2.6.3", + "resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/protospack-v2/-/protospack-v2-2.6.3.tgz", + "integrity": "sha512-9mIEON2bUAVKoIysODlmaJqEjBhpN/exUyTM9snZBqO4ajB2yLIyAv1MTRB8ZepH7k9ZHKx8afrTJoLadz20pQ==", + "requires": { + "rxjs": "^7.5.5", + "ts-proto": "^1.112.2" + } + }, "proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", diff --git a/package.json b/package.json index 20d1b49..e0a8574 100644 --- a/package.json +++ b/package.json @@ -36,8 +36,8 @@ "@nestjs/platform-express": "^8.4.7", "@nestjs/schedule": "^1.1.0", "@nestjs/swagger": "^5.2.1", - "@victorradael/protospack": "2.5.0", - "@victorradael/protospack-v2": "1.1.1", + "protospack": "2.5.2", + "protospack-v2": "2.6.3", "axios": "^0.25.0", "cron-parser": "^4.4.0", "dotenv": "^14.3.2", diff --git a/src/clients/auth/client.service.ts b/src/clients/auth/client.service.ts index 15a1faa..9ffd148 100644 --- a/src/clients/auth/client.service.ts +++ b/src/clients/auth/client.service.ts @@ -1,8 +1,8 @@ import { Logger, OnModuleInit, Inject } from '@nestjs/common'; import { ClientGrpc } from '@nestjs/microservices'; -import { ProtoServices } from '@victorradael/protospack-v2/dist/lib/Duc'; -import { AuthProtoService as AuthServiceInterface } from '@victorradael/protospack-v2/dist/lib/Duc/interfaces/write-service'; +import { ProtoServices } from 'protospack-v2/dist/lib/Duc'; +import { AuthProtoService as AuthServiceInterface } from 'protospack-v2/dist/lib/Duc/interfaces/write-service'; import { AuthGetPublicKeysResponse, AuthSignInRequest, @@ -25,7 +25,7 @@ import { AuthVerifyResetPasswordCodeResponse, AuthConfirmResetPasswordRequest, AuthConfirmResetPasswordResponse, -} from '@victorradael/protospack-v2/dist/lib/Duc/interfaces/messages'; +} from 'protospack-v2/dist/lib/Duc/interfaces/messages'; import grpcHandler from '../../utils/grpcHandler'; diff --git a/src/clients/connector/client.config.ts b/src/clients/connector/client.config.ts index 61db9a1..a22a9c8 100644 --- a/src/clients/connector/client.config.ts +++ b/src/clients/connector/client.config.ts @@ -1,6 +1,6 @@ import { credentials } from '@grpc/grpc-js'; import { ClientOptions, Transport } from '@nestjs/microservices'; -import { ConnectorManager } from '@victorradael/protospack-v2'; +import { ConnectorManager } from 'protospack-v2'; export class ConnectorClientConfiguration { config(): ClientOptions { diff --git a/src/clients/connector/client.service.ts b/src/clients/connector/client.service.ts index e9b4ed1..2a3793b 100644 --- a/src/clients/connector/client.service.ts +++ b/src/clients/connector/client.service.ts @@ -5,7 +5,7 @@ import { HttpStatus, } from '@nestjs/common'; import { ClientGrpc } from '@nestjs/microservices'; -import { ConnectorManager } from '@victorradael/protospack-v2'; +import { ConnectorManager } from 'protospack-v2'; import { from } from 'rxjs'; export class ConnectorClientService implements OnModuleInit { @@ -200,6 +200,33 @@ export class ConnectorClientService implements OnModuleInit { return result; } + async getConnectorsTags() { + const observable = from(this.connectorServiceRead.GetConnectorsTags({})); + const result = await new Promise((resolve, reject) => { + observable.subscribe({ + next(x) { + resolve(x); + }, + error(err) { + console.log('Observable Error'); + reject(err); + }, + complete() { + console.log('done'); + }, + }); + }).catch((err) => { + throw new HttpException( + err.details, + err.code === 6 ? HttpStatus.CONFLICT : 400, + ); + }); + + console.log('ConnectorClientService', 'getAllConnectors'); + + return result; + } + async deleteConnector(plugin: string, version: string) { const observable = from( this.connectorServiceWrite.DeleteConnector({ diff --git a/src/clients/duc/client.config.ts b/src/clients/duc/client.config.ts index e1f5de6..f3384f3 100644 --- a/src/clients/duc/client.config.ts +++ b/src/clients/duc/client.config.ts @@ -1,9 +1,6 @@ import { credentials } from '@grpc/grpc-js'; import { ClientOptions, Transport } from '@nestjs/microservices'; -import { - ProtoPackages, - ProtoPaths, -} from '@victorradael/protospack-v2/dist/lib/Duc'; +import { ProtoPackages, ProtoPaths } from 'protospack-v2/dist/lib/Duc'; export class DucClient { config(): ClientOptions { @@ -12,9 +9,10 @@ export class DucClient { options: { url: process.env.DUC_URL, package: ProtoPackages.WritePackage, - credentials: process.env.LOCAL_ENV - ? undefined - : credentials.createSsl(), + credentials: + process.env.LOCAL_ENV === 'local' + ? undefined + : credentials.createSsl(), protoPath: ProtoPaths.WriteFilePath, loader: { keepCase: true, diff --git a/src/clients/inputs/client.config.ts b/src/clients/inputs/client.config.ts index 06c6340..525b5eb 100644 --- a/src/clients/inputs/client.config.ts +++ b/src/clients/inputs/client.config.ts @@ -1,7 +1,7 @@ import { credentials } from '@grpc/grpc-js'; import { ClientOptions, Transport } from '@nestjs/microservices'; -import { InputPackages, InputProtoFilePath } from '@victorradael/protospack'; +import { InputPackages, InputProtoFilePath } from 'protospack'; export class InputsClientConfiguration { config(): ClientOptions { diff --git a/src/clients/inputs/client.service.ts b/src/clients/inputs/client.service.ts index 88582c8..4777d24 100644 --- a/src/clients/inputs/client.service.ts +++ b/src/clients/inputs/client.service.ts @@ -15,7 +15,7 @@ import { InputService, TestConnectionGetColumnsRequest, TestConnectionRequest, -} from '@victorradael/protospack'; +} from 'protospack'; import axios, { AxiosRequestConfig } from 'axios'; import { lastValueFrom } from 'rxjs'; import { InputModel } from 'src/modules/inputs/dtos/input.model'; diff --git a/src/clients/outputs/client.config.ts b/src/clients/outputs/client.config.ts index a9a5bc0..3fac08f 100644 --- a/src/clients/outputs/client.config.ts +++ b/src/clients/outputs/client.config.ts @@ -1,4 +1,4 @@ -import { OutputPackages, OutputProtoFilePath } from '@victorradael/protospack'; +import { OutputPackages, OutputProtoFilePath } from 'protospack'; import { ClientOptions, Transport } from '@nestjs/microservices'; import { credentials } from '@grpc/grpc-js'; diff --git a/src/clients/outputs/client.service.ts b/src/clients/outputs/client.service.ts index c05663f..9c09f83 100644 --- a/src/clients/outputs/client.service.ts +++ b/src/clients/outputs/client.service.ts @@ -3,7 +3,7 @@ import { ClientGrpc, Payload } from '@nestjs/microservices'; import { OutputServicesNames, OutputsServiceInterface, -} from '@victorradael/protospack'; +} from 'protospack'; import { objectCamelToSnake, objectSnakeToCamel, diff --git a/src/clients/permissions/client.service.ts b/src/clients/permissions/client.service.ts index 7e9236b..1912cbf 100644 --- a/src/clients/permissions/client.service.ts +++ b/src/clients/permissions/client.service.ts @@ -1,12 +1,12 @@ import { Logger, OnModuleInit, Inject } from '@nestjs/common'; import { ClientGrpc } from '@nestjs/microservices'; -import { ProtoServices } from '@victorradael/protospack-v2/dist/lib/Duc'; -import { PermissionsProtoService as PermissionsServiceInterface } from '@victorradael/protospack-v2/dist/lib/Duc/interfaces/write-service'; +import { ProtoServices } from 'protospack-v2/dist/lib/Duc'; +import { PermissionsProtoService as PermissionsServiceInterface } from 'protospack-v2/dist/lib/Duc/interfaces/write-service'; import { Empty, InjectPermissionsRequest, -} from '@victorradael/protospack-v2/dist/lib/Duc/interfaces/messages'; +} from 'protospack-v2/dist/lib/Duc/interfaces/messages'; import grpcHandler from '../../utils/grpcHandler'; diff --git a/src/clients/pipelines/client.config.ts b/src/clients/pipelines/client.config.ts index 21d9a9e..01083eb 100644 --- a/src/clients/pipelines/client.config.ts +++ b/src/clients/pipelines/client.config.ts @@ -2,7 +2,7 @@ import { ClientOptions, Transport } from '@nestjs/microservices'; import { PipelinePackages, PipelineProtoFilePath, -} from '@victorradael/protospack'; +} from 'protospack'; import { credentials } from '@grpc/grpc-js'; export class PipelinesClientConfiguration { diff --git a/src/clients/pipelines/client.service.ts b/src/clients/pipelines/client.service.ts index b10af2f..f65c2a4 100644 --- a/src/clients/pipelines/client.service.ts +++ b/src/clients/pipelines/client.service.ts @@ -8,7 +8,7 @@ import { ClientGrpc, Payload } from '@nestjs/microservices'; import { PipelineServicesNames, PipelinesServiceInterface, -} from '@victorradael/protospack'; +} from 'protospack'; import { lastValueFrom } from 'rxjs'; import { objectCamelToSnake, diff --git a/src/clients/transformations/client.config.ts b/src/clients/transformations/client.config.ts index 461e6a9..26c52f1 100644 --- a/src/clients/transformations/client.config.ts +++ b/src/clients/transformations/client.config.ts @@ -2,7 +2,7 @@ import { ClientOptions, Transport } from '@nestjs/microservices'; import { TransformationPackages, TransformationProtoFilePath, -} from '@victorradael/protospack'; +} from 'protospack'; import { credentials } from '@grpc/grpc-js'; export class TransformationsClientConfiguration { diff --git a/src/clients/transformations/client.service.ts b/src/clients/transformations/client.service.ts index 9c5c9cc..2d62550 100644 --- a/src/clients/transformations/client.service.ts +++ b/src/clients/transformations/client.service.ts @@ -1,6 +1,6 @@ import { Controller, Inject, OnModuleInit, Post } from '@nestjs/common'; import { ClientGrpc } from '@nestjs/microservices'; -import { TransformationsServiceInterface } from '@victorradael/protospack'; +import { TransformationsServiceInterface } from 'protospack'; import { objectCamelToSnake, objectSnakeToCamel, diff --git a/src/modules/auth/auth.controller.ts b/src/modules/auth/auth.controller.ts index 97e1794..4895391 100644 --- a/src/modules/auth/auth.controller.ts +++ b/src/modules/auth/auth.controller.ts @@ -19,7 +19,7 @@ import { AuthEnableTotpMfaRequest, AuthDisableTotpMfaRequest, AuthVerifyTotpMfaRequest, -} from '@victorradael/protospack-v2/dist/lib/Duc/interfaces/messages'; +} from 'protospack-v2/dist/lib/Duc/interfaces/messages'; import { AuthClientService } from '../../clients/auth/client.service'; import { PermissionsClientService } from '../../clients/permissions/client.service'; diff --git a/src/modules/connector/connector.controller.ts b/src/modules/connector/connector.controller.ts index 4b8f8ad..a9566ee 100644 --- a/src/modules/connector/connector.controller.ts +++ b/src/modules/connector/connector.controller.ts @@ -78,6 +78,11 @@ export class ConnectorController { }; } + @Get('/tags') + async getConnectorsTags() { + return await this.connectorClientService.getConnectorsTags(); + } + @Get('/:plugin') async getConnector( @Param('plugin') plugin: string, diff --git a/src/modules/inputs/inputs.service.ts b/src/modules/inputs/inputs.service.ts index a7c3715..56f548f 100644 --- a/src/modules/inputs/inputs.service.ts +++ b/src/modules/inputs/inputs.service.ts @@ -1,6 +1,6 @@ import { Body, HttpException, HttpStatus, Injectable } from '@nestjs/common'; import { Timeout } from '@nestjs/schedule'; -import { DecodeGrpcStruct } from '@victorradael/protospack'; +import { DecodeGrpcStruct } from 'protospack'; import CronParser, { CronExpression } from 'cron-parser'; import { InputsClientService } from 'src/clients/inputs/client.service'; import { IIdRequest, Info } from 'src/clients/inputs/interfaces'; diff --git a/src/modules/pipelines/pipelines.service.ts b/src/modules/pipelines/pipelines.service.ts index 416ae97..2ed3c3a 100644 --- a/src/modules/pipelines/pipelines.service.ts +++ b/src/modules/pipelines/pipelines.service.ts @@ -1,5 +1,5 @@ import { HttpException, HttpStatus, Injectable } from '@nestjs/common'; -import { DecodeGrpcStruct } from '@victorradael/protospack'; +import { DecodeGrpcStruct } from 'protospack'; import { PipelinesClientService } from 'src/clients/pipelines/client.service'; import { IIdRequest, Info } from 'src/clients/pipelines/interfaces'; import { objectCamelToSnake } from 'src/utils/CaseConverter';