mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-28 22:00:05 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43d181a429 | ||
|
|
a72fe1b60d | ||
|
|
b52a1227b1 | ||
|
|
31478ed61d | ||
|
|
79b1ba910e | ||
|
|
7fd929915b |
Generated
+7
-7
@@ -12,7 +12,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-secrets-manager": "^3.112.0",
|
"@aws-sdk/client-secrets-manager": "^3.112.0",
|
||||||
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
||||||
"@dadosfera/protospack-v2": "3.18.8",
|
"@dadosfera/protospack-v2": "3.18.10",
|
||||||
"@grpc/grpc-js": "^1.6.7",
|
"@grpc/grpc-js": "^1.6.7",
|
||||||
"@grpc/proto-loader": "^0.6.13",
|
"@grpc/proto-loader": "^0.6.13",
|
||||||
"@nestjs/common": "^8.4.7",
|
"@nestjs/common": "^8.4.7",
|
||||||
@@ -1726,9 +1726,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@dadosfera/protospack-v2": {
|
"node_modules/@dadosfera/protospack-v2": {
|
||||||
"version": "3.18.8",
|
"version": "3.18.10",
|
||||||
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.18.8.tgz",
|
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.18.10.tgz",
|
||||||
"integrity": "sha512-pzvuIzCrIf/ZG//lwMdCxtZ7w/ZhiLFBA3VWyN9uM7AjeqVl7LllHKV08Fw6YjNNGBmQF3DLJQTK8kMCQja4hA==",
|
"integrity": "sha512-0bRUvo4p7cJJOL+B0hVTiSDaA2MGtirPkFVQW4lUfzsyY5vrsbAkMz6R3iPdPPwFSxGn5LwidHGkP3/l7hlEpA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@grpc/grpc-js": "^1.6.7",
|
"@grpc/grpc-js": "^1.6.7",
|
||||||
"rxjs": "^7.5.5",
|
"rxjs": "^7.5.5",
|
||||||
@@ -12306,9 +12306,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@dadosfera/protospack-v2": {
|
"@dadosfera/protospack-v2": {
|
||||||
"version": "3.18.8",
|
"version": "3.18.10",
|
||||||
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.18.8.tgz",
|
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.18.10.tgz",
|
||||||
"integrity": "sha512-pzvuIzCrIf/ZG//lwMdCxtZ7w/ZhiLFBA3VWyN9uM7AjeqVl7LllHKV08Fw6YjNNGBmQF3DLJQTK8kMCQja4hA==",
|
"integrity": "sha512-0bRUvo4p7cJJOL+B0hVTiSDaA2MGtirPkFVQW4lUfzsyY5vrsbAkMz6R3iPdPPwFSxGn5LwidHGkP3/l7hlEpA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@grpc/grpc-js": "^1.6.7",
|
"@grpc/grpc-js": "^1.6.7",
|
||||||
"rxjs": "^7.5.5",
|
"rxjs": "^7.5.5",
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-secrets-manager": "^3.112.0",
|
"@aws-sdk/client-secrets-manager": "^3.112.0",
|
||||||
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
||||||
"@dadosfera/protospack-v2": "3.18.8",
|
"@dadosfera/protospack-v2": "3.18.10",
|
||||||
"@grpc/grpc-js": "^1.6.7",
|
"@grpc/grpc-js": "^1.6.7",
|
||||||
"@grpc/proto-loader": "^0.6.13",
|
"@grpc/proto-loader": "^0.6.13",
|
||||||
"@nestjs/common": "^8.4.7",
|
"@nestjs/common": "^8.4.7",
|
||||||
|
|||||||
@@ -71,27 +71,174 @@ export class ConnectorClientService implements OnModuleInit {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async uploadConnectorsFile(uploadFile) {
|
async uploadConnectorsFile(uploadFile: Express.Multer.File) {
|
||||||
const connectors = JSON.parse(uploadFile.file.buffer.toString('utf8'));
|
const res = await lastValueFrom(
|
||||||
|
this.connectorServiceWrite.RegisterMultipleConnectorsWithoutImage({
|
||||||
const body = connectors.map((connector) => {
|
connectors: uploadFile.buffer,
|
||||||
return JSON.stringify(connector);
|
}),
|
||||||
});
|
|
||||||
|
|
||||||
const request = {
|
|
||||||
connectors: body,
|
|
||||||
};
|
|
||||||
|
|
||||||
return lastValueFrom(
|
|
||||||
this.connectorServiceWrite.RegisterMultipleConnectorsWithoutImage(
|
|
||||||
request,
|
|
||||||
),
|
|
||||||
).catch((err) => {
|
).catch((err) => {
|
||||||
throw new HttpException(
|
throw new HttpException(
|
||||||
err.details,
|
err.details,
|
||||||
err.code === 6 ? HttpStatus.CONFLICT : 400,
|
err.code === 6 ? HttpStatus.CONFLICT : 400,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
const responseParsed = JSON.parse(res.message);
|
||||||
|
const connectorErrors = responseParsed.items
|
||||||
|
.filter((i) => i.update._index === 'connector' && i.update.error)
|
||||||
|
.map((i) => ({
|
||||||
|
id: i.update._id,
|
||||||
|
reason: i.update.error,
|
||||||
|
status: i.error.status,
|
||||||
|
}));
|
||||||
|
const connectionControlsErrors = responseParsed.items
|
||||||
|
.filter(
|
||||||
|
(i) => i.update._index === 'connection_controls' && i.update.error,
|
||||||
|
)
|
||||||
|
.map((i) => ({
|
||||||
|
id: i.update._id,
|
||||||
|
reason: i.update.error,
|
||||||
|
status: i.error.status,
|
||||||
|
}));
|
||||||
|
const connectionStepsErrors = responseParsed.items
|
||||||
|
.filter((i) => i.update._index === 'connection_steps' && i.update.error)
|
||||||
|
.map((i) => ({
|
||||||
|
id: i.update._id,
|
||||||
|
reason: i.update.error,
|
||||||
|
status: i.error.status,
|
||||||
|
}));
|
||||||
|
const configControlsErrors = responseParsed.items
|
||||||
|
.filter((i) => i.update._index === 'config_controls' && i.update.error)
|
||||||
|
.map((i) => ({
|
||||||
|
id: i.update._id,
|
||||||
|
reason: i.update.error,
|
||||||
|
status: i.error.status,
|
||||||
|
}));
|
||||||
|
const connectorCreated = responseParsed.items
|
||||||
|
.filter(
|
||||||
|
(i) => i.update._index === 'connector' && i.update.result === 'created',
|
||||||
|
)
|
||||||
|
.map((i) => ({
|
||||||
|
id: i.update._id,
|
||||||
|
}));
|
||||||
|
const connectionControlsCreated = responseParsed.items
|
||||||
|
.filter(
|
||||||
|
(i) =>
|
||||||
|
i.update._index === 'connection_controls' &&
|
||||||
|
i.update.result === 'created',
|
||||||
|
)
|
||||||
|
.map((i) => ({
|
||||||
|
id: i.update._id,
|
||||||
|
}));
|
||||||
|
const connectionStepsCreated = responseParsed.items
|
||||||
|
.filter(
|
||||||
|
(i) =>
|
||||||
|
i.update._index === 'connection_steps' &&
|
||||||
|
i.update.result === 'created',
|
||||||
|
)
|
||||||
|
.map((i) => ({
|
||||||
|
id: i.update._id,
|
||||||
|
}));
|
||||||
|
const configControlsCreated = responseParsed.items
|
||||||
|
.filter(
|
||||||
|
(i) =>
|
||||||
|
i.update._index === 'config_controls' &&
|
||||||
|
i.update.result === 'created',
|
||||||
|
)
|
||||||
|
.map((i) => ({
|
||||||
|
id: i.update._id,
|
||||||
|
}));
|
||||||
|
const connectorUpdated = responseParsed.items
|
||||||
|
.filter(
|
||||||
|
(i) => i.update._index === 'connector' && i.update.result === 'updated',
|
||||||
|
)
|
||||||
|
.map((i) => ({
|
||||||
|
id: i.update._id,
|
||||||
|
}));
|
||||||
|
const connectionControlsUpdated = responseParsed.items
|
||||||
|
.filter(
|
||||||
|
(i) =>
|
||||||
|
i.update._index === 'connection_controls' &&
|
||||||
|
i.update.result === 'updated',
|
||||||
|
)
|
||||||
|
.map((i) => ({
|
||||||
|
id: i.update._id,
|
||||||
|
}));
|
||||||
|
const connectionStepsUpdated = responseParsed.items
|
||||||
|
.filter(
|
||||||
|
(i) =>
|
||||||
|
i.update._index === 'connection_steps' &&
|
||||||
|
i.update.result === 'updated',
|
||||||
|
)
|
||||||
|
.map((i) => ({
|
||||||
|
id: i.update._id,
|
||||||
|
}));
|
||||||
|
const configControlsUpdated = responseParsed.items
|
||||||
|
.filter(
|
||||||
|
(i) =>
|
||||||
|
i.update._index === 'config_controls' &&
|
||||||
|
i.update.result === 'updated',
|
||||||
|
)
|
||||||
|
.map((i) => ({
|
||||||
|
id: i.update._id,
|
||||||
|
}));
|
||||||
|
const connectorNoop = responseParsed.items
|
||||||
|
.filter(
|
||||||
|
(i) => i.update._index === 'connector' && i.update.result === 'noop',
|
||||||
|
)
|
||||||
|
.map((i) => ({
|
||||||
|
id: i.update._id,
|
||||||
|
}));
|
||||||
|
const connectionControlsNoop = responseParsed.items
|
||||||
|
.filter(
|
||||||
|
(i) =>
|
||||||
|
i.update._index === 'connection_controls' &&
|
||||||
|
i.update.result === 'noop',
|
||||||
|
)
|
||||||
|
.map((i) => ({
|
||||||
|
id: i.update._id,
|
||||||
|
}));
|
||||||
|
const connectionStepsNoop = responseParsed.items
|
||||||
|
.filter(
|
||||||
|
(i) =>
|
||||||
|
i.update._index === 'connection_steps' && i.update.result === 'noop',
|
||||||
|
)
|
||||||
|
.map((i) => ({
|
||||||
|
id: i.update._id,
|
||||||
|
}));
|
||||||
|
const configControlsNoop = responseParsed.items
|
||||||
|
.filter(
|
||||||
|
(i) =>
|
||||||
|
i.update._index === 'config_controls' && i.update.result === 'noop',
|
||||||
|
)
|
||||||
|
.map((i) => ({
|
||||||
|
id: i.update._id,
|
||||||
|
}));
|
||||||
|
return {
|
||||||
|
errors: {
|
||||||
|
connectors: connectorErrors,
|
||||||
|
connection_controls: connectionControlsErrors,
|
||||||
|
connection_steps: connectionStepsErrors,
|
||||||
|
config_controls: configControlsErrors,
|
||||||
|
},
|
||||||
|
created: {
|
||||||
|
connectors: connectorCreated,
|
||||||
|
connection_controls: connectionControlsCreated,
|
||||||
|
connection_steps: connectionStepsCreated,
|
||||||
|
config_controls: configControlsCreated,
|
||||||
|
},
|
||||||
|
updated: {
|
||||||
|
connectors: connectorUpdated,
|
||||||
|
connection_controls: connectionControlsUpdated,
|
||||||
|
connection_steps: connectionStepsUpdated,
|
||||||
|
config_controls: configControlsUpdated,
|
||||||
|
},
|
||||||
|
noop: {
|
||||||
|
connectors: connectorNoop,
|
||||||
|
connection_controls: connectionControlsNoop,
|
||||||
|
connection_steps: connectionStepsNoop,
|
||||||
|
config_controls: configControlsNoop,
|
||||||
|
},
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAllConnectors(body) {
|
async getAllConnectors(body) {
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import { ApiBearerAuth, ApiConsumes, ApiTags } from '@nestjs/swagger';
|
|||||||
import { ConnectorClientService } from './client.service';
|
import { ConnectorClientService } from './client.service';
|
||||||
import { AddTagDto } from './dtos/add-tag';
|
import { AddTagDto } from './dtos/add-tag';
|
||||||
import { CreateConnectorDto } from './dtos/create-connector';
|
import { CreateConnectorDto } from './dtos/create-connector';
|
||||||
import { UploadConnectorsFileDto } from './dtos/create-multiple-connector';
|
|
||||||
import { DeleteConnectorDto } from './dtos/delete-connector';
|
import { DeleteConnectorDto } from './dtos/delete-connector';
|
||||||
import { GetAllDto } from './dtos/get-all';
|
import { GetAllDto } from './dtos/get-all';
|
||||||
import { RemoveTagDto } from './dtos/remove-tag';
|
import { RemoveTagDto } from './dtos/remove-tag';
|
||||||
@@ -85,14 +84,10 @@ export class ConnectorController {
|
|||||||
@RequireAllPermissions(PERMISSIONS_GROUPS.CONNECTORS.permissions.CREATE)
|
@RequireAllPermissions(PERMISSIONS_GROUPS.CONNECTORS.permissions.CREATE)
|
||||||
@ApiConsumes('multipart/form-data')
|
@ApiConsumes('multipart/form-data')
|
||||||
@UseInterceptors(FileInterceptor('file'))
|
@UseInterceptors(FileInterceptor('file'))
|
||||||
async uploadConnectorsFile(@UploadedFile() file: UploadConnectorsFileDto) {
|
async uploadConnectorsFile(@UploadedFile() file: Express.Multer.File) {
|
||||||
this.logger.info(`/upload`, 'Upload Connector Route');
|
this.logger.info(`/upload`, 'Upload Connector Route');
|
||||||
|
|
||||||
const response = await this.connectorClientService.uploadConnectorsFile({
|
return await this.connectorClientService.uploadConnectorsFile(file);
|
||||||
file,
|
|
||||||
});
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
|||||||
@@ -103,14 +103,9 @@ export class PipelinesController {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const response = await this.pipelinesClientService.findAll(data, metadata);
|
const response = await this.pipelinesClientService.findAll(data, metadata);
|
||||||
const oldResponse = await this.oldPipelinesService.findAll({
|
|
||||||
customer_name,
|
|
||||||
user_id,
|
|
||||||
customer_id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
pipelines: [...response.pipelines, ...oldResponse.pipelines],
|
pipelines: [...response.pipelines],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,13 +144,6 @@ export class PipelinesController {
|
|||||||
: {},
|
: {},
|
||||||
});
|
});
|
||||||
return res;
|
return res;
|
||||||
})
|
|
||||||
.catch(async (err) => {
|
|
||||||
this.logger.error(err);
|
|
||||||
return await this.oldPipelinesService.findOne({
|
|
||||||
id,
|
|
||||||
info: { customer_id, customer: customer_name, user_id },
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user