@cargolift-cdi/types 0.1.46 → 0.1.48

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.
@@ -1 +1 @@
1
- {"version":3,"file":"integration-credential.entity.d.ts","sourceRoot":"","sources":["../../../../src/db/entities/integration/integration-credential.entity.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD;;;GAGG;AACH,qBAEa,qBAAqB;IAEhC,EAAE,EAAG,MAAM,CAAC;IAEZ,2DAA2D;IAE3D,IAAI,EAAG,MAAM,CAAC;IAEd,iCAAiC;IAEjC,MAAM,EAAG,OAAO,CAAC;IAEjB;;;OAGG;IAEH,IAAI,EAAG,QAAQ,CAAC;IAEhB;;;;;;OAMG;IAEH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAEpC;;;;;;OAMG;IAEH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAIrC,oDAAoD;IAEpD,QAAQ,CAAC,EAAE;QACT,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,IAAI,CAAC;IAGT,SAAS,EAAG,IAAI,CAAC;IAGjB,SAAS,EAAG,IAAI,CAAC;CAElB"}
1
+ {"version":3,"file":"integration-credential.entity.d.ts","sourceRoot":"","sources":["../../../../src/db/entities/integration/integration-credential.entity.ts"],"names":[],"mappings":"AAyCA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD;;;GAGG;AACH,qBAEa,qBAAqB;IAEhC,EAAE,EAAG,MAAM,CAAC;IAGZ,2DAA2D;IAE3D,IAAI,EAAG,MAAM,CAAC;IAEd,iCAAiC;IAEjC,MAAM,EAAG,OAAO,CAAC;IAEjB;;;OAGG;IAEH,IAAI,EAAG,QAAQ,CAAC;IAEhB;;;;;;OAMG;IAEH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAEpC;;;;;;OAMG;IAEH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAIrC,oDAAoD;IAEpD,QAAQ,CAAC,EAAE;QACT,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,IAAI,CAAC;IAGT,SAAS,EAAG,IAAI,CAAC;IAGjB,SAAS,EAAG,IAAI,CAAC;CAElB"}
@@ -4,13 +4,45 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
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
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
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
+ */
7
39
  import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn, UpdateDateColumn, } from 'typeorm';
8
40
  /**
9
41
  * Perfil de credenciais reutilizáveis para autenticação (API Key, Basic, Bearer, OAuth2).
10
42
  * Utilize credentialId no IntegrationOutbound para referenciar estas credenciais.
11
43
  */
