@muni-sanfer/types-gestor-documental 0.0.1-beta.36 → 0.0.1-beta.38
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.
- package/dist/base/entities.d.ts +25 -1
- package/dist/base/entities.js +1 -0
- package/dist/contracts/documentTemplate.contract.d.ts +58 -0
- package/dist/contracts/documentTemplate.contract.js +12 -0
- package/dist/contracts/index.d.ts +11 -1
- package/dist/contracts/index.js +3 -0
- package/dist/entities/document/document.entity.d.ts +83 -0
- package/dist/entities/documentTemplate/documentTemplate.entity.d.ts +51 -0
- package/dist/entities/documentTemplate/documentTemplate.entity.js +2 -0
- package/dist/entities/documentTemplate/index.d.ts +1 -0
- package/dist/entities/documentTemplate/index.js +17 -0
- package/dist/entities/index.d.ts +1 -0
- package/dist/entities/index.js +1 -0
- package/package.json +1 -1
- package/src/base/entities.ts +28 -1
- package/src/contracts/documentTemplate.contract.ts +61 -0
- package/src/contracts/index.ts +4 -0
- package/src/entities/document/document.entity.ts +57 -1
- package/src/entities/documentTemplate/documentTemplate.entity.ts +58 -0
- package/src/entities/documentTemplate/index.ts +1 -0
- package/src/entities/index.ts +1 -0
package/dist/base/entities.d.ts
CHANGED
|
@@ -220,7 +220,7 @@ export declare const DocumentAccessAction: {
|
|
|
220
220
|
FileDownloaded: "FileDownloaded";
|
|
221
221
|
TrailExported: "TrailExported";
|
|
222
222
|
};
|
|
223
|
-
export type AuditEntity = 'DocumentType' | 'IssuingEntity' | 'ArchivalSeries' | 'TextSnippet' | 'Holiday' | 'Procedure' | 'QualityMetric' | 'ServiceOutage' | 'Repository' | 'DataTreatment';
|
|
223
|
+
export type AuditEntity = 'DocumentType' | 'IssuingEntity' | 'ArchivalSeries' | 'TextSnippet' | 'Holiday' | 'Procedure' | 'QualityMetric' | 'ServiceOutage' | 'Repository' | 'DataTreatment' | 'DocumentTemplate';
|
|
224
224
|
export declare const AuditEntity: {
|
|
225
225
|
DocumentType: "DocumentType";
|
|
226
226
|
IssuingEntity: "IssuingEntity";
|
|
@@ -232,6 +232,7 @@ export declare const AuditEntity: {
|
|
|
232
232
|
ServiceOutage: "ServiceOutage";
|
|
233
233
|
Repository: "Repository";
|
|
234
234
|
DataTreatment: "DataTreatment";
|
|
235
|
+
DocumentTemplate: "DocumentTemplate";
|
|
235
236
|
};
|
|
236
237
|
export type AuditAction = 'Created' | 'Updated' | 'Enabled' | 'Disabled' | 'Removed' | 'Exported';
|
|
237
238
|
export declare const AuditAction: {
|
|
@@ -887,6 +888,29 @@ export interface TextSnippetEntity {
|
|
|
887
888
|
createdAt: string;
|
|
888
889
|
updatedAt: string;
|
|
889
890
|
}
|
|
891
|
+
export interface DocumentTemplateEntity {
|
|
892
|
+
id: string;
|
|
893
|
+
name: string;
|
|
894
|
+
description?: string | null;
|
|
895
|
+
documentTypeIds: string[];
|
|
896
|
+
content: JsonValue;
|
|
897
|
+
version: number;
|
|
898
|
+
enabled: boolean;
|
|
899
|
+
updatedByFullName?: string | null;
|
|
900
|
+
versions?: DocumentTemplateVersionEntity[];
|
|
901
|
+
deleted: boolean;
|
|
902
|
+
createdAt: string;
|
|
903
|
+
updatedAt: string;
|
|
904
|
+
}
|
|
905
|
+
export interface DocumentTemplateVersionEntity {
|
|
906
|
+
id: string;
|
|
907
|
+
templateId: string;
|
|
908
|
+
template?: DocumentTemplateEntity;
|
|
909
|
+
version: number;
|
|
910
|
+
content: JsonValue;
|
|
911
|
+
createdByFullName?: string | null;
|
|
912
|
+
createdAt: string;
|
|
913
|
+
}
|
|
890
914
|
export interface ArchivalSeriesEntity {
|
|
891
915
|
id: string;
|
|
892
916
|
code: string;
|
package/dist/base/entities.js
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type DocumentTemplateEntity } from '../base/entities';
|
|
2
|
+
import { type DocumentTemplateAvailableResponseEntity, type DocumentTemplateContent, type DocumentTemplateCreateResponseEntity, type DocumentTemplateGetAllResponseEntity, type DocumentTemplateGetByIdResponseEntity, type DocumentTemplateUpdateResponseEntity } from '../entities';
|
|
3
|
+
import { type RpcPage } from './contract';
|
|
4
|
+
/** Patrones NATS de `documentTemplate` (plantillas propias del editor): `<servicio>.<recurso>.<acción>`. */
|
|
5
|
+
export declare const DocumentTemplatePatterns: {
|
|
6
|
+
readonly getAll: "gestorDocumental.documentTemplate.getAll";
|
|
7
|
+
readonly getById: "gestorDocumental.documentTemplate.getById";
|
|
8
|
+
readonly create: "gestorDocumental.documentTemplate.create";
|
|
9
|
+
readonly update: "gestorDocumental.documentTemplate.update";
|
|
10
|
+
readonly setEnabled: "gestorDocumental.documentTemplate.setEnabled";
|
|
11
|
+
readonly getAvailable: "gestorDocumental.documentTemplate.getAvailable";
|
|
12
|
+
};
|
|
13
|
+
/** Datos de una plantilla propia al crearla o editarla. */
|
|
14
|
+
export interface DocumentTemplateWritePayload {
|
|
15
|
+
name: string;
|
|
16
|
+
description?: string | null;
|
|
17
|
+
documentTypeIds?: string[];
|
|
18
|
+
content: DocumentTemplateContent;
|
|
19
|
+
enabled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface DocumentTemplateContract {
|
|
22
|
+
[DocumentTemplatePatterns.getAll]: {
|
|
23
|
+
payload: {
|
|
24
|
+
pagination?: {
|
|
25
|
+
page?: number;
|
|
26
|
+
limit?: number;
|
|
27
|
+
};
|
|
28
|
+
filters?: {
|
|
29
|
+
search?: string;
|
|
30
|
+
enabled?: boolean;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
response: RpcPage<DocumentTemplateGetAllResponseEntity[]>;
|
|
34
|
+
};
|
|
35
|
+
[DocumentTemplatePatterns.getById]: {
|
|
36
|
+
payload: Pick<DocumentTemplateEntity, 'id'>;
|
|
37
|
+
response: DocumentTemplateGetByIdResponseEntity;
|
|
38
|
+
};
|
|
39
|
+
[DocumentTemplatePatterns.create]: {
|
|
40
|
+
payload: DocumentTemplateWritePayload;
|
|
41
|
+
response: DocumentTemplateCreateResponseEntity;
|
|
42
|
+
};
|
|
43
|
+
[DocumentTemplatePatterns.update]: {
|
|
44
|
+
payload: DocumentTemplateWritePayload & Pick<DocumentTemplateEntity, 'id'>;
|
|
45
|
+
response: DocumentTemplateUpdateResponseEntity;
|
|
46
|
+
};
|
|
47
|
+
[DocumentTemplatePatterns.setEnabled]: {
|
|
48
|
+
payload: Pick<DocumentTemplateEntity, 'id' | 'enabled'>;
|
|
49
|
+
response: DocumentTemplateUpdateResponseEntity;
|
|
50
|
+
};
|
|
51
|
+
/** Las habilitadas que se ofrecen al redactar un documento del tipo (las de todos los tipos y las suyas). */
|
|
52
|
+
[DocumentTemplatePatterns.getAvailable]: {
|
|
53
|
+
payload: {
|
|
54
|
+
documentTypeId: string;
|
|
55
|
+
};
|
|
56
|
+
response: DocumentTemplateAvailableResponseEntity[];
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocumentTemplatePatterns = void 0;
|
|
4
|
+
/** Patrones NATS de `documentTemplate` (plantillas propias del editor): `<servicio>.<recurso>.<acción>`. */
|
|
5
|
+
exports.DocumentTemplatePatterns = {
|
|
6
|
+
getAll: 'gestorDocumental.documentTemplate.getAll',
|
|
7
|
+
getById: 'gestorDocumental.documentTemplate.getById',
|
|
8
|
+
create: 'gestorDocumental.documentTemplate.create',
|
|
9
|
+
update: 'gestorDocumental.documentTemplate.update',
|
|
10
|
+
setEnabled: 'gestorDocumental.documentTemplate.setEnabled',
|
|
11
|
+
getAvailable: 'gestorDocumental.documentTemplate.getAvailable',
|
|
12
|
+
};
|
|
@@ -4,6 +4,7 @@ import { type DocumentTypeContract } from './documentType.contract';
|
|
|
4
4
|
import { type IssuingEntityContract } from './issuingEntity.contract';
|
|
5
5
|
import { type ArchivalSeriesContract } from './archivalSeries.contract';
|
|
6
6
|
import { type TextSnippetContract } from './textSnippet.contract';
|
|
7
|
+
import { type DocumentTemplateContract } from './documentTemplate.contract';
|
|
7
8
|
import { type HolidayContract } from './holiday.contract';
|
|
8
9
|
import { type IndicatorsContract } from './indicators.contract';
|
|
9
10
|
import { type AuditContract } from './audit.contract';
|
|
@@ -35,6 +36,7 @@ export * from './workFolder.contract';
|
|
|
35
36
|
export * from './scan.contract';
|
|
36
37
|
export * from './archivalSeries.contract';
|
|
37
38
|
export * from './textSnippet.contract';
|
|
39
|
+
export * from './documentTemplate.contract';
|
|
38
40
|
export * from './holiday.contract';
|
|
39
41
|
export * from './indicators.contract';
|
|
40
42
|
export * from './audit.contract';
|
|
@@ -192,6 +194,14 @@ export declare const GestorDocumentalPatterns: {
|
|
|
192
194
|
readonly update: "gestorDocumental.textSnippet.update";
|
|
193
195
|
readonly setEnabled: "gestorDocumental.textSnippet.setEnabled";
|
|
194
196
|
};
|
|
197
|
+
readonly documentTemplate: {
|
|
198
|
+
readonly getAll: "gestorDocumental.documentTemplate.getAll";
|
|
199
|
+
readonly getById: "gestorDocumental.documentTemplate.getById";
|
|
200
|
+
readonly create: "gestorDocumental.documentTemplate.create";
|
|
201
|
+
readonly update: "gestorDocumental.documentTemplate.update";
|
|
202
|
+
readonly setEnabled: "gestorDocumental.documentTemplate.setEnabled";
|
|
203
|
+
readonly getAvailable: "gestorDocumental.documentTemplate.getAvailable";
|
|
204
|
+
};
|
|
195
205
|
readonly holiday: {
|
|
196
206
|
readonly getAll: "gestorDocumental.holiday.getAll";
|
|
197
207
|
readonly create: "gestorDocumental.holiday.create";
|
|
@@ -288,4 +298,4 @@ export declare const GestorDocumentalPatterns: {
|
|
|
288
298
|
};
|
|
289
299
|
};
|
|
290
300
|
/** Contrato completo de gestor-documental-ms: la unión de los contratos de sus recursos. */
|
|
291
|
-
export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & IssuingEntityContract & CaseFileContract & PartsOfficeContract & RegisterBookContract & SignatureBatchContract & WorkFolderContract & ScanContract & ArchivalSeriesContract & TextSnippetContract & HolidayContract & IndicatorsContract & AuditContract & SignatureCheckContract & RepositoryExportContract & RetentionContract & AccessRequestContract & TransparencyContract & DataProtectionContract & DeskContract & MailIntakeContract & PushContract;
|
|
301
|
+
export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & IssuingEntityContract & CaseFileContract & PartsOfficeContract & RegisterBookContract & SignatureBatchContract & WorkFolderContract & ScanContract & ArchivalSeriesContract & TextSnippetContract & DocumentTemplateContract & HolidayContract & IndicatorsContract & AuditContract & SignatureCheckContract & RepositoryExportContract & RetentionContract & AccessRequestContract & TransparencyContract & DataProtectionContract & DeskContract & MailIntakeContract & PushContract;
|
package/dist/contracts/index.js
CHANGED
|
@@ -21,6 +21,7 @@ const documentType_contract_1 = require("./documentType.contract");
|
|
|
21
21
|
const issuingEntity_contract_1 = require("./issuingEntity.contract");
|
|
22
22
|
const archivalSeries_contract_1 = require("./archivalSeries.contract");
|
|
23
23
|
const textSnippet_contract_1 = require("./textSnippet.contract");
|
|
24
|
+
const documentTemplate_contract_1 = require("./documentTemplate.contract");
|
|
24
25
|
const holiday_contract_1 = require("./holiday.contract");
|
|
25
26
|
const indicators_contract_1 = require("./indicators.contract");
|
|
26
27
|
const audit_contract_1 = require("./audit.contract");
|
|
@@ -52,6 +53,7 @@ __exportStar(require("./workFolder.contract"), exports);
|
|
|
52
53
|
__exportStar(require("./scan.contract"), exports);
|
|
53
54
|
__exportStar(require("./archivalSeries.contract"), exports);
|
|
54
55
|
__exportStar(require("./textSnippet.contract"), exports);
|
|
56
|
+
__exportStar(require("./documentTemplate.contract"), exports);
|
|
55
57
|
__exportStar(require("./holiday.contract"), exports);
|
|
56
58
|
__exportStar(require("./indicators.contract"), exports);
|
|
57
59
|
__exportStar(require("./audit.contract"), exports);
|
|
@@ -78,6 +80,7 @@ exports.GestorDocumentalPatterns = {
|
|
|
78
80
|
scan: scan_contract_1.ScanPatterns,
|
|
79
81
|
archivalSeries: archivalSeries_contract_1.ArchivalSeriesPatterns,
|
|
80
82
|
textSnippet: textSnippet_contract_1.TextSnippetPatterns,
|
|
83
|
+
documentTemplate: documentTemplate_contract_1.DocumentTemplatePatterns,
|
|
81
84
|
holiday: holiday_contract_1.HolidayPatterns,
|
|
82
85
|
indicators: indicators_contract_1.IndicatorsPatterns,
|
|
83
86
|
audit: audit_contract_1.AuditPatterns,
|
|
@@ -390,6 +390,77 @@ export interface DocumentTrailExportEntity {
|
|
|
390
390
|
}
|
|
391
391
|
/** Plantilla oficial con que se redacta un documento en el sistema. */
|
|
392
392
|
export type DocumentTemplateKind = 'Decree' | 'Office' | 'Memorandum' | 'General';
|
|
393
|
+
/** Formato de un trozo de texto en el editor del gestor. */
|
|
394
|
+
export type RichMark = 'bold' | 'italic' | 'underline';
|
|
395
|
+
/**
|
|
396
|
+
* Texto con su formato, o un campo de la plantilla (`field`: su clave), que se reemplaza por su valor al armar el PDF.
|
|
397
|
+
* Un salto de línea dentro del texto (`\n`) es un salto de línea del párrafo.
|
|
398
|
+
*/
|
|
399
|
+
export type RichInline = {
|
|
400
|
+
text: string;
|
|
401
|
+
marks?: RichMark[];
|
|
402
|
+
} | {
|
|
403
|
+
field: string;
|
|
404
|
+
};
|
|
405
|
+
export type RichAlign = 'left' | 'center' | 'right' | 'justify';
|
|
406
|
+
/** Numeración de una lista: viñetas, «1.» o la de los decretos, «1.-». */
|
|
407
|
+
export type RichListStyle = 'bullet' | 'decimal' | 'decree';
|
|
408
|
+
/**
|
|
409
|
+
* Cómo se ve una tabla: con bordes (`grid`), o como las líneas «DE:», «A:», «MAT.:» de un oficio, con la etiqueta en
|
|
410
|
+
* negrita y sin bordes (`labels`, o `labelsRight`, en la mitad derecha, como «ANT.» y «MAT.» de un oficio).
|
|
411
|
+
*/
|
|
412
|
+
export type RichTableVariant = 'grid' | 'labels' | 'labelsRight';
|
|
413
|
+
/**
|
|
414
|
+
* Un bloque del texto. Los de una plantilla pueden ser fijos (`locked`): quien redacta no los cambia. Las listas son
|
|
415
|
+
* bloques seguidos del mismo estilo (su nivel es la sangría, desde 0); un título o un párrafo reinicia la numeración.
|
|
416
|
+
*/
|
|
417
|
+
export type RichBlock = {
|
|
418
|
+
id: string;
|
|
419
|
+
type: 'paragraph';
|
|
420
|
+
align?: RichAlign;
|
|
421
|
+
locked?: boolean;
|
|
422
|
+
content: RichInline[];
|
|
423
|
+
} | {
|
|
424
|
+
id: string;
|
|
425
|
+
type: 'heading';
|
|
426
|
+
level: 1 | 2;
|
|
427
|
+
align?: RichAlign;
|
|
428
|
+
locked?: boolean;
|
|
429
|
+
content: RichInline[];
|
|
430
|
+
} | {
|
|
431
|
+
id: string;
|
|
432
|
+
type: 'listItem';
|
|
433
|
+
list: RichListStyle;
|
|
434
|
+
level: number;
|
|
435
|
+
locked?: boolean;
|
|
436
|
+
content: RichInline[];
|
|
437
|
+
}
|
|
438
|
+
/** `rows[fila][columna]`: el contenido de cada celda. */
|
|
439
|
+
| {
|
|
440
|
+
id: string;
|
|
441
|
+
type: 'table';
|
|
442
|
+
variant: RichTableVariant;
|
|
443
|
+
locked?: boolean;
|
|
444
|
+
rows: RichInline[][][];
|
|
445
|
+
} | {
|
|
446
|
+
id: string;
|
|
447
|
+
type: 'rule';
|
|
448
|
+
locked?: boolean;
|
|
449
|
+
} | {
|
|
450
|
+
id: string;
|
|
451
|
+
type: 'pageBreak';
|
|
452
|
+
locked?: boolean;
|
|
453
|
+
};
|
|
454
|
+
/**
|
|
455
|
+
* Campo de una plantilla, con el valor que le dio quien redacta. `materia` es el asunto del documento: no se escribe
|
|
456
|
+
* aparte.
|
|
457
|
+
*/
|
|
458
|
+
export interface RichField {
|
|
459
|
+
key: string;
|
|
460
|
+
label: string;
|
|
461
|
+
value: string;
|
|
462
|
+
required?: boolean;
|
|
463
|
+
}
|
|
393
464
|
/**
|
|
394
465
|
* Contenido de un documento redactado en el sistema. Cada plantilla tiene su estructura; los párrafos son texto
|
|
395
466
|
* (un salto de línea dentro de un párrafo se respeta). La materia es el asunto del documento.
|
|
@@ -426,6 +497,18 @@ export type DocumentComposition = {
|
|
|
426
497
|
title: string;
|
|
427
498
|
body: string[];
|
|
428
499
|
closing?: string | null;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Redactado con el editor del gestor: los bloques del texto, los campos de la plantilla con su valor y la
|
|
503
|
+
* distribución. `templateKey` y `templateVersion`: de qué plantilla salió, si salió de una.
|
|
504
|
+
*/
|
|
505
|
+
| {
|
|
506
|
+
template: 'Rich';
|
|
507
|
+
templateKey?: string | null;
|
|
508
|
+
templateVersion?: number | null;
|
|
509
|
+
blocks: RichBlock[];
|
|
510
|
+
fields: RichField[];
|
|
511
|
+
distribution: string[];
|
|
429
512
|
};
|
|
430
513
|
/** PDF armado con una plantilla: para la vista previa (`contentBase64`) o ya subido (`fileId`). */
|
|
431
514
|
export interface DocumentComposeResponseEntity {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type DocumentTemplateEntity } from '../../base/entities';
|
|
2
|
+
import { type RichBlock, type RichField } from '../document/document.entity';
|
|
3
|
+
/**
|
|
4
|
+
* Contenido de una plantilla propia: los bloques del editor (con sus partes fijas) y los campos que completa quien
|
|
5
|
+
* redacta (en la plantilla, sin valor).
|
|
6
|
+
*/
|
|
7
|
+
export interface DocumentTemplateContent {
|
|
8
|
+
blocks: RichBlock[];
|
|
9
|
+
fields: RichField[];
|
|
10
|
+
}
|
|
11
|
+
/** Plantilla propia en el listado de quien las administra. */
|
|
12
|
+
export interface DocumentTemplateGetAllResponseEntity {
|
|
13
|
+
id: DocumentTemplateEntity['id'];
|
|
14
|
+
name: DocumentTemplateEntity['name'];
|
|
15
|
+
description: string | null;
|
|
16
|
+
/** Tipos documentales donde se ofrece; vacío, en todos. */
|
|
17
|
+
documentTypeIds: DocumentTemplateEntity['documentTypeIds'];
|
|
18
|
+
documentTypeNames: string[];
|
|
19
|
+
version: DocumentTemplateEntity['version'];
|
|
20
|
+
enabled: DocumentTemplateEntity['enabled'];
|
|
21
|
+
updatedAt: DocumentTemplateEntity['updatedAt'];
|
|
22
|
+
updatedByFullName: string | null;
|
|
23
|
+
}
|
|
24
|
+
/** Una versión del contenido de una plantilla. */
|
|
25
|
+
export interface DocumentTemplateVersionResponseEntity {
|
|
26
|
+
version: number;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
createdByFullName: string | null;
|
|
29
|
+
}
|
|
30
|
+
export interface DocumentTemplateGetByIdResponseEntity extends DocumentTemplateGetAllResponseEntity {
|
|
31
|
+
content: DocumentTemplateContent;
|
|
32
|
+
versions: DocumentTemplateVersionResponseEntity[];
|
|
33
|
+
}
|
|
34
|
+
/** Plantilla que se ofrece al redactar un documento de un tipo: con su contenido, lista para usar. */
|
|
35
|
+
export interface DocumentTemplateAvailableResponseEntity {
|
|
36
|
+
id: DocumentTemplateEntity['id'];
|
|
37
|
+
name: DocumentTemplateEntity['name'];
|
|
38
|
+
description: string | null;
|
|
39
|
+
version: DocumentTemplateEntity['version'];
|
|
40
|
+
content: DocumentTemplateContent;
|
|
41
|
+
}
|
|
42
|
+
export interface DocumentTemplateCreateResponseEntity {
|
|
43
|
+
id: DocumentTemplateEntity['id'];
|
|
44
|
+
ok: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface DocumentTemplateUpdateResponseEntity {
|
|
47
|
+
id: DocumentTemplateEntity['id'];
|
|
48
|
+
ok: boolean;
|
|
49
|
+
/** Versión vigente: sube solo si cambió el contenido. */
|
|
50
|
+
version: number;
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './documentTemplate.entity';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./documentTemplate.entity"), exports);
|
package/dist/entities/index.d.ts
CHANGED
package/dist/entities/index.js
CHANGED
package/package.json
CHANGED
package/src/base/entities.ts
CHANGED
|
@@ -344,7 +344,8 @@ export type AuditEntity =
|
|
|
344
344
|
| 'QualityMetric'
|
|
345
345
|
| 'ServiceOutage'
|
|
346
346
|
| 'Repository'
|
|
347
|
-
| 'DataTreatment'
|
|
347
|
+
| 'DataTreatment'
|
|
348
|
+
| 'DocumentTemplate';
|
|
348
349
|
|
|
349
350
|
export const AuditEntity = {
|
|
350
351
|
DocumentType: 'DocumentType',
|
|
@@ -357,6 +358,7 @@ export const AuditEntity = {
|
|
|
357
358
|
ServiceOutage: 'ServiceOutage',
|
|
358
359
|
Repository: 'Repository',
|
|
359
360
|
DataTreatment: 'DataTreatment',
|
|
361
|
+
DocumentTemplate: 'DocumentTemplate',
|
|
360
362
|
} satisfies Record<string, AuditEntity>;
|
|
361
363
|
|
|
362
364
|
export type AuditAction = 'Created' | 'Updated' | 'Enabled' | 'Disabled' | 'Removed' | 'Exported';
|
|
@@ -1106,6 +1108,31 @@ export interface TextSnippetEntity {
|
|
|
1106
1108
|
updatedAt: string;
|
|
1107
1109
|
}
|
|
1108
1110
|
|
|
1111
|
+
export interface DocumentTemplateEntity {
|
|
1112
|
+
id: string;
|
|
1113
|
+
name: string;
|
|
1114
|
+
description?: string | null;
|
|
1115
|
+
documentTypeIds: string[];
|
|
1116
|
+
content: JsonValue;
|
|
1117
|
+
version: number;
|
|
1118
|
+
enabled: boolean;
|
|
1119
|
+
updatedByFullName?: string | null;
|
|
1120
|
+
versions?: DocumentTemplateVersionEntity[];
|
|
1121
|
+
deleted: boolean;
|
|
1122
|
+
createdAt: string;
|
|
1123
|
+
updatedAt: string;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
export interface DocumentTemplateVersionEntity {
|
|
1127
|
+
id: string;
|
|
1128
|
+
templateId: string;
|
|
1129
|
+
template?: DocumentTemplateEntity;
|
|
1130
|
+
version: number;
|
|
1131
|
+
content: JsonValue;
|
|
1132
|
+
createdByFullName?: string | null;
|
|
1133
|
+
createdAt: string;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1109
1136
|
export interface ArchivalSeriesEntity {
|
|
1110
1137
|
id: string;
|
|
1111
1138
|
code: string;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type DocumentTemplateEntity } from '../base/entities';
|
|
2
|
+
import {
|
|
3
|
+
type DocumentTemplateAvailableResponseEntity,
|
|
4
|
+
type DocumentTemplateContent,
|
|
5
|
+
type DocumentTemplateCreateResponseEntity,
|
|
6
|
+
type DocumentTemplateGetAllResponseEntity,
|
|
7
|
+
type DocumentTemplateGetByIdResponseEntity,
|
|
8
|
+
type DocumentTemplateUpdateResponseEntity,
|
|
9
|
+
} from '../entities';
|
|
10
|
+
import { type RpcPage } from './contract';
|
|
11
|
+
|
|
12
|
+
/** Patrones NATS de `documentTemplate` (plantillas propias del editor): `<servicio>.<recurso>.<acción>`. */
|
|
13
|
+
export const DocumentTemplatePatterns = {
|
|
14
|
+
getAll: 'gestorDocumental.documentTemplate.getAll',
|
|
15
|
+
getById: 'gestorDocumental.documentTemplate.getById',
|
|
16
|
+
create: 'gestorDocumental.documentTemplate.create',
|
|
17
|
+
update: 'gestorDocumental.documentTemplate.update',
|
|
18
|
+
setEnabled: 'gestorDocumental.documentTemplate.setEnabled',
|
|
19
|
+
getAvailable: 'gestorDocumental.documentTemplate.getAvailable',
|
|
20
|
+
} as const;
|
|
21
|
+
|
|
22
|
+
/** Datos de una plantilla propia al crearla o editarla. */
|
|
23
|
+
export interface DocumentTemplateWritePayload {
|
|
24
|
+
name: string;
|
|
25
|
+
description?: string | null;
|
|
26
|
+
documentTypeIds?: string[];
|
|
27
|
+
content: DocumentTemplateContent;
|
|
28
|
+
enabled?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface DocumentTemplateContract {
|
|
32
|
+
[DocumentTemplatePatterns.getAll]: {
|
|
33
|
+
// sin `page` y `limit` responde todas en una sola página
|
|
34
|
+
payload: {
|
|
35
|
+
pagination?: { page?: number; limit?: number };
|
|
36
|
+
filters?: { search?: string; enabled?: boolean };
|
|
37
|
+
};
|
|
38
|
+
response: RpcPage<DocumentTemplateGetAllResponseEntity[]>;
|
|
39
|
+
};
|
|
40
|
+
[DocumentTemplatePatterns.getById]: {
|
|
41
|
+
payload: Pick<DocumentTemplateEntity, 'id'>;
|
|
42
|
+
response: DocumentTemplateGetByIdResponseEntity;
|
|
43
|
+
};
|
|
44
|
+
[DocumentTemplatePatterns.create]: {
|
|
45
|
+
payload: DocumentTemplateWritePayload;
|
|
46
|
+
response: DocumentTemplateCreateResponseEntity;
|
|
47
|
+
};
|
|
48
|
+
[DocumentTemplatePatterns.update]: {
|
|
49
|
+
payload: DocumentTemplateWritePayload & Pick<DocumentTemplateEntity, 'id'>;
|
|
50
|
+
response: DocumentTemplateUpdateResponseEntity;
|
|
51
|
+
};
|
|
52
|
+
[DocumentTemplatePatterns.setEnabled]: {
|
|
53
|
+
payload: Pick<DocumentTemplateEntity, 'id' | 'enabled'>;
|
|
54
|
+
response: DocumentTemplateUpdateResponseEntity;
|
|
55
|
+
};
|
|
56
|
+
/** Las habilitadas que se ofrecen al redactar un documento del tipo (las de todos los tipos y las suyas). */
|
|
57
|
+
[DocumentTemplatePatterns.getAvailable]: {
|
|
58
|
+
payload: { documentTypeId: string };
|
|
59
|
+
response: DocumentTemplateAvailableResponseEntity[];
|
|
60
|
+
};
|
|
61
|
+
}
|
package/src/contracts/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { DocumentTypePatterns, type DocumentTypeContract } from './documentType.
|
|
|
4
4
|
import { IssuingEntityPatterns, type IssuingEntityContract } from './issuingEntity.contract';
|
|
5
5
|
import { ArchivalSeriesPatterns, type ArchivalSeriesContract } from './archivalSeries.contract';
|
|
6
6
|
import { TextSnippetPatterns, type TextSnippetContract } from './textSnippet.contract';
|
|
7
|
+
import { DocumentTemplatePatterns, type DocumentTemplateContract } from './documentTemplate.contract';
|
|
7
8
|
import { HolidayPatterns, type HolidayContract } from './holiday.contract';
|
|
8
9
|
import { IndicatorsPatterns, type IndicatorsContract } from './indicators.contract';
|
|
9
10
|
import { AuditPatterns, type AuditContract } from './audit.contract';
|
|
@@ -36,6 +37,7 @@ export * from './workFolder.contract';
|
|
|
36
37
|
export * from './scan.contract';
|
|
37
38
|
export * from './archivalSeries.contract';
|
|
38
39
|
export * from './textSnippet.contract';
|
|
40
|
+
export * from './documentTemplate.contract';
|
|
39
41
|
export * from './holiday.contract';
|
|
40
42
|
export * from './indicators.contract';
|
|
41
43
|
export * from './audit.contract';
|
|
@@ -63,6 +65,7 @@ export const GestorDocumentalPatterns = {
|
|
|
63
65
|
scan: ScanPatterns,
|
|
64
66
|
archivalSeries: ArchivalSeriesPatterns,
|
|
65
67
|
textSnippet: TextSnippetPatterns,
|
|
68
|
+
documentTemplate: DocumentTemplatePatterns,
|
|
66
69
|
holiday: HolidayPatterns,
|
|
67
70
|
indicators: IndicatorsPatterns,
|
|
68
71
|
audit: AuditPatterns,
|
|
@@ -90,6 +93,7 @@ export type GestorDocumentalContract = DocumentTypeContract &
|
|
|
90
93
|
ScanContract &
|
|
91
94
|
ArchivalSeriesContract &
|
|
92
95
|
TextSnippetContract &
|
|
96
|
+
DocumentTemplateContract &
|
|
93
97
|
HolidayContract &
|
|
94
98
|
IndicatorsContract &
|
|
95
99
|
AuditContract &
|
|
@@ -439,6 +439,50 @@ export interface DocumentTrailExportEntity {
|
|
|
439
439
|
/** Plantilla oficial con que se redacta un documento en el sistema. */
|
|
440
440
|
export type DocumentTemplateKind = 'Decree' | 'Office' | 'Memorandum' | 'General';
|
|
441
441
|
|
|
442
|
+
/** Formato de un trozo de texto en el editor del gestor. */
|
|
443
|
+
export type RichMark = 'bold' | 'italic' | 'underline';
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Texto con su formato, o un campo de la plantilla (`field`: su clave), que se reemplaza por su valor al armar el PDF.
|
|
447
|
+
* Un salto de línea dentro del texto (`\n`) es un salto de línea del párrafo.
|
|
448
|
+
*/
|
|
449
|
+
export type RichInline = { text: string; marks?: RichMark[] } | { field: string };
|
|
450
|
+
|
|
451
|
+
export type RichAlign = 'left' | 'center' | 'right' | 'justify';
|
|
452
|
+
|
|
453
|
+
/** Numeración de una lista: viñetas, «1.» o la de los decretos, «1.-». */
|
|
454
|
+
export type RichListStyle = 'bullet' | 'decimal' | 'decree';
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Cómo se ve una tabla: con bordes (`grid`), o como las líneas «DE:», «A:», «MAT.:» de un oficio, con la etiqueta en
|
|
458
|
+
* negrita y sin bordes (`labels`, o `labelsRight`, en la mitad derecha, como «ANT.» y «MAT.» de un oficio).
|
|
459
|
+
*/
|
|
460
|
+
export type RichTableVariant = 'grid' | 'labels' | 'labelsRight';
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Un bloque del texto. Los de una plantilla pueden ser fijos (`locked`): quien redacta no los cambia. Las listas son
|
|
464
|
+
* bloques seguidos del mismo estilo (su nivel es la sangría, desde 0); un título o un párrafo reinicia la numeración.
|
|
465
|
+
*/
|
|
466
|
+
export type RichBlock =
|
|
467
|
+
| { id: string; type: 'paragraph'; align?: RichAlign; locked?: boolean; content: RichInline[] }
|
|
468
|
+
| { id: string; type: 'heading'; level: 1 | 2; align?: RichAlign; locked?: boolean; content: RichInline[] }
|
|
469
|
+
| { id: string; type: 'listItem'; list: RichListStyle; level: number; locked?: boolean; content: RichInline[] }
|
|
470
|
+
/** `rows[fila][columna]`: el contenido de cada celda. */
|
|
471
|
+
| { id: string; type: 'table'; variant: RichTableVariant; locked?: boolean; rows: RichInline[][][] }
|
|
472
|
+
| { id: string; type: 'rule'; locked?: boolean }
|
|
473
|
+
| { id: string; type: 'pageBreak'; locked?: boolean };
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Campo de una plantilla, con el valor que le dio quien redacta. `materia` es el asunto del documento: no se escribe
|
|
477
|
+
* aparte.
|
|
478
|
+
*/
|
|
479
|
+
export interface RichField {
|
|
480
|
+
key: string;
|
|
481
|
+
label: string;
|
|
482
|
+
value: string;
|
|
483
|
+
required?: boolean;
|
|
484
|
+
}
|
|
485
|
+
|
|
442
486
|
/**
|
|
443
487
|
* Contenido de un documento redactado en el sistema. Cada plantilla tiene su estructura; los párrafos son texto
|
|
444
488
|
* (un salto de línea dentro de un párrafo se respeta). La materia es el asunto del documento.
|
|
@@ -474,7 +518,19 @@ export type DocumentComposition =
|
|
|
474
518
|
closing?: string | null;
|
|
475
519
|
distribution: string[];
|
|
476
520
|
}
|
|
477
|
-
| { template: 'General'; title: string; body: string[]; closing?: string | null }
|
|
521
|
+
| { template: 'General'; title: string; body: string[]; closing?: string | null }
|
|
522
|
+
/**
|
|
523
|
+
* Redactado con el editor del gestor: los bloques del texto, los campos de la plantilla con su valor y la
|
|
524
|
+
* distribución. `templateKey` y `templateVersion`: de qué plantilla salió, si salió de una.
|
|
525
|
+
*/
|
|
526
|
+
| {
|
|
527
|
+
template: 'Rich';
|
|
528
|
+
templateKey?: string | null;
|
|
529
|
+
templateVersion?: number | null;
|
|
530
|
+
blocks: RichBlock[];
|
|
531
|
+
fields: RichField[];
|
|
532
|
+
distribution: string[];
|
|
533
|
+
};
|
|
478
534
|
|
|
479
535
|
/** PDF armado con una plantilla: para la vista previa (`contentBase64`) o ya subido (`fileId`). */
|
|
480
536
|
export interface DocumentComposeResponseEntity {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type DocumentTemplateEntity } from '../../base/entities';
|
|
2
|
+
import { type RichBlock, type RichField } from '../document/document.entity';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Contenido de una plantilla propia: los bloques del editor (con sus partes fijas) y los campos que completa quien
|
|
6
|
+
* redacta (en la plantilla, sin valor).
|
|
7
|
+
*/
|
|
8
|
+
export interface DocumentTemplateContent {
|
|
9
|
+
blocks: RichBlock[];
|
|
10
|
+
fields: RichField[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Plantilla propia en el listado de quien las administra. */
|
|
14
|
+
export interface DocumentTemplateGetAllResponseEntity {
|
|
15
|
+
id: DocumentTemplateEntity['id'];
|
|
16
|
+
name: DocumentTemplateEntity['name'];
|
|
17
|
+
description: string | null;
|
|
18
|
+
/** Tipos documentales donde se ofrece; vacío, en todos. */
|
|
19
|
+
documentTypeIds: DocumentTemplateEntity['documentTypeIds'];
|
|
20
|
+
documentTypeNames: string[];
|
|
21
|
+
version: DocumentTemplateEntity['version'];
|
|
22
|
+
enabled: DocumentTemplateEntity['enabled'];
|
|
23
|
+
updatedAt: DocumentTemplateEntity['updatedAt'];
|
|
24
|
+
updatedByFullName: string | null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Una versión del contenido de una plantilla. */
|
|
28
|
+
export interface DocumentTemplateVersionResponseEntity {
|
|
29
|
+
version: number;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
createdByFullName: string | null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface DocumentTemplateGetByIdResponseEntity extends DocumentTemplateGetAllResponseEntity {
|
|
35
|
+
content: DocumentTemplateContent;
|
|
36
|
+
versions: DocumentTemplateVersionResponseEntity[];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Plantilla que se ofrece al redactar un documento de un tipo: con su contenido, lista para usar. */
|
|
40
|
+
export interface DocumentTemplateAvailableResponseEntity {
|
|
41
|
+
id: DocumentTemplateEntity['id'];
|
|
42
|
+
name: DocumentTemplateEntity['name'];
|
|
43
|
+
description: string | null;
|
|
44
|
+
version: DocumentTemplateEntity['version'];
|
|
45
|
+
content: DocumentTemplateContent;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface DocumentTemplateCreateResponseEntity {
|
|
49
|
+
id: DocumentTemplateEntity['id'];
|
|
50
|
+
ok: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface DocumentTemplateUpdateResponseEntity {
|
|
54
|
+
id: DocumentTemplateEntity['id'];
|
|
55
|
+
ok: boolean;
|
|
56
|
+
/** Versión vigente: sube solo si cambió el contenido. */
|
|
57
|
+
version: number;
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './documentTemplate.entity';
|
package/src/entities/index.ts
CHANGED