@muni-sanfer/types-gestor-documental 0.0.1-beta.2 → 0.0.1-beta.4

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.
Files changed (37) hide show
  1. package/dist/base/entities.d.ts +215 -1
  2. package/dist/base/entities.js +60 -1
  3. package/dist/contracts/caseFile.contract.d.ts +149 -0
  4. package/dist/contracts/caseFile.contract.js +17 -0
  5. package/dist/contracts/document.contract.d.ts +17 -2
  6. package/dist/contracts/document.contract.js +1 -0
  7. package/dist/contracts/documentType.contract.d.ts +17 -1
  8. package/dist/contracts/index.d.ts +26 -1
  9. package/dist/contracts/index.js +6 -0
  10. package/dist/contracts/procedure.contract.d.ts +50 -0
  11. package/dist/contracts/procedure.contract.js +11 -0
  12. package/dist/entities/caseFile/caseFile.entity.d.ts +169 -0
  13. package/dist/entities/caseFile/caseFile.entity.js +2 -0
  14. package/dist/entities/caseFile/index.d.ts +1 -0
  15. package/dist/entities/caseFile/index.js +17 -0
  16. package/dist/entities/document/document.entity.d.ts +12 -0
  17. package/dist/entities/documentType/documentType.entity.d.ts +17 -1
  18. package/dist/entities/index.d.ts +2 -0
  19. package/dist/entities/index.js +2 -0
  20. package/dist/entities/procedure/index.d.ts +1 -0
  21. package/dist/entities/procedure/index.js +17 -0
  22. package/dist/entities/procedure/procedure.entity.d.ts +20 -0
  23. package/dist/entities/procedure/procedure.entity.js +2 -0
  24. package/package.json +1 -1
  25. package/src/base/entities.ts +261 -1
  26. package/src/contracts/caseFile.contract.ts +134 -0
  27. package/src/contracts/document.contract.ts +18 -0
  28. package/src/contracts/documentType.contract.ts +12 -1
  29. package/src/contracts/index.ts +7 -1
  30. package/src/contracts/procedure.contract.ts +53 -0
  31. package/src/entities/caseFile/caseFile.entity.ts +196 -0
  32. package/src/entities/caseFile/index.ts +1 -0
  33. package/src/entities/document/document.entity.ts +9 -0
  34. package/src/entities/documentType/documentType.entity.ts +18 -1
  35. package/src/entities/index.ts +2 -0
  36. package/src/entities/procedure/index.ts +1 -0
  37. package/src/entities/procedure/procedure.entity.ts +24 -0
