@muni-sanfer/types-gestor-documental 0.0.1-beta.1 → 0.0.1-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/base/entities.d.ts +436 -1
  2. package/dist/base/entities.js +98 -1
  3. package/dist/contracts/caseFile.contract.d.ts +159 -0
  4. package/dist/contracts/caseFile.contract.js +18 -0
  5. package/dist/contracts/document.contract.d.ts +163 -3
  6. package/dist/contracts/document.contract.js +8 -0
  7. package/dist/contracts/documentType.contract.d.ts +18 -1
  8. package/dist/contracts/index.d.ts +84 -1
  9. package/dist/contracts/index.js +18 -0
  10. package/dist/contracts/partsOffice.contract.d.ts +171 -0
  11. package/dist/contracts/partsOffice.contract.js +22 -0
  12. package/dist/contracts/procedure.contract.d.ts +50 -0
  13. package/dist/contracts/procedure.contract.js +11 -0
  14. package/dist/contracts/registerBook.contract.d.ts +27 -0
  15. package/dist/contracts/registerBook.contract.js +8 -0
  16. package/dist/contracts/signatureBatch.contract.d.ts +109 -0
  17. package/dist/contracts/signatureBatch.contract.js +12 -0
  18. package/dist/contracts/workFolder.contract.d.ts +114 -0
  19. package/dist/contracts/workFolder.contract.js +16 -0
  20. package/dist/entities/caseFile/caseFile.entity.d.ts +176 -0
  21. package/dist/entities/caseFile/caseFile.entity.js +2 -0
  22. package/dist/entities/caseFile/index.d.ts +1 -0
  23. package/dist/entities/caseFile/index.js +17 -0
  24. package/dist/entities/document/document.entity.d.ts +248 -1
  25. package/dist/entities/documentType/documentType.entity.d.ts +18 -1
  26. package/dist/entities/index.d.ts +6 -0
  27. package/dist/entities/index.js +6 -0
  28. package/dist/entities/partsOffice/index.d.ts +1 -0
  29. package/dist/entities/partsOffice/index.js +17 -0
  30. package/dist/entities/partsOffice/partsOffice.entity.d.ts +98 -0
  31. package/dist/entities/partsOffice/partsOffice.entity.js +2 -0
  32. package/dist/entities/procedure/index.d.ts +1 -0
  33. package/dist/entities/procedure/index.js +17 -0
  34. package/dist/entities/procedure/procedure.entity.d.ts +20 -0
  35. package/dist/entities/procedure/procedure.entity.js +2 -0
  36. package/dist/entities/registerBook/index.d.ts +1 -0
  37. package/dist/entities/registerBook/index.js +17 -0
  38. package/dist/entities/registerBook/registerBook.entity.d.ts +42 -0
  39. package/dist/entities/registerBook/registerBook.entity.js +2 -0
  40. package/dist/entities/signatureBatch/index.d.ts +1 -0
  41. package/dist/entities/signatureBatch/index.js +17 -0
  42. package/dist/entities/signatureBatch/signatureBatch.entity.d.ts +107 -0
  43. package/dist/entities/signatureBatch/signatureBatch.entity.js +2 -0
  44. package/dist/entities/workFolder/index.d.ts +1 -0
  45. package/dist/entities/workFolder/index.js +17 -0
  46. package/dist/entities/workFolder/workFolder.entity.d.ts +83 -0
  47. package/dist/entities/workFolder/workFolder.entity.js +2 -0
  48. package/package.json +1 -1
  49. package/src/base/entities.ts +509 -1
  50. package/src/contracts/caseFile.contract.ts +141 -0
  51. package/src/contracts/document.contract.ts +155 -0
  52. package/src/contracts/documentType.contract.ts +14 -1
  53. package/src/contracts/index.ts +26 -1
  54. package/src/contracts/partsOffice.contract.ts +120 -0
  55. package/src/contracts/procedure.contract.ts +53 -0
  56. package/src/contracts/registerBook.contract.ts +24 -0
  57. package/src/contracts/signatureBatch.contract.ts +96 -0
  58. package/src/contracts/workFolder.contract.ts +75 -0
  59. package/src/entities/caseFile/caseFile.entity.ts +204 -0
  60. package/src/entities/caseFile/index.ts +1 -0
  61. package/src/entities/document/document.entity.ts +259 -0
  62. package/src/entities/documentType/documentType.entity.ts +20 -1
  63. package/src/entities/index.ts +6 -0
  64. package/src/entities/partsOffice/index.ts +1 -0
  65. package/src/entities/partsOffice/partsOffice.entity.ts +103 -0
  66. package/src/entities/procedure/index.ts +1 -0
  67. package/src/entities/procedure/procedure.entity.ts +24 -0
  68. package/src/entities/registerBook/index.ts +1 -0
  69. package/src/entities/registerBook/registerBook.entity.ts +46 -0
  70. package/src/entities/signatureBatch/index.ts +1 -0
  71. package/src/entities/signatureBatch/signatureBatch.entity.ts +110 -0
  72. package/src/entities/workFolder/index.ts +1 -0
  73. package/src/entities/workFolder/workFolder.entity.ts +84 -0
  74. package/tsconfig.json +1 -3
