@muni-sanfer/types-gestor-documental 0.0.1-beta.23 → 0.0.1-beta.24

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' | 'Reassigned' | 'Dispatched' | 'DispatchReturned' | 'Received' | 'EmailCopySent' | 'EmailCopyOpened';
36
+ export type DocumentTrackingAction = 'Created' | 'Updated' | 'Submitted' | 'Visaed' | 'Signed' | 'Rejected' | 'Finished' | 'Discarded' | 'Numbered' | 'NumberAnnulled' | 'Annulled' | 'Delivered' | 'Derived' | 'Reassigned' | 'Dispatched' | 'DispatchReturned' | 'Received' | 'EmailCopySent' | 'EmailCopyOpened' | 'DispositionRecorded';
37
37
  export declare const DocumentTrackingAction: {
38
38
  Created: "Created";
39
39
  Updated: "Updated";
@@ -54,6 +54,7 @@ export declare const DocumentTrackingAction: {
54
54
  Received: "Received";
55
55
  EmailCopySent: "EmailCopySent";
56
56
  EmailCopyOpened: "EmailCopyOpened";
57
+ DispositionRecorded: "DispositionRecorded";
57
58
  };
58
59
  export type DocumentOrigin = 'Internal' | 'DocDigital';
59
60
  export declare const DocumentOrigin: {
@@ -146,7 +147,7 @@ export declare const CaseFileActorType: {
146
147
  PrivateInstitution: "PrivateInstitution";
147
148
  Official: "Official";
148
149
  };
149
- export type CaseFileTrackingAction = 'Created' | 'Updated' | 'EntryAdded' | 'EntryVoided' | 'EntryMoved' | 'ParticipantAdded' | 'ParticipantRemoved' | 'Closed' | 'Exported' | 'ShareLinkCreated' | 'ShareLinkRevoked';
150
+ export type CaseFileTrackingAction = 'Created' | 'Updated' | 'EntryAdded' | 'EntryVoided' | 'EntryMoved' | 'ParticipantAdded' | 'ParticipantRemoved' | 'Closed' | 'Exported' | 'ShareLinkCreated' | 'ShareLinkRevoked' | 'DispositionRecorded';
150
151
  export declare const CaseFileTrackingAction: {
151
152
  Created: "Created";
152
153
  Updated: "Updated";
@@ -159,6 +160,7 @@ export declare const CaseFileTrackingAction: {
159
160
  Exported: "Exported";
160
161
  ShareLinkCreated: "ShareLinkCreated";
161
162
  ShareLinkRevoked: "ShareLinkRevoked";
163
+ DispositionRecorded: "DispositionRecorded";
162
164
  };
163
165
  export type CaseFileAccessAction = 'Viewed' | 'FileDownloaded' | 'Exported';
164
166
  export declare const CaseFileAccessAction: {
@@ -226,6 +228,17 @@ export declare const AuditAction: {
226
228
  Removed: "Removed";
227
229
  Exported: "Exported";
228
230
  };
231
+ export type FinalDisposition = 'Permanent' | 'Eliminate' | 'Select';
232
+ export declare const FinalDisposition: {
233
+ Permanent: "Permanent";
234
+ Eliminate: "Eliminate";
235
+ Select: "Select";
236
+ };
237
+ export type DispositionKind = 'Transfer' | 'Elimination';
238
+ export declare const DispositionKind: {
239
+ Transfer: "Transfer";
240
+ Elimination: "Elimination";
241
+ };
229
242
  export interface DocumentTypeEntity {
230
243
  id: string;
231
244
  name: string;
@@ -306,6 +319,8 @@ export interface DocumentEntity {
306
319
  externalRecipients?: DocumentExternalRecipientEntity[];
307
320
  emailCopies?: DocumentEmailCopyEntity[];
308
321
  accesses?: DocumentAccessEntity[];
322
+ disposition?: DispositionRecordEntity | null;
323
+ dispositionId?: string | null;
309
324
  dispatch?: DocumentDispatchEntity | null;
310
325
  docDigitalInbound?: DocDigitalInboundEntity | null;
311
326
  deleted: boolean;
@@ -462,6 +477,8 @@ export interface CaseFileEntity {
462
477
  responsibleFullName: string;
463
478
  responsiblePosition?: string | null;
464
479
  closedAt?: string | null;
480
+ disposition?: DispositionRecordEntity | null;
481
+ dispositionId?: string | null;
465
482
  closedByEmployeeId?: string | null;
466
483
  closedByFullName?: string | null;
467
484
  closingNote?: string | null;
@@ -699,9 +716,14 @@ export interface ArchivalSeriesEntity {
699
716
  name: string;
700
717
  section?: string | null;
701
718
  description?: string | null;
719
+ managementYears?: number | null;
720
+ centralYears?: number | null;
721
+ finalDisposition?: FinalDisposition | null;
722
+ retentionNote?: string | null;
702
723
  enabled: boolean;
703
724
  documentTypes?: DocumentTypeEntity[];
704
725
  caseFiles?: CaseFileEntity[];
726
+ dispositions?: DispositionRecordEntity[];
705
727
  deleted: boolean;
706
728
  createdAt: string;
707
729
  updatedAt: string;
@@ -815,6 +837,20 @@ export interface AuditLogEntity {
815
837
  employeeFullName: string;
816
838
  createdAt: string;
817
839
  }
840
+ export interface DispositionRecordEntity {
841
+ id: string;
842
+ kind: DispositionKind;
843
+ number: number;
844
+ year: number;
845
+ observation?: string | null;
846
+ series?: ArchivalSeriesEntity;
847
+ seriesId: string;
848
+ documents?: DocumentEntity[];
849
+ caseFiles?: CaseFileEntity[];
850
+ createdByEmployeeId: string;
851
+ createdByFullName: string;
852
+ createdAt: string;
853
+ }
818
854
  type JsonValue = string | number | boolean | {
819
855
  [key in string]?: JsonValue;
820
856
  } | Array<JsonValue> | null;
@@ -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.AuditAction = exports.AuditEntity = exports.DocumentAccessAction = exports.QualityMetricKey = exports.ServiceOutageKind = exports.WorkFolderItemKind = exports.TextSnippetSection = exports.ScanSessionStatus = exports.CaseFileAccessAction = exports.CaseFileTrackingAction = exports.CaseFileActorType = exports.CaseFileActorRelation = exports.CaseFileEntryKind = exports.CaseFileActuationType = exports.CaseFileIncorporationMechanism = exports.CaseFileStatus = exports.DocumentInstruction = exports.DocumentDeliveryOrigin = exports.DocumentRecipientType = exports.DocumentAttachmentType = exports.DocumentFlowStepType = exports.DocDigitalInboundStatus = exports.DocumentDispatchStatus = exports.DocumentOrigin = exports.DocumentTrackingAction = exports.DocumentParticipantStatus = exports.DocumentParticipantRole = exports.DocumentAccessLevel = exports.DocumentStatus = exports.DocumentCategory = void 0;
4
+ exports.DispositionKind = exports.FinalDisposition = exports.AuditAction = exports.AuditEntity = exports.DocumentAccessAction = exports.QualityMetricKey = exports.ServiceOutageKind = exports.WorkFolderItemKind = exports.TextSnippetSection = exports.ScanSessionStatus = exports.CaseFileAccessAction = exports.CaseFileTrackingAction = exports.CaseFileActorType = exports.CaseFileActorRelation = exports.CaseFileEntryKind = exports.CaseFileActuationType = exports.CaseFileIncorporationMechanism = exports.CaseFileStatus = exports.DocumentInstruction = exports.DocumentDeliveryOrigin = exports.DocumentRecipientType = exports.DocumentAttachmentType = exports.DocumentFlowStepType = exports.DocDigitalInboundStatus = exports.DocumentDispatchStatus = exports.DocumentOrigin = 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',
@@ -52,6 +52,7 @@ exports.DocumentTrackingAction = {
52
52
  Received: 'Received',
53
53
  EmailCopySent: 'EmailCopySent',
54
54
  EmailCopyOpened: 'EmailCopyOpened',
55
+ DispositionRecorded: 'DispositionRecorded',
55
56
  };
56
57
  exports.DocumentOrigin = {
57
58
  Internal: 'Internal',
@@ -142,6 +143,7 @@ exports.CaseFileTrackingAction = {
142
143
  Exported: 'Exported',
143
144
  ShareLinkCreated: 'ShareLinkCreated',
144
145
  ShareLinkRevoked: 'ShareLinkRevoked',
146
+ DispositionRecorded: 'DispositionRecorded',
145
147
  };
146
148
  exports.CaseFileAccessAction = {
147
149
  Viewed: 'Viewed',
@@ -200,3 +202,12 @@ exports.AuditAction = {
200
202
  Removed: 'Removed',
201
203
  Exported: 'Exported',
202
204
  };
205
+ exports.FinalDisposition = {
206
+ Permanent: 'Permanent',
207
+ Eliminate: 'Eliminate',
208
+ Select: 'Select',
209
+ };
210
+ exports.DispositionKind = {
211
+ Transfer: 'Transfer',
212
+ Elimination: 'Elimination',
213
+ };
@@ -1,3 +1,4 @@
1
+ import { type FinalDisposition } from '../base/entities';
1
2
  import { type ArchivalSeriesEntity } from '../base/entities';
2
3
  import { type ArchivalSeriesCreateResponseEntity, type ArchivalSeriesGetAllResponseEntity, type ArchivalSeriesGetByIdResponseEntity, type ArchivalSeriesUpdateResponseEntity } from '../entities';
3
4
  import { type RpcPage } from './contract';
@@ -16,6 +17,11 @@ export interface ArchivalSeriesWritePayload {
16
17
  section?: string | null;
17
18
  description?: string | null;
18
19
  enabled?: boolean;
20
+ /** Tabla de Retención Documental: los tres juntos o ninguno. */
21
+ managementYears?: number | null;
22
+ centralYears?: number | null;
23
+ finalDisposition?: FinalDisposition | null;
24
+ retentionNote?: string | null;
19
25
  }
20
26
  export interface ArchivalSeriesContract {
21
27
  [ArchivalSeriesPatterns.getAll]: {
@@ -9,6 +9,7 @@ import { type IndicatorsContract } from './indicators.contract';
9
9
  import { type AuditContract } from './audit.contract';
10
10
  import { type SignatureCheckContract } from './signatureCheck.contract';
11
11
  import { type RepositoryExportContract } from './repositoryExport.contract';
12
+ import { type RetentionContract } from './retention.contract';
12
13
  import { type ScanContract } from './scan.contract';
13
14
  import { type PartsOfficeContract } from './partsOffice.contract';
14
15
  import { type ProcedureContract } from './procedure.contract';
@@ -33,6 +34,7 @@ export * from './indicators.contract';
33
34
  export * from './audit.contract';
34
35
  export * from './signatureCheck.contract';
35
36
  export * from './repositoryExport.contract';
37
+ export * from './retention.contract';
36
38
  /** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
37
39
  export declare const GestorDocumentalPatterns: {
38
40
  readonly documentType: {
@@ -198,6 +200,13 @@ export declare const GestorDocumentalPatterns: {
198
200
  readonly getCaseFiles: "gestorDocumental.repositoryExport.getCaseFiles";
199
201
  readonly record: "gestorDocumental.repositoryExport.record";
200
202
  };
203
+ readonly retention: {
204
+ readonly getSummary: "gestorDocumental.retention.getSummary";
205
+ readonly getDueItems: "gestorDocumental.retention.getDueItems";
206
+ readonly createRecord: "gestorDocumental.retention.createRecord";
207
+ readonly getRecords: "gestorDocumental.retention.getRecords";
208
+ readonly getRecordPdf: "gestorDocumental.retention.getRecordPdf";
209
+ };
201
210
  };
202
211
  /** Contrato completo de gestor-documental-ms: la unión de los contratos de sus recursos. */
203
- export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & IssuingEntityContract & CaseFileContract & PartsOfficeContract & RegisterBookContract & SignatureBatchContract & WorkFolderContract & ScanContract & ArchivalSeriesContract & TextSnippetContract & HolidayContract & IndicatorsContract & AuditContract & SignatureCheckContract & RepositoryExportContract;
212
+ export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & IssuingEntityContract & CaseFileContract & PartsOfficeContract & RegisterBookContract & SignatureBatchContract & WorkFolderContract & ScanContract & ArchivalSeriesContract & TextSnippetContract & HolidayContract & IndicatorsContract & AuditContract & SignatureCheckContract & RepositoryExportContract & RetentionContract;
@@ -26,6 +26,7 @@ const indicators_contract_1 = require("./indicators.contract");
26
26
  const audit_contract_1 = require("./audit.contract");
27
27
  const signatureCheck_contract_1 = require("./signatureCheck.contract");
28
28
  const repositoryExport_contract_1 = require("./repositoryExport.contract");
29
+ const retention_contract_1 = require("./retention.contract");
29
30
  const scan_contract_1 = require("./scan.contract");
30
31
  const partsOffice_contract_1 = require("./partsOffice.contract");
31
32
  const procedure_contract_1 = require("./procedure.contract");
@@ -50,6 +51,7 @@ __exportStar(require("./indicators.contract"), exports);
50
51
  __exportStar(require("./audit.contract"), exports);
51
52
  __exportStar(require("./signatureCheck.contract"), exports);
52
53
  __exportStar(require("./repositoryExport.contract"), exports);
54
+ __exportStar(require("./retention.contract"), exports);
53
55
  /** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
54
56
  exports.GestorDocumentalPatterns = {
55
57
  documentType: documentType_contract_1.DocumentTypePatterns,
@@ -69,4 +71,5 @@ exports.GestorDocumentalPatterns = {
69
71
  audit: audit_contract_1.AuditPatterns,
70
72
  signatureCheck: signatureCheck_contract_1.SignatureCheckPatterns,
71
73
  repositoryExport: repositoryExport_contract_1.RepositoryExportPatterns,
74
+ retention: retention_contract_1.RetentionPatterns,
72
75
  };
@@ -14,6 +14,8 @@ export interface RepositoryExportQuery {
14
14
  from?: string | null;
15
15
  to?: string | null;
16
16
  scope?: RepositoryExportScope;
17
+ /** Solo lo incluido en un acta de transferencia: el paquete para el Archivo Nacional. */
18
+ dispositionId?: string | null;
17
19
  }
18
20
  export interface RepositoryExportContract {
19
21
  [RepositoryExportPatterns.getSummary]: {
@@ -0,0 +1,58 @@
1
+ import { type DispositionKind } from '../base/entities';
2
+ import { type DispositionRecordResponseEntity, type IndicatorsFileEntity, type RetentionDueItemEntity, type RetentionSummaryEntity } from '../entities';
3
+ import { type RpcPage } from './contract';
4
+ /** Patrones NATS de `retention`: plazos de retención por serie y actas de transferencia o eliminación. */
5
+ export declare const RetentionPatterns: {
6
+ readonly getSummary: "gestorDocumental.retention.getSummary";
7
+ readonly getDueItems: "gestorDocumental.retention.getDueItems";
8
+ readonly createRecord: "gestorDocumental.retention.createRecord";
9
+ readonly getRecords: "gestorDocumental.retention.getRecords";
10
+ readonly getRecordPdf: "gestorDocumental.retention.getRecordPdf";
11
+ };
12
+ export interface RetentionContract {
13
+ [RetentionPatterns.getSummary]: {
14
+ payload: Record<string, never>;
15
+ response: RetentionSummaryEntity;
16
+ };
17
+ /** Lo vencido de una serie, de lo más antiguo a lo más reciente. */
18
+ [RetentionPatterns.getDueItems]: {
19
+ payload: {
20
+ seriesId: string;
21
+ page?: number;
22
+ limit?: number;
23
+ };
24
+ response: RpcPage<RetentionDueItemEntity[]>;
25
+ };
26
+ /**
27
+ * Emite el acta con lo elegido (todo debe estar vencido y sin acta). Según la serie: conservación permanente →
28
+ * transferencia; eliminación → eliminación; selección → cualquiera de las dos.
29
+ */
30
+ [RetentionPatterns.createRecord]: {
31
+ payload: {
32
+ kind: DispositionKind;
33
+ seriesId: string;
34
+ documentIds: string[];
35
+ caseFileIds: string[];
36
+ observation?: string | null;
37
+ actor: {
38
+ employeeId: string;
39
+ fullName: string;
40
+ };
41
+ };
42
+ response: DispositionRecordResponseEntity;
43
+ };
44
+ [RetentionPatterns.getRecords]: {
45
+ payload: {
46
+ year: number;
47
+ };
48
+ response: DispositionRecordResponseEntity[];
49
+ };
50
+ /** El acta en PDF, con lo que incluye, para firmarla y archivarla. */
51
+ [RetentionPatterns.getRecordPdf]: {
52
+ payload: {
53
+ id: string;
54
+ generatedBy: string;
55
+ };
56
+ response: IndicatorsFileEntity;
57
+ };
58
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RetentionPatterns = void 0;
4
+ /** Patrones NATS de `retention`: plazos de retención por serie y actas de transferencia o eliminación. */
5
+ exports.RetentionPatterns = {
6
+ getSummary: 'gestorDocumental.retention.getSummary',
7
+ getDueItems: 'gestorDocumental.retention.getDueItems',
8
+ createRecord: 'gestorDocumental.retention.createRecord',
9
+ getRecords: 'gestorDocumental.retention.getRecords',
10
+ getRecordPdf: 'gestorDocumental.retention.getRecordPdf',
11
+ };
@@ -6,6 +6,11 @@ export interface ArchivalSeriesGetAllResponseEntity {
6
6
  section: ArchivalSeriesEntity['section'];
7
7
  description: ArchivalSeriesEntity['description'];
8
8
  enabled: ArchivalSeriesEntity['enabled'];
9
+ /** Tabla de Retención Documental: años en archivo de gestión y central, y qué se hace después. */
10
+ managementYears: ArchivalSeriesEntity['managementYears'];
11
+ centralYears: ArchivalSeriesEntity['centralYears'];
12
+ finalDisposition: ArchivalSeriesEntity['finalDisposition'];
13
+ retentionNote: ArchivalSeriesEntity['retentionNote'];
9
14
  /** Cuántos tipos documentales y expedientes la usan. */
10
15
  documentTypes: number;
11
16
  caseFiles: number;
@@ -15,3 +15,4 @@ export * from './indicators';
15
15
  export * from './audit';
16
16
  export * from './signatureCheck';
17
17
  export * from './repositoryExport';
18
+ export * from './retention';
@@ -31,3 +31,4 @@ __exportStar(require("./indicators"), exports);
31
31
  __exportStar(require("./audit"), exports);
32
32
  __exportStar(require("./signatureCheck"), exports);
33
33
  __exportStar(require("./repositoryExport"), exports);
34
+ __exportStar(require("./retention"), exports);
@@ -0,0 +1 @@
1
+ export * from './retention.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("./retention.entity"), exports);
@@ -0,0 +1,49 @@
1
+ import { type DispositionKind, type FinalDisposition } from '../../base/entities';
2
+ /** Una serie con su Tabla de Retención y cuánto venció. */
3
+ export interface RetentionSeriesEntity {
4
+ seriesId: string;
5
+ code: string;
6
+ name: string;
7
+ section: string | null;
8
+ managementYears: number;
9
+ centralYears: number;
10
+ finalDisposition: FinalDisposition;
11
+ retentionNote: string | null;
12
+ /** Documentos firmados y expedientes cerrados cuyo plazo terminó y aún no tienen acta. */
13
+ documentsDue: number;
14
+ caseFilesDue: number;
15
+ /** Actas ya emitidas de la serie. */
16
+ dispositions: number;
17
+ }
18
+ export interface RetentionSummaryEntity {
19
+ series: RetentionSeriesEntity[];
20
+ /** Series habilitadas sin plazos: sus documentos no vencen. */
21
+ seriesWithoutRetention: number;
22
+ }
23
+ /** Un documento o expediente cuyo plazo de retención terminó. */
24
+ export interface RetentionDueItemEntity {
25
+ kind: 'Document' | 'CaseFile';
26
+ id: string;
27
+ /** Folio del documento o IUIe del expediente. */
28
+ reference: string;
29
+ title: string;
30
+ /** Desde cuándo se cuenta: la última firma del documento o el cierre del expediente. */
31
+ baseDate: string;
32
+ dueAt: string;
33
+ }
34
+ export interface DispositionRecordResponseEntity {
35
+ id: string;
36
+ kind: DispositionKind;
37
+ number: number;
38
+ year: number;
39
+ /** «Acta de transferencia N° 1/2026». */
40
+ label: string;
41
+ seriesId: string;
42
+ seriesCode: string;
43
+ seriesName: string;
44
+ observation: string | null;
45
+ documents: number;
46
+ caseFiles: number;
47
+ createdByFullName: string;
48
+ createdAt: string;
49
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muni-sanfer/types-gestor-documental",
3
- "version": "0.0.1-beta.23",
3
+ "version": "0.0.1-beta.24",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -65,7 +65,8 @@ export type DocumentTrackingAction =
65
65
  | 'DispatchReturned'
66
66
  | 'Received'
67
67
  | 'EmailCopySent'
68
- | 'EmailCopyOpened';
68
+ | 'EmailCopyOpened'
69
+ | 'DispositionRecorded';
69
70
 
70
71
  export const DocumentTrackingAction = {
71
72
  Created: 'Created',
@@ -87,6 +88,7 @@ export const DocumentTrackingAction = {
87
88
  Received: 'Received',
88
89
  EmailCopySent: 'EmailCopySent',
89
90
  EmailCopyOpened: 'EmailCopyOpened',
91
+ DispositionRecorded: 'DispositionRecorded',
90
92
  } satisfies Record<string, DocumentTrackingAction>;
91
93
 
92
94
  export type DocumentOrigin = 'Internal' | 'DocDigital';
@@ -228,7 +230,8 @@ export type CaseFileTrackingAction =
228
230
  | 'Closed'
229
231
  | 'Exported'
230
232
  | 'ShareLinkCreated'
231
- | 'ShareLinkRevoked';
233
+ | 'ShareLinkRevoked'
234
+ | 'DispositionRecorded';
232
235
 
233
236
  export const CaseFileTrackingAction = {
234
237
  Created: 'Created',
@@ -242,6 +245,7 @@ export const CaseFileTrackingAction = {
242
245
  Exported: 'Exported',
243
246
  ShareLinkCreated: 'ShareLinkCreated',
244
247
  ShareLinkRevoked: 'ShareLinkRevoked',
248
+ DispositionRecorded: 'DispositionRecorded',
245
249
  } satisfies Record<string, CaseFileTrackingAction>;
246
250
 
247
251
  export type CaseFileAccessAction = 'Viewed' | 'FileDownloaded' | 'Exported';
@@ -344,6 +348,21 @@ export const AuditAction = {
344
348
  Exported: 'Exported',
345
349
  } satisfies Record<string, AuditAction>;
346
350
 
351
+ export type FinalDisposition = 'Permanent' | 'Eliminate' | 'Select';
352
+
353
+ export const FinalDisposition = {
354
+ Permanent: 'Permanent',
355
+ Eliminate: 'Eliminate',
356
+ Select: 'Select',
357
+ } satisfies Record<string, FinalDisposition>;
358
+
359
+ export type DispositionKind = 'Transfer' | 'Elimination';
360
+
361
+ export const DispositionKind = {
362
+ Transfer: 'Transfer',
363
+ Elimination: 'Elimination',
364
+ } satisfies Record<string, DispositionKind>;
365
+
347
366
  export interface DocumentTypeEntity {
348
367
  id: string;
349
368
  name: string;
@@ -425,6 +444,8 @@ export interface DocumentEntity {
425
444
  externalRecipients?: DocumentExternalRecipientEntity[];
426
445
  emailCopies?: DocumentEmailCopyEntity[];
427
446
  accesses?: DocumentAccessEntity[];
447
+ disposition?: DispositionRecordEntity | null;
448
+ dispositionId?: string | null;
428
449
  dispatch?: DocumentDispatchEntity | null;
429
450
  docDigitalInbound?: DocDigitalInboundEntity | null;
430
451
  deleted: boolean;
@@ -592,6 +613,8 @@ export interface CaseFileEntity {
592
613
  responsibleFullName: string;
593
614
  responsiblePosition?: string | null;
594
615
  closedAt?: string | null;
616
+ disposition?: DispositionRecordEntity | null;
617
+ dispositionId?: string | null;
595
618
  closedByEmployeeId?: string | null;
596
619
  closedByFullName?: string | null;
597
620
  closingNote?: string | null;
@@ -844,9 +867,14 @@ export interface ArchivalSeriesEntity {
844
867
  name: string;
845
868
  section?: string | null;
846
869
  description?: string | null;
870
+ managementYears?: number | null;
871
+ centralYears?: number | null;
872
+ finalDisposition?: FinalDisposition | null;
873
+ retentionNote?: string | null;
847
874
  enabled: boolean;
848
875
  documentTypes?: DocumentTypeEntity[];
849
876
  caseFiles?: CaseFileEntity[];
877
+ dispositions?: DispositionRecordEntity[];
850
878
  deleted: boolean;
851
879
  createdAt: string;
852
880
  updatedAt: string;
@@ -971,4 +999,19 @@ export interface AuditLogEntity {
971
999
  createdAt: string;
972
1000
  }
973
1001
 
1002
+ export interface DispositionRecordEntity {
1003
+ id: string;
1004
+ kind: DispositionKind;
1005
+ number: number;
1006
+ year: number;
1007
+ observation?: string | null;
1008
+ series?: ArchivalSeriesEntity;
1009
+ seriesId: string;
1010
+ documents?: DocumentEntity[];
1011
+ caseFiles?: CaseFileEntity[];
1012
+ createdByEmployeeId: string;
1013
+ createdByFullName: string;
1014
+ createdAt: string;
1015
+ }
1016
+
974
1017
  type JsonValue = string | number | boolean | { [key in string]?: JsonValue } | Array<JsonValue> | null;
@@ -1,3 +1,4 @@
1
+ import { type FinalDisposition } from '../base/entities';
1
2
  import { type ArchivalSeriesEntity } from '../base/entities';
2
3
  import {
3
4
  type ArchivalSeriesCreateResponseEntity,
@@ -23,6 +24,11 @@ export interface ArchivalSeriesWritePayload {
23
24
  section?: string | null;
24
25
  description?: string | null;
25
26
  enabled?: boolean;
27
+ /** Tabla de Retención Documental: los tres juntos o ninguno. */
28
+ managementYears?: number | null;
29
+ centralYears?: number | null;
30
+ finalDisposition?: FinalDisposition | null;
31
+ retentionNote?: string | null;
26
32
  }
27
33
 
28
34
  export interface ArchivalSeriesContract {
@@ -9,6 +9,7 @@ import { IndicatorsPatterns, type IndicatorsContract } from './indicators.contra
9
9
  import { AuditPatterns, type AuditContract } from './audit.contract';
10
10
  import { SignatureCheckPatterns, type SignatureCheckContract } from './signatureCheck.contract';
11
11
  import { RepositoryExportPatterns, type RepositoryExportContract } from './repositoryExport.contract';
12
+ import { RetentionPatterns, type RetentionContract } from './retention.contract';
12
13
  import { ScanPatterns, type ScanContract } from './scan.contract';
13
14
  import { PartsOfficePatterns, type PartsOfficeContract } from './partsOffice.contract';
14
15
  import { ProcedurePatterns, type ProcedureContract } from './procedure.contract';
@@ -34,6 +35,7 @@ export * from './indicators.contract';
34
35
  export * from './audit.contract';
35
36
  export * from './signatureCheck.contract';
36
37
  export * from './repositoryExport.contract';
38
+ export * from './retention.contract';
37
39
 
38
40
  /** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
39
41
  export const GestorDocumentalPatterns = {
@@ -54,6 +56,7 @@ export const GestorDocumentalPatterns = {
54
56
  audit: AuditPatterns,
55
57
  signatureCheck: SignatureCheckPatterns,
56
58
  repositoryExport: RepositoryExportPatterns,
59
+ retention: RetentionPatterns,
57
60
  } as const;
58
61
 
59
62
  /** Contrato completo de gestor-documental-ms: la unión de los contratos de sus recursos. */
@@ -73,4 +76,5 @@ export type GestorDocumentalContract = DocumentTypeContract &
73
76
  IndicatorsContract &
74
77
  AuditContract &
75
78
  SignatureCheckContract &
76
- RepositoryExportContract;
79
+ RepositoryExportContract &
80
+ RetentionContract;
@@ -22,6 +22,8 @@ export interface RepositoryExportQuery {
22
22
  from?: string | null;
23
23
  to?: string | null;
24
24
  scope?: RepositoryExportScope;
25
+ /** Solo lo incluido en un acta de transferencia: el paquete para el Archivo Nacional. */
26
+ dispositionId?: string | null;
25
27
  }
26
28
 
27
29
  export interface RepositoryExportContract {
@@ -0,0 +1,44 @@
1
+ import { type DispositionKind } from '../base/entities';
2
+ import {
3
+ type DispositionRecordResponseEntity,
4
+ type IndicatorsFileEntity,
5
+ type RetentionDueItemEntity,
6
+ type RetentionSummaryEntity,
7
+ } from '../entities';
8
+ import { type RpcPage } from './contract';
9
+
10
+ /** Patrones NATS de `retention`: plazos de retención por serie y actas de transferencia o eliminación. */
11
+ export const RetentionPatterns = {
12
+ getSummary: 'gestorDocumental.retention.getSummary',
13
+ getDueItems: 'gestorDocumental.retention.getDueItems',
14
+ createRecord: 'gestorDocumental.retention.createRecord',
15
+ getRecords: 'gestorDocumental.retention.getRecords',
16
+ getRecordPdf: 'gestorDocumental.retention.getRecordPdf',
17
+ } as const;
18
+
19
+ export interface RetentionContract {
20
+ [RetentionPatterns.getSummary]: { payload: Record<string, never>; response: RetentionSummaryEntity };
21
+ /** Lo vencido de una serie, de lo más antiguo a lo más reciente. */
22
+ [RetentionPatterns.getDueItems]: {
23
+ payload: { seriesId: string; page?: number; limit?: number };
24
+ response: RpcPage<RetentionDueItemEntity[]>;
25
+ };
26
+ /**
27
+ * Emite el acta con lo elegido (todo debe estar vencido y sin acta). Según la serie: conservación permanente →
28
+ * transferencia; eliminación → eliminación; selección → cualquiera de las dos.
29
+ */
30
+ [RetentionPatterns.createRecord]: {
31
+ payload: {
32
+ kind: DispositionKind;
33
+ seriesId: string;
34
+ documentIds: string[];
35
+ caseFileIds: string[];
36
+ observation?: string | null;
37
+ actor: { employeeId: string; fullName: string };
38
+ };
39
+ response: DispositionRecordResponseEntity;
40
+ };
41
+ [RetentionPatterns.getRecords]: { payload: { year: number }; response: DispositionRecordResponseEntity[] };
42
+ /** El acta en PDF, con lo que incluye, para firmarla y archivarla. */
43
+ [RetentionPatterns.getRecordPdf]: { payload: { id: string; generatedBy: string }; response: IndicatorsFileEntity };
44
+ }
@@ -7,6 +7,11 @@ export interface ArchivalSeriesGetAllResponseEntity {
7
7
  section: ArchivalSeriesEntity['section'];
8
8
  description: ArchivalSeriesEntity['description'];
9
9
  enabled: ArchivalSeriesEntity['enabled'];
10
+ /** Tabla de Retención Documental: años en archivo de gestión y central, y qué se hace después. */
11
+ managementYears: ArchivalSeriesEntity['managementYears'];
12
+ centralYears: ArchivalSeriesEntity['centralYears'];
13
+ finalDisposition: ArchivalSeriesEntity['finalDisposition'];
14
+ retentionNote: ArchivalSeriesEntity['retentionNote'];
10
15
  /** Cuántos tipos documentales y expedientes la usan. */
11
16
  documentTypes: number;
12
17
  caseFiles: number;
@@ -15,3 +15,4 @@ export * from './indicators';
15
15
  export * from './audit';
16
16
  export * from './signatureCheck';
17
17
  export * from './repositoryExport';
18
+ export * from './retention';
@@ -0,0 +1 @@
1
+ export * from './retention.entity';
@@ -0,0 +1,53 @@
1
+ import { type DispositionKind, type FinalDisposition } from '../../base/entities';
2
+
3
+ /** Una serie con su Tabla de Retención y cuánto venció. */
4
+ export interface RetentionSeriesEntity {
5
+ seriesId: string;
6
+ code: string;
7
+ name: string;
8
+ section: string | null;
9
+ managementYears: number;
10
+ centralYears: number;
11
+ finalDisposition: FinalDisposition;
12
+ retentionNote: string | null;
13
+ /** Documentos firmados y expedientes cerrados cuyo plazo terminó y aún no tienen acta. */
14
+ documentsDue: number;
15
+ caseFilesDue: number;
16
+ /** Actas ya emitidas de la serie. */
17
+ dispositions: number;
18
+ }
19
+
20
+ export interface RetentionSummaryEntity {
21
+ series: RetentionSeriesEntity[];
22
+ /** Series habilitadas sin plazos: sus documentos no vencen. */
23
+ seriesWithoutRetention: number;
24
+ }
25
+
26
+ /** Un documento o expediente cuyo plazo de retención terminó. */
27
+ export interface RetentionDueItemEntity {
28
+ kind: 'Document' | 'CaseFile';
29
+ id: string;
30
+ /** Folio del documento o IUIe del expediente. */
31
+ reference: string;
32
+ title: string;
33
+ /** Desde cuándo se cuenta: la última firma del documento o el cierre del expediente. */
34
+ baseDate: string;
35
+ dueAt: string;
36
+ }
37
+
38
+ export interface DispositionRecordResponseEntity {
39
+ id: string;
40
+ kind: DispositionKind;
41
+ number: number;
42
+ year: number;
43
+ /** «Acta de transferencia N° 1/2026». */
44
+ label: string;
45
+ seriesId: string;
46
+ seriesCode: string;
47
+ seriesName: string;
48
+ observation: string | null;
49
+ documents: number;
50
+ caseFiles: number;
51
+ createdByFullName: string;
52
+ createdAt: string;
53
+ }