@cargolift-cdi/types 0.1.110 → 0.1.112
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/entities/log-integration-inbound.entity.d.ts +4 -2
- package/dist/entities/log-integration-inbound.entity.d.ts.map +1 -1
- package/dist/entities/log-integration-inbound.entity.js +7 -2
- package/dist/repository/log-integration-inbound.service.d.ts +3 -2
- package/dist/repository/log-integration-inbound.service.d.ts.map +1 -1
- package/dist/repository/log-integration-inbound.service.js +15 -13
- package/package.json +1 -1
|
@@ -12,9 +12,9 @@ export declare class LogIntegrationInbound {
|
|
|
12
12
|
/** Ação (e.g., 'create', 'update', 'delete', etc) */
|
|
13
13
|
action: string;
|
|
14
14
|
/** Evento de origem (antes do roteamento) (e.g., 'driver' or 'driver.created') */
|
|
15
|
-
sourceEvent
|
|
15
|
+
sourceEvent?: string | null;
|
|
16
16
|
/** Ação de origem (antes do roteamento) (e.g., 'create', 'update', 'delete', etc) */
|
|
17
|
-
sourceAction
|
|
17
|
+
sourceAction?: string | null;
|
|
18
18
|
/** Correlation Id */
|
|
19
19
|
correlationId: string;
|
|
20
20
|
/** Status final do processamento */
|
|
@@ -39,6 +39,8 @@ export declare class LogIntegrationInbound {
|
|
|
39
39
|
headers?: string | null;
|
|
40
40
|
/** Envelope da requisição */
|
|
41
41
|
envelope?: string | null;
|
|
42
|
+
/** Corpo bruto da requisição recebida para reprocessamento */
|
|
43
|
+
rawPayload?: string | null;
|
|
42
44
|
/** Corpo sanitizado da requisição sem o envelope */
|
|
43
45
|
payload?: string | null;
|
|
44
46
|
/** Payload transformado em formato canônico após aplicação da transformação JSONata */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-integration-inbound.entity.d.ts","sourceRoot":"","sources":["../../src/entities/log-integration-inbound.entity.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGjE;;;GAGG;AACH,qBA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isição recebida para reprocessamento */
|
|
49
|
+
rawPayload;
|
|
48
50
|
/** Corpo sanitizado da requisição sem o envelope */
|
|
49
51
|
payload;
|
|
50
52
|
/** Payload transformado em formato canônico após aplicação da transformação JSONata */
|
|
@@ -87,10 +89,10 @@ __decorate([
|
|
|
87
89
|
Column({ type: "varchar", length: 40 })
|
|
88
90
|
], LogIntegrationInbound.prototype, "action", void 0);
|
|
89
91
|
__decorate([
|
|
90
|
-
Column({ type: "varchar", length: 80 })
|
|
92
|
+
Column({ type: "varchar", length: 80, nullable: true })
|
|
91
93
|
], LogIntegrationInbound.prototype, "sourceEvent", void 0);
|
|
92
94
|
__decorate([
|
|
93
|
-
Column({ type: "varchar", length: 40 })
|
|
95
|
+
Column({ type: "varchar", length: 40, nullable: true })
|
|
94
96
|
], LogIntegrationInbound.prototype, "sourceAction", void 0);
|
|
95
97
|
__decorate([
|
|
96
98
|
Column({ name: "correlation_id", type: "varchar", length: 36 })
|
|
@@ -128,6 +130,9 @@ __decorate([
|
|
|
128
130
|
__decorate([
|
|
129
131
|
Column({ type: 'text', nullable: true })
|
|
130
132
|
], LogIntegrationInbound.prototype, "envelope", void 0);
|
|
133
|
+
__decorate([
|
|
134
|
+
Column({ type: 'text', nullable: true })
|
|
135
|
+
], LogIntegrationInbound.prototype, "rawPayload", void 0);
|
|
131
136
|
__decorate([
|
|
132
137
|
Column({ type: 'text', nullable: true })
|
|
133
138
|
], LogIntegrationInbound.prototype, "payload", void 0);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Repository } from 'typeorm';
|
|
2
2
|
import { LogIntegrationInbound } from '../entities/log-integration-inbound.entity.js';
|
|
3
3
|
/**
|
|
4
|
-
* Repositório de
|
|
4
|
+
* Repositório de log de integração de entrada (inbound).
|
|
5
5
|
* Responsável por criar/atualizar registros de latência associados a um id.
|
|
6
|
+
* Possibilidade de reprocessamento e auditoria.
|
|
6
7
|
*/
|
|
7
8
|
export declare class LogInboundRepositoryService {
|
|
8
9
|
private readonly repo;
|
|
@@ -14,6 +15,6 @@ export declare class LogInboundRepositoryService {
|
|
|
14
15
|
* @param timestamp_start
|
|
15
16
|
* @returns
|
|
16
17
|
*/
|
|
17
|
-
register(
|
|
18
|
+
register(correlationId: string, data?: Partial<LogIntegrationInbound>): Promise<LogIntegrationInbound | null>;
|
|
18
19
|
}
|
|
19
20
|
//# sourceMappingURL=log-integration-inbound.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-integration-inbound.service.d.ts","sourceRoot":"","sources":["../../src/repository/log-integration-inbound.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAGtF
|
|
1
|
+
{"version":3,"file":"log-integration-inbound.service.d.ts","sourceRoot":"","sources":["../../src/repository/log-integration-inbound.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAGtF;;;;GAIG;AACH,qBACa,2BAA2B;IAGpC,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU,CAAC,qBAAqB,CAAC;IAG1D;;;;;;OAMG;IACG,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,GAAE,OAAO,CAAC,qBAAqB,CAAM,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;CA0BxH"}
|
|
@@ -12,8 +12,9 @@ import { InjectRepository } from '@nestjs/typeorm';
|
|
|
12
12
|
import { LogIntegrationInbound } from '../entities/log-integration-inbound.entity.js';
|
|
13
13
|
import { IntegrationStatus } from '../enum/integration.enums.js';
|
|
14
14
|
/**
|
|
15
|
-
* Repositório de
|
|
15
|
+
* Repositório de log de integração de entrada (inbound).
|
|
16
16
|
* Responsável por criar/atualizar registros de latência associados a um id.
|
|
17
|
+
* Possibilidade de reprocessamento e auditoria.
|
|
17
18
|
*/
|
|
18
19
|
let LogInboundRepositoryService = class LogInboundRepositoryService {
|
|
19
20
|
repo;
|
|
@@ -27,25 +28,26 @@ let LogInboundRepositoryService = class LogInboundRepositoryService {
|
|
|
27
28
|
* @param timestamp_start
|
|
28
29
|
* @returns
|
|
29
30
|
*/
|
|
30
|
-
async register(
|
|
31
|
+
async register(correlationId, data = {}) {
|
|
31
32
|
const payload = {
|
|
32
|
-
system,
|
|
33
|
-
event,
|
|
34
|
-
action,
|
|
35
33
|
correlationId,
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
durationProcessMs: data.timestampProcess
|
|
35
|
+
? Date.now() - new Date(data.timestampProcess || "").getTime()
|
|
36
|
+
: undefined,
|
|
37
|
+
...data,
|
|
38
38
|
};
|
|
39
|
-
if (data.status === IntegrationStatus.SUCCESS
|
|
40
|
-
const startTime = new Date(payload.timestampStart).getTime();
|
|
39
|
+
if (data.status === IntegrationStatus.SUCCESS || data.status === IntegrationStatus.FAILED) {
|
|
41
40
|
const endTime = Date.now();
|
|
42
|
-
payload.
|
|
41
|
+
payload.timestampEnd = new Date();
|
|
42
|
+
if (payload.timestampStart) {
|
|
43
|
+
payload.durationMs = endTime - new Date(payload.timestampStart).getTime();
|
|
44
|
+
}
|
|
43
45
|
}
|
|
44
|
-
await this.repo.upsert(payload, [
|
|
46
|
+
await this.repo.upsert(payload, ["correlationId"]);
|
|
45
47
|
return this.repo.findOne({
|
|
46
48
|
where: {
|
|
47
|
-
correlationId
|
|
48
|
-
}
|
|
49
|
+
correlationId,
|
|
50
|
+
},
|
|
49
51
|
});
|
|
50
52
|
}
|
|
51
53
|
};
|