@@ -57,7 +57,13 @@ export type DocumentTrackingAction =
57
57
  | 'Discarded'
58
58
  | 'Numbered'
59
59
  | 'NumberAnnulled'
60
- | 'Annulled';
60
+ | 'Annulled'
61
+ | 'Delivered'
62
+ | 'Derived'
63
+ | 'Reassigned'
64
+ | 'Dispatched'
65
+ | 'DispatchReturned'
66
+ | 'Received';
61
67
 
62
68
  export const DocumentTrackingAction = {
63
69
  Created: 'Created',
@@ -71,8 +77,44 @@ export const DocumentTrackingAction = {
71
77
  Numbered: 'Numbered',
72
78
  NumberAnnulled: 'NumberAnnulled',
73
79
  Annulled: 'Annulled',
80
+ Delivered: 'Delivered',
81
+ Derived: 'Derived',
82
+ Reassigned: 'Reassigned',
83
+ Dispatched: 'Dispatched',
84
+ DispatchReturned: 'DispatchReturned',
85
+ Received: 'Received',
74
86
  } satisfies Record<string, DocumentTrackingAction>;
75
87
 
88
+ export type DocumentOrigin = 'Internal' | 'DocDigital';
89
+
90
+ export const DocumentOrigin = {
91
+ Internal: 'Internal',
92
+ DocDigital: 'DocDigital',
93
+ } satisfies Record<string, DocumentOrigin>;
94
+
95
+ export type DocumentDispatchStatus = 'Pending' | 'Dispatched' | 'Returned';
96
+
97
+ export const DocumentDispatchStatus = {
98
+ Pending: 'Pending',
99
+ Dispatched: 'Dispatched',
100
+ Returned: 'Returned',
101
+ } satisfies Record<string, DocumentDispatchStatus>;
102
+
103
+ export type DocDigitalInboundStatus = 'Pending' | 'Registered' | 'Returned';
104
+
105
+ export const DocDigitalInboundStatus = {
106
+ Pending: 'Pending',
107
+ Registered: 'Registered',
108
+ Returned: 'Returned',
109
+ } satisfies Record<string, DocDigitalInboundStatus>;
110
+
111
+ export type DocumentFlowStepType = 'Employee' | 'DirectorateHead';
112
+
113
+ export const DocumentFlowStepType = {
114
+ Employee: 'Employee',
115
+ DirectorateHead: 'DirectorateHead',
116
+ } satisfies Record<string, DocumentFlowStepType>;
117
+
76
118
  export type DocumentAttachmentType = 'File' | 'Link';
77
119
 
78
120
  export const DocumentAttachmentType = {
@@ -80,6 +122,132 @@ export const DocumentAttachmentType = {
80
122
  Link: 'Link',
81
123
  } satisfies Record<string, DocumentAttachmentType>;
82
124
 
125
+ export type DocumentRecipientType = 'Employee' | 'Directorate' | 'Department';
126
+
127
+ export const DocumentRecipientType = {
128
+ Employee: 'Employee',
129
+ Directorate: 'Directorate',
130
+ Department: 'Department',
131
+ } satisfies Record<string, DocumentRecipientType>;
132
+
133
+ export type DocumentDeliveryOrigin = 'Recipient' | 'Derivation';
134
+
135
+ export const DocumentDeliveryOrigin = {
136
+ Recipient: 'Recipient',
137
+ Derivation: 'Derivation',
138
+ } satisfies Record<string, DocumentDeliveryOrigin>;
139
+
140
+ export type DocumentInstruction = 'Knowledge' | 'Inform' | 'Respond' | 'Archive';
141
+
142
+ export const DocumentInstruction = {
143
+ Knowledge: 'Knowledge',
144
+ Inform: 'Inform',
145
+ Respond: 'Respond',
146
+ Archive: 'Archive',
147
+ } satisfies Record<string, DocumentInstruction>;
148
+
149
+ export type CaseFileStatus = 'Open' | 'Closed';
150
+
151
+ export const CaseFileStatus = {
152
+ Open: 'Open',
153
+ Closed: 'Closed',
154
+ } satisfies Record<string, CaseFileStatus>;
155
+
156
+ export type CaseFileIncorporationMechanism =
157
+ 'Manual' | 'WebService' | 'Mixed' | 'CitizenRepository' | 'Interoperability';
158
+
159
+ export const CaseFileIncorporationMechanism = {
160
+ Manual: 'Manual',
161
+ WebService: 'WebService',
162
+ Mixed: 'Mixed',
163
+ CitizenRepository: 'CitizenRepository',
164
+ Interoperability: 'Interoperability',
165
+ } satisfies Record<string, CaseFileIncorporationMechanism>;
166
+
167
+ export type CaseFileActuationType =
168
+ | 'AdministrativeAct'
169
+ | 'Notification'
170
+ | 'OfficialCommunication'
171
+ | 'Interoperability'
172
+ | 'RequestReception'
173
+ | 'Subfolder'
174
+ | 'PowerRegistration';
175
+
176
+ export const CaseFileActuationType = {
177
+ AdministrativeAct: 'AdministrativeAct',
178
+ Notification: 'Notification',
179
+ OfficialCommunication: 'OfficialCommunication',
180
+ Interoperability: 'Interoperability',
181
+ RequestReception: 'RequestReception',
182
+ Subfolder: 'Subfolder',
183
+ PowerRegistration: 'PowerRegistration',
184
+ } satisfies Record<string, CaseFileActuationType>;
185
+
186
+ export type CaseFileEntryKind = 'Document' | 'File' | 'CaseFile';
187
+
188
+ export const CaseFileEntryKind = {
189
+ Document: 'Document',
190
+ File: 'File',
191
+ CaseFile: 'CaseFile',
192
+ } satisfies Record<string, CaseFileEntryKind>;
193
+
194
+ export type CaseFileActorRelation =
195
+ 'Responsible' | 'Interested' | 'Author' | 'Referred' | 'Recipient' | 'MinisterOfFaith';
196
+
197
+ export const CaseFileActorRelation = {
198
+ Responsible: 'Responsible',
199
+ Interested: 'Interested',
200
+ Author: 'Author',
201
+ Referred: 'Referred',
202
+ Recipient: 'Recipient',
203
+ MinisterOfFaith: 'MinisterOfFaith',
204
+ } satisfies Record<string, CaseFileActorRelation>;
205
+
206
+ export type CaseFileActorType = 'Citizen' | 'Foreigner' | 'PrivateInstitution' | 'Official';
207
+
208
+ export const CaseFileActorType = {
209
+ Citizen: 'Citizen',
210
+ Foreigner: 'Foreigner',
211
+ PrivateInstitution: 'PrivateInstitution',
212
+ Official: 'Official',
213
+ } satisfies Record<string, CaseFileActorType>;
214
+
215
+ export type CaseFileTrackingAction =
216
+ | 'Created'
217
+ | 'Updated'
218
+ | 'EntryAdded'
219
+ | 'EntryVoided'
220
+ | 'ParticipantAdded'
221
+ | 'ParticipantRemoved'
222
+ | 'Closed'
223
+ | 'Exported';
224
+
225
+ export const CaseFileTrackingAction = {
226
+ Created: 'Created',
227
+ Updated: 'Updated',
228
+ EntryAdded: 'EntryAdded',
229
+ EntryVoided: 'EntryVoided',
230
+ ParticipantAdded: 'ParticipantAdded',
231
+ ParticipantRemoved: 'ParticipantRemoved',
232
+ Closed: 'Closed',
233
+ Exported: 'Exported',
234
+ } satisfies Record<string, CaseFileTrackingAction>;
235
+
236
+ export type CaseFileAccessAction = 'Viewed' | 'FileDownloaded' | 'Exported';
237
+
238
+ export const CaseFileAccessAction = {
239
+ Viewed: 'Viewed',
240
+ FileDownloaded: 'FileDownloaded',
241
+ Exported: 'Exported',
242
+ } satisfies Record<string, CaseFileAccessAction>;
243
+
244
+ export type WorkFolderItemKind = 'Document' | 'File';
245
+
246
+ export const WorkFolderItemKind = {
247
+ Document: 'Document',
248
+ File: 'File',
249
+ } satisfies Record<string, WorkFolderItemKind>;
250
+
83
251
  export interface DocumentTypeEntity {
84
252
  id: string;
85
253
  name: string;
@@ -89,10 +257,13 @@ export interface DocumentTypeEntity {
89
257
  nextCorrelative: number;
90
258
  correlativeYear?: number | null;
91
259
  resetsYearly: boolean;
260
+ numbered: boolean;
92
261
  directorateCodeReference?: number | null;
93
262
  enabled: boolean;
94
263
  documents?: DocumentEntity[];
95
264
  annulledNumbers?: DocumentAnnulledNumberEntity[];
265
+ flowSteps?: DocumentTypeFlowStepEntity[];
266
+ signatureBatches?: SignatureBatchEntity[];
96
267
  deleted: boolean;
97
268
  createdAt: string;
98
269
  updatedAt: string;
@@ -112,6 +283,21 @@ export interface DocumentEntity {
112
283
  signatureSheet: boolean;
113
284
  annulledAt?: string | null;
114
285
  annulmentReason?: string | null;
286
+ responseDueAt?: string | null;
287
+ origin: DocumentOrigin;
288
+ intakeNumber?: number | null;
289
+ intakeYear?: number | null;
290
+ externalFolio?: string | null;
291
+ externalSender?: string | null;
292
+ externalDate?: string | null;
293
+ composition?: JsonValue | null;
294
+ contentText?: string | null;
295
+ textExtractedAt?: string | null;
296
+ batch?: SignatureBatchEntity | null;
297
+ batchId?: string | null;
298
+ replyTo?: DocumentEntity | null;
299
+ replyToDocumentId?: string | null;
300
+ replies?: DocumentEntity[];
115
301
  directorateCodeReference?: number | null;
116
302
  departmentId?: string | null;
117
303
  createdByEmployeeId: string;
@@ -128,6 +314,26 @@ export interface DocumentEntity {
128
314
  attachments?: DocumentAttachmentEntity[];
129
315
  trackings?: DocumentTrackingEntity[];
130
316
  annulledNumbers?: DocumentAnnulledNumberEntity[];
317
+ recipients?: DocumentRecipientEntity[];
318
+ deliveries?: DocumentDeliveryEntity[];
319
+ caseFileEntries?: CaseFileEntryEntity[];
320
+ workFolderItems?: WorkFolderItemEntity[];
321
+ externalRecipients?: DocumentExternalRecipientEntity[];
322
+ dispatch?: DocumentDispatchEntity | null;
323
+ docDigitalInbound?: DocDigitalInboundEntity | null;
324
+ deleted: boolean;
325
+ createdAt: string;
326
+ updatedAt: string;
327
+ }
328
+
329
+ export interface SignatureBatchEntity {
330
+ id: string;
331
+ name: string;
332
+ createdByEmployeeId: string;
333
+ createdByFullName: string;
334
+ documentType?: DocumentTypeEntity;
335
+ documentTypeId: string;
336
+ documents?: DocumentEntity[];
131
337
  deleted: boolean;
132
338
  createdAt: string;
133
339
  updatedAt: string;
@@ -137,6 +343,7 @@ export interface DocumentParticipantEntity {
137
343
  id: string;
138
344
  role: DocumentParticipantRole;
139
345
  order: number;
346
+ stage: number;
140
347
  status: DocumentParticipantStatus;
141
348
  employeeId: string;
142
349
  fullName: string;
@@ -186,3 +393,304 @@ export interface DocumentAnnulledNumberEntity {
186
393
  documentId: string;
187
394
  createdAt: string;
188
395
  }
396
+
397
+ export interface DocumentRecipientEntity {
398
+ id: string;
399
+ type: DocumentRecipientType;
400
+ employeeId?: string | null;
401
+ directorateCodeReference?: number | null;
402
+ departmentId?: string | null;
403
+ name: string;
404
+ position?: string | null;
405
+ document?: DocumentEntity;
406
+ documentId: string;
407
+ createdAt: string;
408
+ }
409
+
410
+ export interface DocumentDeliveryEntity {
411
+ id: string;
412
+ origin: DocumentDeliveryOrigin;
413
+ employeeId: string;
414
+ fullName: string;
415
+ position?: string | null;
416
+ areaName?: string | null;
417
+ sentByEmployeeId?: string | null;
418
+ sentByFullName?: string | null;
419
+ instruction?: DocumentInstruction | null;
420
+ note?: string | null;
421
+ dueAt?: string | null;
422
+ deliveredAt?: string | null;
423
+ readAt?: string | null;
424
+ closedAt?: string | null;
425
+ closingNote?: string | null;
426
+ document?: DocumentEntity;
427
+ documentId: string;
428
+ createdAt: string;
429
+ }
430
+
431
+ export interface DocumentTypeFlowStepEntity {
432
+ id: string;
433
+ role: DocumentParticipantRole;
434
+ order: number;
435
+ type: DocumentFlowStepType;
436
+ employeeId?: string | null;
437
+ directorateCodeReference?: number | null;
438
+ name: string;
439
+ position?: string | null;
440
+ documentType?: DocumentTypeEntity;
441
+ documentTypeId: string;
442
+ createdAt: string;
443
+ }
444
+
445
+ export interface ProcedureEntity {
446
+ id: string;
447
+ name: string;
448
+ cpatId?: string | null;
449
+ cpatCode?: string | null;
450
+ description?: string | null;
451
+ enabled: boolean;
452
+ caseFiles?: CaseFileEntity[];
453
+ deleted: boolean;
454
+ createdAt: string;
455
+ updatedAt: string;
456
+ }
457
+
458
+ export interface CaseFileSequenceEntity {
459
+ year: number;
460
+ next: number;
461
+ }
462
+
463
+ export interface CaseFileEntity {
464
+ id: string;
465
+ code: string;
466
+ year: number;
467
+ number: number;
468
+ title: string;
469
+ subject: string;
470
+ summary?: string | null;
471
+ status: CaseFileStatus;
472
+ accessLevel: DocumentAccessLevel;
473
+ hasSensitiveData: boolean;
474
+ incorporationMechanism: CaseFileIncorporationMechanism;
475
+ schemaVersion: string;
476
+ procedure?: ProcedureEntity;
477
+ procedureId: string;
478
+ responsibleEmployeeId: string;
479
+ responsibleFullName: string;
480
+ responsiblePosition?: string | null;
481
+ closedAt?: string | null;
482
+ closedByEmployeeId?: string | null;
483
+ closedByFullName?: string | null;
484
+ closingNote?: string | null;
485
+ participants?: CaseFileParticipantEntity[];
486
+ actors?: CaseFileActorEntity[];
487
+ entries?: CaseFileEntryEntity[];
488
+ linkedFrom?: CaseFileEntryEntity[];
489
+ trackings?: CaseFileTrackingEntity[];
490
+ metadataChanges?: CaseFileMetadataChangeEntity[];
491
+ accesses?: CaseFileAccessEntity[];
492
+ createdAt: string;
493
+ updatedAt: string;
494
+ workFolder?: WorkFolderEntity | null;
495
+ }
496
+
497
+ export interface CaseFileParticipantEntity {
498
+ id: string;
499
+ employeeId: string;
500
+ fullName: string;
501
+ position?: string | null;
502
+ addedByEmployeeId: string;
503
+ addedByFullName: string;
504
+ caseFile?: CaseFileEntity;
505
+ caseFileId: string;
506
+ createdAt: string;
507
+ }
508
+
509
+ export interface CaseFileActorEntity {
510
+ id: string;
511
+ relation: CaseFileActorRelation;
512
+ actorType: CaseFileActorType;
513
+ identifier?: string | null;
514
+ name: string;
515
+ caseFile?: CaseFileEntity;
516
+ caseFileId: string;
517
+ createdAt: string;
518
+ }
519
+
520
+ export interface CaseFileEntryEntity {
521
+ id: string;
522
+ sequence: number;
523
+ kind: CaseFileEntryKind;
524
+ actuationType: CaseFileActuationType;
525
+ title: string;
526
+ document?: DocumentEntity | null;
527
+ documentId?: string | null;
528
+ fileId?: string | null;
529
+ fileName?: string | null;
530
+ documentTypeName?: string | null;
531
+ originDate?: string | null;
532
+ author?: string | null;
533
+ keywords: string[];
534
+ accessLevel?: DocumentAccessLevel | null;
535
+ hasSensitiveData?: boolean | null;
536
+ linkedCaseFile?: CaseFileEntity | null;
537
+ linkedCaseFileId?: string | null;
538
+ sha256?: string | null;
539
+ size?: number | null;
540
+ hasAdvancedSignature: boolean;
541
+ incorporatedByEmployeeId: string;
542
+ incorporatedByFullName: string;
543
+ voidedAt?: string | null;
544
+ voidedByEmployeeId?: string | null;
545
+ voidedByFullName?: string | null;
546
+ voidReason?: string | null;
547
+ caseFile?: CaseFileEntity;
548
+ caseFileId: string;
549
+ createdAt: string;
550
+ }
551
+
552
+ export interface CaseFileTrackingEntity {
553
+ id: string;
554
+ action: CaseFileTrackingAction;
555
+ observation?: string | null;
556
+ employeeId?: string | null;
557
+ employeeFullName?: string | null;
558
+ caseFile?: CaseFileEntity;
559
+ caseFileId: string;
560
+ createdAt: string;
561
+ }
562
+
563
+ export interface CaseFileMetadataChangeEntity {
564
+ id: string;
565
+ field: string;
566
+ previousValue?: string | null;
567
+ newValue?: string | null;
568
+ employeeId: string;
569
+ employeeFullName: string;
570
+ caseFile?: CaseFileEntity;
571
+ caseFileId: string;
572
+ createdAt: string;
573
+ }
574
+
575
+ export interface CaseFileAccessEntity {
576
+ id: string;
577
+ action: CaseFileAccessAction;
578
+ entryId?: string | null;
579
+ employeeId: string;
580
+ employeeFullName: string;
581
+ caseFile?: CaseFileEntity;
582
+ caseFileId: string;
583
+ createdAt: string;
584
+ }
585
+
586
+ export interface DocumentExternalRecipientEntity {
587
+ id: string;
588
+ entityId: number;
589
+ entityName: string;
590
+ userId?: number | null;
591
+ userName?: string | null;
592
+ userPosition?: string | null;
593
+ document?: DocumentEntity;
594
+ documentId: string;
595
+ createdAt: string;
596
+ }
597
+
598
+ export interface DocumentDispatchEntity {
599
+ id: string;
600
+ status: DocumentDispatchStatus;
601
+ folio?: string | null;
602
+ docDigitalTypeId?: number | null;
603
+ docDigitalTypeName?: string | null;
604
+ docDigitalDocumentId?: string | null;
605
+ docDigitalRequestId?: string | null;
606
+ dispatchedAt?: string | null;
607
+ dispatchedByEmployeeId?: string | null;
608
+ dispatchedByFullName?: string | null;
609
+ returnedAt?: string | null;
610
+ returnedByEmployeeId?: string | null;
611
+ returnedByFullName?: string | null;
612
+ returnReason?: string | null;
613
+ document?: DocumentEntity;
614
+ documentId: string;
615
+ createdAt: string;
616
+ updatedAt: string;
617
+ }
618
+
619
+ export interface DocDigitalInboundEntity {
620
+ id: string;
621
+ docDigitalDocumentId: string;
622
+ docDigitalRequestId?: string | null;
623
+ status: DocDigitalInboundStatus;
624
+ subject: string;
625
+ description?: string | null;
626
+ folio?: string | null;
627
+ folioDate?: string | null;
628
+ typeName?: string | null;
629
+ reserved: boolean;
630
+ senderEntityId?: number | null;
631
+ senderEntityName?: string | null;
632
+ senderName?: string | null;
633
+ senderPosition?: string | null;
634
+ fileId?: string | null;
635
+ fileName?: string | null;
636
+ attachments: JsonValue;
637
+ registeredAt?: string | null;
638
+ registeredByEmployeeId?: string | null;
639
+ registeredByFullName?: string | null;
640
+ acknowledgedAt?: string | null;
641
+ acknowledgeError?: string | null;
642
+ returnedAt?: string | null;
643
+ returnedByEmployeeId?: string | null;
644
+ returnedByFullName?: string | null;
645
+ returnReason?: string | null;
646
+ document?: DocumentEntity | null;
647
+ documentId?: string | null;
648
+ createdAt: string;
649
+ updatedAt: string;
650
+ }
651
+
652
+ export interface IntakeSequenceEntity {
653
+ year: number;
654
+ next: number;
655
+ }
656
+
657
+ export interface WorkFolderEntity {
658
+ id: string;
659
+ name: string;
660
+ description?: string | null;
661
+ ownerEmployeeId: string;
662
+ ownerFullName: string;
663
+ caseFile?: CaseFileEntity | null;
664
+ caseFileId?: string | null;
665
+ participants?: WorkFolderParticipantEntity[];
666
+ items?: WorkFolderItemEntity[];
667
+ deleted: boolean;
668
+ createdAt: string;
669
+ updatedAt: string;
670
+ }
671
+
672
+ export interface WorkFolderParticipantEntity {
673
+ id: string;
674
+ employeeId: string;
675
+ fullName: string;
676
+ folder?: WorkFolderEntity;
677
+ folderId: string;
678
+ createdAt: string;
679
+ }
680
+
681
+ export interface WorkFolderItemEntity {
682
+ id: string;
683
+ kind: WorkFolderItemKind;
684
+ title: string;
685
+ document?: DocumentEntity | null;
686
+ documentId?: string | null;
687
+ fileId?: string | null;
688
+ fileName?: string | null;
689
+ addedByEmployeeId: string;
690
+ addedByFullName: string;
691
+ folder?: WorkFolderEntity;
692
+ folderId: string;
693
+ createdAt: string;
694
+ }
695
+
696
+ type JsonValue = string | number | boolean | { [key in string]?: JsonValue } | Array<JsonValue> | null;
@@ -0,0 +1,141 @@
1
+ import {
2
+ type CaseFileActorRelation,
3
+ type CaseFileActorType,
4
+ type CaseFileActuationType,
5
+ type CaseFileEntity,
6
+ type CaseFileStatus,
7
+ type DocumentAccessLevel,
8
+ } from '../base/entities';
9
+ import {
10
+ type CaseFileAddBatchResponseEntity,
11
+ type CaseFileAddEntryResponseEntity,
12
+ type CaseFileCreateResponseEntity,
13
+ type CaseFileEntryFileResponseEntity,
14
+ type CaseFileExportResponseEntity,
15
+ type CaseFileGetAllResponseEntity,
16
+ type CaseFileGetByIdResponseEntity,
17
+ type CaseFileUpdateResponseEntity,
18
+ } from '../entities';
19
+ import { type RpcPage } from './contract';
20
+ import { type DocumentActor } from './document.contract';
21
+
22
+ /** Patrones NATS de `caseFile`: `<servicio>.<recurso>.<acción>`. */
23
+ export const CaseFilePatterns = {
24
+ getAll: 'gestorDocumental.caseFile.getAll',
25
+ getById: 'gestorDocumental.caseFile.getById',
26
+ create: 'gestorDocumental.caseFile.create',
27
+ update: 'gestorDocumental.caseFile.update',
28
+ addEntry: 'gestorDocumental.caseFile.addEntry',
29
+ addBatch: 'gestorDocumental.caseFile.addBatch',
30
+ voidEntry: 'gestorDocumental.caseFile.voidEntry',
31
+ share: 'gestorDocumental.caseFile.share',
32
+ unshare: 'gestorDocumental.caseFile.unshare',
33
+ close: 'gestorDocumental.caseFile.close',
34
+ getEntryFile: 'gestorDocumental.caseFile.getEntryFile',
35
+ getExport: 'gestorDocumental.caseFile.getExport',
36
+ } as const;
37
+
38
+ /** Persona u organización relacionada con el expediente (MGDEE54). */
39
+ export interface CaseFileActorInput {
40
+ relation: CaseFileActorRelation;
41
+ actorType: CaseFileActorType;
42
+ identifier?: string | null;
43
+ name: string;
44
+ }
45
+
46
+ /** Metadatos del expediente que se ingresan a mano. */
47
+ export interface CaseFileWritePayload {
48
+ title: string;
49
+ subject: string;
50
+ summary?: string | null;
51
+ procedureId: string;
52
+ accessLevel: DocumentAccessLevel;
53
+ hasSensitiveData: boolean;
54
+ actors?: CaseFileActorInput[];
55
+ }
56
+
57
+ /** Actuación que se incorpora al índice: un documento del gestor, un archivo subido u otro expediente. */
58
+ export type CaseFileEntryInput =
59
+ | { kind: 'Document'; actuationType: CaseFileActuationType; documentId: string }
60
+ | {
61
+ kind: 'File';
62
+ actuationType: CaseFileActuationType;
63
+ fileId: string;
64
+ fileName: string;
65
+ title: string;
66
+ documentTypeName?: string | null;
67
+ originDate?: string | null;
68
+ author?: string | null;
69
+ keywords: string[];
70
+ accessLevel: DocumentAccessLevel;
71
+ hasSensitiveData: boolean;
72
+ }
73
+ | { kind: 'CaseFile'; actuationType: CaseFileActuationType; linkedCaseFileId: string };
74
+
75
+ /** Quién hace la operación (de la sesión) y si puede ver todos los expedientes. */
76
+ interface CaseFileActorPayload {
77
+ actor: DocumentActor;
78
+ viewAll?: boolean;
79
+ }
80
+
81
+ /** Ámbito del listado: los expedientes del funcionario (responsable o compartidos con él) o todos. */
82
+ export type CaseFileScope = 'mine' | 'all';
83
+
84
+ export interface CaseFileContract {
85
+ [CaseFilePatterns.getAll]: {
86
+ payload: {
87
+ pagination?: { page?: number; limit?: number };
88
+ filters?: { search?: string; status?: CaseFileStatus; procedureId?: string; scope?: CaseFileScope };
89
+ } & CaseFileActorPayload;
90
+ response: RpcPage<CaseFileGetAllResponseEntity[]>;
91
+ };
92
+ /** Por id o por su identificador (`EXP-2026-00001`), que es el del enlace persistente. Queda en el registro de accesos. */
93
+ [CaseFilePatterns.getById]: {
94
+ payload: { id: string } & CaseFileActorPayload;
95
+ response: CaseFileGetByIdResponseEntity;
96
+ };
97
+ [CaseFilePatterns.create]: {
98
+ payload: CaseFileWritePayload & { actor: DocumentActor };
99
+ response: CaseFileCreateResponseEntity;
100
+ };
101
+ [CaseFilePatterns.update]: {
102
+ payload: CaseFileWritePayload & Pick<CaseFileEntity, 'id'> & { actor: DocumentActor };
103
+ response: CaseFileUpdateResponseEntity;
104
+ };
105
+ /** Incorpora los documentos finalizados de un lote de firma, en su orden; omite los que ya están en el expediente. */
106
+ [CaseFilePatterns.addBatch]: {
107
+ payload: { id: string; batchId: string; actuationType: CaseFileActuationType } & CaseFileActorPayload;
108
+ response: CaseFileAddBatchResponseEntity;
109
+ };
110
+ [CaseFilePatterns.addEntry]: {
111
+ payload: Pick<CaseFileEntity, 'id'> & { entry: CaseFileEntryInput } & CaseFileActorPayload;
112
+ response: CaseFileAddEntryResponseEntity;
113
+ };
114
+ /** Deja una actuación sin efecto, con su motivo. No se elimina del índice. */
115
+ [CaseFilePatterns.voidEntry]: {
116
+ payload: Pick<CaseFileEntity, 'id'> & { entryId: string; reason: string; actor: DocumentActor };
117
+ response: CaseFileUpdateResponseEntity;
118
+ };
119
+ [CaseFilePatterns.share]: {
120
+ payload: Pick<CaseFileEntity, 'id'> & { employeeIds: string[]; actor: DocumentActor };
121
+ response: CaseFileUpdateResponseEntity;
122
+ };
123
+ [CaseFilePatterns.unshare]: {
124
+ payload: Pick<CaseFileEntity, 'id'> & { participantId: string; actor: DocumentActor };
125
+ response: CaseFileUpdateResponseEntity;
126
+ };
127
+ [CaseFilePatterns.close]: {
128
+ payload: Pick<CaseFileEntity, 'id'> & { note?: string | null; actor: DocumentActor };
129
+ response: CaseFileUpdateResponseEntity;
130
+ };
131
+ /** Archivo de una actuación del índice. Queda en el registro de accesos. */
132
+ [CaseFilePatterns.getEntryFile]: {
133
+ payload: Pick<CaseFileEntity, 'id'> & { entryId: string } & CaseFileActorPayload;
134
+ response: CaseFileEntryFileResponseEntity;
135
+ };
136
+ /** Metadatos y archivos para exportar el expediente completo. Queda en la trazabilidad y en el registro de accesos. */
137
+ [CaseFilePatterns.getExport]: {
138
+ payload: Pick<CaseFileEntity, 'id'> & CaseFileActorPayload;
139
+ response: CaseFileExportResponseEntity;
140
+ };
141
+ }