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

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.
@@ -205,7 +205,7 @@ export declare const DocumentAccessAction: {
205
205
  FileDownloaded: "FileDownloaded";
206
206
  TrailExported: "TrailExported";
207
207
  };
208
- export type AuditEntity = 'DocumentType' | 'IssuingEntity' | 'ArchivalSeries' | 'TextSnippet' | 'Holiday' | 'Procedure' | 'QualityMetric' | 'ServiceOutage';
208
+ export type AuditEntity = 'DocumentType' | 'IssuingEntity' | 'ArchivalSeries' | 'TextSnippet' | 'Holiday' | 'Procedure' | 'QualityMetric' | 'ServiceOutage' | 'Repository';
209
209
  export declare const AuditEntity: {
210
210
  DocumentType: "DocumentType";
211
211
  IssuingEntity: "IssuingEntity";
@@ -215,14 +215,16 @@ export declare const AuditEntity: {
215
215
  Procedure: "Procedure";
216
216
  QualityMetric: "QualityMetric";
217
217
  ServiceOutage: "ServiceOutage";
218
+ Repository: "Repository";
218
219
  };
219
- export type AuditAction = 'Created' | 'Updated' | 'Enabled' | 'Disabled' | 'Removed';
220
+ export type AuditAction = 'Created' | 'Updated' | 'Enabled' | 'Disabled' | 'Removed' | 'Exported';
220
221
  export declare const AuditAction: {
221
222
  Created: "Created";
222
223
  Updated: "Updated";
223
224
  Enabled: "Enabled";
224
225
  Disabled: "Disabled";
225
226
  Removed: "Removed";
227
+ Exported: "Exported";
226
228
  };
227
229
  export interface DocumentTypeEntity {
228
230
  id: string;
@@ -190,6 +190,7 @@ exports.AuditEntity = {
190
190
  Procedure: 'Procedure',
191
191
  QualityMetric: 'QualityMetric',
192
192
  ServiceOutage: 'ServiceOutage',
193
+ Repository: 'Repository',
193
194
  };
194
195
  exports.AuditAction = {
195
196
  Created: 'Created',
@@ -197,4 +198,5 @@ exports.AuditAction = {
197
198
  Enabled: 'Enabled',
198
199
  Disabled: 'Disabled',
199
200
  Removed: 'Removed',
201
+ Exported: 'Exported',
200
202
  };
@@ -8,6 +8,7 @@ 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';
11
12
  import { type ScanContract } from './scan.contract';
12
13
  import { type PartsOfficeContract } from './partsOffice.contract';
13
14
  import { type ProcedureContract } from './procedure.contract';
@@ -31,6 +32,7 @@ export * from './holiday.contract';
31
32
  export * from './indicators.contract';
32
33
  export * from './audit.contract';
33
34
  export * from './signatureCheck.contract';
35
+ export * from './repositoryExport.contract';
34
36
  /** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
35
37
  export declare const GestorDocumentalPatterns: {
36
38
  readonly documentType: {
@@ -119,6 +121,7 @@ export declare const GestorDocumentalPatterns: {
119
121
  readonly acknowledgeInbound: "gestorDocumental.partsOffice.acknowledgeInbound";
120
122
  readonly returnInbound: "gestorDocumental.partsOffice.returnInbound";
121
123
  readonly getInboundFile: "gestorDocumental.partsOffice.getInboundFile";
124
+ readonly checkEnablement: "gestorDocumental.partsOffice.checkEnablement";
122
125
  };
123
126
  readonly registerBook: {
124
127
  readonly get: "gestorDocumental.registerBook.get";
@@ -189,6 +192,12 @@ export declare const GestorDocumentalPatterns: {
189
192
  readonly signatureCheck: {
190
193
  readonly check: "gestorDocumental.signatureCheck.check";
191
194
  };
195
+ readonly repositoryExport: {
196
+ readonly getSummary: "gestorDocumental.repositoryExport.getSummary";
197
+ readonly getDocuments: "gestorDocumental.repositoryExport.getDocuments";
198
+ readonly getCaseFiles: "gestorDocumental.repositoryExport.getCaseFiles";
199
+ readonly record: "gestorDocumental.repositoryExport.record";
200
+ };
192
201
  };
193
202
  /** Contrato completo de gestor-documental-ms: la unión de los contratos de sus recursos. */
194
- export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & IssuingEntityContract & CaseFileContract & PartsOfficeContract & RegisterBookContract & SignatureBatchContract & WorkFolderContract & ScanContract & ArchivalSeriesContract & TextSnippetContract & HolidayContract & IndicatorsContract & AuditContract & SignatureCheckContract;
203
+ export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & IssuingEntityContract & CaseFileContract & PartsOfficeContract & RegisterBookContract & SignatureBatchContract & WorkFolderContract & ScanContract & ArchivalSeriesContract & TextSnippetContract & HolidayContract & IndicatorsContract & AuditContract & SignatureCheckContract & RepositoryExportContract;
@@ -25,6 +25,7 @@ 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");
28
29
  const scan_contract_1 = require("./scan.contract");
29
30
  const partsOffice_contract_1 = require("./partsOffice.contract");
30
31
  const procedure_contract_1 = require("./procedure.contract");
@@ -48,6 +49,7 @@ __exportStar(require("./holiday.contract"), exports);
48
49
  __exportStar(require("./indicators.contract"), exports);
49
50
  __exportStar(require("./audit.contract"), exports);
50
51
  __exportStar(require("./signatureCheck.contract"), exports);
52
+ __exportStar(require("./repositoryExport.contract"), exports);
51
53
  /** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
52
54
  exports.GestorDocumentalPatterns = {
53
55
  documentType: documentType_contract_1.DocumentTypePatterns,
@@ -66,4 +68,5 @@ exports.GestorDocumentalPatterns = {
66
68
  indicators: indicators_contract_1.IndicatorsPatterns,
67
69
  audit: audit_contract_1.AuditPatterns,
68
70
  signatureCheck: signatureCheck_contract_1.SignatureCheckPatterns,
71
+ repositoryExport: repositoryExport_contract_1.RepositoryExportPatterns,
69
72
  };
@@ -1,5 +1,5 @@
1
1
  import { type DocumentAccessLevel, type DocumentInstruction } from '../base/entities';
2
- import { type DocDigitalDocumentTypeEntity, type DocDigitalEntityEntity, type PartsOfficeInboundEntity, type DocDigitalUserEntity, type PartsOfficeDispatchEntity, type PartsOfficeFileEntity, type PartsOfficeOkResponseEntity, type PartsOfficeRegisterResponseEntity, type PartsOfficeStatusEntity, type PartsOfficeSummaryEntity, type PartsOfficeSyncResponseEntity } from '../entities';
2
+ import { type DocDigitalDocumentTypeEntity, type DocDigitalEntityEntity, type PartsOfficeInboundEntity, type DocDigitalUserEntity, type EnablementPersonInput, type PartsOfficeEnablementEntity, type PartsOfficeDispatchEntity, type PartsOfficeFileEntity, type PartsOfficeOkResponseEntity, type PartsOfficeRegisterResponseEntity, type PartsOfficeStatusEntity, type PartsOfficeSummaryEntity, type PartsOfficeSyncResponseEntity } from '../entities';
3
3
  import { type RpcPage } from './contract';
4
4
  import { type DocumentActor, type DocumentExternalRecipientInput } from './document.contract';
5
5
  /** Patrones NATS de `partsOffice` (Oficina de Partes y DocDigital): `<servicio>.<recurso>.<acción>`. */
@@ -21,6 +21,7 @@ export declare const PartsOfficePatterns: {
21
21
  readonly acknowledgeInbound: "gestorDocumental.partsOffice.acknowledgeInbound";
22
22
  readonly returnInbound: "gestorDocumental.partsOffice.returnInbound";
23
23
  readonly getInboundFile: "gestorDocumental.partsOffice.getInboundFile";
24
+ readonly checkEnablement: "gestorDocumental.partsOffice.checkEnablement";
24
25
  };
25
26
  /** Destinatario interno de un ingreso, ya resuelto por el gateway (las áreas con sus integrantes). */
26
27
  export type PartsOfficeRecipientInput = {
@@ -173,5 +174,15 @@ export interface PartsOfficeContract {
173
174
  };
174
175
  response: PartsOfficeFileEntity;
175
176
  };
177
+ /**
178
+ * Quiénes de `people` están habilitados como usuarios de DocDigital en la municipalidad o en sus entidades emisoras
179
+ * (por RUN). El directorio de cada entidad se guarda 10 minutos.
180
+ */
181
+ [PartsOfficePatterns.checkEnablement]: {
182
+ payload: {
183
+ people: EnablementPersonInput[];
184
+ };
185
+ response: PartsOfficeEnablementEntity;
186
+ };
176
187
  }
177
188
  export {};
@@ -20,4 +20,5 @@ exports.PartsOfficePatterns = {
20
20
  acknowledgeInbound: 'gestorDocumental.partsOffice.acknowledgeInbound',
21
21
  returnInbound: 'gestorDocumental.partsOffice.returnInbound',
22
22
  getInboundFile: 'gestorDocumental.partsOffice.getInboundFile',
23
+ checkEnablement: 'gestorDocumental.partsOffice.checkEnablement',
23
24
  };
@@ -0,0 +1,55 @@
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
+ }
18
+ export interface RepositoryExportContract {
19
+ [RepositoryExportPatterns.getSummary]: {
20
+ payload: RepositoryExportQuery;
21
+ response: RepositoryExportSummaryEntity;
22
+ };
23
+ /** Hasta 50 documentos por página, en orden de creación. */
24
+ [RepositoryExportPatterns.getDocuments]: {
25
+ payload: RepositoryExportQuery & {
26
+ cursor?: string | null;
27
+ limit?: number;
28
+ };
29
+ response: RepositoryExportDocumentsPageEntity;
30
+ };
31
+ /** Hasta 10 expedientes por página; cada uno queda con «Exportó» en su trazabilidad, a nombre de quien exporta. */
32
+ [RepositoryExportPatterns.getCaseFiles]: {
33
+ payload: Omit<RepositoryExportQuery, 'scope'> & {
34
+ cursor?: string | null;
35
+ limit?: number;
36
+ actor: {
37
+ employeeId: string | null;
38
+ fullName: string;
39
+ };
40
+ };
41
+ response: RepositoryExportCaseFilesPageEntity;
42
+ };
43
+ /** Deja la exportación en la bitácora: quién, qué período y si llevó archivos. */
44
+ [RepositoryExportPatterns.record]: {
45
+ payload: RepositoryExportQuery & {
46
+ includeFiles: boolean;
47
+ complete: boolean;
48
+ actor: {
49
+ employeeId: string | null;
50
+ fullName: string;
51
+ };
52
+ };
53
+ response: RepositoryExportRecordResponseEntity;
54
+ };
55
+ }
@@ -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
+ };
@@ -14,3 +14,4 @@ export * from './holiday';
14
14
  export * from './indicators';
