@cargolift-cdi/types 0.1.42 → 0.1.44
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.
- package/dist/db/entities/integration/integration-endpoint.js +2 -2
- package/dist/db/entities/integration/integration-inbound.entity.d.ts +2 -2
- package/dist/db/entities/integration/integration-inbound.entity.d.ts.map +1 -1
- package/dist/db/entities/integration/integration-inbound.entity.js +7 -7
- package/dist/db/entities/integration/integration-outbound.entity.d.ts +4 -4
- package/dist/db/entities/integration/integration-outbound.entity.d.ts.map +1 -1
- package/dist/db/entities/integration/integration-outbound.entity.js +12 -12
- package/dist/db/repository/integration-endpoint-repository.service.d.ts.map +1 -1
- package/dist/db/repository/integration-endpoint-repository.service.js +27 -1
- package/dist/db/repository/integration-inbound-repository.service.d.ts.map +1 -1
- package/dist/db/repository/integration-inbound-repository.service.js +37 -9
- package/dist/db/repository/integration-outbound-repository.service.d.ts.map +1 -1
- package/dist/db/repository/integration-outbound-repository.service.js +54 -2
- package/package.json +1 -1
|
@@ -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:
|
|
112
|
+
Column({ type: "varchar", length: 40 })
|
|
113
113
|
], IntegrationEndpoint.prototype, "action", void 0);
|
|
114
114
|
__decorate([
|
|
115
115
|
Column({ type: "boolean", default: true })
|
|
@@ -158,7 +158,7 @@ __decorate([
|
|
|
158
158
|
], IntegrationEndpoint.prototype, "updatedAt", void 0);
|
|
159
159
|
IntegrationEndpoint = __decorate([
|
|
160
160
|
Entity({ name: "integration_endpoint" }),
|
|
161
|
-
Index(["system", "event", "active"], { unique: true }),
|
|
161
|
+
Index(["system", "event", "action", "active"], { unique: true }),
|
|
162
162
|
Index(["credentialId"])
|
|
163
163
|
], IntegrationEndpoint);
|
|
164
164
|
export { IntegrationEndpoint };
|
|
@@ -13,6 +13,8 @@ export declare class IntegrationInbound {
|
|
|
13
13
|
action: string;
|
|
14
14
|
/** Versão da rota. Apenas a última versão pode estar ativa. Versões anteriores não podem sofrer modificações */
|
|
15
15
|
version: number;
|
|
16
|
+
/**Se a rota está ativa */
|
|
17
|
+
active: boolean;
|
|
16
18
|
/** Descrição opcional amigável ao usuário */
|
|
17
19
|
description?: string | null;
|
|
18
20
|
/** Pré-validação do payload de origem */
|
|
@@ -21,8 +23,6 @@ export declare class IntegrationInbound {
|
|
|
21
23
|
transformation: string;
|
|
22
24
|
/** Regra global (BRE RulesConfiguration) */
|
|
23
25
|
rules: Record<string, any>;
|
|
24
|
-
/**Se a rota está ativa */
|
|
25
|
-
active: boolean;
|
|
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,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,
|
|
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"}
|
|
@@ -20,6 +20,8 @@ let IntegrationInbound = class IntegrationInbound {
|
|
|
20
20
|
action;
|
|
21
21
|
/** Versão da rota. Apenas a última versão pode estar ativa. Versões anteriores não podem sofrer modificações */
|
|
22
22
|
version;
|
|
23
|
+
/**Se a rota está ativa */
|
|
24
|
+
active;
|
|
23
25
|
/** Descrição opcional amigável ao usuário */
|
|
24
26
|
description;
|
|
25
27
|
/** Pré-validação do payload de origem */
|
|
@@ -28,8 +30,6 @@ let IntegrationInbound = class IntegrationInbound {
|
|
|
28
30
|
transformation;
|
|
29
31
|
/** Regra global (BRE RulesConfiguration) */
|
|
30
32
|
rules;
|
|
31
|
-
/**Se a rota está ativa */
|
|
32
|
-
active;
|
|
33
33
|
/** Opções adicionais (reservado para uso futuro) */
|
|
34
34
|
options;
|
|
35
35
|
createdAt;
|
|
@@ -45,11 +45,14 @@ __decorate([
|
|
|
45
45
|
Column({ type: "varchar", length: 80 })
|
|
46
46
|
], IntegrationInbound.prototype, "event", void 0);
|
|
47
47
|
__decorate([
|
|
48
|
-
Column({ type: "varchar", length:
|
|
48
|
+
Column({ type: "varchar", length: 40 })
|
|
49
49
|
], IntegrationInbound.prototype, "action", void 0);
|
|
50
50
|
__decorate([
|
|
51
51
|
Column({ type: "int", default: 1 })
|
|
52
52
|
], IntegrationInbound.prototype, "version", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
Column({ type: "boolean", default: true })
|
|
55
|
+
], IntegrationInbound.prototype, "active", void 0);
|
|
53
56
|
__decorate([
|
|
54
57
|
Column({ type: "varchar", length: 500, nullable: true })
|
|
55
58
|
], IntegrationInbound.prototype, "description", void 0);
|
|
@@ -62,9 +65,6 @@ __decorate([
|
|
|
62
65
|
__decorate([
|
|
63
66
|
Column({ type: 'jsonb', nullable: true })
|
|
64
67
|
], IntegrationInbound.prototype, "rules", void 0);
|
|
65
|
-
__decorate([
|
|
66
|
-
Column({ type: "boolean", default: true })
|
|
67
|
-
], IntegrationInbound.prototype, "active", void 0);
|
|
68
68
|
__decorate([
|
|
69
69
|
Column({ type: "jsonb", nullable: true })
|
|
70
70
|
], IntegrationInbound.prototype, "options", void 0);
|
|
@@ -76,6 +76,6 @@ __decorate([
|
|
|
76
76
|
], IntegrationInbound.prototype, "updatedAt", void 0);
|
|
77
77
|
IntegrationInbound = __decorate([
|
|
78
78
|
Entity({ name: "integration_inbound" }),
|
|
79
|
-
Index(["system", "event", "version"], { unique: true })
|
|
79
|
+
Index(["system", "event", "action", "version"], { unique: true })
|
|
80
80
|
], IntegrationInbound);
|
|
81
81
|
export { IntegrationInbound };
|
|
@@ -6,20 +6,20 @@ export declare class IntegrationOutbound {
|
|
|
6
6
|
id: string;
|
|
7
7
|
/** Sistema de origem (e.g., 'tms') */
|
|
8
8
|
system: string;
|
|
9
|
-
/** Sistema de destino (e.g., 'erp', 'wms') */
|
|
10
|
-
targetSystem: string;
|
|
11
9
|
/** Evento (chave) (e.g., 'driver' or 'driver.created') */
|
|
12
10
|
event: string;
|
|
13
11
|
/** Ação (e.g., 'create', 'update', 'delete', etc */
|
|
14
12
|
action: string;
|
|
13
|
+
/** Sistema de destino (e.g., 'erp', 'wms') */
|
|
14
|
+
targetSystem: string;
|
|
15
15
|
/** Versão da rota. Apenas a última versão pode estar ativa. Versões anteriores não podem sofrer modificações */
|
|
16
16
|
version: number;
|
|
17
|
+
/** Se a rota está ativa */
|
|
18
|
+
active: boolean;
|
|
17
19
|
/** Descrição */
|
|
18
20
|
description?: string | null;
|
|
19
21
|
/** Regras (BRE RulesConfiguration) */
|
|
20
22
|
rules: Record<string, any>;
|
|
21
|
-
/** Se a rota está ativa */
|
|
22
|
-
active: boolean;
|
|
23
23
|
/** Opções adicionais (reservado para uso futuro) */
|
|
24
24
|
options?: Record<string, any> | null;
|
|
25
25
|
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":"
|
|
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,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"}
|
|
@@ -39,20 +39,20 @@ let IntegrationOutbound = class IntegrationOutbound {
|
|
|
39
39
|
id;
|
|
40
40
|
/** Sistema de origem (e.g., 'tms') */
|
|
41
41
|
system;
|
|
42
|
-
/** Sistema de destino (e.g., 'erp', 'wms') */
|
|
43
|
-
targetSystem;
|
|
44
42
|
/** Evento (chave) (e.g., 'driver' or 'driver.created') */
|
|
45
43
|
event;
|
|
46
44
|
/** Ação (e.g., 'create', 'update', 'delete', etc */
|
|
47
45
|
action;
|
|
46
|
+
/** Sistema de destino (e.g., 'erp', 'wms') */
|
|
47
|
+
targetSystem;
|
|
48
48
|
/** Versão da rota. Apenas a última versão pode estar ativa. Versões anteriores não podem sofrer modificações */
|
|
49
49
|
version;
|
|
50
|
+
/** Se a rota está ativa */
|
|
51
|
+
active;
|
|
50
52
|
/** Descrição */
|
|
51
53
|
description;
|
|
52
54
|
/** Regras (BRE RulesConfiguration) */
|
|
53
55
|
rules;
|
|
54
|
-
/** Se a rota está ativa */
|
|
55
|
-
active;
|
|
56
56
|
/** Opções adicionais (reservado para uso futuro) */
|
|
57
57
|
options;
|
|
58
58
|
createdAt;
|
|
@@ -64,27 +64,27 @@ __decorate([
|
|
|
64
64
|
__decorate([
|
|
65
65
|
Column({ type: "varchar", length: 80 })
|
|
66
66
|
], IntegrationOutbound.prototype, "system", void 0);
|
|
67
|
-
__decorate([
|
|
68
|
-
Column({ name: "target_system", type: "varchar", length: 80 })
|
|
69
|
-
], IntegrationOutbound.prototype, "targetSystem", void 0);
|
|
70
67
|
__decorate([
|
|
71
68
|
Column({ type: "varchar", length: 80 })
|
|
72
69
|
], IntegrationOutbound.prototype, "event", void 0);
|
|
73
70
|
__decorate([
|
|
74
|
-
Column({ type: "varchar", length:
|
|
71
|
+
Column({ type: "varchar", length: 40 })
|
|
75
72
|
], IntegrationOutbound.prototype, "action", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
Column({ name: "target_system", type: "varchar", length: 80 })
|
|
75
|
+
], IntegrationOutbound.prototype, "targetSystem", void 0);
|
|
76
76
|
__decorate([
|
|
77
77
|
Column({ type: "int", default: 1 })
|
|
78
78
|
], IntegrationOutbound.prototype, "version", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
Column({ type: "boolean", default: true })
|
|
81
|
+
], IntegrationOutbound.prototype, "active", void 0);
|
|
79
82
|
__decorate([
|
|
80
83
|
Column({ type: "varchar", length: 500, nullable: true })
|
|
81
84
|
], IntegrationOutbound.prototype, "description", void 0);
|
|
82
85
|
__decorate([
|
|
83
86
|
Column({ type: "jsonb" })
|
|
84
87
|
], IntegrationOutbound.prototype, "rules", void 0);
|
|
85
|
-
__decorate([
|
|
86
|
-
Column({ type: "boolean", default: true })
|
|
87
|
-
], IntegrationOutbound.prototype, "active", void 0);
|
|
88
88
|
__decorate([
|
|
89
89
|
Column({ type: "jsonb", nullable: true })
|
|
90
90
|
], IntegrationOutbound.prototype, "options", void 0);
|
|
@@ -96,6 +96,6 @@ __decorate([
|
|
|
96
96
|
], IntegrationOutbound.prototype, "updatedAt", void 0);
|
|
97
97
|
IntegrationOutbound = __decorate([
|
|
98
98
|
Entity({ name: "integration_outbound" }),
|
|
99
|
-
Index(["system", "event", "targetSystem", "version"], { unique: true })
|
|
99
|
+
Index(["system", "event", "action", "targetSystem", "version"], { unique: true })
|
|
100
100
|
], IntegrationOutbound);
|
|
101
101
|
export { IntegrationOutbound };
|
|
@@ -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;
|
|
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
|
-
|
|
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)
|
|
@@ -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,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;
|
|
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"}
|
|
@@ -16,16 +16,44 @@ let InboundRepositoryService = class InboundRepositoryService {
|
|
|
16
16
|
this.repo = repo;
|
|
17
17
|
}
|
|
18
18
|
async get(system, event, action) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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;
|
|
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
|
-
|
|
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
|
-
|
|
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([
|