@cargolift-cdi/types 0.1.41 → 0.1.43

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.
@@ -109,7 +109,7 @@ __decorate([
109
109
  Column({ type: "varchar", length: 80 })
110
110
  ], IntegrationEndpoint.prototype, "event", void 0);
111
111
  __decorate([
112
- Column({ type: "varchar", length: 10 })
112
+ Column({ type: "varchar", length: 40 })
113
113
  ], IntegrationEndpoint.prototype, "action", void 0);
114
114
  __decorate([
115
115
  Column({ type: "boolean", default: true })
@@ -45,7 +45,7 @@ __decorate([
45
45
  Column({ type: "varchar", length: 80 })
46
46
  ], IntegrationInbound.prototype, "event", void 0);
47
47
  __decorate([
48
- Column({ type: "varchar", length: 10 })
48
+ Column({ type: "varchar", length: 40 })
49
49
  ], IntegrationInbound.prototype, "action", void 0);
50
50
  __decorate([
51
51
  Column({ type: "int", default: 1 })
@@ -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,qBAEa,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,oDAAoD;IAEpD,MAAM,EAAG,MAAM,CAAC;IAEhB,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"}
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,8CAA8C;IAE9C,YAAY,EAAG,MAAM,CAAC;IAEtB,0DAA0D;IAE1D,KAAK,EAAG,MAAM,CAAC;IAEb,oDAAoD;IAEtD,MAAM,EAAG,MAAM,CAAC;IAEhB,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"}
@@ -71,7 +71,7 @@ __decorate([
71
71
  Column({ type: "varchar", length: 80 })
72
72
  ], IntegrationOutbound.prototype, "event", void 0);
73
73
  __decorate([
74
- Column({ type: "varchar", length: 10 })
74
+ Column({ type: "varchar", length: 40 })
75
75
  ], IntegrationOutbound.prototype, "action", void 0);
76
76
  __decorate([
77
77
  Column({ type: "int", default: 1 })
@@ -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;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,0DAA0D,CAAC;AAGjG,qBACa,yBAAyB;IAGlC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAErB,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAFd,IAAI,EAAE,UAAU,CAAC,mBAAmB,CAAC,EAErC,cAAc,EAAE,UAAU,CAAC,qBAAqB,CAAC;IAG9D,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAIxF,aAAa,CAAC,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;CAI1F"}
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;IAErB,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAFd,IAAI,EAAE,UAAU,CAAC,mBAAmB,CAAC,EAErC,cAAc,EAAE,UAAU,CAAC,qBAAqB,CAAC;IAG9D,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAqCxF,aAAa,CAAC,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;CAI1F"}
@@ -19,7 +19,33 @@ let EndpointRepositoryService = class EndpointRepositoryService {
19
19
  this.repoCredential = repoCredential;
20
20
  }
21
21
  async find(system, event, action) {
22
- return await this.repo.findOne({ where: { system, event, action, active: true } });
22
+ const qb = this.repo
23
+ .createQueryBuilder('integration_endpoint')
24
+ .where('integration_endpoint.system = :system', { system })
25
+ .andWhere('integration_endpoint.event = :event', { event })
26
+ .andWhere('integration_endpoint.active = :active', { active: true })
27
+ .andWhere(`(
28
+ integration_endpoint.action = 'all' OR
29
+ integration_endpoint.action = :action OR
30
+ integration_endpoint.action LIKE :actionListPrefix OR
31
+ integration_endpoint.action LIKE :actionListInfix OR
32
+ integration_endpoint.action LIKE :actionListSuffix
33
+ )`, {
34
+ action,
35
+ actionListPrefix: `${action},%`,
36
+ actionListInfix: `%,${action},%`,
37
+ actionListSuffix: `%,${action}`,
38
+ })
39
+ .orderBy(`CASE
40
+ WHEN integration_endpoint.action = :action THEN 1
41
+ WHEN integration_endpoint.action LIKE :actionListPrefix OR
42
+ integration_endpoint.action LIKE :actionListInfix OR
43
+ integration_endpoint.action LIKE :actionListSuffix THEN 2
44
+ WHEN integration_endpoint.action = 'all' THEN 3
45
+ ELSE 4
46
+ END`, 'ASC')
47
+ .addOrderBy('integration_endpoint.version', 'DESC');
48
+ return await qb.getOne();
23
49
  }
24
50
  async getCredential(endpoint) {
25
51
  if (!endpoint?.credentialId)
@@ -3,6 +3,6 @@ import { IntegrationInbound } from "../entities/integration/integration-inbound.
3
3
  export declare class InboundRepositoryService {
4
4
  private readonly repo;
5
5
  constructor(repo: Repository<IntegrationInbound>);
6
- getEvent(system: string, event: string, action: string): Promise<IntegrationInbound[]>;
6
+ get(system: string, event: string, action: string): Promise<IntegrationInbound[]>;
7
7
  }
8
8
  //# sourceMappingURL=integration-inbound-repository.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"integration-inbound-repository.service.d.ts","sourceRoot":"","sources":["../../../src/db/repository/integration-inbound-repository.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAG3F,qBACa,wBAAwB;IAGjC,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU,CAAC,kBAAkB,CAAC;IAGjD,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;CA+C7F"}
1
+ {"version":3,"file":"integration-inbound-repository.service.d.ts","sourceRoot":"","sources":["../../../src/db/repository/integration-inbound-repository.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAG3F,qBACa,wBAAwB;IAGjC,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU,CAAC,kBAAkB,CAAC;IAGjD,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;CAqFxF"}
@@ -15,17 +15,45 @@ let InboundRepositoryService = class InboundRepositoryService {
15
15
  constructor(repo) {
16
16
  this.repo = repo;
17
17
  }
18
- async getEvent(system, event, action) {
19
- return this.repo.find({
20
- where: { system, event, action, active: true },
21
- order: { version: "DESC" },
22
- })
23
- .then((events) => {
24
- return events;
25
- })
26
- .catch((err) => {
27
- throw err;
18
+ async get(system, event, action) {
19
+ const qb = this.repo
20
+ .createQueryBuilder("integration_inbound")
21
+ .where("integration_inbound.system = :system", { system })
22
+ .andWhere("integration_inbound.event = :event", { event })
23
+ .andWhere("integration_inbound.active = :active", { active: true })
24
+ .andWhere(`(
25
+ integration_inbound.action = 'all' OR
26
+ integration_inbound.action = :action OR
27
+ integration_inbound.action LIKE :actionListPrefix OR
28
+ integration_inbound.action LIKE :actionListInfix OR
29
+ integration_inbound.action LIKE :actionListSuffix
30
+ )`, {
31
+ action,
32
+ actionListPrefix: `${action},%`,
33
+ actionListInfix: `%,${action},%`,
34
+ actionListSuffix: `%,${action}`,
28
35
  });
36
+ const rows = await qb
37
+ .orderBy(`CASE
38
+ WHEN integration_inbound.action = :action THEN 1
39
+ WHEN integration_inbound.action LIKE :actionListPrefix OR
40
+ integration_inbound.action LIKE :actionListInfix OR
41
+ integration_inbound.action LIKE :actionListSuffix THEN 2
42
+ WHEN integration_inbound.action = 'all' THEN 3
43
+ ELSE 4
44
+ END`, "ASC")
45
+ .addOrderBy("integration_inbound.system", "ASC")
46
+ .addOrderBy("integration_inbound.event", "ASC")
47
+ .addOrderBy("integration_inbound.version", "DESC")
48
+ .getMany();
49
+ const resultMap = new Map();
50
+ for (const row of rows) {
51
+ const key = `${row.system}::${row.event}`;
52
+ if (!resultMap.has(key)) {
53
+ resultMap.set(key, row);
54
+ }
55
+ }
56
+ return Array.from(resultMap.values());
29
57
  }
30
58
  };
31
59
  InboundRepositoryService = __decorate([
@@ -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;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,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAIxF,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;CAG/F"}
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,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAqCxF,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;CAoC/F"}
@@ -16,10 +16,62 @@ let OutboundRepositoryService = class OutboundRepositoryService {
16
16
  this.repo = repo;
17
17
  }
18
18
  async getRoutes(system, event, action) {
19
- return this.repo.find({ where: { system, event, action, active: true }, order: { version: "DESC" } });
19
+ const qb = this.repo
20
+ .createQueryBuilder("integration_outbound")
21
+ .where("integration_outbound.system = :system", { system })
22
+ .andWhere("integration_outbound.event = :event", { event })
23
+ .andWhere("integration_outbound.active = :active", { active: true })
24
+ .andWhere(`(
25
+ integration_outbound.action = 'all' OR
26
+ integration_outbound.action = :action OR
27
+ integration_outbound.action LIKE :actionListPrefix OR
28
+ integration_outbound.action LIKE :actionListInfix OR
29
+ integration_outbound.action LIKE :actionListSuffix
30
+ )`, {
31
+ action,
32
+ actionListPrefix: `${action},%`,
33
+ actionListInfix: `%,${action},%`,
34
+ actionListSuffix: `%,${action}`,
35
+ })
36
+ .orderBy(`CASE
37
+ WHEN integration_outbound.action = :action THEN 1
38
+ WHEN integration_outbound.action LIKE :actionListPrefix OR
39
+ integration_outbound.action LIKE :actionListInfix OR
40
+ integration_outbound.action LIKE :actionListSuffix THEN 2
41
+ WHEN integration_outbound.action = 'all' THEN 3
42
+ ELSE 4
43
+ END`, "ASC")
44
+ .addOrderBy("integration_outbound.version", "DESC");
45
+ return qb.getMany();
20
46
  }
21
47
  async find(system, event, action) {
22
- return this.repo.findOne({ where: { system, event, action, active: true }, order: { version: "DESC" } });
48
+ const qb = this.repo
49
+ .createQueryBuilder("integration_outbound")
50
+ .where("integration_outbound.system = :system", { system })
51
+ .andWhere("integration_outbound.event = :event", { event })
52
+ .andWhere("integration_outbound.active = :active", { active: true })
53
+ .andWhere(`(
54
+ integration_outbound.action = 'all' OR
55
+ integration_outbound.action = :action OR
56
+ integration_outbound.action LIKE :actionListPrefix OR
57
+ integration_outbound.action LIKE :actionListInfix OR
58
+ integration_outbound.action LIKE :actionListSuffix
59
+ )`, {
60
+ action,
61
+ actionListPrefix: `${action},%`,
62
+ actionListInfix: `%,${action},%`,
63
+ actionListSuffix: `%,${action}`,
64
+ })
65
+ .orderBy(`CASE
66
+ WHEN integration_outbound.action = :action THEN 1
67
+ WHEN integration_outbound.action LIKE :actionListPrefix OR
68
+ integration_outbound.action LIKE :actionListInfix OR
69
+ integration_outbound.action LIKE :actionListSuffix THEN 2
70
+ WHEN integration_outbound.action = 'all' THEN 3
71
+ ELSE 4
72
+ END`, "ASC")
73
+ .addOrderBy("integration_outbound.version", "DESC");
74
+ return qb.getOne();
23
75
  }
24
76
  };
25
77
  OutboundRepositoryService = __decorate([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cargolift-cdi/types",
3
- "version": "0.1.41",
3
+ "version": "0.1.43",
4
4
  "description": "TypeScript types e interfaces comuns para projetos Cargolift CDI",
5
5
  "keywords": [
6
6
  "typescript",