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

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.
@@ -239,6 +239,42 @@ export declare const DispositionKind: {
239
239
  Transfer: "Transfer";
240
240
  Elimination: "Elimination";
241
241
  };
242
+ export type AccessRequestChannel = 'Portal' | 'Email' | 'InPerson' | 'Letter';
243
+ export declare const AccessRequestChannel: {
244
+ Portal: "Portal";
245
+ Email: "Email";
246
+ InPerson: "InPerson";
247
+ Letter: "Letter";
248
+ };
249
+ export type AccessRequestStatus = 'Received' | 'InCorrection' | 'InProgress' | 'Resolved';
250
+ export declare const AccessRequestStatus: {
251
+ Received: "Received";
252
+ InCorrection: "InCorrection";
253
+ InProgress: "InProgress";
254
+ Resolved: "Resolved";
255
+ };
256
+ export type AccessRequestResolution = 'Delivered' | 'PartiallyDelivered' | 'Denied' | 'Derived' | 'NonExistent' | 'Withdrawn';
257
+ export declare const AccessRequestResolution: {
258
+ Delivered: "Delivered";
259
+ PartiallyDelivered: "PartiallyDelivered";
260
+ Denied: "Denied";
261
+ Derived: "Derived";
262
+ NonExistent: "NonExistent";
263
+ Withdrawn: "Withdrawn";
264
+ };
265
+ export type AccessRequestEventAction = 'Received' | 'Updated' | 'CorrectionRequested' | 'Corrected' | 'Assigned' | 'ThirdPartyNotified' | 'OppositionRegistered' | 'Extended' | 'Resolved' | 'AppealRegistered';
266
+ export declare const AccessRequestEventAction: {
267
+ Received: "Received";
268
+ Updated: "Updated";
269
+ CorrectionRequested: "CorrectionRequested";
270
+ Corrected: "Corrected";
271
+ Assigned: "Assigned";
272
+ ThirdPartyNotified: "ThirdPartyNotified";
273
+ OppositionRegistered: "OppositionRegistered";
274
+ Extended: "Extended";
275
+ Resolved: "Resolved";
276
+ AppealRegistered: "AppealRegistered";
277
+ };
242
278
  export interface DocumentTypeEntity {
243
279
  id: string;
244
280
  name: string;
@@ -321,6 +357,8 @@ export interface DocumentEntity {
321
357
  accesses?: DocumentAccessEntity[];
322
358
  disposition?: DispositionRecordEntity | null;
323
359
  dispositionId?: string | null;
360
+ accessRequestResponses?: AccessRequestEntity[];
361
+ accessRequestDeliveries?: AccessRequestDocumentEntity[];
324
362
  dispatch?: DocumentDispatchEntity | null;
325
363
  docDigitalInbound?: DocDigitalInboundEntity | null;
326
364
  deleted: boolean;
@@ -851,6 +889,62 @@ export interface DispositionRecordEntity {
851
889
  createdByFullName: string;
852
890
  createdAt: string;
853
891
  }
892
+ export interface AccessRequestEntity {
893
+ id: string;
894
+ number: number;
895
+ year: number;
896
+ externalFolio?: string | null;
897
+ channel: AccessRequestChannel;
898
+ receivedAt: string;
899
+ requesterName: string;
900
+ requesterEmail?: string | null;
901
+ requesterAddress?: string | null;
902
+ requestText: string;
903
+ deliveryFormat?: string | null;
904
+ status: AccessRequestStatus;
905
+ correctionRequestedAt?: string | null;
906
+ correctionDueAt?: string | null;
907
+ correctedAt?: string | null;
908
+ dueAt: string;
909
+ extendedAt?: string | null;
910
+ extensionNote?: string | null;
911
+ assigneeEmployeeId?: string | null;
912
+ assigneeFullName?: string | null;
913
+ thirdPartyNotifiedAt?: string | null;
914
+ oppositionDueAt?: string | null;
915
+ thirdPartyOpposed?: boolean | null;
916
+ resolution?: AccessRequestResolution | null;
917
+ resolvedAt?: string | null;
918
+ denialGrounds: string[];
919
+ derivedTo?: string | null;
920
+ resolutionNote?: string | null;
921
+ responseDocument?: DocumentEntity | null;
922
+ responseDocumentId?: string | null;
923
+ appealedAt?: string | null;
924
+ appealNote?: string | null;
925
+ createdByEmployeeId: string;
926
+ createdByFullName: string;
927
+ documents?: AccessRequestDocumentEntity[];
928
+ events?: AccessRequestEventEntity[];
929
+ createdAt: string;
930
+ updatedAt: string;
931
+ }
932
+ export interface AccessRequestDocumentEntity {
933
+ accessRequest?: AccessRequestEntity;
934
+ accessRequestId: string;
935
+ document?: DocumentEntity;
936
+ documentId: string;
937
+ }
938
+ export interface AccessRequestEventEntity {
939
+ id: string;
940
+ action: AccessRequestEventAction;
941
+ note?: string | null;
942
+ employeeId?: string | null;
943
+ employeeFullName: string;
944
+ accessRequest?: AccessRequestEntity;
945
+ accessRequestId: string;
946
+ createdAt: string;
947
+ }
854
948
  type JsonValue = string | number | boolean | {
855
949
  [key in string]?: JsonValue;
856
950
  } | 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.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;
4
+ exports.AccessRequestEventAction = exports.AccessRequestResolution = exports.AccessRequestStatus = exports.AccessRequestChannel = 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',
@@ -211,3 +211,35 @@ exports.DispositionKind = {
211
211
  Transfer: 'Transfer',
212
212
  Elimination: 'Elimination',
213
213
  };
214
+ exports.AccessRequestChannel = {
215
+ Portal: 'Portal',
216
+ Email: 'Email',
217
+ InPerson: 'InPerson',
218
+ Letter: 'Letter',
219
+ };
220
+ exports.AccessRequestStatus = {
221
+ Received: 'Received',
222
+ InCorrection: 'InCorrection',
223
+ InProgress: 'InProgress',
224
+ Resolved: 'Resolved',
225
+ };
226
+ exports.AccessRequestResolution = {
227
+ Delivered: 'Delivered',
228
+ PartiallyDelivered: 'PartiallyDelivered',
229
+ Denied: 'Denied',
230
+ Derived: 'Derived',
231
+ NonExistent: 'NonExistent',
232
+ Withdrawn: 'Withdrawn',
233
+ };
234
+ exports.AccessRequestEventAction = {
235
+ Received: 'Received',
236
+ Updated: 'Updated',
237
+ CorrectionRequested: 'CorrectionRequested',
238
+ Corrected: 'Corrected',
239
+ Assigned: 'Assigned',
240
+ ThirdPartyNotified: 'ThirdPartyNotified',
241
+ OppositionRegistered: 'OppositionRegistered',
242
+ Extended: 'Extended',
243
+ Resolved: 'Resolved',
244
+ AppealRegistered: 'AppealRegistered',
245
+ };
@@ -0,0 +1,109 @@
1
+ import { type AccessRequestChannel, type AccessRequestResolution } from '../base/entities';
2
+ import { type AccessRequestDetailEntity, type AccessRequestListItemEntity, type AccessRequestSummaryEntity } from '../entities';
3
+ import { type RpcPage } from './contract';
4
+ /** Patrones NATS de `accessRequest`: solicitudes de acceso a la información pública (Ley 20.285). */
5
+ export declare const AccessRequestPatterns: {
6
+ readonly getAll: "gestorDocumental.accessRequest.getAll";
7
+ readonly getById: "gestorDocumental.accessRequest.getById";
8
+ readonly getSummary: "gestorDocumental.accessRequest.getSummary";
9
+ readonly create: "gestorDocumental.accessRequest.create";
10
+ readonly update: "gestorDocumental.accessRequest.update";
11
+ readonly act: "gestorDocumental.accessRequest.act";
12
+ };
13
+ export interface AccessRequestWritePayload {
14
+ externalFolio?: string | null;
15
+ channel: AccessRequestChannel;
16
+ /** Fecha y hora de ingreso (ISO): desde ahí corren los 20 días hábiles. */
17
+ receivedAt: string;
18
+ requesterName: string;
19
+ requesterEmail?: string | null;
20
+ requesterAddress?: string | null;
21
+ requestText: string;
22
+ deliveryFormat?: string | null;
23
+ }
24
+ /** Lo que se hace con una solicitud, un paso a la vez. */
25
+ export type AccessRequestAction = {
26
+ type: 'requestCorrection';
27
+ note: string;
28
+ } | {
29
+ type: 'registerCorrection';
30
+ correctedAt?: string | null;
31
+ note?: string | null;
32
+ } | {
33
+ type: 'assign';
34
+ employeeId: string;
35
+ fullName: string;
36
+ note?: string | null;
37
+ } | {
38
+ type: 'notifyThirdParty';
39
+ note: string;
40
+ } | {
41
+ type: 'registerOpposition';
42
+ opposed: boolean;
43
+ note?: string | null;
44
+ } | {
45
+ type: 'extend';
46
+ note: string;
47
+ } | {
48
+ type: 'resolve';
49
+ resolution: AccessRequestResolution;
50
+ grounds?: string[];
51
+ derivedTo?: string | null;
52
+ note?: string | null;
53
+ responseDocumentId?: string | null;
54
+ documentIds?: string[];
55
+ } | {
56
+ type: 'registerAppeal';
57
+ appealedAt?: string | null;
58
+ note: string;
59
+ };
60
+ export interface AccessRequestActor {
61
+ employeeId: string;
62
+ fullName: string;
63
+ }
64
+ export interface AccessRequestContract {
65
+ [AccessRequestPatterns.getAll]: {
66
+ payload: {
67
+ status?: 'open' | 'resolved' | 'all';
68
+ year?: number | null;
69
+ search?: string;
70
+ page?: number;
71
+ limit?: number;
72
+ };
73
+ response: RpcPage<AccessRequestListItemEntity[]>;
74
+ };
75
+ [AccessRequestPatterns.getById]: {
76
+ payload: {
77
+ id: string;
78
+ };
79
+ response: AccessRequestDetailEntity;
80
+ };
81
+ [AccessRequestPatterns.getSummary]: {
82
+ payload: {
83
+ year: number;
84
+ };
85
+ response: AccessRequestSummaryEntity;
86
+ };
87
+ [AccessRequestPatterns.create]: {
88
+ payload: AccessRequestWritePayload & {
89
+ actor: AccessRequestActor;
90
+ };
91
+ response: AccessRequestDetailEntity;
92
+ };
93
+ /** Corrige los datos mientras no está resuelta. */
94
+ [AccessRequestPatterns.update]: {
95
+ payload: AccessRequestWritePayload & {
96
+ id: string;
97
+ actor: AccessRequestActor;
98
+ };
99
+ response: AccessRequestDetailEntity;
100
+ };
101
+ [AccessRequestPatterns.act]: {
102
+ payload: {
103
+ id: string;
104
+ action: AccessRequestAction;
105
+ actor: AccessRequestActor;
106
+ };
107
+ response: AccessRequestDetailEntity;
108
+ };
109
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccessRequestPatterns = void 0;
4
+ /** Patrones NATS de `accessRequest`: solicitudes de acceso a la información pública (Ley 20.285). */
5
+ exports.AccessRequestPatterns = {
6
+ getAll: 'gestorDocumental.accessRequest.getAll',
7
+ getById: 'gestorDocumental.accessRequest.getById',
8
+ getSummary: 'gestorDocumental.accessRequest.getSummary',
9
+ create: 'gestorDocumental.accessRequest.create',
10
+ update: 'gestorDocumental.accessRequest.update',
11
+ act: 'gestorDocumental.accessRequest.act',
12
+ };
@@ -10,6 +10,7 @@ import { type AuditContract } from './audit.contract';
10
10
  import { type SignatureCheckContract } from './signatureCheck.contract';
11
11
  import { type RepositoryExportContract } from './repositoryExport.contract';
12
12
  import { type RetentionContract } from './retention.contract';
13
+ import { type AccessRequestContract } from './accessRequest.contract';
13
14
  import { type ScanContract } from './scan.contract';
14
15
  import { type PartsOfficeContract } from './partsOffice.contract';
15
16
  import { type ProcedureContract } from './procedure.contract';
@@ -35,6 +36,7 @@ export * from './audit.contract';
35
36
  export * from './signatureCheck.contract';
36
37
  export * from './repositoryExport.contract';
37
38
  export * from './retention.contract';
39
+ export * from './accessRequest.contract';
38
40
  /** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
39
41
  export declare const GestorDocumentalPatterns: {
40
42
  readonly documentType: {
@@ -207,6 +209,14 @@ export declare const GestorDocumentalPatterns: {
207
209
  readonly getRecords: "gestorDocumental.retention.getRecords";
208
210
  readonly getRecordPdf: "gestorDocumental.retention.getRecordPdf";
209
211
  };
212
+ readonly accessRequest: {
213
+ readonly getAll: "gestorDocumental.accessRequest.getAll";
214
+ readonly getById: "gestorDocumental.accessRequest.getById";
215
+ readonly getSummary: "gestorDocumental.accessRequest.getSummary";
216
+ readonly create: "gestorDocumental.accessRequest.create";
217
+ readonly update: "gestorDocumental.accessRequest.update";
218
+ readonly act: "gestorDocumental.accessRequest.act";
219
+ };
210
220
  };
211
221
  /** Contrato completo de gestor-documental-ms: la unión de los contratos de sus recursos. */
212
- export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & IssuingEntityContract & CaseFileContract & PartsOfficeContract & RegisterBookContract & SignatureBatchContract & WorkFolderContract & ScanContract & ArchivalSeriesContract & TextSnippetContract & HolidayContract & IndicatorsContract & AuditContract & SignatureCheckContract & RepositoryExportContract & RetentionContract;
222
+ export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & IssuingEntityContract & CaseFileContract & PartsOfficeContract & RegisterBookContract & SignatureBatchContract & WorkFolderContract & ScanContract & ArchivalSeriesContract & TextSnippetContract & HolidayContract & IndicatorsContract & AuditContract & SignatureCheckContract & RepositoryExportContract & RetentionContract & AccessRequestContract;
@@ -27,6 +27,7 @@ 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
29
  const retention_contract_1 = require("./retention.contract");
30
+ const accessRequest_contract_1 = require("./accessRequest.contract");
30
31
  const scan_contract_1 = require("./scan.contract");
31
32
  const partsOffice_contract_1 = require("./partsOffice.contract");
32
33
  const procedure_contract_1 = require("./procedure.contract");
@@ -52,6 +53,7 @@ __exportStar(require("./audit.contract"), exports);
52
53
  __exportStar(require("./signatureCheck.contract"), exports);
53
54
  __exportStar(require("./repositoryExport.contract"), exports);
54
55
  __exportStar(require("./retention.contract"), exports);
56
+ __exportStar(require("./accessRequest.contract"), exports);
55
57
  /** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
56
58
  exports.GestorDocumentalPatterns = {
57
59
  documentType: documentType_contract_1.DocumentTypePatterns,
@@ -72,4 +74,5 @@ exports.GestorDocumentalPatterns = {
72
74
  signatureCheck: signatureCheck_contract_1.SignatureCheckPatterns,
73
75
  repositoryExport: repositoryExport_contract_1.RepositoryExportPatterns,
74
76
  retention: retention_contract_1.RetentionPatterns,
77
+ accessRequest: accessRequest_contract_1.AccessRequestPatterns,
75
78
  };
@@ -0,0 +1,73 @@
1
+ import { type AccessRequestChannel, type AccessRequestEventAction, type AccessRequestResolution, type AccessRequestStatus } from '../../base/entities';
2
+ /** Semáforo del plazo de respuesta: a tiempo, por vencer (2 días hábiles o menos) o vencido. */
3
+ export type AccessRequestDueStatus = 'OnTime' | 'DueSoon' | 'Overdue';
4
+ export interface AccessRequestListItemEntity {
5
+ id: string;
6
+ /** «N° 15/2026». */
7
+ label: string;
8
+ externalFolio: string | null;
9
+ channel: AccessRequestChannel;
10
+ requesterName: string;
11
+ requestText: string;
12
+ receivedAt: string;
13
+ dueAt: string;
14
+ status: AccessRequestStatus;
15
+ resolution: AccessRequestResolution | null;
16
+ assigneeFullName: string | null;
17
+ /** Solo mientras está abierta. */
18
+ dueStatus: AccessRequestDueStatus | null;
19
+ businessDaysLeft: number | null;
20
+ /** Ya resuelta: si se respondió dentro del plazo. */
21
+ resolvedOnTime: boolean | null;
22
+ }
23
+ export interface AccessRequestDocumentLinkEntity {
24
+ id: string;
25
+ folio: string | null;
26
+ subject: string;
27
+ }
28
+ export interface AccessRequestDetailEntity extends AccessRequestListItemEntity {
29
+ year: number;
30
+ number: number;
31
+ requesterEmail: string | null;
32
+ requesterAddress: string | null;
33
+ deliveryFormat: string | null;
34
+ correctionRequestedAt: string | null;
35
+ correctionDueAt: string | null;
36
+ correctedAt: string | null;
37
+ extendedAt: string | null;
38
+ extensionNote: string | null;
39
+ assigneeEmployeeId: string | null;
40
+ thirdPartyNotifiedAt: string | null;
41
+ oppositionDueAt: string | null;
42
+ thirdPartyOpposed: boolean | null;
43
+ resolvedAt: string | null;
44
+ denialGrounds: string[];
45
+ derivedTo: string | null;
46
+ resolutionNote: string | null;
47
+ responseDocument: AccessRequestDocumentLinkEntity | null;
48
+ documents: AccessRequestDocumentLinkEntity[];
49
+ appealedAt: string | null;
50
+ appealNote: string | null;
51
+ createdByFullName: string;
52
+ /** Se puede prorrogar: abierta, sin prórroga y antes de vencer. */
53
+ canExtend: boolean;
54
+ events: {
55
+ action: AccessRequestEventAction;
56
+ note: string | null;
57
+ employeeFullName: string;
58
+ createdAt: string;
59
+ }[];
60
+ }
61
+ export interface AccessRequestSummaryEntity {
62
+ year: number;
63
+ total: number;
64
+ open: number;
65
+ overdue: number;
66
+ dueSoon: number;
67
+ resolved: Record<AccessRequestResolution, number>;
68
+ /** Respondidas dentro del plazo sobre las respondidas, en %. */
69
+ onTimeRate: number | null;
70
+ /** Días hábiles promedio entre el ingreso (o la subsanación) y la respuesta. */
71
+ averageBusinessDays: number | null;
72
+ appealed: number;
73
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from './accessRequest.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("./accessRequest.entity"), exports);
@@ -16,3 +16,4 @@ export * from './audit';
16
16
  export * from './signatureCheck';
17
17
  export * from './repositoryExport';
18
18
  export * from './retention';
19
+ export * from './accessRequest';
@@ -32,3 +32,4 @@ __exportStar(require("./audit"), exports);
32
32
  __exportStar(require("./signatureCheck"), exports);
33
33
  __exportStar(require("./repositoryExport"), exports);
34
34
  __exportStar(require("./retention"), exports);
35
+ __exportStar(require("./accessRequest"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muni-sanfer/types-gestor-documental",
3
- "version": "0.0.1-beta.24",
3
+ "version": "0.0.1-beta.25",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -363,6 +363,61 @@ export const DispositionKind = {
363
363
  Elimination: 'Elimination',
364
364
  } satisfies Record<string, DispositionKind>;
365
365
 
366
+ export type AccessRequestChannel = 'Portal' | 'Email' | 'InPerson' | 'Letter';
367
+
368
+ export const AccessRequestChannel = {
369
+ Portal: 'Portal',
370
+ Email: 'Email',
371
+ InPerson: 'InPerson',
372
+ Letter: 'Letter',
373
+ } satisfies Record<string, AccessRequestChannel>;
374
+
375
+ export type AccessRequestStatus = 'Received' | 'InCorrection' | 'InProgress' | 'Resolved';
376
+
377
+ export const AccessRequestStatus = {
378
+ Received: 'Received',
379
+ InCorrection: 'InCorrection',
380
+ InProgress: 'InProgress',
381
+ Resolved: 'Resolved',
382
+ } satisfies Record<string, AccessRequestStatus>;
383
+
384
+ export type AccessRequestResolution =
385
+ 'Delivered' | 'PartiallyDelivered' | 'Denied' | 'Derived' | 'NonExistent' | 'Withdrawn';
386
+
387
+ export const AccessRequestResolution = {
388
+ Delivered: 'Delivered',
389
+ PartiallyDelivered: 'PartiallyDelivered',
390
+ Denied: 'Denied',
391
+ Derived: 'Derived',
392
+ NonExistent: 'NonExistent',
393
+ Withdrawn: 'Withdrawn',
394
+ } satisfies Record<string, AccessRequestResolution>;
395
+
396
+ export type AccessRequestEventAction =
397
+ | 'Received'
398
+ | 'Updated'
399
+ | 'CorrectionRequested'
400
+ | 'Corrected'
401
+ | 'Assigned'
402
+ | 'ThirdPartyNotified'
403
+ | 'OppositionRegistered'
404
+ | 'Extended'
405
+ | 'Resolved'
406
+ | 'AppealRegistered';
407
+
408
+ export const AccessRequestEventAction = {
409
+ Received: 'Received',
410
+ Updated: 'Updated',
411
+ CorrectionRequested: 'CorrectionRequested',
412
+ Corrected: 'Corrected',
413
+ Assigned: 'Assigned',
414
+ ThirdPartyNotified: 'ThirdPartyNotified',
415
+ OppositionRegistered: 'OppositionRegistered',
416
+ Extended: 'Extended',
417
+ Resolved: 'Resolved',
418
+ AppealRegistered: 'AppealRegistered',
419
+ } satisfies Record<string, AccessRequestEventAction>;
420
+
366
421
  export interface DocumentTypeEntity {
367
422
  id: string;
368
423
  name: string;
@@ -446,6 +501,8 @@ export interface DocumentEntity {
446
501
  accesses?: DocumentAccessEntity[];
447
502
  disposition?: DispositionRecordEntity | null;
448
503
  dispositionId?: string | null;
504
+ accessRequestResponses?: AccessRequestEntity[];
505
+ accessRequestDeliveries?: AccessRequestDocumentEntity[];
449
506
  dispatch?: DocumentDispatchEntity | null;
450
507
  docDigitalInbound?: DocDigitalInboundEntity | null;
451
508
  deleted: boolean;
@@ -1014,4 +1071,63 @@ export interface DispositionRecordEntity {
1014
1071
  createdAt: string;
1015
1072
  }
1016
1073
 
1074
+ export interface AccessRequestEntity {
1075
+ id: string;
1076
+ number: number;
1077
+ year: number;
1078
+ externalFolio?: string | null;
1079
+ channel: AccessRequestChannel;
1080
+ receivedAt: string;
1081
+ requesterName: string;
1082
+ requesterEmail?: string | null;
1083
+ requesterAddress?: string | null;
1084
+ requestText: string;
1085
+ deliveryFormat?: string | null;
1086
+ status: AccessRequestStatus;
1087
+ correctionRequestedAt?: string | null;
1088
+ correctionDueAt?: string | null;
1089
+ correctedAt?: string | null;
1090
+ dueAt: string;
1091
+ extendedAt?: string | null;
1092
+ extensionNote?: string | null;
1093
+ assigneeEmployeeId?: string | null;
1094
+ assigneeFullName?: string | null;
1095
+ thirdPartyNotifiedAt?: string | null;
1096
+ oppositionDueAt?: string | null;
1097
+ thirdPartyOpposed?: boolean | null;
1098
+ resolution?: AccessRequestResolution | null;
1099
+ resolvedAt?: string | null;
1100
+ denialGrounds: string[];
1101
+ derivedTo?: string | null;
1102
+ resolutionNote?: string | null;
1103
+ responseDocument?: DocumentEntity | null;
1104
+ responseDocumentId?: string | null;
1105
+ appealedAt?: string | null;
1106
+ appealNote?: string | null;
1107
+ createdByEmployeeId: string;
1108
+ createdByFullName: string;
1109
+ documents?: AccessRequestDocumentEntity[];
1110
+ events?: AccessRequestEventEntity[];
1111
+ createdAt: string;
1112
+ updatedAt: string;
1113
+ }
1114
+
1115
+ export interface AccessRequestDocumentEntity {
1116
+ accessRequest?: AccessRequestEntity;
1117
+ accessRequestId: string;
1118
+ document?: DocumentEntity;
1119
+ documentId: string;
1120
+ }
1121
+
1122
+ export interface AccessRequestEventEntity {
1123
+ id: string;
1124
+ action: AccessRequestEventAction;
1125
+ note?: string | null;
1126
+ employeeId?: string | null;
1127
+ employeeFullName: string;
1128
+ accessRequest?: AccessRequestEntity;
1129
+ accessRequestId: string;
1130
+ createdAt: string;
1131
+ }
1132
+
1017
1133
  type JsonValue = string | number | boolean | { [key in string]?: JsonValue } | Array<JsonValue> | null;
@@ -0,0 +1,81 @@
1
+ import { type AccessRequestChannel, type AccessRequestResolution } from '../base/entities';
2
+ import {
3
+ type AccessRequestDetailEntity,
4
+ type AccessRequestListItemEntity,
5
+ type AccessRequestSummaryEntity,
6
+ } from '../entities';
7
+ import { type RpcPage } from './contract';
8
+
9
+ /** Patrones NATS de `accessRequest`: solicitudes de acceso a la información pública (Ley 20.285). */
10
+ export const AccessRequestPatterns = {
11
+ getAll: 'gestorDocumental.accessRequest.getAll',
12
+ getById: 'gestorDocumental.accessRequest.getById',
13
+ getSummary: 'gestorDocumental.accessRequest.getSummary',
14
+ create: 'gestorDocumental.accessRequest.create',
15
+ update: 'gestorDocumental.accessRequest.update',
16
+ act: 'gestorDocumental.accessRequest.act',
17
+ } as const;
18
+
19
+ export interface AccessRequestWritePayload {
20
+ externalFolio?: string | null;
21
+ channel: AccessRequestChannel;
22
+ /** Fecha y hora de ingreso (ISO): desde ahí corren los 20 días hábiles. */
23
+ receivedAt: string;
24
+ requesterName: string;
25
+ requesterEmail?: string | null;
26
+ requesterAddress?: string | null;
27
+ requestText: string;
28
+ deliveryFormat?: string | null;
29
+ }
30
+
31
+ /** Lo que se hace con una solicitud, un paso a la vez. */
32
+ export type AccessRequestAction =
33
+ | { type: 'requestCorrection'; note: string }
34
+ | { type: 'registerCorrection'; correctedAt?: string | null; note?: string | null }
35
+ | { type: 'assign'; employeeId: string; fullName: string; note?: string | null }
36
+ | { type: 'notifyThirdParty'; note: string }
37
+ | { type: 'registerOpposition'; opposed: boolean; note?: string | null }
38
+ | { type: 'extend'; note: string }
39
+ | {
40
+ type: 'resolve';
41
+ resolution: AccessRequestResolution;
42
+ grounds?: string[];
43
+ derivedTo?: string | null;
44
+ note?: string | null;
45
+ responseDocumentId?: string | null;
46
+ documentIds?: string[];
47
+ }
48
+ | { type: 'registerAppeal'; appealedAt?: string | null; note: string };
49
+
50
+ export interface AccessRequestActor {
51
+ employeeId: string;
52
+ fullName: string;
53
+ }
54
+
55
+ export interface AccessRequestContract {
56
+ [AccessRequestPatterns.getAll]: {
57
+ payload: {
58
+ status?: 'open' | 'resolved' | 'all';
59
+ year?: number | null;
60
+ search?: string;
61
+ page?: number;
62
+ limit?: number;
63
+ };
64
+ response: RpcPage<AccessRequestListItemEntity[]>;
65
+ };
66
+ [AccessRequestPatterns.getById]: { payload: { id: string }; response: AccessRequestDetailEntity };
67
+ [AccessRequestPatterns.getSummary]: { payload: { year: number }; response: AccessRequestSummaryEntity };
68
+ [AccessRequestPatterns.create]: {
69
+ payload: AccessRequestWritePayload & { actor: AccessRequestActor };
70
+ response: AccessRequestDetailEntity;
71
+ };
72
+ /** Corrige los datos mientras no está resuelta. */
73
+ [AccessRequestPatterns.update]: {
74
+ payload: AccessRequestWritePayload & { id: string; actor: AccessRequestActor };
75
+ response: AccessRequestDetailEntity;
76
+ };
77
+ [AccessRequestPatterns.act]: {
78
+ payload: { id: string; action: AccessRequestAction; actor: AccessRequestActor };
79
+ response: AccessRequestDetailEntity;
80
+ };
81
+ }
@@ -10,6 +10,7 @@ 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
12
  import { RetentionPatterns, type RetentionContract } from './retention.contract';
13
+ import { AccessRequestPatterns, type AccessRequestContract } from './accessRequest.contract';
13
14
  import { ScanPatterns, type ScanContract } from './scan.contract';
14
15
  import { PartsOfficePatterns, type PartsOfficeContract } from './partsOffice.contract';
15
16
  import { ProcedurePatterns, type ProcedureContract } from './procedure.contract';
@@ -36,6 +37,7 @@ export * from './audit.contract';
36
37
  export * from './signatureCheck.contract';
37
38
  export * from './repositoryExport.contract';
38
39
  export * from './retention.contract';
40
+ export * from './accessRequest.contract';
39
41
 
40
42
  /** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
41
43
  export const GestorDocumentalPatterns = {
@@ -57,6 +59,7 @@ export const GestorDocumentalPatterns = {
57
59
  signatureCheck: SignatureCheckPatterns,
58
60
  repositoryExport: RepositoryExportPatterns,
59
61
  retention: RetentionPatterns,
62
+ accessRequest: AccessRequestPatterns,
60
63
  } as const;
61
64
 
62
65
  /** Contrato completo de gestor-documental-ms: la unión de los contratos de sus recursos. */
@@ -77,4 +80,5 @@ export type GestorDocumentalContract = DocumentTypeContract &
77
80
  AuditContract &
78
81
  SignatureCheckContract &
79
82
  RepositoryExportContract &
80
- RetentionContract;
83
+ RetentionContract &
84
+ AccessRequestContract;
@@ -0,0 +1,78 @@
1
+ import {
2
+ type AccessRequestChannel,
3
+ type AccessRequestEventAction,
4
+ type AccessRequestResolution,
5
+ type AccessRequestStatus,
6
+ } from '../../base/entities';
7
+
8
+ /** Semáforo del plazo de respuesta: a tiempo, por vencer (2 días hábiles o menos) o vencido. */
9
+ export type AccessRequestDueStatus = 'OnTime' | 'DueSoon' | 'Overdue';
10
+
11
+ export interface AccessRequestListItemEntity {
12
+ id: string;
13
+ /** «N° 15/2026». */
14
+ label: string;
15
+ externalFolio: string | null;
16
+ channel: AccessRequestChannel;
17
+ requesterName: string;
18
+ requestText: string;
19
+ receivedAt: string;
20
+ dueAt: string;
21
+ status: AccessRequestStatus;
22
+ resolution: AccessRequestResolution | null;
23
+ assigneeFullName: string | null;
24
+ /** Solo mientras está abierta. */
25
+ dueStatus: AccessRequestDueStatus | null;
26
+ businessDaysLeft: number | null;
27
+ /** Ya resuelta: si se respondió dentro del plazo. */
28
+ resolvedOnTime: boolean | null;
29
+ }
30
+
31
+ export interface AccessRequestDocumentLinkEntity {
32
+ id: string;
33
+ folio: string | null;
34
+ subject: string;
35
+ }
36
+
37
+ export interface AccessRequestDetailEntity extends AccessRequestListItemEntity {
38
+ year: number;
39
+ number: number;
40
+ requesterEmail: string | null;
41
+ requesterAddress: string | null;
42
+ deliveryFormat: string | null;
43
+ correctionRequestedAt: string | null;
44
+ correctionDueAt: string | null;
45
+ correctedAt: string | null;
46
+ extendedAt: string | null;
47
+ extensionNote: string | null;
48
+ assigneeEmployeeId: string | null;
49
+ thirdPartyNotifiedAt: string | null;
50
+ oppositionDueAt: string | null;
51
+ thirdPartyOpposed: boolean | null;
52
+ resolvedAt: string | null;
53
+ denialGrounds: string[];
54
+ derivedTo: string | null;
55
+ resolutionNote: string | null;
56
+ responseDocument: AccessRequestDocumentLinkEntity | null;
57
+ documents: AccessRequestDocumentLinkEntity[];
58
+ appealedAt: string | null;
59
+ appealNote: string | null;
60
+ createdByFullName: string;
61
+ /** Se puede prorrogar: abierta, sin prórroga y antes de vencer. */
62
+ canExtend: boolean;
63
+ events: { action: AccessRequestEventAction; note: string | null; employeeFullName: string; createdAt: string }[];
64
+ }
65
+
66
+ export interface AccessRequestSummaryEntity {
67
+ year: number;
68
+ total: number;
69
+ open: number;
70
+ overdue: number;
71
+ dueSoon: number;
72
+ resolved: Record<AccessRequestResolution, number>;
73
+ /** Respondidas dentro del plazo sobre las respondidas, en %. */
74
+ onTimeRate: number | null;
75
+ /** Días hábiles promedio entre el ingreso (o la subsanación) y la respuesta. */
76
+ averageBusinessDays: number | null;
77
+ appealed: number;
78
+ }
@@ -0,0 +1 @@
1
+ export * from './accessRequest.entity';
@@ -16,3 +16,4 @@ export * from './audit';
16
16
  export * from './signatureCheck';
17
17
  export * from './repositoryExport';
18
18
  export * from './retention';
19
+ export * from './accessRequest';