@abpjs/identity-pro 0.7.2 → 2.0.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/dist/index.d.mts CHANGED
@@ -153,7 +153,7 @@ declare namespace Identity {
153
153
  * - User/Role claims management
154
154
  *
155
155
  * Translated from @volo/abp.ng.identity IdentityService
156
- * @since 0.7.2
156
+ * @since 2.0.0
157
157
  */
158
158
  declare class IdentityService {
159
159
  private rest;
@@ -290,6 +290,184 @@ declare class IdentityService {
290
290
  }): Promise<void>;
291
291
  }
292
292
 
293
+ /**
294
+ * Identity State Service
295
+ * Translated from @volo/abp.ng.identity v2.0.0
296
+ *
297
+ * This service provides facade methods for dispatching identity actions.
298
+ * In Angular, this uses NGXS store dispatch. In React, we wrap the API calls.
299
+ *
300
+ * @since 2.0.0
301
+ */
302
+
303
+ /**
304
+ * State service for identity operations.
305
+ * Provides facade methods that mirror the Angular IdentityStateService.
306
+ *
307
+ * Pro features include all dispatch methods for roles, users, and claim types.
308
+ *
309
+ * @since 2.0.0
310
+ */
311
+ declare class IdentityStateService {
312
+ private identityService;
313
+ private _roles;
314
+ private _rolesTotalCount;
315
+ private _users;
316
+ private _usersTotalCount;
317
+ private _claimTypes;
318
+ private _claimTypesTotalCount;
319
+ private _claimTypeNames;
320
+ constructor(restService: RestService);
321
+ /**
322
+ * Get the current roles
323
+ */
324
+ getRoles(): Identity.RoleItem[];
325
+ /**
326
+ * Get the total count of roles
327
+ */
328
+ getRolesTotalCount(): number;
329
+ /**
330
+ * Get the current users
331
+ */
332
+ getUsers(): Identity.UserItem[];
333
+ /**
334
+ * Get the total count of users
335
+ */
336
+ getUsersTotalCount(): number;
337
+ /**
338
+ * Get the current claim types
339
+ */
340
+ getClaimTypes(): Identity.ClaimType[];
341
+ /**
342
+ * Get the total count of claim types
343
+ */
344
+ getClaimTypesTotalCount(): number;
345
+ /**
346
+ * Get the claim type names
347
+ */
348
+ getClaimTypeNames(): Identity.ClaimTypeName[];
349
+ /**
350
+ * Dispatch get roles action
351
+ * @param params Query parameters for fetching roles
352
+ * @returns Promise resolving to the roles response
353
+ * @since 2.0.0
354
+ */
355
+ dispatchGetRoles(params?: ABP.PageQueryParams): Promise<Identity.RoleResponse>;
356
+ /**
357
+ * Dispatch get role by ID action
358
+ * @param id The role ID
359
+ * @returns Promise resolving to the role item
360
+ * @since 2.0.0
361
+ */
362
+ dispatchGetRoleById(id: string): Promise<Identity.RoleItem>;
363
+ /**
364
+ * Dispatch delete role action
365
+ * @param id The role ID to delete
366
+ * @returns Promise resolving to the deleted role
367
+ * @since 2.0.0
368
+ */
369
+ dispatchDeleteRole(id: string): Promise<Identity.RoleItem>;
370
+ /**
371
+ * Dispatch create role action
372
+ * @param body The role data to create
373
+ * @returns Promise resolving to the created role
374
+ * @since 2.0.0
375
+ */
376
+ dispatchCreateRole(body: Identity.RoleSaveRequest): Promise<Identity.RoleItem>;
377
+ /**
378
+ * Dispatch update role action
379
+ * @param id The role ID to update
380
+ * @param body The updated role data
381
+ * @returns Promise resolving to the updated role
382
+ * @since 2.0.0
383
+ */
384
+ dispatchUpdateRole(id: string, body: Identity.RoleSaveRequest): Promise<Identity.RoleItem>;
385
+ /**
386
+ * Dispatch get claim types action
387
+ * @param params Query parameters for fetching claim types
388
+ * @returns Promise resolving to the claim types response
389
+ * @since 2.0.0
390
+ */
391
+ dispatchGetClaimTypes(params?: ABP.PageQueryParams): Promise<Identity.ClaimResponse>;
392
+ /**
393
+ * Dispatch get claim type by ID action
394
+ * @param id The claim type ID
395
+ * @returns Promise resolving to the claim type
396
+ * @since 2.0.0
397
+ */
398
+ dispatchGetClaimTypeById(id: string): Promise<Identity.ClaimType>;
399
+ /**
400
+ * Dispatch delete claim type action
401
+ * @param id The claim type ID to delete
402
+ * @returns Promise resolving when complete
403
+ * @since 2.0.0
404
+ */
405
+ dispatchDeleteClaimType(id: string): Promise<void>;
406
+ /**
407
+ * Dispatch create claim type action
408
+ * @param body The claim type data to create
409
+ * @returns Promise resolving to the created claim type
410
+ * @since 2.0.0
411
+ */
412
+ dispatchCreateClaimType(body: Identity.ClaimType): Promise<Identity.ClaimType>;
413
+ /**
414
+ * Dispatch update claim type action
415
+ * @param body The claim type data to update
416
+ * @returns Promise resolving to the updated claim type
417
+ * @since 2.0.0
418
+ */
419
+ dispatchUpdateClaimType(body: Identity.ClaimType): Promise<Identity.ClaimType>;
420
+ /**
421
+ * Dispatch get claim type names action
422
+ * @returns Promise resolving to the claim type names
423
+ * @since 2.0.0
424
+ */
425
+ dispatchGetClaimTypeNames(): Promise<Identity.ClaimTypeName[]>;
426
+ /**
427
+ * Dispatch get users action
428
+ * @param params Query parameters for fetching users
429
+ * @returns Promise resolving to the users response
430
+ * @since 2.0.0
431
+ */
432
+ dispatchGetUsers(params?: ABP.PageQueryParams): Promise<Identity.UserResponse>;
433
+ /**
434
+ * Dispatch get user by ID action
435
+ * @param id The user ID
436
+ * @returns Promise resolving to the user item
437
+ * @since 2.0.0
438
+ */
439
+ dispatchGetUserById(id: string): Promise<Identity.UserItem>;
440
+ /**
441
+ * Dispatch delete user action
442
+ * @param id The user ID to delete
443
+ * @returns Promise resolving when complete
444
+ * @since 2.0.0
445
+ */
446
+ dispatchDeleteUser(id: string): Promise<void>;
447
+ /**
448
+ * Dispatch create user action
449
+ * @param body The user data to create
450
+ * @returns Promise resolving to the created user
451
+ * @since 2.0.0
452
+ */
453
+ dispatchCreateUser(body: Identity.UserSaveRequest): Promise<Identity.UserItem>;
454
+ /**
455
+ * Dispatch update user action
456
+ * @param id The user ID to update
457
+ * @param body The updated user data
458
+ * @returns Promise resolving to the updated user
459
+ * @since 2.0.0
460
+ */
461
+ dispatchUpdateUser(id: string, body: Identity.UserSaveRequest): Promise<Identity.UserItem>;
462
+ /**
463
+ * Dispatch get user roles action
464
+ * @param id The user ID
465
+ * @returns Promise resolving to the user's roles
466
+ * @since 2.0.0
467
+ */
468
+ dispatchGetUserRoles(id: string): Promise<Identity.RoleItem[]>;
469
+ }
470
+
293
471
  /**
294
472
  * Result from role operations
295
473
  */
