@flusys/ng-core 1.1.0 → 1.2.0-rc.1
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 +89 -568
- package/fesm2022/flusys-ng-core.mjs +51 -217
- package/fesm2022/flusys-ng-core.mjs.map +1 -1
- package/package.json +6 -6
- package/types/flusys-ng-core.d.ts +55 -167
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Signal, InjectionToken } from '@angular/core';
|
|
3
|
-
import { HttpRequest, HttpHandlerFn, HttpEvent,
|
|
3
|
+
import { HttpRequest, HttpHandlerFn, HttpEvent, HttpClient } from '@angular/common/http';
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
5
5
|
import * as _flusys_ng_core from '@flusys/ng-core';
|
|
6
6
|
|
|
@@ -15,10 +15,6 @@ declare class ApiLoaderService {
|
|
|
15
15
|
static ɵprov: i0.ɵɵInjectableDeclaration<ApiLoaderService>;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* Root configuration component providing global UI elements.
|
|
20
|
-
* Include once at app root for global toast, confirm dialog, and loader.
|
|
21
|
-
*/
|
|
22
18
|
declare class LibAppConfigComponent {
|
|
23
19
|
readonly apiLoaderService: ApiLoaderService;
|
|
24
20
|
static ɵfac: i0.ɵɵFactoryDeclaration<LibAppConfigComponent, never>;
|
|
@@ -39,119 +35,46 @@ declare class LibAppConfigComponent {
|
|
|
39
35
|
*/
|
|
40
36
|
declare function apiLoaderInterceptor(req: HttpRequest<unknown>, next: HttpHandlerFn): Observable<HttpEvent<unknown>>;
|
|
41
37
|
|
|
42
|
-
/**
|
|
43
|
-
* HTTP context token to skip global error toast.
|
|
44
|
-
* Use when component handles error display locally.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```typescript
|
|
48
|
-
* this.http.post(url, data, {
|
|
49
|
-
* context: new HttpContext().set(SKIP_ERROR_TOAST, true)
|
|
50
|
-
* });
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
declare const SKIP_ERROR_TOAST: HttpContextToken<boolean>;
|
|
54
|
-
/**
|
|
55
|
-
* Error Catching Interceptor
|
|
56
|
-
* Displays error messages for failed HTTP requests using backend response.
|
|
57
|
-
*
|
|
58
|
-
* Features:
|
|
59
|
-
* - Uses backend's error title (error.error.error) as summary
|
|
60
|
-
* - Uses backend's error message (error.error.message) as detail
|
|
61
|
-
* - Falls back to sensible defaults based on status code
|
|
62
|
-
* - Skip with SKIP_ERROR_TOAST context token for local handling
|
|
63
|
-
*
|
|
64
|
-
* NOTE: This interceptor only handles error display.
|
|
65
|
-
* For 401 handling and token refresh, use tokenRefreshInterceptor from @flusys/ng-auth.
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* ```typescript
|
|
69
|
-
* // In app.config.ts
|
|
70
|
-
* provideHttpClient(
|
|
71
|
-
* withFetch(),
|
|
72
|
-
* withInterceptors([
|
|
73
|
-
* authInterceptor, // from @flusys/ng-auth
|
|
74
|
-
* tokenRefreshInterceptor, // from @flusys/ng-auth
|
|
75
|
-
* errorCatchingInterceptor, // from @flusys/ng-core
|
|
76
|
-
* apiLoaderInterceptor, // from @flusys/ng-core
|
|
77
|
-
* ])
|
|
78
|
-
* )
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
|
-
declare function errorCatchingInterceptor(req: HttpRequest<unknown>, next: HttpHandlerFn): Observable<HttpEvent<unknown>>;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* IAM Permission Mode - controls permission system behavior
|
|
85
|
-
*/
|
|
86
38
|
type PermissionMode = 'rbac' | 'direct' | 'full';
|
|
87
|
-
|
|
88
|
-
* Service Configuration Interface
|
|
89
|
-
*/
|
|
39
|
+
type ServiceName = 'auth' | 'administration' | 'iam' | 'storage' | 'formBuilder' | 'email' | 'eventManager' | 'notification' | 'localization' | 'taskManager';
|
|
90
40
|
interface IServiceConfig {
|
|
91
41
|
baseUrl: string;
|
|
92
42
|
enabled: boolean;
|
|
93
43
|
}
|
|
94
|
-
/**
|
|
95
|
-
* Storage Service Configuration Interface
|
|
96
|
-
* Extends base service config with storage-specific options
|
|
97
|
-
*/
|
|
98
44
|
interface IStorageServiceConfig extends IServiceConfig {
|
|
99
|
-
/**
|
|
100
|
-
* Default storage config ID from backend storage_config table
|
|
101
|
-
* Used when no storageConfigId is provided to upload operations
|
|
102
|
-
* If not set, backend will use company/branch default config
|
|
103
|
-
*/
|
|
45
|
+
/** Default storage config ID (falls back to company/branch default if not set) */
|
|
104
46
|
defaultStorageConfigId?: string;
|
|
105
47
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
48
|
+
interface INotificationServiceConfig extends IServiceConfig {
|
|
49
|
+
/** WebSocket URL (defaults to baseUrl if not set) */
|
|
50
|
+
socketUrl?: string;
|
|
51
|
+
}
|
|
109
52
|
interface IAuthorConfig {
|
|
110
53
|
name: string;
|
|
111
54
|
url: string;
|
|
112
55
|
}
|
|
113
|
-
/**
|
|
114
|
-
* Registration Defaults Configuration
|
|
115
|
-
* Pre-fills and disables fields on registration page
|
|
116
|
-
*/
|
|
117
56
|
interface IRegistrationDefaults {
|
|
118
|
-
/** Pre-fill company code field and make it readonly */
|
|
119
57
|
companySlug?: string;
|
|
120
|
-
/** Pre-fill branch code field and make it readonly */
|
|
121
58
|
branchSlug?: string;
|
|
122
59
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
60
|
+
interface LayoutConfig {
|
|
61
|
+
preset?: string;
|
|
62
|
+
primary?: string;
|
|
63
|
+
surface?: string | null;
|
|
64
|
+
darkTheme?: boolean;
|
|
65
|
+
menuMode?: 'static' | 'overlay' | 'topbar';
|
|
66
|
+
isMemorable?: boolean;
|
|
67
|
+
}
|
|
127
68
|
interface IAppConfig {
|
|
128
|
-
/** Application name */
|
|
129
69
|
appName: string;
|
|
130
|
-
|
|
70
|
+
appLogo: string;
|
|
131
71
|
author?: IAuthorConfig;
|
|
132
|
-
/** Default API base URL (fallback) */
|
|
133
72
|
apiBaseUrl: string;
|
|
134
|
-
/**
|
|
135
|
-
* Enable company feature across the app
|
|
136
|
-
* When true, enables company selection/switching in layout and feature modules
|
|
137
|
-
*/
|
|
138
73
|
enableCompanyFeature: boolean;
|
|
139
|
-
/**
|
|
140
|
-
* Enable user sign-up/registration
|
|
141
|
-
* When false: hides "Sign Up" link on login page and protects registration route
|
|
142
|
-
* @default true
|
|
143
|
-
*/
|
|
74
|
+
/** @default true */
|
|
144
75
|
enableSignUp?: boolean;
|
|
145
|
-
/**
|
|
146
|
-
* Registration defaults for pre-filling company/branch fields
|
|
147
|
-
* When set: pre-fills fields and makes them readonly
|
|
148
|
-
*/
|
|
149
76
|
registrationDefaults?: IRegistrationDefaults;
|
|
150
|
-
|
|
151
|
-
* Service-specific base URLs
|
|
152
|
-
* If a service exists in this object, its feature is enabled
|
|
153
|
-
* Database mode is determined by multiTenant.enabled
|
|
154
|
-
*/
|
|
77
|
+
layoutConfig?: LayoutConfig;
|
|
155
78
|
services: {
|
|
156
79
|
auth: IServiceConfig;
|
|
157
80
|
administration: IServiceConfig;
|
|
@@ -159,93 +82,58 @@ interface IAppConfig {
|
|
|
159
82
|
storage: IStorageServiceConfig;
|
|
160
83
|
formBuilder: IServiceConfig;
|
|
161
84
|
email: IServiceConfig;
|
|
85
|
+
eventManager: IServiceConfig;
|
|
86
|
+
notification?: INotificationServiceConfig;
|
|
87
|
+
localization?: IServiceConfig;
|
|
88
|
+
taskManager?: IServiceConfig;
|
|
162
89
|
};
|
|
163
|
-
/**
|
|
164
|
-
* Multi-tenant configuration
|
|
165
|
-
* enabled: true → Database mode = multi-tenant
|
|
166
|
-
* enabled: false → Database mode = single
|
|
167
|
-
*/
|
|
168
90
|
multiTenant: {
|
|
169
91
|
enabled: boolean;
|
|
170
92
|
tenantHeader: string;
|
|
171
93
|
tenantId?: string;
|
|
172
94
|
};
|
|
173
|
-
/**
|
|
174
|
-
* IAM Permission Mode - controls permission system behavior
|
|
175
|
-
* - 'rbac': Role-Based Access Control only (users get permissions via roles)
|
|
176
|
-
* - 'direct': Direct action assignments only (actions assigned directly to users)
|
|
177
|
-
* - 'full': Both RBAC and direct permissions (most flexible, default)
|
|
178
|
-
*/
|
|
95
|
+
/** 'rbac' | 'direct' | 'full' (default: 'full') */
|
|
179
96
|
permissionMode?: PermissionMode;
|
|
180
97
|
}
|
|
181
|
-
/**
|
|
182
|
-
* App Configuration Token
|
|
183
|
-
* Use this to inject app config in services/components
|
|
184
|
-
*/
|
|
185
98
|
declare const APP_CONFIG: InjectionToken<IAppConfig>;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
* Derived from multiTenant.enabled
|
|
189
|
-
*/
|
|
190
|
-
declare function getDatabaseMode(config: IAppConfig): 'single' | 'multi-tenant';
|
|
191
|
-
/**
|
|
192
|
-
* Check if a service is enabled
|
|
193
|
-
*/
|
|
194
|
-
declare function isServiceEnabled(config: IAppConfig, serviceName: 'auth' | 'iam' | 'storage' | (string & {})): boolean;
|
|
195
|
-
/**
|
|
196
|
-
* Check if a feature is enabled (alias for isServiceEnabled with strict types)
|
|
197
|
-
*/
|
|
198
|
-
declare function isFeatureEnabled(config: IAppConfig, feature: 'auth' | 'administration' | 'iam' | 'storage' | 'formBuilder' | 'email'): boolean;
|
|
199
|
-
/**
|
|
200
|
-
* Get service base URL or fallback to default apiBaseUrl
|
|
201
|
-
*/
|
|
202
|
-
declare function getServiceUrl(config: IAppConfig, serviceName: 'auth' | 'administration' | 'iam' | 'storage' | 'formBuilder' | 'email' | (string & {})): string;
|
|
203
|
-
/**
|
|
204
|
-
* Check if company feature is enabled
|
|
205
|
-
*/
|
|
99
|
+
declare function isServiceEnabled(config: IAppConfig, serviceName: ServiceName): boolean;
|
|
100
|
+
declare function getServiceUrl(config: IAppConfig, serviceName: ServiceName): string;
|
|
206
101
|
declare function isCompanyFeatureEnabled(config: IAppConfig): boolean;
|
|
207
|
-
|
|
208
|
-
* Check if storage feature is enabled
|
|
209
|
-
*/
|
|
210
|
-
declare function isStorageFeatureEnabled(config: IAppConfig): boolean;
|
|
211
|
-
/**
|
|
212
|
-
* Check if form-builder feature is enabled
|
|
213
|
-
*/
|
|
214
|
-
declare function isFormBuilderFeatureEnabled(config: IAppConfig): boolean;
|
|
215
|
-
/**
|
|
216
|
-
* Check if email feature is enabled
|
|
217
|
-
*/
|
|
218
|
-
declare function isEmailFeatureEnabled(config: IAppConfig): boolean;
|
|
219
|
-
/**
|
|
220
|
-
* Get permission mode from config
|
|
221
|
-
* Defaults to 'full' if not specified
|
|
222
|
-
*/
|
|
102
|
+
declare function getNotificationSocketUrl(config: IAppConfig): string | null;
|
|
223
103
|
declare function getPermissionMode(config: IAppConfig): PermissionMode;
|
|
224
|
-
/**
|
|
225
|
-
* Get default storage config ID from config
|
|
226
|
-
* Used for file upload operations when no storageConfigId is provided
|
|
227
|
-
*/
|
|
228
104
|
declare function getDefaultStorageConfigId(config: IAppConfig): string | undefined;
|
|
229
|
-
/**
|
|
230
|
-
* Check if sign-up/registration is enabled
|
|
231
|
-
* @default true
|
|
232
|
-
*/
|
|
233
105
|
declare function isSignUpEnabled(config: IAppConfig): boolean;
|
|
234
|
-
/**
|
|
235
|
-
* Get default company slug for registration
|
|
236
|
-
*/
|
|
237
106
|
declare function getDefaultCompanySlug(config: IAppConfig): string | undefined;
|
|
238
|
-
/**
|
|
239
|
-
* Get default branch slug for registration
|
|
240
|
-
*/
|
|
241
107
|
declare function getDefaultBranchSlug(config: IAppConfig): string | undefined;
|
|
242
|
-
/**
|
|
243
|
-
* Get registration defaults
|
|
244
|
-
*/
|
|
245
|
-
declare function getRegistrationDefaults(config: IAppConfig): IRegistrationDefaults | undefined;
|
|
246
108
|
declare const DEFAULT_APP_NAME = "FLUSYS";
|
|
247
109
|
declare const DEFAULT_AUTHOR: IAuthorConfig;
|
|
248
110
|
|
|
111
|
+
interface ITranslateAdapter {
|
|
112
|
+
/** Current language code signal - read this to create reactive dependency */
|
|
113
|
+
translate(key: string, params?: Record<string, unknown>): string;
|
|
114
|
+
}
|
|
115
|
+
/** Registry for fallback messages when localization is not active */
|
|
116
|
+
declare const FALLBACK_MESSAGES_REGISTRY: InjectionToken<Record<string, string>>;
|
|
117
|
+
declare const provideFallbackMessagesRegistry: () => {
|
|
118
|
+
provide: InjectionToken<Record<string, string>>;
|
|
119
|
+
useValue: {};
|
|
120
|
+
};
|
|
121
|
+
interface ILocalizationStateServicesAdapter {
|
|
122
|
+
updateFallbackMessages(messages: Record<string, string>): void;
|
|
123
|
+
currentLanguageCode: Signal<string>;
|
|
124
|
+
isModuleLoaded(module: string): boolean;
|
|
125
|
+
mergeTranslations(translations: Record<string, string>): void;
|
|
126
|
+
markModuleLoaded(module: string): void;
|
|
127
|
+
currentLanguage: Signal<string>;
|
|
128
|
+
translations: Signal<Record<string, string>>;
|
|
129
|
+
fallbackMessages: Signal<Record<string, string>>;
|
|
130
|
+
}
|
|
131
|
+
interface ILocalizationApiServicesAdapter {
|
|
132
|
+
getTranslationsByLanguage(languageCode: string, modules: string[]): Observable<unknown>;
|
|
133
|
+
}
|
|
134
|
+
declare const LOCALIZATION_STATE_SERVICE: InjectionToken<ILocalizationStateServicesAdapter>;
|
|
135
|
+
declare const LOCALIZATION_API_SERVICE: InjectionToken<ILocalizationApiServicesAdapter>;
|
|
136
|
+
|
|
249
137
|
/**
|
|
250
138
|
* Base API Service
|
|
251
139
|
* Provides service-specific base URL resolution
|
|
@@ -273,7 +161,7 @@ declare abstract class BaseApiService {
|
|
|
273
161
|
/**
|
|
274
162
|
* @param serviceName - Service name from config (e.g., 'auth', 'iam', 'storage')
|
|
275
163
|
*/
|
|
276
|
-
constructor(serviceName:
|
|
164
|
+
constructor(serviceName: ServiceName);
|
|
277
165
|
/**
|
|
278
166
|
* Get full URL for an endpoint
|
|
279
167
|
* @param endpoint - API endpoint (e.g., '/users/get-all')
|
|
@@ -282,5 +170,5 @@ declare abstract class BaseApiService {
|
|
|
282
170
|
protected getUrl(endpoint: string): string;
|
|
283
171
|
}
|
|
284
172
|
|
|
285
|
-
export { APP_CONFIG, ApiLoaderService, BaseApiService, DEFAULT_APP_NAME, DEFAULT_AUTHOR,
|
|
286
|
-
export type { IAppConfig, IAuthorConfig, IRegistrationDefaults, IServiceConfig, IStorageServiceConfig, PermissionMode };
|
|
173
|
+
export { APP_CONFIG, ApiLoaderService, BaseApiService, DEFAULT_APP_NAME, DEFAULT_AUTHOR, FALLBACK_MESSAGES_REGISTRY, LOCALIZATION_API_SERVICE, LOCALIZATION_STATE_SERVICE, LibAppConfigComponent, apiLoaderInterceptor, getDefaultBranchSlug, getDefaultCompanySlug, getDefaultStorageConfigId, getNotificationSocketUrl, getPermissionMode, getServiceUrl, isCompanyFeatureEnabled, isServiceEnabled, isSignUpEnabled, provideFallbackMessagesRegistry };
|
|
174
|
+
export type { IAppConfig, IAuthorConfig, ILocalizationApiServicesAdapter, ILocalizationStateServicesAdapter, INotificationServiceConfig, IRegistrationDefaults, IServiceConfig, IStorageServiceConfig, ITranslateAdapter, LayoutConfig, PermissionMode, ServiceName };
|