@muni-sanfer/types-gestor-documental 0.0.1-beta.22 → 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.
Files changed (32) hide show
  1. package/dist/base/entities.d.ts +42 -4
  2. package/dist/base/entities.js +14 -1
  3. package/dist/contracts/archivalSeries.contract.d.ts +6 -0
  4. package/dist/contracts/index.d.ts +18 -1
  5. package/dist/contracts/index.js +6 -0
  6. package/dist/contracts/repositoryExport.contract.d.ts +57 -0
  7. package/dist/contracts/repositoryExport.contract.js +13 -0
  8. package/dist/contracts/retention.contract.d.ts +58 -0
  9. package/dist/contracts/retention.contract.js +11 -0
  10. package/dist/entities/archivalSeries/archivalSeries.entity.d.ts +5 -0
  11. package/dist/entities/index.d.ts +2 -0
  12. package/dist/entities/index.js +2 -0
  13. package/dist/entities/repositoryExport/index.d.ts +1 -0
  14. package/dist/entities/repositoryExport/index.js +17 -0
  15. package/dist/entities/repositoryExport/repositoryExport.entity.d.ts +124 -0
  16. package/dist/entities/repositoryExport/repositoryExport.entity.js +2 -0
  17. package/dist/entities/retention/index.d.ts +1 -0
  18. package/dist/entities/retention/index.js +17 -0
  19. package/dist/entities/retention/retention.entity.d.ts +49 -0
  20. package/dist/entities/retention/retention.entity.js +2 -0
  21. package/package.json +1 -1
  22. package/src/base/entities.ts +50 -4
  23. package/src/contracts/archivalSeries.contract.ts +6 -0
  24. package/src/contracts/index.ts +9 -1
  25. package/src/contracts/repositoryExport.contract.ts +54 -0
  26. package/src/contracts/retention.contract.ts +44 -0
  27. package/src/entities/archivalSeries/archivalSeries.entity.ts +5 -0
  28. package/src/entities/index.ts +2 -0
  29. package/src/entities/repositoryExport/index.ts +1 -0
  30. package/src/entities/repositoryExport/repositoryExport.entity.ts +86 -0
  31. package/src/entities/retention/index.ts +1 -0
  32. package/src/entities/retention/retention.entity.ts +53 -0
