@muni-sanfer/types-gestor-documental 0.0.1-beta.10 → 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.
@@ -206,6 +206,7 @@ export interface DocumentEntity {
206
206
  externalFolio?: string | null;
207
207
  externalSender?: string | null;
208
208
  externalDate?: string | null;
209
+ composition?: JsonValue | null;
209
210
  contentText?: string | null;
210
211
  textExtractedAt?: string | null;
211
212
  batch?: SignatureBatchEntity | null;
@@ -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 DocumentAgendaResponseEntity, type DocumentTrailExportEntity, 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 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>`. */
5
5
  export declare const DocumentPatterns: {
@@ -21,6 +21,7 @@ export declare const DocumentPatterns: {
21
21
  readonly getFilesFolder: "gestorDocumental.document.getFilesFolder";
22
22
  readonly getAgenda: "gestorDocumental.document.getAgenda";
23
23
  readonly exportTrail: "gestorDocumental.document.exportTrail";
24
+ readonly compose: "gestorDocumental.document.compose";
24
25
  };
25
26
  /**
26
27
  * Funcionario que hace la operación y sus áreas (direcciones y departamentos a los que pertenece o que dirige). Lo
@@ -73,6 +74,7 @@ export interface DocumentWritePayload extends Pick<DocumentEntity, 'subject' | '
73
74
  visaEmployeeIds: string[];
74
75
  visaStages?: number[] | null;
75
76
  restartFlow?: boolean;
77
+ composition?: DocumentComposition | null;
76
78
  signatureEmployeeIds: string[];
77
79
  signatureSheet?: boolean;
78
80
  recipients?: DocumentRecipientInput[];
@@ -91,6 +93,26 @@ export interface DocumentExternalRecipientInput {
91
93
  * Qué se envía y qué se responde en cada patrón. Generado desde los handlers y los DTO del microservicio.
92
94
  */
93
95
  export interface DocumentContract {
96
+ /**
97
+ * Arma el PDF de un documento redactado con una plantilla oficial: membrete, estructura y espacio libre para el
98
+ * número, las visaciones, las firmas y el QR. Con `preview` lo entrega para verlo; si no, lo sube y entrega su
99
+ * `fileId` para guardarlo como el PDF del documento.
100
+ */
101
+ [DocumentPatterns.compose]: {
102
+ payload: {
103
+ documentTypeId: string;
104
+ subject: string;
105
+ composition: DocumentComposition;
106
+ visaCount: number;
107
+ signatureCount: number;
108
+ signatureSheet?: boolean;
109
+ /** Unidad que emite, para el membrete. */
110
+ issuingUnitName?: string | null;
111
+ preview?: boolean;
112
+ actor: DocumentActor;
113
+ };
114
+ response: DocumentComposeResponseEntity;
115
+ };
94
116
  /** Plazos del funcionario entre `from` y `to` (hasta 62 días), y lo que tiene vencido sin atender. */
95
117
  [DocumentPatterns.getAgenda]: {
96
118
  payload: {
@@ -21,4 +21,5 @@ exports.DocumentPatterns = {
21
21
  getFilesFolder: 'gestorDocumental.document.getFilesFolder',
22
22
  getAgenda: 'gestorDocumental.document.getAgenda',
23
23
  exportTrail: 'gestorDocumental.document.exportTrail',
24
+ compose: 'gestorDocumental.document.compose',
24
25
  };
@@ -43,6 +43,7 @@ export declare const GestorDocumentalPatterns: {
43
43
  readonly getFilesFolder: "gestorDocumental.document.getFilesFolder";
44
44
  readonly getAgenda: "gestorDocumental.document.getAgenda";
45
45
  readonly exportTrail: "gestorDocumental.document.exportTrail";
46
+ readonly compose: "gestorDocumental.document.compose";
46
47
  };
47
48
  readonly procedure: {
48
49
  readonly getAll: "gestorDocumental.procedure.getAll";
@@ -153,6 +153,8 @@ export interface DocumentGetByIdResponseEntity {
153
153
  id: string;
154
154
  name: string;
155
155
  } | null;
156
+ /** Contenido redactado en el sistema con una plantilla, para volver a editarlo (sin valor si se subió un PDF). */
157
+ composition: DocumentComposition | null;
156
158
  replies: DocumentLinkEntity[];
157
159
  /** Expedientes en que está incorporado y que quien consulta puede ver. */
158
160
  caseFiles: {
@@ -353,3 +355,48 @@ export interface DocumentTrailExportEntity {
353
355
  contentType: string;
354
356
  contentBase64: string;
355
357
  }
358
+ /** Plantilla oficial con que se redacta un documento en el sistema. */
359
+ export type DocumentTemplateKind = 'Decree' | 'Office' | 'Memorandum' | 'General';
360
+ /**
361
+ * Contenido de un documento redactado en el sistema. Cada plantilla tiene su estructura; los párrafos son texto
362
+ * (un salto de línea dentro de un párrafo se respeta). La materia es el asunto del documento.
363
+ */
364
+ export type DocumentComposition = {
365
+ template: 'Decree';
366
+ /** VISTOS: las normas y antecedentes. */
367
+ vistos: string[];
368
+ /** CONSIDERANDO: cada fundamento, numerado. */
369
+ considerando: string[];
370
+ /** DECRETO: cada punto resolutivo, numerado. */
371
+ resolutive: string[];
372
+ /** Fórmula de cierre: «Anótese, comuníquese y archívese». */
373
+ closing: string;
374
+ distribution: string[];
375
+ } | {
376
+ template: 'Office';
377
+ /** ANT.: antecedentes (otro oficio, una solicitud). */
378
+ antecedents?: string | null;
379
+ from: string;
380
+ to: string;
381
+ body: string[];
382
+ closing: string;
383
+ distribution: string[];
384
+ } | {
385
+ template: 'Memorandum';
386
+ from: string;
387
+ to: string;
388
+ body: string[];
389
+ closing?: string | null;
390
+ distribution: string[];
391
+ } | {
392
+ template: 'General';
393
+ title: string;
394
+ body: string[];
395
+ closing?: string | null;
396
+ };
397
+ /** PDF armado con una plantilla: para la vista previa (`contentBase64`) o ya subido (`fileId`). */
398
+ export interface DocumentComposeResponseEntity {
399
+ fileName: string;
400
+ fileId?: string;
401
+ contentBase64?: string;
402
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muni-sanfer/types-gestor-documental",
3
- "version": "0.0.1-beta.10",
3
+ "version": "0.0.1-beta.11",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -290,6 +290,7 @@ export interface DocumentEntity {
290
290
  externalFolio?: string | null;
291
291
  externalSender?: string | null;
292
292
  externalDate?: string | null;
293
+ composition?: JsonValue | null;
293
294
  contentText?: string | null;
294
295
  textExtractedAt?: string | null;
295
296
  batch?: SignatureBatchEntity | null;
@@ -22,6 +22,8 @@ import {
22
22
  type DocumentReviewResponseEntity,
23
23
  type DocumentSignManyResponseEntity,
24
24
  type DocumentAgendaResponseEntity,
25
+ type DocumentComposeResponseEntity,
26
+ type DocumentComposition,
25
27
  type DocumentTrailExportEntity,
26
28
  type DocumentUpdateResponseEntity,
27
29
  type DocumentVerifyResponseEntity,
@@ -48,6 +50,7 @@ export const DocumentPatterns = {
48
50
  getFilesFolder: 'gestorDocumental.document.getFilesFolder',
49
51
  getAgenda: 'gestorDocumental.document.getAgenda',
50
52
  exportTrail: 'gestorDocumental.document.exportTrail',
53
+ compose: 'gestorDocumental.document.compose',
51
54
  } as const;
52
55
 
53
56
  /**
@@ -103,6 +106,8 @@ export interface DocumentWritePayload extends Pick<DocumentEntity, 'subject' | '
103
106
  visaStages?: number[] | null;
104
107
  // Al reenviar un documento rechazado, pedir de nuevo las visaciones ya hechas en vez de seguir donde quedó.
105
108
  restartFlow?: boolean;
109
+ // Contenido redactado con una plantilla (el PDF ya armado va en `file`): se guarda para volver a editarlo.
110
+ composition?: DocumentComposition | null;
106
111
  signatureEmployeeIds: string[];
107
112
  // Firmas y visaciones en una hoja aparte al final, en vez de al pie de la última página.
108
113
  signatureSheet?: boolean;
@@ -128,6 +133,26 @@ export interface DocumentExternalRecipientInput {
128
133
  * Qué se envía y qué se responde en cada patrón. Generado desde los handlers y los DTO del microservicio.
129
134
  */
130
135
  export interface DocumentContract {
136
+ /**
137
+ * Arma el PDF de un documento redactado con una plantilla oficial: membrete, estructura y espacio libre para el
138
+ * número, las visaciones, las firmas y el QR. Con `preview` lo entrega para verlo; si no, lo sube y entrega su
139
+ * `fileId` para guardarlo como el PDF del documento.
140
+ */
141
+ [DocumentPatterns.compose]: {
142
+ payload: {
143
+ documentTypeId: string;
144
+ subject: string;
145
+ composition: DocumentComposition;
146
+ visaCount: number;
147
+ signatureCount: number;
148
+ signatureSheet?: boolean;
149
+ /** Unidad que emite, para el membrete. */
150
+ issuingUnitName?: string | null;
151
+ preview?: boolean;
152
+ actor: DocumentActor;
153
+ };
154
+ response: DocumentComposeResponseEntity;
155
+ };
131
156
  /** Plazos del funcionario entre `from` y `to` (hasta 62 días), y lo que tiene vencido sin atender. */
132
157
  [DocumentPatterns.getAgenda]: {
133
158
  payload: { from: string; to: string; actor: DocumentActor };
@@ -182,6 +182,8 @@ export interface DocumentGetByIdResponseEntity {
182
182
  replyTo: DocumentLinkEntity | null;
183
183
  /** Lote de firma al que pertenece. */
184
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;
185
187
  replies: DocumentLinkEntity[];
186
188
  /** Expedientes en que está incorporado y que quien consulta puede ver. */
187
189
  caseFiles: { id: string; code: string; title: string; status: 'Open' | 'Closed' }[];
@@ -395,3 +397,50 @@ export interface DocumentTrailExportEntity {
395
397
  contentType: string;
396
398
  contentBase64: string;
397
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
+ }