@cargolift-cdi/types 0.1.162 → 0.1.166
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entities/mdm/mdm-base.entity.d.ts +17 -0
- package/dist/entities/mdm/mdm-base.entity.d.ts.map +1 -0
- package/dist/entities/mdm/mdm-base.entity.js +38 -0
- package/dist/entities/mdm/mdm-base.entity.js.map +1 -0
- package/dist/entities/mdm/mdm-driver.entity.d.ts +10 -0
- package/dist/entities/mdm/mdm-driver.entity.d.ts.map +1 -0
- package/dist/entities/mdm/mdm-driver.entity.js +49 -0
- package/dist/entities/mdm/mdm-driver.entity.js.map +1 -0
- package/dist/entities/middleware/agent-credential.entity.d.ts +18 -0
- package/dist/entities/middleware/agent-credential.entity.d.ts.map +1 -0
- package/dist/entities/middleware/agent-credential.entity.js +64 -0
- package/dist/entities/middleware/agent-credential.entity.js.map +1 -0
- package/dist/entities/middleware/agent-endpoint.entity.d.ts +24 -0
- package/dist/entities/middleware/agent-endpoint.entity.d.ts.map +1 -0
- package/dist/entities/middleware/agent-endpoint.entity.js +117 -0
- package/dist/entities/middleware/agent-endpoint.entity.js.map +1 -0
- package/dist/entities/middleware/diagnostic-latency.entity.d.ts +9 -0
- package/dist/entities/middleware/diagnostic-latency.entity.d.ts.map +1 -0
- package/dist/entities/{diagnostic-latency.entity.js → middleware/diagnostic-latency.entity.js} +16 -11
- package/dist/entities/middleware/diagnostic-latency.entity.js.map +1 -0
- package/dist/entities/middleware/integration-agent.entity.d.ts +10 -0
- package/dist/entities/middleware/integration-agent.entity.d.ts.map +1 -0
- package/dist/entities/{integration-agent.entity.js → middleware/integration-agent.entity.js} +22 -22
- package/dist/entities/middleware/integration-agent.entity.js.map +1 -0
- package/dist/entities/middleware/integration-entity.entity.d.ts +13 -0
- package/dist/entities/middleware/integration-entity.entity.d.ts.map +1 -0
- package/dist/entities/{integration-entity.entity.js → middleware/integration-entity.entity.js} +26 -33
- package/dist/entities/middleware/integration-entity.entity.js.map +1 -0
- package/dist/entities/middleware/integration-outbound-snapshot.entity.d.ts +16 -0
- package/dist/entities/middleware/integration-outbound-snapshot.entity.d.ts.map +1 -0
- package/dist/entities/middleware/integration-outbound-snapshot.entity.js +83 -0
- package/dist/entities/middleware/integration-outbound-snapshot.entity.js.map +1 -0
- package/dist/entities/middleware/integration-tracking.entity.d.ts +26 -0
- package/dist/entities/middleware/integration-tracking.entity.d.ts.map +1 -0
- package/dist/entities/middleware/integration-tracking.entity.js +125 -0
- package/dist/entities/middleware/integration-tracking.entity.js.map +1 -0
- package/dist/entities/middleware/log-mdm.entity.d.ts +39 -0
- package/dist/entities/middleware/log-mdm.entity.d.ts.map +1 -0
- package/dist/entities/middleware/log-mdm.entity.js +193 -0
- package/dist/entities/middleware/log-mdm.entity.js.map +1 -0
- package/dist/entities/middleware/log-routing-inbound.entity.d.ts +40 -0
- package/dist/entities/middleware/log-routing-inbound.entity.d.ts.map +1 -0
- package/dist/entities/middleware/log-routing-inbound.entity.js +199 -0
- package/dist/entities/middleware/log-routing-inbound.entity.js.map +1 -0
- package/dist/entities/middleware/log-routing-outbound.entity.d.ts +39 -0
- package/dist/entities/middleware/log-routing-outbound.entity.d.ts.map +1 -0
- package/dist/entities/middleware/log-routing-outbound.entity.js +188 -0
- package/dist/entities/middleware/log-routing-outbound.entity.js.map +1 -0
- package/dist/entities/middleware/routing-inbound.entity.d.ts +23 -0
- package/dist/entities/middleware/routing-inbound.entity.d.ts.map +1 -0
- package/dist/entities/middleware/routing-inbound.entity.js +112 -0
- package/dist/entities/middleware/routing-inbound.entity.js.map +1 -0
- package/dist/entities/middleware/routing-outbound.entity.d.ts +18 -0
- package/dist/entities/middleware/routing-outbound.entity.d.ts.map +1 -0
- package/dist/entities/middleware/routing-outbound.entity.js +87 -0
- package/dist/entities/middleware/routing-outbound.entity.js.map +1 -0
- package/dist/entities/middleware/webhook-subscription.entity.d.ts +16 -0
- package/dist/entities/middleware/webhook-subscription.entity.d.ts.map +1 -0
- package/dist/entities/middleware/webhook-subscription.entity.js +80 -0
- package/dist/entities/middleware/webhook-subscription.entity.js.map +1 -0
- package/dist/entities/shared/audit-trail.entity.d.ts +17 -0
- package/dist/entities/shared/audit-trail.entity.d.ts.map +1 -0
- package/dist/entities/shared/audit-trail.entity.js +86 -0
- package/dist/entities/shared/audit-trail.entity.js.map +1 -0
- package/dist/enum/error-type.enum.js +1 -0
- package/dist/enum/error-type.enum.js.map +1 -0
- package/dist/enum/integration.enums.d.ts +1 -7
- package/dist/enum/integration.enums.d.ts.map +1 -1
- package/dist/enum/integration.enums.js +2 -22
- package/dist/enum/integration.enums.js.map +1 -0
- package/dist/enum/tracking.enums.d.ts +29 -0
- package/dist/enum/tracking.enums.d.ts.map +1 -0
- package/dist/enum/tracking.enums.js +32 -0
- package/dist/enum/tracking.enums.js.map +1 -0
- package/dist/index.d.ts +23 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -15
- package/dist/index.js.map +1 -0
- package/dist/interfaces/api-response.interface.js +1 -0
- package/dist/interfaces/api-response.interface.js.map +1 -0
- package/dist/interfaces/audit-trail.interface.d.ts +6 -0
- package/dist/interfaces/audit-trail.interface.d.ts.map +1 -0
- package/dist/interfaces/audit-trail.interface.js +2 -0
- package/dist/interfaces/audit-trail.interface.js.map +1 -0
- package/dist/interfaces/context-message.interface.d.ts +22 -10
- package/dist/interfaces/context-message.interface.d.ts.map +1 -1
- package/dist/interfaces/context-message.interface.js +1 -1
- package/dist/interfaces/context-message.interface.js.map +1 -0
- package/dist/interfaces/entity-metadados.interface.d.ts +17 -0
- package/dist/interfaces/entity-metadados.interface.d.ts.map +1 -0
- package/dist/interfaces/entity-metadados.interface.js +2 -0
- package/dist/interfaces/entity-metadados.interface.js.map +1 -0
- package/dist/interfaces/envelope-message.interface.d.ts +1 -3
- package/dist/interfaces/envelope-message.interface.d.ts.map +1 -1
- package/dist/interfaces/envelope-message.interface.js +1 -0
- package/dist/interfaces/envelope-message.interface.js.map +1 -0
- package/dist/interfaces/field-access-control.interface.d.ts +20 -0
- package/dist/interfaces/field-access-control.interface.d.ts.map +1 -0
- package/dist/interfaces/field-access-control.interface.js +9 -0
- package/dist/interfaces/field-access-control.interface.js.map +1 -0
- package/dist/interfaces/integration.interface.d.ts +2 -16
- package/dist/interfaces/integration.interface.d.ts.map +1 -1
- package/dist/interfaces/integration.interface.js +1 -0
- package/dist/interfaces/integration.interface.js.map +1 -0
- package/dist/interfaces/payload-condition.interface.js +1 -0
- package/dist/interfaces/payload-condition.interface.js.map +1 -0
- package/dist/interfaces/publish-meta.interface.d.ts +0 -11
- package/dist/interfaces/publish-meta.interface.d.ts.map +1 -1
- package/dist/interfaces/publish-meta.interface.js +1 -0
- package/dist/interfaces/publish-meta.interface.js.map +1 -0
- package/dist/interfaces/rabbitmq.interfaces.js +1 -0
- package/dist/interfaces/rabbitmq.interfaces.js.map +1 -0
- package/dist/interfaces/schema-validation.interface.d.ts +35 -0
- package/dist/interfaces/schema-validation.interface.d.ts.map +1 -0
- package/dist/interfaces/schema-validation.interface.js +2 -0
- package/dist/interfaces/schema-validation.interface.js.map +1 -0
- package/dist/interfaces/tracking.interface.d.ts +28 -0
- package/dist/interfaces/tracking.interface.d.ts.map +1 -0
- package/dist/interfaces/tracking.interface.js +2 -0
- package/dist/interfaces/tracking.interface.js.map +1 -0
- package/package.json +55 -54
- package/dist/entities/diagnostic-latency.entity.d.ts +0 -14
- package/dist/entities/diagnostic-latency.entity.d.ts.map +0 -1
- package/dist/entities/integration-agent.entity.d.ts +0 -12
- package/dist/entities/integration-agent.entity.d.ts.map +0 -1
- package/dist/entities/integration-credential.entity.d.ts +0 -43
- package/dist/entities/integration-credential.entity.d.ts.map +0 -1
- package/dist/entities/integration-credential.entity.js +0 -107
- package/dist/entities/integration-endpoint.entity.d.ts +0 -84
- package/dist/entities/integration-endpoint.entity.d.ts.map +0 -1
- package/dist/entities/integration-endpoint.entity.js +0 -193
- package/dist/entities/integration-entity.entity.d.ts +0 -22
- package/dist/entities/integration-entity.entity.d.ts.map +0 -1
- package/dist/entities/integration-inbound.entity.d.ts +0 -61
- package/dist/entities/integration-inbound.entity.d.ts.map +0 -1
- package/dist/entities/integration-inbound.entity.js +0 -149
- package/dist/entities/integration-outbound.entity.d.ts +0 -41
- package/dist/entities/integration-outbound.entity.d.ts.map +0 -1
- package/dist/entities/integration-outbound.entity.js +0 -91
- package/dist/entities/log-integration-inbound.entity.d.ts +0 -83
- package/dist/entities/log-integration-inbound.entity.d.ts.map +0 -1
- package/dist/entities/log-integration-inbound.entity.js +0 -207
- package/dist/entities/log-integration-outbound.entity.d.ts +0 -59
- package/dist/entities/log-integration-outbound.entity.d.ts.map +0 -1
- package/dist/entities/log-integration-outbound.entity.js +0 -152
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Representa um perfil de credenciais reutilizáveis para autenticação (API Key, Basic, Bearer, OAuth2).
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
* - Registra configurações não sensíveis em `config`.
|
|
12
|
-
* - Armazena segredos sensíveis em `secrets` (campo não selecionado por padrão).
|
|
13
|
-
* - Referencie este registro pela sua `id` (ex.: `credentialId` em IntegrationOutbound).
|
|
14
|
-
* - Entidade mapeada para a tabela "integration_credential".
|
|
15
|
-
*
|
|
16
|
-
* Campos:
|
|
17
|
-
* @property config: Configurações não sensíveis específicas do tipo de autenticação. Exemplos:
|
|
18
|
-
* - apiKey: { headerName?: string, queryName?: string, prefix?: string }
|
|
19
|
-
* - basic: { usernameField?: string }
|
|
20
|
-
* - bearer: { headerName?: string, prefix?: string }
|
|
21
|
-
* - oauth2: { tokenUrl: string, clientId: string, scopes?: string[], audience?: string, resource?: string, authStyle?: 'body'|'basic' }
|
|
22
|
-
* @property secrets: Segredos sensíveis (select: false). Exemplos:
|
|
23
|
-
* - apiKey: { value: string }
|
|
24
|
-
* - basic: { username: string, password: string }
|
|
25
|
-
* - bearer: { token: string }
|
|
26
|
-
* - oauth2: { clientSecret: string, username?: string, password?: string, privateKey?: string }
|
|
27
|
-
* => Nunca exponha `secrets` em logs ou respostas sem proteção. Recomendado encriptar em repouso e limitar leitura.
|
|
28
|
-
* - rotation: Metadados opcionais para rotação/expiração: { rotatedAt?: string, expiresAt?: string, notes?: string }.
|
|
29
|
-
* - createdAt / updatedAt: Carimbos de data de criação/atualização.
|
|
30
|
-
*
|
|
31
|
-
* Boas práticas de segurança:
|
|
32
|
-
* - Mantenha `secrets` com acesso restrito; carregue explicitamente quando necessário (ex.: query com select do campo).
|
|
33
|
-
* - Evite armazenar segredos em texto simples fora do banco ou em logs.
|
|
34
|
-
* - Implemente rotação periódica e registre `rotation.rotatedAt` / `rotation.expiresAt` quando aplicável.
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* @see IntegrationOutbound - referenciar credenciais por credentialId
|
|
38
|
-
*/
|
|
39
|
-
import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn, UpdateDateColumn, } from 'typeorm';
|
|
40
|
-
/**
|
|
41
|
-
* Perfil de credenciais reutilizáveis para autenticação (API Key, Basic, Bearer, OAuth2).
|
|
42
|
-
* Utilize credentialId no IntegrationOutbound para referenciar estas credenciais.
|
|
43
|
-
*/
|
|
44
|
-
let IntegrationCredential = class IntegrationCredential {
|
|
45
|
-
id; // manter string no TS para bigint seguro
|
|
46
|
-
/** Nome amigável único (ex.: 'erp-prod', 'wms-staging') */
|
|
47
|
-
name;
|
|
48
|
-
/** Se a credencial está ativa */
|
|
49
|
-
active;
|
|
50
|
-
/**
|
|
51
|
-
* Tipo de autenticação: 'apiKey' | 'basic' | 'bearer' | 'oauth2'
|
|
52
|
-
* Mantido como string para flexibilidade sem precisar de enum em migrations.
|
|
53
|
-
*/
|
|
54
|
-
type;
|
|
55
|
-
/**
|
|
56
|
-
* Configuração não sensível:
|
|
57
|
-
* - apiKey: { headerName?: string, queryName?: string, prefix?: string }
|
|
58
|
-
* - basic: { usernameField?: string }
|
|
59
|
-
* - bearer: { headerName?: string, prefix?: string }
|
|
60
|
-
* - oauth2: { tokenUrl: string, clientId: string, scopes?: string[], audience?: string, resource?: string, authStyle?: 'body'|'basic' }
|
|
61
|
-
*/
|
|
62
|
-
config;
|
|
63
|
-
/**
|
|
64
|
-
* Segredos sensíveis (não selecionados por padrão):
|
|
65
|
-
* - apiKey: { value: string }
|
|
66
|
-
* - basic: { username: string, password: string }
|
|
67
|
-
* - bearer: { token: string }
|
|
68
|
-
* - oauth2: { clientSecret: string, username?: string, password?: string, privateKey?: string }
|
|
69
|
-
*/
|
|
70
|
-
secrets;
|
|
71
|
-
/** Metadados de rotação/expiração de credenciais */
|
|
72
|
-
rotation;
|
|
73
|
-
createdAt;
|
|
74
|
-
updatedAt;
|
|
75
|
-
};
|
|
76
|
-
__decorate([
|
|
77
|
-
PrimaryGeneratedColumn("identity", { type: "bigint", generatedIdentity: "ALWAYS" })
|
|
78
|
-
], IntegrationCredential.prototype, "id", void 0);
|
|
79
|
-
__decorate([
|
|
80
|
-
Column({ type: 'varchar', length: 120 })
|
|
81
|
-
], IntegrationCredential.prototype, "name", void 0);
|
|
82
|
-
__decorate([
|
|
83
|
-
Column({ type: 'boolean', default: true })
|
|
84
|
-
], IntegrationCredential.prototype, "active", void 0);
|
|
85
|
-
__decorate([
|
|
86
|
-
Column({ type: 'varchar', length: 30 })
|
|
87
|
-
], IntegrationCredential.prototype, "type", void 0);
|
|
88
|
-
__decorate([
|
|
89
|
-
Column({ type: 'jsonb', nullable: true })
|
|
90
|
-
], IntegrationCredential.prototype, "config", void 0);
|
|
91
|
-
__decorate([
|
|
92
|
-
Column({ type: 'jsonb', nullable: true })
|
|
93
|
-
], IntegrationCredential.prototype, "secrets", void 0);
|
|
94
|
-
__decorate([
|
|
95
|
-
Column({ type: 'jsonb', nullable: true })
|
|
96
|
-
], IntegrationCredential.prototype, "rotation", void 0);
|
|
97
|
-
__decorate([
|
|
98
|
-
CreateDateColumn({ name: "created_at", type: "timestamptz" })
|
|
99
|
-
], IntegrationCredential.prototype, "createdAt", void 0);
|
|
100
|
-
__decorate([
|
|
101
|
-
UpdateDateColumn({ name: "updated_at", type: "timestamptz" })
|
|
102
|
-
], IntegrationCredential.prototype, "updatedAt", void 0);
|
|
103
|
-
IntegrationCredential = __decorate([
|
|
104
|
-
Entity({ name: 'integration_credential' }),
|
|
105
|
-
Index(['name'], { unique: true })
|
|
106
|
-
], IntegrationCredential);
|
|
107
|
-
export { IntegrationCredential };
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { TransportProtocol } from "../enum/integration.enums.js";
|
|
2
|
-
import { BreakerPolicy, EndpointConfig, EndpointQueueConfig, EndpointTlsConfig, HttpConfig, RateLimit, RetryPolicy } from "../interfaces/integration.interface.js";
|
|
3
|
-
/**
|
|
4
|
-
* Definição de roteamento de saída por chave (entity) e destino.
|
|
5
|
-
* Agora inclui também as configurações de Target/Delivery (protocolo, endpoint, políticas, etc.).
|
|
6
|
-
*/
|
|
7
|
-
export declare class IntegrationEndpoint {
|
|
8
|
-
id: string;
|
|
9
|
-
/** Agente de destino (e.g., 'erp', 'wms') */
|
|
10
|
-
agent: string;
|
|
11
|
-
/** Entidade (chave) (e.g., 'driver' or 'driver.created') */
|
|
12
|
-
entity: string;
|
|
13
|
-
/** Ação (e.g., 'create', 'update', 'delete', etc) */
|
|
14
|
-
action: string;
|
|
15
|
-
version: number;
|
|
16
|
-
active: boolean;
|
|
17
|
-
/** ===================== Target/Delivery (simplificado no próprio Outbound) ===================== */
|
|
18
|
-
/**
|
|
19
|
-
* Transporte de saída: 'REST' | 'SOAP' | 'AMQP' | etc
|
|
20
|
-
*/
|
|
21
|
-
transportProtocol: TransportProtocol;
|
|
22
|
-
/**
|
|
23
|
-
* Endpoint principal:
|
|
24
|
-
* - http(s): baseUrl (ex.: https://api.exemplo.com)
|
|
25
|
-
* - amqp: uri/host (ex.: amqp://broker:5672)
|
|
26
|
-
* - kafka: bootstrap servers (ex.: broker1:9092,broker2:9092)
|
|
27
|
-
* - sqs/pubsub: pode ser arn/topic/queue ou projeto+tópico
|
|
28
|
-
*/
|
|
29
|
-
endpoint: string;
|
|
30
|
-
/**
|
|
31
|
-
* Referência a credenciais reutilizáveis (IntegrationCredential.id).
|
|
32
|
-
*/
|
|
33
|
-
credentialId?: string | null;
|
|
34
|
-
/**
|
|
35
|
-
* Opções de TLS/MTLS, certificados, SNI etc.
|
|
36
|
-
* Ex.: { rejectUnauthorized: true, ca?: string, cert?: string, key?: string, servername?: string }
|
|
37
|
-
*/
|
|
38
|
-
tls?: EndpointTlsConfig | null;
|
|
39
|
-
/**
|
|
40
|
-
* Configurações gerais do endpoint
|
|
41
|
-
*/
|
|
42
|
-
config?: EndpointConfig | null;
|
|
43
|
-
/**
|
|
44
|
-
* Config HTTP específica (quando transport = 'REST'):
|
|
45
|
-
*/
|
|
46
|
-
httpConfig?: HttpConfig | null;
|
|
47
|
-
/**
|
|
48
|
-
* Config de fila/stream (quando transport = 'amqp' | 'kafka' | 'sqs' | 'pubsub'):
|
|
49
|
-
* {
|
|
50
|
-
* topic?: string, queue?: string, exchange?: string, routingKey?: string,
|
|
51
|
-
* partitionKey?: string, messageKey?: string,
|
|
52
|
-
* properties?: Record<string, any>, // amqp/kafka props
|
|
53
|
-
* }
|
|
54
|
-
*/
|
|
55
|
-
queueConfig?: EndpointQueueConfig | null;
|
|
56
|
-
/**
|
|
57
|
-
* Política de retentativa:
|
|
58
|
-
* { maxAttempts: 3, strategy: 'exponential' | 'fixed', delayMs: 1000, maxDelayMs?: 60000, jitter?: true }
|
|
59
|
-
*/
|
|
60
|
-
retryPolicy?: RetryPolicy | null;
|
|
61
|
-
/**
|
|
62
|
-
* Rate limiting por rota:
|
|
63
|
-
* { limit: 100, intervalMs: 1000, burst?: 50, key?: 'targetAgent' | 'endpoint' | 'custom' }
|
|
64
|
-
*/
|
|
65
|
-
rateLimit?: RateLimit | null;
|
|
66
|
-
/**
|
|
67
|
-
* Política de circuit breaker opcional por endpoint.
|
|
68
|
-
* { threshold?: number; openMs?: number; halfOpenMaxAttempts?: number }
|
|
69
|
-
*/
|
|
70
|
-
breakerPolicy?: BreakerPolicy | null;
|
|
71
|
-
/**
|
|
72
|
-
* Concorrência máxima local por endpoint nesta instância.
|
|
73
|
-
* Controla quantas requisições simultâneas este endpoint pode ter por processo.
|
|
74
|
-
* Default: 1 (serialização local).
|
|
75
|
-
*/
|
|
76
|
-
maxConcurrentPerEndpoint?: number | null;
|
|
77
|
-
/**
|
|
78
|
-
* Idempotência:
|
|
79
|
-
* { strategy: 'header' | 'bodyHash' | 'custom', headerName?: 'Idempotency-Key', ttlMs?: 300000 }
|
|
80
|
-
*/
|
|
81
|
-
createdAt: Date;
|
|
82
|
-
updatedAt: Date;
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=integration-endpoint.entity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"integration-endpoint.entity.d.ts","sourceRoot":"","sources":["../../src/entities/integration-endpoint.entity.ts"],"names":[],"mappings":"AA0CA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAGnK;;;GAGG;AACH,qBAKa,mBAAmB;IAE9B,EAAE,EAAG,MAAM,CAAC;IAGZ,6CAA6C;IAE7C,KAAK,EAAG,MAAM,CAAC;IAEf,4DAA4D;IAE5D,MAAM,EAAG,MAAM,CAAC;IAEhB,qDAAqD;IAErD,MAAM,EAAG,MAAM,CAAC;IAGhB,OAAO,EAAG,MAAM,CAAC;IAGjB,MAAM,EAAG,OAAO,CAAC;IAEjB,qGAAqG;IAErG;;OAEG;IAEH,iBAAiB,EAAG,iBAAiB,CAAC;IAEtC;;;;;;OAMG;IAEH,QAAQ,EAAG,MAAM,CAAC;IAElB;;OAEG;IAEH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;;OAGG;IAEH,GAAG,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAE/B;;OAEG;IAEH,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAK/B;;OAEG;IAEH,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAE/B;;;;;;;OAOG;IAEH,WAAW,CAAC,EAAE,mBAAmB,GAAE,IAAI,CAAC;IAGxC;;;OAGG;IAEH,WAAW,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAEjC;;;OAGG;IAEH,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAE7B;;;OAGG;IAEH,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAErC;;;;OAIG;IAEH,wBAAwB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzC;;;OAGG;IAOH,SAAS,EAAG,IAAI,CAAC;IAGjB,SAAS,EAAG,IAAI,CAAC;CAElB"}
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* @fileoverview Entidade IntegrationOutbound - Define configurações de integração de saída (outbound)
|
|
9
|
-
* @author Israel A. Possoli
|
|
10
|
-
* @date 2026-01-06 *
|
|
11
|
-
|
|
12
|
-
* Definição de roteamento e configuração de entrega/saída para entidades de integração (Outbound).
|
|
13
|
-
*
|
|
14
|
-
* Representa uma rota/endpoint de destino para uma entidade específica, incluindo
|
|
15
|
-
* informações de transporte, endpoint, credenciais, políticas de retry, rate-limiting,
|
|
16
|
-
* circuit breaker, idempotência e configurações específicas por protocolo (HTTP, filas/streams).
|
|
17
|
-
*
|
|
18
|
-
* Observações importantes:
|
|
19
|
-
* - A combinação (agent, entity, action) é única. Há também um índice condicional que garante
|
|
20
|
-
* unicidade quando active = true (ou seja, apenas uma rota ativa por chave).
|
|
21
|
-
* - O campo `id` é um bigint no banco — no TypeScript é mantido como string para segurança.
|
|
22
|
-
*
|
|
23
|
-
* @remarks
|
|
24
|
-
* - Esta entidade centraliza tanto o roteamento (por agent/entity/action) quanto as políticas e
|
|
25
|
-
* configurações de entrega, permitindo múltiplos tipos de transporte e adaptações por destino.
|
|
26
|
-
* - Campos JSONB (httpConfig, queueConfig, tls, retryPolicy, rateLimit, breakerPolicy, idempotency)
|
|
27
|
-
* devem seguir os formatos esperados pelo componente de entrega para serem interpretados corretamente.*
|
|
28
|
-
*
|
|
29
|
-
* @property transportProtocol Protocolo de transporte usado para a entrega (ex.: 'REST', 'SOAP', 'AMQP', 'KAFKA').
|
|
30
|
-
* @property endpoint Endpoint principal/URI/host/connection string dependente do protocolo:
|
|
31
|
-
* - HTTP(S): baseUrl (ex.: https://api.exemplo.com)
|
|
32
|
-
* - AMQP: amqp://broker:5672
|
|
33
|
-
* - Kafka: broker1:9092,broker2:9092
|
|
34
|
-
* - SQS/PubSub: ARN, tópico ou projeto+tópico
|
|
35
|
-
*
|
|
36
|
-
* @property httpConfig Configurações específicas quando transportProtocol é HTTP/REST.
|
|
37
|
-
*
|
|
38
|
-
* @property queueConfig Configurações para filas/streams quando transportProtocol é AMQP/Kafka/SQS/PubSub.
|
|
39
|
-
*
|
|
40
|
-
*/
|
|
41
|
-
import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn, UpdateDateColumn, } from "typeorm";
|
|
42
|
-
/**
|
|
43
|
-
* Definição de roteamento de saída por chave (entity) e destino.
|
|
44
|
-
* Agora inclui também as configurações de Target/Delivery (protocolo, endpoint, políticas, etc.).
|
|
45
|
-
*/
|
|
46
|
-
let IntegrationEndpoint = class IntegrationEndpoint {
|
|
47
|
-
id; // manter string no TS para bigint seguro
|
|
48
|
-
/** Agente de destino (e.g., 'erp', 'wms') */
|
|
49
|
-
agent;
|
|
50
|
-
/** Entidade (chave) (e.g., 'driver' or 'driver.created') */
|
|
51
|
-
entity;
|
|
52
|
-
/** Ação (e.g., 'create', 'update', 'delete', etc) */
|
|
53
|
-
action;
|
|
54
|
-
version;
|
|
55
|
-
active;
|
|
56
|
-
/** ===================== Target/Delivery (simplificado no próprio Outbound) ===================== */
|
|
57
|
-
/**
|
|
58
|
-
* Transporte de saída: 'REST' | 'SOAP' | 'AMQP' | etc
|
|
59
|
-
*/
|
|
60
|
-
transportProtocol;
|
|
61
|
-
/**
|
|
62
|
-
* Endpoint principal:
|
|
63
|
-
* - http(s): baseUrl (ex.: https://api.exemplo.com)
|
|
64
|
-
* - amqp: uri/host (ex.: amqp://broker:5672)
|
|
65
|
-
* - kafka: bootstrap servers (ex.: broker1:9092,broker2:9092)
|
|
66
|
-
* - sqs/pubsub: pode ser arn/topic/queue ou projeto+tópico
|
|
67
|
-
*/
|
|
68
|
-
endpoint;
|
|
69
|
-
/**
|
|
70
|
-
* Referência a credenciais reutilizáveis (IntegrationCredential.id).
|
|
71
|
-
*/
|
|
72
|
-
credentialId;
|
|
73
|
-
/**
|
|
74
|
-
* Opções de TLS/MTLS, certificados, SNI etc.
|
|
75
|
-
* Ex.: { rejectUnauthorized: true, ca?: string, cert?: string, key?: string, servername?: string }
|
|
76
|
-
*/
|
|
77
|
-
tls;
|
|
78
|
-
/**
|
|
79
|
-
* Configurações gerais do endpoint
|
|
80
|
-
*/
|
|
81
|
-
config;
|
|
82
|
-
// @Column({ name: "http_method", type: "varchar", length: 10, default: 'POST', nullable: true })
|
|
83
|
-
// httpMethod!: HttpMethod | null;
|
|
84
|
-
/**
|
|
85
|
-
* Config HTTP específica (quando transport = 'REST'):
|
|
86
|
-
*/
|
|
87
|
-
httpConfig;
|
|
88
|
-
/**
|
|
89
|
-
* Config de fila/stream (quando transport = 'amqp' | 'kafka' | 'sqs' | 'pubsub'):
|
|
90
|
-
* {
|
|
91
|
-
* topic?: string, queue?: string, exchange?: string, routingKey?: string,
|
|
92
|
-
* partitionKey?: string, messageKey?: string,
|
|
93
|
-
* properties?: Record<string, any>, // amqp/kafka props
|
|
94
|
-
* }
|
|
95
|
-
*/
|
|
96
|
-
queueConfig;
|
|
97
|
-
/**
|
|
98
|
-
* Política de retentativa:
|
|
99
|
-
* { maxAttempts: 3, strategy: 'exponential' | 'fixed', delayMs: 1000, maxDelayMs?: 60000, jitter?: true }
|
|
100
|
-
*/
|
|
101
|
-
retryPolicy;
|
|
102
|
-
/**
|
|
103
|
-
* Rate limiting por rota:
|
|
104
|
-
* { limit: 100, intervalMs: 1000, burst?: 50, key?: 'targetAgent' | 'endpoint' | 'custom' }
|
|
105
|
-
*/
|
|
106
|
-
rateLimit;
|
|
107
|
-
/**
|
|
108
|
-
* Política de circuit breaker opcional por endpoint.
|
|
109
|
-
* { threshold?: number; openMs?: number; halfOpenMaxAttempts?: number }
|
|
110
|
-
*/
|
|
111
|
-
breakerPolicy;
|
|
112
|
-
/**
|
|
113
|
-
* Concorrência máxima local por endpoint nesta instância.
|
|
114
|
-
* Controla quantas requisições simultâneas este endpoint pode ter por processo.
|
|
115
|
-
* Default: 1 (serialização local).
|
|
116
|
-
*/
|
|
117
|
-
maxConcurrentPerEndpoint;
|
|
118
|
-
/**
|
|
119
|
-
* Idempotência:
|
|
120
|
-
* { strategy: 'header' | 'bodyHash' | 'custom', headerName?: 'Idempotency-Key', ttlMs?: 300000 }
|
|
121
|
-
*/
|
|
122
|
-
/*
|
|
123
|
-
@Column({ type: "jsonb", nullable: true })
|
|
124
|
-
idempotency?: Record<string, any> | null;
|
|
125
|
-
*/
|
|
126
|
-
createdAt;
|
|
127
|
-
updatedAt;
|
|
128
|
-
};
|
|
129
|
-
__decorate([
|
|
130
|
-
PrimaryGeneratedColumn("identity", { type: "bigint", generatedIdentity: "ALWAYS" })
|
|
131
|
-
], IntegrationEndpoint.prototype, "id", void 0);
|
|
132
|
-
__decorate([
|
|
133
|
-
Column({ name: "target_agent", type: "varchar", length: 80 })
|
|
134
|
-
], IntegrationEndpoint.prototype, "agent", void 0);
|
|
135
|
-
__decorate([
|
|
136
|
-
Column({ type: "varchar", length: 80 })
|
|
137
|
-
], IntegrationEndpoint.prototype, "entity", void 0);
|
|
138
|
-
__decorate([
|
|
139
|
-
Column({ type: "varchar", length: 40 })
|
|
140
|
-
], IntegrationEndpoint.prototype, "action", void 0);
|
|
141
|
-
__decorate([
|
|
142
|
-
Column({ type: "int", default: 1 })
|
|
143
|
-
], IntegrationEndpoint.prototype, "version", void 0);
|
|
144
|
-
__decorate([
|
|
145
|
-
Column({ type: "boolean", default: true })
|
|
146
|
-
], IntegrationEndpoint.prototype, "active", void 0);
|
|
147
|
-
__decorate([
|
|
148
|
-
Column({ name: "transport_protocol", type: "varchar", length: 20 })
|
|
149
|
-
], IntegrationEndpoint.prototype, "transportProtocol", void 0);
|
|
150
|
-
__decorate([
|
|
151
|
-
Column({ type: "varchar", length: 500 })
|
|
152
|
-
], IntegrationEndpoint.prototype, "endpoint", void 0);
|
|
153
|
-
__decorate([
|
|
154
|
-
Column({ name: "credential_id", type: "bigint", nullable: true })
|
|
155
|
-
], IntegrationEndpoint.prototype, "credentialId", void 0);
|
|
156
|
-
__decorate([
|
|
157
|
-
Column({ type: "jsonb", nullable: true })
|
|
158
|
-
], IntegrationEndpoint.prototype, "tls", void 0);
|
|
159
|
-
__decorate([
|
|
160
|
-
Column({ name: "config", type: "jsonb", nullable: true })
|
|
161
|
-
], IntegrationEndpoint.prototype, "config", void 0);
|
|
162
|
-
__decorate([
|
|
163
|
-
Column({ name: "http_config", type: "jsonb", nullable: true })
|
|
164
|
-
], IntegrationEndpoint.prototype, "httpConfig", void 0);
|
|
165
|
-
__decorate([
|
|
166
|
-
Column({ name: "queue_config", type: "jsonb", nullable: true })
|
|
167
|
-
], IntegrationEndpoint.prototype, "queueConfig", void 0);
|
|
168
|
-
__decorate([
|
|
169
|
-
Column({ name: "retry_policy", type: "jsonb", nullable: true })
|
|
170
|
-
], IntegrationEndpoint.prototype, "retryPolicy", void 0);
|
|
171
|
-
__decorate([
|
|
172
|
-
Column({ name: "rate_limit", type: "jsonb", nullable: true })
|
|
173
|
-
], IntegrationEndpoint.prototype, "rateLimit", void 0);
|
|
174
|
-
__decorate([
|
|
175
|
-
Column({ name: "breaker_policy", type: "jsonb", nullable: true })
|
|
176
|
-
], IntegrationEndpoint.prototype, "breakerPolicy", void 0);
|
|
177
|
-
__decorate([
|
|
178
|
-
Column({ name: "max_concurrent_per_endpoint", type: "int", nullable: true })
|
|
179
|
-
], IntegrationEndpoint.prototype, "maxConcurrentPerEndpoint", void 0);
|
|
180
|
-
__decorate([
|
|
181
|
-
CreateDateColumn({ name: "created_at", type: "timestamptz" })
|
|
182
|
-
], IntegrationEndpoint.prototype, "createdAt", void 0);
|
|
183
|
-
__decorate([
|
|
184
|
-
UpdateDateColumn({ name: "updated_at", type: "timestamptz" })
|
|
185
|
-
], IntegrationEndpoint.prototype, "updatedAt", void 0);
|
|
186
|
-
IntegrationEndpoint = __decorate([
|
|
187
|
-
Entity({ name: "integration_endpoint" }),
|
|
188
|
-
Index("uq_integration_endpoint_active", ["agent", "entity", "action"], {
|
|
189
|
-
unique: true,
|
|
190
|
-
where: `"active" = true`,
|
|
191
|
-
})
|
|
192
|
-
], IntegrationEndpoint);
|
|
193
|
-
export { IntegrationEndpoint };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare class IntegrationEntity {
|
|
2
|
-
id: string;
|
|
3
|
-
/** Entidade (e.g., 'driver') */
|
|
4
|
-
entity: string;
|
|
5
|
-
/** Versão da entidade. Apenas a última versão pode estar ativa. Versões anteriores não podem sofrer modificações */
|
|
6
|
-
version: number;
|
|
7
|
-
/**Se a entidade está ativa */
|
|
8
|
-
active: boolean;
|
|
9
|
-
/** Descrição opcional amigável ao usuário */
|
|
10
|
-
description?: string | null;
|
|
11
|
-
/**
|
|
12
|
-
* Modo de roteamento da entidade
|
|
13
|
-
* - 'direct': Roteia diretamente para entidades de destino sem passar pelo ODS
|
|
14
|
-
* - 'ods': Roteia para o ODS (Operational Data Store) antes de enviar para entidades de destino
|
|
15
|
-
* - 'mdm': Roteia para fila de dados mestres (MDM) antes de enviar para entidades de destino
|
|
16
|
-
*/
|
|
17
|
-
routingMode: "direct" | "ods" | "mdm";
|
|
18
|
-
/** Opções adicionais (reservado para uso futuro) */
|
|
19
|
-
createdAt: Date;
|
|
20
|
-
updatedAt: Date;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=integration-entity.entity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"integration-entity.entity.d.ts","sourceRoot":"","sources":["../../src/entities/integration-entity.entity.ts"],"names":[],"mappings":"AAcA,qBAMa,iBAAiB;IAE5B,EAAE,EAAG,MAAM,CAAC;IAEZ,gCAAgC;IAEhC,MAAM,EAAG,MAAM,CAAC;IAEhB,oHAAoH;IAEpH,OAAO,EAAG,MAAM,CAAC;IAEjB,8BAA8B;IAE9B,MAAM,EAAG,OAAO,CAAC;IAEjB,6CAA6C;IAE7C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B;;;;;OAKG;IAEH,WAAW,EAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAC;IAEvC,oDAAoD;IAKpD,SAAS,EAAG,IAAI,CAAC;IAGjB,SAAS,EAAG,IAAI,CAAC;CAClB"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { IntegrationInboundRouting } from "../interfaces/integration.interface.js";
|
|
2
|
-
import { IntegrationActions } from "../enum/integration.enums.js";
|
|
3
|
-
/**
|
|
4
|
-
* Perfil de rotas de integração de entrada (inbound) para validação, transformação e roteamento.
|
|
5
|
-
* Utilize agent + entity + action no IntegrationEntity para referenciar estas rotas.
|
|
6
|
-
*/
|
|
7
|
-
export declare class IntegrationInbound {
|
|
8
|
-
id: string;
|
|
9
|
-
/** Agente de integração de origem (e.g., 'erp') */
|
|
10
|
-
agent: string;
|
|
11
|
-
/** Entidade - Representa o que está sendo integrado. (e.g., 'driver', 'cte', etc) */
|
|
12
|
-
entity: string;
|
|
13
|
-
/** Método HTTP (e.g., 'GET', 'POST', 'PUT', 'DELETE', etc), será usado para identificar qual a ação que será executada
|
|
14
|
-
* Pode ser usado para diferenciar ações em um mesmo endpoint de integração. Ex: 'POST' para 'CREATE', 'PUT' para 'UPDATE', etc.
|
|
15
|
-
* Também pode ser usado para roteamento condicional baseado no método HTTP, caso um mesma entidade de integração receba chamadas com métodos diferentes.
|
|
16
|
-
* Exemplo: um endpoint de integração que recebe tanto 'POST' para criar um cadastro quanto 'PUT' para atualizar o cadastro, ambos mapeados para a mesma entidade 'driver' mas com ações diferentes ('create' e 'update', por exemplo).
|
|
17
|
-
* Pode-se usar vários métodos para a mesma ação, caso queira mapear 'POST' e 'PUT' para a ação 'upsert', por exemplo. Neste caso, o campo method pode conter uma lista de métodos HTTP (ex: "POST, PUT") e a lógica de roteamento deve considerar isso.
|
|
18
|
-
*/
|
|
19
|
-
method: string;
|
|
20
|
-
/** Ação dentro do middleware (e.g., 'create', 'update', 'delete', etc) */
|
|
21
|
-
action: IntegrationActions;
|
|
22
|
-
/** Versão da rota. Apenas a última versão pode estar ativa. Versões anteriores não podem sofrer modificações */
|
|
23
|
-
version: number;
|
|
24
|
-
/**Se a rota está ativa */
|
|
25
|
-
active: boolean;
|
|
26
|
-
/** Descrição opcional amigável ao usuário */
|
|
27
|
-
description?: string | null;
|
|
28
|
-
/** Condições de definição para entidades (entity) baseadas no payload canônico (transformado).
|
|
29
|
-
* É aplicado dentro do ESB
|
|
30
|
-
* Sobrepõe a entidade definida no campo 'entity' para roteamento condicional baseado no conteúdo do payload.
|
|
31
|
-
* Ex: Uma integração de pessoa física (people) quando no payload tiver um campo "type" com valor "driver", então a entidade será 'driver' ao invés de 'people'
|
|
32
|
-
* Útil para casos onde o mesmo endpoint de integração recebe chamadas com a mesma combinação de método HTTP e entidade, mas a entidade a ser processada depende do conteúdo do payload.
|
|
33
|
-
*/
|
|
34
|
-
routingEntity?: IntegrationInboundRouting[];
|
|
35
|
-
/** Condições de definição para ações (action) baseadas no payload canônico (transformado).
|
|
36
|
-
* É aplicado dentro do ESB
|
|
37
|
-
* Sobrepõe a ação definida no campo 'action' para roteamento condicional baseado no conteúdo do payload.
|
|
38
|
-
* Ex: Se o payload tiver um campo "operation" com valor "update", então a ação será 'update' ao invés de 'create', mesmo que o método HTTP seja 'POST'.
|
|
39
|
-
* Útil para casos onde o mesmo endpoint de integração recebe chamadas com a mesma combinação de método HTTP e entidade, mas a ação a ser executada depende do conteúdo do payload.
|
|
40
|
-
*/
|
|
41
|
-
routingAction?: IntegrationInboundRouting[];
|
|
42
|
-
/** Pré-validação do payload do agente de integração (antes da transformação para o formato canônico) */
|
|
43
|
-
validation?: Record<string, any> | null;
|
|
44
|
-
/** Expressão JSONata para transformação do payload de entrada para o formato canônico */
|
|
45
|
-
transformation?: string | null;
|
|
46
|
-
/** Regra global (BRE RulesConfiguration) aplicada após a transformação do payload canônico */
|
|
47
|
-
rules?: Record<string, any> | null;
|
|
48
|
-
refExtraction?: string | null;
|
|
49
|
-
refType?: string | null;
|
|
50
|
-
additionalRefsExtraction?: string | null;
|
|
51
|
-
/** Modo de roteamento que sobrescreve o modo definido na entidade (integration_entity)
|
|
52
|
-
* - 'direct': Roteia diretamente para os agentes de destino sem passar pelo ODS
|
|
53
|
-
* - 'ods': Roteia para o ODS (Operational Data Store) antes de enviar para os agentes de destino
|
|
54
|
-
* - 'mdm': Roteia para fila de dados mestres (MDM) antes de enviar para os agentes de destino
|
|
55
|
-
* - 'default': Usa o modo definido na entidade (integration_entity)
|
|
56
|
-
*/
|
|
57
|
-
overrideRoutingMode?: "default" | "direct" | "ods" | "mdm" | null;
|
|
58
|
-
createdAt: Date;
|
|
59
|
-
updatedAt: Date;
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=integration-inbound.entity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"integration-inbound.entity.d.ts","sourceRoot":"","sources":["../../src/entities/integration-inbound.entity.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE;;;GAGG;AACH,qBAMa,kBAAkB;IAE7B,EAAE,EAAG,MAAM,CAAC;IAEZ,mDAAmD;IAEnD,KAAK,EAAG,MAAM,CAAC;IAEf,qFAAqF;IAErF,MAAM,EAAG,MAAM,CAAC;IAEhB;;;;;OAKG;IAEH,MAAM,EAAG,MAAM,CAAC;IAEhB,0EAA0E;IAE1E,MAAM,EAAG,kBAAkB,CAAC;IAE5B,gHAAgH;IAEhH,OAAO,EAAG,MAAM,CAAC;IAEjB,0BAA0B;IAE1B,MAAM,EAAG,OAAO,CAAC;IAEjB,6CAA6C;IAE7C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B;;;;;OAKG;IAEH,aAAa,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAE5C;;;;;OAKG;IAEH,aAAa,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAG5C,wGAAwG;IAExG,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAExC,yFAAyF;IAEzF,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B,8FAA8F;IAE9F,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAInC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAI9B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAIxB,wBAAwB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzC;;;;;OAKG;IAEH,mBAAmB,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC;IAIlE,SAAS,EAAG,IAAI,CAAC;IAGjB,SAAS,EAAG,IAAI,CAAC;CAClB"}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* @fileoverview Entidade IntegrationInbound - Define configurações de integração de entrada (inbound)
|
|
9
|
-
* @author Israel A. Possoli
|
|
10
|
-
* @date 2026-01-06
|
|
11
|
-
* Representa uma rota de integração de entrada (inbound) que descreve como entidades externas (o que está sendo integrado)
|
|
12
|
-
* devem ser validados, transformados e aplicados às regras globais antes do roteamento dentro do ESB para o MDM, ODS ou agentes de destino.
|
|
13
|
-
*
|
|
14
|
-
* @remarks
|
|
15
|
-
* - Cada combinação (agent, entity, action, version) é única.
|
|
16
|
-
* - Apenas uma versão por (agent, entity, action) pode estar ativa ao mesmo tempo.
|
|
17
|
-
* - Versões anteriores devem ser imutáveis após a publicação de novas versões.
|
|
18
|
-
* - Transformações usam expressões JSONata para mapear payloads externos ao formato canônico interno.
|
|
19
|
-
*
|
|
20
|
-
|
|
21
|
-
*/
|
|
22
|
-
import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
|
|
23
|
-
/**
|
|
24
|
-
* Perfil de rotas de integração de entrada (inbound) para validação, transformação e roteamento.
|
|
25
|
-
* Utilize agent + entity + action no IntegrationEntity para referenciar estas rotas.
|
|
26
|
-
*/
|
|
27
|
-
let IntegrationInbound = class IntegrationInbound {
|
|
28
|
-
id; // manter string no TS para bigint seguro
|
|
29
|
-
/** Agente de integração de origem (e.g., 'erp') */
|
|
30
|
-
agent;
|
|
31
|
-
/** Entidade - Representa o que está sendo integrado. (e.g., 'driver', 'cte', etc) */
|
|
32
|
-
entity;
|
|
33
|
-
/** Método HTTP (e.g., 'GET', 'POST', 'PUT', 'DELETE', etc), será usado para identificar qual a ação que será executada
|
|
34
|
-
* Pode ser usado para diferenciar ações em um mesmo endpoint de integração. Ex: 'POST' para 'CREATE', 'PUT' para 'UPDATE', etc.
|
|
35
|
-
* Também pode ser usado para roteamento condicional baseado no método HTTP, caso um mesma entidade de integração receba chamadas com métodos diferentes.
|
|
36
|
-
* Exemplo: um endpoint de integração que recebe tanto 'POST' para criar um cadastro quanto 'PUT' para atualizar o cadastro, ambos mapeados para a mesma entidade 'driver' mas com ações diferentes ('create' e 'update', por exemplo).
|
|
37
|
-
* Pode-se usar vários métodos para a mesma ação, caso queira mapear 'POST' e 'PUT' para a ação 'upsert', por exemplo. Neste caso, o campo method pode conter uma lista de métodos HTTP (ex: "POST, PUT") e a lógica de roteamento deve considerar isso.
|
|
38
|
-
*/
|
|
39
|
-
method;
|
|
40
|
-
/** Ação dentro do middleware (e.g., 'create', 'update', 'delete', etc) */
|
|
41
|
-
action;
|
|
42
|
-
/** Versão da rota. Apenas a última versão pode estar ativa. Versões anteriores não podem sofrer modificações */
|
|
43
|
-
version;
|
|
44
|
-
/**Se a rota está ativa */
|
|
45
|
-
active;
|
|
46
|
-
/** Descrição opcional amigável ao usuário */
|
|
47
|
-
description;
|
|
48
|
-
/** Condições de definição para entidades (entity) baseadas no payload canônico (transformado).
|
|
49
|
-
* É aplicado dentro do ESB
|
|
50
|
-
* Sobrepõe a entidade definida no campo 'entity' para roteamento condicional baseado no conteúdo do payload.
|
|
51
|
-
* Ex: Uma integração de pessoa física (people) quando no payload tiver um campo "type" com valor "driver", então a entidade será 'driver' ao invés de 'people'
|
|
52
|
-
* Útil para casos onde o mesmo endpoint de integração recebe chamadas com a mesma combinação de método HTTP e entidade, mas a entidade a ser processada depende do conteúdo do payload.
|
|
53
|
-
*/
|
|
54
|
-
routingEntity;
|
|
55
|
-
/** Condições de definição para ações (action) baseadas no payload canônico (transformado).
|
|
56
|
-
* É aplicado dentro do ESB
|
|
57
|
-
* Sobrepõe a ação definida no campo 'action' para roteamento condicional baseado no conteúdo do payload.
|
|
58
|
-
* Ex: Se o payload tiver um campo "operation" com valor "update", então a ação será 'update' ao invés de 'create', mesmo que o método HTTP seja 'POST'.
|
|
59
|
-
* Útil para casos onde o mesmo endpoint de integração recebe chamadas com a mesma combinação de método HTTP e entidade, mas a ação a ser executada depende do conteúdo do payload.
|
|
60
|
-
*/
|
|
61
|
-
routingAction;
|
|
62
|
-
/** Pré-validação do payload do agente de integração (antes da transformação para o formato canônico) */
|
|
63
|
-
validation;
|
|
64
|
-
/** Expressão JSONata para transformação do payload de entrada para o formato canônico */
|
|
65
|
-
transformation;
|
|
66
|
-
/** Regra global (BRE RulesConfiguration) aplicada após a transformação do payload canônico */
|
|
67
|
-
rules;
|
|
68
|
-
// Expressão JSONNata para extração da referência externa (código do cadastro, número do documento, etc) a partir do payload canônico (transformado)
|
|
69
|
-
refExtraction;
|
|
70
|
-
// Nome do tipo de referência externa (e.g., 'cte', 'cnpj', 'viagem', etc)
|
|
71
|
-
refType;
|
|
72
|
-
// Expressão JSONNata para extração de referências adicionais (e.g., múltiplos códigos relacionados em formato Json) a partir do payload canônico (transformado)
|
|
73
|
-
additionalRefsExtraction;
|
|
74
|
-
/** Modo de roteamento que sobrescreve o modo definido na entidade (integration_entity)
|
|
75
|
-
* - 'direct': Roteia diretamente para os agentes de destino sem passar pelo ODS
|
|
76
|
-
* - 'ods': Roteia para o ODS (Operational Data Store) antes de enviar para os agentes de destino
|
|
77
|
-
* - 'mdm': Roteia para fila de dados mestres (MDM) antes de enviar para os agentes de destino
|
|
78
|
-
* - 'default': Usa o modo definido na entidade (integration_entity)
|
|
79
|
-
*/
|
|
80
|
-
overrideRoutingMode;
|
|
81
|
-
createdAt;
|
|
82
|
-
updatedAt;
|
|
83
|
-
};
|
|
84
|
-
__decorate([
|
|
85
|
-
PrimaryGeneratedColumn("identity", { type: "bigint", generatedIdentity: "ALWAYS" })
|
|
86
|
-
], IntegrationInbound.prototype, "id", void 0);
|
|
87
|
-
__decorate([
|
|
88
|
-
Column({ type: "varchar", length: 80 })
|
|
89
|
-
], IntegrationInbound.prototype, "agent", void 0);
|
|
90
|
-
__decorate([
|
|
91
|
-
Column({ type: "varchar", length: 80 })
|
|
92
|
-
], IntegrationInbound.prototype, "entity", void 0);
|
|
93
|
-
__decorate([
|
|
94
|
-
Column({ type: "varchar", length: 80 })
|
|
95
|
-
], IntegrationInbound.prototype, "method", void 0);
|
|
96
|
-
__decorate([
|
|
97
|
-
Column({ type: "varchar", length: 40 })
|
|
98
|
-
], IntegrationInbound.prototype, "action", void 0);
|
|
99
|
-
__decorate([
|
|
100
|
-
Column({ type: "int", default: 1 })
|
|
101
|
-
], IntegrationInbound.prototype, "version", void 0);
|
|
102
|
-
__decorate([
|
|
103
|
-
Column({ type: "boolean", default: true })
|
|
104
|
-
], IntegrationInbound.prototype, "active", void 0);
|
|
105
|
-
__decorate([
|
|
106
|
-
Column({ type: "varchar", length: 500, nullable: true })
|
|
107
|
-
], IntegrationInbound.prototype, "description", void 0);
|
|
108
|
-
__decorate([
|
|
109
|
-
Column({ type: "jsonb", nullable: true })
|
|
110
|
-
], IntegrationInbound.prototype, "routingEntity", void 0);
|
|
111
|
-
__decorate([
|
|
112
|
-
Column({ type: "jsonb", nullable: true })
|
|
113
|
-
], IntegrationInbound.prototype, "routingAction", void 0);
|
|
114
|
-
__decorate([
|
|
115
|
-
Column({ type: "jsonb", nullable: true })
|
|
116
|
-
], IntegrationInbound.prototype, "validation", void 0);
|
|
117
|
-
__decorate([
|
|
118
|
-
Column({ type: "text", nullable: true })
|
|
119
|
-
], IntegrationInbound.prototype, "transformation", void 0);
|
|
120
|
-
__decorate([
|
|
121
|
-
Column({ type: "jsonb", nullable: true })
|
|
122
|
-
], IntegrationInbound.prototype, "rules", void 0);
|
|
123
|
-
__decorate([
|
|
124
|
-
Column({ type: "text", nullable: true })
|
|
125
|
-
], IntegrationInbound.prototype, "refExtraction", void 0);
|
|
126
|
-
__decorate([
|
|
127
|
-
Column({ type: "varchar", nullable: true })
|
|
128
|
-
], IntegrationInbound.prototype, "refType", void 0);
|
|
129
|
-
__decorate([
|
|
130
|
-
Column({ type: "text", nullable: true })
|
|
131
|
-
], IntegrationInbound.prototype, "additionalRefsExtraction", void 0);
|
|
132
|
-
__decorate([
|
|
133
|
-
Column({ type: "varchar", length: 20, nullable: true })
|
|
134
|
-
], IntegrationInbound.prototype, "overrideRoutingMode", void 0);
|
|
135
|
-
__decorate([
|
|
136
|
-
CreateDateColumn({ name: "created_at", type: "timestamptz" })
|
|
137
|
-
], IntegrationInbound.prototype, "createdAt", void 0);
|
|
138
|
-
__decorate([
|
|
139
|
-
UpdateDateColumn({ name: "updated_at", type: "timestamptz" })
|
|
140
|
-
], IntegrationInbound.prototype, "updatedAt", void 0);
|
|
141
|
-
IntegrationInbound = __decorate([
|
|
142
|
-
Entity({ name: "integration_inbound" }),
|
|
143
|
-
Index(["agent", "entity", "action", "version"], { unique: true }),
|
|
144
|
-
Index("uq_integration_inbound_active", ["agent", "entity", "action"], {
|
|
145
|
-
unique: true,
|
|
146
|
-
where: `"active" = true`,
|
|
147
|
-
})
|
|
148
|
-
], IntegrationInbound);
|
|
149
|
-
export { IntegrationInbound };
|