@acontplus/ng-config 2.0.2 → 2.0.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.
Files changed (2) hide show
  1. package/README.md +34 -29
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -224,15 +224,15 @@ export class LocalStorageTokenRepository implements AuthTokenRepository {
224
224
 
225
225
  ### BaseRepository
226
226
 
227
- Abstract base repository with common CRUD operations.
227
+ Interface for common CRUD operations.
228
228
 
229
229
  ```typescript
230
- export abstract class BaseRepository<T, ID> {
231
- abstract findById(id: ID): Promise<T | null>;
232
- abstract findAll(): Promise<T[]>;
233
- abstract create(entity: Omit<T, 'id'>): Promise<T>;
234
- abstract update(id: ID, entity: Partial<T>): Promise<T>;
235
- abstract delete(id: ID): Promise<void>;
230
+ export interface BaseRepository<TEntity = any, TId = number> {
231
+ findById(id: TId): Observable<TEntity>;
232
+ findAll(): Observable<TEntity[]>;
233
+ create(entity: Omit<TEntity, 'id'>): Observable<TEntity>;
234
+ update(id: TId, entity: Partial<TEntity>): Observable<TEntity>;
235
+ delete(id: TId): Observable<void>;
236
236
  }
237
237
  ```
238
238
 
@@ -242,6 +242,7 @@ export abstract class BaseRepository<T, ID> {
242
242
  import { BaseRepository } from '@acontplus/ng-config';
243
243
  import { Injectable } from '@angular/core';
244
244
  import { HttpClient } from '@angular/common/http';
245
+ import { Observable } from 'rxjs';
245
246
 
246
247
  interface User {
247
248
  id: number;
@@ -250,45 +251,49 @@ interface User {
250
251
  }
251
252
 
252
253
  @Injectable({ providedIn: 'root' })
253
- export class UserRepository extends BaseRepository<User, number> {
254
- constructor(private http: HttpClient) {
255
- super();
256
- }
254
+ export class UserRepository implements BaseRepository<User, number> {
255
+ constructor(private http: HttpClient) {}
257
256
 
258
- async findById(id: number): Promise<User | null> {
259
- return this.http.get<User>(`/api/users/${id}`).toPromise() || null;
257
+ findById(id: number): Observable<User> {
258
+ return this.http.get<User>(`/api/users/${id}`);
260
259
  }
261
260
 
262
- async findAll(): Promise<User[]> {
263
- return this.http.get<User[]>('/api/users').toPromise() || [];
261
+ findAll(): Observable<User[]> {
262
+ return this.http.get<User[]>('/api/users');
264
263
  }
265
264
 
266
- async create(user: Omit<User, 'id'>): Promise<User> {
267
- return this.http.post<User>('/api/users', user).toPromise() as Promise<User>;
265
+ create(user: Omit<User, 'id'>): Observable<User> {
266
+ return this.http.post<User>('/api/users', user);
268
267
  }
269
268
 
270
- async update(id: number, user: Partial<User>): Promise<User> {
271
- return this.http.put<User>(`/api/users/${id}`, user).toPromise() as Promise<User>;
269
+ update(id: number, user: Partial<User>): Observable<User> {
270
+ return this.http.put<User>(`/api/users/${id}`, user);
272
271
  }
273
272
 
274
- async delete(id: number): Promise<void> {
275
- await this.http.delete(`/api/users/${id}`).toPromise();
273
+ delete(id: number): Observable<void> {
274
+ return this.http.delete<void>(`/api/users/${id}`);
276
275
  }
277
276
  }
278
277
  ```
279
278
 
280
279
  ## Configuration Constants
281
280
 
282
- ### Authentication Constants
281
+ ### Authentication API
283
282
 
284
283
  ```typescript
285
- import { AUTH_CONSTANTS, CONFIG_CONSTANTS } from '@acontplus/ng-config';
284
+ import { AUTH_API } from '@acontplus/ng-config';
285
+
286
+ // Authentication API paths
287
+ const authPath = AUTH_API.AUTH; // 'auth/'
288
+ ```
286
289
 
287
- // Authentication configuration
288
- const tokenExpiry = AUTH_CONSTANTS.TOKEN_EXPIRY_TIME;
289
- const refreshThreshold = AUTH_CONSTANTS.REFRESH_THRESHOLD;
290
+ ### Default Configuration
291
+
292
+ ```typescript
293
+ import { DEFAULT_CONFIG } from '@acontplus/ng-config';
290
294
 
291
- // Application configuration
292
- const apiTimeout = CONFIG_CONSTANTS.DEFAULT_API_TIMEOUT;
293
- const retryAttempts = CONFIG_CONSTANTS.MAX_RETRY_ATTEMPTS;
295
+ // Full application defaults
296
+ const apiTimeout = DEFAULT_CONFIG.apiTimeout; // 30000
297
+ const retryAttempts = DEFAULT_CONFIG.retryAttempts; // 2
298
+ const enableCorrelationTracking = DEFAULT_CONFIG.enableCorrelationTracking; // true
294
299
  ```
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@acontplus/ng-config",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Angular configuration management library providing environment tokens, application settings, dependency injection patterns, and runtime configuration services for enterprise applications.",
5
5
  "peerDependencies": {
6
- "@acontplus/core": "^1.1.3",
6
+ "@acontplus/core": "^1.1.4",
7
7
  "@angular/common": "^21.0.0",
8
8
  "@angular/core": "^21.0.0"
9
9
  },
@@ -43,12 +43,12 @@
43
43
  "author": "Ivan Paz <ifer343@gmail.com>",
44
44
  "license": "MIT",
45
45
  "bugs": {
46
- "url": "https://github.com/Acontplus-S-A-S/acontplus-libs/issues"
46
+ "url": "https://github.com/acontplus/acontplus-libs/issues"
47
47
  },
48
- "homepage": "https://github.com/Acontplus-S-A-S/acontplus-libs#readme",
48
+ "homepage": "https://github.com/acontplus/acontplus-libs#readme",
49
49
  "repository": {
50
50
  "type": "git",
51
- "url": "git+https://github.com/Acontplus-S-A-S/acontplus-libs.git"
51
+ "url": "git+https://github.com/acontplus/acontplus-libs.git"
52
52
  },
53
53
  "release": {
54
54
  "branches": [