@muni-sanfer/types-gestor-documental 0.0.1-beta.7 → 0.0.1-beta.9

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.
@@ -250,6 +250,7 @@ export interface DocumentParticipantEntity {
250
250
  id: string;
251
251
  role: DocumentParticipantRole;
252
252
  order: number;
253
+ stage: number;
253
254
  status: DocumentParticipantStatus;
254
255
  employeeId: string;
255
256
  fullName: string;
@@ -1,5 +1,5 @@
1
1
  import { type DocumentAccessLevel, type DocumentAttachmentEntity, type DocumentDeliveryEntity, type DocumentEntity, type DocumentInstruction, type DocumentParticipantEntity, type DocumentStatus } from '../base/entities';
2
- import { type DocumentAnnulResponseEntity, type DocumentCloseDeliveryResponseEntity, type DocumentCreateResponseEntity, type DocumentDeriveResponseEntity, type DocumentDiscardResponseEntity, type DocumentGetAllResponseEntity, type DocumentGetByIdResponseEntity, type DocumentGetSummaryResponseEntity, type DocumentInboxItemEntity, type DocumentPublicFileResponseEntity, type DocumentReassignResponseEntity, type DocumentReviewResponseEntity, type DocumentSignManyResponseEntity, type DocumentUpdateResponseEntity, type DocumentVerifyResponseEntity } from '../entities';
2
+ import { type DocumentAnnulResponseEntity, type DocumentCloseDeliveryResponseEntity, type DocumentCreateResponseEntity, type DocumentDeriveResponseEntity, type DocumentDiscardResponseEntity, type DocumentGetAllResponseEntity, type DocumentGetByIdResponseEntity, type DocumentGetSummaryResponseEntity, type DocumentInboxItemEntity, type DocumentPublicFileResponseEntity, type DocumentReassignResponseEntity, type DocumentReviewResponseEntity, type DocumentSignManyResponseEntity, type DocumentAgendaResponseEntity, 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>`. */
5
5
  export declare const DocumentPatterns: {
@@ -19,6 +19,8 @@ export declare const DocumentPatterns: {
19
19
  readonly verify: "gestorDocumental.document.verify";
20
20
  readonly getPublicFile: "gestorDocumental.document.getPublicFile";
21
21
  readonly getFilesFolder: "gestorDocumental.document.getFilesFolder";
22
+ readonly getAgenda: "gestorDocumental.document.getAgenda";
23
+ readonly exportTrail: "gestorDocumental.document.exportTrail";
22
24
  };
23
25
  /**
24
26
  * Funcionario que hace la operación y sus áreas (direcciones y departamentos a los que pertenece o que dirige). Lo
@@ -69,6 +71,8 @@ export interface DocumentWritePayload extends Pick<DocumentEntity, 'subject' | '
69
71
  };
70
72
  attachments?: Pick<DocumentAttachmentEntity, 'name' | 'type' | 'fileId' | 'url'>[];
71
73
  visaEmployeeIds: string[];
74
+ visaStages?: number[] | null;
75
+ restartFlow?: boolean;
72
76
  signatureEmployeeIds: string[];
73
77
  signatureSheet?: boolean;
74
78
  recipients?: DocumentRecipientInput[];
@@ -87,6 +91,27 @@ export interface DocumentExternalRecipientInput {
87
91
  * Qué se envía y qué se responde en cada patrón. Generado desde los handlers y los DTO del microservicio.
88
92
  */
89
93
  export interface DocumentContract {
94
+ /** Plazos del funcionario entre `from` y `to` (hasta 62 días), y lo que tiene vencido sin atender. */
95
+ [DocumentPatterns.getAgenda]: {
96
+ payload: {
97
+ from: string;
98
+ to: string;
99
+ actor: DocumentActor;
100
+ };
101
+ response: DocumentAgendaResponseEntity;
102
+ };
103
+ /**
104
+ * Trazabilidad del documento en PDF: datos, flujo, hechos y huella de sus archivos. Con las mismas reglas de acceso
105
+ * del detalle. `generatedBy`: quién la descarga (va al pie).
106
+ */
107
+ [DocumentPatterns.exportTrail]: {
108
+ payload: Pick<DocumentEntity, 'id'> & {
109
+ actor?: DocumentActor;
110
+ viewAll?: boolean;
111
+ generatedBy: string;
112
+ };
113
+ response: DocumentTrailExportEntity;
114
+ };
90
115
  [DocumentPatterns.getAll]: {
91
116
  payload: {
92
117
  pagination?: {
@@ -19,4 +19,6 @@ exports.DocumentPatterns = {
19
19
  verify: 'gestorDocumental.document.verify',
20
20
  getPublicFile: 'gestorDocumental.document.getPublicFile',
21
21
  getFilesFolder: 'gestorDocumental.document.getFilesFolder',
22
+ getAgenda: 'gestorDocumental.document.getAgenda',
23
+ exportTrail: 'gestorDocumental.document.exportTrail',
22
24
  };
@@ -39,6 +39,8 @@ export declare const GestorDocumentalPatterns: {
39
39
  readonly verify: "gestorDocumental.document.verify";
40
40
  readonly getPublicFile: "gestorDocumental.document.getPublicFile";
41
41
  readonly getFilesFolder: "gestorDocumental.document.getFilesFolder";
42
+ readonly getAgenda: "gestorDocumental.document.getAgenda";
43
+ readonly exportTrail: "gestorDocumental.document.exportTrail";
42
44
  };
43
45
  readonly procedure: {
44
46
  readonly getAll: "gestorDocumental.procedure.getAll";
@@ -56,6 +56,7 @@ export interface SignatureBatchContract {
56
56
  directorateCodeReference?: number | null;
57
57
  departmentId?: string | null;
58
58
  visaEmployeeIds?: string[];
59
+ visaStages?: number[] | null;
59
60
  signatureEmployeeIds: string[];
60
61
  signatureSheet?: boolean;
61
62
  documents: {
@@ -10,6 +10,8 @@ export interface DocumentParticipantResponseEntity {
10
10
  id: DocumentParticipantEntity['id'];
11
11
  role: DocumentParticipantEntity['role'];
12
12
  order: DocumentParticipantEntity['order'];
13
+ /** Los visadores de una misma etapa visan a la vez. */
14
+ stage: DocumentParticipantEntity['stage'];
13
15
  status: DocumentParticipantEntity['status'];
14
16
  employeeId: DocumentParticipantEntity['employeeId'];
15
17
  fullName: DocumentParticipantEntity['fullName'];
@@ -100,6 +102,7 @@ export interface DocumentGetAllResponseEntity {
100
102
  /** Con búsqueda de texto completo: el fragmento donde aparece lo buscado, con lo encontrado entre ⟦ y ⟧. */
101
103
  snippet?: string | null;
102
104
  currentParticipant: Pick<DocumentParticipantResponseEntity, 'role' | 'employeeId' | 'fullName'> | null;
105
+ otherCurrentCount: number;
103
106
  distribution: {
104
107
  total: number;
105
108
  read: number;
@@ -307,3 +310,46 @@ export interface DocumentReassignResponseEntity {
307
310
  id: DocumentEntity['id'];
308
311
  ok: boolean;
309
312
  }
313
+ /**
314
+ * Un plazo en la agenda de un funcionario: lo que recibió (como destinatario o por derivación) y debe atender, o un
315
+ * documento que envió y del que espera respuesta.
316
+ */
317
+ export interface DocumentAgendaItemEntity {
318
+ kind: 'Received' | 'Sent';
319
+ /** La entrega (lo recibido) o el documento (lo enviado). */
320
+ id: string;
321
+ documentId: DocumentEntity['id'];
322
+ subject: DocumentEntity['subject'];
323
+ documentType: {
324
+ name: string;
325
+ abbreviation: string | null;
326
+ };
327
+ correlative: DocumentEntity['correlative'];
328
+ correlativeYear: DocumentEntity['correlativeYear'];
329
+ intakeNumber: DocumentEntity['intakeNumber'];
330
+ intakeYear: DocumentEntity['intakeYear'];
331
+ /** Plazo, en ISO 8601. */
332
+ dueAt: string;
333
+ /** Lo recibido: cuándo lo marcó como atendido (sin valor si sigue pendiente). */
334
+ closedAt: string | null;
335
+ /** Lo recibido: la providencia y quién lo derivó. */
336
+ instruction: DocumentDeliveryEntity['instruction'] | null;
337
+ sentByFullName: string | null;
338
+ /** Lo enviado: a cuántos les llegó y cuántos aún no lo atienden. */
339
+ recipients: {
340
+ total: number;
341
+ pending: number;
342
+ } | null;
343
+ }
344
+ export interface DocumentAgendaResponseEntity {
345
+ /** Plazos dentro del período pedido. */
346
+ items: DocumentAgendaItemEntity[];
347
+ /** Lo recibido con el plazo vencido y sin atender, de cualquier fecha (los 50 más antiguos). */
348
+ overdue: DocumentAgendaItemEntity[];
349
+ }
350
+ /** Trazabilidad de un documento en PDF, lista para descargar. */
351
+ export interface DocumentTrailExportEntity {
352
+ fileName: string;
353
+ contentType: string;
354
+ contentBase64: string;
355
+ }
@@ -65,6 +65,7 @@ export interface SignatureBatchGetByIdResponseEntity extends SignatureBatchGetAl
65
65
  /** Visadores y firmantes del lote, en orden (los del primer documento: todos parten con el mismo flujo). */
66
66
  flow: {
67
67
  role: DocumentParticipantRole;
68
+ stage: number;
68
69
  employeeId: string;
69
70
  fullName: string;
70
71
  position: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muni-sanfer/types-gestor-documental",
3
- "version": "0.0.1-beta.7",
3
+ "version": "0.0.1-beta.9",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -334,6 +334,7 @@ export interface DocumentParticipantEntity {
334
334
  id: string;
335
335
  role: DocumentParticipantRole;
336
336
  order: number;
337
+ stage: number;
337
338
  status: DocumentParticipantStatus;
338
339
  employeeId: string;
339
340
  fullName: string;
@@ -21,6 +21,8 @@ import {
21
21
  type DocumentReassignResponseEntity,
22
22
  type DocumentReviewResponseEntity,
23
23
  type DocumentSignManyResponseEntity,
24
+ type DocumentAgendaResponseEntity,
25
+ type DocumentTrailExportEntity,
24
26
  type DocumentUpdateResponseEntity,
25
27
  type DocumentVerifyResponseEntity,
26
28
  } from '../entities';
@@ -44,6 +46,8 @@ export const DocumentPatterns = {
44
46
  verify: 'gestorDocumental.document.verify',
45
47
  getPublicFile: 'gestorDocumental.document.getPublicFile',
46
48
  getFilesFolder: 'gestorDocumental.document.getFilesFolder',
49
+ getAgenda: 'gestorDocumental.document.getAgenda',
50
+ exportTrail: 'gestorDocumental.document.exportTrail',
47
51
  } as const;
48
52
 
49
53
  /**
@@ -95,6 +99,10 @@ export interface DocumentWritePayload extends Pick<DocumentEntity, 'subject' | '
95
99
  attachments?: Pick<DocumentAttachmentEntity, 'name' | 'type' | 'fileId' | 'url'>[];
96
100
  // Funcionarios que visan y que firman, en el orden en que les toca. Primero visan todos y después firman.
97
101
  visaEmployeeIds: string[];
102
+ // Etapa de cada visador, en su orden ([1, 1, 2]: los dos primeros visan a la vez). Sin etapas, visan en cadena.
103
+ visaStages?: number[] | null;
104
+ // Al reenviar un documento rechazado, pedir de nuevo las visaciones ya hechas en vez de seguir donde quedó.
105
+ restartFlow?: boolean;
98
106
  signatureEmployeeIds: string[];
99
107
  // Firmas y visaciones en una hoja aparte al final, en vez de al pie de la última página.
100
108
  signatureSheet?: boolean;
@@ -120,6 +128,19 @@ export interface DocumentExternalRecipientInput {
120
128
  * Qué se envía y qué se responde en cada patrón. Generado desde los handlers y los DTO del microservicio.
121
129
  */
122
130
  export interface DocumentContract {
131
+ /** Plazos del funcionario entre `from` y `to` (hasta 62 días), y lo que tiene vencido sin atender. */
132
+ [DocumentPatterns.getAgenda]: {
133
+ payload: { from: string; to: string; actor: DocumentActor };
134
+ response: DocumentAgendaResponseEntity;
135
+ };
136
+ /**
137
+ * Trazabilidad del documento en PDF: datos, flujo, hechos y huella de sus archivos. Con las mismas reglas de acceso
138
+ * del detalle. `generatedBy`: quién la descarga (va al pie).
139
+ */
140
+ [DocumentPatterns.exportTrail]: {
141
+ payload: Pick<DocumentEntity, 'id'> & { actor?: DocumentActor; viewAll?: boolean; generatedBy: string };
142
+ response: DocumentTrailExportEntity;
143
+ };
123
144
  [DocumentPatterns.getAll]: {
124
145
  payload: {
125
146
  pagination?: { page?: number; limit?: number };
@@ -57,6 +57,8 @@ export interface SignatureBatchContract {
57
57
  directorateCodeReference?: number | null;
58
58
  departmentId?: string | null;
59
59
  visaEmployeeIds?: string[];
60
+ // Etapa de cada visador: los de una misma etapa visan a la vez.
61
+ visaStages?: number[] | null;
60
62
  signatureEmployeeIds: string[];
61
63
  signatureSheet?: boolean;
62
64
  documents: { subject: string; file: { fileId: string; name: string } }[];
@@ -21,6 +21,8 @@ export interface DocumentParticipantResponseEntity {
21
21
  id: DocumentParticipantEntity['id'];
22
22
  role: DocumentParticipantEntity['role'];
23
23
  order: DocumentParticipantEntity['order'];
24
+ /** Los visadores de una misma etapa visan a la vez. */
25
+ stage: DocumentParticipantEntity['stage'];
24
26
  status: DocumentParticipantEntity['status'];
25
27
  employeeId: DocumentParticipantEntity['employeeId'];
26
28
  fullName: DocumentParticipantEntity['fullName'];
@@ -121,6 +123,8 @@ export interface DocumentGetAllResponseEntity {
121
123
  snippet?: string | null;
122
124
  // A quién le toca visar o firmar (null si el documento no está en tramitación).
123
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;
124
128
  // A cuántos funcionarios llegó y cuántos ya lo abrieron (null si aún no se distribuye a nadie).
125
129
  distribution: { total: number; read: number } | null;
126
130
  }
@@ -351,3 +355,43 @@ export interface DocumentReassignResponseEntity {
351
355
  id: DocumentEntity['id'];
352
356
  ok: boolean;
353
357
  }
358
+
359
+ /**
360
+ * Un plazo en la agenda de un funcionario: lo que recibió (como destinatario o por derivación) y debe atender, o un
361
+ * documento que envió y del que espera respuesta.
362
+ */
363
+ export interface DocumentAgendaItemEntity {
364
+ kind: 'Received' | 'Sent';
365
+ /** La entrega (lo recibido) o el documento (lo enviado). */
366
+ id: string;
367
+ documentId: DocumentEntity['id'];
368
+ subject: DocumentEntity['subject'];
369
+ documentType: { name: string; abbreviation: string | null };
370
+ correlative: DocumentEntity['correlative'];
371
+ correlativeYear: DocumentEntity['correlativeYear'];
372
+ intakeNumber: DocumentEntity['intakeNumber'];
373
+ intakeYear: DocumentEntity['intakeYear'];
374
+ /** Plazo, en ISO 8601. */
375
+ dueAt: string;
376
+ /** Lo recibido: cuándo lo marcó como atendido (sin valor si sigue pendiente). */
377
+ closedAt: string | null;
378
+ /** Lo recibido: la providencia y quién lo derivó. */
379
+ instruction: DocumentDeliveryEntity['instruction'] | null;
380
+ sentByFullName: string | null;
381
+ /** Lo enviado: a cuántos les llegó y cuántos aún no lo atienden. */
382
+ recipients: { total: number; pending: number } | null;
383
+ }
384
+
385
+ export interface DocumentAgendaResponseEntity {
386
+ /** Plazos dentro del período pedido. */
387
+ items: DocumentAgendaItemEntity[];
388
+ /** Lo recibido con el plazo vencido y sin atender, de cualquier fecha (los 50 más antiguos). */
389
+ overdue: DocumentAgendaItemEntity[];
390
+ }
391
+
392
+ /** Trazabilidad de un documento en PDF, lista para descargar. */
393
+ export interface DocumentTrailExportEntity {
394
+ fileName: string;
395
+ contentType: string;
396
+ contentBase64: string;
397
+ }
@@ -60,7 +60,13 @@ export interface SignatureBatchGetByIdResponseEntity extends SignatureBatchGetAl
60
60
  accessLevel: DocumentAccessLevel;
61
61
  hasSensitiveData: boolean;
62
62
  /** Visadores y firmantes del lote, en orden (los del primer documento: todos parten con el mismo flujo). */
63
- flow: { role: DocumentParticipantRole; employeeId: string; fullName: string; position: string | null }[];
63
+ flow: {
64
+ role: DocumentParticipantRole;
65
+ stage: number;
66
+ employeeId: string;
67
+ fullName: string;
68
+ position: string | null;
69
+ }[];
64
70
  documents: SignatureBatchDocumentEntity[];
65
71
  }
66
72