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

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.
@@ -33,7 +33,7 @@ export declare const DocumentParticipantStatus: {
33
33
  Resolved: "Resolved";
34
34
  Rejected: "Rejected";
35
35
  };
36
- export type DocumentTrackingAction = 'Created' | 'Updated' | 'Submitted' | 'Visaed' | 'Signed' | 'Rejected' | 'Finished' | 'Discarded' | 'Numbered' | 'NumberAnnulled' | 'Annulled' | 'Delivered' | 'Derived';
36
+ export type DocumentTrackingAction = 'Created' | 'Updated' | 'Submitted' | 'Visaed' | 'Signed' | 'Rejected' | 'Finished' | 'Discarded' | 'Numbered' | 'NumberAnnulled' | 'Annulled' | 'Delivered' | 'Derived' | 'Reassigned';
37
37
  export declare const DocumentTrackingAction: {
38
38
  Created: "Created";
39
39
  Updated: "Updated";
@@ -48,6 +48,12 @@ export declare const DocumentTrackingAction: {
48
48
  Annulled: "Annulled";
49
49
  Delivered: "Delivered";
50
50
  Derived: "Derived";
51
+ Reassigned: "Reassigned";
52
+ };
53
+ export type DocumentFlowStepType = 'Employee' | 'DirectorateHead';
54
+ export declare const DocumentFlowStepType: {
55
+ Employee: "Employee";
56
+ DirectorateHead: "DirectorateHead";
51
57
  };
52
58
  export type DocumentAttachmentType = 'File' | 'Link';
53
59
  export declare const DocumentAttachmentType: {
@@ -85,6 +91,7 @@ export interface DocumentTypeEntity {
85
91
  enabled: boolean;
86
92
  documents?: DocumentEntity[];
87
93
  annulledNumbers?: DocumentAnnulledNumberEntity[];
94
+ flowSteps?: DocumentTypeFlowStepEntity[];
88
95
  deleted: boolean;
89
96
  createdAt: string;
90
97
  updatedAt: string;
@@ -211,3 +218,16 @@ export interface DocumentDeliveryEntity {
211
218
  documentId: string;
212
219
  createdAt: string;
213
220
  }
221
+ export interface DocumentTypeFlowStepEntity {
222
+ id: string;
223
+ role: DocumentParticipantRole;
224
+ order: number;
225
+ type: DocumentFlowStepType;
226
+ employeeId?: string | null;
227
+ directorateCodeReference?: number | null;
228
+ name: string;
229
+ position?: string | null;
230
+ documentType?: DocumentTypeEntity;
231
+ documentTypeId: string;
232
+ createdAt: string;
233
+ }
@@ -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.DocumentInstruction = exports.DocumentDeliveryOrigin = exports.DocumentRecipientType = exports.DocumentAttachmentType = exports.DocumentTrackingAction = exports.DocumentParticipantStatus = exports.DocumentParticipantRole = exports.DocumentAccessLevel = exports.DocumentStatus = exports.DocumentCategory = void 0;
4
+ exports.DocumentInstruction = exports.DocumentDeliveryOrigin = exports.DocumentRecipientType = exports.DocumentAttachmentType = exports.DocumentFlowStepType = 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',
@@ -46,6 +46,11 @@ exports.DocumentTrackingAction = {
46
46
  Annulled: 'Annulled',
47
47
  Delivered: 'Delivered',
48
48
  Derived: 'Derived',
49
+ Reassigned: 'Reassigned',
50
+ };
51
+ exports.DocumentFlowStepType = {
52
+ Employee: 'Employee',
53
+ DirectorateHead: 'DirectorateHead',
49
54
  };
50
55
  exports.DocumentAttachmentType = {
51
56
  File: 'File',
@@ -1,5 +1,5 @@
1
- import { type DocumentAccessLevel, type DocumentAttachmentEntity, type DocumentDeliveryEntity, type DocumentEntity, type DocumentInstruction, 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 DocumentReviewResponseEntity, type DocumentUpdateResponseEntity, type DocumentVerifyResponseEntity } from '../entities';
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 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: {
@@ -10,6 +10,7 @@ export declare const DocumentPatterns: {
10
10
  readonly create: "gestorDocumental.document.create";
11
11
  readonly update: "gestorDocumental.document.update";
12
12
  readonly review: "gestorDocumental.document.review";
13
+ readonly reassign: "gestorDocumental.document.reassign";
13
14
  readonly discard: "gestorDocumental.document.discard";
14
15
  readonly annul: "gestorDocumental.document.annul";
15
16
  readonly derive: "gestorDocumental.document.derive";
@@ -148,6 +149,20 @@ export interface DocumentContract {
148
149
  };
149
150
  response: DocumentReviewResponseEntity;
150
151
  };
152
+ /**
153
+ * Pasa un turno pendiente (de visación o de firma) a otro funcionario, por ausencia o por error, y lo deja en la
154
+ * trazabilidad con su motivo. Puede hacerlo quien redactó el documento; con `anyDocument`, quien lleva el registro.
155
+ */
156
+ [DocumentPatterns.reassign]: {
157
+ payload: Pick<DocumentEntity, 'id'> & {
158
+ participantId: DocumentParticipantEntity['id'];
159
+ employeeId: string;
160
+ reason: string;
161
+ actor: DocumentActor;
162
+ anyDocument?: boolean;
163
+ };
164
+ response: DocumentReassignResponseEntity;
165
+ };
151
166
  [DocumentPatterns.discard]: {
152
167
  payload: Pick<DocumentEntity, 'id'> & {
153
168
  actor: DocumentActor;
@@ -10,6 +10,7 @@ exports.DocumentPatterns = {
10
10
  create: 'gestorDocumental.document.create',
11
11
  update: 'gestorDocumental.document.update',
12
12
  review: 'gestorDocumental.document.review',
13
+ reassign: 'gestorDocumental.document.reassign',
13
14
  discard: 'gestorDocumental.document.discard',
14
15
  annul: 'gestorDocumental.document.annul',
15
16
  derive: 'gestorDocumental.document.derive',
@@ -1,4 +1,4 @@
1
- import { type DocumentCategory, type DocumentTypeEntity } from '../base/entities';
1
+ import { type DocumentCategory, type DocumentParticipantRole, type DocumentTypeEntity } from '../base/entities';
2
2
  import { type DocumentTypeCreateResponseEntity, type DocumentTypeGetAllResponseEntity, type DocumentTypeGetByIdResponseEntity, type DocumentTypeUpdateResponseEntity } from '../entities';
3
3
  import { type RpcPage } from './contract';
4
4
  /** Patrones NATS de `documentType`: `<servicio>.<recurso>.<acción>`. */
@@ -9,6 +9,21 @@ export declare const DocumentTypePatterns: {
9
9
  readonly update: "gestorDocumental.documentType.update";
10
10
  readonly setEnabled: "gestorDocumental.documentType.setEnabled";
11
11
  };
12
+ /**
13
+ * Paso del flujo sugerido de un tipo documental: un funcionario en particular, o quien dirija una dirección al
14
+ * momento de redactar (su jefatura o, con subrogancia activa, el subrogante). El nombre de la dirección lo resuelve
15
+ * el gateway; el navegador solo indica cuál es.
16
+ */
17
+ export type DocumentFlowStepInput = {
18
+ role: DocumentParticipantRole;
19
+ type: 'Employee';
20
+ employeeId: string;
21
+ } | {
22
+ role: DocumentParticipantRole;
23
+ type: 'DirectorateHead';
24
+ directorateCodeReference: number;
25
+ name: string;
26
+ };
12
27
  /** Datos de un tipo documental al crearlo o editarlo. */
13
28
  export interface DocumentTypeWritePayload {
14
29
  name: string;
@@ -19,6 +34,7 @@ export interface DocumentTypeWritePayload {
19
34
  resetsYearly?: boolean;
20
35
  directorateCodeReference?: number | null;
21
36
  enabled?: boolean;
37
+ flowSteps?: DocumentFlowStepInput[];
22
38
  }
23
39
  /**
24
40
  * Qué se envía y qué se responde en cada patrón. Generado desde los handlers y los DTO del microservicio.
@@ -20,6 +20,7 @@ export declare const GestorDocumentalPatterns: {
20
20
  readonly create: "gestorDocumental.document.create";
21
21
  readonly update: "gestorDocumental.document.update";
22
22
  readonly review: "gestorDocumental.document.review";
23
+ readonly reassign: "gestorDocumental.document.reassign";
23
24
  readonly discard: "gestorDocumental.document.discard";
24
25
  readonly annul: "gestorDocumental.document.annul";
25
26
  readonly derive: "gestorDocumental.document.derive";
@@ -139,6 +139,7 @@ export interface DocumentGetByIdResponseEntity {
139
139
  canDiscard: boolean;
140
140
  canDerive: boolean;
141
141
  canReply: boolean;
142
+ canReassign: boolean;
142
143
  inbox: DocumentDeliveryResponseEntity[];
143
144
  };
144
145
  signatureRequiresOtp: boolean;
@@ -222,3 +223,7 @@ export interface DocumentCloseDeliveryResponseEntity {
222
223
  id: DocumentDeliveryEntity['id'];
223
224
  ok: boolean;
224
225
  }
226
+ export interface DocumentReassignResponseEntity {
227
+ id: DocumentEntity['id'];
228
+ ok: boolean;
229
+ }
@@ -1,4 +1,15 @@
1
- import { DocumentTypeEntity } from '../../base/entities';
1
+ import { DocumentTypeEntity, DocumentTypeFlowStepEntity } from '../../base/entities';
2
+ /** Paso del flujo sugerido de un tipo documental: quién visa o firma, en su orden. */
3
+ export interface DocumentTypeFlowStepResponseEntity {
4
+ id: DocumentTypeFlowStepEntity['id'];
5
+ role: DocumentTypeFlowStepEntity['role'];
6
+ order: DocumentTypeFlowStepEntity['order'];
7
+ type: DocumentTypeFlowStepEntity['type'];
8
+ employeeId: DocumentTypeFlowStepEntity['employeeId'];
9
+ directorateCodeReference: DocumentTypeFlowStepEntity['directorateCodeReference'];
10
+ name: DocumentTypeFlowStepEntity['name'];
11
+ position: DocumentTypeFlowStepEntity['position'];
12
+ }
2
13
  export interface DocumentTypeGetAllResponseEntity {
3
14
  id: DocumentTypeEntity['id'];
4
15
  name: DocumentTypeEntity['name'];
@@ -10,9 +21,14 @@ export interface DocumentTypeGetAllResponseEntity {
10
21
  resetsYearly: DocumentTypeEntity['resetsYearly'];
11
22
  directorateCodeReference: DocumentTypeEntity['directorateCodeReference'];
12
23
  enabled: DocumentTypeEntity['enabled'];
24
+ flow: {
25
+ visa: number;
26
+ signature: number;
27
+ };
13
28
  }
14
29
  export interface DocumentTypeGetByIdResponseEntity extends DocumentTypeGetAllResponseEntity {
15
30
  lastCorrelative: number | null;
31
+ flowSteps: DocumentTypeFlowStepResponseEntity[];
16
32
  }
17
33
  export interface DocumentTypeCreateResponseEntity {
18
34
  id: DocumentTypeEntity['id'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muni-sanfer/types-gestor-documental",
3
- "version": "0.0.1-beta.2",
3
+ "version": "0.0.1-beta.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -59,7 +59,8 @@ export type DocumentTrackingAction =
59
59
  | 'NumberAnnulled'
60
60
  | 'Annulled'
61
61
  | 'Delivered'
62
- | 'Derived';
62
+ | 'Derived'
63
+ | 'Reassigned';
63
64
 
64
65
  export const DocumentTrackingAction = {
65
66
  Created: 'Created',
@@ -75,8 +76,16 @@ export const DocumentTrackingAction = {
75
76
  Annulled: 'Annulled',
76
77
  Delivered: 'Delivered',
77
78
  Derived: 'Derived',
79
+ Reassigned: 'Reassigned',
78
80
  } satisfies Record<string, DocumentTrackingAction>;
79
81
 
82
+ export type DocumentFlowStepType = 'Employee' | 'DirectorateHead';
83
+
84
+ export const DocumentFlowStepType = {
85
+ Employee: 'Employee',
86
+ DirectorateHead: 'DirectorateHead',
87
+ } satisfies Record<string, DocumentFlowStepType>;
88
+
80
89
  export type DocumentAttachmentType = 'File' | 'Link';
81
90
 
82
91
  export const DocumentAttachmentType = {
@@ -121,6 +130,7 @@ export interface DocumentTypeEntity {
121
130
  enabled: boolean;
122
131
  documents?: DocumentEntity[];
123
132
  annulledNumbers?: DocumentAnnulledNumberEntity[];
133
+ flowSteps?: DocumentTypeFlowStepEntity[];
124
134
  deleted: boolean;
125
135
  createdAt: string;
126
136
  updatedAt: string;
@@ -254,3 +264,17 @@ export interface DocumentDeliveryEntity {
254
264
  documentId: string;
255
265
  createdAt: string;
256
266
  }
267
+
268
+ export interface DocumentTypeFlowStepEntity {
269
+ id: string;
270
+ role: DocumentParticipantRole;
271
+ order: number;
272
+ type: DocumentFlowStepType;
273
+ employeeId?: string | null;
274
+ directorateCodeReference?: number | null;
275
+ name: string;
276
+ position?: string | null;
277
+ documentType?: DocumentTypeEntity;
278
+ documentTypeId: string;
279
+ createdAt: string;
280
+ }
@@ -4,6 +4,7 @@ import {
4
4
  type DocumentDeliveryEntity,
5
5
  type DocumentEntity,
6
6
  type DocumentInstruction,
7
+ type DocumentParticipantEntity,
7
8
  type DocumentStatus,
8
9
  } from '../base/entities';
9
10
  import {
@@ -17,6 +18,7 @@ import {
17
18
  type DocumentGetSummaryResponseEntity,
18
19
  type DocumentInboxItemEntity,
19
20
  type DocumentPublicFileResponseEntity,
21
+ type DocumentReassignResponseEntity,
20
22
  type DocumentReviewResponseEntity,
21
23
  type DocumentUpdateResponseEntity,
22
24
  type DocumentVerifyResponseEntity,
@@ -32,6 +34,7 @@ export const DocumentPatterns = {
32
34
  create: 'gestorDocumental.document.create',
33
35
  update: 'gestorDocumental.document.update',
34
36
  review: 'gestorDocumental.document.review',
37
+ reassign: 'gestorDocumental.document.reassign',
35
38
  discard: 'gestorDocumental.document.discard',
36
39
  annul: 'gestorDocumental.document.annul',
37
40
  derive: 'gestorDocumental.document.derive',
@@ -165,6 +168,21 @@ export interface DocumentContract {
165
168
  };
166
169
  response: DocumentReviewResponseEntity;
167
170
  };
171
+ /**
172
+ * Pasa un turno pendiente (de visación o de firma) a otro funcionario, por ausencia o por error, y lo deja en la
173
+ * trazabilidad con su motivo. Puede hacerlo quien redactó el documento; con `anyDocument`, quien lleva el registro.
174
+ */
175
+ [DocumentPatterns.reassign]: {
176
+ payload: Pick<DocumentEntity, 'id'> & {
177
+ participantId: DocumentParticipantEntity['id'];
178
+ // Funcionario que toma el turno.
179
+ employeeId: string;
180
+ reason: string;
181
+ actor: DocumentActor;
182
+ anyDocument?: boolean;
183
+ };
184
+ response: DocumentReassignResponseEntity;
185
+ };
168
186
  [DocumentPatterns.discard]: {
169
187
  payload: Pick<DocumentEntity, 'id'> & { actor: DocumentActor };
170
188
  response: DocumentDiscardResponseEntity;
@@ -1,4 +1,4 @@
1
- import { type DocumentCategory, type DocumentTypeEntity } from '../base/entities';
1
+ import { type DocumentCategory, type DocumentParticipantRole, type DocumentTypeEntity } from '../base/entities';
2
2
  import {
3
3
  type DocumentTypeCreateResponseEntity,
4
4
  type DocumentTypeGetAllResponseEntity,
@@ -16,6 +16,15 @@ export const DocumentTypePatterns = {
16
16
  setEnabled: 'gestorDocumental.documentType.setEnabled',
17
17
  } as const;
18
18
 
19
+ /**
20
+ * Paso del flujo sugerido de un tipo documental: un funcionario en particular, o quien dirija una dirección al
21
+ * momento de redactar (su jefatura o, con subrogancia activa, el subrogante). El nombre de la dirección lo resuelve
22
+ * el gateway; el navegador solo indica cuál es.
23
+ */
24
+ export type DocumentFlowStepInput =
25
+ | { role: DocumentParticipantRole; type: 'Employee'; employeeId: string }
26
+ | { role: DocumentParticipantRole; type: 'DirectorateHead'; directorateCodeReference: number; name: string };
27
+
19
28
  /** Datos de un tipo documental al crearlo o editarlo. */
20
29
  export interface DocumentTypeWritePayload {
21
30
  name: string;
@@ -27,6 +36,8 @@ export interface DocumentTypeWritePayload {
27
36
  resetsYearly?: boolean;
28
37
  directorateCodeReference?: number | null;
29
38
  enabled?: boolean;
39
+ // Flujo sugerido, en el orden en que les toca dentro de cada rol. Al editar, si no viene, el flujo no cambia.
40
+ flowSteps?: DocumentFlowStepInput[];
30
41
  }
31
42
 
32
43
  /**
@@ -171,6 +171,8 @@ export interface DocumentGetByIdResponseEntity {
171
171
  // Puede derivarlo a otros funcionarios y responderlo: el documento ya es oficial y está a su alcance.
172
172
  canDerive: boolean;
173
173
  canReply: boolean;
174
+ // Es quien redactó un documento en tramitación: puede pasar un turno pendiente a otro funcionario.
175
+ canReassign: boolean;
174
176
  // Sus propias entregas de este documento (puede tener más de una si además se lo derivaron).
175
177
  inbox: DocumentDeliveryResponseEntity[];
176
178
  };
@@ -271,3 +273,8 @@ export interface DocumentCloseDeliveryResponseEntity {
271
273
  id: DocumentDeliveryEntity['id'];
272
274
  ok: boolean;
273
275
  }
276
+
277
+ export interface DocumentReassignResponseEntity {
278
+ id: DocumentEntity['id'];
279
+ ok: boolean;
280
+ }
@@ -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 {