@@ -802,4 +980,4 @@ declare const IDENTITY_POLICIES: {
802
980
  readonly ROLES_DELETE: "AbpIdentity.Roles.Delete";
803
981
  };
804
982
 
805
- export { ClaimModal, type ClaimModalProps, type ClaimOperationResult, ClaimsComponent, type ClaimsComponentProps, IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseClaimsReturn, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, useClaims, useIdentity, useRoles, useUsers };
983
+ export { ClaimModal, type ClaimModalProps, type ClaimOperationResult, ClaimsComponent, type ClaimsComponentProps, IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, IdentityStateService, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseClaimsReturn, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, useClaims, useIdentity, useRoles, useUsers };
package/dist/index.d.ts CHANGED
@@ -153,7 +153,7 @@ declare namespace Identity {
153
153
  * - User/Role claims management
154
154
  *
155
155
  * Translated from @volo/abp.ng.identity IdentityService
156
- * @since 0.7.2
156
+ * @since 2.0.0
157
157
  */
158
158
  declare class IdentityService {
159
159
  private rest;
@@ -290,6 +290,184 @@ declare class IdentityService {
290
290
  }): Promise<void>;
291
291
  }
292
292
 
293
+ /**
294
+ * Identity State Service
295
+ * Translated from @volo/abp.ng.identity v2.0.0
296
+ *
297
+ * This service provides facade methods for dispatching identity actions.
298
+ * In Angular, this uses NGXS store dispatch. In React, we wrap the API calls.
299
+ *
300
+ * @since 2.0.0
301
+ */
302
+
303
+ /**
304
+ * State service for identity operations.
305
+ * Provides facade methods that mirror the Angular IdentityStateService.
306
+ *
307
+ * Pro features include all dispatch methods for roles, users, and claim types.
308
+ *
309
+ * @since 2.0.0
310
+ */
311
+ declare class IdentityStateService {
312
+ private identityService;
313
+ private _roles;
314
+ private _rolesTotalCount;
315
+ private _users;
316
+ private _usersTotalCount;
317
+ private _claimTypes;
318
+ private _claimTypesTotalCount;
319
+ private _claimTypeNames;
320
+ constructor(restService: RestService);
321
+ /**
322
+ * Get the current roles
323
+ */
324
+ getRoles(): Identity.RoleItem[];
325
+ /**
326
+ * Get the total count of roles
327
+ */
328
+ getRolesTotalCount(): number;
329
+ /**
330
+ * Get the current users
331
+ */
332
+ getUsers(): Identity.UserItem[];
333
+ /**
334
+ * Get the total count of users
335
+ */
336
+ getUsersTotalCount(): number;
337
+ /**
338
+ * Get the current claim types
339
+ */
340
+ getClaimTypes(): Identity.ClaimType[];
341
+ /**
342
+ * Get the total count of claim types
343
+ */
344
+ getClaimTypesTotalCount(): number;
345
+ /**
346
+ * Get the claim type names
347
+ */
348
+ getClaimTypeNames(): Identity.ClaimTypeName[];
349
+ /**
350
+ * Dispatch get roles action
351
+ * @param params Query parameters for fetching roles
352
+ * @returns Promise resolving to the roles response
353
+ * @since 2.0.0
354
+ */
355
+ dispatchGetRoles(params?: ABP.PageQueryParams): Promise<Identity.RoleResponse>;
356
+ /**
357
+ * Dispatch get role by ID action
358
+ * @param id The role ID
359
+ * @returns Promise resolving to the role item
360
+ * @since 2.0.0
361
+ */
362
+ dispatchGetRoleById(id: string): Promise<Identity.RoleItem>;
363
+ /**
364
+ * Dispatch delete role action
365
+ * @param id The role ID to delete
366
+ * @returns Promise resolving to the deleted role
367
+ * @since 2.0.0
368
+ */
369
+ dispatchDeleteRole(id: string): Promise<Identity.RoleItem>;
370
+ /**
371
+ * Dispatch create role action
372
+ * @param body The role data to create
373
+ * @returns Promise resolving to the created role
374
+ * @since 2.0.0
375
+ */
376
+ dispatchCreateRole(body: Identity.RoleSaveRequest): Promise<Identity.RoleItem>;
377
+ /**
378
+ * Dispatch update role action
379
+ * @param id The role ID to update
380
+ * @param body The updated role data
381
+ * @returns Promise resolving to the updated role
382
+ * @since 2.0.0
383
+ */
384
+ dispatchUpdateRole(id: string, body: Identity.RoleSaveRequest): Promise<Identity.RoleItem>;
385
+ /**
386
+ * Dispatch get claim types action
387
+ * @param params Query parameters for fetching claim types
388
+ * @returns Promise resolving to the claim types response
389
+ * @since 2.0.0
390
+ */
391
+ dispatchGetClaimTypes(params?: ABP.PageQueryParams): Promise<Identity.ClaimResponse>;
392
+ /**
393
+ * Dispatch get claim type by ID action
394
+ * @param id The claim type ID
395
+ * @returns Promise resolving to the claim type
396
+ * @since 2.0.0
397
+ */
398
+ dispatchGetClaimTypeById(id: string): Promise<Identity.ClaimType>;
399
+ /**
400
+ * Dispatch delete claim type action
401
+ * @param id The claim type ID to delete
402
+ * @returns Promise resolving when complete
403
+ * @since 2.0.0
404
+ */
405
+ dispatchDeleteClaimType(id: string): Promise<void>;
406
+ /**
407
+ * Dispatch create claim type action
408
+ * @param body The claim type data to create
409
+ * @returns Promise resolving to the created claim type
410
+ * @since 2.0.0
411
+ */
412
+ dispatchCreateClaimType(body: Identity.ClaimType): Promise<Identity.ClaimType>;
413
+ /**
414
+ * Dispatch update claim type action
415
+ * @param body The claim type data to update
416
+ * @returns Promise resolving to the updated claim type
417
+ * @since 2.0.0
418
+ */
419
+ dispatchUpdateClaimType(body: Identity.ClaimType): Promise<Identity.ClaimType>;
420
+ /**
421
+ * Dispatch get claim type names action
422
+ * @returns Promise resolving to the claim type names
423
+ * @since 2.0.0
424
+ */
425
+ dispatchGetClaimTypeNames(): Promise<Identity.ClaimTypeName[]>;
426
+ /**
427
+ * Dispatch get users action
428
+ * @param params Query parameters for fetching users
429
+ * @returns Promise resolving to the users response
430
+ * @since 2.0.0
431
+ */
432
+ dispatchGetUsers(params?: ABP.PageQueryParams): Promise<Identity.UserResponse>;
433
+ /**
434
+ * Dispatch get user by ID action
435
+ * @param id The user ID
436
+ * @returns Promise resolving to the user item
437
+ * @since 2.0.0
438
+ */
439
+ dispatchGetUserById(id: string): Promise<Identity.UserItem>;
440
+ /**
441
+ * Dispatch delete user action
442
+ * @param id The user ID to delete
443
+ * @returns Promise resolving when complete
444
+ * @since 2.0.0
445
+ */
446
+ dispatchDeleteUser(id: string): Promise<void>;
447
+ /**
448
+ * Dispatch create user action
449
+ * @param body The user data to create
450
+ * @returns Promise resolving to the created user
451
+ * @since 2.0.0
452
+ */
453
+ dispatchCreateUser(body: Identity.UserSaveRequest): Promise<Identity.UserItem>;
454
+ /**
455
+ * Dispatch update user action
456
+ * @param id The user ID to update
457
+ * @param body The updated user data
458
+ * @returns Promise resolving to the updated user
459
+ * @since 2.0.0
460
+ */
461
+ dispatchUpdateUser(id: string, body: Identity.UserSaveRequest): Promise<Identity.UserItem>;
462
+ /**
463
+ * Dispatch get user roles action
464
+ * @param id The user ID
465
+ * @returns Promise resolving to the user's roles
466
+ * @since 2.0.0
467
+ */
468
+ dispatchGetUserRoles(id: string): Promise<Identity.RoleItem[]>;
469
+ }
470
+
293
471
  /**
294
472
  * Result from role operations
295
473
  */
