@cargolift-cdi/types 0.1.135 → 0.1.136

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.
@@ -0,0 +1,22 @@
1
+ export declare class IntegrationEvent {
2
+ id: string;
3
+ /** Evento (e.g., 'driver') */
4
+ event: string;
5
+ /** Versão do evento. Apenas a última versão pode estar ativa. Versões anteriores não podem sofrer modificações */
6
+ version: number;
7
+ /**Se a evento está ativa */
8
+ active: boolean;
9
+ /** Descrição opcional amigável ao usuário */
10
+ description?: string | null;
11
+ /**
12
+ * Modo de roteamento do evento
13
+ * - 'direct': Roteia diretamente para sistemas de destino sem passar pelo ODS
14
+ * - 'ods': Roteia para o ODS (Operational Data Store) antes de enviar para sistemas de destino
15
+ * - 'mdos': Roteia para fila de dados mestres (MDOS) antes de enviar para sistemas de destino
16
+ */
17
+ routingMode: "direct" | "ods" | "mdos";
18
+ /** Opções adicionais (reservado para uso futuro) */
19
+ createdAt: Date;
20
+ updatedAt: Date;
21
+ }
22
+ //# sourceMappingURL=integration-event.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration-event.entity.d.ts","sourceRoot":"","sources":["../../src/entities/integration-event.entity.ts"],"names":[],"mappings":"AAcA,qBAMa,gBAAgB;IAE3B,EAAE,EAAG,MAAM,CAAC;IAEZ,8BAA8B;IAE9B,KAAK,EAAG,MAAM,CAAC;IAEf,kHAAkH;IAElH,OAAO,EAAG,MAAM,CAAC;IAEjB,4BAA4B;IAE5B,MAAM,EAAG,OAAO,CAAC;IAEjB,6CAA6C;IAE7C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B;;;;;OAKG;IAEH,WAAW,EAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IAExC,oDAAoD;IAKpD,SAAS,EAAG,IAAI,CAAC;IAGjB,SAAS,EAAG,IAAI,CAAC;CAClB"}
@@ -0,0 +1,74 @@
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 IntegrationEvent - Define eventos de integração e modos de roteamento.
9
+ * @author Israel A. Possoli
10
+ * @date 2026-01-19
11
+ *
12
+ * @remarks
13
+ * - Cada combinação (event, version) é única.
14
+ * - Apenas uma versão por (event) pode estar ativa ao mesmo tempo.
15
+ * - Versões anteriores devem ser imutáveis após a publicação de novas versões.
16
+ * - O modo de roteamento define como o evento será processado dentro do middleware (direto, via ODS ou via MDOS).
17
+ */
18
+ import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
19
+ let IntegrationEvent = class IntegrationEvent {
20
+ id; // manter string no TS para bigint seguro
21
+ /** Evento (e.g., 'driver') */
22
+ event;
23
+ /** Versão do evento. Apenas a última versão pode estar ativa. Versões anteriores não podem sofrer modificações */
24
+ version;
25
+ /**Se a evento está ativa */
26
+ active;
27
+ /** Descrição opcional amigável ao usuário */
28
+ description;
29
+ /**
30
+ * Modo de roteamento do evento
31
+ * - 'direct': Roteia diretamente para sistemas de destino sem passar pelo ODS
32
+ * - 'ods': Roteia para o ODS (Operational Data Store) antes de enviar para sistemas de destino
33
+ * - 'mdos': Roteia para fila de dados mestres (MDOS) antes de enviar para sistemas de destino
34
+ */
35
+ routingMode;
36
+ /** Opções adicionais (reservado para uso futuro) */
37
+ // @Column({ type: "jsonb", nullable: true })
38
+ // options?: Record<string, any> | null;
39
+ createdAt;
40
+ updatedAt;
41
+ };
42
+ __decorate([
43
+ PrimaryGeneratedColumn("identity", { type: "bigint", generatedIdentity: "ALWAYS" })
44
+ ], IntegrationEvent.prototype, "id", void 0);
45
+ __decorate([
46
+ Column({ type: "varchar", length: 80 })
47
+ ], IntegrationEvent.prototype, "event", void 0);
48
+ __decorate([
49
+ Column({ type: "int", default: 1 })
50
+ ], IntegrationEvent.prototype, "version", void 0);
51
+ __decorate([
52
+ Column({ type: "boolean", default: true })
53
+ ], IntegrationEvent.prototype, "active", void 0);
54
+ __decorate([
55
+ Column({ type: "varchar", length: 500, nullable: true })
56
+ ], IntegrationEvent.prototype, "description", void 0);
57
+ __decorate([
58
+ Column({ type: "varchar", length: 20, default: "ods" })
59
+ ], IntegrationEvent.prototype, "routingMode", void 0);
60
+ __decorate([
61
+ CreateDateColumn({ name: "created_at", type: "timestamptz" })
62
+ ], IntegrationEvent.prototype, "createdAt", void 0);
63
+ __decorate([
64
+ UpdateDateColumn({ name: "updated_at", type: "timestamptz" })
65
+ ], IntegrationEvent.prototype, "updatedAt", void 0);
66
+ IntegrationEvent = __decorate([
67
+ Entity({ name: "integration_event" }),
68
+ Index(["event", "version"], { unique: true }),
69
+ Index("uq_integration_event_active", ["event"], {
70
+ unique: true,
71
+ where: `"active" = true`,
72
+ })
73
+ ], IntegrationEvent);
74
+ export { IntegrationEvent };
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export * from './interfaces/api-response.interface.js';
10
10
  export * from './interfaces/integration.interface.js';
