@acontplus/ng-infrastructure 1.0.8 → 1.1.0
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.
- package/README.md +320 -45
- package/fesm2022/acontplus-ng-infrastructure.mjs +45 -71
- package/fesm2022/acontplus-ng-infrastructure.mjs.map +1 -1
- package/index.d.ts +11 -54
- package/package.json +23 -9
package/index.d.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
|
+
import { HttpContextToken, HttpInterceptorFn, HttpContext, HttpRequest, HttpClient } from '@angular/common/http';
|
|
1
2
|
import * as i0 from '@angular/core';
|
|
2
3
|
import { InjectionToken } from '@angular/core';
|
|
3
|
-
import { UserData, PaginationParams, PagedResult, HttpPort, HttpOptions } from '@acontplus/core';
|
|
4
|
-
import { HttpContextToken, HttpInterceptorFn, HttpContext, HttpRequest, HttpClient } from '@angular/common/http';
|
|
5
4
|
import { Observable } from 'rxjs';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
getToken(): string | null;
|
|
9
|
-
isAuthenticated(): boolean;
|
|
10
|
-
getRefreshToken?(): string | null;
|
|
11
|
-
getUserData(): UserData | null;
|
|
12
|
-
}
|
|
13
|
-
declare const TOKEN_PROVIDER: InjectionToken<ITokenProvider>;
|
|
5
|
+
import { RepositoryConfig, PaginationParams, PagedResult, HttpPort, HttpOptions, CoreConfig } from '@acontplus/core';
|
|
6
|
+
import { BaseRepository, SearchableRepository } from '@acontplus/ng-config';
|
|
14
7
|
|
|
15
8
|
declare const SKIP_NOTIFICATION: HttpContextToken<boolean>;
|
|
16
9
|
declare const SHOW_NOTIFICATIONS: HttpContextToken<boolean | undefined>;
|
|
@@ -84,22 +77,6 @@ declare class ActiveRequestsTracker {
|
|
|
84
77
|
*/
|
|
85
78
|
declare const spinnerInterceptor: HttpInterceptorFn;
|
|
86
79
|
|
|
87
|
-
interface Repository<TEntity = any, TId = number> {
|
|
88
|
-
getById?(id: TId): Observable<TEntity>;
|
|
89
|
-
getAll?(pagination?: PaginationParams): Observable<PagedResult<TEntity>>;
|
|
90
|
-
create?(entity: Partial<TEntity>): Observable<TEntity>;
|
|
91
|
-
update?(id: TId, entity: Partial<TEntity>): Observable<TEntity>;
|
|
92
|
-
remove?(id: TId): Observable<void>;
|
|
93
|
-
}
|
|
94
|
-
interface SearchableRepository<TEntity = any, TId = number> extends Repository<TEntity, TId> {
|
|
95
|
-
search?(query: string, pagination: PaginationParams): Observable<PagedResult<TEntity>>;
|
|
96
|
-
}
|
|
97
|
-
interface RepositoryConfig {
|
|
98
|
-
endpoint: string;
|
|
99
|
-
baseUrl?: string;
|
|
100
|
-
version?: string;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
80
|
declare abstract class BaseHttpRepository {
|
|
104
81
|
protected http: HttpClient;
|
|
105
82
|
protected abstract config: RepositoryConfig;
|
|
@@ -114,7 +91,7 @@ declare abstract class BaseHttpRepository {
|
|
|
114
91
|
}
|
|
115
92
|
|
|
116
93
|
declare const REPOSITORY_CONFIG: InjectionToken<RepositoryConfig>;
|
|
117
|
-
declare class GenericRepository<TEntity = any, TId extends string | number = number> extends BaseHttpRepository implements
|
|
94
|
+
declare class GenericRepository<TEntity = any, TId extends string | number = number> extends BaseHttpRepository implements BaseRepository<TEntity, TId> {
|
|
118
95
|
protected config: RepositoryConfig;
|
|
119
96
|
constructor();
|
|
120
97
|
getById(id: TId): Observable<TEntity>;
|
|
@@ -134,7 +111,7 @@ declare class SearchableGenericRepository<TEntity = any, TId extends string | nu
|
|
|
134
111
|
|
|
135
112
|
declare class RepositoryFactory {
|
|
136
113
|
private http;
|
|
137
|
-
create<TEntity, TId extends string | number = number>(config: RepositoryConfig):
|
|
114
|
+
create<TEntity, TId extends string | number = number>(config: RepositoryConfig): BaseRepository<TEntity, TId>;
|
|
138
115
|
static ɵfac: i0.ɵɵFactoryDeclaration<RepositoryFactory, never>;
|
|
139
116
|
static ɵprov: i0.ɵɵInjectableDeclaration<RepositoryFactory>;
|
|
140
117
|
}
|
|
@@ -155,26 +132,6 @@ declare class AngularHttpAdapter implements HttpPort {
|
|
|
155
132
|
delete<T>(url: string, options?: HttpOptions): Promise<T>;
|
|
156
133
|
}
|
|
157
134
|
|
|
158
|
-
interface CoreConfig {
|
|
159
|
-
apiBaseUrl?: string;
|
|
160
|
-
apiTimeout?: number;
|
|
161
|
-
retryAttempts?: number;
|
|
162
|
-
retryDelay?: number;
|
|
163
|
-
enableCorrelationTracking?: boolean;
|
|
164
|
-
enableRequestLogging?: boolean;
|
|
165
|
-
enableErrorLogging?: boolean;
|
|
166
|
-
enableToastNotifications?: boolean;
|
|
167
|
-
includeAuthToken?: boolean;
|
|
168
|
-
authTokenHeader?: string;
|
|
169
|
-
enableMultiTenancy?: boolean;
|
|
170
|
-
tenantIdHeader?: string;
|
|
171
|
-
logLevel?: 'debug' | 'info' | 'warn' | 'error';
|
|
172
|
-
enableConsoleLogging?: boolean;
|
|
173
|
-
customHeaders?: Record<string, string | (() => string)>;
|
|
174
|
-
excludeUrls?: string[];
|
|
175
|
-
excludeMethods?: string[];
|
|
176
|
-
}
|
|
177
|
-
declare const CORE_CONFIG: InjectionToken<CoreConfig>;
|
|
178
135
|
declare class CoreConfigService {
|
|
179
136
|
private config;
|
|
180
137
|
private environment;
|
|
@@ -223,12 +180,12 @@ declare class CoreConfigService {
|
|
|
223
180
|
static ɵprov: i0.ɵɵInjectableDeclaration<CoreConfigService>;
|
|
224
181
|
}
|
|
225
182
|
declare function provideCoreConfig(config?: Partial<CoreConfig>): {
|
|
226
|
-
provide: InjectionToken<CoreConfig>;
|
|
183
|
+
provide: i0.InjectionToken<CoreConfig>;
|
|
227
184
|
useValue: Partial<CoreConfig>;
|
|
228
185
|
}[];
|
|
229
186
|
declare function createCoreConfig(overrides?: Partial<CoreConfig>): CoreConfig;
|
|
230
187
|
|
|
231
|
-
declare class
|
|
188
|
+
declare class CorrelationInfo {
|
|
232
189
|
private correlationId;
|
|
233
190
|
private readonly CORRELATION_KEY;
|
|
234
191
|
readonly currentCorrelationId: i0.Signal<string | null>;
|
|
@@ -236,8 +193,8 @@ declare class CorrelationService {
|
|
|
236
193
|
setCorrelationId(correlationId: string): void;
|
|
237
194
|
resetCorrelationId(): void;
|
|
238
195
|
getId(): string;
|
|
239
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<
|
|
240
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<
|
|
196
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CorrelationInfo, never>;
|
|
197
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CorrelationInfo>;
|
|
241
198
|
}
|
|
242
199
|
|
|
243
200
|
declare class LoggingService {
|
|
@@ -273,5 +230,5 @@ declare abstract class Query<TRequest, TResponse> extends BaseUseCase<TRequest,
|
|
|
273
230
|
protected abstract executeInternal(request: TRequest): Observable<TResponse>;
|
|
274
231
|
}
|
|
275
232
|
|
|
276
|
-
export { ActiveRequestsTracker, AngularHttpAdapter, BaseHttpRepository, BaseUseCase,
|
|
277
|
-
export type {
|
|
233
|
+
export { ActiveRequestsTracker, AngularHttpAdapter, BaseHttpRepository, BaseUseCase, Command, CoreConfigService, CorrelationInfo, GenericRepository, HTTP_CONTEXT_CONFIG, LoggingService, Query, REPOSITORY_CONFIG, RepositoryFactory, SHOW_NOTIFICATIONS, SKIP_NOTIFICATION, SearchableGenericRepository, apiInterceptor, createCoreConfig, createHttpContextConfig, customUrl, httpContextInterceptor, provideCoreConfig, provideHttpContext, skipContextHeaders, spinnerInterceptor, withCustomHeaders, withoutSpinner };
|
|
234
|
+
export type { HttpContextConfig, HttpErrorLog, HttpRequestLog, UseCase };
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acontplus/ng-infrastructure",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Angular infrastructure library implementing clean architecture patterns with HTTP interceptors, repository implementations, adapters, dependency injection providers, and core infrastructure services for enterprise applications.",
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@acontplus/core": "^1.0
|
|
7
|
-
"@acontplus/ng-config": "^1.0
|
|
8
|
-
"@acontplus/ng-notifications": "^1.0
|
|
9
|
-
"@acontplus/ng-components": "^1.
|
|
6
|
+
"@acontplus/core": "^1.1.0",
|
|
7
|
+
"@acontplus/ng-config": "^1.1.0",
|
|
8
|
+
"@acontplus/ng-notifications": "^1.1.0",
|
|
9
|
+
"@acontplus/ng-components": "^1.3.0",
|
|
10
10
|
"@angular/common": "^20.3.2",
|
|
11
11
|
"@angular/core": "^20.3.2"
|
|
12
12
|
},
|
|
@@ -32,14 +32,28 @@
|
|
|
32
32
|
"angular",
|
|
33
33
|
"infrastructure",
|
|
34
34
|
"http-interceptors",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
35
|
+
"api-interceptor",
|
|
36
|
+
"spinner-interceptor",
|
|
37
|
+
"http-context-interceptor",
|
|
38
|
+
"base-repository",
|
|
39
|
+
"generic-repository",
|
|
40
|
+
"repository-factory",
|
|
41
|
+
"angular-http-adapter",
|
|
42
|
+
"correlation-service",
|
|
43
|
+
"logging-service",
|
|
44
|
+
"tenant-service",
|
|
45
|
+
"core-config-service",
|
|
46
|
+
"base-use-case",
|
|
47
|
+
"commands",
|
|
48
|
+
"queries",
|
|
49
|
+
"cqrs",
|
|
37
50
|
"ddd",
|
|
38
51
|
"clean-architecture",
|
|
52
|
+
"hexagonal-architecture",
|
|
39
53
|
"dependency-injection",
|
|
40
54
|
"typescript",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
55
|
+
"enterprise",
|
|
56
|
+
"frontend"
|
|
43
57
|
],
|
|
44
58
|
"author": "Ivan Paz <ifer343@gmail.com>",
|
|
45
59
|
"license": "MIT",
|