@muni-sanfer/types-gestor-documental 0.0.1-beta.19 → 0.0.1-beta.20
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/base/entities.d.ts +46 -0
- package/dist/base/entities.js +23 -1
- package/dist/contracts/audit.contract.d.ts +32 -0
- package/dist/contracts/audit.contract.js +8 -0
- package/dist/contracts/document.contract.d.ts +7 -1
- package/dist/contracts/index.d.ts +7 -1
- package/dist/contracts/index.js +3 -0
- package/dist/entities/audit/audit.entity.d.ts +27 -0
- package/dist/entities/audit/audit.entity.js +2 -0
- package/dist/entities/audit/index.d.ts +1 -0
- package/dist/entities/audit/index.js +17 -0
- package/dist/entities/index.d.ts +1 -0
- package/dist/entities/index.js +1 -0
- package/package.json +1 -1
- package/src/base/entities.ts +62 -0
- package/src/contracts/audit.contract.ts +30 -0
- package/src/contracts/document.contract.ts +10 -2
- package/src/contracts/index.ts +5 -1
- package/src/entities/audit/audit.entity.ts +30 -0
- package/src/entities/audit/index.ts +1 -0
- package/src/entities/index.ts +1 -0
package/dist/base/entities.d.ts
CHANGED
|
@@ -199,6 +199,31 @@ export declare const QualityMetricKey: {
|
|
|
199
199
|
FunctionalCompleteness: "FunctionalCompleteness";
|
|
200
200
|
Interoperability: "Interoperability";
|
|
201
201
|
};
|
|
202
|
+
export type DocumentAccessAction = 'Viewed' | 'FileDownloaded' | 'TrailExported';
|
|
203
|
+
export declare const DocumentAccessAction: {
|
|
204
|
+
Viewed: "Viewed";
|
|
205
|
+
FileDownloaded: "FileDownloaded";
|
|
206
|
+
TrailExported: "TrailExported";
|
|
207
|
+
};
|
|
208
|
+
export type AuditEntity = 'DocumentType' | 'IssuingEntity' | 'ArchivalSeries' | 'TextSnippet' | 'Holiday' | 'Procedure' | 'QualityMetric' | 'ServiceOutage';
|
|
209
|
+
export declare const AuditEntity: {
|
|
210
|
+
DocumentType: "DocumentType";
|
|
211
|
+
IssuingEntity: "IssuingEntity";
|
|
212
|
+
ArchivalSeries: "ArchivalSeries";
|
|
213
|
+
TextSnippet: "TextSnippet";
|
|
214
|
+
Holiday: "Holiday";
|
|
215
|
+
Procedure: "Procedure";
|
|
216
|
+
QualityMetric: "QualityMetric";
|
|
217
|
+
ServiceOutage: "ServiceOutage";
|
|
218
|
+
};
|
|
219
|
+
export type AuditAction = 'Created' | 'Updated' | 'Enabled' | 'Disabled' | 'Removed';
|
|
220
|
+
export declare const AuditAction: {
|
|
221
|
+
Created: "Created";
|
|
222
|
+
Updated: "Updated";
|
|
223
|
+
Enabled: "Enabled";
|
|
224
|
+
Disabled: "Disabled";
|
|
225
|
+
Removed: "Removed";
|
|
226
|
+
};
|
|
202
227
|
export interface DocumentTypeEntity {
|
|
203
228
|
id: string;
|
|
204
229
|
name: string;
|
|
@@ -278,6 +303,7 @@ export interface DocumentEntity {
|
|
|
278
303
|
workFolderItems?: WorkFolderItemEntity[];
|
|
279
304
|
externalRecipients?: DocumentExternalRecipientEntity[];
|
|
280
305
|
emailCopies?: DocumentEmailCopyEntity[];
|
|
306
|
+
accesses?: DocumentAccessEntity[];
|
|
281
307
|
dispatch?: DocumentDispatchEntity | null;
|
|
282
308
|
docDigitalInbound?: DocDigitalInboundEntity | null;
|
|
283
309
|
deleted: boolean;
|
|
@@ -765,6 +791,26 @@ export interface ServiceTimingEntity {
|
|
|
765
791
|
under5000: number;
|
|
766
792
|
over5000: number;
|
|
767
793
|
}
|
|
794
|
+
export interface DocumentAccessEntity {
|
|
795
|
+
id: string;
|
|
796
|
+
action: DocumentAccessAction;
|
|
797
|
+
employeeId?: string | null;
|
|
798
|
+
employeeFullName: string;
|
|
799
|
+
document?: DocumentEntity;
|
|
800
|
+
documentId: string;
|
|
801
|
+
createdAt: string;
|
|
802
|
+
}
|
|
803
|
+
export interface AuditLogEntity {
|
|
804
|
+
id: string;
|
|
805
|
+
entity: AuditEntity;
|
|
806
|
+
action: AuditAction;
|
|
807
|
+
entityId?: string | null;
|
|
808
|
+
name: string;
|
|
809
|
+
details?: JsonValue | null;
|
|
810
|
+
employeeId?: string | null;
|
|
811
|
+
employeeFullName: string;
|
|
812
|
+
createdAt: string;
|
|
813
|
+
}
|
|
768
814
|
type JsonValue = string | number | boolean | {
|
|
769
815
|
[key in string]?: JsonValue;
|
|
770
816
|
} | Array<JsonValue> | null;
|
package/dist/base/entities.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file was auto-generated by prisma-generator-typescript-interfaces
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.QualityMetricKey = exports.ServiceOutageKind = exports.WorkFolderItemKind = exports.TextSnippetSection = exports.ScanSessionStatus = exports.CaseFileAccessAction = exports.CaseFileTrackingAction = exports.CaseFileActorType = exports.CaseFileActorRelation = exports.CaseFileEntryKind = exports.CaseFileActuationType = exports.CaseFileIncorporationMechanism = exports.CaseFileStatus = exports.DocumentInstruction = exports.DocumentDeliveryOrigin = exports.DocumentRecipientType = exports.DocumentAttachmentType = exports.DocumentFlowStepType = exports.DocDigitalInboundStatus = exports.DocumentDispatchStatus = exports.DocumentOrigin = exports.DocumentTrackingAction = exports.DocumentParticipantStatus = exports.DocumentParticipantRole = exports.DocumentAccessLevel = exports.DocumentStatus = exports.DocumentCategory = void 0;
|
|
4
|
+
exports.AuditAction = exports.AuditEntity = exports.DocumentAccessAction = exports.QualityMetricKey = exports.ServiceOutageKind = exports.WorkFolderItemKind = exports.TextSnippetSection = exports.ScanSessionStatus = exports.CaseFileAccessAction = exports.CaseFileTrackingAction = exports.CaseFileActorType = exports.CaseFileActorRelation = exports.CaseFileEntryKind = exports.CaseFileActuationType = exports.CaseFileIncorporationMechanism = exports.CaseFileStatus = exports.DocumentInstruction = exports.DocumentDeliveryOrigin = exports.DocumentRecipientType = exports.DocumentAttachmentType = exports.DocumentFlowStepType = exports.DocDigitalInboundStatus = exports.DocumentDispatchStatus = exports.DocumentOrigin = exports.DocumentTrackingAction = exports.DocumentParticipantStatus = exports.DocumentParticipantRole = exports.DocumentAccessLevel = exports.DocumentStatus = exports.DocumentCategory = void 0;
|
|
5
5
|
exports.DocumentCategory = {
|
|
6
6
|
Decree: 'Decree',
|
|
7
7
|
Communication: 'Communication',
|
|
@@ -176,3 +176,25 @@ exports.QualityMetricKey = {
|
|
|
176
176
|
FunctionalCompleteness: 'FunctionalCompleteness',
|
|
177
177
|
Interoperability: 'Interoperability',
|
|
178
178
|
};
|
|
179
|
+
exports.DocumentAccessAction = {
|
|
180
|
+
Viewed: 'Viewed',
|
|
181
|
+
FileDownloaded: 'FileDownloaded',
|
|
182
|
+
TrailExported: 'TrailExported',
|
|
183
|
+
};
|
|
184
|
+
exports.AuditEntity = {
|
|
185
|
+
DocumentType: 'DocumentType',
|
|
186
|
+
IssuingEntity: 'IssuingEntity',
|
|
187
|
+
ArchivalSeries: 'ArchivalSeries',
|
|
188
|
+
TextSnippet: 'TextSnippet',
|
|
189
|
+
Holiday: 'Holiday',
|
|
190
|
+
Procedure: 'Procedure',
|
|
191
|
+
QualityMetric: 'QualityMetric',
|
|
192
|
+
ServiceOutage: 'ServiceOutage',
|
|
193
|
+
};
|
|
194
|
+
exports.AuditAction = {
|
|
195
|
+
Created: 'Created',
|
|
196
|
+
Updated: 'Updated',
|
|
197
|
+
Enabled: 'Enabled',
|
|
198
|
+
Disabled: 'Disabled',
|
|
199
|
+
Removed: 'Removed',
|
|
200
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type AuditEventEntity, type AuditSource, type IndicatorsFileEntity } from '../entities';
|
|
2
|
+
import { type RpcPage } from './contract';
|
|
3
|
+
/** Patrones NATS de `audit`: la auditoría reúne todos los registros del gestor en una sola vista. */
|
|
4
|
+
export declare const AuditPatterns: {
|
|
5
|
+
readonly getEvents: "gestorDocumental.audit.getEvents";
|
|
6
|
+
readonly export: "gestorDocumental.audit.export";
|
|
7
|
+
};
|
|
8
|
+
/** Qué hechos: período (días de Chile «AAAA-MM-DD», hasta un año) y filtros optativos. */
|
|
9
|
+
export interface AuditQuery {
|
|
10
|
+
from: string;
|
|
11
|
+
to: string;
|
|
12
|
+
sources?: AuditSource[];
|
|
13
|
+
/** Parte del nombre de quien actuó. */
|
|
14
|
+
person?: string;
|
|
15
|
+
/** Parte del folio, materia, IUIe, título o nombre de lo afectado. */
|
|
16
|
+
reference?: string;
|
|
17
|
+
page?: number;
|
|
18
|
+
limit?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface AuditContract {
|
|
21
|
+
[AuditPatterns.getEvents]: {
|
|
22
|
+
payload: AuditQuery;
|
|
23
|
+
response: RpcPage<AuditEventEntity[]>;
|
|
24
|
+
};
|
|
25
|
+
/** Los hechos filtrados (hasta 10.000) en Excel. `generatedBy`: quién la descarga. */
|
|
26
|
+
[AuditPatterns.export]: {
|
|
27
|
+
payload: Omit<AuditQuery, 'page' | 'limit'> & {
|
|
28
|
+
generatedBy: string;
|
|
29
|
+
};
|
|
30
|
+
response: IndicatorsFileEntity;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuditPatterns = void 0;
|
|
4
|
+
/** Patrones NATS de `audit`: la auditoría reúne todos los registros del gestor en una sola vista. */
|
|
5
|
+
exports.AuditPatterns = {
|
|
6
|
+
getEvents: 'gestorDocumental.audit.getEvents',
|
|
7
|
+
export: 'gestorDocumental.audit.export',
|
|
8
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DocumentAccessLevel, type DocumentAttachmentEntity, type DocumentDeliveryEntity, type DocumentEntity, type DocumentInstruction, type DocumentParticipantEntity, type DocumentStatus } from '../base/entities';
|
|
1
|
+
import { type DocumentAccessAction, type DocumentAccessLevel, type DocumentAttachmentEntity, type DocumentDeliveryEntity, type DocumentEntity, type DocumentInstruction, type DocumentParticipantEntity, type DocumentStatus } from '../base/entities';
|
|
2
2
|
import { type DocumentAnnulResponseEntity, type DocumentCloseDeliveryResponseEntity, type DocumentCreateResponseEntity, type DocumentDeriveResponseEntity, type DocumentDiscardResponseEntity, type DocumentEmailCopyIssuedEntity, type DocumentEmailCopyViewEntity, type DocumentReminderEntity, type DocumentGetAllResponseEntity, type DocumentGetByIdResponseEntity, type DocumentGetSummaryResponseEntity, type DocumentInboxItemEntity, type DocumentPublicFileResponseEntity, type DocumentReassignResponseEntity, type DocumentReviewResponseEntity, type DocumentSignManyResponseEntity, type DocumentAgendaResponseEntity, type DocumentComposeResponseEntity, type DocumentComposition, type DocumentTrailExportEntity, type DocumentUpdateResponseEntity, type DocumentVerifyResponseEntity } from '../entities';
|
|
3
3
|
import { type RpcPage } from './contract';
|
|
4
4
|
/** Patrones NATS de `document`: `<servicio>.<recurso>.<acción>`. */
|
|
@@ -103,6 +103,11 @@ export interface DocumentExternalRecipientInput {
|
|
|
103
103
|
/**
|
|
104
104
|
* Qué se envía y qué se responde en cada patrón. Generado desde los handlers y los DTO del microservicio.
|
|
105
105
|
*/
|
|
106
|
+
/** Una lectura que queda en el registro de accesos del documento. */
|
|
107
|
+
export interface DocumentAccessInput {
|
|
108
|
+
action: DocumentAccessAction;
|
|
109
|
+
fullName: string;
|
|
110
|
+
}
|
|
106
111
|
export interface DocumentContract {
|
|
107
112
|
/**
|
|
108
113
|
* Arma el PDF de un documento redactado con una plantilla oficial: membrete, estructura y espacio libre para el
|
|
@@ -194,6 +199,7 @@ export interface DocumentContract {
|
|
|
194
199
|
payload: Pick<DocumentEntity, 'id'> & {
|
|
195
200
|
actor?: DocumentActor;
|
|
196
201
|
viewAll?: boolean;
|
|
202
|
+
access?: DocumentAccessInput;
|
|
197
203
|
};
|
|
198
204
|
response: DocumentGetByIdResponseEntity;
|
|
199
205
|
};
|
|
@@ -6,6 +6,7 @@ import { type ArchivalSeriesContract } from './archivalSeries.contract';
|
|
|
6
6
|
import { type TextSnippetContract } from './textSnippet.contract';
|
|
7
7
|
import { type HolidayContract } from './holiday.contract';
|
|
8
8
|
import { type IndicatorsContract } from './indicators.contract';
|
|
9
|
+
import { type AuditContract } from './audit.contract';
|
|
9
10
|
import { type ScanContract } from './scan.contract';
|
|
10
11
|
import { type PartsOfficeContract } from './partsOffice.contract';
|
|
11
12
|
import { type ProcedureContract } from './procedure.contract';
|
|
@@ -27,6 +28,7 @@ export * from './archivalSeries.contract';
|
|
|
27
28
|
export * from './textSnippet.contract';
|
|
28
29
|
export * from './holiday.contract';
|
|
29
30
|
export * from './indicators.contract';
|
|
31
|
+
export * from './audit.contract';
|
|
30
32
|
/** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
|
|
31
33
|
export declare const GestorDocumentalPatterns: {
|
|
32
34
|
readonly documentType: {
|
|
@@ -178,6 +180,10 @@ export declare const GestorDocumentalPatterns: {
|
|
|
178
180
|
readonly removeOutage: "gestorDocumental.indicators.removeOutage";
|
|
179
181
|
readonly getOutageCertificate: "gestorDocumental.indicators.getOutageCertificate";
|
|
180
182
|
};
|
|
183
|
+
readonly audit: {
|
|
184
|
+
readonly getEvents: "gestorDocumental.audit.getEvents";
|
|
185
|
+
readonly export: "gestorDocumental.audit.export";
|
|
186
|
+
};
|
|
181
187
|
};
|
|
182
188
|
/** Contrato completo de gestor-documental-ms: la unión de los contratos de sus recursos. */
|
|
183
|
-
export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & IssuingEntityContract & CaseFileContract & PartsOfficeContract & RegisterBookContract & SignatureBatchContract & WorkFolderContract & ScanContract & ArchivalSeriesContract & TextSnippetContract & HolidayContract & IndicatorsContract;
|
|
189
|
+
export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & IssuingEntityContract & CaseFileContract & PartsOfficeContract & RegisterBookContract & SignatureBatchContract & WorkFolderContract & ScanContract & ArchivalSeriesContract & TextSnippetContract & HolidayContract & IndicatorsContract & AuditContract;
|
package/dist/contracts/index.js
CHANGED
|
@@ -23,6 +23,7 @@ const archivalSeries_contract_1 = require("./archivalSeries.contract");
|
|
|
23
23
|
const textSnippet_contract_1 = require("./textSnippet.contract");
|
|
24
24
|
const holiday_contract_1 = require("./holiday.contract");
|
|
25
25
|
const indicators_contract_1 = require("./indicators.contract");
|
|
26
|
+
const audit_contract_1 = require("./audit.contract");
|
|
26
27
|
const scan_contract_1 = require("./scan.contract");
|
|
27
28
|
const partsOffice_contract_1 = require("./partsOffice.contract");
|
|
28
29
|
const procedure_contract_1 = require("./procedure.contract");
|
|
@@ -44,6 +45,7 @@ __exportStar(require("./archivalSeries.contract"), exports);
|
|
|
44
45
|
__exportStar(require("./textSnippet.contract"), exports);
|
|
45
46
|
__exportStar(require("./holiday.contract"), exports);
|
|
46
47
|
__exportStar(require("./indicators.contract"), exports);
|
|
48
|
+
__exportStar(require("./audit.contract"), exports);
|
|
47
49
|
/** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
|
|
48
50
|
exports.GestorDocumentalPatterns = {
|
|
49
51
|
documentType: documentType_contract_1.DocumentTypePatterns,
|
|
@@ -60,4 +62,5 @@ exports.GestorDocumentalPatterns = {
|
|
|
60
62
|
textSnippet: textSnippet_contract_1.TextSnippetPatterns,
|
|
61
63
|
holiday: holiday_contract_1.HolidayPatterns,
|
|
62
64
|
indicators: indicators_contract_1.IndicatorsPatterns,
|
|
65
|
+
audit: audit_contract_1.AuditPatterns,
|
|
63
66
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type AuditEntity } from '../../base/entities';
|
|
2
|
+
/** De dónde sale un hecho de la auditoría. */
|
|
3
|
+
export type AuditSource = 'Document' | 'DocumentAccess' | 'CaseFile' | 'CaseFileAccess' | 'Configuration';
|
|
4
|
+
/**
|
|
5
|
+
* Un hecho de la auditoría, de cualquiera de los registros: trazabilidad de documentos y expedientes, accesos y
|
|
6
|
+
* cambios de configuración. `action` es la acción del registro de origen (p. ej. `Signed`, `Viewed`, `Updated`).
|
|
7
|
+
*/
|
|
8
|
+
export interface AuditEventEntity {
|
|
9
|
+
id: string;
|
|
10
|
+
source: AuditSource;
|
|
11
|
+
action: string;
|
|
12
|
+
employeeId: string | null;
|
|
13
|
+
employeeFullName: string | null;
|
|
14
|
+
/** Documento, expediente o elemento de configuración al que se refiere. */
|
|
15
|
+
targetId: string | null;
|
|
16
|
+
/** Cómo se cita: folio o materia del documento, IUIe y título del expediente, nombre de lo configurado. */
|
|
17
|
+
reference: string;
|
|
18
|
+
/** Qué se configuró, en los cambios de configuración. */
|
|
19
|
+
entity: AuditEntity | null;
|
|
20
|
+
observation: string | null;
|
|
21
|
+
createdAt: string;
|
|
22
|
+
}
|
|
23
|
+
/** Quién hace un cambio de configuración, según la sesión. Lo agrega el gateway; el ms lo deja en la bitácora. */
|
|
24
|
+
export interface AuditActorInput {
|
|
25
|
+
employeeId: string | null;
|
|
26
|
+
fullName: string;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './audit.entity';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./audit.entity"), exports);
|
package/dist/entities/index.d.ts
CHANGED
package/dist/entities/index.js
CHANGED
package/package.json
CHANGED
package/src/base/entities.ts
CHANGED
|
@@ -302,6 +302,45 @@ export const QualityMetricKey = {
|
|
|
302
302
|
Interoperability: 'Interoperability',
|
|
303
303
|
} satisfies Record<string, QualityMetricKey>;
|
|
304
304
|
|
|
305
|
+
export type DocumentAccessAction = 'Viewed' | 'FileDownloaded' | 'TrailExported';
|
|
306
|
+
|
|
307
|
+
export const DocumentAccessAction = {
|
|
308
|
+
Viewed: 'Viewed',
|
|
309
|
+
FileDownloaded: 'FileDownloaded',
|
|
310
|
+
TrailExported: 'TrailExported',
|
|
311
|
+
} satisfies Record<string, DocumentAccessAction>;
|
|
312
|
+
|
|
313
|
+
export type AuditEntity =
|
|
314
|
+
| 'DocumentType'
|
|
315
|
+
| 'IssuingEntity'
|
|
316
|
+
| 'ArchivalSeries'
|
|
317
|
+
| 'TextSnippet'
|
|
318
|
+
| 'Holiday'
|
|
319
|
+
| 'Procedure'
|
|
320
|
+
| 'QualityMetric'
|
|
321
|
+
| 'ServiceOutage';
|
|
322
|
+
|
|
323
|
+
export const AuditEntity = {
|
|
324
|
+
DocumentType: 'DocumentType',
|
|
325
|
+
IssuingEntity: 'IssuingEntity',
|
|
326
|
+
ArchivalSeries: 'ArchivalSeries',
|
|
327
|
+
TextSnippet: 'TextSnippet',
|
|
328
|
+
Holiday: 'Holiday',
|
|
329
|
+
Procedure: 'Procedure',
|
|
330
|
+
QualityMetric: 'QualityMetric',
|
|
331
|
+
ServiceOutage: 'ServiceOutage',
|
|
332
|
+
} satisfies Record<string, AuditEntity>;
|
|
333
|
+
|
|
334
|
+
export type AuditAction = 'Created' | 'Updated' | 'Enabled' | 'Disabled' | 'Removed';
|
|
335
|
+
|
|
336
|
+
export const AuditAction = {
|
|
337
|
+
Created: 'Created',
|
|
338
|
+
Updated: 'Updated',
|
|
339
|
+
Enabled: 'Enabled',
|
|
340
|
+
Disabled: 'Disabled',
|
|
341
|
+
Removed: 'Removed',
|
|
342
|
+
} satisfies Record<string, AuditAction>;
|
|
343
|
+
|
|
305
344
|
export interface DocumentTypeEntity {
|
|
306
345
|
id: string;
|
|
307
346
|
name: string;
|
|
@@ -382,6 +421,7 @@ export interface DocumentEntity {
|
|
|
382
421
|
workFolderItems?: WorkFolderItemEntity[];
|
|
383
422
|
externalRecipients?: DocumentExternalRecipientEntity[];
|
|
384
423
|
emailCopies?: DocumentEmailCopyEntity[];
|
|
424
|
+
accesses?: DocumentAccessEntity[];
|
|
385
425
|
dispatch?: DocumentDispatchEntity | null;
|
|
386
426
|
docDigitalInbound?: DocDigitalInboundEntity | null;
|
|
387
427
|
deleted: boolean;
|
|
@@ -904,4 +944,26 @@ export interface ServiceTimingEntity {
|
|
|
904
944
|
over5000: number;
|
|
905
945
|
}
|
|
906
946
|
|
|
947
|
+
export interface DocumentAccessEntity {
|
|
948
|
+
id: string;
|
|
949
|
+
action: DocumentAccessAction;
|
|
950
|
+
employeeId?: string | null;
|
|
951
|
+
employeeFullName: string;
|
|
952
|
+
document?: DocumentEntity;
|
|
953
|
+
documentId: string;
|
|
954
|
+
createdAt: string;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
export interface AuditLogEntity {
|
|
958
|
+
id: string;
|
|
959
|
+
entity: AuditEntity;
|
|
960
|
+
action: AuditAction;
|
|
961
|
+
entityId?: string | null;
|
|
962
|
+
name: string;
|
|
963
|
+
details?: JsonValue | null;
|
|
964
|
+
employeeId?: string | null;
|
|
965
|
+
employeeFullName: string;
|
|
966
|
+
createdAt: string;
|
|
967
|
+
}
|
|
968
|
+
|
|
907
969
|
type JsonValue = string | number | boolean | { [key in string]?: JsonValue } | Array<JsonValue> | null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type AuditEventEntity, type AuditSource, type IndicatorsFileEntity } from '../entities';
|
|
2
|
+
import { type RpcPage } from './contract';
|
|
3
|
+
|
|
4
|
+
/** Patrones NATS de `audit`: la auditoría reúne todos los registros del gestor en una sola vista. */
|
|
5
|
+
export const AuditPatterns = {
|
|
6
|
+
getEvents: 'gestorDocumental.audit.getEvents',
|
|
7
|
+
export: 'gestorDocumental.audit.export',
|
|
8
|
+
} as const;
|
|
9
|
+
|
|
10
|
+
/** Qué hechos: período (días de Chile «AAAA-MM-DD», hasta un año) y filtros optativos. */
|
|
11
|
+
export interface AuditQuery {
|
|
12
|
+
from: string;
|
|
13
|
+
to: string;
|
|
14
|
+
sources?: AuditSource[];
|
|
15
|
+
/** Parte del nombre de quien actuó. */
|
|
16
|
+
person?: string;
|
|
17
|
+
/** Parte del folio, materia, IUIe, título o nombre de lo afectado. */
|
|
18
|
+
reference?: string;
|
|
19
|
+
page?: number;
|
|
20
|
+
limit?: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface AuditContract {
|
|
24
|
+
[AuditPatterns.getEvents]: { payload: AuditQuery; response: RpcPage<AuditEventEntity[]> };
|
|
25
|
+
/** Los hechos filtrados (hasta 10.000) en Excel. `generatedBy`: quién la descarga. */
|
|
26
|
+
[AuditPatterns.export]: {
|
|
27
|
+
payload: Omit<AuditQuery, 'page' | 'limit'> & { generatedBy: string };
|
|
28
|
+
response: IndicatorsFileEntity;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
type DocumentAccessAction,
|
|
2
3
|
type DocumentAccessLevel,
|
|
3
4
|
type DocumentAttachmentEntity,
|
|
4
5
|
type DocumentDeliveryEntity,
|
|
@@ -149,6 +150,12 @@ export interface DocumentExternalRecipientInput {
|
|
|
149
150
|
/**
|
|
150
151
|
* Qué se envía y qué se responde en cada patrón. Generado desde los handlers y los DTO del microservicio.
|
|
151
152
|
*/
|
|
153
|
+
/** Una lectura que queda en el registro de accesos del documento. */
|
|
154
|
+
export interface DocumentAccessInput {
|
|
155
|
+
action: DocumentAccessAction;
|
|
156
|
+
fullName: string;
|
|
157
|
+
}
|
|
158
|
+
|
|
152
159
|
export interface DocumentContract {
|
|
153
160
|
/**
|
|
154
161
|
* Arma el PDF de un documento redactado con una plantilla oficial: membrete, estructura y espacio libre para el
|
|
@@ -224,8 +231,9 @@ export interface DocumentContract {
|
|
|
224
231
|
[DocumentPatterns.getById]: {
|
|
225
232
|
// Con `actor`, el documento solo se entrega a su redactor y a quienes lo visan o firman, y la respuesta dice qué
|
|
226
233
|
// puede hacer con él. `viewAll` levanta esa restricción para quien tiene permiso de ver todos los documentos
|
|
227
|
-
// (historial), sin perder lo que puede hacer si además participa.
|
|
228
|
-
|
|
234
|
+
// (historial), sin perder lo que puede hacer si además participa. Con `access`, la lectura queda en el registro de
|
|
235
|
+
// accesos del documento a nombre de `fullName` (abrirlo varias veces seguidas cuenta una vez).
|
|
236
|
+
payload: Pick<DocumentEntity, 'id'> & { actor?: DocumentActor; viewAll?: boolean; access?: DocumentAccessInput };
|
|
229
237
|
response: DocumentGetByIdResponseEntity;
|
|
230
238
|
};
|
|
231
239
|
[DocumentPatterns.create]: {
|
package/src/contracts/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { ArchivalSeriesPatterns, type ArchivalSeriesContract } from './archivalS
|
|
|
6
6
|
import { TextSnippetPatterns, type TextSnippetContract } from './textSnippet.contract';
|
|
7
7
|
import { HolidayPatterns, type HolidayContract } from './holiday.contract';
|
|
8
8
|
import { IndicatorsPatterns, type IndicatorsContract } from './indicators.contract';
|
|
9
|
+
import { AuditPatterns, type AuditContract } from './audit.contract';
|
|
9
10
|
import { ScanPatterns, type ScanContract } from './scan.contract';
|
|
10
11
|
import { PartsOfficePatterns, type PartsOfficeContract } from './partsOffice.contract';
|
|
11
12
|
import { ProcedurePatterns, type ProcedureContract } from './procedure.contract';
|
|
@@ -28,6 +29,7 @@ export * from './archivalSeries.contract';
|
|
|
28
29
|
export * from './textSnippet.contract';
|
|
29
30
|
export * from './holiday.contract';
|
|
30
31
|
export * from './indicators.contract';
|
|
32
|
+
export * from './audit.contract';
|
|
31
33
|
|
|
32
34
|
/** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
|
|
33
35
|
export const GestorDocumentalPatterns = {
|
|
@@ -45,6 +47,7 @@ export const GestorDocumentalPatterns = {
|
|
|
45
47
|
textSnippet: TextSnippetPatterns,
|
|
46
48
|
holiday: HolidayPatterns,
|
|
47
49
|
indicators: IndicatorsPatterns,
|
|
50
|
+
audit: AuditPatterns,
|
|
48
51
|
} as const;
|
|
49
52
|
|
|
50
53
|
/** Contrato completo de gestor-documental-ms: la unión de los contratos de sus recursos. */
|
|
@@ -61,4 +64,5 @@ export type GestorDocumentalContract = DocumentTypeContract &
|
|
|
61
64
|
ArchivalSeriesContract &
|
|
62
65
|
TextSnippetContract &
|
|
63
66
|
HolidayContract &
|
|
64
|
-
IndicatorsContract
|
|
67
|
+
IndicatorsContract &
|
|
68
|
+
AuditContract;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type AuditEntity } from '../../base/entities';
|
|
2
|
+
|
|
3
|
+
/** De dónde sale un hecho de la auditoría. */
|
|
4
|
+
export type AuditSource = 'Document' | 'DocumentAccess' | 'CaseFile' | 'CaseFileAccess' | 'Configuration';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Un hecho de la auditoría, de cualquiera de los registros: trazabilidad de documentos y expedientes, accesos y
|
|
8
|
+
* cambios de configuración. `action` es la acción del registro de origen (p. ej. `Signed`, `Viewed`, `Updated`).
|
|
9
|
+
*/
|
|
10
|
+
export interface AuditEventEntity {
|
|
11
|
+
id: string;
|
|
12
|
+
source: AuditSource;
|
|
13
|
+
action: string;
|
|
14
|
+
employeeId: string | null;
|
|
15
|
+
employeeFullName: string | null;
|
|
16
|
+
/** Documento, expediente o elemento de configuración al que se refiere. */
|
|
17
|
+
targetId: string | null;
|
|
18
|
+
/** Cómo se cita: folio o materia del documento, IUIe y título del expediente, nombre de lo configurado. */
|
|
19
|
+
reference: string;
|
|
20
|
+
/** Qué se configuró, en los cambios de configuración. */
|
|
21
|
+
entity: AuditEntity | null;
|
|
22
|
+
observation: string | null;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Quién hace un cambio de configuración, según la sesión. Lo agrega el gateway; el ms lo deja en la bitácora. */
|
|
27
|
+
export interface AuditActorInput {
|
|
28
|
+
employeeId: string | null;
|
|
29
|
+
fullName: string;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './audit.entity';
|
package/src/entities/index.ts
CHANGED