@hichchi/ngx-auth 0.0.4 → 0.0.6
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 +120 -150
- package/fesm2022/hichchi-ngx-auth.mjs +16 -47
- package/fesm2022/hichchi-ngx-auth.mjs.map +1 -1
- package/package.json +5 -5
- package/types/hichchi-ngx-auth.d.ts +15 -46
package/package.json
CHANGED
|
@@ -1,7 +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
|
+
"version": "0.0.6",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"@angular/core": "^21.1.4",
|
|
20
20
|
"@angular/forms": "^21.1.4",
|
|
21
21
|
"@angular/router": "^21.1.4",
|
|
22
|
-
"@hichchi/nest-connector": "0.0.
|
|
23
|
-
"@hichchi/ngx-ui": "0.0.
|
|
24
|
-
"@hichchi/ngx-utils": "0.0.
|
|
25
|
-
"@hichchi/utils": "0.0.
|
|
22
|
+
"@hichchi/nest-connector": "0.0.6",
|
|
23
|
+
"@hichchi/ngx-ui": "0.0.6",
|
|
24
|
+
"@hichchi/ngx-utils": "0.0.6",
|
|
25
|
+
"@hichchi/utils": "0.0.6",
|
|
26
26
|
"@ngrx/signals": "^21.0.1",
|
|
27
27
|
"rxjs": "^7.8.2"
|
|
28
28
|
},
|
|
@@ -4,7 +4,7 @@ import { ErrorResponseCode, SuccessResponse } from '@hichchi/nest-connector';
|
|
|
4
4
|
import * as rxjs from 'rxjs';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
6
6
|
import * as _hichchi_nest_connector_auth from '@hichchi/nest-connector/auth';
|
|
7
|
-
import { AuthField, AuthResponse, User, SignInBody, SignUpBody, AccessToken, RefreshToken, TokenResponse } from '@hichchi/nest-connector/auth';
|
|
7
|
+
import { AuthField, TenantSlug, AuthResponse, User, SignInBody, SignUpBody, AccessToken, RefreshToken, TokenResponse } from '@hichchi/nest-connector/auth';
|
|
8
8
|
import * as _angular_core from '@angular/core';
|
|
9
9
|
import { InputSignal, OutputEmitterRef, WritableSignal, Signal, ModuleWithProviders } from '@angular/core';
|
|
10
10
|
import { HttpError, DataFormGroup, CrudHttpService } from '@hichchi/ngx-utils';
|
|
@@ -18,7 +18,7 @@ interface AuthConfig {
|
|
|
18
18
|
authField?: AuthField;
|
|
19
19
|
apiBaseURL: string;
|
|
20
20
|
splitDomain?: string;
|
|
21
|
-
|
|
21
|
+
tenant?: TenantSlug;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -1260,12 +1260,10 @@ declare class AuthService extends CrudHttpService {
|
|
|
1260
1260
|
* The module must be configured using the forRoot() method to provide the necessary
|
|
1261
1261
|
* authentication configuration.
|
|
1262
1262
|
*
|
|
1263
|
-
*
|
|
1264
|
-
* - `
|
|
1265
|
-
*
|
|
1266
|
-
*
|
|
1267
|
-
* - `true`: resolves subdomain dynamically from the current host context
|
|
1268
|
-
* - `false` / `undefined`: keeps `apiBaseURL` unchanged
|
|
1263
|
+
* Tenant handling:
|
|
1264
|
+
* - `tenant` can be provided in the configuration or dynamically set in requests
|
|
1265
|
+
* via a custom HTTP header (`x-tenant`, controlled by `TENANT_HEADER_KEY`).
|
|
1266
|
+
* - This approach replaces previous subdomain-based tenant resolution.
|
|
1269
1267
|
*
|
|
1270
1268
|
* @example
|
|
1271
1269
|
* ```typescript
|
|
@@ -1296,26 +1294,12 @@ declare class AuthService extends CrudHttpService {
|
|
|
1296
1294
|
*
|
|
1297
1295
|
* @example
|
|
1298
1296
|
* ```typescript
|
|
1299
|
-
* //
|
|
1297
|
+
* // Optional static tenant header
|
|
1300
1298
|
* @NgModule({
|
|
1301
1299
|
* imports: [
|
|
1302
1300
|
* NgxHichchiAuthModule.forRoot({
|
|
1303
1301
|
* apiBaseURL: 'https://api.example.com',
|
|
1304
|
-
*
|
|
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
|
|
1302
|
+
* tenant: 'tenant-a'
|
|
1319
1303
|
* })
|
|
1320
1304
|
* ]
|
|
1321
1305
|
* })
|
|
@@ -1332,17 +1316,11 @@ declare class NgxHichchiAuthModule {
|
|
|
1332
1316
|
* Configures the NgxHichchiAuthModule with the provided authentication configuration
|
|
1333
1317
|
*
|
|
1334
1318
|
* This static method sets up the module with the necessary providers and configuration
|
|
1335
|
-
* for authentication functionality.
|
|
1336
|
-
*
|
|
1337
|
-
*
|
|
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
|
|
1319
|
+
* for authentication functionality. The configuration includes the `apiBaseURL` for
|
|
1320
|
+
* all authentication requests, and optionally a `tenant` string that is attached
|
|
1321
|
+
* to requests via the `TENANT_HEADER_KEY` header.
|
|
1344
1322
|
*
|
|
1345
|
-
* @param config - The authentication configuration object containing API endpoints and settings
|
|
1323
|
+
* @param config - The authentication configuration object containing API endpoints, tenant, and other settings
|
|
1346
1324
|
* @returns A ModuleWithProviders object configured with authentication providers
|
|
1347
1325
|
*
|
|
1348
1326
|
* @example
|
|
@@ -1364,26 +1342,17 @@ declare class NgxHichchiAuthModule {
|
|
|
1364
1342
|
*
|
|
1365
1343
|
* @example
|
|
1366
1344
|
* ```typescript
|
|
1367
|
-
* //
|
|
1368
|
-
* NgxHichchiAuthModule.forRoot({
|
|
1369
|
-
* apiBaseURL: 'https://api.example.com',
|
|
1370
|
-
* prependSubdomain: 'tenant-a'
|
|
1371
|
-
* })
|
|
1372
|
-
* ```
|
|
1373
|
-
*
|
|
1374
|
-
* @example
|
|
1375
|
-
* ```typescript
|
|
1376
|
-
* // Dynamic subdomain
|
|
1345
|
+
* // Configuration with static tenant
|
|
1377
1346
|
* NgxHichchiAuthModule.forRoot({
|
|
1378
1347
|
* apiBaseURL: 'https://api.example.com',
|
|
1379
|
-
*
|
|
1348
|
+
* tenant: 'tenant-a'
|
|
1380
1349
|
* })
|
|
1381
1350
|
* ```
|
|
1382
1351
|
*
|
|
1383
1352
|
* @see {@link AuthConfig} Interface defining the configuration structure
|
|
1384
1353
|
* @see {@link AUTH_CONFIG} Injection token for the authentication configuration
|
|
1385
1354
|
* @see {@link AuthService} Service that uses the provided configuration
|
|
1386
|
-
* @see {@link
|
|
1355
|
+
* @see {@link TENANT_HEADER_KEY} Constant used to attach tenant header to requests
|
|
1387
1356
|
*/
|
|
1388
1357
|
static forRoot(config: AuthConfig): ModuleWithProviders<NgxHichchiAuthModule>;
|
|
1389
1358
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxHichchiAuthModule, never>;
|