15
15
  export * from './audit';
16
16
  export * from './signatureCheck';
17
+ export * from './repositoryExport';
@@ -30,3 +30,4 @@ __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);
@@ -103,3 +103,35 @@ export interface PartsOfficeFileEntity {
103
103
  fileId: string;
104
104
  fileName: string;
105
105
  }
106
+ /** Por qué una persona tiene que estar habilitada en DocDigital. */
107
+ export type EnablementRole = 'PartsOffice' | 'Signer';
108
+ /** Persona que se revisa: la arma el gateway con organizacion-ms (permisos de Partes y firmantes por cargo). */
109
+ export interface EnablementPersonInput {
110
+ employeeId: string;
111
+ fullName: string;
112
+ /** RUN del funcionario; sin él no se puede buscar en DocDigital. */
113
+ rut: string | null;
114
+ position: string | null;
115
+ roles: EnablementRole[];
116
+ }
117
+ /** Resultado de una persona: en qué entidades de DocDigital está habilitada. */
118
+ export interface EnablementPersonEntity extends EnablementPersonInput {
119
+ status: 'Enabled' | 'NotEnabled' | 'NoRut';
120
+ enabledIn: {
121
+ entityId: number;
122
+ entityName: string;
123
+ docDigitalPosition: string | null;
124
+ }[];
125
+ }
126
+ export interface PartsOfficeEnablementEntity {
127
+ checkedAt: string;
128
+ /** DocDigital configurado en el gestor; sin él no se revisa nada. */
129
+ configured: boolean;
130
+ /** Entidades revisadas: la municipalidad y las entidades emisoras con DocDigital. */
131
+ entities: {
132
+ entityId: number;
133
+ entityName: string;
134
+ userCount: number;
135
+ }[];
136
+ people: EnablementPersonEntity[];
137
+ }
@@ -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 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muni-sanfer/types-gestor-documental",
3
- "version": "0.0.1-beta.21",
3
+ "version": "0.0.1-beta.23",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -318,7 +318,8 @@ export type AuditEntity =
318
318
  | 'Holiday'
