@muni-sanfer/types-gestor-documental 0.0.1-beta.1 → 0.0.1-beta.11

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 (74) hide show
  1. package/dist/base/entities.d.ts +436 -1
  2. package/dist/base/entities.js +98 -1
  3. package/dist/contracts/caseFile.contract.d.ts +159 -0
  4. package/dist/contracts/caseFile.contract.js +18 -0
  5. package/dist/contracts/document.contract.d.ts +163 -3
  6. package/dist/contracts/document.contract.js +8 -0
  7. package/dist/contracts/documentType.contract.d.ts +18 -1
  8. package/dist/contracts/index.d.ts +84 -1
  9. package/dist/contracts/index.js +18 -0
  10. package/dist/contracts/partsOffice.contract.d.ts +171 -0
  11. package/dist/contracts/partsOffice.contract.js +22 -0
  12. package/dist/contracts/procedure.contract.d.ts +50 -0
  13. package/dist/contracts/procedure.contract.js +11 -0
  14. package/dist/contracts/registerBook.contract.d.ts +27 -0
  15. package/dist/contracts/registerBook.contract.js +8 -0
  16. package/dist/contracts/signatureBatch.contract.d.ts +109 -0
  17. package/dist/contracts/signatureBatch.contract.js +12 -0
  18. package/dist/contracts/workFolder.contract.d.ts +114 -0
  19. package/dist/contracts/workFolder.contract.js +16 -0
  20. package/dist/entities/caseFile/caseFile.entity.d.ts +176 -0
  21. package/dist/entities/caseFile/caseFile.entity.js +2 -0
  22. package/dist/entities/caseFile/index.d.ts +1 -0
  23. package/dist/entities/caseFile/index.js +17 -0
  24. package/dist/entities/document/document.entity.d.ts +248 -1
  25. package/dist/entities/documentType/documentType.entity.d.ts +18 -1
  26. package/dist/entities/index.d.ts +6 -0
  27. package/dist/entities/index.js +6 -0
  28. package/dist/entities/partsOffice/index.d.ts +1 -0
  29. package/dist/entities/partsOffice/index.js +17 -0
  30. package/dist/entities/partsOffice/partsOffice.entity.d.ts +98 -0
  31. package/dist/entities/partsOffice/partsOffice.entity.js +2 -0
  32. package/dist/entities/procedure/index.d.ts +1 -0
  33. package/dist/entities/procedure/index.js +17 -0
  34. package/dist/entities/procedure/procedure.entity.d.ts +20 -0
  35. package/dist/entities/procedure/procedure.entity.js +2 -0
  36. package/dist/entities/registerBook/index.d.ts +1 -0
  37. package/dist/entities/registerBook/index.js +17 -0
  38. package/dist/entities/registerBook/registerBook.entity.d.ts +42 -0
  39. package/dist/entities/registerBook/registerBook.entity.js +2 -0
  40. package/dist/entities/signatureBatch/index.d.ts +1 -0
  41. package/dist/entities/signatureBatch/index.js +17 -0
  42. package/dist/entities/signatureBatch/signatureBatch.entity.d.ts +107 -0
  43. package/dist/entities/signatureBatch/signatureBatch.entity.js +2 -0
  44. package/dist/entities/workFolder/index.d.ts +1 -0
  45. package/dist/entities/workFolder/index.js +17 -0
  46. package/dist/entities/workFolder/workFolder.entity.d.ts +83 -0
  47. package/dist/entities/workFolder/workFolder.entity.js +2 -0
  48. package/package.json +1 -1
  49. package/src/base/entities.ts +509 -1
  50. package/src/contracts/caseFile.contract.ts +141 -0
  51. package/src/contracts/document.contract.ts +155 -0
  52. package/src/contracts/documentType.contract.ts +14 -1
  53. package/src/contracts/index.ts +26 -1
  54. package/src/contracts/partsOffice.contract.ts +120 -0
  55. package/src/contracts/procedure.contract.ts +53 -0
  56. package/src/contracts/registerBook.contract.ts +24 -0
  57. package/src/contracts/signatureBatch.contract.ts +96 -0
  58. package/src/contracts/workFolder.contract.ts +75 -0
  59. package/src/entities/caseFile/caseFile.entity.ts +204 -0
  60. package/src/entities/caseFile/index.ts +1 -0
  61. package/src/entities/document/document.entity.ts +259 -0
  62. package/src/entities/documentType/documentType.entity.ts +20 -1
  63. package/src/entities/index.ts +6 -0
  64. package/src/entities/partsOffice/index.ts +1 -0
  65. package/src/entities/partsOffice/partsOffice.entity.ts +103 -0
  66. package/src/entities/procedure/index.ts +1 -0
  67. package/src/entities/procedure/procedure.entity.ts +24 -0
  68. package/src/entities/registerBook/index.ts +1 -0
  69. package/src/entities/registerBook/registerBook.entity.ts +46 -0
  70. package/src/entities/signatureBatch/index.ts +1 -0
  71. package/src/entities/signatureBatch/signatureBatch.entity.ts +110 -0
  72. package/src/entities/workFolder/index.ts +1 -0
  73. package/src/entities/workFolder/workFolder.entity.ts +84 -0
  74. package/tsconfig.json +1 -3
