Version: 1.0
Fecha: 07 de Abril, 2026
Contexto: Documentacion tecnica de la libreria @nebula/vault v0.1.0, creada como paquete Angular standalone (ng-packagr) siguiendo el patron de nebula-ui-kit. Contiene los modelos de dominio, servicios de acceso a datos y facade publica para integracion con nebula-erp.
Arquitecto: Carlos Alberto Torres Camargo
Clasificacion: Interno — Arquitectura
Repositorio: https://gitlab.centricasoluciones.com/nebula/vault/vault.git (branch develop)
Documentar la estructura, contenido y uso de la libreria @nebula/vault — el paquete npm que encapsula el dominio de gestion documental de Nebula Vault para ser consumido tanto por el workspace nebula-vault (aplicacion) como por nebula-erp en el futuro.
Este documento complementa el analisis de REQUERIMIENTOS_LIBRERIAS_NEBULA_PARA_VAULT con la implementacion real de la libreria.
EQUIPO FRONTEND PRIMARIO EQUIPO NEBULA VAULT
──────────────────────── ─────────────────────
Mantiene: Mantiene:
nebula-ui-kit v0.2.1+ @nebula/vault v0.1.0
nebula-erp/libs/shared/* nebula-vault (workspace Nx)
Consume en el futuro: Consume:
@nebula/vault ◄─────────────────────── nebula-ui-kit
@nebula/shared/*
| Aspecto |
Valor |
| Nombre npm |
@nebula/vault |
| Version |
0.1.0 |
| Build system |
ng-packagr 21.2.0 |
| Angular |
^21.0.0 (peer dependency) |
| RxJS |
^7.8.0 (peer dependency) |
| TypeScript |
~5.9.2 |
| Patron seguido |
nebula-ui-kit (Angular CLI library) |
| Compilacion |
Partial compilation mode |
| Ruta local |
/code/centrica/vault/vault/ |
| Ruta build |
dist/nebula-vault/ |
vault/
├── angular.json Configuracion Angular CLI
├── package.json Dependencias del workspace
├── tsconfig.json TypeScript base + path aliases
├── .editorconfig Convenciones de formato
├── .gitignore Exclusiones git
└── projects/
└── nebula-vault/
├── ng-package.json Configuracion ng-packagr
├── package.json Metadata del paquete npm (@nebula/vault)
├── tsconfig.lib.json Compilacion desarrollo
├── tsconfig.lib.prod.json Compilacion produccion (partial)
├── tsconfig.spec.json Configuracion tests
└── src/
├── public-api.ts Barrel exports (API publica)
└── lib/
├── domain/ Interfaces y tipos TypeScript
├── data-access/ Servicios Angular (HttpClient)
└── api/ VaultFacade (punto de entrada)
¶ 2. CAPA DOMAIN — MODELOS DE DOMINIO
Interfaces TypeScript migradas 1:1 desde los schemas Pydantic del backend FastAPI (datavault-backend/app/schemas/). Cada modelo incluye las variantes *Create y *Update cuando aplica.
| Archivo |
Interfaces |
Tipos Literales |
Origen Backend |
employee.model.ts |
Employee, EmployeeCreate, EmployeeUpdate |
EmployeeStatus (active, inactive, terminated) |
schemas/employee.py |
contract.model.ts |
Contract, ContractCreate, ContractUpdate |
ContractType (indefinido, fijo, obra_labor, prestacion_servicios), ContractStatus |
schemas/contract.py |
certification.model.ts |
Certification, CertificationCreate, CertificationUpdate |
CertificationStatus (valid, expired, pending_renewal) |
schemas/certification.py |
training.model.ts |
Training, TrainingCreate, TrainingUpdate |
TrainingType (curso, taller, seminario, certificacion), TrainingStatus |
schemas/training.py |
absence.model.ts |
Absence, AbsenceCreate, AbsenceUpdate, AbsenceApproval |
AbsenceType (vacaciones, incapacidad, permiso, licencia), AbsenceStatus |
schemas/absence.py |
hr-document.model.ts |
HRDocument, HRDocumentCreate |
HRDocumentType (hoja_vida, cedula, diploma, certificado_bancario, eps, pension, otro) |
schemas/hr_document.py |
| Archivo |
Interfaces |
Tipos Literales |
Origen Backend |
user.model.ts |
User, UserCreate, UserUpdate, UserTenantInfo, LoginRequest, TokenResponse, ProfileUpdate, ChangePasswordRequest |
UserRole (admin_empresa, rh, archivista, auditor, consulta) |
schemas/user.py |
tenant.model.ts |
Tenant, TenantCreate, TenantUpdate, TenantRequest, TenantRequestCreate |
— |
schemas/tenant.py |
password-reset.model.ts |
PasswordResetRequest, PasswordResetConfirm |
— |
schemas/password_reset.py |
| Archivo |
Interfaces |
Tipos Literales |
Origen Backend |
project.model.ts |
Project, ProjectCreate, ProjectUpdate |
— |
models/ingest.py (Project) |
ingest.model.ts |
Ingest, IngestCreate, IngestUpdate, UploadProgress |
IngestStatus (new, staged, backuped, completed, error) |
models/ingest.py (Ingest) |
repository.model.ts |
RepositoryItem, RepositoryTree, RepositorySearchResult |
— |
api/repository.py (inline) |
preservation.model.ts |
PreservationStatus, PreservationStatusSummary, FilePreservationStatus, DiagnosticResult, PreservationStatistics |
PreservationFileStatus (optimal, attention, critical, unverified) |
api/preservation.py (inline) |
document-retention.model.ts |
RetentionPolicy, RetentionPolicyCreate, RetentionPolicyUpdate, DocumentRetention, DocumentRetentionCreate, DocumentRetentionUpdate, RetentionStats, ExpiringDocument |
RetentionPeriodUnit, DispositionAction, RetentionDocumentType, DocumentRetentionStatus |
schemas/document_retention.py |
legal-hold.model.ts |
LegalHold, LegalHoldCreate, LegalHoldUpdate, LegalHoldDocument, LegalHoldDocumentCreate, LegalHoldWithDocuments |
LegalHoldStatus, LegalHoldDocumentType |
schemas/legal_hold.py |
cloud.model.ts |
CloudSyncStatus, CloudDaemonStatus, CloudDaemonStats |
— |
api/cloud.py (inline) |
| Archivo |
Interfaces |
Tipos Literales |
Origen Backend |
notification.model.ts |
Notification, NotificationCreate |
NotificationType (alert, info, warning, success) |
schemas/notification.py |
audit-log.model.ts |
AuditLog, AuditUserInfo, AuditTenantInfo |
AuditAction (CREATE, UPDATE, DELETE, LOGIN, LOGOUT) |
schemas/audit_log.py |
file-assignment.model.ts |
FileAssignment, FileAssignmentCreate, FileAssignmentBulkCreate |
— |
schemas/file_assignment.py |
module-permission.model.ts |
ModulePermission, ModulePermissionCreate, ModulePermissionUpdate, FolderPermission, FolderPermissionCreate |
— |
schemas/module_permission.py |
preservation-message.model.ts |
PreservationMessage, PreservationMessageCreate, PreservationMessageUpdate |
AudienceScope (all, role, tenant) |
schemas/preservation_message.py |
dashboard.model.ts |
DashboardStats, SystemStats, HRStats, DocumentStats, AuditStats, DashboardTask, RecentActivity |
— |
api/dashboard.py (inline) |
| Metrica |
Valor |
Archivos .model.ts |
22 |
| Interfaces totales |
78 |
| Tipos literales (union types) |
18 |
| Schemas Pydantic migrados |
16 archivos |
| Endpoints del backend cubiertos |
~90+ |
Todos los servicios siguen el mismo patron:
@Injectable({ providedIn: 'root' })
export class XxxService {
private readonly http = inject(HttpClient);
private readonly baseUrl = '/api/xxx';
// metodos tipados que retornan Observable<T>
}
Convenciones:
inject(HttpClient) (inyeccion funcional, no constructor)
providedIn: 'root' (tree-shakeable)
- Parametros opcionales via
HttpParams
- Uploads via
FormData
- Descargas retornan
Observable<Blob>
| Servicio |
Base URL |
Metodos |
Endpoints Cubiertos |
EmployeeService |
/api/employees |
list, get, create, update, delete, search |
6 |
ContractService |
/api/contracts |
list, get, create, update, delete, getByEmployee |
6 |
CertificationService |
/api/certifications |
list, get, create, update, delete, getByEmployee |
6 |
TrainingService |
/api/trainings |
list, get, create, update, delete, getByEmployee |
6 |
AbsenceService |
/api/absences |
list, get, create, update, approve, delete, getByEmployee, importExcel |
8 |
HRDocumentService |
/api/hr-documents |
list, get, upload, download, delete, getByEmployee |
6 |
| Servicio |
Base URL |
Metodos |
Endpoints Cubiertos |
ProjectService |
/api/ingest/projects |
list, get, create, update, delete |
5 |
IngestService |
/api/ingest |
list, get, upload, update, delete |
5 |
RepositoryService |
/api/repository |
list, getTree, get, createFolder, delete, move, download, downloadMultiple, search |
9 |
PreservationService |
/api/preservation |
getStatus, getFileStatus, markAsOptimal, diagnoseFile, repairFile, getCriticalFiles, getAttentionFiles, getOptimalFiles, getStatistics, verifyFiles |
10 |
RetentionService |
/api/document-retention |
listPolicies, getPolicy, createPolicy, updatePolicy, deletePolicy, listRetentions, getRetention, createRetention, updateRetention, deleteRetention, suspendRetention, resumeRetention, getStats, getExpiringDocuments, getAvailableDocuments, getDocumentsFromServer, createRetentionByPath, detectFilesByPolicy, auditServerFiles |
19 |
LegalHoldService |
/api/legal-hold |
list, get, create, update, close, reopen, addDocument, removeDocument, addDocumentByPath, getAvailableDocuments, getDocumentsFromServer, checkDocument |
12 |
CloudService |
/api/cloud |
getSyncStatus, uploadFiles, getDaemonStatus, startDaemon, stopDaemon, getDaemonStats, getDaemonLogs |
7 |
| Servicio |
Base URL |
Metodos |
Endpoints Cubiertos |
VaultNotificationService |
/api/notifications |
list, get, create, markAsRead, markAllAsRead, getUnreadCount, delete |
7 |
AuditService |
/api/audit |
list, getGlobal, export |
3 |
DashboardService |
/api/dashboard |
getStats, getTasks |
2 |
FileAssignmentService |
/api/file-assignments |
list, get, create, bulkCreate, delete |
5 |
ModulePermissionService |
/api/module-permissions |
list, get, create, update, delete, getByUser, addFolder, removeFolder |
8 |
PreservationMessageService |
/api/preservation-messages |
list, get, create, update, delete, getActive |
6 |
TenantService |
/api/tenants |
list, get, create, update, delete |
5 |
| Metrica |
Valor |
| Servicios totales |
20 |
| Metodos totales |
141 |
| Endpoints backend cubiertos |
~90+ de ~90+ (cobertura completa) |
Nota: VaultNotificationService usa el prefijo Vault para evitar colision con posibles NotificationService de @nebula/shared o del framework.
VaultFacade es el punto de entrada unico que nebula-erp consumira en el futuro. Orquesta los servicios internos y expone una API simplificada para los casos de uso mas comunes.
| Categoria |
Metodo |
Retorna |
Servicio Interno |
| Projects |
getProjects() |
Observable<Project[]> |
ProjectService.list() |
|
getProject(id) |
Observable<Project> |
ProjectService.get() |
|
createProject(data) |
Observable<Project> |
ProjectService.create() |
| Ingest |
uploadFiles(projectId, file, subfolder?) |
Observable<Ingest> |
IngestService.upload() |
|
getIngestStatus(ingestId) |
Observable<Ingest> |
IngestService.get() |
| Repository |
browseFiles(path?) |
Observable<RepositoryItem[]> |
RepositoryService.list() |
|
searchFiles(query) |
Observable<RepositorySearchResult[]> |
RepositoryService.search() |
|
downloadFile(filePath) |
Observable<Blob> |
RepositoryService.download() |
| Preservation |
getPreservationStatus() |
Observable<PreservationStatus> |
PreservationService.getStatus() |
|
getFilePreservationStatus(filePath) |
Observable<FilePreservationStatus> |
PreservationService.getFileStatus() |
|
runDiagnostic(filePath) |
Observable<DiagnosticResult> |
PreservationService.diagnoseFile() |
| Retention |
getRetentionPolicies() |
Observable<RetentionPolicy[]> |
RetentionService.listPolicies() |
|
getDocumentsUnderRetention() |
Observable<DocumentRetention[]> |
RetentionService.listRetentions() |
|
getRetentionStats() |
Observable<RetentionStats> |
RetentionService.getStats() |
|
getExpiringDocuments(days?) |
Observable<ExpiringDocument[]> |
RetentionService.getExpiringDocuments() |
| Legal Hold |
getLegalHolds() |
Observable<LegalHold[]> |
LegalHoldService.list() |
|
getLegalHold(id) |
Observable<LegalHoldWithDocuments> |
LegalHoldService.get() |
|
assignDocumentToHold(holdId, data) |
Observable<LegalHoldDocument> |
LegalHoldService.addDocument() |
| Cloud |
getCloudStatus() |
Observable<CloudSyncStatus> |
CloudService.getSyncStatus() |
| Dashboard |
getDashboardStats() |
Observable<DashboardStats> |
DashboardService.getStats() |
// En cualquier feature de nebula-erp:
import { Project, PreservationStatus } from '@nebula/vault';
import { VaultFacade } from '@nebula/vault';
@Component({
selector: 'app-document-widget',
standalone: true,
template: `
@if (projects(); as list) {
<neb-table [config]="tableConfig" [data]="list" />
}
`
})
export class DocumentWidgetComponent {
private vault = inject(VaultFacade);
projects = toSignal(this.vault.getProjects());
}
Nota: Para operaciones avanzadas (CRUD completo, filtros, paginacion) se pueden importar los servicios individuales directamente desde @nebula/vault.
Los exports estan organizados por categoria:
@nebula/vault
├── Domain (22 modelos)
│ ├── HR: Employee, Contract, Certification, Training, Absence, HRDocument
│ ├── Auth: User, Tenant, PasswordReset
│ ├── Docs: Project, Ingest, Repository, Preservation, Retention, LegalHold, Cloud
│ └── System: Notification, AuditLog, FileAssignment, ModulePermission, PreservationMessage, Dashboard
├── Data-Access (20 servicios)
│ ├── HR: EmployeeService, ContractService, CertificationService, TrainingService, AbsenceService, HRDocumentService
│ ├── Docs: ProjectService, IngestService, RepositoryService, PreservationService, RetentionService, LegalHoldService, CloudService
│ └── System: VaultNotificationService, AuditService, DashboardService, FileAssignmentService, ModulePermissionService, PreservationMessageService, TenantService
└── API
└── VaultFacade
@nebula/vault/domain → No depende de nada (leaf node, solo tipos)
@nebula/vault/data-access → Depende de: @nebula/vault/domain, @angular/common/http
@nebula/vault/api → Depende de: @nebula/vault/data-access, @nebula/vault/domain
La app consumidora (nebula-vault workspace o nebula-erp) es responsable de:
- Configurar
provideHttpClient(withInterceptors([tokenInterceptor, errorInterceptor]))
- Inyectar el token JWT via interceptor (de
@nebula/shared/data-access)
- Configurar la base URL del API Gateway
| Capa Backend (FastAPI) |
Capa Frontend (@nebula/vault) |
Transformacion |
app/schemas/*.py (Pydantic BaseModel) |
lib/domain/*.model.ts (interfaces) |
UUID → string, datetime → string, Optional → ?, Decimal → number, Enum → union type |
app/api/*.py (FastAPI routers) |
lib/data-access/*.service.ts (Angular services) |
Endpoints → metodos HttpClient tipados, path params → argumentos, query params → HttpParams |
| — (nuevo) |
lib/api/vault.facade.ts |
Orquestacion de servicios para consumo simplificado |
| Version |
Fecha |
Autor |
Descripcion |
| 1.0.0 |
2026-04-07 |
Carlos Torres |
Creacion del documento. Libreria @nebula/vault v0.1.0: 22 modelos domain, 20 servicios data-access (141 metodos, ~90+ endpoints), VaultFacade. Build exitoso con ng-packagr 21.2.0 |