@muni-sanfer/types-gestor-documental 0.0.1-beta.18 → 0.0.1-beta.19

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.
@@ -184,6 +184,21 @@ export declare const WorkFolderItemKind: {
184
184
  Document: "Document";
185
185
  File: "File";
186
186
  };
187
+ export type ServiceOutageKind = 'Unplanned' | 'Planned';
188
+ export declare const ServiceOutageKind: {
189
+ Unplanned: "Unplanned";
190
+ Planned: "Planned";
191
+ };
192
+ export type QualityMetricKey = 'Effectiveness' | 'Efficiency' | 'Availability' | 'ResponseTime' | 'Accessibility' | 'FunctionalCompleteness' | 'Interoperability';
193
+ export declare const QualityMetricKey: {
194
+ Effectiveness: "Effectiveness";
195
+ Efficiency: "Efficiency";
196
+ Availability: "Availability";
197
+ ResponseTime: "ResponseTime";
198
+ Accessibility: "Accessibility";
199
+ FunctionalCompleteness: "FunctionalCompleteness";
200
+ Interoperability: "Interoperability";
201
+ };
187
202
  export interface DocumentTypeEntity {
188
203
  id: string;
189
204
  name: string;
@@ -713,6 +728,43 @@ export interface WorkFolderItemEntity {
713
728
  folderId: string;
714
729
  createdAt: string;
715
730
  }
731
+ export interface ServiceOutageEntity {
732
+ id: string;
733
+ kind: ServiceOutageKind;
734
+ startedAt: string;
735
+ endedAt?: string | null;
736
+ cause: string;
737
+ affectedServices?: string | null;
738
+ createdByEmployeeId: string;
739
+ createdByFullName: string;
740
+ updatedByFullName?: string | null;
741
+ deleted: boolean;
742
+ createdAt: string;
743
+ updatedAt: string;
744
+ }
745
+ export interface QualityMetricSettingEntity {
746
+ key: QualityMetricKey;
747
+ threshold: number;
748
+ declaredValue?: number | null;
749
+ declaredNote?: string | null;
750
+ declaredAt?: string | null;
751
+ declaredByFullName?: string | null;
752
+ updatedAt: string;
753
+ }
754
+ export interface ServiceTimingEntity {
755
+ hour: string;
756
+ count: number;
757
+ errorCount: number;
758
+ totalMs: number;
759
+ maxMs: number;
760
+ under100: number;
761
+ under250: number;
762
+ under500: number;
763
+ under1000: number;
764
+ under2000: number;
765
+ under5000: number;
766
+ over5000: number;
767
+ }
716
768
  type JsonValue = string | number | boolean | {
717
769
  [key in string]?: JsonValue;
718
770
  } | 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.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.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',
@@ -163,3 +163,16 @@ exports.WorkFolderItemKind = {
163
163
  Document: 'Document',
164
164
  File: 'File',
165
165
  };
166
+ exports.ServiceOutageKind = {
167
+ Unplanned: 'Unplanned',
168
+ Planned: 'Planned',
169
+ };
170
+ exports.QualityMetricKey = {
171
+ Effectiveness: 'Effectiveness',
172
+ Efficiency: 'Efficiency',
173
+ Availability: 'Availability',
174
+ ResponseTime: 'ResponseTime',
175
+ Accessibility: 'Accessibility',
176
+ FunctionalCompleteness: 'FunctionalCompleteness',
177
+ Interoperability: 'Interoperability',
178
+ };
@@ -5,6 +5,7 @@ import { type IssuingEntityContract } from './issuingEntity.contract';
5
5
  import { type ArchivalSeriesContract } from './archivalSeries.contract';
6
6
  import { type TextSnippetContract } from './textSnippet.contract';
7
7
  import { type HolidayContract } from './holiday.contract';
8
+ import { type IndicatorsContract } from './indicators.contract';
8
9
  import { type ScanContract } from './scan.contract';
9
10
  import { type PartsOfficeContract } from './partsOffice.contract';
10
11
  import { type ProcedureContract } from './procedure.contract';
@@ -25,6 +26,7 @@ export * from './scan.contract';
25
26
  export * from './archivalSeries.contract';
26
27
  export * from './textSnippet.contract';
27
28
  export * from './holiday.contract';
29
+ export * from './indicators.contract';
28
30
  /** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
29
31
  export declare const GestorDocumentalPatterns: {
30
32
  readonly documentType: {
@@ -165,6 +167,17 @@ export declare const GestorDocumentalPatterns: {
165
167
  readonly create: "gestorDocumental.holiday.create";
166
168
  readonly remove: "gestorDocumental.holiday.remove";
167
169
  };
170
+ readonly indicators: {
171
+ readonly getManagement: "gestorDocumental.indicators.getManagement";
172
+ readonly getQuality: "gestorDocumental.indicators.getQuality";
173
+ readonly export: "gestorDocumental.indicators.export";
174
+ readonly updateQualityMetric: "gestorDocumental.indicators.updateQualityMetric";
175
+ readonly getOutages: "gestorDocumental.indicators.getOutages";
176
+ readonly createOutage: "gestorDocumental.indicators.createOutage";
177
+ readonly updateOutage: "gestorDocumental.indicators.updateOutage";
178
+ readonly removeOutage: "gestorDocumental.indicators.removeOutage";
179
+ readonly getOutageCertificate: "gestorDocumental.indicators.getOutageCertificate";
180
+ };
168
181
  };
169
182
  /** Contrato completo de gestor-documental-ms: la unión de los contratos de sus recursos. */
170
- export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & IssuingEntityContract & CaseFileContract & PartsOfficeContract & RegisterBookContract & SignatureBatchContract & WorkFolderContract & ScanContract & ArchivalSeriesContract & TextSnippetContract & HolidayContract;
183
+ export type GestorDocumentalContract = DocumentTypeContract & DocumentContract & ProcedureContract & IssuingEntityContract & CaseFileContract & PartsOfficeContract & RegisterBookContract & SignatureBatchContract & WorkFolderContract & ScanContract & ArchivalSeriesContract & TextSnippetContract & HolidayContract & IndicatorsContract;
@@ -22,6 +22,7 @@ const issuingEntity_contract_1 = require("./issuingEntity.contract");
22
22
  const archivalSeries_contract_1 = require("./archivalSeries.contract");
23
23
  const textSnippet_contract_1 = require("./textSnippet.contract");
24
24
  const holiday_contract_1 = require("./holiday.contract");
25
+ const indicators_contract_1 = require("./indicators.contract");
25
26
  const scan_contract_1 = require("./scan.contract");
26
27
  const partsOffice_contract_1 = require("./partsOffice.contract");
27
28
  const procedure_contract_1 = require("./procedure.contract");
@@ -42,6 +43,7 @@ __exportStar(require("./scan.contract"), exports);
42
43
  __exportStar(require("./archivalSeries.contract"), exports);
43
44
  __exportStar(require("./textSnippet.contract"), exports);
44
45
  __exportStar(require("./holiday.contract"), exports);
46
+ __exportStar(require("./indicators.contract"), exports);
45
47
  /** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
46
48
  exports.GestorDocumentalPatterns = {
47
49
  documentType: documentType_contract_1.DocumentTypePatterns,
@@ -57,4 +59,5 @@ exports.GestorDocumentalPatterns = {
57
59
  archivalSeries: archivalSeries_contract_1.ArchivalSeriesPatterns,
58
60
  textSnippet: textSnippet_contract_1.TextSnippetPatterns,
59
61
  holiday: holiday_contract_1.HolidayPatterns,
62
+ indicators: indicators_contract_1.IndicatorsPatterns,
60
63
  };
@@ -0,0 +1,103 @@
1
+ import { type IndicatorsFileEntity, type ManagementIndicatorsEntity, type QualityMetricSettingResponseEntity, type QualityReportEntity, type ServiceOutageRemoveResponseEntity, type ServiceOutageResponseEntity } from '../entities';
2
+ import { type QualityMetricKey, type ServiceOutageKind } from '../base/entities';
3
+ /** Patrones NATS de `indicators`: indicadores de gestión y Plan de Mejora Continua (DS 11/2023). */
4
+ export declare const IndicatorsPatterns: {
5
+ readonly getManagement: "gestorDocumental.indicators.getManagement";
6
+ readonly getQuality: "gestorDocumental.indicators.getQuality";
7
+ readonly export: "gestorDocumental.indicators.export";
8
+ readonly updateQualityMetric: "gestorDocumental.indicators.updateQualityMetric";
9
+ readonly getOutages: "gestorDocumental.indicators.getOutages";
10
+ readonly createOutage: "gestorDocumental.indicators.createOutage";
11
+ readonly updateOutage: "gestorDocumental.indicators.updateOutage";
12
+ readonly removeOutage: "gestorDocumental.indicators.removeOutage";
13
+ readonly getOutageCertificate: "gestorDocumental.indicators.getOutageCertificate";
14
+ };
15
+ /** Período: días de Chile «AAAA-MM-DD», hasta dos años. */
16
+ export interface IndicatorsPeriodQuery {
17
+ from: string;
18
+ to: string;
19
+ }
20
+ export interface ManagementIndicatorsQuery extends IndicatorsPeriodQuery {
21
+ documentTypeId?: string | null;
22
+ directorateCode?: number | null;
23
+ }
24
+ export interface ServiceOutageInput {
25
+ kind: ServiceOutageKind;
26
+ startedAt: string;
27
+ endedAt?: string | null;
28
+ cause: string;
29
+ affectedServices?: string | null;
30
+ }
31
+ export interface IndicatorsContract {
32
+ [IndicatorsPatterns.getManagement]: {
33
+ payload: ManagementIndicatorsQuery;
34
+ response: ManagementIndicatorsEntity;
35
+ };
36
+ [IndicatorsPatterns.getQuality]: {
37
+ payload: IndicatorsPeriodQuery;
38
+ response: QualityReportEntity;
39
+ };
40
+ /**
41
+ * Indicadores y Plan de Mejora en una planilla Excel. `generatedBy`: quién la descarga. `unitNames`: nombre de cada
42
+ * unidad (`c:<código de dirección>` o `d:<id de departamento>`), que el ms no conoce.
43
+ */
44
+ [IndicatorsPatterns.export]: {
45
+ payload: ManagementIndicatorsQuery & {
46
+ generatedBy: string;
47
+ unitNames?: Record<string, string>;
48
+ };
49
+ response: IndicatorsFileEntity;
50
+ };
51
+ /** Umbral y, en las métricas declaradas, su valor y respaldo. */
52
+ [IndicatorsPatterns.updateQualityMetric]: {
53
+ payload: {
54
+ key: QualityMetricKey;
55
+ threshold: number;
56
+ declaredValue?: number | null;
57
+ declaredNote?: string | null;
58
+ actor: {
59
+ fullName: string;
60
+ };
61
+ };
62
+ response: QualityMetricSettingResponseEntity;
63
+ };
64
+ [IndicatorsPatterns.getOutages]: {
65
+ payload: {
66
+ year: number;
67
+ };
68
+ response: ServiceOutageResponseEntity[];
69
+ };
70
+ [IndicatorsPatterns.createOutage]: {
71
+ payload: ServiceOutageInput & {
72
+ actor: {
73
+ employeeId: string;
74
+ fullName: string;
75
+ };
76
+ };
77
+ response: ServiceOutageResponseEntity;
78
+ };
79
+ [IndicatorsPatterns.updateOutage]: {
80
+ payload: ServiceOutageInput & {
81
+ id: string;
82
+ actor: {
83
+ employeeId: string;
84
+ fullName: string;
85
+ };
86
+ };
87
+ response: ServiceOutageResponseEntity;
88
+ };
89
+ [IndicatorsPatterns.removeOutage]: {
90
+ payload: {
91
+ id: string;
92
+ };
93
+ response: ServiceOutageRemoveResponseEntity;
94
+ };
95
+ /** Certificado de indisponibilidad (DS 10/2023) en PDF, de una caída ya terminada. */
96
+ [IndicatorsPatterns.getOutageCertificate]: {
97
+ payload: {
98
+ id: string;
99
+ generatedBy: string;
100
+ };
101
+ response: IndicatorsFileEntity;
102
+ };
103
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IndicatorsPatterns = void 0;
4
+ /** Patrones NATS de `indicators`: indicadores de gestión y Plan de Mejora Continua (DS 11/2023). */
5
+ exports.IndicatorsPatterns = {
6
+ getManagement: 'gestorDocumental.indicators.getManagement',
7
+ getQuality: 'gestorDocumental.indicators.getQuality',
8
+ export: 'gestorDocumental.indicators.export',
9
+ updateQualityMetric: 'gestorDocumental.indicators.updateQualityMetric',
10
+ getOutages: 'gestorDocumental.indicators.getOutages',
11
+ createOutage: 'gestorDocumental.indicators.createOutage',
12
+ updateOutage: 'gestorDocumental.indicators.updateOutage',
13
+ removeOutage: 'gestorDocumental.indicators.removeOutage',
14
+ getOutageCertificate: 'gestorDocumental.indicators.getOutageCertificate',
15
+ };
@@ -11,3 +11,4 @@ export * from './scan';
11
11
  export * from './archivalSeries';
12
12
  export * from './textSnippet';
13
13
  export * from './holiday';
14
+ export * from './indicators';
@@ -27,3 +27,4 @@ __exportStar(require("./scan"), exports);
27
27
  __exportStar(require("./archivalSeries"), exports);
28
28
  __exportStar(require("./textSnippet"), exports);
29
29
  __exportStar(require("./holiday"), exports);
30
+ __exportStar(require("./indicators"), exports);
@@ -0,0 +1 @@
1
+ export * from './indicators.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("./indicators.entity"), exports);
@@ -0,0 +1,152 @@
1
+ import { type DocumentParticipantRole, type QualityMetricKey, type ServiceOutageKind } from '../../base/entities';
2
+ /** Tiempos de tramitación, desde el primer envío a tramitación hasta la última firma. En días corridos y hábiles. */
3
+ export interface ProcessingTimeEntity {
4
+ count: number;
5
+ averageDays: number | null;
6
+ medianDays: number | null;
7
+ p90Days: number | null;
8
+ averageBusinessDays: number | null;
9
+ }
10
+ export interface IndicatorsByTypeEntity {
11
+ documentTypeId: string;
12
+ name: string;
13
+ submitted: number;
14
+ finished: number;
15
+ rejections: number;
16
+ averageDays: number | null;
17
+ averageBusinessDays: number | null;
18
+ }
19
+ /** Unidad emisora: una dirección (código de caschile) o un departamento; el nombre lo pone el front. */
20
+ export interface IndicatorsByUnitEntity {
21
+ directorateCode: number | null;
22
+ departmentId: string | null;
23
+ submitted: number;
24
+ finished: number;
25
+ averageDays: number | null;
26
+ averageBusinessDays: number | null;
27
+ }
28
+ /** Quién demora más en su turno de visación o firma, y cuánto tiene pendiente hoy. */
29
+ export interface IndicatorsBottleneckEntity {
30
+ employeeId: string;
31
+ fullName: string;
32
+ role: DocumentParticipantRole;
33
+ resolved: number;
34
+ averageDays: number | null;
35
+ pending: number;
36
+ oldestPendingDays: number | null;
37
+ }
38
+ export interface ManagementIndicatorsEntity {
39
+ /** Período consultado, días de Chile «AAAA-MM-DD». */
40
+ from: string;
41
+ to: string;
42
+ generatedAt: string;
43
+ filters: {
44
+ documentTypeId: string | null;
45
+ directorateCode: number | null;
46
+ };
47
+ volume: {
48
+ /** Enviados a tramitación por primera vez en el período. */
49
+ submitted: number;
50
+ finished: number;
51
+ /** Rechazos de visadores y firmantes (un documento puede tener varios). */
52
+ rejections: number;
53
+ annulled: number;
54
+ discarded: number;
55
+ /** En tramitación hoy, sin importar el período. */
56
+ inProcess: number;
57
+ };
58
+ processing: ProcessingTimeEntity;
59
+ byType: IndicatorsByTypeEntity[];
60
+ byUnit: IndicatorsByUnitEntity[];
61
+ /** Por mes de Chile «AAAA-MM». */
62
+ monthly: {
63
+ month: string;
64
+ submitted: number;
65
+ finished: number;
66
+ }[];
67
+ bottlenecks: IndicatorsBottleneckEntity[];
68
+ /** Plazos de lo recibido y derivado que vencían en el período. */
69
+ deadlines: {
70
+ withDeadline: number;
71
+ onTime: number;
72
+ late: number;
73
+ /** Vencidos sin atender. */
74
+ overdue: number;
75
+ /** Sin atender, todavía en plazo. */
76
+ pending: number;
77
+ /** A tiempo sobre los ya resueltos o vencidos, en %. */
78
+ onTimeRate: number | null;
79
+ };
80
+ partsOffice: {
81
+ received: number;
82
+ registered: number;
83
+ returned: number;
84
+ /** Días desde que llegó por DocDigital hasta que Partes lo ingresó. */
85
+ averageIntakeDays: number | null;
86
+ dispatched: number;
87
+ dispatchReturned: number;
88
+ };
89
+ }
90
+ export type QualityMetricUnit = 'Percent' | 'Ratio' | 'Milliseconds';
91
+ export type QualityMetricDirection = 'AtLeast' | 'AtMost';
92
+ /** Una métrica del Plan de Mejora Continua, con su valor en el período y su umbral. */
93
+ export interface QualityMetricEntity {
94
+ key: QualityMetricKey;
95
+ /** Subcaracterística de la ISO/IEC 25010 que mide. */
96
+ subcharacteristic: string;
97
+ model: 'Product' | 'InUse';
98
+ name: string;
99
+ description: string;
100
+ /** La mide el sistema o la declara quien administra la calidad, con su respaldo. */
101
+ source: 'Measured' | 'Declared';
102
+ value: number | null;
103
+ unit: QualityMetricUnit;
104
+ threshold: number;
105
+ direction: QualityMetricDirection;
106
+ /** Cumple el umbral. `null` sin valor. */
107
+ meets: boolean | null;
108
+ /** Con qué se calculó: cantidades del período. */
109
+ detail: string | null;
110
+ declaredNote: string | null;
111
+ declaredAt: string | null;
112
+ declaredByFullName: string | null;
113
+ }
114
+ export interface ServiceOutageResponseEntity {
115
+ id: string;
116
+ kind: ServiceOutageKind;
117
+ startedAt: string;
118
+ endedAt: string | null;
119
+ /** Duración en minutos; si sigue caído, hasta ahora. */
120
+ minutes: number;
121
+ cause: string;
122
+ affectedServices: string | null;
123
+ createdByFullName: string;
124
+ updatedByFullName: string | null;
125
+ createdAt: string;
126
+ }
127
+ export interface QualityReportEntity {
128
+ from: string;
129
+ to: string;
130
+ generatedAt: string;
131
+ metrics: QualityMetricEntity[];
132
+ /** Caídas que tocan el período. */
133
+ outages: ServiceOutageResponseEntity[];
134
+ }
135
+ export interface QualityMetricSettingResponseEntity {
136
+ key: QualityMetricKey;
137
+ threshold: number;
138
+ declaredValue: number | null;
139
+ declaredNote: string | null;
140
+ declaredAt: string | null;
141
+ declaredByFullName: string | null;
142
+ }
143
+ export interface ServiceOutageRemoveResponseEntity {
144
+ id: string;
145
+ ok: boolean;
146
+ }
147
+ /** Un archivo generado (planilla o certificado), en base64. */
148
+ export interface IndicatorsFileEntity {
149
+ fileName: string;
150
+ contentType: string;
151
+ contentBase64: string;
152
+ }
@@ -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.18",
3
+ "version": "0.0.1-beta.19",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -276,6 +276,32 @@ export const WorkFolderItemKind = {
276
276
  File: 'File',
277
277
  } satisfies Record<string, WorkFolderItemKind>;
278
278
 
279
+ export type ServiceOutageKind = 'Unplanned' | 'Planned';
280
+
281
+ export const ServiceOutageKind = {
282
+ Unplanned: 'Unplanned',
283
+ Planned: 'Planned',
284
+ } satisfies Record<string, ServiceOutageKind>;
285
+
286
+ export type QualityMetricKey =
287
+ | 'Effectiveness'
288
+ | 'Efficiency'
289
+ | 'Availability'
290
+ | 'ResponseTime'
291
+ | 'Accessibility'
292
+ | 'FunctionalCompleteness'
293
+ | 'Interoperability';
294
+
295
+ export const QualityMetricKey = {
296
+ Effectiveness: 'Effectiveness',
297
+ Efficiency: 'Efficiency',
298
+ Availability: 'Availability',
299
+ ResponseTime: 'ResponseTime',
300
+ Accessibility: 'Accessibility',
301
+ FunctionalCompleteness: 'FunctionalCompleteness',
302
+ Interoperability: 'Interoperability',
303
+ } satisfies Record<string, QualityMetricKey>;
304
+
279
305
  export interface DocumentTypeEntity {
280
306
  id: string;
281
307
  name: string;
@@ -838,4 +864,44 @@ export interface WorkFolderItemEntity {
838
864
  createdAt: string;
839
865
  }
840
866
 
867
+ export interface ServiceOutageEntity {
868
+ id: string;
869
+ kind: ServiceOutageKind;
870
+ startedAt: string;
871
+ endedAt?: string | null;
872
+ cause: string;
873
+ affectedServices?: string | null;
874
+ createdByEmployeeId: string;
875
+ createdByFullName: string;
876
+ updatedByFullName?: string | null;
877
+ deleted: boolean;
878
+ createdAt: string;
879
+ updatedAt: string;
880
+ }
881
+
882
+ export interface QualityMetricSettingEntity {
883
+ key: QualityMetricKey;
884
+ threshold: number;
885
+ declaredValue?: number | null;
886
+ declaredNote?: string | null;
887
+ declaredAt?: string | null;
888
+ declaredByFullName?: string | null;
889
+ updatedAt: string;
890
+ }
891
+
892
+ export interface ServiceTimingEntity {
893
+ hour: string;
894
+ count: number;
895
+ errorCount: number;
896
+ totalMs: number;
897
+ maxMs: number;
898
+ under100: number;
899
+ under250: number;
900
+ under500: number;
901
+ under1000: number;
902
+ under2000: number;
903
+ under5000: number;
904
+ over5000: number;
905
+ }
906
+
841
907
  type JsonValue = string | number | boolean | { [key in string]?: JsonValue } | Array<JsonValue> | null;
@@ -5,6 +5,7 @@ import { IssuingEntityPatterns, type IssuingEntityContract } from './issuingEnti
5
5
  import { ArchivalSeriesPatterns, type ArchivalSeriesContract } from './archivalSeries.contract';
6
6
  import { TextSnippetPatterns, type TextSnippetContract } from './textSnippet.contract';
7
7
  import { HolidayPatterns, type HolidayContract } from './holiday.contract';
8
+ import { IndicatorsPatterns, type IndicatorsContract } from './indicators.contract';
8
9
  import { ScanPatterns, type ScanContract } from './scan.contract';
9
10
  import { PartsOfficePatterns, type PartsOfficeContract } from './partsOffice.contract';
10
11
  import { ProcedurePatterns, type ProcedureContract } from './procedure.contract';
@@ -26,6 +27,7 @@ export * from './scan.contract';
26
27
  export * from './archivalSeries.contract';
27
28
  export * from './textSnippet.contract';
28
29
  export * from './holiday.contract';
30
+ export * from './indicators.contract';
29
31
 
30
32
  /** Patrones NATS de gestor-documental-ms, por recurso: `gestorDocumental.<recurso>.<acción>`. */
31
33
  export const GestorDocumentalPatterns = {
@@ -42,6 +44,7 @@ export const GestorDocumentalPatterns = {
42
44
  archivalSeries: ArchivalSeriesPatterns,
43
45
  textSnippet: TextSnippetPatterns,
44
46
  holiday: HolidayPatterns,
47
+ indicators: IndicatorsPatterns,
45
48
  } as const;
46
49
 
47
50
  /** Contrato completo de gestor-documental-ms: la unión de los contratos de sus recursos. */
@@ -57,4 +60,5 @@ export type GestorDocumentalContract = DocumentTypeContract &
57
60
  ScanContract &
58
61
  ArchivalSeriesContract &
59
62
  TextSnippetContract &
60
- HolidayContract;
63
+ HolidayContract &
64
+ IndicatorsContract;
@@ -0,0 +1,80 @@
1
+ import {
2
+ type IndicatorsFileEntity,
3
+ type ManagementIndicatorsEntity,
4
+ type QualityMetricSettingResponseEntity,
5
+ type QualityReportEntity,
6
+ type ServiceOutageRemoveResponseEntity,
7
+ type ServiceOutageResponseEntity,
8
+ } from '../entities';
9
+ import { type QualityMetricKey, type ServiceOutageKind } from '../base/entities';
10
+
11
+ /** Patrones NATS de `indicators`: indicadores de gestión y Plan de Mejora Continua (DS 11/2023). */
12
+ export const IndicatorsPatterns = {
13
+ getManagement: 'gestorDocumental.indicators.getManagement',
14
+ getQuality: 'gestorDocumental.indicators.getQuality',
15
+ export: 'gestorDocumental.indicators.export',
16
+ updateQualityMetric: 'gestorDocumental.indicators.updateQualityMetric',
17
+ getOutages: 'gestorDocumental.indicators.getOutages',
18
+ createOutage: 'gestorDocumental.indicators.createOutage',
19
+ updateOutage: 'gestorDocumental.indicators.updateOutage',
20
+ removeOutage: 'gestorDocumental.indicators.removeOutage',
21
+ getOutageCertificate: 'gestorDocumental.indicators.getOutageCertificate',
22
+ } as const;
23
+
24
+ /** Período: días de Chile «AAAA-MM-DD», hasta dos años. */
25
+ export interface IndicatorsPeriodQuery {
26
+ from: string;
27
+ to: string;
28
+ }
29
+
30
+ export interface ManagementIndicatorsQuery extends IndicatorsPeriodQuery {
31
+ documentTypeId?: string | null;
32
+ directorateCode?: number | null;
33
+ }
34
+
35
+ export interface ServiceOutageInput {
36
+ kind: ServiceOutageKind;
37
+ startedAt: string;
38
+ endedAt?: string | null;
39
+ cause: string;
40
+ affectedServices?: string | null;
41
+ }
42
+
43
+ export interface IndicatorsContract {
44
+ [IndicatorsPatterns.getManagement]: { payload: ManagementIndicatorsQuery; response: ManagementIndicatorsEntity };
45
+ [IndicatorsPatterns.getQuality]: { payload: IndicatorsPeriodQuery; response: QualityReportEntity };
46
+ /**
47
+ * Indicadores y Plan de Mejora en una planilla Excel. `generatedBy`: quién la descarga. `unitNames`: nombre de cada
48
+ * unidad (`c:<código de dirección>` o `d:<id de departamento>`), que el ms no conoce.
49
+ */
50
+ [IndicatorsPatterns.export]: {
51
+ payload: ManagementIndicatorsQuery & { generatedBy: string; unitNames?: Record<string, string> };
52
+ response: IndicatorsFileEntity;
53
+ };
54
+ /** Umbral y, en las métricas declaradas, su valor y respaldo. */
55
+ [IndicatorsPatterns.updateQualityMetric]: {
56
+ payload: {
57
+ key: QualityMetricKey;
58
+ threshold: number;
59
+ declaredValue?: number | null;
60
+ declaredNote?: string | null;
61
+ actor: { fullName: string };
62
+ };
63
+ response: QualityMetricSettingResponseEntity;
64
+ };
65
+ [IndicatorsPatterns.getOutages]: { payload: { year: number }; response: ServiceOutageResponseEntity[] };
66
+ [IndicatorsPatterns.createOutage]: {
67
+ payload: ServiceOutageInput & { actor: { employeeId: string; fullName: string } };
68
+ response: ServiceOutageResponseEntity;
69
+ };
70
+ [IndicatorsPatterns.updateOutage]: {
71
+ payload: ServiceOutageInput & { id: string; actor: { employeeId: string; fullName: string } };
72
+ response: ServiceOutageResponseEntity;
73
+ };
74
+ [IndicatorsPatterns.removeOutage]: { payload: { id: string }; response: ServiceOutageRemoveResponseEntity };
75
+ /** Certificado de indisponibilidad (DS 10/2023) en PDF, de una caída ya terminada. */
76
+ [IndicatorsPatterns.getOutageCertificate]: {
77
+ payload: { id: string; generatedBy: string };
78
+ response: IndicatorsFileEntity;
79
+ };
80
+ }
@@ -11,3 +11,4 @@ export * from './scan';
11
11
  export * from './archivalSeries';
12
12
  export * from './textSnippet';
13
13
  export * from './holiday';
14
+ export * from './indicators';
@@ -0,0 +1 @@
1
+ export * from './indicators.entity';
@@ -0,0 +1,157 @@
1
+ import { type DocumentParticipantRole, type QualityMetricKey, type ServiceOutageKind } from '../../base/entities';
2
+
3
+ /** Tiempos de tramitación, desde el primer envío a tramitación hasta la última firma. En días corridos y hábiles. */
4
+ export interface ProcessingTimeEntity {
5
+ count: number;
6
+ averageDays: number | null;
7
+ medianDays: number | null;
8
+ p90Days: number | null;
9
+ averageBusinessDays: number | null;
10
+ }
11
+
12
+ export interface IndicatorsByTypeEntity {
13
+ documentTypeId: string;
14
+ name: string;
15
+ submitted: number;
16
+ finished: number;
17
+ rejections: number;
18
+ averageDays: number | null;
19
+ averageBusinessDays: number | null;
20
+ }
21
+
22
+ /** Unidad emisora: una dirección (código de caschile) o un departamento; el nombre lo pone el front. */
23
+ export interface IndicatorsByUnitEntity {
24
+ directorateCode: number | null;
25
+ departmentId: string | null;
26
+ submitted: number;
27
+ finished: number;
28
+ averageDays: number | null;
29
+ averageBusinessDays: number | null;
30
+ }
31
+
32
+ /** Quién demora más en su turno de visación o firma, y cuánto tiene pendiente hoy. */
33
+ export interface IndicatorsBottleneckEntity {
34
+ employeeId: string;
35
+ fullName: string;
36
+ role: DocumentParticipantRole;
37
+ resolved: number;
38
+ averageDays: number | null;
39
+ pending: number;
40
+ oldestPendingDays: number | null;
41
+ }
42
+
43
+ export interface ManagementIndicatorsEntity {
44
+ /** Período consultado, días de Chile «AAAA-MM-DD». */
45
+ from: string;
46
+ to: string;
47
+ generatedAt: string;
48
+ filters: { documentTypeId: string | null; directorateCode: number | null };
49
+ volume: {
50
+ /** Enviados a tramitación por primera vez en el período. */
51
+ submitted: number;
52
+ finished: number;
53
+ /** Rechazos de visadores y firmantes (un documento puede tener varios). */
54
+ rejections: number;
55
+ annulled: number;
56
+ discarded: number;
57
+ /** En tramitación hoy, sin importar el período. */
58
+ inProcess: number;
59
+ };
60
+ processing: ProcessingTimeEntity;
61
+ byType: IndicatorsByTypeEntity[];
62
+ byUnit: IndicatorsByUnitEntity[];
63
+ /** Por mes de Chile «AAAA-MM». */
64
+ monthly: { month: string; submitted: number; finished: number }[];
65
+ bottlenecks: IndicatorsBottleneckEntity[];
66
+ /** Plazos de lo recibido y derivado que vencían en el período. */
67
+ deadlines: {
68
+ withDeadline: number;
69
+ onTime: number;
70
+ late: number;
71
+ /** Vencidos sin atender. */
72
+ overdue: number;
73
+ /** Sin atender, todavía en plazo. */
74
+ pending: number;
75
+ /** A tiempo sobre los ya resueltos o vencidos, en %. */
76
+ onTimeRate: number | null;
77
+ };
78
+ partsOffice: {
79
+ received: number;
80
+ registered: number;
81
+ returned: number;
82
+ /** Días desde que llegó por DocDigital hasta que Partes lo ingresó. */
83
+ averageIntakeDays: number | null;
84
+ dispatched: number;
85
+ dispatchReturned: number;
86
+ };
87
+ }
88
+
89
+ export type QualityMetricUnit = 'Percent' | 'Ratio' | 'Milliseconds';
90
+ export type QualityMetricDirection = 'AtLeast' | 'AtMost';
91
+
92
+ /** Una métrica del Plan de Mejora Continua, con su valor en el período y su umbral. */
93
+ export interface QualityMetricEntity {
94
+ key: QualityMetricKey;
95
+ /** Subcaracterística de la ISO/IEC 25010 que mide. */
96
+ subcharacteristic: string;
97
+ model: 'Product' | 'InUse';
98
+ name: string;
99
+ description: string;
100
+ /** La mide el sistema o la declara quien administra la calidad, con su respaldo. */
101
+ source: 'Measured' | 'Declared';
102
+ value: number | null;
103
+ unit: QualityMetricUnit;
104
+ threshold: number;
105
+ direction: QualityMetricDirection;
106
+ /** Cumple el umbral. `null` sin valor. */
107
+ meets: boolean | null;
108
+ /** Con qué se calculó: cantidades del período. */
109
+ detail: string | null;
110
+ declaredNote: string | null;
111
+ declaredAt: string | null;
112
+ declaredByFullName: string | null;
113
+ }
114
+
115
+ export interface ServiceOutageResponseEntity {
116
+ id: string;
117
+ kind: ServiceOutageKind;
118
+ startedAt: string;
119
+ endedAt: string | null;
120
+ /** Duración en minutos; si sigue caído, hasta ahora. */
121
+ minutes: number;
122
+ cause: string;
123
+ affectedServices: string | null;
124
+ createdByFullName: string;
125
+ updatedByFullName: string | null;
126
+ createdAt: string;
127
+ }
128
+
129
+ export interface QualityReportEntity {
130
+ from: string;
131
+ to: string;
132
+ generatedAt: string;
133
+ metrics: QualityMetricEntity[];
134
+ /** Caídas que tocan el período. */
135
+ outages: ServiceOutageResponseEntity[];
136
+ }
137
+
138
+ export interface QualityMetricSettingResponseEntity {
139
+ key: QualityMetricKey;
140
+ threshold: number;
141
+ declaredValue: number | null;
142
+ declaredNote: string | null;
143
+ declaredAt: string | null;
144
+ declaredByFullName: string | null;
145
+ }
146
+
147
+ export interface ServiceOutageRemoveResponseEntity {
148
+ id: string;
149
+ ok: boolean;
150
+ }
151
+
152
+ /** Un archivo generado (planilla o certificado), en base64. */
153
+ export interface IndicatorsFileEntity {
154
+ fileName: string;
155
+ contentType: string;
156
+ contentBase64: string;
157
+ }