@hichchi/ngx-auth 0.0.2 → 0.0.4
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 +3116 -1384
- package/fesm2022/hichchi-ngx-auth.mjs +67 -5
- package/fesm2022/hichchi-ngx-auth.mjs.map +1 -1
- package/package.json +6 -5
- package/types/hichchi-ngx-auth.d.ts +65 -2
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hichchi/ngx-auth",
|
|
3
|
-
"
|
|
3
|
+
"description": "A utility library for Angular applications with common services, interceptors, and state management",
|
|
4
|
+
"version": "0.0.4",
|
|
4
5
|
"publishConfig": {
|
|
5
6
|
"access": "public"
|
|
6
7
|
},
|
|
@@ -18,10 +19,10 @@
|
|
|
18
19
|
"@angular/core": "^21.1.4",
|
|
19
20
|
"@angular/forms": "^21.1.4",
|
|
20
21
|
"@angular/router": "^21.1.4",
|
|
21
|
-
"@hichchi/nest-connector": "0.0.
|
|
22
|
-
"@hichchi/ngx-ui": "0.0.
|
|
23
|
-
"@hichchi/ngx-utils": "0.0.
|
|
24
|
-
"@hichchi/utils": "0.0.
|
|
22
|
+
"@hichchi/nest-connector": "0.0.4",
|
|
23
|
+
"@hichchi/ngx-ui": "0.0.4",
|
|
24
|
+
"@hichchi/ngx-utils": "0.0.4",
|
|
25
|
+
"@hichchi/utils": "0.0.4",
|
|
25
26
|
"@ngrx/signals": "^21.0.1",
|
|
26
27
|
"rxjs": "^7.8.2"
|
|
27
28
|
},
|
|
@@ -17,6 +17,8 @@ import * as i4 from '@hichchi/ngx-ui';
|
|
|
17
17
|
interface AuthConfig {
|
|
18
18
|
authField?: AuthField;
|
|
19
19
|
apiBaseURL: string;
|
|
20
|
+
splitDomain?: string;
|
|
21
|
+
devSubdomain?: string;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
/**
|
|
@@ -1258,6 +1260,13 @@ declare class AuthService extends CrudHttpService {
|
|
|
1258
1260
|
* The module must be configured using the forRoot() method to provide the necessary
|
|
1259
1261
|
* authentication configuration.
|
|
1260
1262
|
*
|
|
1263
|
+
* API base URL handling:
|
|
1264
|
+
* - `apiBaseURL` defines the base API host for auth requests.
|
|
1265
|
+
* - Optional `prependSubdomain` lets you prepend a subdomain to `apiBaseURL`.
|
|
1266
|
+
* - `string`: uses the provided subdomain
|
|
1267
|
+
* - `true`: resolves subdomain dynamically from the current host context
|
|
1268
|
+
* - `false` / `undefined`: keeps `apiBaseURL` unchanged
|
|
1269
|
+
*
|
|
1261
1270
|
* @example
|
|
1262
1271
|
* ```typescript
|
|
1263
1272
|
* // Basic module configuration
|
|
@@ -1285,6 +1294,34 @@ declare class AuthService extends CrudHttpService {
|
|
|
1285
1294
|
* export class AppModule { }
|
|
1286
1295
|
* ```
|
|
1287
1296
|
*
|
|
1297
|
+
* @example
|
|
1298
|
+
* ```typescript
|
|
1299
|
+
* // Configuration with a static subdomain
|
|
1300
|
+
* @NgModule({
|
|
1301
|
+
* imports: [
|
|
1302
|
+
* NgxHichchiAuthModule.forRoot({
|
|
1303
|
+
* apiBaseURL: 'https://api.example.com',
|
|
1304
|
+
* prependSubdomain: 'tenant-a'
|
|
1305
|
+
* })
|
|
1306
|
+
* ]
|
|
1307
|
+
* })
|
|
1308
|
+
* export class AppModule { }
|
|
1309
|
+
* ```
|
|
1310
|
+
*
|
|
1311
|
+
* @example
|
|
1312
|
+
* ```typescript
|
|
1313
|
+
* // Configuration with dynamic subdomain resolution
|
|
1314
|
+
* @NgModule({
|
|
1315
|
+
* imports: [
|
|
1316
|
+
* NgxHichchiAuthModule.forRoot({
|
|
1317
|
+
* apiBaseURL: 'https://api.example.com',
|
|
1318
|
+
* prependSubdomain: true
|
|
1319
|
+
* })
|
|
1320
|
+
* ]
|
|
1321
|
+
* })
|
|
1322
|
+
* export class AppModule { }
|
|
1323
|
+
* ```
|
|
1324
|
+
*
|
|
1288
1325
|
* @see {@link AuthConfig} Configuration interface for the authentication module
|
|
1289
1326
|
* @see {@link AuthFormComponent} Authentication form component
|
|
1290
1327
|
* @see {@link PermissionDirective} Permission-based conditional rendering directive
|
|
@@ -1295,8 +1332,15 @@ declare class NgxHichchiAuthModule {
|
|
|
1295
1332
|
* Configures the NgxHichchiAuthModule with the provided authentication configuration
|
|
1296
1333
|
*
|
|
1297
1334
|
* This static method sets up the module with the necessary providers and configuration
|
|
1298
|
-
* for authentication functionality.
|
|
1299
|
-
*
|
|
1335
|
+
* for authentication functionality. Before providers are created, `apiBaseURL` is normalized
|
|
1336
|
+
* through `prependSubdomainToApi(config.apiBaseURL, config.prependSubdomain)`.
|
|
1337
|
+
* It then provides the AuthService and authentication configuration token required
|
|
1338
|
+
* for the module to function properly.
|
|
1339
|
+
*
|
|
1340
|
+
* `prependSubdomain` behavior:
|
|
1341
|
+
* - `string`: prepend that subdomain to the API host
|
|
1342
|
+
* - `true`: derive subdomain dynamically from the current host context
|
|
1343
|
+
* - `false` / `undefined`: do not prepend a subdomain
|
|
1300
1344
|
*
|
|
1301
1345
|
* @param config - The authentication configuration object containing API endpoints and settings
|
|
1302
1346
|
* @returns A ModuleWithProviders object configured with authentication providers
|
|
@@ -1318,9 +1362,28 @@ declare class NgxHichchiAuthModule {
|
|
|
1318
1362
|
* })
|
|
1319
1363
|
* ```
|
|
1320
1364
|
*
|
|
1365
|
+
* @example
|
|
1366
|
+
* ```typescript
|
|
1367
|
+
* // Static subdomain
|
|
1368
|
+
* NgxHichchiAuthModule.forRoot({
|
|
1369
|
+
* apiBaseURL: 'https://api.example.com',
|
|
1370
|
+
* prependSubdomain: 'tenant-a'
|
|
1371
|
+
* })
|
|
1372
|
+
* ```
|
|
1373
|
+
*
|
|
1374
|
+
* @example
|
|
1375
|
+
* ```typescript
|
|
1376
|
+
* // Dynamic subdomain
|
|
1377
|
+
* NgxHichchiAuthModule.forRoot({
|
|
1378
|
+
* apiBaseURL: 'https://api.example.com',
|
|
1379
|
+
* prependSubdomain: true
|
|
1380
|
+
* })
|
|
1381
|
+
* ```
|
|
1382
|
+
*
|
|
1321
1383
|
* @see {@link AuthConfig} Interface defining the configuration structure
|
|
1322
1384
|
* @see {@link AUTH_CONFIG} Injection token for the authentication configuration
|
|
1323
1385
|
* @see {@link AuthService} Service that uses the provided configuration
|
|
1386
|
+
* @see {@link prependSubdomainToUrlBrowser} Utility used to transform `apiBaseURL`
|
|
1324
1387
|
*/
|
|
1325
1388
|
static forRoot(config: AuthConfig): ModuleWithProviders<NgxHichchiAuthModule>;
|
|
1326
1389
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxHichchiAuthModule, never>;
|