ngx-dsxlibrary 2.21.2 → 2.21.3

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.
@@ -3258,7 +3258,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImpor
3258
3258
  /**
3259
3259
  * Servicio genérico para consumir endpoints REST de la API.
3260
3260
  *
3261
- * @typeParam T Tipo de dato que representa el recurso manejado por el endpoint.
3261
+ * @typeParam T Tipo base de la entidad. Puede sobrescribirse por método.
3262
3262
  */
3263
3263
  class EndpointService {
3264
3264
  /** Cliente HTTP de Angular utilizado para realizar las peticiones. */
@@ -3277,9 +3277,10 @@ class EndpointService {
3277
3277
  /**
3278
3278
  * Obtiene un listado de recursos del endpoint especificado.
3279
3279
  *
3280
+ * @typeParam TList Tipo de cada elemento del listado (por defecto `T`).
3280
3281
  * @param endpoint Segmento del endpoint (sin la parte de `api/`).
3281
3282
  * @param invalidateCache Indica si se invalida la caché del lado del servidor.
3282
- * @returns Observable con un arreglo de elementos del tipo `T`.
3283
+ * @returns Observable con un arreglo de elementos del tipo `TList`.
3283
3284
  */
3284
3285
  list(endpoint, invalidateCache = false) {
3285
3286
  return this.http.get(`${this.getUrl(endpoint)}/listar/${invalidateCache}`);
@@ -3287,9 +3288,10 @@ class EndpointService {
3287
3288
  /**
3288
3289
  * Obtiene un recurso por su identificador.
3289
3290
  *
3291
+ * @typeParam TEdit Tipo del recurso retornado (por defecto `T`).
3290
3292
  * @param endpoint Segmento del endpoint (sin la parte de `api/`).
3291
3293
  * @param id Identificador del recurso a recuperar.
3292
- * @returns Observable con el elemento del tipo `T`.
3294
+ * @returns Observable con el elemento del tipo `TEdit`.
3293
3295
  */
3294
3296
  edit(endpoint, id) {
3295
3297
  return this.http.get(`${this.getUrl(endpoint)}/get-id/${id}`);
@@ -3297,9 +3299,11 @@ class EndpointService {
3297
3299
  /**
3298
3300
  * Crea o actualiza un recurso en el endpoint especificado.
3299
3301
  *
3302
+ * @typeParam TSave Tipo del payload enviado al backend (por defecto `T`).
3303
+ * @typeParam TResponse Tipo de la entidad en la respuesta (por defecto `T`).
3300
3304
  * @param endpoint Segmento del endpoint (sin la parte de `api/`).
3301
3305
  * @param values Objeto con los datos del recurso a guardar.
3302
- * @returns Observable con el resultado del servicio que envuelve al tipo `T`.
3306
+ * @returns Observable con el resultado del servicio que envuelve `TResponse`.
3303
3307
  */
3304
3308
  save(endpoint, values) {
3305
3309
  return this.http.put(`${this.getUrl(endpoint)}/save`, values);
@@ -3308,7 +3312,7 @@ class EndpointService {
3308
3312
  * Elimina un recurso del endpoint especificado.
3309
3313
  *
3310
3314
  * @param endpoint Segmento del endpoint (sin la parte de `api/`).
3311
- * @param id Identificador del recurso a eliminar.
3315
+ * @param id Identificador del recurso a eliminar (numérico o textual).
3312
3316
  * @param softDelete Indica si la eliminación es lógica (por defecto) o física.
3313
3317
  * @returns Observable con el modelo de respuesta HTTP genérico.
3314
3318
  */
@@ -3325,19 +3329,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImpor
3325
3329
  }]
3326
3330
  }] });
3327
3331
 
3332
+ /**
3333
+ * Clase base para servicios CRUD tipados.
3334
+ *
3335
+ * @typeParam TBase Modelo base que representa la entidad principal.
3336
+ * @typeParam TEdit Modelo de respuesta para la operación de edición/consulta por id.
3337
+ * @typeParam TSave Modelo de entrada para guardar (create/update).
3338
+ * @typeParam TList Modelo de cada elemento del listado.
3339
+ * @typeParam TDelete Tipo del identificador usado para eliminar (number o string).
3340
+ */
3328
3341
  class BaseCRUDService {
3329
- _endpointService = inject((EndpointService));
3342
+ /** Servicio HTTP base para operaciones REST. */
3343
+ _endpointService = inject(EndpointService);
3344
+ /**
3345
+ * Obtiene el listado de registros.
3346
+ * @param invalidateCache Si es true, solicita invalidar caché en backend.
3347
+ */
3330
3348
  list(invalidateCache = false) {
3331
3349
  return this._endpointService.list(this.endpoint, invalidateCache);
3332
3350
  }
3351
+ /**
3352
+ * Obtiene un registro por id para edición.
3353
+ * @param id Identificador numérico del registro.
3354
+ */
3333
3355
  edit(id) {
3334
3356
  return this._endpointService.edit(this.endpoint, id);
3335
3357
  }
3358
+ /**
3359
+ * Guarda un registro (creación o actualización).
3360
+ * @param values Payload tipado para persistir.
3361
+ */
3336
3362
  save(values) {
3337
3363
  return this._endpointService.save(this.endpoint, values);
3338
3364
  }
3339
- delete(id, softDelete = true) {
3340
- return this._endpointService.delete(this.endpoint, id, softDelete);
3365
+ /**
3366
+ * Elimina un registro por identificador.
3367
+ * @param value Identificador del registro a eliminar.
3368
+ * @param softDelete Si es true, realiza eliminación lógica.
3369
+ */
3370
+ delete(value, softDelete = true) {
3371
+ return this._endpointService.delete(this.endpoint, value, softDelete);
3341
3372
  }
3342
3373
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: BaseCRUDService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3343
3374
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: BaseCRUDService, providedIn: 'root' });