@hichchi/ngx-auth 0.0.3 → 0.0.5

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/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.3",
4
+ "version": "0.0.5",
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.3",
23
- "@hichchi/ngx-ui": "0.0.3",
24
- "@hichchi/ngx-utils": "0.0.3",
25
- "@hichchi/utils": "0.0.3",
22
+ "@hichchi/nest-connector": "0.0.5",
23
+ "@hichchi/ngx-ui": "0.0.5",
24
+ "@hichchi/ngx-utils": "0.0.5",
25
+ "@hichchi/utils": "0.0.5",
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';
@@ -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
+ tenant?: TenantSlug;
20
22
  }
21
23
 
22
24
  /**
@@ -1258,6 +1260,11 @@ 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
+ * 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.
1267
+ *
1261
1268
  * @example
1262
1269
  * ```typescript
1263
1270
  * // Basic module configuration
@@ -1285,6 +1292,20 @@ declare class AuthService extends CrudHttpService {
1285
1292
  * export class AppModule { }
1286
1293
  * ```
1287
1294
  *
1295
+ * @example
1296
+ * ```typescript
1297
+ * // Optional static tenant header
1298
+ * @NgModule({
1299
+ * imports: [
1300
+ * NgxHichchiAuthModule.forRoot({
1301
+ * apiBaseURL: 'https://api.example.com',
1302
+ * tenant: 'tenant-a'
1303
+ * })
1304
+ * ]
1305
+ * })
1306
+ * export class AppModule { }
1307
+ * ```
1308
+ *
1288
1309
  * @see {@link AuthConfig} Configuration interface for the authentication module
1289
1310
  * @see {@link AuthFormComponent} Authentication form component
1290
1311
  * @see {@link PermissionDirective} Permission-based conditional rendering directive
@@ -1295,10 +1316,11 @@ declare class NgxHichchiAuthModule {
1295
1316
  * Configures the NgxHichchiAuthModule with the provided authentication configuration
1296
1317
  *
1297
1318
  * This static method sets up the module with the necessary providers and configuration
1298
- * for authentication functionality. It provides the AuthService, HTTP client, and
1299
- * authentication configuration token that are required for the module to function properly.
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.
1300
1322
  *
1301
- * @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
1302
1324
  * @returns A ModuleWithProviders object configured with authentication providers
1303
1325
  *
1304
1326
  * @example
@@ -1318,9 +1340,19 @@ declare class NgxHichchiAuthModule {
1318
1340
  * })
1319
1341
  * ```
1320
1342
  *
1343
+ * @example
1344
+ * ```typescript
1345
+ * // Configuration with static tenant
1346
+ * NgxHichchiAuthModule.forRoot({
1347
+ * apiBaseURL: 'https://api.example.com',
1348
+ * tenant: 'tenant-a'
1349
+ * })
1350
+ * ```
1351
+ *
1321
1352
  * @see {@link AuthConfig} Interface defining the configuration structure
1322
1353
  * @see {@link AUTH_CONFIG} Injection token for the authentication configuration
1323
1354
  * @see {@link AuthService} Service that uses the provided configuration
1355
+ * @see {@link TENANT_HEADER_KEY} Constant used to attach tenant header to requests
1324
1356
  */
1325
1357
  static forRoot(config: AuthConfig): ModuleWithProviders<NgxHichchiAuthModule>;
1326
1358
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxHichchiAuthModule, never>;