@@ -802,4 +980,4 @@ declare const IDENTITY_POLICIES: {
802
980
  readonly ROLES_DELETE: "AbpIdentity.Roles.Delete";
803
981
  };
804
982
 
805
- export { ClaimModal, type ClaimModalProps, type ClaimOperationResult, ClaimsComponent, type ClaimsComponentProps, IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseClaimsReturn, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, useClaims, useIdentity, useRoles, useUsers };
983
+ export { ClaimModal, type ClaimModalProps, type ClaimOperationResult, ClaimsComponent, type ClaimsComponentProps, IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, IdentityStateService, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseClaimsReturn, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, useClaims, useIdentity, useRoles, useUsers };
package/dist/index.js CHANGED
@@ -27,6 +27,7 @@ __export(index_exports, {
27
27
  IDENTITY_ROUTE_PATHS: () => IDENTITY_ROUTE_PATHS,
28
28
  Identity: () => Identity,
29
29
  IdentityService: () => IdentityService,
30
+ IdentityStateService: () => IdentityStateService,
30
31
  RolesComponent: () => RolesComponent,
31
32
  UsersComponent: () => UsersComponent,
32
33
  useClaims: () => useClaims,
@@ -295,6 +296,257 @@ var IdentityService = class {
295
296
  }
296
297
  };
297
298
 
299
+ // src/services/identity-state.service.ts
300
+ var IdentityStateService = class {
301
+ constructor(restService) {
302
+ // State
303
+ this._roles = [];
304
+ this._rolesTotalCount = 0;
305
+ this._users = [];
306
+ this._usersTotalCount = 0;
307
+ this._claimTypes = [];
308
+ this._claimTypesTotalCount = 0;
309
+ this._claimTypeNames = [];
310
+ this.identityService = new IdentityService(restService);
311
+ }
312
+ // ========================
313
+ // Getter Methods
314
+ // ========================
315
+ /**
316
+ * Get the current roles
317
+ */
318
+ getRoles() {
319
+ return this._roles;
320
+ }
321
+ /**
322
+ * Get the total count of roles
323
+ */
324
+ getRolesTotalCount() {
325
+ return this._rolesTotalCount;
326
+ }
327
+ /**
328
+ * Get the current users
329
+ */
330
+ getUsers() {
331
+ return this._users;
332
+ }
333
+ /**
334
+ * Get the total count of users
335
+ */
336
+ getUsersTotalCount() {
337
+ return this._usersTotalCount;
338
+ }
339
+ /**
340
+ * Get the current claim types
341
+ */
342
+ getClaimTypes() {
343
+ return this._claimTypes;
344
+ }
345
+ /**
346
+ * Get the total count of claim types
347
+ */
348
+ getClaimTypesTotalCount() {
349
+ return this._claimTypesTotalCount;
350
+ }
351
+ /**
352
+ * Get the claim type names
353
+ */
354
+ getClaimTypeNames() {
355
+ return this._claimTypeNames;
356
+ }
357
+ // ========================
358
+ // Role Dispatch Methods (v2.0.0)
359
+ // ========================
360
+ /**
361
+ * Dispatch get roles action
362
+ * @param params Query parameters for fetching roles
363
+ * @returns Promise resolving to the roles response
364
+ * @since 2.0.0
365
+ */
366
+ async dispatchGetRoles(params) {
367
+ const response = await this.identityService.getRoles(params);
368
+ this._roles = response.items || [];
369
+ this._rolesTotalCount = response.totalCount || 0;
370
+ return response;
371
+ }
372
+ /**
373
+ * Dispatch get role by ID action
374
+ * @param id The role ID
375
+ * @returns Promise resolving to the role item
376
+ * @since 2.0.0
377
+ */
378
+ async dispatchGetRoleById(id) {
379
+ return this.identityService.getRoleById(id);
380
+ }
381
+ /**
382
+ * Dispatch delete role action
383
+ * @param id The role ID to delete
384
+ * @returns Promise resolving to the deleted role
385
+ * @since 2.0.0
386
+ */
387
+ async dispatchDeleteRole(id) {
388
+ const result = await this.identityService.deleteRole(id);
389
+ await this.dispatchGetRoles();
390
+ return result;
391
+ }
392
+ /**
393
+ * Dispatch create role action
394
+ * @param body The role data to create
395
+ * @returns Promise resolving to the created role
396
+ * @since 2.0.0
397
+ */
398
+ async dispatchCreateRole(body) {
399
+ const result = await this.identityService.createRole(body);
400
+ await this.dispatchGetRoles();
401
+ return result;
402
+ }
403
+ /**
404
+ * Dispatch update role action
405
+ * @param id The role ID to update
406
+ * @param body The updated role data
407
+ * @returns Promise resolving to the updated role
408
+ * @since 2.0.0
409
+ */
410
+ async dispatchUpdateRole(id, body) {
411
+ const result = await this.identityService.updateRole(id, body);
412
+ await this.dispatchGetRoles();
413
+ return result;
414
+ }
415
+ // ========================
416
+ // Claim Type Dispatch Methods (v2.0.0)
417
+ // ========================
418
+ /**
419
+ * Dispatch get claim types action
420
+ * @param params Query parameters for fetching claim types
421
+ * @returns Promise resolving to the claim types response
422
+ * @since 2.0.0
423
+ */
424
+ async dispatchGetClaimTypes(params) {
425
+ const response = await this.identityService.getClaimTypes(params);
426
+ this._claimTypes = response.items || [];
427
+ this._claimTypesTotalCount = response.totalCount || 0;
428
+ return response;
429
+ }
430
+ /**
431
+ * Dispatch get claim type by ID action
432
+ * @param id The claim type ID
433
+ * @returns Promise resolving to the claim type
434
+ * @since 2.0.0
435
+ */
436
+ async dispatchGetClaimTypeById(id) {
437
+ return this.identityService.getClaimTypeById(id);
438
+ }
439
+ /**
440
+ * Dispatch delete claim type action
441
+ * @param id The claim type ID to delete
442
+ * @returns Promise resolving when complete
443
+ * @since 2.0.0
444
+ */
445
+ async dispatchDeleteClaimType(id) {
446
+ await this.identityService.deleteClaimType(id);
447
+ await this.dispatchGetClaimTypes();
448
+ }
449
+ /**
450
+ * Dispatch create claim type action
451
+ * @param body The claim type data to create
452
+ * @returns Promise resolving to the created claim type
453
+ * @since 2.0.0
454
+ */
455
+ async dispatchCreateClaimType(body) {
456
+ const result = await this.identityService.createClaimType(body);
457
+ await this.dispatchGetClaimTypes();
458
+ return result;
459
+ }
460
+ /**
461
+ * Dispatch update claim type action
462
+ * @param body The claim type data to update
463
+ * @returns Promise resolving to the updated claim type
464
+ * @since 2.0.0
465
+ */
466
+ async dispatchUpdateClaimType(body) {
467
+ const result = await this.identityService.updateClaimType(body);
468
+ await this.dispatchGetClaimTypes();
469
+ return result;
470
+ }
471
+ /**
472
+ * Dispatch get claim type names action
473
+ * @returns Promise resolving to the claim type names
474
+ * @since 2.0.0
475
+ */
476
+ async dispatchGetClaimTypeNames() {
477
+ const result = await this.identityService.getClaimTypeNames();
478
+ this._claimTypeNames = result || [];
479
+ return result;
480
+ }
481
+ // ========================
482
+ // User Dispatch Methods (v2.0.0)
483
+ // ========================
484
+ /**
485
+ * Dispatch get users action
486
+ * @param params Query parameters for fetching users
487
+ * @returns Promise resolving to the users response
488
+ * @since 2.0.0
489
+ */
490
+ async dispatchGetUsers(params) {
491
+ const response = await this.identityService.getUsers(params);
492
+ this._users = response.items || [];
493
+ this._usersTotalCount = response.totalCount || 0;
494
+ return response;
495
+ }
496
+ /**
497
+ * Dispatch get user by ID action
498
+ * @param id The user ID
499
+ * @returns Promise resolving to the user item
500
+ * @since 2.0.0
501
+ */
502
+ async dispatchGetUserById(id) {
503
+ return this.identityService.getUserById(id);
504
+ }
505
+ /**
506
+ * Dispatch delete user action
507
+ * @param id The user ID to delete
508
+ * @returns Promise resolving when complete
509
+ * @since 2.0.0
510
+ */
511
+ async dispatchDeleteUser(id) {
512
+ await this.identityService.deleteUser(id);
513
+ await this.dispatchGetUsers();
514
+ }
515
+ /**
516
+ * Dispatch create user action
517
+ * @param body The user data to create
518
+ * @returns Promise resolving to the created user
519
+ * @since 2.0.0
520
+ */
521
+ async dispatchCreateUser(body) {
522
+ const result = await this.identityService.createUser(body);
523
+ await this.dispatchGetUsers();
524
+ return result;
525
+ }
526
+ /**
527
+ * Dispatch update user action
528
+ * @param id The user ID to update
529
+ * @param body The updated user data
530
+ * @returns Promise resolving to the updated user
531
+ * @since 2.0.0
532
+ */
533
+ async dispatchUpdateUser(id, body) {
534
+ const result = await this.identityService.updateUser(id, body);
535
+ await this.dispatchGetUsers();
536
+ return result;
537
+ }
538
+ /**
539
+ * Dispatch get user roles action
540
+ * @param id The user ID
541
+ * @returns Promise resolving to the user's roles
542
+ * @since 2.0.0
543
+ */
544
+ async dispatchGetUserRoles(id) {
545
+ const response = await this.identityService.getUserRoles(id);
546
+ return response.items || [];
547
+ }
548
+ };
549
+
298
550
  // src/hooks/useRoles.ts
299
551
  var import_react = require("react");
300
552
  var import_core = require("@abpjs/core");
@@ -1901,6 +2153,7 @@ var IDENTITY_POLICIES = {
1901
2153
  IDENTITY_ROUTE_PATHS,
1902
2154
  Identity,
1903
2155
  IdentityService,
2156
+ IdentityStateService,
1904
2157
  RolesComponent,
1905
2158
  UsersComponent,
1906
2159
  useClaims,
package/dist/index.mjs CHANGED
@@ -257,6 +257,257 @@ var IdentityService = class {
257
257
  }
258
258
  };
259
259
 
260
+ // src/services/identity-state.service.ts
261
+ var IdentityStateService = class {
262
+ constructor(restService) {
263
+ // State
264
+ this._roles = [];
265
+ this._rolesTotalCount = 0;
266
+ this._users = [];
267
+ this._usersTotalCount = 0;
268
+ this._claimTypes = [];
269
+ this._claimTypesTotalCount = 0;
270
+ this._claimTypeNames = [];
271
+ this.identityService = new IdentityService(restService);
272
+ }
273
+ // ========================
274
+ // Getter Methods
275
+ // ========================
276
+ /**
277
+ * Get the current roles
278
+ */
279
+ getRoles() {
280
+ return this._roles;
281
+ }
282
+ /**
283
+ * Get the total count of roles
284
+ */
285
+ getRolesTotalCount() {
286
+ return this._rolesTotalCount;
287
+ }
288
+ /**
289
+ * Get the current users
290
+ */
291
+ getUsers() {
292
+ return this._users;
293
+ }
294
+ /**
295
+ * Get the total count of users
296
+ */
297
+ getUsersTotalCount() {
298
+ return this._usersTotalCount;
299
+ }
300
+ /**
301
+ * Get the current claim types
302
+ */
303
+ getClaimTypes() {
304
+ return this._claimTypes;
305
+ }
306
+ /**
307
+ * Get the total count of claim types
308
+ */
309
+ getClaimTypesTotalCount() {
310
+ return this._claimTypesTotalCount;
311
+ }
312
+ /**
313
+ * Get the claim type names
314
+ */
315
+ getClaimTypeNames() {
316
+ return this._claimTypeNames;
317
+ }
318
+ // ========================
319
+ // Role Dispatch Methods (v2.0.0)
320
+ // ========================
321
+ /**
322
+ * Dispatch get roles action
323
+ * @param params Query parameters for fetching roles
324
+ * @returns Promise resolving to the roles response
325
+ * @since 2.0.0
326
+ */
327
+ async dispatchGetRoles(params) {
328
+ const response = await this.identityService.getRoles(params);
329
+ this._roles = response.items || [];
330
+ this._rolesTotalCount = response.totalCount || 0;
331
+ return response;
332
+ }
333
+ /**
334
+ * Dispatch get role by ID action
335
+ * @param id The role ID
336
+ * @returns Promise resolving to the role item
337
+ * @since 2.0.0
338
+ */
339
+ async dispatchGetRoleById(id) {
340
+ return this.identityService.getRoleById(id);
341
+ }
342
+ /**
343
+ * Dispatch delete role action
344
+ * @param id The role ID to delete
345
+ * @returns Promise resolving to the deleted role
346
+ * @since 2.0.0
347
+ */
348
+ async dispatchDeleteRole(id) {
349
+ const result = await this.identityService.deleteRole(id);
350
+ await this.dispatchGetRoles();
351
+ return result;
352
+ }
353
+ /**
354
+ * Dispatch create role action
355
+ * @param body The role data to create
356
+ * @returns Promise resolving to the created role
357
+ * @since 2.0.0
358
+ */
359
+ async dispatchCreateRole(body) {
360
+ const result = await this.identityService.createRole(body);
361
+ await this.dispatchGetRoles();
362
+ return result;
363
+ }
364
+ /**
365
+ * Dispatch update role action
366
+ * @param id The role ID to update
367
+ * @param body The updated role data
368
+ * @returns Promise resolving to the updated role
369
+ * @since 2.0.0
370
+ */
371
+ async dispatchUpdateRole(id, body) {
372
+ const result = await this.identityService.updateRole(id, body);
373
+ await this.dispatchGetRoles();
374
+ return result;
375
+ }
376
+ // ========================
377
+ // Claim Type Dispatch Methods (v2.0.0)
378
+ // ========================
379
+ /**
380
+ * Dispatch get claim types action
381
+ * @param params Query parameters for fetching claim types
382
+ * @returns Promise resolving to the claim types response
383
+ * @since 2.0.0
384
+ */
385
+ async dispatchGetClaimTypes(params) {
386
+ const response = await this.identityService.getClaimTypes(params);
387
+ this._claimTypes = response.items || [];
388
+ this._claimTypesTotalCount = response.totalCount || 0;
389
+ return response;
390
+ }
391
+ /**
392
+ * Dispatch get claim type by ID action
393
+ * @param id The claim type ID
394
+ * @returns Promise resolving to the claim type
395
+ * @since 2.0.0
396
+ */
397
+ async dispatchGetClaimTypeById(id) {
398
+ return this.identityService.getClaimTypeById(id);
399
+ }
400
+ /**
401
+ * Dispatch delete claim type action
402
+ * @param id The claim type ID to delete
403
+ * @returns Promise resolving when complete
404
+ * @since 2.0.0
405
+ */
406
+ async dispatchDeleteClaimType(id) {
407
+ await this.identityService.deleteClaimType(id);
408
+ await this.dispatchGetClaimTypes();
409
+ }
410
+ /**
411
+ * Dispatch create claim type action
412
+ * @param body The claim type data to create
413
+ * @returns Promise resolving to the created claim type
414
+ * @since 2.0.0
415
+ */
416
+ async dispatchCreateClaimType(body) {
417
+ const result = await this.identityService.createClaimType(body);
418
+ await this.dispatchGetClaimTypes();
419
+ return result;
420
+ }
421
+ /**
422
+ * Dispatch update claim type action
423
+ * @param body The claim type data to update
424
+ * @returns Promise resolving to the updated claim type
425
+ * @since 2.0.0
426
+ */
427
+ async dispatchUpdateClaimType(body) {
428
+ const result = await this.identityService.updateClaimType(body);
429
+ await this.dispatchGetClaimTypes();
430
+ return result;
431
+ }
432
+ /**
433
+ * Dispatch get claim type names action
434
+ * @returns Promise resolving to the claim type names
435
+ * @since 2.0.0
436
+ */
437
+ async dispatchGetClaimTypeNames() {
438
+ const result = await this.identityService.getClaimTypeNames();
439
+ this._claimTypeNames = result || [];
440
+ return result;
441
+ }
442
+ // ========================
443
+ // User Dispatch Methods (v2.0.0)
444
+ // ========================
445
+ /**
446
+ * Dispatch get users action
447
+ * @param params Query parameters for fetching users
448
+ * @returns Promise resolving to the users response
449
+ * @since 2.0.0
450
+ */
451
+ async dispatchGetUsers(params) {
452
+ const response = await this.identityService.getUsers(params);
453
+ this._users = response.items || [];
454
+ this._usersTotalCount = response.totalCount || 0;
455
+ return response;
456
+ }
457
+ /**
458
+ * Dispatch get user by ID action
459
+ * @param id The user ID
460
+ * @returns Promise resolving to the user item
461
+ * @since 2.0.0
462
+ */
463
+ async dispatchGetUserById(id) {
464
+ return this.identityService.getUserById(id);
465
+ }
466
+ /**
467
+ * Dispatch delete user action
468
+ * @param id The user ID to delete
469
+ * @returns Promise resolving when complete
470
+ * @since 2.0.0
471
+ */
472
+ async dispatchDeleteUser(id) {
473
+ await this.identityService.deleteUser(id);
474
+ await this.dispatchGetUsers();
475
+ }
476
+ /**
477
+ * Dispatch create user action
478
+ * @param body The user data to create
479
+ * @returns Promise resolving to the created user
480
+ * @since 2.0.0
481
+ */
482
+ async dispatchCreateUser(body) {
483
+ const result = await this.identityService.createUser(body);
484
+ await this.dispatchGetUsers();
485
+ return result;
486
+ }
487
+ /**
488
+ * Dispatch update user action
489
+ * @param id The user ID to update
490
+ * @param body The updated user data
491
+ * @returns Promise resolving to the updated user
492
+ * @since 2.0.0
493
+ */
494
+ async dispatchUpdateUser(id, body) {
495
+ const result = await this.identityService.updateUser(id, body);
496
+ await this.dispatchGetUsers();
497
+ return result;
498
+ }
499
+ /**
500
+ * Dispatch get user roles action
501
+ * @param id The user ID
502
+ * @returns Promise resolving to the user's roles
503
+ * @since 2.0.0
504
+ */
505
+ async dispatchGetUserRoles(id) {
506
+ const response = await this.identityService.getUserRoles(id);
507
+ return response.items || [];
508
+ }
509
+ };
510
+
260
511
  // src/hooks/useRoles.ts
261
512
  import { useState, useCallback, useMemo } from "react";
262
513
  import { useRestService } from "@abpjs/core";
@@ -1900,6 +2151,7 @@ export {
1900
2151
  IDENTITY_ROUTE_PATHS,
1901
2152
  Identity,
1902
2153
  IdentityService,
2154
+ IdentityStateService,
1903
2155
  RolesComponent,
1904
2156
  UsersComponent,
1905
2157
  useClaims,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abpjs/identity-pro",
3
- "version": "0.7.2",
3
+ "version": "2.0.0",
4
4
  "description": "ABP Framework identity pro components for React - translated from @volo/abp.ng.identity",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -27,12 +27,12 @@
27
27
  "@chakra-ui/react": "^3.2.0",
28
28
  "@emotion/react": "^11.11.0",
29
29
  "react-icons": "^5.3.0",
30
- "@abpjs/core": "1.1.0",
31
- "@abpjs/theme-shared": "1.1.0",
32
- "@abpjs/permission-management": "1.1.0"
30
+ "@abpjs/theme-shared": "2.0.0",
31
+ "@abpjs/core": "2.0.0",
32
+ "@abpjs/permission-management": "2.0.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@volo/abp.ng.identity": "0.7.2",
35
+ "@volo/abp.ng.identity": "2.0.0",
36
36
  "@testing-library/jest-dom": "^6.9.1",
37
37
  "@testing-library/react": "^14.0.0",
38
38
  "@testing-library/user-event": "^14.6.1",