12
44
  let IntegrationCredential = class IntegrationCredential {
13
- id;
45
+ id; // manter string no TS para bigint seguro
14
46
  /** Nome amigável único (ex.: 'erp-prod', 'wms-staging') */
15
47
  name;
16
48
  /** Se a credencial está ativa */
@@ -42,7 +74,7 @@ let IntegrationCredential = class IntegrationCredential {
42
74
  updatedAt;
43
75
  };
44
76
  __decorate([
45
- PrimaryGeneratedColumn('uuid')
77
+ PrimaryGeneratedColumn("identity", { type: "bigint", generatedIdentity: "ALWAYS" })
46
78
  ], IntegrationCredential.prototype, "id", void 0);
47
79
  __decorate([
48
80
  Column({ type: 'varchar', length: 120 })
@@ -63,10 +95,10 @@ __decorate([
63
95
  Column({ type: 'jsonb', nullable: true })
64
96
  ], IntegrationCredential.prototype, "rotation", void 0);
65
97
  __decorate([
66
- CreateDateColumn({ name: "create_at", type: "timestamptz" })
98
+ CreateDateColumn({ name: "created_at", type: "timestamptz" })
67
99
  ], IntegrationCredential.prototype, "createdAt", void 0);
68
100
  __decorate([
69
- UpdateDateColumn({ name: "update_at", type: "timestamptz" })
101
+ UpdateDateColumn({ name: "updated_at", type: "timestamptz" })
70
102
  ], IntegrationCredential.prototype, "updatedAt", void 0);
71
103
  IntegrationCredential = __decorate([
72
104
  Entity({ name: 'integration_credential' }),
@@ -1,4 +1,5 @@
1
- import { HttpMethod, TransportProtocol } from "./integration.enums.js";
1
+ import { TransportProtocol } from "./integration.enums.js";
2
+ import { EndpointBreakerPolicy, EndpointHttpConfig, EndpointQueueConfig, EndpointRateLimitConfig, EndpointRetryPolicy, EndpointTlsConfig } from "./integration.interface.js";
2
3
  /**
3
4
  * Definição de roteamento de saída por chave (evento) e destino.
4
5
  * Agora inclui também as configurações de Target/Delivery (protocolo, endpoint, templates, políticas, etc.).
@@ -9,7 +10,7 @@ export declare class IntegrationEndpoint {
9
10
  system: string;
10
11
  /** Evento (chave) (e.g., 'driver' or 'driver.created') */
11
12
  event: string;
12
- /** Ação (e.g., 'create', 'update', 'delete', etc */
13
+ /** Ação (e.g., 'create', 'update', 'delete', etc) */
13
14
  action: string;
14
15
  version: number;
15
16
  active: boolean;
@@ -26,7 +27,15 @@ export declare class IntegrationEndpoint {
26
27
  * - sqs/pubsub: pode ser arn/topic/queue ou projeto+tópico
27
28
  */
28
29
  endpoint: string;
29
- httpMethod: HttpMethod;
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;
30
39
  /**
31
40
  * Config HTTP específica (quando transport = 'http'):
32
41
  * {
@@ -40,7 +49,7 @@ export declare class IntegrationEndpoint {
40
49
  * compression?: { type?: 'gzip' | 'deflate' | 'br' }
41
50
  * }
42
51
  */
43
- httpConfig?: Record<string, any> | null;
52
+ httpConfig?: EndpointHttpConfig | null;
44
53
  /**
45
54
  * Config de fila/stream (quando transport = 'amqp' | 'kafka' | 'sqs' | 'pubsub'):
46
55
  * {
@@ -51,46 +60,22 @@ export declare class IntegrationEndpoint {
51
60
  * payloadTemplate?: any
52
61
  * }
53
62
  */
54
- queueConfig?: Record<string, any> | null;
55
- /**
56
- * Referência a credenciais reutilizáveis (IntegrationCredential.id).
57
- */
58
- credentialId?: string | null;
59
- /**
60
- * Opções de TLS/MTLS, certificados, SNI etc.
61
- * Ex.: { rejectUnauthorized: true, ca?: string, cert?: string, key?: string, servername?: string }
62
- */
63
- tls?: Record<string, any> | null;
63
+ queueConfig?: EndpointQueueConfig | null;
64
64
  /**
65
65
  * Política de retentativa:
66
66
  * { maxAttempts: 3, strategy: 'exponential' | 'fixed', delayMs: 1000, maxDelayMs?: 60000, jitter?: true }
67
67
  */
68
- retryPolicy?: {
69
- maxAttempts?: number;
70
- strategy?: 'exponential' | 'fixed';
71
- delayMs?: number;
72
- maxDelayMs?: number;
73
- jitter?: boolean;
74
- } | null;
68
+ retryPolicy?: EndpointRetryPolicy | null;
75
69
  /**
76
70
  * Rate limiting por rota:
77
71
  * { limit: 100, intervalMs: 1000, burst?: 50, key?: 'targetSystem' | 'endpoint' | 'custom' }
78
72
  */
79
- rateLimit?: {
80
- strategy?: 'fixed-window' | 'token-bucket';
81
- limit?: number;
82
- intervalMs?: number;
83
- burst?: number;
84
- } | null;
73
+ rateLimit?: EndpointRateLimitConfig | null;
85
74
  /**
86
75
  * Política de circuit breaker opcional por endpoint.
87
76
  * { threshold?: number; openMs?: number; halfOpenMaxAttempts?: number }
88
77
  */
89
- breakerPolicy?: {
90
- threshold?: number;
91
- openMs?: number;
92
- halfOpenMaxAttempts?: number;
93
- } | null;
78
+ breakerPolicy?: EndpointBreakerPolicy | null;
94
79
  /**
95
80
  * Concorrência máxima local por endpoint nesta instância.
96
81
  * Controla quantas requisições simultâneas este endpoint pode ter por processo.
@@ -101,7 +86,6 @@ export declare class IntegrationEndpoint {
101
86
  * Idempotência:
102
87
  * { strategy: 'header' | 'bodyHash' | 'custom', headerName?: 'Idempotency-Key', ttlMs?: 300000 }
103
88
  */
104
- idempotency?: Record<string, any> | null;
105
89
  createdAt: Date;
106
90
  updatedAt: Date;
107
91
  }
@@ -1 +1 @@
1
- {"version":3,"file":"integration-endpoint.d.ts","sourceRoot":"","sources":["../../../../src/db/entities/integration/integration-endpoint.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGvE;;;GAGG;AACH,qBAGa,mBAAmB;IAE9B,EAAE,EAAG,MAAM,CAAC;IAEZ,8CAA8C;IAE9C,MAAM,EAAG,MAAM,CAAC;IAEhB,0DAA0D;IAE1D,KAAK,EAAG,MAAM,CAAC;IAEf,oDAAoD;IAEpD,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;IAGlB,UAAU,EAAG,UAAU,CAAC;IAExB;;;;;;;;;;;;OAYG;IAEH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAExC;;;;;;;;;OASG;IAEH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAGzC;;OAEG;IAEH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;;OAGG;IAEH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAEjC;;;OAGG;IAEH,WAAW,CAAC,EAAE;QACZ,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC;QACnC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,GAAG,IAAI,CAAC;IAET;;;OAGG;IAEH,SAAS,CAAC,EAAE;QACV,QAAQ,CAAC,EAAE,cAAc,GAAG,cAAc,CAAC;QAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,IAAI,CAAC;IAET;;;OAGG;IAEH,aAAa,CAAC,EAAE;QACd,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAC9B,GAAG,IAAI,CAAC;IAET;;;;OAIG;IAEH,wBAAwB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzC;;;OAGG;IAEH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAGzC,SAAS,EAAG,IAAI,CAAC;IAGjB,SAAS,EAAG,IAAI,CAAC;CAElB"}
1
+ {"version":3,"file":"integration-endpoint.d.ts","sourceRoot":"","sources":["../../../../src/db/entities/integration/integration-endpoint.ts"],"names":[],"mappings":"AA6EA,OAAO,EAAc,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAG7K;;;GAGG;AACH,qBAKa,mBAAmB;IAE9B,EAAE,EAAG,MAAM,CAAC;IAGZ,8CAA8C;IAE9C,MAAM,EAAG,MAAM,CAAC;IAEhB,0DAA0D;IAE1D,KAAK,EAAG,MAAM,CAAC;IAEf,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;IAK/B;;;;;;;;;;;;OAYG;IAEH,UAAU,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAEvC;;;;;;;;;OASG;IAEH,WAAW,CAAC,EAAE,mBAAmB,GAAE,IAAI,CAAC;IAGxC;;;OAGG;IAEH,WAAW,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAEzC;;;OAGG;IAEH,SAAS,CAAC,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAE3C;;;OAGG;IAEH,aAAa,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAE7C;;;;OAIG;IAEH,wBAAwB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzC;;;OAGG;IAOH,SAAS,EAAG,IAAI,CAAC;IAGjB,SAAS,EAAG,IAAI,CAAC;CAElB"}
@@ -5,21 +5,86 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  /**
8
+ * Definição de roteamento e configuração de entrega/saída para eventos de integração (Outbound).
9
+ *
10
+ * Representa uma rota/endpoint de destino para um evento específico, incluindo
11
+ * informações de transporte, endpoint, credenciais, políticas de retry, rate-limiting,
12
+ * circuit breaker, idempotência e configurações específicas por protocolo (HTTP, filas/streams).
13
+ *
14
+ * Observações importantes:
15
+ * - A combinação (system, event, action) é única. Há também um índice condicional que garante
16
+ * unicidade quando active = true (ou seja, apenas uma rota ativa por chave).
17
+ * - O campo `id` é um bigint no banco — no TypeScript é mantido como string para segurança.
18
+ *
19
+ * @remarks
20
+ * - Esta entidade centraliza tanto o roteamento (por sistema/evento/ação) quanto as políticas e
21
+ * configurações de entrega, permitindo múltiplos tipos de transporte e adaptações por destino.
22
+ * - Campos JSONB (httpConfig, queueConfig, tls, retryPolicy, rateLimit, breakerPolicy, idempotency)
23
+ * devem seguir os formatos esperados pelo componente de entrega para serem interpretados corretamente.*
24
+ *
25
+ * @property transportProtocol Protocolo de transporte usado para a entrega (ex.: 'REST', 'SOAP', 'AMQP', 'KAFKA').
26
+ * @property endpoint Endpoint principal/URI/host/connection string dependente do protocolo:
27
+ * - HTTP(S): baseUrl (ex.: https://api.exemplo.com)
28
+ * - AMQP: amqp://broker:5672
29
+ * - Kafka: broker1:9092,broker2:9092
30
+ * - SQS/PubSub: ARN, tópico ou projeto+tópico
31
+ *
32
+ * @property httpConfig Configurações específicas quando transportProtocol é HTTP/REST.
33
+ * Estrutura típica:
34
+ * {
35
+ * method?: 'POST'|'PUT'|'PATCH'|'GET'|'DELETE',
36
+ * pathTemplate?: string, // ex.: /v1/drivers/{{id}}
37
+ * headersTemplate?: Record<string,string>,
38
+ * queryTemplate?: Record<string,any>,
39
+ * bodyTemplate?: any, // JSONata / Liquid / Handlebars
40
+ * contentType?: string, // ex.: 'application/json'
41
+ * timeoutMs?: number,
42
+ * compression?: { type?: 'gzip'|'deflate'|'br' }
43
+ * }
44
+ *
45
+ * @property queueConfig Configurações para filas/streams quando transportProtocol é AMQP/Kafka/SQS/PubSub.
46
+ * Estrutura típica:
47
+ * {
48
+ * topic?: string,
49
+ * queue?: string,
50
+ * exchange?: string,
51
+ * routingKey?: string,
52
+ * partitionKey?: string,
53
+ * messageKey?: string,
54
+ * headersTemplate?: Record<string,string>,
55
+ * properties?: Record<string,any>, // propriedades específicas do broker
56
+ * payloadTemplate?: any
57
+ * }
58
+ *
59
+ * @example Exemplo de httpConfig:
60
+ * {
61
+ * method: 'POST',
62
+ * pathTemplate: '/v1/drivers/{{id}}',
63
+ * headersTemplate: { 'Authorization': 'Bearer {{token}}', 'Content-Type': 'application/json' },
64
+ * bodyTemplate: { id: '{{id}}', name: '{{name}}' },
65
+ * timeoutMs: 5000
66
+ * }
67
+ *
68
+ * @example Exemplo de queueConfig para Kafka:
69
+ * {
70
+ * topic: 'drivers.created',
71
+ * partitionKey: '{{id}}',
72
+ * headersTemplate: { correlationId: '{{correlationId}}' },
73
+ * payloadTemplate: { id: '{{id}}', payload: '{{payload}}' }
74
+ * }
8
75
  */
9
- // src/integration/entities/integration-outbound.entity.ts
10
- //
11
76
  import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn, UpdateDateColumn, } from "typeorm";
12
77
  /**
13
78
  * Definição de roteamento de saída por chave (evento) e destino.
14
79
  * Agora inclui também as configurações de Target/Delivery (protocolo, endpoint, templates, políticas, etc.).
15
80
  */
16
81
  let IntegrationEndpoint = class IntegrationEndpoint {
17
- id;
82
+ id; // manter string no TS para bigint seguro
18
83
  /** Sistema de destino (e.g., 'erp', 'wms') */
19
84
  system;
20
85
  /** Evento (chave) (e.g., 'driver' or 'driver.created') */
21
86
  event;
22
- /** Ação (e.g., 'create', 'update', 'delete', etc */
87
+ /** Ação (e.g., 'create', 'update', 'delete', etc) */
23
88
  action;
24
89
  version;
25
90
  active;
@@ -36,7 +101,17 @@ let IntegrationEndpoint = class IntegrationEndpoint {
36
101
  * - sqs/pubsub: pode ser arn/topic/queue ou projeto+tópico
37
102
  */
38
103
  endpoint;
39
- httpMethod;
104
+ /**
105
+ * Referência a credenciais reutilizáveis (IntegrationCredential.id).
106
+ */
107
+ credentialId;
108
+ /**
109
+ * Opções de TLS/MTLS, certificados, SNI etc.
110
+ * Ex.: { rejectUnauthorized: true, ca?: string, cert?: string, key?: string, servername?: string }
111
+ */
112
+ tls;
113
+ // @Column({ name: "http_method", type: "varchar", length: 10, default: 'POST', nullable: true })
114
+ // httpMethod!: HttpMethod | null;
40
115
  /**
41
116
  * Config HTTP específica (quando transport = 'http'):
42
117
  * {
@@ -62,15 +137,6 @@ let IntegrationEndpoint = class IntegrationEndpoint {
62
137
  * }
63
138
  */
64
139
  queueConfig;
65
- /**
66
- * Referência a credenciais reutilizáveis (IntegrationCredential.id).
67
- */
68
- credentialId;
69
- /**
70
- * Opções de TLS/MTLS, certificados, SNI etc.
71
- * Ex.: { rejectUnauthorized: true, ca?: string, cert?: string, key?: string, servername?: string }
72
- */
73
- tls;
74
140
  /**
75
141
  * Política de retentativa:
76
142
  * { maxAttempts: 3, strategy: 'exponential' | 'fixed', delayMs: 1000, maxDelayMs?: 60000, jitter?: true }
@@ -96,12 +162,15 @@ let IntegrationEndpoint = class IntegrationEndpoint {
96
162
  * Idempotência:
97
163
  * { strategy: 'header' | 'bodyHash' | 'custom', headerName?: 'Idempotency-Key', ttlMs?: 300000 }
98
164
  */
99
- idempotency;
165
+ /*
166
+ @Column({ type: "jsonb", nullable: true })
167
+ idempotency?: Record<string, any> | null;
168
+ */
100
169
  createdAt;
101
170
  updatedAt;
102
171
  };
103
172
  __decorate([
104
- PrimaryGeneratedColumn("uuid")
173
+ PrimaryGeneratedColumn("identity", { type: "bigint", generatedIdentity: "ALWAYS" })
105
174
  ], IntegrationEndpoint.prototype, "id", void 0);
106
175
  __decorate([
107
176
  Column({ name: "target_system", type: "varchar", length: 80 })
@@ -125,20 +194,17 @@ __decorate([
125
194
  Column({ type: "varchar", length: 500 })
126
195
  ], IntegrationEndpoint.prototype, "endpoint", void 0);
127
196
  __decorate([
128
- Column({ name: "http_method", type: "varchar", length: 10, default: 'POST' })
129
- ], IntegrationEndpoint.prototype, "httpMethod", void 0);
197
+ Column({ name: "credential_id", type: "bigint", nullable: true })
198
+ ], IntegrationEndpoint.prototype, "credentialId", void 0);
199
+ __decorate([
200
+ Column({ type: "jsonb", nullable: true })
201
+ ], IntegrationEndpoint.prototype, "tls", void 0);
130
202
  __decorate([
131
203
  Column({ name: "http_config", type: "jsonb", nullable: true })
132
204
  ], IntegrationEndpoint.prototype, "httpConfig", void 0);
133
205
  __decorate([
134
206
  Column({ name: "queue_config", type: "jsonb", nullable: true })
135
207
  ], IntegrationEndpoint.prototype, "queueConfig", void 0);
136
- __decorate([
137
- Column({ name: "credential_id", type: "uuid", nullable: true })
138
- ], IntegrationEndpoint.prototype, "credentialId", void 0);
139
- __decorate([
140
- Column({ type: "jsonb", nullable: true })
141
- ], IntegrationEndpoint.prototype, "tls", void 0);
142
208
  __decorate([
143
209
  Column({ name: "retry_policy", type: "jsonb", nullable: true })
144
210
  ], IntegrationEndpoint.prototype, "retryPolicy", void 0);
@@ -152,17 +218,16 @@ __decorate([
152
218
  Column({ name: "max_concurrent_per_endpoint", type: "int", nullable: true })
153
219
  ], IntegrationEndpoint.prototype, "maxConcurrentPerEndpoint", void 0);
154
220
  __decorate([
155
- Column({ type: "jsonb", nullable: true })
156
- ], IntegrationEndpoint.prototype, "idempotency", void 0);
157
- __decorate([
158
- CreateDateColumn({ name: "create_at", type: "timestamptz" })
221
+ CreateDateColumn({ name: "created_at", type: "timestamptz" })
159
222
  ], IntegrationEndpoint.prototype, "createdAt", void 0);
160
223
  __decorate([
161
- UpdateDateColumn({ name: "update_at", type: "timestamptz" })
224
+ UpdateDateColumn({ name: "updated_at", type: "timestamptz" })
162
225
  ], IntegrationEndpoint.prototype, "updatedAt", void 0);
163
226
  IntegrationEndpoint = __decorate([
164
227
  Entity({ name: "integration_endpoint" }),
165
- Index(["system", "event", "action"], { unique: true }),
166
- Index(["credentialId"])
228
+ Index("uq_integration_endpoint_active", ["system", "event", "action"], {
229
+ unique: true,
230
+ where: `"active" = true`,
231
+ })
167
232
  ], IntegrationEndpoint);
168
233
  export { IntegrationEndpoint };
@@ -18,11 +18,11 @@ export declare class IntegrationInbound {
18
18
  /** Descrição opcional amigável ao usuário */
19
19
  description?: string | null;
20
20
  /** Pré-validação do payload de origem */
21
- validation: Record<string, any>;
21
+ validation?: Record<string, any> | null;
22
22
  /** Expressão JSONata */
23
- transformation: string;
23
+ transformation?: string | null;
24
24
  /** Regra global (BRE RulesConfiguration) */
25
- rules: Record<string, any>;
25
+ rules?: Record<string, any> | null;
26
26
  /** Opções adicionais (reservado para uso futuro) */
27
27
  options?: Record<string, any> | null;
28
28
  createdAt: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"integration-inbound.entity.d.ts","sourceRoot":"","sources":["../../../../src/db/entities/integration/integration-inbound.entity.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,qBAEa,kBAAkB;IAE7B,EAAE,EAAG,MAAM,CAAC;IAEZ,sCAAsC;IAEtC,MAAM,EAAG,MAAM,CAAC;IAEhB,8BAA8B;IAE9B,KAAK,EAAG,MAAM,CAAC;IAEb,oDAAoD;IAEtD,MAAM,EAAG,MAAM,CAAC;IAEhB,gHAAgH;IAEhH,OAAO,EAAG,MAAM,CAAC;IAEjB,0BAA0B;IAE1B,MAAM,EAAG,OAAO,CAAC;IAEjB,6CAA6C;IAE7C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,0CAA0C;IAE1C,UAAU,EAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEjC,yBAAyB;IAEzB,cAAc,EAAG,MAAM,CAAC;IAExB,4CAA4C;IAE5C,KAAK,EAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE5B,oDAAoD;IAEpD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAGrC,SAAS,EAAG,IAAI,CAAC;IAGjB,SAAS,EAAG,IAAI,CAAC;CAElB"}
1
+ {"version":3,"file":"integration-inbound.entity.d.ts","sourceRoot":"","sources":["../../../../src/db/entities/integration/integration-inbound.entity.ts"],"names":[],"mappings":"AAuBA;;;;GAIG;AACH,qBAOa,kBAAkB;IAE7B,EAAE,EAAG,MAAM,CAAC;IAEZ,sCAAsC;IAEtC,MAAM,EAAG,MAAM,CAAC;IAEhB,8BAA8B;IAE9B,KAAK,EAAG,MAAM,CAAC;IAEb,oDAAoD;IAEtD,MAAM,EAAG,MAAM,CAAC;IAEhB,gHAAgH;IAEhH,OAAO,EAAG,MAAM,CAAC;IAEjB,0BAA0B;IAE1B,MAAM,EAAG,OAAO,CAAC;IAEjB,6CAA6C;IAE7C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,0CAA0C;IAE1C,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAExC,yBAAyB;IAEzB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B,4CAA4C;IAE5C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAEnC,oDAAoD;IAEpD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAGrC,SAAS,EAAG,IAAI,CAAC;IAGjB,SAAS,EAAG,IAAI,CAAC;CAElB"}
@@ -4,6 +4,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
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
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
+ /**
8
+ * Representa uma rota de integração de entrada (inbound) que descreve como eventos externos
9
+ * devem ser validados, transformados e aplicados às regras globais antes do roteamento interno.
10
+ *
11
+ * @remarks
12
+ * - Cada combinação (system, event, action, version) é única.
13
+ * - Apenas uma versão por (system, event, action) pode estar ativa ao mesmo tempo.
14
+ * - Versões anteriores devem ser imutáveis após a publicação de novas versões.
15
+ * - Transformações usam expressões JSONata para mapear payloads externos ao formato canônico interno.
16
+ *
17
+
18
+ */
7
19
  import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn, UpdateDateColumn, } from "typeorm";
8
20
  /**
9
21
  * Eventos de integração (tms.driver) - Ocorre na integração de entrada (inbound) antes do roteamento.
@@ -11,7 +23,7 @@ import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn, Update
11
23
  * Também armazena configurações de regras global (BRE) associadas ao evento.
12
24
  */
13
25
  let IntegrationInbound = class IntegrationInbound {
14
- id;
26
+ id; // manter string no TS para bigint seguro
15
27
  /** Sistema de origem (e.g., 'erp') */
16
28
  system;
17
29
  /** Evento (e.g., 'driver') */
@@ -36,7 +48,7 @@ let IntegrationInbound = class IntegrationInbound {
36
48
  updatedAt;
37
49
  };
38
50
  __decorate([
39
- PrimaryGeneratedColumn("uuid")
51
+ PrimaryGeneratedColumn("identity", { type: "bigint", generatedIdentity: "ALWAYS" })
40
52
  ], IntegrationInbound.prototype, "id", void 0);
41
53
  __decorate([
42
54
  Column({ type: "varchar", length: 80 })
@@ -69,13 +81,17 @@ __decorate([
69
81
  Column({ type: "jsonb", nullable: true })
70
82
  ], IntegrationInbound.prototype, "options", void 0);
71
83
  __decorate([
72
- CreateDateColumn({ name: "create_at", type: "timestamptz" })
84
+ CreateDateColumn({ name: "created_at", type: "timestamptz" })
73
85
  ], IntegrationInbound.prototype, "createdAt", void 0);
74
86
  __decorate([
75
- UpdateDateColumn({ name: "update_at", type: "timestamptz" })
87
+ UpdateDateColumn({ name: "updated_at", type: "timestamptz" })
76
88
  ], IntegrationInbound.prototype, "updatedAt", void 0);
77
89
  IntegrationInbound = __decorate([
78
90
  Entity({ name: "integration_inbound" }),
79
- Index(["system", "event", "action", "version"], { unique: true })
91
+ Index(["system", "event", "action", "version"], { unique: true }),
92
+ Index("uq_integration_inbound_active", ["system", "event", "action"], {
93
+ unique: true,
94
+ where: `"active" = true`,
95
+ })
80
96
  ], IntegrationInbound);
81
97
  export { IntegrationInbound };
@@ -1,14 +1,11 @@
1
- /**
2
- * Definição de roteamento de saída por chave (evento) e destino.
3
- * Agora inclui também as configurações de Target/Delivery (protocolo, endpoint, templates, políticas, etc.).
4
- */
5
1
  export declare class IntegrationOutbound {
2
+ /** Identificador único do sistema de integração */
6
3
  id: string;
7
4
  /** Sistema de origem (e.g., 'tms') */
8
5
  system: string;
9
6
  /** Evento (chave) (e.g., 'driver' or 'driver.created') */
10
7
  event: string;
11
- /** Ação (e.g., 'create', 'update', 'delete', etc */
8
+ /** Ação (e.g., 'create', 'update', 'delete', etc) */
12
9
  action: string;
13
10
  /** Sistema de destino (e.g., 'erp', 'wms') */
14
11
  targetSystem: string;
@@ -21,7 +18,6 @@ export declare class IntegrationOutbound {
21
18
  /** Regras (BRE RulesConfiguration) */
22
19
  rules?: Record<string, any>;
23
20
  /** Opções adicionais (reservado para uso futuro) */
24
- options?: Record<string, any> | null;
25
21
  createdAt: Date;
26
22
  updatedAt: Date;
27
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"integration-outbound.entity.d.ts","sourceRoot":"","sources":["../../../../src/db/entities/integration/integration-outbound.entity.ts"],"names":[],"mappings":"AAoCA;;;GAGG;AACH,qBAEa,mBAAmB;IAE9B,EAAE,EAAG,MAAM,CAAC;IAEZ,sCAAsC;IAEtC,MAAM,EAAG,MAAM,CAAC;IAEhB,0DAA0D;IAE1D,KAAK,EAAG,MAAM,CAAC;IAEb,oDAAoD;IAEtD,MAAM,EAAG,MAAM,CAAC;IAEhB,8CAA8C;IAE9C,YAAY,EAAG,MAAM,CAAC;IAGtB,gHAAgH;IAEhH,OAAO,EAAG,MAAM,CAAC;IAEjB,2BAA2B;IAE3B,MAAM,EAAG,OAAO,CAAC;IAGjB,gBAAgB;IAEhB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,sCAAsC;IAEtC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE5B,oDAAoD;IAEpD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAGrC,SAAS,EAAG,IAAI,CAAC;IAGjB,SAAS,EAAG,IAAI,CAAC;CAElB"}
1
+ {"version":3,"file":"integration-outbound.entity.d.ts","sourceRoot":"","sources":["../../../../src/db/entities/integration/integration-outbound.entity.ts"],"names":[],"mappings":"AAuBA,qBAMa,mBAAmB;IAC9B,mDAAmD;IAEnD,EAAE,EAAG,MAAM,CAAC;IAEZ,sCAAsC;IAEtC,MAAM,EAAG,MAAM,CAAC;IAEhB,0DAA0D;IAE1D,KAAK,EAAG,MAAM,CAAC;IAEf,qDAAqD;IAErD,MAAM,EAAG,MAAM,CAAC;IAEhB,8CAA8C;IAE9C,YAAY,EAAG,MAAM,CAAC;IAGtB,gHAAgH;IAEhH,OAAO,EAAG,MAAM,CAAC;IAEjB,2BAA2B;IAE3B,MAAM,EAAG,OAAO,CAAC;IAGjB,gBAAgB;IAEhB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,sCAAsC;IAEtC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE5B,oDAAoD;IAKpD,SAAS,EAAG,IAAI,CAAC;IAGjB,SAAS,EAAG,IAAI,CAAC;CAGlB"}
@@ -15,33 +15,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
15
15
  * - Há um índice único composto por (system, event, targetSystem, version) garantindo que
16
16
  * não existam duplicatas de rota para a mesma combinação.
17
17
  * - Somente a versão mais recente de uma rota pode estar ativa; versões anteriores devem ser imutáveis.
18
- *
19
- * @property id UUID gerada automaticamente que identifica unicamente a rota.
20
- * @property system Sistema de origem (ex.: "tms"), usado para agrupar/filtrar rotas por emissor.
21
- * @property targetSystem Sistema de destino (ex.: "erp", "wms") para o qual o evento será encaminhado.
22
- * @property event Chave do evento (ex.: "driver", "driver.created") que aciona esta rota.
23
- * @property version Versão da rota. Versões anteriores não devem ser modificadas; apenas a última pode estar ativa.
24
- * @property description Texto descritivo opcional da rota (até 500 caracteres).
25
- * @property rules Configuração de regras (BRE) em formato JSONB utilizada para avaliar/executar o roteamento.
26
- * @property active Indicador se a rota está ativa e deve ser considerada pelo mecanismo de envio.
27
- * @property options Campo JSONB opcional para opções adicionais de roteamento (reservado para uso futuro).
28
- * @property createdAt Timestamp (timestamptz) de criação do registro.
29
- * @property updatedAt Timestamp (timestamptz) da última atualização do registro.
30
18
  */
31
- // src/integration/entities/integration-outbound.entity.ts
32
- //
33
19
  import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn, UpdateDateColumn, } from "typeorm";
34
- /**
35
- * Definição de roteamento de saída por chave (evento) e destino.
36
- * Agora inclui também as configurações de Target/Delivery (protocolo, endpoint, templates, políticas, etc.).
37
- */
38
20
  let IntegrationOutbound = class IntegrationOutbound {
39
- id;
21
+ /** Identificador único do sistema de integração */
22
+ id; // manter string no TS para bigint seguro
40
23
  /** Sistema de origem (e.g., 'tms') */
41
24
  system;
42
25
  /** Evento (chave) (e.g., 'driver' or 'driver.created') */
43
26
  event;
44
- /** Ação (e.g., 'create', 'update', 'delete', etc */
27
+ /** Ação (e.g., 'create', 'update', 'delete', etc) */
45
28
  action;
46
29
  /** Sistema de destino (e.g., 'erp', 'wms') */
47
30
  targetSystem;
@@ -54,12 +37,13 @@ let IntegrationOutbound = class IntegrationOutbound {
54
37
  /** Regras (BRE RulesConfiguration) */
55
38
  rules;
56
39
  /** Opções adicionais (reservado para uso futuro) */
57
- options;
40
+ // @Column({ type: "jsonb", nullable: true })
41
+ // options?: Record<string, any> | null;
58
42
  createdAt;
59
43
  updatedAt;
60
44
  };
61
45
  __decorate([
62
- PrimaryGeneratedColumn("uuid")
46
+ PrimaryGeneratedColumn("identity", { type: "bigint", generatedIdentity: "ALWAYS" })
63
47
  ], IntegrationOutbound.prototype, "id", void 0);
64
48
  __decorate([
65
49
  Column({ type: "varchar", length: 80 })
@@ -83,19 +67,20 @@ __decorate([
83
67
  Column({ type: "varchar", length: 500, nullable: true })
84
68
  ], IntegrationOutbound.prototype, "description", void 0);
85
69
  __decorate([
86
- Column({ type: "jsonb" })
70
+ Column({ type: "jsonb", default: () => "'{}'::jsonb" })
87
71
  ], IntegrationOutbound.prototype, "rules", void 0);
88
72
  __decorate([
89
- Column({ type: "jsonb", nullable: true })
90
- ], IntegrationOutbound.prototype, "options", void 0);
91
- __decorate([
92
- CreateDateColumn({ name: "create_at", type: "timestamptz" })
73
+ CreateDateColumn({ name: "created_at", type: "timestamptz" })
93
74
  ], IntegrationOutbound.prototype, "createdAt", void 0);
94
75
  __decorate([
95
- UpdateDateColumn({ name: "update_at", type: "timestamptz" })
76
+ UpdateDateColumn({ name: "updated_at", type: "timestamptz" })
96
77
  ], IntegrationOutbound.prototype, "updatedAt", void 0);
97
78
  IntegrationOutbound = __decorate([
98
79
  Entity({ name: "integration_outbound" }),
99
- Index(["system", "event", "action", "targetSystem", "version"], { unique: true })
80
+ Index(["system", "event", "action", "targetSystem", "version"], { unique: true }),
81
+ Index("uq_integration_outbound_active", ["system", "event", "action", "targetSystem"], {
82
+ unique: true,
83
+ where: `"active" = true`,
84
+ })
100
85
  ], IntegrationOutbound);
101
86
  export { IntegrationOutbound };
@@ -1 +1 @@
1
- {"version":3,"file":"integration-system.entity.d.ts","sourceRoot":"","sources":["../../../../src/db/entities/integration/integration-system.entity.ts"],"names":[],"mappings":"AAEA,qBACa,iBAAiB;IAC5B,mDAAmD;IAEnD,EAAE,EAAG,MAAM,CAAC;IAEZ,yDAAyD;IAGzD,MAAM,EAAG,MAAM,CAAC;IAEhB,8BAA8B;IAE9B,MAAM,EAAG,OAAO,CAAC;IAGjB,SAAS,EAAG,IAAI,CAAC;IAGjB,SAAS,EAAG,IAAI,CAAC;CAElB"}
1
+ {"version":3,"file":"integration-system.entity.d.ts","sourceRoot":"","sources":["../../../../src/db/entities/integration/integration-system.entity.ts"],"names":[],"mappings":"AAaA,qBAEa,iBAAiB;IAC5B,mDAAmD;IAEnD,EAAE,EAAG,MAAM,CAAC;IAEZ,yDAAyD;IAEzD,MAAM,EAAG,MAAM,CAAC;IAEhB,8BAA8B;IAE9B,MAAM,EAAG,OAAO,CAAC;IAGjB,SAAS,EAAG,IAAI,CAAC;IAGjB,SAAS,EAAG,IAAI,CAAC;CAElB"}
@@ -4,10 +4,21 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
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
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
+ /**
8
+ * Representa um sistema de integração registrado na aplicação.
9
+ *
10
+ * Cada instância mapeia uma linha da tabela "integration_system".
11
+ *
12
+ * @property id Identificador único do sistema de integração (armazenado como bigint no banco). Mantém-se como string no TypeScript para evitar perda de precisão com bigints.
13
+ * @property system Nome único do sistema de integração (ex.: 'erp', 'tms'). Campo varchar com até 80 caracteres.
14
+ * @property active Flag que indica se o sistema está ativo. Valor booleano; padrão: true.
15
+ * @property createdAt Carimbo de data/hora de criação (timestamptz).
16
+ * @property updatedAt Carimbo de data/hora da última atualização (timestamptz).
17
+ */
7
18
  import { Column, Entity, PrimaryGeneratedColumn, Index, CreateDateColumn, UpdateDateColumn } from 'typeorm';
8
19
  let IntegrationSystem = class IntegrationSystem {
9
20
  /** Identificador único do sistema de integração */
10
- id;
21
+ id; // manter string no TS para bigint seguro
11
22
  /** Nome do sistema de integração (e.g., 'erp', 'tms') */
12
23
  system;
13
24
  /** Se o sistema está ativo */
@@ -16,22 +27,22 @@ let IntegrationSystem = class IntegrationSystem {
16
27
  updatedAt;
17
28
  };
18
29
  __decorate([
19
- PrimaryGeneratedColumn('uuid')
30
+ PrimaryGeneratedColumn("identity", { type: "bigint", generatedIdentity: "ALWAYS" })
20
31
  ], IntegrationSystem.prototype, "id", void 0);
21
32
  __decorate([
22
- Index({ unique: true }),
23
33
  Column({ type: 'varchar', length: 80 })
24
34
  ], IntegrationSystem.prototype, "system", void 0);
25
35
  __decorate([
26
36
  Column({ type: 'boolean', default: true })
27
37
  ], IntegrationSystem.prototype, "active", void 0);
28
38
  __decorate([
29
- CreateDateColumn({ name: "create_at", type: "timestamptz" })
39
+ CreateDateColumn({ name: "created_at", type: "timestamptz" })
30
40
  ], IntegrationSystem.prototype, "createdAt", void 0);
31
41
  __decorate([
32
- UpdateDateColumn({ name: "update_at", type: "timestamptz" })
42
+ UpdateDateColumn({ name: "updated_at", type: "timestamptz" })
33
43
  ], IntegrationSystem.prototype, "updatedAt", void 0);
34
44
  IntegrationSystem = __decorate([
35
- Entity({ name: 'integration_system' })
45
+ Entity({ name: 'integration_system' }),
46
+ Index(["system"], { unique: true })
36
47
  ], IntegrationSystem);
37
48
  export { IntegrationSystem };
@@ -0,0 +1,54 @@
1
+ import { HttpMethod } from "./integration.enums.js";
2
+ export interface EndpointHttpConfig {
3
+ method: HttpMethod;
4
+ pathTemplate?: string;
5
+ headersTemplate?: Record<string, string>;
6
+ queryTemplate?: Record<string, any>;
7
+ bodyTemplate?: any;
8
+ contentType?: string;
9
+ timeoutMs?: number;
10
+ compression?: {
11
+ type?: 'gzip' | 'deflate' | 'br';
12
+ };
13
+ }
14
+ export interface EndpointQueueConfig {
15
+ topic?: string;
16
+ queue?: string;
17
+ exchange?: string;
18
+ routingKey?: string;
19
+ partitionKey?: string;
20
+ messageKey?: string;
21
+ headersTemplate?: Record<string, string>;
22
+ properties?: Record<string, any>;
23
+ payloadTemplate?: any;
24
+ }
25
+ export interface EndpointTlsConfig {
26
+ rejectUnauthorized?: boolean;
27
+ ca?: string;
28
+ cert?: string;
29
+ key?: string;
30
+ }
31
+ export interface EndpointRetryPolicy {
32
+ maxAttempts?: number;
33
+ strategy?: 'exponential' | 'fixed';
34
+ delayMs?: number;
35
+ maxDelayMs?: number;
36
+ jitter?: boolean;
37
+ }
38
+ export interface EndpointRateLimitConfig {
39
+ strategy?: 'fixed-window' | 'token-bucket';
40
+ limit?: number;
41
+ intervalMs?: number;
42
+ burst?: number;
43
+ }
44
+ export interface EndpointBreakerPolicy {
45
+ threshold?: number;
46
+ openMs?: number;
47
+ halfOpenMaxAttempts?: number;
48
+ }
49
+ export interface EndpointIdempotencyConfig {
50
+ strategy: 'header' | 'bodyHash' | 'custom';
51
+ headerName?: string;
52
+ ttlMs?: number;
53
+ }
54
+ //# sourceMappingURL=integration.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration.interface.d.ts","sourceRoot":"","sources":["../../../../src/db/entities/integration/integration.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,UAAU,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpC,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAA;KAAE,CAAC;CACpD;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,eAAe,CAAC,EAAE,GAAG,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,cAAc,GAAG,cAAc,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cargolift-cdi/types",
3
- "version": "0.1.46",
3
+ "version": "0.1.48",
4
4
  "description": "TypeScript types e interfaces comuns para projetos Cargolift CDI",
5
5
  "keywords": [
6
6
  "typescript",