@@ -0,0 +1,196 @@
1
+ import {
2
+ CaseFileAccessEntity,
3
+ CaseFileActorEntity,
4
+ CaseFileEntity,
5
+ CaseFileEntryEntity,
6
+ CaseFileMetadataChangeEntity,
7
+ CaseFileParticipantEntity,
8
+ CaseFileTrackingEntity,
9
+ DocumentEntity,
10
+ ProcedureEntity,
11
+ } from '../../base/entities';
12
+ import { DocumentTypeSummaryEntity } from '../document';
13
+
14
+ /** Expediente al que se hace referencia desde otro lado: cómo se cita y en qué estado está. */
15
+ export interface CaseFileLinkEntity {
16
+ id: CaseFileEntity['id'];
17
+ code: CaseFileEntity['code'];
18
+ title: CaseFileEntity['title'];
19
+ status: CaseFileEntity['status'];
20
+ }
21
+
22
+ export interface CaseFileGetAllResponseEntity extends CaseFileLinkEntity {
23
+ subject: CaseFileEntity['subject'];
24
+ accessLevel: CaseFileEntity['accessLevel'];
25
+ hasSensitiveData: CaseFileEntity['hasSensitiveData'];
26
+ procedure: Pick<ProcedureEntity, 'id' | 'name'>;
27
+ responsibleEmployeeId: CaseFileEntity['responsibleEmployeeId'];
28
+ responsibleFullName: CaseFileEntity['responsibleFullName'];
29
+ /** Actuaciones vigentes del índice (las que quedaron sin efecto no cuentan). */
30
+ entries: number;
31
+ participants: number;
32
+ createdAt: CaseFileEntity['createdAt'];
33
+ closedAt: CaseFileEntity['closedAt'];
34
+ }
35
+
36
+ /** Documento del gestor incorporado al expediente. */
37
+ export interface CaseFileEntryDocumentEntity {
38
+ id: DocumentEntity['id'];
39
+ subject: DocumentEntity['subject'];
40
+ status: DocumentEntity['status'];
41
+ correlative: DocumentEntity['correlative'];
42
+ correlativeYear: DocumentEntity['correlativeYear'];
43
+ documentType: DocumentTypeSummaryEntity;
44
+ }
45
+
46
+ /** Entrada del índice electrónico: una actuación, en su orden de incorporación. */
47
+ export interface CaseFileEntryResponseEntity {
48
+ id: CaseFileEntryEntity['id'];
49
+ sequence: CaseFileEntryEntity['sequence'];
50
+ kind: CaseFileEntryEntity['kind'];
51
+ actuationType: CaseFileEntryEntity['actuationType'];
52
+ title: CaseFileEntryEntity['title'];
53
+ document: CaseFileEntryDocumentEntity | null;
54
+ fileName: CaseFileEntryEntity['fileName'];
55
+ documentTypeName: CaseFileEntryEntity['documentTypeName'];
56
+ originDate: CaseFileEntryEntity['originDate'];
57
+ author: CaseFileEntryEntity['author'];
58
+ keywords: CaseFileEntryEntity['keywords'];
59
+ accessLevel: CaseFileEntryEntity['accessLevel'];
60
+ hasSensitiveData: CaseFileEntryEntity['hasSensitiveData'];
61
+ linkedCaseFile: CaseFileLinkEntity | null;
62
+ /** `true` si la entrada tiene un archivo que se puede abrir (un documento o un archivo subido). */
63
+ hasFile: boolean;
64
+ sha256: CaseFileEntryEntity['sha256'];
65
+ size: CaseFileEntryEntity['size'];
66
+ hasAdvancedSignature: CaseFileEntryEntity['hasAdvancedSignature'];
67
+ incorporatedByEmployeeId: CaseFileEntryEntity['incorporatedByEmployeeId'];
68
+ incorporatedByFullName: CaseFileEntryEntity['incorporatedByFullName'];
69
+ createdAt: CaseFileEntryEntity['createdAt'];
70
+ voidedAt: CaseFileEntryEntity['voidedAt'];
71
+ voidedByFullName: CaseFileEntryEntity['voidedByFullName'];
72
+ voidReason: CaseFileEntryEntity['voidReason'];
73
+ /** `true` si quien consulta puede dejarla sin efecto: el responsable o quien la incorporó, con el expediente abierto. */
74
+ canVoid: boolean;
75
+ }
76
+
77
+ export interface CaseFileParticipantResponseEntity {
78
+ id: CaseFileParticipantEntity['id'];
79
+ employeeId: CaseFileParticipantEntity['employeeId'];
80
+ fullName: CaseFileParticipantEntity['fullName'];
81
+ position: CaseFileParticipantEntity['position'];
82
+ addedByFullName: CaseFileParticipantEntity['addedByFullName'];
83
+ createdAt: CaseFileParticipantEntity['createdAt'];
84
+ }
85
+
86
+ export interface CaseFileActorResponseEntity {
87
+ id: CaseFileActorEntity['id'];
88
+ relation: CaseFileActorEntity['relation'];
89
+ actorType: CaseFileActorEntity['actorType'];
90
+ identifier: CaseFileActorEntity['identifier'];
91
+ name: CaseFileActorEntity['name'];
92
+ }
93
+
94
+ export interface CaseFileTrackingResponseEntity {
95
+ id: CaseFileTrackingEntity['id'];
96
+ action: CaseFileTrackingEntity['action'];
97
+ observation: CaseFileTrackingEntity['observation'];
98
+ employeeFullName: CaseFileTrackingEntity['employeeFullName'];
99
+ createdAt: CaseFileTrackingEntity['createdAt'];
100
+ }
101
+
102
+ export interface CaseFileMetadataChangeResponseEntity {
103
+ id: CaseFileMetadataChangeEntity['id'];
104
+ /** Código oficial del metadato. Ej: `MGDEE1_5`. */
105
+ field: CaseFileMetadataChangeEntity['field'];
106
+ previousValue: CaseFileMetadataChangeEntity['previousValue'];
107
+ newValue: CaseFileMetadataChangeEntity['newValue'];
108
+ employeeFullName: CaseFileMetadataChangeEntity['employeeFullName'];
109
+ createdAt: CaseFileMetadataChangeEntity['createdAt'];
110
+ }
111
+
112
+ export interface CaseFileAccessResponseEntity {
113
+ id: CaseFileAccessEntity['id'];
114
+ action: CaseFileAccessEntity['action'];
115
+ entryId: CaseFileAccessEntity['entryId'];
116
+ /** Título del documento que se abrió, si el acceso fue a uno. */
117
+ entryTitle: string | null;
118
+ employeeFullName: CaseFileAccessEntity['employeeFullName'];
119
+ createdAt: CaseFileAccessEntity['createdAt'];
120
+ }
121
+
122
+ export interface CaseFileGetByIdResponseEntity extends CaseFileGetAllResponseEntity {
123
+ summary: CaseFileEntity['summary'];
124
+ procedure: Pick<ProcedureEntity, 'id' | 'name' | 'cpatId' | 'cpatCode'>;
125
+ responsiblePosition: CaseFileEntity['responsiblePosition'];
126
+ incorporationMechanism: CaseFileEntity['incorporationMechanism'];
127
+ schemaVersion: CaseFileEntity['schemaVersion'];
128
+ /** Enlace persistente del expediente (MGDEE4_2). `null` si el servicio no tiene configurada la dirección. */
129
+ uri: string | null;
130
+ closedByFullName: CaseFileEntity['closedByFullName'];
131
+ closingNote: CaseFileEntity['closingNote'];
132
+ index: CaseFileEntryResponseEntity[];
133
+ sharedWith: CaseFileParticipantResponseEntity[];
134
+ actors: CaseFileActorResponseEntity[];
135
+ trackings: CaseFileTrackingResponseEntity[];
136
+ metadataChanges: CaseFileMetadataChangeResponseEntity[];
137
+ /** Registro de accesos. Solo lo recibe el responsable y quien puede ver todos los expedientes. */
138
+ accesses: CaseFileAccessResponseEntity[];
139
+ /** Qué puede hacer con el expediente quien lo consulta. Sin `actor` en la consulta, no viene. */
140
+ actorCapabilities?: {
141
+ isResponsible: boolean;
142
+ /** Editar sus metadatos y cerrarlo: el responsable, mientras esté abierto. */
143
+ canEdit: boolean;
144
+ /** Incorporar actuaciones: el responsable y aquellos con quienes se compartió, mientras esté abierto. */
145
+ canIncorporate: boolean;
146
+ /** Compartirlo con otros funcionarios: el responsable, también después de cerrado. */
147
+ canShare: boolean;
148
+ };
149
+ }
150
+
151
+ export interface CaseFileCreateResponseEntity {
152
+ id: CaseFileEntity['id'];
153
+ code: CaseFileEntity['code'];
154
+ ok: boolean;
155
+ }
156
+
157
+ export interface CaseFileUpdateResponseEntity {
158
+ id: CaseFileEntity['id'];
159
+ ok: boolean;
160
+ }
161
+
162
+ export interface CaseFileAddEntryResponseEntity {
163
+ id: CaseFileEntity['id'];
164
+ entryId: CaseFileEntryEntity['id'];
165
+ sequence: CaseFileEntryEntity['sequence'];
166
+ ok: boolean;
167
+ }
168
+
169
+ /** Archivo de una entrada del índice, para servirlo a quien puede ver el expediente. */
170
+ export interface CaseFileEntryFileResponseEntity {
171
+ fileId: string;
172
+ fileName: string;
173
+ }
174
+
175
+ /** Archivo que va dentro del expediente exportado, con la huella que tenía al incorporarse. */
176
+ export interface CaseFileExportFileEntity {
177
+ entryId: CaseFileEntryEntity['id'];
178
+ sequence: CaseFileEntryEntity['sequence'];
179
+ /** Ruta dentro del ZIP. Ej: `documentos/001-decreto-alcaldicio-exento-590-2026.pdf`. */
180
+ path: string;
181
+ fileId: string;
182
+ sha256: string | null;
183
+ }
184
+
185
+ /**
186
+ * Expediente listo para exportar: los metadatos con sus códigos oficiales (va tal cual como `expediente.json`) y los
187
+ * archivos que hay que agregar. El ZIP lo arma el gateway.
188
+ */
189
+ export interface CaseFileExportResponseEntity {
190
+ code: CaseFileEntity['code'];
191
+ manifest: Record<string, unknown>;
192
+ files: CaseFileExportFileEntity[];
193
+ }
194
+
195
+ /** Expediente en que está incorporado un documento, visto desde el documento. */
196
+ export type DocumentCaseFileEntity = CaseFileLinkEntity;
@@ -0,0 +1 @@
1
+ export * from './caseFile.entity';
@@ -145,6 +145,8 @@ export interface DocumentGetByIdResponseEntity {
145
145
  // Documento al que este responde, y los que le responden (solo los ya finalizados, más los propios de quien consulta).
146
146
  replyTo: DocumentLinkEntity | null;
147
147
  replies: DocumentLinkEntity[];
148
+ /** Expedientes en que está incorporado y que quien consulta puede ver. */
149
+ caseFiles: { id: string; code: string; title: string; status: 'Open' | 'Closed' }[];
148
150
  documentType: DocumentTypeSummaryEntity;
149
151
  participants: DocumentParticipantResponseEntity[];
150
152
  attachments: {
@@ -171,6 +173,8 @@ export interface DocumentGetByIdResponseEntity {
171
173
  // Puede derivarlo a otros funcionarios y responderlo: el documento ya es oficial y está a su alcance.
172
174
  canDerive: boolean;
173
175
  canReply: boolean;
176
+ // Es quien redactó un documento en tramitación: puede pasar un turno pendiente a otro funcionario.
177
+ canReassign: boolean;
174
178
  // Sus propias entregas de este documento (puede tener más de una si además se lo derivaron).
175
179
  inbox: DocumentDeliveryResponseEntity[];
176
180
  };
@@ -271,3 +275,8 @@ export interface DocumentCloseDeliveryResponseEntity {
271
275
  id: DocumentDeliveryEntity['id'];
272
276
  ok: boolean;
273
277
  }
278
+
279
+ export interface DocumentReassignResponseEntity {
280
+ id: DocumentEntity['id'];
281
+ ok: boolean;
282
+ }
@@ -1,4 +1,17 @@
1
- import { DocumentTypeEntity } from '../../base/entities';
1
+ import { DocumentTypeEntity, DocumentTypeFlowStepEntity } from '../../base/entities';
2
+
3
+ /** Paso del flujo sugerido de un tipo documental: quién visa o firma, en su orden. */
4
+ export interface DocumentTypeFlowStepResponseEntity {
5
+ id: DocumentTypeFlowStepEntity['id'];
6
+ role: DocumentTypeFlowStepEntity['role'];
7
+ order: DocumentTypeFlowStepEntity['order'];
8
+ type: DocumentTypeFlowStepEntity['type'];
9
+ employeeId: DocumentTypeFlowStepEntity['employeeId'];
10
+ directorateCodeReference: DocumentTypeFlowStepEntity['directorateCodeReference'];
11
+ // Nombre del funcionario o de la dirección, como estaba al definir el flujo.
12
+ name: DocumentTypeFlowStepEntity['name'];
13
+ position: DocumentTypeFlowStepEntity['position'];
14
+ }
2
15
 
3
16
  export interface DocumentTypeGetAllResponseEntity {
4
17
  id: DocumentTypeEntity['id'];
@@ -11,12 +24,16 @@ export interface DocumentTypeGetAllResponseEntity {
11
24
  resetsYearly: DocumentTypeEntity['resetsYearly'];
12
25
  directorateCodeReference: DocumentTypeEntity['directorateCodeReference'];
13
26
  enabled: DocumentTypeEntity['enabled'];
27
+ // Cuántos visadores y firmantes tiene su flujo sugerido.
28
+ flow: { visa: number; signature: number };
14
29
  }
15
30
 
16
31
  export interface DocumentTypeGetByIdResponseEntity extends DocumentTypeGetAllResponseEntity {
17
32
  // Último número ya asignado en el año vigente del correlativo (null si aún no se numera ninguno): el próximo
18
33
  // correlativo no puede quedar por debajo de él.
19
34
  lastCorrelative: number | null;
35
+ // Flujo sugerido: primero los visadores y después los firmantes, cada grupo en su orden.
36
+ flowSteps: DocumentTypeFlowStepResponseEntity[];
20
37
  }
21
38
 
22
39
  export interface DocumentTypeCreateResponseEntity {
@@ -1,2 +1,4 @@
1
1
  export * from './documentType';
2
2
  export * from './document';
3
+ export * from './procedure';
4
+ export * from './caseFile';
@@ -0,0 +1 @@
1
+ export * from './procedure.entity';
@@ -0,0 +1,24 @@
1
+ import { ProcedureEntity } from '../../base/entities';
2
+
3
+ export interface ProcedureGetAllResponseEntity {
4
+ id: ProcedureEntity['id'];
5
+ name: ProcedureEntity['name'];
6
+ cpatId: ProcedureEntity['cpatId'];
7
+ cpatCode: ProcedureEntity['cpatCode'];
8
+ description: ProcedureEntity['description'];
9
+ enabled: ProcedureEntity['enabled'];
10
+ /** Cuántos expedientes pertenecen a este procedimiento. */
11
+ caseFiles: number;
12
+ }
13
+
14
+ export type ProcedureGetByIdResponseEntity = ProcedureGetAllResponseEntity;
15
+
16
+ export interface ProcedureCreateResponseEntity {
17
+ id: ProcedureEntity['id'];
18
+ ok: boolean;
19
+ }
20
+
21
+ export interface ProcedureUpdateResponseEntity {
22
+ id: ProcedureEntity['id'];
23
+ ok: boolean;
24
+ }