11
11
  export * from './interfaces/payload-condition.interface.js';
12
12
  export * from './entities/integration-system.entity.js';
13
+ export * from './entities/integration-event.entity.js';
13
14
  export * from './entities/integration-inbound.entity.js';
14
15
  export * from './entities/integration-outbound.entity.js';
15
16
  export * from './entities/integration-endpoint.entity.js';
@@ -19,6 +20,7 @@ export * from './entities/log-integration-inbound.entity.js';
19
20
  export * from './entities/log-integration-outbound.entity.js';
20
21
  export * from './enum/integration.enums.js';
21
22
  export * from './enum/error-type.enum.js';
23
+ export * from './repository/integration-event-repository.service.js';
22
24
  export * from './repository/integration-inbound-repository.service.js';
23
25
  export * from './repository/integration-outbound-repository.service.js';
24
26
  export * from './repository/integration-endpoint-repository.service.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,qCAAqC,CAAC;AACpD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wCAAwC,CAAC;AACvD,cAAc,wCAAwC,CAAC;AACvD,cAAc,uCAAuC,CAAC;AACtD,cAAc,6CAA6C,CAAC;AAG5D,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AACzD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,yCAAyC,CAAC;AACxD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,+CAA+C,CAAC;AAG9D,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAG1C,cAAc,wDAAwD,CAAC;AACvE,cAAc,yDAAyD,CAAC;AACxE,cAAc,yDAAyD,CAAC;AACxE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,uDAAuD,CAAC;AACtE,cAAc,iDAAiD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,qCAAqC,CAAC;AACpD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wCAAwC,CAAC;AACvD,cAAc,wCAAwC,CAAC;AACvD,cAAc,uCAAuC,CAAC;AACtD,cAAc,6CAA6C,CAAC;AAG5D,cAAc,yCAAyC,CAAC;AACxD,cAAc,wCAAwC,CAAC;AACvD,cAAc,0CAA0C,CAAC;AACzD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,yCAAyC,CAAC;AACxD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,+CAA+C,CAAC;AAG9D,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAG1C,cAAc,sDAAsD,CAAC;AACrE,cAAc,wDAAwD,CAAC;AACvE,cAAc,yDAAyD,CAAC;AACxE,cAAc,yDAAyD,CAAC;AACxE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,uDAAuD,CAAC;AACtE,cAAc,iDAAiD,CAAC"}
package/dist/index.js CHANGED
@@ -11,6 +11,7 @@ export * from './interfaces/integration.interface.js';
11
11
  export * from './interfaces/payload-condition.interface.js';
12
12
  // Entidades
13
13
  export * from './entities/integration-system.entity.js';
14
+ export * from './entities/integration-event.entity.js';
14
15
  export * from './entities/integration-inbound.entity.js';
15
16
  export * from './entities/integration-outbound.entity.js';
16
17
  export * from './entities/integration-endpoint.entity.js';
@@ -22,6 +23,7 @@ export * from './entities/log-integration-outbound.entity.js';
22
23
  export * from './enum/integration.enums.js';
23
24
  export * from './enum/error-type.enum.js';
24
25
  // Repositórios
26
+ export * from './repository/integration-event-repository.service.js';
25
27
  export * from './repository/integration-inbound-repository.service.js';
26
28
  export * from './repository/integration-outbound-repository.service.js';
27
29
  export * from './repository/integration-endpoint-repository.service.js';
@@ -0,0 +1,8 @@
1
+ import { Repository } from "typeorm";
2
+ import { IntegrationEvent } from "../entities/integration-event.entity.js";
3
+ export declare class EventRepositoryService {
4
+ private readonly repo;
5
+ constructor(repo: Repository<IntegrationEvent>);
6
+ get(event: string): Promise<IntegrationEvent[]>;
7
+ }
8
+ //# sourceMappingURL=integration-event-repository.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration-event-repository.service.d.ts","sourceRoot":"","sources":["../../src/repository/integration-event-repository.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAE3E,qBACa,sBAAsB;IAG/B,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC;IAG/C,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAGtD"}
@@ -0,0 +1,26 @@
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
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
8
+ return function (target, key) { decorator(target, key, paramIndex); }
9
+ };
10
+ import { Injectable } from "@nestjs/common";
11
+ import { InjectRepository } from "@nestjs/typeorm";
12
+ import { IntegrationEvent } from "../entities/integration-event.entity.js";
13
+ let EventRepositoryService = class EventRepositoryService {
14
+ repo;
15
+ constructor(repo) {
16
+ this.repo = repo;
17
+ }
18
+ async get(event) {
19
+ return await this.repo.find({ where: { event, active: true }, order: { version: "DESC" } });
20
+ }
21
+ };
22
+ EventRepositoryService = __decorate([
23
+ Injectable(),
24
+ __param(0, InjectRepository(IntegrationEvent))
25
+ ], EventRepositoryService);
26
+ export { EventRepositoryService };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cargolift-cdi/types",
3
- "version": "0.1.135",
3
+ "version": "0.1.136",
4
4
  "description": "TypeScript types e interfaces comuns para projetos Cargolift CDI",
5
5
  "keywords": [
6
6
  "typescript",