@cargolift-cdi/types 0.1.33 → 0.1.34

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.
@@ -5,8 +5,10 @@ import { HttpMethod, TransportProtocol } from "./integration.enums.js";
5
5
  */
6
6
  export declare class IntegrationEndpoint {
7
7
  id: string;
8
- /** Sistema do endpoint (e.g., 'tms') */
9
- name: string;
8
+ /** Sistema de destino (e.g., 'erp', 'wms') */
9
+ system: string;
10
+ /** Evento (chave) (e.g., 'driver' or 'driver.created') */
11
+ event: string;
10
12
  active: boolean;
11
13
  /** ===================== Target/Delivery (simplificado no próprio Outbound) ===================== */
12
14
  /**
@@ -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,wCAAwC;IAExC,IAAI,EAAG,MAAM,CAAC;IAGd,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,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,IAAI,CAAC;IAET;;;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":"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;IAGf,MAAM,EAAG,OAAO,CAAC;IAGjB,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,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,IAAI,CAAC;IAET;;;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"}
@@ -15,8 +15,10 @@ import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn, Update
15
15
  */
16
16
  let IntegrationEndpoint = class IntegrationEndpoint {
17
17
  id;
18
- /** Sistema do endpoint (e.g., 'tms') */
19
- name;
18
+ /** Sistema de destino (e.g., 'erp', 'wms') */
19
+ system;
20
+ /** Evento (chave) (e.g., 'driver' or 'driver.created') */
21
+ event;
20
22
  active;
21
23
  /** ===================== Target/Delivery (simplificado no próprio Outbound) ===================== */
22
24
  /**
@@ -87,9 +89,12 @@ let IntegrationEndpoint = class IntegrationEndpoint {
87
89
  __decorate([
88
90
  PrimaryGeneratedColumn("uuid")
89
91
  ], IntegrationEndpoint.prototype, "id", void 0);
92
+ __decorate([
93
+ Column({ name: "target_system", type: "varchar", length: 80 })
94
+ ], IntegrationEndpoint.prototype, "system", void 0);
90
95
  __decorate([
91
96
  Column({ type: "varchar", length: 80 })
92
- ], IntegrationEndpoint.prototype, "name", void 0);
97
+ ], IntegrationEndpoint.prototype, "event", void 0);
93
98
  __decorate([
94
99
  Column({ type: "boolean", default: true })
95
100
  ], IntegrationEndpoint.prototype, "active", void 0);
@@ -131,7 +136,7 @@ __decorate([
131
136
  ], IntegrationEndpoint.prototype, "updatedAt", void 0);
132
137
  IntegrationEndpoint = __decorate([
133
138
  Entity({ name: "integration_endpoint" }),
134
- Index(["name", "active"], { unique: true }),
139
+ Index(["system", "event", "active"], { unique: true }),
135
140
  Index(["credentialId"])
136
141
  ], IntegrationEndpoint);
137
142
  export { IntegrationEndpoint };
@@ -18,7 +18,6 @@ export declare class IntegrationOutbound {
18
18
  rules: Record<string, any>;
19
19
  /** Se a rota está ativa */
20
20
  active: boolean;
21
- endpointId?: string | null;
22
21
  /** Opções adicionais (reservado para uso futuro) */
23
22
  options?: Record<string, any> | null;
24
23
  createdAt: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"integration-outbound.entity.d.ts","sourceRoot":"","sources":["../../../../src/db/entities/integration/integration-outbound.entity.ts"],"names":[],"mappings":"AAmCA;;;GAGG;AACH,qBAGa,mBAAmB;IAE9B,EAAE,EAAG,MAAM,CAAC;IAEZ,sCAAsC;IAEtC,MAAM,EAAG,MAAM,CAAC;IAEhB,8CAA8C;IAE9C,YAAY,EAAG,MAAM,CAAC;IAEtB,0DAA0D;IAE1D,KAAK,EAAG,MAAM,CAAC;IAEf,gHAAgH;IAEhH,OAAO,EAAG,MAAM,CAAC;IAEjB,gBAAgB;IAEhB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,sCAAsC;IAEtC,KAAK,EAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE5B,2BAA2B;IAE3B,MAAM,EAAG,OAAO,CAAC;IAIjB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3B,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":"AAmCA;;;GAGG;AACH,qBAGa,mBAAmB;IAE9B,EAAE,EAAG,MAAM,CAAC;IAEZ,sCAAsC;IAEtC,MAAM,EAAG,MAAM,CAAC;IAEhB,8CAA8C;IAE9C,YAAY,EAAG,MAAM,CAAC;IAEtB,0DAA0D;IAE1D,KAAK,EAAG,MAAM,CAAC;IAEf,gHAAgH;IAEhH,OAAO,EAAG,MAAM,CAAC;IAEjB,gBAAgB;IAEhB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,sCAAsC;IAEtC,KAAK,EAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE5B,2BAA2B;IAE3B,MAAM,EAAG,OAAO,CAAC;IAEjB,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"}
@@ -51,8 +51,6 @@ let IntegrationOutbound = class IntegrationOutbound {
51
51
  rules;
52
52
  /** Se a rota está ativa */
53
53
  active;
54
- /* Referência o perfil de endpoint (IntegrationEndpoint.id). */
55
- endpointId;
56
54
  /** Opções adicionais (reservado para uso futuro) */
57
55
  options;
58
56
  createdAt;
@@ -82,9 +80,6 @@ __decorate([
82
80
  __decorate([
83
81
  Column({ type: "boolean", default: true })
84
82
  ], IntegrationOutbound.prototype, "active", void 0);
85
- __decorate([
86
- Column({ name: "endpoint_id", type: "uuid", nullable: true })
87
- ], IntegrationOutbound.prototype, "endpointId", void 0);
88
83
  __decorate([
89
84
  Column({ type: "jsonb", nullable: true })
90
85
  ], IntegrationOutbound.prototype, "options", void 0);
@@ -3,6 +3,6 @@ import { IntegrationCredential } from '../entities/integration/integration-crede
3
3
  export declare class CredentialRepositoryService {
4
4
  private readonly repo;
5
5
  constructor(repo: Repository<IntegrationCredential>);
6
- findOne(credentialId: string): Promise<IntegrationCredential | null>;
6
+ find(credentialId: string): Promise<IntegrationCredential | null>;
7
7
  }
8
8
  //# sourceMappingURL=integration-credential-repository.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"integration-credential-repository.service.d.ts","sourceRoot":"","sources":["../../../src/db/repository/integration-credential-repository.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,0DAA0D,CAAC;AAGjG,qBACa,2BAA2B;IAGpC,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU,CAAC,qBAAqB,CAAC;IAGpD,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;CAG3E"}
1
+ {"version":3,"file":"integration-credential-repository.service.d.ts","sourceRoot":"","sources":["../../../src/db/repository/integration-credential-repository.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,0DAA0D,CAAC;AAGjG,qBACa,2BAA2B;IAGpC,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU,CAAC,qBAAqB,CAAC;IAGpD,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;CAGxE"}
@@ -15,7 +15,7 @@ let CredentialRepositoryService = class CredentialRepositoryService {
15
15
  constructor(repo) {
16
16
  this.repo = repo;
17
17
  }
18
- async findOne(credentialId) {
18
+ async find(credentialId) {
19
19
  return await this.repo.findOne({ where: { id: credentialId, active: true } });
20
20
  }
21
21
  };
@@ -1,8 +1,11 @@
1
1
  import { Repository } from 'typeorm';
2
2
  import { IntegrationEndpoint } from '../entities/integration/integration-endpoint.js';
3
+ import { IntegrationCredential } from '../entities/integration/integration-credential.entity.js';
3
4
  export declare class EndpointRepositoryService {
4
5
  private readonly repo;
5
- constructor(repo: Repository<IntegrationEndpoint>);
6
- findOne(endpointId: string): Promise<IntegrationEndpoint | null>;
6
+ private readonly repoCredential;
7
+ constructor(repo: Repository<IntegrationEndpoint>, repoCredential: Repository<IntegrationCredential>);
8
+ find(system: string, event: string): Promise<IntegrationEndpoint | null>;
9
+ getCredential(endpoint: IntegrationEndpoint): Promise<IntegrationCredential | null>;
7
10
  }
8
11
  //# sourceMappingURL=integration-endpoint-repository.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"integration-endpoint-repository.service.d.ts","sourceRoot":"","sources":["../../../src/db/repository/integration-endpoint-repository.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAGtF,qBACa,yBAAyB;IAGlC,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU,CAAC,mBAAmB,CAAC;IAGlD,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;CAGvE"}
1
+ {"version":3,"file":"integration-endpoint-repository.service.d.ts","sourceRoot":"","sources":["../../../src/db/repository/integration-endpoint-repository.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,0DAA0D,CAAC;AAGjG,qBACa,yBAAyB;IAGlC,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,cAAc;gBADd,IAAI,EAAE,UAAU,CAAC,mBAAmB,CAAC,EACrC,cAAc,EAAE,UAAU,CAAC,qBAAqB,CAAC;IAG9D,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAIxE,aAAa,CAAC,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;CAI1F"}
@@ -12,11 +12,18 @@ import { InjectRepository } from '@nestjs/typeorm';
12
12
  import { IntegrationEndpoint } from '../entities/integration/integration-endpoint.js';
13
13
  let EndpointRepositoryService = class EndpointRepositoryService {
14
14
  repo;
15
- constructor(repo) {
15
+ repoCredential;
16
+ constructor(repo, repoCredential) {
16
17
  this.repo = repo;
18
+ this.repoCredential = repoCredential;
17
19
  }
18
- async findOne(endpointId) {
19
- return await this.repo.findOne({ where: { id: endpointId, active: true } });
20
+ async find(system, event) {
21
+ return await this.repo.findOne({ where: { system, event, active: true } });
22
+ }
23
+ async getCredential(endpoint) {
24
+ if (!endpoint?.credentialId)
25
+ return null;
26
+ return await this.repoCredential.findOne({ where: { id: endpoint.credentialId, active: true } });
20
27
  }
21
28
  };
22
29
  EndpointRepositoryService = __decorate([
@@ -1,9 +1,9 @@
1
- import { Repository } from 'typeorm';
2
- import { IntegrationOutbound } from '../entities/integration/integration-outbound.entity.js';
1
+ import { Repository } from "typeorm";
2
+ import { IntegrationOutbound } from "../entities/integration/integration-outbound.entity.js";
3
3
  export declare class OutboundRepositoryService {
4
4
  private readonly repo;
5
5
  constructor(repo: Repository<IntegrationOutbound>);
6
6
  getRoutes(system: string, event: string): Promise<IntegrationOutbound[]>;
7
- findOne(system: string, event: string): Promise<IntegrationOutbound | null>;
7
+ find(system: string, event: string): Promise<IntegrationOutbound | null>;
8
8
  }
9
9
  //# sourceMappingURL=integration-outbound-repository.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"integration-outbound-repository.service.d.ts","sourceRoot":"","sources":["../../../src/db/repository/integration-outbound-repository.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAG7F,qBACa,yBAAyB;IAGlC,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU,CAAC,mBAAmB,CAAC;IAGlD,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAKxE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;CAGlF"}
1
+ {"version":3,"file":"integration-outbound-repository.service.d.ts","sourceRoot":"","sources":["../../../src/db/repository/integration-outbound-repository.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAE7F,qBACa,yBAAyB;IAGlC,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU,CAAC,mBAAmB,CAAC;IAGlD,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAIxE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;CAG/E"}
@@ -7,19 +7,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __param = (this && this.__param) || function (paramIndex, decorator) {
8
8
  return function (target, key) { decorator(target, key, paramIndex); }
9
9
  };
10
- import { Injectable } from '@nestjs/common';
11
- import { InjectRepository } from '@nestjs/typeorm';
12
- import { IntegrationOutbound } from '../entities/integration/integration-outbound.entity.js';
10
+ import { Injectable } from "@nestjs/common";
11
+ import { InjectRepository } from "@nestjs/typeorm";
12
+ import { IntegrationOutbound } from "../entities/integration/integration-outbound.entity.js";
13
13
  let OutboundRepositoryService = class OutboundRepositoryService {
14
14
  repo;
15
15
  constructor(repo) {
16
16
  this.repo = repo;
17
17
  }
18
18
  async getRoutes(system, event) {
19
- return this.repo.find({ where: { system, event, active: true }, order: { version: 'DESC' } });
19
+ return this.repo.find({ where: { system, event, active: true }, order: { version: "DESC" } });
20
20
  }
21
- async findOne(system, event) {
22
- return this.repo.findOne({ where: { system, event, active: true }, order: { version: 'DESC' } });
21
+ async find(system, event) {
22
+ return this.repo.findOne({ where: { system, event, active: true }, order: { version: "DESC" } });
23
23
  }
24
24
  };
25
25
  OutboundRepositoryService = __decorate([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cargolift-cdi/types",
3
- "version": "0.1.33",
3
+ "version": "0.1.34",
4
4
  "description": "TypeScript types e interfaces comuns para projetos Cargolift CDI",
5
5
  "keywords": [
6
6
  "typescript",