@cargolift-cdi/types 0.1.47 → 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,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.).
@@ -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 | null;
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":"AA6EA,OAAO,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AC,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"}
@@ -101,7 +101,17 @@ let IntegrationEndpoint = class IntegrationEndpoint {
101
101
  * - sqs/pubsub: pode ser arn/topic/queue ou projeto+tópico
102
102
  */
103
103
  endpoint;
104
- 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;
105
115
  /**
106
116
  * Config HTTP específica (quando transport = 'http'):
107
117
  * {
@@ -127,15 +137,6 @@ let IntegrationEndpoint = class IntegrationEndpoint {
127
137
  * }
128
138
  */
129
139
  queueConfig;
130
- /**
131
- * Referência a credenciais reutilizáveis (IntegrationCredential.id).
132
- */
133
- credentialId;
134
- /**
135
- * Opções de TLS/MTLS, certificados, SNI etc.
136
- * Ex.: { rejectUnauthorized: true, ca?: string, cert?: string, key?: string, servername?: string }
137
- */
138
- tls;
139
140
  /**
140
141
  * Política de retentativa:
141
142
  * { maxAttempts: 3, strategy: 'exponential' | 'fixed', delayMs: 1000, maxDelayMs?: 60000, jitter?: true }
@@ -161,7 +162,10 @@ let IntegrationEndpoint = class IntegrationEndpoint {
161
162
  * Idempotência:
162
163
  * { strategy: 'header' | 'bodyHash' | 'custom', headerName?: 'Idempotency-Key', ttlMs?: 300000 }
163
164
  */
164
- idempotency;
165
+ /*
166
+ @Column({ type: "jsonb", nullable: true })
167
+ idempotency?: Record<string, any> | null;
168
+ */
165
169
  createdAt;
166
170
  updatedAt;
167
171
  };
@@ -190,20 +194,17 @@ __decorate([
190
194
  Column({ type: "varchar", length: 500 })
191
195
  ], IntegrationEndpoint.prototype, "endpoint", void 0);
192
196
  __decorate([
193
- Column({ name: "http_method", type: "varchar", length: 10, default: 'POST', nullable: true })
194
- ], 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);
195
202
  __decorate([
196
203
  Column({ name: "http_config", type: "jsonb", nullable: true })
197
204
  ], IntegrationEndpoint.prototype, "httpConfig", void 0);
198
205
  __decorate([
199
206
  Column({ name: "queue_config", type: "jsonb", nullable: true })
200
207
  ], IntegrationEndpoint.prototype, "queueConfig", void 0);
201
- __decorate([
202
- Column({ name: "credential_id", type: "bigint", nullable: true })
203
- ], IntegrationEndpoint.prototype, "credentialId", void 0);
204
- __decorate([
205
- Column({ type: "jsonb", nullable: true })
206
- ], IntegrationEndpoint.prototype, "tls", void 0);
207
208
  __decorate([
208
209
  Column({ name: "retry_policy", type: "jsonb", nullable: true })
209
210
  ], IntegrationEndpoint.prototype, "retryPolicy", void 0);
@@ -216,9 +217,6 @@ __decorate([
216
217
  __decorate([
217
218
  Column({ name: "max_concurrent_per_endpoint", type: "int", nullable: true })
218
219
  ], IntegrationEndpoint.prototype, "maxConcurrentPerEndpoint", void 0);
219
- __decorate([
220
- Column({ type: "jsonb", nullable: true })
221
- ], IntegrationEndpoint.prototype, "idempotency", void 0);
222
220
  __decorate([
223
221
  CreateDateColumn({ name: "created_at", type: "timestamptz" })
224
222
  ], IntegrationEndpoint.prototype, "createdAt", void 0);
@@ -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.47",
3
+ "version": "0.1.48",
4
4
  "description": "TypeScript types e interfaces comuns para projetos Cargolift CDI",
5
5
  "keywords": [
6
6
  "typescript",