@@ -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: {
@@ -205,7 +207,7 @@ export declare const DocumentAccessAction: {
205
207
  FileDownloaded: "FileDownloaded";
206
208
  TrailExported: "TrailExported";
207
209
  };
208
- export type AuditEntity = 'DocumentType' | 'IssuingEntity' | 'ArchivalSeries' | 'TextSnippet' | 'Holiday' | 'Procedure' | 'QualityMetric' | 'ServiceOutage';
210
+ export type AuditEntity = 'DocumentType' | 'IssuingEntity' | 'ArchivalSeries' | 'TextSnippet' | 'Holiday' | 'Procedure' | 'QualityMetric' | 'ServiceOutage' | 'Repository';
209
211
  export declare const AuditEntity: {
210
212
  DocumentType: "DocumentType";
211
213
  IssuingEntity: "IssuingEntity";
@@ -215,14 +217,27 @@ export declare const AuditEntity: {
215
217
  Procedure: "Procedure";
216
218
  QualityMetric: "QualityMetric";
217
219
  ServiceOutage: "ServiceOutage";
220
+ Repository: "Repository";
218
221
  };
219
- export type AuditAction = 'Created' | 'Updated' | 'Enabled' | 'Disabled' | 'Removed';
222
+ export type AuditAction = 'Created' | 'Updated' | 'Enabled' | 'Disabled' | 'Removed' | 'Exported';
220
223
  export declare const AuditAction: {
221
224
  Created: "Created";
222
225
  Updated: "Updated";
223
226
  Enabled: "Enabled";
224
227
  Disabled: "Disabled";
225
228
  Removed: "Removed";
229
+ Exported: "Exported";
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";
226
241
  };
227
242
  export interface DocumentTypeEntity {
228
243
  id: string;
@@ -304,6 +319,8 @@ export interface DocumentEntity {
304
319
  externalRecipients?: DocumentExternalRecipientEntity[];
305
320
  emailCopies?: DocumentEmailCopyEntity[];
306
321
  accesses?: DocumentAccessEntity[];
322
+ disposition?: DispositionRecordEntity | null;
323
+ dispositionId?: string | null;
307
324
  dispatch?: DocumentDispatchEntity | null;
308
325
  docDigitalInbound?: DocDigitalInboundEntity | null;
309
326
  deleted: boolean;
@@ -460,6 +477,8 @@ export interface CaseFileEntity {
460
477
  responsibleFullName: string;
461
478
  responsiblePosition?: string | null;
462
479
  closedAt?: string | null;
480
+ disposition?: DispositionRecordEntity | null;
481
+ dispositionId?: string | null;
463
482
  closedByEmployeeId?: string | null;
464
483
  closedByFullName?: string | null;
465
484
  closingNote?: string | null;
@@ -697,9 +716,14 @@ export interface ArchivalSeriesEntity {
697
716
  name: string;
698
717
  section?: string | null;
699
718
  description?: string | null;
719
+ managementYears?: number | null;
720
+ centralYears?: number | null;
721
+ finalDisposition?: FinalDisposition | null;
722
+ retentionNote?: string | null;
700
723
  enabled: boolean;
701
724
  documentTypes?: DocumentTypeEntity[];
702
725
  caseFiles?: CaseFileEntity[];
726
+ dispositions?: DispositionRecordEntity[];
703
727
  deleted: boolean;
704
728
  createdAt: string;
705
729
  updatedAt: string;
@@ -813,6 +837,20 @@ export interface AuditLogEntity {
813
837
  employeeFullName: string;
814
838
  createdAt: string;
815
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
+ }
816
854
  type JsonValue = string | number | boolean | {
817
855
  [key in string]?: JsonValue;
818
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',
@@ -190,6 +192,7 @@ exports.AuditEntity = {
190
192
  Procedure: 'Procedure',
191
193
  QualityMetric: 'QualityMetric',
192
194
  ServiceOutage: 'ServiceOutage',
195
+ Repository: 'Repository',
193
196
  };
194
197
  exports.AuditAction = {
195
198
  Created: 'Created',
@@ -197,4 +200,14 @@ exports.AuditAction = {
197
200
  Enabled: 'Enabled',
198
201
  Disabled: 'Disabled',
199
202
  Removed: 'Removed',
203
+ Exported: 'Exported',
204
+ };
205
+ exports.FinalDisposition = {
206
+ Permanent: 'Permanent',
207
+ Eliminate: 'Eliminate',
208
+ Select: 'Select',
209
+ };
210
+ exports.DispositionKind = {
211
+ Transfer: 'Transfer',
212
+ Elimination: 'Elimination',
200
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]: {
@@ -8,6 +8,8 @@ import { type HolidayContract } from './holiday.contract';
8
8
  import { type IndicatorsContract } from './indicators.contract';
9
9
  import { type AuditContract } from './audit.contract';
10
10
  import { type SignatureCheckContract } from './signatureCheck.contract';
11
+ import { type RepositoryExportContract } from './repositoryExport.contract';
12
+ import { type RetentionContract } from './retention.contract';
11
13
  import { type ScanContract } from './scan.contract';
12
14
  import { type PartsOfficeContract } from './partsOffice.contract';
13
15
  import { type ProcedureContract } from './procedure.contract';
@@ -31,6 +33,8 @@ export * from './holiday.contract';
31
33
  export * from './indicators.contract';
32
34
  export * from './audit.contract';
33
35
  export * from './signatureCheck.contract';
36
+ export * from './repositoryExport.contract';
37
+ export * from './retention.contract';
34
38
  /** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
35
39
  export declare const GestorDocumentalPatterns: {
36
40
  readonly documentType: {
@@ -190,6 +194,19 @@ export declare const GestorDocumentalPatterns: {
190
194
  readonly signatureCheck: {
191
195
  readonly check: "gestorDocumental.signatureCheck.check";
192
196
  };
197
+ readonly repositoryExport: {
198
+ readonly getSummary: "gestorDocumental.repositoryExport.getSummary";
199
+ readonly getDocuments: "gestorDocumental.repositoryExport.getDocuments";
200
+ readonly getCaseFiles: "gestorDocumental.repositoryExport.getCaseFiles";
201
+ readonly record: "gestorDocumental.repositoryExport.record";
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
+ };
193
210
  };
194
211
  /** Contrato completo de gestor-documental-ms: la unión de los contratos de sus recursos. */
195
- export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & IssuingEntityContract & CaseFileContract & PartsOfficeContract & RegisterBookContract & SignatureBatchContract & WorkFolderContract & ScanContract & ArchivalSeriesContract & TextSnippetContract & HolidayContract & IndicatorsContract & AuditContract & SignatureCheckContract;
212
+ export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & IssuingEntityContract & CaseFileContract & PartsOfficeContract & RegisterBookContract & SignatureBatchContract & WorkFolderContract & ScanContract & ArchivalSeriesContract & TextSnippetContract & HolidayContract & IndicatorsContract & AuditContract & SignatureCheckContract & RepositoryExportContract & RetentionContract;
@@ -25,6 +25,8 @@ const holiday_contract_1 = require("./holiday.contract");
25
25
  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
+ const repositoryExport_contract_1 = require("./repositoryExport.contract");
29
+ const retention_contract_1 = require("./retention.contract");
28
30
  const scan_contract_1 = require("./scan.contract");
29
31
  const partsOffice_contract_1 = require("./partsOffice.contract");
30
32
  const procedure_contract_1 = require("./procedure.contract");
@@ -48,6 +50,8 @@ __exportStar(require("./holiday.contract"), exports);
48
50
  __exportStar(require("./indicators.contract"), exports);
49
51
  __exportStar(require("./audit.contract"), exports);
50
52
  __exportStar(require("./signatureCheck.contract"), exports);
53
+ __exportStar(require("./repositoryExport.contract"), exports);
54
+ __exportStar(require("./retention.contract"), exports);
51
55
  /** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
52
56
  exports.GestorDocumentalPatterns = {
53
57
  documentType: documentType_contract_1.DocumentTypePatterns,
@@ -66,4 +70,6 @@ exports.GestorDocumentalPatterns = {
66
70
  indicators: indicators_contract_1.IndicatorsPatterns,
67
71
  audit: audit_contract_1.AuditPatterns,
68
72
  signatureCheck: signatureCheck_contract_1.SignatureCheckPatterns,
73
+ repositoryExport: repositoryExport_contract_1.RepositoryExportPatterns,
74
+ retention: retention_contract_1.RetentionPatterns,
69
75
  };
@@ -0,0 +1,57 @@
1
+ import { type RepositoryExportCaseFilesPageEntity, type RepositoryExportRecordResponseEntity, type RepositoryExportDocumentsPageEntity, type RepositoryExportScope, type RepositoryExportSummaryEntity } from '../entities';
2
+ /**
3
+ * Patrones NATS de `repositoryExport`: exportación completa del repositorio (portabilidad). El ms entrega los datos
4
+ * por páginas, porque un mensaje NATS no admite más de 1 MB; el gateway arma el ZIP con ellos y los archivos.
5
+ */
6
+ export declare const RepositoryExportPatterns: {
7
+ readonly getSummary: "gestorDocumental.repositoryExport.getSummary";
8
+ readonly getDocuments: "gestorDocumental.repositoryExport.getDocuments";
9
+ readonly getCaseFiles: "gestorDocumental.repositoryExport.getCaseFiles";
10
+ readonly record: "gestorDocumental.repositoryExport.record";
11
+ };
12
+ /** Período por fecha de creación (días de Chile «AAAA-MM-DD»); sin él, todo. */
13
+ export interface RepositoryExportQuery {
14
+ from?: string | null;
15
+ to?: string | null;
16
+ scope?: RepositoryExportScope;
17
+ /** Solo lo incluido en un acta de transferencia: el paquete para el Archivo Nacional. */
18
+ dispositionId?: string | null;
19
+ }
20
+ export interface RepositoryExportContract {
21
+ [RepositoryExportPatterns.getSummary]: {
22
+ payload: RepositoryExportQuery;
23
+ response: RepositoryExportSummaryEntity;
24
+ };
25
+ /** Hasta 50 documentos por página, en orden de creación. */
26
+ [RepositoryExportPatterns.getDocuments]: {
27
+ payload: RepositoryExportQuery & {
28
+ cursor?: string | null;
29
+ limit?: number;
30
+ };
31
+ response: RepositoryExportDocumentsPageEntity;
32
+ };
33
+ /** Hasta 10 expedientes por página; cada uno queda con «Exportó» en su trazabilidad, a nombre de quien exporta. */
34
+ [RepositoryExportPatterns.getCaseFiles]: {
35
+ payload: Omit<RepositoryExportQuery, 'scope'> & {
36
+ cursor?: string | null;
37
+ limit?: number;
38
+ actor: {
39
+ employeeId: string | null;
40
+ fullName: string;
41
+ };
42
+ };
43
+ response: RepositoryExportCaseFilesPageEntity;
44
+ };
45
+ /** Deja la exportación en la bitácora: quién, qué período y si llevó archivos. */
46
+ [RepositoryExportPatterns.record]: {
47
+ payload: RepositoryExportQuery & {
48
+ includeFiles: boolean;
49
+ complete: boolean;
50
+ actor: {
51
+ employeeId: string | null;
52
+ fullName: string;
53
+ };
54
+ };
55
+ response: RepositoryExportRecordResponseEntity;
56
+ };
57
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RepositoryExportPatterns = void 0;
4
+ /**
5
+ * Patrones NATS de `repositoryExport`: exportación completa del repositorio (portabilidad). El ms entrega los datos
6
+ * por páginas, porque un mensaje NATS no admite más de 1 MB; el gateway arma el ZIP con ellos y los archivos.
7
+ */
8
+ exports.RepositoryExportPatterns = {
9
+ getSummary: 'gestorDocumental.repositoryExport.getSummary',
10
+ getDocuments: 'gestorDocumental.repositoryExport.getDocuments',
11
+ getCaseFiles: 'gestorDocumental.repositoryExport.getCaseFiles',
12
+ record: 'gestorDocumental.repositoryExport.record',
13
+ };
@@ -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;
@@ -14,3 +14,5 @@ export * from './holiday';
14
14
  export * from './indicators';
15
15
  export * from './audit';
16
16
  export * from './signatureCheck';
17
+ export * from './repositoryExport';
18
+ export * from './retention';
@@ -30,3 +30,5 @@ __exportStar(require("./holiday"), exports);
30
30
  __exportStar(require("./indicators"), exports);
31
31
  __exportStar(require("./audit"), exports);
32
32
  __exportStar(require("./signatureCheck"), exports);
33
+ __exportStar(require("./repositoryExport"), exports);
34
+ __exportStar(require("./retention"), exports);
@@ -0,0 +1 @@
1
+ export * from './repositoryExport.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("./repositoryExport.entity"), exports);
@@ -0,0 +1,124 @@
1
+ import { type CaseFileExportResponseEntity } from '../caseFile';
2
+ /** Qué documentos: los oficiales (finalizados y anulados) o todos, también borradores y en tramitación. */
3
+ export type RepositoryExportScope = 'official' | 'all';
4
+ /** Un archivo que el gateway descarga y pone en el ZIP, en la ruta indicada. */
5
+ export interface RepositoryExportFile {
6
+ fileId: string;
7
+ path: string;
8
+ kind: 'document' | 'attachment';
9
+ }
10
+ /** Un documento con todos sus datos, como va en `documentos/*.jsonl`. Claves en castellano, como `expediente.json`. */
11
+ export interface RepositoryDocumentRecord {
12
+ id: string;
13
+ tipo: {
14
+ nombre: string;
15
+ sigla: string | null;
16
+ serie: {
17
+ codigo: string;
18
+ nombre: string;
19
+ } | null;
20
+ };
21
+ entidadEmisora: string;
22
+ folio: string | null;
23
+ numero: number | null;
24
+ anio: number | null;
25
+ materia: string;
26
+ palabrasClave: string[];
27
+ nivelAcceso: string;
28
+ datosSensibles: boolean;
29
+ finRestriccion: string | null;
30
+ estado: string;
31
+ origen: string;
32
+ codigoVerificacion: string | null;
33
+ redactor: {
34
+ id: string;
35
+ nombre: string;
36
+ };
37
+ unidadEmisora: {
38
+ codigoDireccion: number | null;
39
+ departamentoId: string | null;
40
+ };
41
+ creado: string;
42
+ enviado: string | null;
43
+ finalizado: string | null;
44
+ anulacion: {
45
+ fecha: string;
46
+ motivo: string | null;
47
+ } | null;
48
+ numerosAnulados: {
49
+ numero: number;
50
+ anio: number;
51
+ motivo: string;
52
+ registradoPor: string;
53
+ fecha: string;
54
+ }[];
55
+ participantes: {
56
+ rol: string;
57
+ orden: number;
58
+ etapa: number;
59
+ nombre: string;
60
+ cargo: string | null;
61
+ estado: string;
62
+ resueltoEl: string | null;
63
+ observacion: string | null;
64
+ }[];
65
+ destinatarios: {
66
+ tipo: string;
67
+ nombre: string;
68
+ cargo: string | null;
69
+ }[];
70
+ destinatariosExternos: {
71
+ entidad: string;
72
+ usuario: string | null;
73
+ }[];
74
+ despacho: {
75
+ estado: string;
76
+ folio: string | null;
77
+ despachadoEl: string | null;
78
+ idDocDigital: string | null;
79
+ } | null;
80
+ ingreso: {
81
+ folio: string | null;
82
+ remitente: string | null;
83
+ folioDeOrigen: string | null;
84
+ } | null;
85
+ anexos: {
86
+ nombre: string;
87
+ enlace: string | null;
88
+ archivo: string | null;
89
+ }[];
90
+ trazabilidad: {
91
+ accion: string;
92
+ quien: string | null;
93
+ cuando: string;
94
+ observacion: string | null;
95
+ sha256: string | null;
96
+ }[];
97
+ /** Ruta del PDF vigente (firmado) dentro del ZIP. */
98
+ archivo: string;
99
+ }
100
+ export interface RepositoryExportSummaryEntity {
101
+ /** Órgano que exporta (`ORGAN_NAME`). */
102
+ organ: string;
103
+ from: string | null;
104
+ to: string | null;
105
+ scope: RepositoryExportScope;
106
+ documents: number;
107
+ caseFiles: number;
108
+ /** Catálogos completos: tipos documentales, series, procedimientos, entidades emisoras y feriados. */
109
+ catalogs: Record<string, unknown[]>;
110
+ }
111
+ export interface RepositoryExportDocumentsPageEntity {
112
+ items: {
113
+ record: RepositoryDocumentRecord;
114
+ files: RepositoryExportFile[];
115
+ }[];
116
+ nextCursor: string | null;
117
+ }
118
+ export interface RepositoryExportCaseFilesPageEntity {
119
+ items: CaseFileExportResponseEntity[];
120
+ nextCursor: string | null;
121
+ }
122
+ export interface RepositoryExportRecordResponseEntity {
123
+ ok: boolean;
124
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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.22",
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';
@@ -318,7 +322,8 @@ export type AuditEntity =
318
322
  | 'Holiday'
319
323
  | 'Procedure'
320
324
  | 'QualityMetric'
321
- | 'ServiceOutage';
325
+ | 'ServiceOutage'
326
+ | 'Repository';
322
327
 
323
328
  export const AuditEntity = {
324
329
  DocumentType: 'DocumentType',
@@ -329,9 +334,10 @@ export const AuditEntity = {
329
334
  Procedure: 'Procedure',
330
335
  QualityMetric: 'QualityMetric',
331
336
  ServiceOutage: 'ServiceOutage',
337
+ Repository: 'Repository',
332
338
  } satisfies Record<string, AuditEntity>;
333
339
 
334
- export type AuditAction = 'Created' | 'Updated' | 'Enabled' | 'Disabled' | 'Removed';
340
+ export type AuditAction = 'Created' | 'Updated' | 'Enabled' | 'Disabled' | 'Removed' | 'Exported';
335
341
 
336
342
  export const AuditAction = {
337
343
  Created: 'Created',
@@ -339,8 +345,24 @@ export const AuditAction = {
339
345
  Enabled: 'Enabled',
340
346
  Disabled: 'Disabled',
341
347
  Removed: 'Removed',
348
+ Exported: 'Exported',
342
349
  } satisfies Record<string, AuditAction>;
343
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
+
344
366
  export interface DocumentTypeEntity {
345
367
  id: string;
346
368
  name: string;
@@ -422,6 +444,8 @@ export interface DocumentEntity {
422
444
  externalRecipients?: DocumentExternalRecipientEntity[];
423
445
  emailCopies?: DocumentEmailCopyEntity[];
424
446
  accesses?: DocumentAccessEntity[];
447
+ disposition?: DispositionRecordEntity | null;
448
+ dispositionId?: string | null;
425
449
  dispatch?: DocumentDispatchEntity | null;
426
450
  docDigitalInbound?: DocDigitalInboundEntity | null;
427
451
  deleted: boolean;
@@ -589,6 +613,8 @@ export interface CaseFileEntity {
589
613
  responsibleFullName: string;
590
614
  responsiblePosition?: string | null;
591
615
  closedAt?: string | null;
616
+ disposition?: DispositionRecordEntity | null;
617
+ dispositionId?: string | null;
592
618
  closedByEmployeeId?: string | null;
593
619
  closedByFullName?: string | null;
594
620
  closingNote?: string | null;
@@ -841,9 +867,14 @@ export interface ArchivalSeriesEntity {
841
867
  name: string;
842
868
  section?: string | null;
843
869
  description?: string | null;
870
+ managementYears?: number | null;
871
+ centralYears?: number | null;
872
+ finalDisposition?: FinalDisposition | null;
873
+ retentionNote?: string | null;
844
874
  enabled: boolean;
845
875
  documentTypes?: DocumentTypeEntity[];
846
876
  caseFiles?: CaseFileEntity[];
877
+ dispositions?: DispositionRecordEntity[];
847
878
  deleted: boolean;
848
879
  createdAt: string;
849
880
  updatedAt: string;
@@ -968,4 +999,19 @@ export interface AuditLogEntity {
968
999
  createdAt: string;
969
1000
  }
970
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
+
971
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 {
@@ -8,6 +8,8 @@ import { HolidayPatterns, type HolidayContract } from './holiday.contract';
8
8
  import { IndicatorsPatterns, type IndicatorsContract } from './indicators.contract';
9
9
  import { AuditPatterns, type AuditContract } from './audit.contract';
10
10
  import { SignatureCheckPatterns, type SignatureCheckContract } from './signatureCheck.contract';
11
+ import { RepositoryExportPatterns, type RepositoryExportContract } from './repositoryExport.contract';
12
+ import { RetentionPatterns, type RetentionContract } from './retention.contract';
11
13
  import { ScanPatterns, type ScanContract } from './scan.contract';
12
14
  import { PartsOfficePatterns, type PartsOfficeContract } from './partsOffice.contract';
13
15
  import { ProcedurePatterns, type ProcedureContract } from './procedure.contract';
@@ -32,6 +34,8 @@ export * from './holiday.contract';
32
34
  export * from './indicators.contract';
33
35
  export * from './audit.contract';
34
36
  export * from './signatureCheck.contract';
37
+ export * from './repositoryExport.contract';
38
+ export * from './retention.contract';
35
39
 
36
40
  /** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
37
41
  export const GestorDocumentalPatterns = {
@@ -51,6 +55,8 @@ export const GestorDocumentalPatterns = {
51
55
  indicators: IndicatorsPatterns,
52
56
  audit: AuditPatterns,
53
57
  signatureCheck: SignatureCheckPatterns,
58
+ repositoryExport: RepositoryExportPatterns,
59
+ retention: RetentionPatterns,
54
60
  } as const;
55
61
 
56
62
  /** Contrato completo de gestor-documental-ms: la unión de los contratos de sus recursos. */
@@ -69,4 +75,6 @@ export type GestorDocumentalContract = DocumentTypeContract &
69
75
  HolidayContract &
70
76
  IndicatorsContract &
71
77
  AuditContract &
72
- SignatureCheckContract;
78
+ SignatureCheckContract &
79
+ RepositoryExportContract &
80
+ RetentionContract;
@@ -0,0 +1,54 @@
1
+ import {
2
+ type RepositoryExportCaseFilesPageEntity,
3
+ type RepositoryExportRecordResponseEntity,
4
+ type RepositoryExportDocumentsPageEntity,
5
+ type RepositoryExportScope,
6
+ type RepositoryExportSummaryEntity,
7
+ } from '../entities';
8
+
9
+ /**
10
+ * Patrones NATS de `repositoryExport`: exportación completa del repositorio (portabilidad). El ms entrega los datos
11
+ * por páginas, porque un mensaje NATS no admite más de 1 MB; el gateway arma el ZIP con ellos y los archivos.
12
+ */
13
+ export const RepositoryExportPatterns = {
14
+ getSummary: 'gestorDocumental.repositoryExport.getSummary',
15
+ getDocuments: 'gestorDocumental.repositoryExport.getDocuments',
16
+ getCaseFiles: 'gestorDocumental.repositoryExport.getCaseFiles',
17
+ record: 'gestorDocumental.repositoryExport.record',
18
+ } as const;
19
+
20
+ /** Período por fecha de creación (días de Chile «AAAA-MM-DD»); sin él, todo. */
21
+ export interface RepositoryExportQuery {
22
+ from?: string | null;
23
+ to?: string | null;
24
+ scope?: RepositoryExportScope;
25
+ /** Solo lo incluido en un acta de transferencia: el paquete para el Archivo Nacional. */
26
+ dispositionId?: string | null;
27
+ }
28
+
29
+ export interface RepositoryExportContract {
30
+ [RepositoryExportPatterns.getSummary]: { payload: RepositoryExportQuery; response: RepositoryExportSummaryEntity };
31
+ /** Hasta 50 documentos por página, en orden de creación. */
32
+ [RepositoryExportPatterns.getDocuments]: {
33
+ payload: RepositoryExportQuery & { cursor?: string | null; limit?: number };
34
+ response: RepositoryExportDocumentsPageEntity;
35
+ };
36
+ /** Hasta 10 expedientes por página; cada uno queda con «Exportó» en su trazabilidad, a nombre de quien exporta. */
37
+ [RepositoryExportPatterns.getCaseFiles]: {
38
+ payload: Omit<RepositoryExportQuery, 'scope'> & {
39
+ cursor?: string | null;
40
+ limit?: number;
41
+ actor: { employeeId: string | null; fullName: string };
42
+ };
43
+ response: RepositoryExportCaseFilesPageEntity;
44
+ };
45
+ /** Deja la exportación en la bitácora: quién, qué período y si llevó archivos. */
46
+ [RepositoryExportPatterns.record]: {
47
+ payload: RepositoryExportQuery & {
48
+ includeFiles: boolean;
49
+ complete: boolean;
50
+ actor: { employeeId: string | null; fullName: string };
51
+ };
52
+ response: RepositoryExportRecordResponseEntity;
53
+ };
54
+ }
@@ -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;
@@ -14,3 +14,5 @@ export * from './holiday';
14
14
  export * from './indicators';
15
15
  export * from './audit';
16
16
  export * from './signatureCheck';
17
+ export * from './repositoryExport';
18
+ export * from './retention';
@@ -0,0 +1 @@
1
+ export * from './repositoryExport.entity';
@@ -0,0 +1,86 @@
1
+ import { type CaseFileExportResponseEntity } from '../caseFile';
2
+
3
+ /** Qué documentos: los oficiales (finalizados y anulados) o todos, también borradores y en tramitación. */
4
+ export type RepositoryExportScope = 'official' | 'all';
5
+
6
+ /** Un archivo que el gateway descarga y pone en el ZIP, en la ruta indicada. */
7
+ export interface RepositoryExportFile {
8
+ fileId: string;
9
+ path: string;
10
+ kind: 'document' | 'attachment';
11
+ }
12
+
13
+ /** Un documento con todos sus datos, como va en `documentos/*.jsonl`. Claves en castellano, como `expediente.json`. */
14
+ export interface RepositoryDocumentRecord {
15
+ id: string;
16
+ tipo: { nombre: string; sigla: string | null; serie: { codigo: string; nombre: string } | null };
17
+ entidadEmisora: string;
18
+ folio: string | null;
19
+ numero: number | null;
20
+ anio: number | null;
21
+ materia: string;
22
+ palabrasClave: string[];
23
+ nivelAcceso: string;
24
+ datosSensibles: boolean;
25
+ finRestriccion: string | null;
26
+ estado: string;
27
+ origen: string;
28
+ codigoVerificacion: string | null;
29
+ redactor: { id: string; nombre: string };
30
+ unidadEmisora: { codigoDireccion: number | null; departamentoId: string | null };
31
+ creado: string;
32
+ enviado: string | null;
33
+ finalizado: string | null;
34
+ anulacion: { fecha: string; motivo: string | null } | null;
35
+ numerosAnulados: { numero: number; anio: number; motivo: string; registradoPor: string; fecha: string }[];
36
+ participantes: {
37
+ rol: string;
38
+ orden: number;
39
+ etapa: number;
40
+ nombre: string;
41
+ cargo: string | null;
42
+ estado: string;
43
+ resueltoEl: string | null;
44
+ observacion: string | null;
45
+ }[];
46
+ destinatarios: { tipo: string; nombre: string; cargo: string | null }[];
47
+ destinatariosExternos: { entidad: string; usuario: string | null }[];
48
+ despacho: { estado: string; folio: string | null; despachadoEl: string | null; idDocDigital: string | null } | null;
49
+ ingreso: { folio: string | null; remitente: string | null; folioDeOrigen: string | null } | null;
50
+ anexos: { nombre: string; enlace: string | null; archivo: string | null }[];
51
+ trazabilidad: {
52
+ accion: string;
53
+ quien: string | null;
54
+ cuando: string;
55
+ observacion: string | null;
56
+ sha256: string | null;
57
+ }[];
58
+ /** Ruta del PDF vigente (firmado) dentro del ZIP. */
59
+ archivo: string;
60
+ }
61
+
62
+ export interface RepositoryExportSummaryEntity {
63
+ /** Órgano que exporta (`ORGAN_NAME`). */
64
+ organ: string;
65
+ from: string | null;
66
+ to: string | null;
67
+ scope: RepositoryExportScope;
68
+ documents: number;
69
+ caseFiles: number;
70
+ /** Catálogos completos: tipos documentales, series, procedimientos, entidades emisoras y feriados. */
71
+ catalogs: Record<string, unknown[]>;
72
+ }
73
+
74
+ export interface RepositoryExportDocumentsPageEntity {
75
+ items: { record: RepositoryDocumentRecord; files: RepositoryExportFile[] }[];
76
+ nextCursor: string | null;
77
+ }
78
+
79
+ export interface RepositoryExportCaseFilesPageEntity {
80
+ items: CaseFileExportResponseEntity[];
81
+ nextCursor: string | null;
82
+ }
83
+
84
+ export interface RepositoryExportRecordResponseEntity {
85
+ ok: boolean;
86
+ }
@@ -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
+ }