mirror of
https://github.com/dadosfera/maestro.git
synced 2026-10-27 17:49:07 +00:00
Compare commits
29
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8eb7fd0169 | ||
|
|
8a9d6c2f9c | ||
|
|
2e181e70af | ||
|
|
ef615adb8e | ||
|
|
e03900811b | ||
|
|
5bc5fb0977 | ||
|
|
011032e3d4 | ||
|
|
17363e74f4 | ||
|
|
63efff6adf | ||
|
|
b5f569e522 | ||
|
|
5c77577992 | ||
|
|
4b9e113185 | ||
|
|
06d505c50a | ||
|
|
c70abfc826 | ||
|
|
db2c7d6c02 | ||
|
|
0a99ce1aa4 | ||
|
|
39c66f030a | ||
|
|
1223e21ac4 | ||
|
|
2177f6725c | ||
|
|
e8b982998f | ||
|
|
ccd4159c59 | ||
|
|
9e49abb40d | ||
|
|
21a82b64f3 | ||
|
|
2414fcf21e | ||
|
|
94fbdb2226 | ||
|
|
985170d7ae | ||
|
|
b38b8f51e2 | ||
|
|
ea16e62d6b | ||
|
|
6182705410 |
@@ -71,6 +71,11 @@ jobs:
|
|||||||
sudo mv helmfile /usr/local/bin/
|
sudo mv helmfile /usr/local/bin/
|
||||||
helmfile --version
|
helmfile --version
|
||||||
|
|
||||||
|
- name: Install Helm Diff plugin
|
||||||
|
run: |
|
||||||
|
helm plugin install https://github.com/databus23/helm-diff --version v3.9.3
|
||||||
|
helm diff version
|
||||||
|
|
||||||
- name: Debug Helm env
|
- name: Debug Helm env
|
||||||
run: |
|
run: |
|
||||||
helm env
|
helm env
|
||||||
@@ -102,4 +107,5 @@ jobs:
|
|||||||
- name: Run Helmfile Diff
|
- name: Run Helmfile Diff
|
||||||
env:
|
env:
|
||||||
ENV: ${{ needs.extract_environment.outputs.environment }}
|
ENV: ${{ needs.extract_environment.outputs.environment }}
|
||||||
|
HELM_PLUGINS: /home/runner/.local/share/helm/plugins
|
||||||
run: helmfile -f deploy/helmfiles/${ENV}.yaml diff
|
run: helmfile -f deploy/helmfiles/${ENV}.yaml diff
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
FROM node:20-alpine AS base_image
|
FROM node:20-alpine AS base_image
|
||||||
RUN npm install -g npm@latest
|
RUN npm install -g npm@10.8.2
|
||||||
|
|
||||||
FROM base_image AS build_base
|
FROM base_image AS build_base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
+174
-90
@@ -3343,14 +3343,7 @@
|
|||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "",
|
"description": ""
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"type": "object"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tags": [
|
"tags": [
|
||||||
@@ -3647,6 +3640,46 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/pipelinesV2/{id}/upgrade": {
|
||||||
|
"patch": {
|
||||||
|
"operationId": "PipelinesController_upgradeConnector",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "dadosfera-lang",
|
||||||
|
"in": "header",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"enum": [
|
||||||
|
"pt-br",
|
||||||
|
"en-us"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"required": true,
|
||||||
|
"in": "path",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"204": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"PipelinesV2"
|
||||||
|
],
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"access-token": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"/pipelinesV2/init-upload": {
|
"/pipelinesV2/init-upload": {
|
||||||
"post": {
|
"post": {
|
||||||
"operationId": "PipelinesController_initUploadFile",
|
"operationId": "PipelinesController_initUploadFile",
|
||||||
@@ -3834,88 +3867,6 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/pipelines/start/{id}": {
|
|
||||||
"post": {
|
|
||||||
"operationId": "PipelinesController_activate",
|
|
||||||
"summary": "",
|
|
||||||
"deprecated": true,
|
|
||||||
"description": "This method is deprecated. Please use route /pipelinesV2/start/:id instead",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"required": true,
|
|
||||||
"in": "path",
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"201": {
|
|
||||||
"description": "",
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"type": "object"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tags": [
|
|
||||||
"Pipelines"
|
|
||||||
],
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"access-token": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"access-token": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/pipelines/{id}/status": {
|
|
||||||
"get": {
|
|
||||||
"operationId": "PipelinesController_getPipelineStatus",
|
|
||||||
"summary": "",
|
|
||||||
"deprecated": true,
|
|
||||||
"description": "This method is deprecated. Please use route /pipelinesV2/:id/status instead",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"required": true,
|
|
||||||
"in": "path",
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "",
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"type": "object"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tags": [
|
|
||||||
"Pipelines"
|
|
||||||
],
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"access-token": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"access-token": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/transformations": {
|
"/transformations": {
|
||||||
"post": {
|
"post": {
|
||||||
"operationId": "TransformationsController_create",
|
"operationId": "TransformationsController_create",
|
||||||
@@ -4619,6 +4570,62 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/platform/pipelines/{pipelineId}/pipeline_run/{runId}/jobs": {
|
||||||
|
"get": {
|
||||||
|
"operationId": "PlatformApiController_getPipelineRunJobs",
|
||||||
|
"summary": "Get pipeline run jobs",
|
||||||
|
"description": "Proxies platform-api DB-backed job runs and returns `{ jobs: [...] }`.",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "pipelineId",
|
||||||
|
"required": true,
|
||||||
|
"in": "path",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "runId",
|
||||||
|
"required": true,
|
||||||
|
"in": "path",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "DB-backed job runs for the selected pipeline run.",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"jobs": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"jobs"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"Platform API"
|
||||||
|
],
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"access-token": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"/platform/jobs/{jobId}/input": {
|
"/platform/jobs/{jobId}/input": {
|
||||||
"put": {
|
"put": {
|
||||||
"operationId": "PlatformApiController_updateJobInput",
|
"operationId": "PlatformApiController_updateJobInput",
|
||||||
@@ -5945,6 +5952,66 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/catalog/data-asset/{id}/certification-status": {
|
||||||
|
"put": {
|
||||||
|
"operationId": "CatalogController_updateDataAssetCertificationStatus",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "dadosfera-lang",
|
||||||
|
"in": "header",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"enum": [
|
||||||
|
"pt-br",
|
||||||
|
"en-us"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"required": true,
|
||||||
|
"in": "path",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"requestBody": {
|
||||||
|
"required": true,
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/IUpdateCertificationStatusRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/IUpdateCertificationStatusRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"Catalog"
|
||||||
|
],
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"access-token": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"access-token": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"/catalog/data-asset/{id}/manage-permissions": {
|
"/catalog/data-asset/{id}/manage-permissions": {
|
||||||
"put": {
|
"put": {
|
||||||
"operationId": "CatalogController_manageDataAssetPermissions",
|
"operationId": "CatalogController_manageDataAssetPermissions",
|
||||||
@@ -11025,6 +11092,23 @@
|
|||||||
"data_asset"
|
"data_asset"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"IUpdateCertificationStatusRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"certification_status": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"draft",
|
||||||
|
"in_review",
|
||||||
|
"approved",
|
||||||
|
"deprecated"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"certification_status"
|
||||||
|
]
|
||||||
|
},
|
||||||
"ICreateDataAsset": {
|
"ICreateDataAsset": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
Generated
+4
-15
@@ -16,8 +16,7 @@
|
|||||||
"@aws-sdk/lib-dynamodb": "^3.414.0",
|
"@aws-sdk/lib-dynamodb": "^3.414.0",
|
||||||
"@aws-sdk/signature-v4": "^3.370.0",
|
"@aws-sdk/signature-v4": "^3.370.0",
|
||||||
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
||||||
"@dadosfera/protospack": "2.5.3",
|
"@dadosfera/protospack-v2": "^3.40.0-beta.10",
|
||||||
"@dadosfera/protospack-v2": "3.40.0-beta.8",
|
|
||||||
"@grpc/grpc-js": "^1.9.3",
|
"@grpc/grpc-js": "^1.9.3",
|
||||||
"@grpc/proto-loader": "^0.7.9",
|
"@grpc/proto-loader": "^0.7.9",
|
||||||
"@nestjs/cli": "^9.5.0",
|
"@nestjs/cli": "^9.5.0",
|
||||||
@@ -1735,20 +1734,10 @@
|
|||||||
"winston-log2gelf": "^2.4.0"
|
"winston-log2gelf": "^2.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@dadosfera/protospack": {
|
|
||||||
"version": "2.5.3",
|
|
||||||
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com/npm/dadosfera-npm/@dadosfera/protospack/-/protospack-2.5.3.tgz",
|
|
||||||
"integrity": "sha512-yOLnd+s6n9VkPpZXO8HnUY27CQPHj/qs+ecddviA4Ldn0Gx4KGRgbVdsSSP45nPm0GHhCd2bHg4ap+la7xtRmA==",
|
|
||||||
"license": "ISC",
|
|
||||||
"dependencies": {
|
|
||||||
"rxjs": "^7.5.5"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@dadosfera/protospack-v2": {
|
"node_modules/@dadosfera/protospack-v2": {
|
||||||
"version": "3.40.0-beta.8",
|
"version": "3.40.0-beta.10",
|
||||||
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.40.0-beta.8.tgz",
|
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.40.0-beta.10.tgz",
|
||||||
"integrity": "sha512-JE5qMjqB3UOM+tCUxB1EwYLQW0PecsaQIa1KDpKEaG3lrzG/H13z8iJi3WH/DuVav2EI94i9VcJWJ1Y0F7ribw==",
|
"integrity": "sha512-F45dSEIKG+gwwDMYHayA242bFwhFTJbZm26KesQbGhf4I45ur6hYZD8dK0voNuVQInLMQhtm6+7th6/jJ8xpTQ==",
|
||||||
"license": "ISC",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@grpc/grpc-js": "^1.9.3",
|
"@grpc/grpc-js": "^1.9.3",
|
||||||
"rxjs": "^7.5.5"
|
"rxjs": "^7.5.5"
|
||||||
|
|||||||
+1
-2
@@ -34,8 +34,7 @@
|
|||||||
"@aws-sdk/lib-dynamodb": "^3.414.0",
|
"@aws-sdk/lib-dynamodb": "^3.414.0",
|
||||||
"@aws-sdk/signature-v4": "^3.370.0",
|
"@aws-sdk/signature-v4": "^3.370.0",
|
||||||
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
||||||
"@dadosfera/protospack": "2.5.3",
|
"@dadosfera/protospack-v2": "^3.40.0-beta.10",
|
||||||
"@dadosfera/protospack-v2": "3.40.0-beta.8",
|
|
||||||
"@grpc/grpc-js": "^1.9.3",
|
"@grpc/grpc-js": "^1.9.3",
|
||||||
"@grpc/proto-loader": "^0.7.9",
|
"@grpc/proto-loader": "^0.7.9",
|
||||||
"@nestjs/cli": "^9.5.0",
|
"@nestjs/cli": "^9.5.0",
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import { ConnectionTestModule } from './modules/connection-test/connection-test.
|
|||||||
import { NetworkConfigModule } from './modules/network-config/network-config.module';
|
import { NetworkConfigModule } from './modules/network-config/network-config.module';
|
||||||
import { InputsModule } from './modules/inputs/inputs.module';
|
import { InputsModule } from './modules/inputs/inputs.module';
|
||||||
import { OauthModule } from './modules/oauth/oauth.module';
|
import { OauthModule } from './modules/oauth/oauth.module';
|
||||||
import { PipelinesModule } from './modules/pipelines/pipelines.module';
|
|
||||||
import { TransformationsModule } from './modules/transformations/transformations.module';
|
import { TransformationsModule } from './modules/transformations/transformations.module';
|
||||||
import { HealthModule } from './modules/health/health.module';
|
import { HealthModule } from './modules/health/health.module';
|
||||||
import { CatalogModule } from './modules/catalog/catalog.module';
|
import { CatalogModule } from './modules/catalog/catalog.module';
|
||||||
@@ -60,7 +59,6 @@ import { ReleaseNoteModule } from './modules/release_note/release_note.module';
|
|||||||
PermissionsModule,
|
PermissionsModule,
|
||||||
TermsOfUseModule,
|
TermsOfUseModule,
|
||||||
ConnectionTestModule,
|
ConnectionTestModule,
|
||||||
PipelinesModule,
|
|
||||||
TransformationsModule,
|
TransformationsModule,
|
||||||
UsersModule,
|
UsersModule,
|
||||||
RolesModule,
|
RolesModule,
|
||||||
|
|||||||
@@ -357,6 +357,16 @@ export const PERMISSIONS_GROUPS = {
|
|||||||
'es-es': 'Crear y editar atributos en el catálogo',
|
'es-es': 'Crear y editar atributos en el catálogo',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
CERTIFY: {
|
||||||
|
seqid: 53,
|
||||||
|
claim: 'catalog:certify',
|
||||||
|
usage: PermissionUsages.PUBLIC,
|
||||||
|
name: {
|
||||||
|
'pt-br': 'Alterar o status de certificação dos Ativos',
|
||||||
|
'en-us': "Change Assets' certification status",
|
||||||
|
'es-es': 'Cambiar el estado de certificación de los Activos',
|
||||||
|
},
|
||||||
|
},
|
||||||
DELETE: {
|
DELETE: {
|
||||||
seqid: 1,
|
seqid: 1,
|
||||||
claim: 'catalog:delete',
|
claim: 'catalog:delete',
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
HttpStatus,
|
HttpStatus,
|
||||||
Res,
|
Res,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
|
import { ValidationPipe } from '../../pipes/object-validation.pipe';
|
||||||
import {
|
import {
|
||||||
ApiCreatedResponse,
|
ApiCreatedResponse,
|
||||||
ApiHeaders,
|
ApiHeaders,
|
||||||
@@ -46,6 +47,7 @@ import {
|
|||||||
IMakeAComment,
|
IMakeAComment,
|
||||||
IOneDataAsset,
|
IOneDataAsset,
|
||||||
IPreviewResponse,
|
IPreviewResponse,
|
||||||
|
IUpdateCertificationStatusRequest,
|
||||||
IUpdateDataRequest,
|
IUpdateDataRequest,
|
||||||
TriggerCatalogReq,
|
TriggerCatalogReq,
|
||||||
TriggerCatalogRes,
|
TriggerCatalogRes,
|
||||||
@@ -493,6 +495,8 @@ export class CatalogController {
|
|||||||
language,
|
language,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
delete (body as any).certification_status;
|
||||||
|
|
||||||
const result = await this.catalogService.updateOneDataAsset({
|
const result = await this.catalogService.updateOneDataAsset({
|
||||||
body,
|
body,
|
||||||
data_asset_id,
|
data_asset_id,
|
||||||
@@ -506,6 +510,33 @@ export class CatalogController {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Put('data-asset/:id/certification-status')
|
||||||
|
@RequireSomePermission(
|
||||||
|
PERMISSIONS_GROUPS.CATALOG.permissions.CERTIFY,
|
||||||
|
PERMISSIONS_GROUPS.CATALOG.permissions.DATA_MANAGER,
|
||||||
|
)
|
||||||
|
async updateDataAssetCertificationStatus(
|
||||||
|
@User() user: RequestUser,
|
||||||
|
@Language() language: LanguageEnum,
|
||||||
|
@Param('id') data_asset_id: string,
|
||||||
|
@Body(new ValidationPipe()) body: IUpdateCertificationStatusRequest,
|
||||||
|
): Promise<IUpdateCertificationStatusRequest> {
|
||||||
|
const { customer_id, customer_name, user_id, username } = user;
|
||||||
|
const metadata = PackTheMetadata({
|
||||||
|
customer_id,
|
||||||
|
customer_name,
|
||||||
|
user_id,
|
||||||
|
username,
|
||||||
|
language,
|
||||||
|
});
|
||||||
|
|
||||||
|
return this.catalogService.updateCertificationStatus({
|
||||||
|
body,
|
||||||
|
data_asset_id,
|
||||||
|
metadata,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Post('data-asset/:id/docs')
|
@Post('data-asset/:id/docs')
|
||||||
@RequireSomePermission(
|
@RequireSomePermission(
|
||||||
PERMISSIONS_GROUPS.CATALOG.permissions.UPDATE,
|
PERMISSIONS_GROUPS.CATALOG.permissions.UPDATE,
|
||||||
|
|||||||
@@ -5,20 +5,17 @@ import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
|
|||||||
import { CatalogController } from './catalog.controller';
|
import { CatalogController } from './catalog.controller';
|
||||||
import { CatalogClientConfiguration } from './catalog-client';
|
import { CatalogClientConfiguration } from './catalog-client';
|
||||||
import { ClientsModule } from '@nestjs/microservices';
|
import { ClientsModule } from '@nestjs/microservices';
|
||||||
import { PipelinesModule as OldPipelineModule } from 'src/modules/pipelines/pipelines.module';
|
|
||||||
import { UsersModule } from '../users/users.module';
|
import { UsersModule } from '../users/users.module';
|
||||||
import { RolesModule } from '../roles/roles.module';
|
import { RolesModule } from '../roles/roles.module';
|
||||||
import { CustomersModule } from '../customers/customers.module';
|
import { CustomersModule } from '../customers/customers.module';
|
||||||
import { ShareModule } from './share/share.module';
|
import { ShareModule } from './share/share.module';
|
||||||
import { CatalogService } from './catalog.service';
|
import { CatalogService } from './catalog.service';
|
||||||
import { MixpanelModule } from '../mixpanel/mixpanel.module';
|
|
||||||
|
|
||||||
const client = new CatalogClientConfiguration();
|
const client = new CatalogClientConfiguration();
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
ClientsModule.register([client.providerOptions]),
|
ClientsModule.register([client.providerOptions]),
|
||||||
OldPipelineModule,
|
|
||||||
UsersModule,
|
UsersModule,
|
||||||
RolesModule,
|
RolesModule,
|
||||||
CustomersModule,
|
CustomersModule,
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import {
|
|||||||
AssetReporter,
|
AssetReporter,
|
||||||
BatchRemoveRlsRulesRequest,
|
BatchRemoveRlsRulesRequest,
|
||||||
CreateDataDocsDTO,
|
CreateDataDocsDTO,
|
||||||
|
IUpdateCertificationStatusRequest,
|
||||||
IUpdateDataRequest,
|
IUpdateDataRequest,
|
||||||
TriggerCatalogReq,
|
TriggerCatalogReq,
|
||||||
} from './dtos';
|
} from './dtos';
|
||||||
@@ -384,6 +385,28 @@ class CatalogService implements OnModuleInit {
|
|||||||
return { data_asset: asset[0] };
|
return { data_asset: asset[0] };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async updateCertificationStatus(data: {
|
||||||
|
data_asset_id: string;
|
||||||
|
body: IUpdateCertificationStatusRequest;
|
||||||
|
metadata: Metadata;
|
||||||
|
}) {
|
||||||
|
const { body, data_asset_id, metadata } = data;
|
||||||
|
|
||||||
|
await lastValueFrom(
|
||||||
|
this.catalogWriteService.UpdateDataAsset(
|
||||||
|
{
|
||||||
|
id: data_asset_id,
|
||||||
|
changes: JSON.stringify({
|
||||||
|
certification_status: body.certification_status,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
metadata,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return { certification_status: body.certification_status };
|
||||||
|
}
|
||||||
|
|
||||||
async updateOneDataAsset(data: {
|
async updateOneDataAsset(data: {
|
||||||
data_asset_id: string;
|
data_asset_id: string;
|
||||||
customer_id: string;
|
customer_id: string;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { ApiProperty, ApiPropertyOptional, PickType } from '@nestjs/swagger';
|
import { ApiProperty, ApiPropertyOptional, PickType } from '@nestjs/swagger';
|
||||||
|
import { IsEnum } from 'class-validator';
|
||||||
import { CreateDataAssetRequest } from '@dadosfera/protospack-v2/dist/lib/Catalog/interfaces/messages';
|
import { CreateDataAssetRequest } from '@dadosfera/protospack-v2/dist/lib/Catalog/interfaces/messages';
|
||||||
|
|
||||||
export enum DataAssetShareType {
|
export enum DataAssetShareType {
|
||||||
@@ -6,6 +7,12 @@ export enum DataAssetShareType {
|
|||||||
public = 'public',
|
public = 'public',
|
||||||
private = 'private',
|
private = 'private',
|
||||||
}
|
}
|
||||||
|
export enum CertificationStatus {
|
||||||
|
draft = 'draft',
|
||||||
|
in_review = 'in_review',
|
||||||
|
approved = 'approved',
|
||||||
|
deprecated = 'deprecated',
|
||||||
|
}
|
||||||
export enum OrderEnum {
|
export enum OrderEnum {
|
||||||
asc = 'asc',
|
asc = 'asc',
|
||||||
desc = 'desc',
|
desc = 'desc',
|
||||||
@@ -205,6 +212,13 @@ export class IUpdateDataRequest {
|
|||||||
@ApiPropertyOptional()
|
@ApiPropertyOptional()
|
||||||
docs?: string;
|
docs?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class IUpdateCertificationStatusRequest {
|
||||||
|
@ApiProperty({ enum: CertificationStatus })
|
||||||
|
@IsEnum(CertificationStatus)
|
||||||
|
certification_status: CertificationStatus;
|
||||||
|
}
|
||||||
|
|
||||||
export class ICreateDataAsset implements CreateDataAssetRequest {
|
export class ICreateDataAsset implements CreateDataAssetRequest {
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
display_name: string;
|
display_name: string;
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
import { Info } from '@dadosfera/protospack/dist/lib/interfaces';
|
export interface Info {
|
||||||
|
user_id: string;
|
||||||
|
customer_id: string;
|
||||||
|
customer: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface Values {
|
interface Values {
|
||||||
jdbc_user: string;
|
jdbc_user: string;
|
||||||
|
|||||||
@@ -1,78 +0,0 @@
|
|||||||
import { ConflictException, Inject, OnModuleInit } from '@nestjs/common';
|
|
||||||
import { ClientGrpc } from '@nestjs/microservices';
|
|
||||||
import {
|
|
||||||
PipelineServicesNames,
|
|
||||||
PipelinesServiceInterface,
|
|
||||||
} from '@dadosfera/protospack';
|
|
||||||
import { lastValueFrom } from 'rxjs';
|
|
||||||
|
|
||||||
import { IIdRequest } from './interfaces';
|
|
||||||
|
|
||||||
import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
|
|
||||||
import { PipelinesClientConfiguration } from './pipelines-client';
|
|
||||||
|
|
||||||
export class PipelinesClientService implements OnModuleInit {
|
|
||||||
private pipelineService: PipelinesServiceInterface;
|
|
||||||
logger: DadosferaLogger;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
@Inject(DadosferaLogger)
|
|
||||||
dadosferaLogger: DadosferaLogger,
|
|
||||||
@Inject(PipelinesClientConfiguration.name)
|
|
||||||
private readonly grpcClient: ClientGrpc,
|
|
||||||
) {
|
|
||||||
this.logger = dadosferaLogger.logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
onModuleInit() {
|
|
||||||
this.pipelineService =
|
|
||||||
this.grpcClient.getService<PipelinesServiceInterface>(
|
|
||||||
PipelineServicesNames.PipelineService,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async getPipelineStatus(data) {
|
|
||||||
this.logger.info('PipelinesClientService - GetPipelineStatus');
|
|
||||||
|
|
||||||
const statusPipelineResponse = await lastValueFrom(
|
|
||||||
this.pipelineService.getPipelineStatus(data),
|
|
||||||
)
|
|
||||||
.then((res) => {
|
|
||||||
const statusArray =
|
|
||||||
res.status?.sort((a, b) => {
|
|
||||||
if (a.id < b.id) {
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}) || [];
|
|
||||||
return { status: statusArray };
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
this.logger.error(err.message);
|
|
||||||
throw new Error(err);
|
|
||||||
});
|
|
||||||
this.logger.info('Done');
|
|
||||||
|
|
||||||
return statusPipelineResponse;
|
|
||||||
}
|
|
||||||
|
|
||||||
async runPipeline({ id, info }: IIdRequest) {
|
|
||||||
this.logger.info('PipelinesClientService - RunPipeline');
|
|
||||||
const statusPipelineResponse = await lastValueFrom(
|
|
||||||
this.pipelineService.triggerPipeline({ id, info }),
|
|
||||||
).catch((err) => {
|
|
||||||
this.logger.error(err.message);
|
|
||||||
throw new Error(err);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (statusPipelineResponse.status == false) {
|
|
||||||
throw new ConflictException(
|
|
||||||
'This pipeline is not ready yet to execute, Try again later!',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.logger.info('Done');
|
|
||||||
return statusPipelineResponse;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-36
@@ -1,36 +0,0 @@
|
|||||||
import { Info } from '@dadosfera/protospack/dist/lib/interfaces';
|
|
||||||
|
|
||||||
export interface ICreatePipelineDto {
|
|
||||||
input: IdRequest;
|
|
||||||
transformations: IdRequest[];
|
|
||||||
output: IdRequest;
|
|
||||||
tags: string[];
|
|
||||||
name: string;
|
|
||||||
description: string;
|
|
||||||
info: Info;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IdRequest {
|
|
||||||
id: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IIdRequest {
|
|
||||||
id: string;
|
|
||||||
info: Info;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IUpdatePipelineRequest {
|
|
||||||
input: IdRequest;
|
|
||||||
transformations: IdRequest[];
|
|
||||||
output: IdRequest;
|
|
||||||
tags: string[];
|
|
||||||
name: string;
|
|
||||||
description: string;
|
|
||||||
id: string;
|
|
||||||
info: Info;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IGetPipelineLogsRequest {
|
|
||||||
id: string;
|
|
||||||
details: string;
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
import {
|
|
||||||
ClientsProviderAsyncOptions,
|
|
||||||
GrpcOptions,
|
|
||||||
Transport,
|
|
||||||
} from '@nestjs/microservices';
|
|
||||||
import { PipelinePackages, PipelineProtoFilePath } from '@dadosfera/protospack';
|
|
||||||
import { credentials } from '@grpc/grpc-js';
|
|
||||||
|
|
||||||
const isLocalConnection =
|
|
||||||
process.env.PIFACTORY_URL.startsWith('pi-factory:') ||
|
|
||||||
process.env.PIFACTORY_URL.includes('0.0.0.0');
|
|
||||||
|
|
||||||
export class PipelinesClientConfiguration {
|
|
||||||
public name = 'PipelinesClientConfiguration';
|
|
||||||
private config: GrpcOptions = {
|
|
||||||
transport: Transport.GRPC,
|
|
||||||
options: {
|
|
||||||
url: process.env.PIFACTORY_URL,
|
|
||||||
package: PipelinePackages,
|
|
||||||
credentials: isLocalConnection ? undefined : credentials.createSsl(),
|
|
||||||
protoPath: PipelineProtoFilePath,
|
|
||||||
loader: {
|
|
||||||
keepCase: true,
|
|
||||||
enums: String,
|
|
||||||
defaults: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
providerOptions: ClientsProviderAsyncOptions = {
|
|
||||||
name: this.name,
|
|
||||||
...this.config,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
import { Body, Controller, Get, Inject, Param, Post } from '@nestjs/common';
|
|
||||||
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
|
||||||
import {
|
|
||||||
AuthenticateCondition,
|
|
||||||
Authenticated,
|
|
||||||
RequireSomePermission,
|
|
||||||
} from 'src/decorators/authentication.decorator';
|
|
||||||
import { PERMISSIONS_GROUPS } from '../../authentication/permissions.enum';
|
|
||||||
import { PipelinesService } from './pipelines.service';
|
|
||||||
import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
|
|
||||||
import { ApiInternalOnlyController } from 'src/decorators/swagger.decorator';
|
|
||||||
|
|
||||||
@ApiInternalOnlyController()
|
|
||||||
@ApiTags('Pipelines')
|
|
||||||
@Controller('pipelines')
|
|
||||||
@Authenticated()
|
|
||||||
export class PipelinesController {
|
|
||||||
logger: DadosferaLogger;
|
|
||||||
constructor(
|
|
||||||
@Inject(DadosferaLogger)
|
|
||||||
dadosferaLogger: DadosferaLogger,
|
|
||||||
private pipelineService: PipelinesService,
|
|
||||||
) {
|
|
||||||
this.logger = dadosferaLogger.logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Post('start/:id')
|
|
||||||
@RequireSomePermission(PERMISSIONS_GROUPS.PIPELINE.permissions.CREATE)
|
|
||||||
@ApiOperation({
|
|
||||||
deprecated: true,
|
|
||||||
description:
|
|
||||||
'This method is deprecated. Please use route /pipelinesV2/start/:id instead',
|
|
||||||
})
|
|
||||||
async activate(@Param('id') id: string, @Body() body) {
|
|
||||||
const { info } = body;
|
|
||||||
|
|
||||||
this.logger.info(
|
|
||||||
process.env.DEV_URL + `/pipeline/start/${id} - ON START PIPELINE ROUTE`,
|
|
||||||
{
|
|
||||||
user: body.info.user_id,
|
|
||||||
customer: body.info.customer,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const response = await this.pipelineService.runPipeline({ id, info });
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Get(':id/status')
|
|
||||||
@ApiOperation({
|
|
||||||
deprecated: true,
|
|
||||||
description:
|
|
||||||
'This method is deprecated. Please use route /pipelinesV2/:id/status instead',
|
|
||||||
})
|
|
||||||
@RequireSomePermission(PERMISSIONS_GROUPS.IMPORT_FILES.permissions.VIEW, PERMISSIONS_GROUPS.PIPELINE.permissions.GET)
|
|
||||||
async getPipelineStatus(@Body() body, @Param('id') id: string) {
|
|
||||||
body.id = id;
|
|
||||||
|
|
||||||
this.logger.info(
|
|
||||||
process.env.DEV_URL + `/pipeline/${id} - ON GET PIPELINE STATUS ROUTE`,
|
|
||||||
{
|
|
||||||
user: body.info.user_id,
|
|
||||||
customer: body.info.customer,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const response = await this.pipelineService.getPipelineStatus(body);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
import { Module } from '@nestjs/common';
|
|
||||||
import { ClientsModule } from '@nestjs/microservices';
|
|
||||||
import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
|
|
||||||
|
|
||||||
import { PipelinesController } from './pipelines.controller';
|
|
||||||
import { PipelinesService } from './pipelines.service';
|
|
||||||
|
|
||||||
import { PipelinesClientConfiguration } from './pipelines-client';
|
|
||||||
import { PipelinesClientService } from './client.service';
|
|
||||||
|
|
||||||
const client = new PipelinesClientConfiguration();
|
|
||||||
|
|
||||||
@Module({
|
|
||||||
imports: [ClientsModule.register([client.providerOptions])],
|
|
||||||
controllers: [PipelinesController],
|
|
||||||
providers: [PipelinesService, PipelinesClientService, DadosferaLogger],
|
|
||||||
exports: [PipelinesService],
|
|
||||||
})
|
|
||||||
export class PipelinesModule {}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
|
|
||||||
import { PipelinesClientService } from './client.service';
|
|
||||||
import { IIdRequest } from './interfaces';
|
|
||||||
import { objectCamelToSnake } from 'src/utils/CaseConverter';
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class PipelinesService {
|
|
||||||
constructor(private pipelineClient: PipelinesClientService) {}
|
|
||||||
|
|
||||||
async getPipelineStatus(data: IIdRequest) {
|
|
||||||
try {
|
|
||||||
const pipelineStatusResponse =
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import { ApiProperty, ApiPropertyOptional, OmitType } from '@nestjs/swagger';
|
import { ApiProperty, ApiPropertyOptional, OmitType } from '@nestjs/swagger';
|
||||||
import { Info } from '@dadosfera/protospack/dist/lib/interfaces';
|
|
||||||
|
|
||||||
export class PipelineInputsDTO {
|
export class PipelineInputsDTO {
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
@@ -62,6 +61,12 @@ export interface IIdRequest {
|
|||||||
info: Info;
|
info: Info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface Info {
|
||||||
|
user_id: string;
|
||||||
|
customer_id: string;
|
||||||
|
customer: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface IUpdatePipelineRequest {
|
export interface IUpdatePipelineRequest {
|
||||||
input: IdRequest;
|
input: IdRequest;
|
||||||
transformations: IdRequest[];
|
transformations: IdRequest[];
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
HttpException,
|
HttpException,
|
||||||
BadRequestException,
|
BadRequestException,
|
||||||
UseGuards,
|
UseGuards,
|
||||||
|
Res,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import {
|
import {
|
||||||
ApiCreatedResponse,
|
ApiCreatedResponse,
|
||||||
@@ -34,7 +35,6 @@ import { Messages } from '@dadosfera/protospack-v2/dist/lib/PipelineV2';
|
|||||||
import { RequestUser, User } from 'src/decorators/user.decorator';
|
import { RequestUser, User } from 'src/decorators/user.decorator';
|
||||||
import { PackTheMetadata } from 'src/utils/PackTheMetadata';
|
import { PackTheMetadata } from 'src/utils/PackTheMetadata';
|
||||||
|
|
||||||
import { PipelinesService as OldPipelineService } from 'src/modules/pipelines/pipelines.service';
|
|
||||||
import {
|
import {
|
||||||
ICompleteUploadCSVFile,
|
ICompleteUploadCSVFile,
|
||||||
ICreatePipelineCSVFile,
|
ICreatePipelineCSVFile,
|
||||||
@@ -63,9 +63,7 @@ export class PipelinesController {
|
|||||||
constructor(
|
constructor(
|
||||||
@Inject(DadosferaLogger)
|
@Inject(DadosferaLogger)
|
||||||
dadosferaLogger: DadosferaLogger,
|
dadosferaLogger: DadosferaLogger,
|
||||||
|
|
||||||
private pipelinesClientService: PipelinesService,
|
private pipelinesClientService: PipelinesService,
|
||||||
private oldPipelinesService: OldPipelineService,
|
|
||||||
) {
|
) {
|
||||||
this.logger = dadosferaLogger.logger;
|
this.logger = dadosferaLogger.logger;
|
||||||
}
|
}
|
||||||
@@ -201,7 +199,7 @@ export class PipelinesController {
|
|||||||
customer: body.info.customer,
|
customer: body.info.customer,
|
||||||
});
|
});
|
||||||
|
|
||||||
const response = await this.oldPipelinesService.getPipelineStatus(body);
|
const response = await this.pipelinesClientService.getPipelineStatus(body);
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
@@ -368,6 +366,21 @@ export class PipelinesController {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Patch('/:id/upgrade')
|
||||||
|
@RequireSomePermission(PERMISSIONS_GROUPS.PIPELINE.permissions.UPDATE)
|
||||||
|
@HttpCode(HttpStatus.NO_CONTENT)
|
||||||
|
async upgradeConnector(
|
||||||
|
@Language() language: LanguageEnum,
|
||||||
|
@Param('id') id: string,
|
||||||
|
@User() user: RequestUser
|
||||||
|
) {
|
||||||
|
this.logger.info('PipelinesController - upgrade connector');
|
||||||
|
|
||||||
|
const metadata = PackTheMetadata(user);
|
||||||
|
|
||||||
|
await this.pipelinesClientService.upgrade(id, metadata);
|
||||||
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
@ApiNoContentResponse()
|
@ApiNoContentResponse()
|
||||||
@HttpCode(HttpStatus.NO_CONTENT)
|
@HttpCode(HttpStatus.NO_CONTENT)
|
||||||
@@ -497,7 +510,7 @@ export class PipelinesController {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const response = await this.oldPipelinesService.runPipeline({ id, info });
|
const response = await this.pipelinesClientService.runPipeline({ id, info });
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import { PipelinesService } from './pipelines.service';
|
|||||||
|
|
||||||
import { PipelinesClientConfiguration } from './pipelines-client';
|
import { PipelinesClientConfiguration } from './pipelines-client';
|
||||||
|
|
||||||
import { PipelinesModule as OldPipelineModule } from 'src/modules/pipelines/pipelines.module';
|
|
||||||
import { ConnectorModule } from '../connector/connector.module';
|
import { ConnectorModule } from '../connector/connector.module';
|
||||||
import { InputsModule } from '../inputs/inputs.module';
|
import { InputsModule } from '../inputs/inputs.module';
|
||||||
import { TransformationsModule } from '../transformations/transformations.module';
|
import { TransformationsModule } from '../transformations/transformations.module';
|
||||||
@@ -21,7 +20,6 @@ const client = new PipelinesClientConfiguration();
|
|||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
ClientsModule.register([client.providerOptions]),
|
ClientsModule.register([client.providerOptions]),
|
||||||
OldPipelineModule,
|
|
||||||
ConnectorModule,
|
ConnectorModule,
|
||||||
InputsModule,
|
InputsModule,
|
||||||
TransformationsModule,
|
TransformationsModule,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* eslint-disable no-async-promise-executor */
|
/* eslint-disable no-async-promise-executor */
|
||||||
import {
|
import {
|
||||||
BadRequestException,
|
BadRequestException,
|
||||||
|
ConflictException,
|
||||||
HttpException,
|
HttpException,
|
||||||
HttpStatus,
|
HttpStatus,
|
||||||
Inject,
|
Inject,
|
||||||
@@ -17,7 +18,7 @@ import { lastValueFrom } from 'rxjs';
|
|||||||
|
|
||||||
import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
|
import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
|
||||||
import { PipelinesClientConfiguration } from './pipelines-client';
|
import { PipelinesClientConfiguration } from './pipelines-client';
|
||||||
import { ICreatePipelineV2Req, UpdatePlatformInputRequest, UpdateTableDTO } from './interfaces';
|
import { ICreatePipelineV2Req, IIdRequest, UpdatePlatformInputRequest, UpdateTableDTO } from './interfaces';
|
||||||
import { PipelineV2CreateRequest } from '@dadosfera/protospack-v2/dist/lib/PipelineV2/interfaces/messages';
|
import { PipelineV2CreateRequest } from '@dadosfera/protospack-v2/dist/lib/PipelineV2/interfaces/messages';
|
||||||
import { Metadata } from '@grpc/grpc-js';
|
import { Metadata } from '@grpc/grpc-js';
|
||||||
import { ConnectorClientService } from '../connector/client.service';
|
import { ConnectorClientService } from '../connector/client.service';
|
||||||
@@ -176,6 +177,15 @@ export class PipelinesService implements OnModuleInit {
|
|||||||
return updatePipelineResponse;
|
return updatePipelineResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async upgrade(id: string, metadata: Metadata) {
|
||||||
|
await lastValueFrom(
|
||||||
|
this.pipelineWriteService.Upgrade(
|
||||||
|
{ id },
|
||||||
|
metadata,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
async remove(data: { id: string; metadata: Metadata; user: RequestUser }) {
|
async remove(data: { id: string; metadata: Metadata; user: RequestUser }) {
|
||||||
const { id, metadata, user } = data;
|
const { id, metadata, user } = data;
|
||||||
const info = {
|
const info = {
|
||||||
@@ -623,4 +633,49 @@ export class PipelinesService implements OnModuleInit {
|
|||||||
return assets;
|
return assets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getPipelineStatus(data) {
|
||||||
|
this.logger.info('PipelinesClientService - GetPipelineStatus');
|
||||||
|
|
||||||
|
const statusPipelineResponse = await lastValueFrom(
|
||||||
|
this.pipelineReadService.PipelineV2GetPipelineV2Status(data),
|
||||||
|
)
|
||||||
|
.then((res) => {
|
||||||
|
const statusArray =
|
||||||
|
res.status?.sort((a, b) => {
|
||||||
|
if (a.id < b.id) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}) || [];
|
||||||
|
return { status: statusArray };
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
this.logger.error(err.message);
|
||||||
|
throw new Error(err);
|
||||||
|
});
|
||||||
|
this.logger.info('Done');
|
||||||
|
|
||||||
|
return statusPipelineResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
async runPipeline({ id, info }: IIdRequest) {
|
||||||
|
this.logger.info('PipelinesClientService - RunPipeline');
|
||||||
|
const statusPipelineResponse = await lastValueFrom(
|
||||||
|
this.pipelineWriteService.PipelineV2TriggerPipelineV2({ id, info }),
|
||||||
|
).catch((err) => {
|
||||||
|
this.logger.error(err.message);
|
||||||
|
throw new Error(err);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (statusPipelineResponse.status == false) {
|
||||||
|
throw new ConflictException(
|
||||||
|
'This pipeline is not ready yet to execute, Try again later!',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.logger.info('Done');
|
||||||
|
return statusPipelineResponse;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
NotFoundException,
|
NotFoundException,
|
||||||
UseGuards,
|
UseGuards,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { ApiTags, ApiOperation } from '@nestjs/swagger';
|
import { ApiTags, ApiOperation, ApiOkResponse } from '@nestjs/swagger';
|
||||||
import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
|
import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -72,6 +72,10 @@ export class PlatformApiController {
|
|||||||
return id?.replace(/-/g, '_') || '';
|
return id?.replace(/-/g, '_') || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private decodePathParam(value: string): string {
|
||||||
|
return value ? decodeURIComponent(value) : '';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denormalize ID back to UUID format (replace _ with -).
|
* Denormalize ID back to UUID format (replace _ with -).
|
||||||
* Used when we receive a normalized ID but need the original UUID.
|
* Used when we receive a normalized ID but need the original UUID.
|
||||||
@@ -832,6 +836,40 @@ export class PlatformApiController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get('pipelines/:pipelineId/pipeline_run/:runId/jobs')
|
||||||
|
@ApiOperation({
|
||||||
|
summary: 'Get pipeline run jobs',
|
||||||
|
description: 'Proxies platform-api DB-backed job runs and returns `{ jobs: [...] }`.',
|
||||||
|
})
|
||||||
|
@ApiOkResponse({
|
||||||
|
description: 'DB-backed job runs for the selected pipeline run.',
|
||||||
|
schema: {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
jobs: {
|
||||||
|
type: 'array',
|
||||||
|
items: { type: 'object' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ['jobs'],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
@RequireAllPermissions(PERMISSIONS_GROUPS.PIPELINE.permissions.GET)
|
||||||
|
async getPipelineRunJobs(
|
||||||
|
@Param('pipelineId') pipelineId: string,
|
||||||
|
@Param('runId') runId: string,
|
||||||
|
@User() user: RequestUser,
|
||||||
|
) {
|
||||||
|
const normalizedPipelineId = this.normalizePipelineId(pipelineId);
|
||||||
|
const decodedRunId = this.decodePathParam(runId);
|
||||||
|
|
||||||
|
return this.platformApiService.proxy(
|
||||||
|
'GET',
|
||||||
|
`/pipeline/${normalizedPipelineId}/pipeline_run/${decodedRunId}/jobs`,
|
||||||
|
user,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// ==================== JOBS - COLUMN EDITING ROUTES ====================
|
// ==================== JOBS - COLUMN EDITING ROUTES ====================
|
||||||
|
|
||||||
@Put('jobs/:jobId/input')
|
@Put('jobs/:jobId/input')
|
||||||
|
|||||||
+5
-2
@@ -1,5 +1,8 @@
|
|||||||
import { Info } from '@dadosfera/protospack/dist/lib/interfaces';
|
export interface Info {
|
||||||
|
user_id: string;
|
||||||
|
customer_id: string;
|
||||||
|
customer: string;
|
||||||
|
}
|
||||||
export interface ICreateTransformationsRequest {
|
export interface ICreateTransformationsRequest {
|
||||||
transformations: Transformation[];
|
transformations: Transformation[];
|
||||||
info: Info;
|
info: Info;
|
||||||
|
|||||||
Reference in New Issue
Block a user