319
319
  | 'Procedure'
320
320
  | 'QualityMetric'
321
- | 'ServiceOutage';
321
+ | 'ServiceOutage'
322
+ | 'Repository';
322
323
 
323
324
  export const AuditEntity = {
324
325
  DocumentType: 'DocumentType',
@@ -329,9 +330,10 @@ export const AuditEntity = {
329
330
  Procedure: 'Procedure',
330
331
  QualityMetric: 'QualityMetric',
331
332
  ServiceOutage: 'ServiceOutage',
333
+ Repository: 'Repository',
332
334
  } satisfies Record<string, AuditEntity>;
333
335
 
334
- export type AuditAction = 'Created' | 'Updated' | 'Enabled' | 'Disabled' | 'Removed';
336
+ export type AuditAction = 'Created' | 'Updated' | 'Enabled' | 'Disabled' | 'Removed' | 'Exported';
335
337
 
336
338
  export const AuditAction = {
337
339
  Created: 'Created',
@@ -339,6 +341,7 @@ export const AuditAction = {
339
341
  Enabled: 'Enabled',
340
342
  Disabled: 'Disabled',
341
343
  Removed: 'Removed',
344
+ Exported: 'Exported',
342
345
  } satisfies Record<string, AuditAction>;
343
346
 
344
347
  export interface DocumentTypeEntity {
@@ -8,6 +8,7 @@ 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';
11
12
  import { ScanPatterns, type ScanContract } from './scan.contract';
12
13
  import { PartsOfficePatterns, type PartsOfficeContract } from './partsOffice.contract';
13
14
  import { ProcedurePatterns, type ProcedureContract } from './procedure.contract';
@@ -32,6 +33,7 @@ export * from './holiday.contract';
32
33
  export * from './indicators.contract';
33
34
  export * from './audit.contract';
34
35
  export * from './signatureCheck.contract';
36
+ export * from './repositoryExport.contract';
35
37
 
36
38
  /** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
37
39
  export const GestorDocumentalPatterns = {
@@ -51,6 +53,7 @@ export const GestorDocumentalPatterns = {
51
53
  indicators: IndicatorsPatterns,
52
54
  audit: AuditPatterns,
53
55
  signatureCheck: SignatureCheckPatterns,
56
+ repositoryExport: RepositoryExportPatterns,
54
57
  } as const;
55
58
 
56
59
  /** Contrato completo de gestor-documental-ms: la unión de los contratos de sus recursos. */
@@ -69,4 +72,5 @@ export type GestorDocumentalContract = DocumentTypeContract &
69
72
  HolidayContract &
70
73
  IndicatorsContract &
71
74
  AuditContract &
72
- SignatureCheckContract;
75
+ SignatureCheckContract &
76
+ RepositoryExportContract;
@@ -4,6 +4,8 @@ import {
4
4
  type DocDigitalEntityEntity,
5
5
  type PartsOfficeInboundEntity,
6
6
  type DocDigitalUserEntity,
7
+ type EnablementPersonInput,
8
+ type PartsOfficeEnablementEntity,
7
9
  type PartsOfficeDispatchEntity,
8
10
  type PartsOfficeFileEntity,
9
11
  type PartsOfficeOkResponseEntity,
@@ -34,6 +36,7 @@ export const PartsOfficePatterns = {
34
36
  acknowledgeInbound: 'gestorDocumental.partsOffice.acknowledgeInbound',
35
37
  returnInbound: 'gestorDocumental.partsOffice.returnInbound',
36
38
  getInboundFile: 'gestorDocumental.partsOffice.getInboundFile',
39
+ checkEnablement: 'gestorDocumental.partsOffice.checkEnablement',
37
40
  } as const;
38
41
 
39
42
  /** Destinatario interno de un ingreso, ya resuelto por el gateway (las áreas con sus integrantes). */
@@ -120,4 +123,12 @@ export interface PartsOfficeContract {
120
123
  payload: { id: string; attachment?: number };
121
124
  response: PartsOfficeFileEntity;
122
125
  };
126
+ /**
127
+ * Quiénes de `people` están habilitados como usuarios de DocDigital en la municipalidad o en sus entidades emisoras
128
+ * (por RUN). El directorio de cada entidad se guarda 10 minutos.
129
+ */
130
+ [PartsOfficePatterns.checkEnablement]: {
131
+ payload: { people: EnablementPersonInput[] };
132
+ response: PartsOfficeEnablementEntity;
133
+ };
123
134
  }
@@ -0,0 +1,52 @@
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
+ }
26
+
27
+ export interface RepositoryExportContract {
28
+ [RepositoryExportPatterns.getSummary]: { payload: RepositoryExportQuery; response: RepositoryExportSummaryEntity };
29
+ /** Hasta 50 documentos por página, en orden de creación. */
30
+ [RepositoryExportPatterns.getDocuments]: {
31
+ payload: RepositoryExportQuery & { cursor?: string | null; limit?: number };
32
+ response: RepositoryExportDocumentsPageEntity;
33
+ };
34
+ /** Hasta 10 expedientes por página; cada uno queda con «Exportó» en su trazabilidad, a nombre de quien exporta. */
35
+ [RepositoryExportPatterns.getCaseFiles]: {
36
+ payload: Omit<RepositoryExportQuery, 'scope'> & {
37
+ cursor?: string | null;
38
+ limit?: number;
39
+ actor: { employeeId: string | null; fullName: string };
40
+ };
41
+ response: RepositoryExportCaseFilesPageEntity;
42
+ };
43
+ /** Deja la exportación en la bitácora: quién, qué período y si llevó archivos. */
44
+ [RepositoryExportPatterns.record]: {
45
+ payload: RepositoryExportQuery & {
46
+ includeFiles: boolean;
47
+ complete: boolean;
48
+ actor: { employeeId: string | null; fullName: string };
49
+ };
50
+ response: RepositoryExportRecordResponseEntity;
51
+ };
52
+ }
@@ -14,3 +14,4 @@ export * from './holiday';
14
14
  export * from './indicators';
15
15
  export * from './audit';
16
16
  export * from './signatureCheck';
17
+ export * from './repositoryExport';
@@ -108,3 +108,31 @@ export interface PartsOfficeFileEntity {
108
108
  fileId: string;
109
109
  fileName: string;
110
110
  }
111
+
112
+ /** Por qué una persona tiene que estar habilitada en DocDigital. */
113
+ export type EnablementRole = 'PartsOffice' | 'Signer';
114
+
115
+ /** Persona que se revisa: la arma el gateway con organizacion-ms (permisos de Partes y firmantes por cargo). */
116
+ export interface EnablementPersonInput {
117
+ employeeId: string;
118
+ fullName: string;
119
+ /** RUN del funcionario; sin él no se puede buscar en DocDigital. */
120
+ rut: string | null;
121
+ position: string | null;
122
+ roles: EnablementRole[];
123
+ }
124
+
125
+ /** Resultado de una persona: en qué entidades de DocDigital está habilitada. */
126
+ export interface EnablementPersonEntity extends EnablementPersonInput {
127
+ status: 'Enabled' | 'NotEnabled' | 'NoRut';
128
+ enabledIn: { entityId: number; entityName: string; docDigitalPosition: string | null }[];
129
+ }
130
+
131
+ export interface PartsOfficeEnablementEntity {
132
+ checkedAt: string;
133
+ /** DocDigital configurado en el gestor; sin él no se revisa nada. */
134
+ configured: boolean;
135
+ /** Entidades revisadas: la municipalidad y las entidades emisoras con DocDigital. */
136
+ entities: { entityId: number; entityName: string; userCount: number }[];
137
+ people: EnablementPersonEntity[];
138
+ }
@@ -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
+ }