@@ -0,0 +1,75 @@
1
+ import {
2
+ type WorkFolderConvertInput,
3
+ type WorkFolderConvertResponseEntity,
4
+ type WorkFolderGetAllResponseEntity,
5
+ type WorkFolderGetByIdResponseEntity,
6
+ type WorkFolderWriteResponseEntity,
7
+ } from '../entities';
8
+ import { type RpcPage } from './contract';
9
+ import { type DocumentActor } from './document.contract';
10
+
11
+ /** Patrones NATS de `workFolder` (carpetas de trabajo): `<servicio>.<recurso>.<acción>`. */
12
+ export const WorkFolderPatterns = {
13
+ getAll: 'gestorDocumental.workFolder.getAll',
14
+ getById: 'gestorDocumental.workFolder.getById',
15
+ create: 'gestorDocumental.workFolder.create',
16
+ update: 'gestorDocumental.workFolder.update',
17
+ share: 'gestorDocumental.workFolder.share',
18
+ unshare: 'gestorDocumental.workFolder.unshare',
19
+ addItem: 'gestorDocumental.workFolder.addItem',
20
+ removeItem: 'gestorDocumental.workFolder.removeItem',
21
+ remove: 'gestorDocumental.workFolder.remove',
22
+ convert: 'gestorDocumental.workFolder.convert',
23
+ } as const;
24
+
25
+ /** Lo que se agrega a una carpeta: un documento finalizado del gestor o un archivo ya subido. */
26
+ export type WorkFolderItemInput =
27
+ { kind: 'Document'; documentId: string } | { kind: 'File'; fileId: string; fileName: string; title: string };
28
+
29
+ type TActor = { actor: DocumentActor };
30
+
31
+ /**
32
+ * Carpetas de trabajo: agrupan y comparten documentos y archivos sin procedimiento asociado. Las ven su responsable y
33
+ * aquellos con quienes la compartió.
34
+ */
35
+ export interface WorkFolderContract {
36
+ [WorkFolderPatterns.getAll]: {
37
+ payload: { pagination?: { page?: number; limit?: number }; filters?: { search?: string } } & TActor;
38
+ response: RpcPage<WorkFolderGetAllResponseEntity[]>;
39
+ };
40
+ [WorkFolderPatterns.getById]: { payload: { id: string } & TActor; response: WorkFolderGetByIdResponseEntity };
41
+ [WorkFolderPatterns.create]: {
42
+ payload: { name: string; description?: string | null } & TActor;
43
+ response: WorkFolderWriteResponseEntity;
44
+ };
45
+ [WorkFolderPatterns.update]: {
46
+ payload: { id: string; name: string; description?: string | null } & TActor;
47
+ response: WorkFolderWriteResponseEntity;
48
+ };
49
+ [WorkFolderPatterns.share]: {
50
+ payload: { id: string; employeeIds: string[] } & TActor;
51
+ response: WorkFolderWriteResponseEntity;
52
+ };
53
+ [WorkFolderPatterns.unshare]: {
54
+ payload: { id: string; participantId: string } & TActor;
55
+ response: WorkFolderWriteResponseEntity;
56
+ };
57
+ [WorkFolderPatterns.addItem]: {
58
+ payload: { id: string; item: WorkFolderItemInput } & TActor;
59
+ response: WorkFolderWriteResponseEntity;
60
+ };
61
+ [WorkFolderPatterns.removeItem]: {
62
+ payload: { id: string; itemId: string } & TActor;
63
+ response: WorkFolderWriteResponseEntity;
64
+ };
65
+ /** La carpeta deja de verse. Lo que contiene no se toca: los documentos siguen en el gestor. */
66
+ [WorkFolderPatterns.remove]: { payload: { id: string } & TActor; response: WorkFolderWriteResponseEntity };
67
+ /**
68
+ * La convierte en expediente: lo crea con estos metadatos, lo comparte con los mismos funcionarios e incorpora sus
69
+ * ítems al índice en el orden en que se agregaron. Desde ahí la carpeta queda solo de consulta.
70
+ */
71
+ [WorkFolderPatterns.convert]: {
72
+ payload: { id: string } & WorkFolderConvertInput & TActor;
73
+ response: WorkFolderConvertResponseEntity;
74
+ };
75
+ }
@@ -0,0 +1,204 @@
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
+ /** Lote incorporado: cuántos documentos entraron y cuántos se omitieron (ya estaban, o no finalizados). */
163
+ export interface CaseFileAddBatchResponseEntity {
164
+ id: CaseFileEntity['id'];
165
+ added: number;
166
+ skipped: number;
167
+ ok: boolean;
168
+ }
169
+
170
+ export interface CaseFileAddEntryResponseEntity {
171
+ id: CaseFileEntity['id'];
172
+ entryId: CaseFileEntryEntity['id'];
173
+ sequence: CaseFileEntryEntity['sequence'];
174
+ ok: boolean;
175
+ }
176
+
177
+ /** Archivo de una entrada del índice, para servirlo a quien puede ver el expediente. */
178
+ export interface CaseFileEntryFileResponseEntity {
179
+ fileId: string;
180
+ fileName: string;
181
+ }
182
+
183
+ /** Archivo que va dentro del expediente exportado, con la huella que tenía al incorporarse. */
184
+ export interface CaseFileExportFileEntity {
185
+ entryId: CaseFileEntryEntity['id'];
186
+ sequence: CaseFileEntryEntity['sequence'];
187
+ /** Ruta dentro del ZIP. Ej: `documentos/001-decreto-alcaldicio-exento-590-2026.pdf`. */
188
+ path: string;
189
+ fileId: string;
190
+ sha256: string | null;
191
+ }
192
+
193
+ /**
194
+ * Expediente listo para exportar: los metadatos con sus códigos oficiales (va tal cual como `expediente.json`) y los
195
+ * archivos que hay que agregar. El ZIP lo arma el gateway.
196
+ */
197
+ export interface CaseFileExportResponseEntity {
198
+ code: CaseFileEntity['code'];
199
+ manifest: Record<string, unknown>;
200
+ files: CaseFileExportFileEntity[];
201
+ }
202
+
203
+ /** Expediente en que está incorporado un documento, visto desde el documento. */
204
+ export type DocumentCaseFileEntity = CaseFileLinkEntity;
@@ -0,0 +1 @@
1
+ export * from './caseFile.entity';
@@ -1,8 +1,10 @@
1
1
  import {
2
2
  DocumentAnnulledNumberEntity,
3
3
  DocumentAttachmentEntity,
4
+ DocumentDeliveryEntity,
4
5
  DocumentEntity,
5
6
  DocumentParticipantEntity,
7
+ DocumentRecipientEntity,
6
8
  DocumentTrackingEntity,
7
9
  DocumentTypeEntity,
8
10
  } from '../../base/entities';
@@ -19,6 +21,8 @@ export interface DocumentParticipantResponseEntity {
19
21
  id: DocumentParticipantEntity['id'];
20
22
  role: DocumentParticipantEntity['role'];
21
23
  order: DocumentParticipantEntity['order'];
24
+ /** Los visadores de una misma etapa visan a la vez. */
25
+ stage: DocumentParticipantEntity['stage'];
22
26
  status: DocumentParticipantEntity['status'];
23
27
  employeeId: DocumentParticipantEntity['employeeId'];
24
28
  fullName: DocumentParticipantEntity['fullName'];
@@ -27,6 +31,78 @@ export interface DocumentParticipantResponseEntity {
27
31
  resolvedAt: DocumentParticipantEntity['resolvedAt'];
28
32
  }
29
33
 
34
+ /** Destinatario de un documento, como lo eligió el redactor: una persona o un área completa. */
35
+ export interface DocumentRecipientResponseEntity {
36
+ id: DocumentRecipientEntity['id'];
37
+ type: DocumentRecipientEntity['type'];
38
+ employeeId: DocumentRecipientEntity['employeeId'];
39
+ directorateCodeReference: DocumentRecipientEntity['directorateCodeReference'];
40
+ departmentId: DocumentRecipientEntity['departmentId'];
41
+ name: DocumentRecipientEntity['name'];
42
+ position: DocumentRecipientEntity['position'];
43
+ }
44
+
45
+ /** Un documento en la bandeja de un funcionario: como destinatario o porque se lo derivaron. */
46
+ export interface DocumentDeliveryResponseEntity {
47
+ id: DocumentDeliveryEntity['id'];
48
+ origin: DocumentDeliveryEntity['origin'];
49
+ employeeId: DocumentDeliveryEntity['employeeId'];
50
+ fullName: DocumentDeliveryEntity['fullName'];
51
+ position: DocumentDeliveryEntity['position'];
52
+ // Área por la que le llegó, si el documento iba dirigido a un área.
53
+ areaName: DocumentDeliveryEntity['areaName'];
54
+ // Quién se lo derivó. Null si es uno de los destinatarios originales.
55
+ sentByEmployeeId: DocumentDeliveryEntity['sentByEmployeeId'];
56
+ sentByFullName: DocumentDeliveryEntity['sentByFullName'];
57
+ instruction: DocumentDeliveryEntity['instruction'];
58
+ note: DocumentDeliveryEntity['note'];
59
+ dueAt: DocumentDeliveryEntity['dueAt'];
60
+ // Null mientras el documento no termina su tramitación.
61
+ deliveredAt: DocumentDeliveryEntity['deliveredAt'];
62
+ readAt: DocumentDeliveryEntity['readAt'];
63
+ closedAt: DocumentDeliveryEntity['closedAt'];
64
+ closingNote: DocumentDeliveryEntity['closingNote'];
65
+ }
66
+
67
+ /** Lo necesario para citar otro documento y enlazarlo (el que se responde, o las respuestas). */
68
+ export interface DocumentLinkEntity {
69
+ id: DocumentEntity['id'];
70
+ subject: DocumentEntity['subject'];
71
+ status: DocumentEntity['status'];
72
+ correlative: DocumentEntity['correlative'];
73
+ correlativeYear: DocumentEntity['correlativeYear'];
74
+ createdByFullName: DocumentEntity['createdByFullName'];
75
+ finishedAt: DocumentEntity['finishedAt'];
76
+ documentType: DocumentTypeSummaryEntity;
77
+ /** Folio de ingreso de Oficina de Partes, si llegó por DocDigital. */
78
+ intakeNumber: DocumentEntity['intakeNumber'];
79
+ intakeYear: DocumentEntity['intakeYear'];
80
+ }
81
+
82
+ /** Institución (y usuario) de DocDigital a la que va dirigido un documento. */
83
+ export interface DocumentExternalRecipientResponseEntity {
84
+ id: string;
85
+ entityId: number;
86
+ entityName: string;
87
+ userId: number | null;
88
+ userName: string | null;
89
+ userPosition: string | null;
90
+ }
91
+
92
+ /** Despacho de un documento por DocDigital. */
93
+ export interface DocumentDispatchResponseEntity {
94
+ id: string;
95
+ status: 'Pending' | 'Dispatched' | 'Returned';
96
+ folio: string | null;
97
+ docDigitalTypeName: string | null;
98
+ docDigitalDocumentId: string | null;
99
+ dispatchedAt: string | null;
100
+ dispatchedByFullName: string | null;
101
+ returnedAt: string | null;
102
+ returnedByFullName: string | null;
103
+ returnReason: string | null;
104
+ }
105
+
30
106
  export interface DocumentGetAllResponseEntity {
31
107
  id: DocumentEntity['id'];
32
108
  subject: DocumentEntity['subject'];
@@ -40,8 +116,22 @@ export interface DocumentGetAllResponseEntity {
40
116
  createdByEmployeeId: DocumentEntity['createdByEmployeeId'];
41
117
  createdByFullName: DocumentEntity['createdByFullName'];
42
118
  documentType: DocumentTypeSummaryEntity;
119
+ intakeNumber: DocumentEntity['intakeNumber'];
120
+ intakeYear: DocumentEntity['intakeYear'];
121
+ origin: DocumentEntity['origin'];
122
+ /** Con búsqueda de texto completo: el fragmento donde aparece lo buscado, con lo encontrado entre ⟦ y ⟧. */
123
+ snippet?: string | null;
43
124
  // A quién le toca visar o firmar (null si el documento no está en tramitación).
44
125
  currentParticipant: Pick<DocumentParticipantResponseEntity, 'role' | 'employeeId' | 'fullName'> | null;
126
+ // Cuántos más tienen el turno a la vez (visación en paralelo).
127
+ otherCurrentCount: number;
128
+ // A cuántos funcionarios llegó y cuántos ya lo abrieron (null si aún no se distribuye a nadie).
129
+ distribution: { total: number; read: number } | null;
130
+ }
131
+
132
+ /** Una entrada de la bandeja de recibidos: la entrega y el documento al que corresponde. */
133
+ export interface DocumentInboxItemEntity extends DocumentDeliveryResponseEntity {
134
+ document: DocumentLinkEntity;
45
135
  }
46
136
 
47
137
  export interface DocumentGetByIdResponseEntity {
@@ -82,6 +172,31 @@ export interface DocumentGetByIdResponseEntity {
82
172
  employeeFullName: DocumentAnnulledNumberEntity['employeeFullName'];
83
173
  createdAt: DocumentAnnulledNumberEntity['createdAt'];
84
174
  }[];
175
+ // Plazo en que el redactor espera respuesta de los destinatarios.
176
+ responseDueAt: DocumentEntity['responseDueAt'];
177
+ // A quién va dirigido, como lo indicó el redactor (personas y áreas).
178
+ recipients: DocumentRecipientResponseEntity[];
179
+ // En la bandeja de quién está: destinatarios y derivaciones, con su lectura y atención.
180
+ deliveries: DocumentDeliveryResponseEntity[];
181
+ // Documento al que este responde, y los que le responden (solo los ya finalizados, más los propios de quien consulta).
182
+ replyTo: DocumentLinkEntity | null;
183
+ /** Lote de firma al que pertenece. */
184
+ batch: { id: string; name: string } | null;
185
+ /** Contenido redactado en el sistema con una plantilla, para volver a editarlo (sin valor si se subió un PDF). */
186
+ composition: DocumentComposition | null;
187
+ replies: DocumentLinkEntity[];
188
+ /** Expedientes en que está incorporado y que quien consulta puede ver. */
189
+ caseFiles: { id: string; code: string; title: string; status: 'Open' | 'Closed' }[];
190
+ /** De dónde viene: del gestor o recibido por DocDigital, con su folio de ingreso y los datos de quien lo envió. */
191
+ origin: DocumentEntity['origin'];
192
+ intakeNumber: DocumentEntity['intakeNumber'];
193
+ intakeYear: DocumentEntity['intakeYear'];
194
+ externalFolio: DocumentEntity['externalFolio'];
195
+ externalSender: DocumentEntity['externalSender'];
196
+ externalDate: DocumentEntity['externalDate'];
197
+ /** Instituciones de DocDigital a quienes va dirigido, y su despacho por Oficina de Partes. */
198
+ externalRecipients: DocumentExternalRecipientResponseEntity[];
199
+ dispatch: DocumentDispatchResponseEntity | null;
85
200
  documentType: DocumentTypeSummaryEntity;
86
201
  participants: DocumentParticipantResponseEntity[];
87
202
  attachments: {
@@ -105,6 +220,15 @@ export interface DocumentGetByIdResponseEntity {
105
220
  turn: Pick<DocumentParticipantResponseEntity, 'id' | 'role'> | null;
106
221
  canEdit: boolean;
107
222
  canDiscard: boolean;
223
+ // Puede derivarlo a otros funcionarios y responderlo: el documento ya es oficial y está a su alcance.
224
+ canDerive: boolean;
225
+ canReply: boolean;
226
+ // Es quien redactó un documento en tramitación: puede pasar un turno pendiente a otro funcionario.
227
+ canReassign: boolean;
228
+ /** Quien consulta redactó el documento (o lo ingresó, si llegó por DocDigital). */
229
+ isAuthor: boolean;
230
+ // Sus propias entregas de este documento (puede tener más de una si además se lo derivaron).
231
+ inbox: DocumentDeliveryResponseEntity[];
108
232
  };
109
233
  // Firmar exige el código OTP de quien firma (firma atendida).
110
234
  signatureRequiresOtp: boolean;
@@ -114,12 +238,20 @@ export interface DocumentGetByIdResponseEntity {
114
238
  export interface DocumentGetSummaryResponseEntity {
115
239
  toVisa: number;
116
240
  toSign: number;
241
+ /** Lotes de firma con documentos en su turno (los documentos de un lote no se cuentan en `toVisa` ni `toSign`). */
242
+ batches: { toVisa: number; toSign: number };
117
243
  created: {
118
244
  drafted: number;
119
245
  inProgress: number;
120
246
  rejected: number;
121
247
  finished: number;
122
248
  };
249
+ // Su bandeja de recibidos: sin abrir, sin atender y, de estos, con el plazo vencido.
250
+ received: {
251
+ unread: number;
252
+ pending: number;
253
+ overdue: number;
254
+ };
123
255
  }
124
256
 
125
257
  export interface DocumentCreateResponseEntity {
@@ -138,6 +270,29 @@ export interface DocumentReviewResponseEntity {
138
270
  status: DocumentEntity['status'];
139
271
  }
140
272
 
273
+ /** Resultado de un documento en una firma de varios documentos. */
274
+ export interface DocumentSignManyResultEntity {
275
+ id: DocumentEntity['id'];
276
+ ok: boolean;
277
+ /** Estado en que quedó, si se firmó. */
278
+ status?: DocumentEntity['status'];
279
+ /** Por qué no se firmó. */
280
+ message?: string;
281
+ }
282
+
283
+ /**
284
+ * Firma de varios documentos con un solo OTP. FirmaGob admite 5 MB por solicitud: los que no cupieron quedan en
285
+ * `remaining`, en el turno del firmante, para firmarlos con un OTP nuevo.
286
+ */
287
+ export interface DocumentSignManyResponseEntity {
288
+ results: DocumentSignManyResultEntity[];
289
+ signed: number;
290
+ failed: number;
291
+ remaining: DocumentEntity['id'][];
292
+ /** FirmaGob avisó que el OTP venció antes de firmar todos los documentos de la solicitud. */
293
+ otpExpired: boolean;
294
+ }
295
+
141
296
  export interface DocumentDiscardResponseEntity {
142
297
  id: DocumentEntity['id'];
143
298
  ok: boolean;
@@ -185,3 +340,107 @@ export interface DocumentPublicFileResponseEntity {
185
340
  fileId: string;
186
341
  fileName: string;
187
342
  }
343
+
344
+ export interface DocumentDeriveResponseEntity {
345
+ id: DocumentEntity['id'];
346
+ ok: boolean;
347
+ // A cuántos funcionarios llegó la derivación.
348
+ delivered: number;
349
+ }
350
+
351
+ export interface DocumentCloseDeliveryResponseEntity {
352
+ id: DocumentDeliveryEntity['id'];
353
+ ok: boolean;
354
+ }
355
+
356
+ export interface DocumentReassignResponseEntity {
357
+ id: DocumentEntity['id'];
358
+ ok: boolean;
359
+ }
360
+
361
+ /**
362
+ * Un plazo en la agenda de un funcionario: lo que recibió (como destinatario o por derivación) y debe atender, o un
363
+ * documento que envió y del que espera respuesta.
364
+ */
365
+ export interface DocumentAgendaItemEntity {
366
+ kind: 'Received' | 'Sent';
367
+ /** La entrega (lo recibido) o el documento (lo enviado). */
368
+ id: string;
369
+ documentId: DocumentEntity['id'];
370
+ subject: DocumentEntity['subject'];
371
+ documentType: { name: string; abbreviation: string | null };
372
+ correlative: DocumentEntity['correlative'];
373
+ correlativeYear: DocumentEntity['correlativeYear'];
374
+ intakeNumber: DocumentEntity['intakeNumber'];
375
+ intakeYear: DocumentEntity['intakeYear'];
376
+ /** Plazo, en ISO 8601. */
377
+ dueAt: string;
378
+ /** Lo recibido: cuándo lo marcó como atendido (sin valor si sigue pendiente). */
379
+ closedAt: string | null;
380
+ /** Lo recibido: la providencia y quién lo derivó. */
381
+ instruction: DocumentDeliveryEntity['instruction'] | null;
382
+ sentByFullName: string | null;
383
+ /** Lo enviado: a cuántos les llegó y cuántos aún no lo atienden. */
384
+ recipients: { total: number; pending: number } | null;
385
+ }
386
+
387
+ export interface DocumentAgendaResponseEntity {
388
+ /** Plazos dentro del período pedido. */
389
+ items: DocumentAgendaItemEntity[];
390
+ /** Lo recibido con el plazo vencido y sin atender, de cualquier fecha (los 50 más antiguos). */
391
+ overdue: DocumentAgendaItemEntity[];
392
+ }
393
+
394
+ /** Trazabilidad de un documento en PDF, lista para descargar. */
395
+ export interface DocumentTrailExportEntity {
396
+ fileName: string;
397
+ contentType: string;
398
+ contentBase64: string;
399
+ }
400
+
401
+ /** Plantilla oficial con que se redacta un documento en el sistema. */
402
+ export type DocumentTemplateKind = 'Decree' | 'Office' | 'Memorandum' | 'General';
403
+
404
+ /**
405
+ * Contenido de un documento redactado en el sistema. Cada plantilla tiene su estructura; los párrafos son texto
406
+ * (un salto de línea dentro de un párrafo se respeta). La materia es el asunto del documento.
407
+ */
408
+ export type DocumentComposition =
409
+ | {
410
+ template: 'Decree';
411
+ /** VISTOS: las normas y antecedentes. */
412
+ vistos: string[];
413
+ /** CONSIDERANDO: cada fundamento, numerado. */
414
+ considerando: string[];
415
+ /** DECRETO: cada punto resolutivo, numerado. */
416
+ resolutive: string[];
417
+ /** Fórmula de cierre: «Anótese, comuníquese y archívese». */
418
+ closing: string;
419
+ distribution: string[];
420
+ }
421
+ | {
422
+ template: 'Office';
423
+ /** ANT.: antecedentes (otro oficio, una solicitud). */
424
+ antecedents?: string | null;
425
+ from: string;
426
+ to: string;
427
+ body: string[];
428
+ closing: string;
429
+ distribution: string[];
430
+ }
431
+ | {
432
+ template: 'Memorandum';
433
+ from: string;
434
+ to: string;
435
+ body: string[];
436
+ closing?: string | null;
437
+ distribution: string[];
438
+ }
439
+ | { template: 'General'; title: string; body: string[]; closing?: string | null };
440
+
441
+ /** PDF armado con una plantilla: para la vista previa (`contentBase64`) o ya subido (`fileId`). */
442
+ export interface DocumentComposeResponseEntity {
443
+ fileName: string;
444
+ fileId?: string;
445
+ contentBase64?: string;
446
+ }
@@ -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'];
@@ -9,14 +22,20 @@ export interface DocumentTypeGetAllResponseEntity {
9
22
  nextCorrelative: DocumentTypeEntity['nextCorrelative'];
10
23
  correlativeYear: DocumentTypeEntity['correlativeYear'];
11
24
  resetsYearly: DocumentTypeEntity['resetsYearly'];
25
+ // Sin numeración, sus documentos solo llevan fecha, código de verificación y QR.
26
+ numbered: DocumentTypeEntity['numbered'];
12
27
  directorateCodeReference: DocumentTypeEntity['directorateCodeReference'];
13
28
  enabled: DocumentTypeEntity['enabled'];
29
+ // Cuántos visadores y firmantes tiene su flujo sugerido.
30
+ flow: { visa: number; signature: number };
14
31
  }
15
32
 
16
33
  export interface DocumentTypeGetByIdResponseEntity extends DocumentTypeGetAllResponseEntity {
17
34
  // Último número ya asignado en el año vigente del correlativo (null si aún no se numera ninguno): el próximo
18
35
  // correlativo no puede quedar por debajo de él.
19
36
  lastCorrelative: number | null;
37
+ // Flujo sugerido: primero los visadores y después los firmantes, cada grupo en su orden.
38
+ flowSteps: DocumentTypeFlowStepResponseEntity[];
20
39
  }
21
40
 
22
41
  export interface DocumentTypeCreateResponseEntity {
@@ -1,2 +1,8 @@
1
1
  export * from './documentType';
2
2
  export * from './document';
3
+ export * from './procedure';
4
+ export * from './caseFile';
5
+ export * from './partsOffice';
6
+ export * from './registerBook';
7
+ export * from './signatureBatch';
8
+ export * from './workFolder';
@@ -0,0 +1 @@
1
+ export * from './partsOffice.entity';