@abpjs/identity 0.8.0 → 1.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
@@ -82,10 +82,11 @@ declare class IdentityService {
82
82
  private rest;
83
83
  constructor(rest: RestService);
84
84
  /**
85
- * Get all roles
85
+ * Get all roles with optional pagination/filtering (v0.9.0)
86
+ * @param params - Optional query parameters for pagination and filtering
86
87
  * @returns Promise with paginated role response
87
88
  */
88
- getRoles(): Promise<Identity.RoleResponse>;
89
+ getRoles(params?: ABP.PageQueryParams): Promise<Identity.RoleResponse>;
89
90
  /**
90
91
  * Get a role by ID
91
92
  * @param id - The role ID
@@ -157,6 +158,11 @@ interface RoleOperationResult {
157
158
  success: boolean;
158
159
  error?: string;
159
160
  }
161
+ /**
162
+ * Sort order type
163
+ * @since 1.0.0
164
+ */
165
+ type SortOrder = 'asc' | 'desc' | '';
160
166
  /**
161
167
  * Return type for useRoles hook
162
168
  */
@@ -171,8 +177,12 @@ interface UseRolesReturn {
171
177
  isLoading: boolean;
172
178
  /** Error message if any */
173
179
  error: string | null;
174
- /** Fetch all roles */
175
- fetchRoles: () => Promise<RoleOperationResult>;
180
+ /** Current sort key @since 1.0.0 */
181
+ sortKey: string;
182
+ /** Current sort order @since 1.0.0 */
183
+ sortOrder: SortOrder;
184
+ /** Fetch all roles with optional pagination/filtering */
185
+ fetchRoles: (params?: ABP.PageQueryParams) => Promise<RoleOperationResult>;
176
186
  /** Get a role by ID and set it as selected */
177
187
  getRoleById: (id: string) => Promise<RoleOperationResult>;
178
188
  /** Create a new role */
@@ -183,6 +193,10 @@ interface UseRolesReturn {
183
193
  deleteRole: (id: string) => Promise<RoleOperationResult>;
184
194
  /** Set the selected role */
185
195
  setSelectedRole: (role: Identity.RoleItem | null) => void;
196
+ /** Set sort key @since 1.0.0 */
197
+ setSortKey: (key: string) => void;
198
+ /** Set sort order @since 1.0.0 */
199
+ setSortOrder: (order: SortOrder) => void;
186
200
  /** Reset state */
187
201
  reset: () => void;
188
202
  }
@@ -251,6 +265,10 @@ interface UseUsersReturn {
251
265
  error: string | null;
252
266
  /** Current page query parameters */
253
267
  pageQuery: ABP.PageQueryParams;
268
+ /** Current sort key @since 1.0.0 */
269
+ sortKey: string;
270
+ /** Current sort order @since 1.0.0 */
271
+ sortOrder: SortOrder;
254
272
  /** Fetch users with pagination */
255
273
  fetchUsers: (params?: ABP.PageQueryParams) => Promise<UserOperationResult>;
256
274
  /** Get a user by ID and set it as selected */
@@ -267,6 +285,10 @@ interface UseUsersReturn {
267
285
  setSelectedUser: (user: Identity.UserItem | null) => void;
268
286
  /** Set page query parameters */
269
287
  setPageQuery: (query: ABP.PageQueryParams) => void;
288
+ /** Set sort key @since 1.0.0 */
289
+ setSortKey: (key: string) => void;
290
+ /** Set sort order @since 1.0.0 */
291
+ setSortOrder: (order: SortOrder) => void;
270
292
  /** Reset state */
271
293
  reset: () => void;
272
294
  }
@@ -424,8 +446,14 @@ declare function UsersComponent({ onUserCreated, onUserUpdated, onUserDeleted, }
424
446
  *
425
447
  * These routes define the navigation structure for the identity module
426
448
  * within the ABP Framework application.
449
+ *
450
+ * @deprecated since version 1.0.0. Route configuration is now handled by
451
+ * identity config services. This constant is kept for backwards compatibility
452
+ * but may be removed in future versions.
427
453
  */
428
- declare const IDENTITY_ROUTES: ABP.FullRoute[];
454
+ declare const IDENTITY_ROUTES: {
455
+ routes: ABP.FullRoute[];
456
+ };
429
457
  /**
430
458
  * Route paths for the identity module.
431
459
  * Use these constants for programmatic navigation.
@@ -460,4 +488,4 @@ declare const IDENTITY_POLICIES: {
460
488
  readonly ROLES_DELETE: "AbpIdentity.Roles.Delete";
461
489
  };
462
490
 
463
- export { IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, type RoleOperationResult, RolesComponent, type RolesComponentProps, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, useIdentity, useRoles, useUsers };
491
+ export { IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, useIdentity, useRoles, useUsers };
package/dist/index.d.ts CHANGED
@@ -82,10 +82,11 @@ declare class IdentityService {
82
82
  private rest;
83
83
  constructor(rest: RestService);
84
84
  /**
85
- * Get all roles
85
+ * Get all roles with optional pagination/filtering (v0.9.0)
86
+ * @param params - Optional query parameters for pagination and filtering
86
87
  * @returns Promise with paginated role response
87
88
  */
88
- getRoles(): Promise<Identity.RoleResponse>;
89
+ getRoles(params?: ABP.PageQueryParams): Promise<Identity.RoleResponse>;
89
90
  /**
90
91
  * Get a role by ID
91
92
  * @param id - The role ID
@@ -157,6 +158,11 @@ interface RoleOperationResult {
157
158
  success: boolean;
158
159
  error?: string;
159
160
  }
161
+ /**
162
+ * Sort order type
163
+ * @since 1.0.0
164
+ */
165
+ type SortOrder = 'asc' | 'desc' | '';
160
166
  /**
161
167
  * Return type for useRoles hook
162
168
  */
@@ -171,8 +177,12 @@ interface UseRolesReturn {
171
177
  isLoading: boolean;
172
178
  /** Error message if any */
173
179
  error: string | null;
174
- /** Fetch all roles */
175
- fetchRoles: () => Promise<RoleOperationResult>;
180
+ /** Current sort key @since 1.0.0 */
181
+ sortKey: string;
182
+ /** Current sort order @since 1.0.0 */
183
+ sortOrder: SortOrder;
184
+ /** Fetch all roles with optional pagination/filtering */
185
+ fetchRoles: (params?: ABP.PageQueryParams) => Promise<RoleOperationResult>;
176
186
  /** Get a role by ID and set it as selected */
177
187
  getRoleById: (id: string) => Promise<RoleOperationResult>;
178
188
  /** Create a new role */
@@ -183,6 +193,10 @@ interface UseRolesReturn {
183
193
  deleteRole: (id: string) => Promise<RoleOperationResult>;
184
194
  /** Set the selected role */
185
195
  setSelectedRole: (role: Identity.RoleItem | null) => void;
196
+ /** Set sort key @since 1.0.0 */
197
+ setSortKey: (key: string) => void;
198
+ /** Set sort order @since 1.0.0 */
199
+ setSortOrder: (order: SortOrder) => void;
186
200
  /** Reset state */
187
201
  reset: () => void;
188
202
  }
@@ -251,6 +265,10 @@ interface UseUsersReturn {
251
265
  error: string | null;
252
266
  /** Current page query parameters */
253
267
  pageQuery: ABP.PageQueryParams;
268
+ /** Current sort key @since 1.0.0 */
269
+ sortKey: string;
270
+ /** Current sort order @since 1.0.0 */
271
+ sortOrder: SortOrder;
254
272
  /** Fetch users with pagination */
255
273
  fetchUsers: (params?: ABP.PageQueryParams) => Promise<UserOperationResult>;
256
274
  /** Get a user by ID and set it as selected */
@@ -267,6 +285,10 @@ interface UseUsersReturn {
267
285
  setSelectedUser: (user: Identity.UserItem | null) => void;
268
286
  /** Set page query parameters */
269
287
  setPageQuery: (query: ABP.PageQueryParams) => void;
288
+ /** Set sort key @since 1.0.0 */
289
+ setSortKey: (key: string) => void;
290
+ /** Set sort order @since 1.0.0 */
291
+ setSortOrder: (order: SortOrder) => void;
270
292
  /** Reset state */
271
293
  reset: () => void;
272
294
  }
@@ -424,8 +446,14 @@ declare function UsersComponent({ onUserCreated, onUserUpdated, onUserDeleted, }
424
446
  *
425
447
  * These routes define the navigation structure for the identity module
426
448
  * within the ABP Framework application.
449
+ *
450
+ * @deprecated since version 1.0.0. Route configuration is now handled by
451
+ * identity config services. This constant is kept for backwards compatibility
452
+ * but may be removed in future versions.
427
453
  */
428
- declare const IDENTITY_ROUTES: ABP.FullRoute[];
454
+ declare const IDENTITY_ROUTES: {
455
+ routes: ABP.FullRoute[];
456
+ };
429
457
  /**
430
458
  * Route paths for the identity module.
431
459
  * Use these constants for programmatic navigation.
@@ -460,4 +488,4 @@ declare const IDENTITY_POLICIES: {
460
488
  readonly ROLES_DELETE: "AbpIdentity.Roles.Delete";
461
489
  };
462
490
 
463
- export { IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, type RoleOperationResult, RolesComponent, type RolesComponentProps, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, useIdentity, useRoles, useUsers };
491
+ export { IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, useIdentity, useRoles, useUsers };
package/dist/index.js CHANGED
@@ -41,13 +41,15 @@ var IdentityService = class {
41
41
  // Role Operations
42
42
  // ========================
43
43
  /**
44
- * Get all roles
44
+ * Get all roles with optional pagination/filtering (v0.9.0)
45
+ * @param params - Optional query parameters for pagination and filtering
45
46
  * @returns Promise with paginated role response
46
47
  */
47
- getRoles() {
48
+ getRoles(params = {}) {
48
49
  return this.rest.request({
49
50
  method: "GET",
50
- url: "/api/identity/roles"
51
+ url: "/api/identity/roles",
52
+ params
51
53
  });
52
54
  }
53
55
  /**
@@ -183,11 +185,13 @@ function useRoles() {
183
185
  const [selectedRole, setSelectedRole] = (0, import_react.useState)(null);
184
186
  const [isLoading, setIsLoading] = (0, import_react.useState)(false);
185
187
  const [error, setError] = (0, import_react.useState)(null);
186
- const fetchRoles = (0, import_react.useCallback)(async () => {
188
+ const [sortKey, setSortKey] = (0, import_react.useState)("name");
189
+ const [sortOrder, setSortOrder] = (0, import_react.useState)("");
190
+ const fetchRoles = (0, import_react.useCallback)(async (params) => {
187
191
  setIsLoading(true);
188
192
  setError(null);
189
193
  try {
190
- const response = await service.getRoles();
194
+ const response = await service.getRoles(params);
191
195
  setRoles(response.items || []);
192
196
  setTotalCount(response.totalCount || 0);
193
197
  setIsLoading(false);
@@ -281,12 +285,16 @@ function useRoles() {
281
285
  selectedRole,
282
286
  isLoading,
283
287
  error,
288
+ sortKey,
289
+ sortOrder,
284
290
  fetchRoles,
285
291
  getRoleById,
286
292
  createRole,
287
293
  updateRole,
288
294
  deleteRole,
289
295
  setSelectedRole,
296
+ setSortKey,
297
+ setSortOrder,
290
298
  reset
291
299
  };
292
300
  }
@@ -309,6 +317,8 @@ function useUsers() {
309
317
  const [isLoading, setIsLoading] = (0, import_react2.useState)(false);
310
318
  const [error, setError] = (0, import_react2.useState)(null);
311
319
  const [pageQuery, setPageQuery] = (0, import_react2.useState)(DEFAULT_PAGE_QUERY);
320
+ const [sortKey, setSortKey] = (0, import_react2.useState)("userName");
321
+ const [sortOrder, setSortOrder] = (0, import_react2.useState)("");
312
322
  const fetchUsers = (0, import_react2.useCallback)(
313
323
  async (params) => {
314
324
  setIsLoading(true);
@@ -433,6 +443,8 @@ function useUsers() {
433
443
  isLoading,
434
444
  error,
435
445
  pageQuery,
446
+ sortKey,
447
+ sortOrder,
436
448
  fetchUsers,
437
449
  getUserById,
438
450
  getUserRoles,
@@ -441,6 +453,8 @@ function useUsers() {
441
453
  deleteUser,
442
454
  setSelectedUser,
443
455
  setPageQuery,
456
+ setSortKey,
457
+ setSortOrder,
444
458
  reset
445
459
  };
446
460
  }
@@ -1092,35 +1106,37 @@ function UsersComponent({
1092
1106
 
1093
1107
  // src/constants/routes.ts
1094
1108
  var import_core5 = require("@abpjs/core");
1095
- var IDENTITY_ROUTES = [
1096
- {
1097
- name: "AbpUiNavigation::Menu:Administration",
1098
- path: "",
1099
- order: 1,
1100
- wrapper: true
1101
- },
1102
- {
1103
- name: "AbpIdentity::Menu:IdentityManagement",
1104
- path: "identity",
1105
- order: 1,
1106
- parentName: "AbpUiNavigation::Menu:Administration",
1107
- layout: import_core5.eLayoutType.application,
1108
- children: [
1109
- {
1110
- path: "roles",
1111
- name: "AbpIdentity::Roles",
1112
- order: 2,
1113
- requiredPolicy: "AbpIdentity.Roles"
1114
- },
1115
- {
1116
- path: "users",
1117
- name: "AbpIdentity::Users",
1118
- order: 1,
1119
- requiredPolicy: "AbpIdentity.Users"
1120
- }
1121
- ]
1122
- }
1123
- ];
1109
+ var IDENTITY_ROUTES = {
1110
+ routes: [
1111
+ {
1112
+ name: "AbpUiNavigation::Menu:Administration",
1113
+ path: "",
1114
+ order: 1,
1115
+ wrapper: true
1116
+ },
1117
+ {
1118
+ name: "AbpIdentity::Menu:IdentityManagement",
1119
+ path: "identity",
1120
+ order: 1,
1121
+ parentName: "AbpUiNavigation::Menu:Administration",
1122
+ layout: import_core5.eLayoutType.application,
1123
+ children: [
1124
+ {
1125
+ path: "roles",
1126
+ name: "AbpIdentity::Roles",
1127
+ order: 2,
1128
+ requiredPolicy: "AbpIdentity.Roles"
1129
+ },
1130
+ {
1131
+ path: "users",
1132
+ name: "AbpIdentity::Users",
1133
+ order: 1,
1134
+ requiredPolicy: "AbpIdentity.Users"
1135
+ }
1136
+ ]
1137
+ }
1138
+ ]
1139
+ };
1124
1140
  var IDENTITY_ROUTE_PATHS = {
1125
1141
  /** Base path for identity module */
1126
1142
  BASE: "/identity",
package/dist/index.mjs CHANGED
@@ -7,13 +7,15 @@ var IdentityService = class {
7
7
  // Role Operations
8
8
  // ========================
9
9
  /**
10
- * Get all roles
10
+ * Get all roles with optional pagination/filtering (v0.9.0)
11
+ * @param params - Optional query parameters for pagination and filtering
11
12
  * @returns Promise with paginated role response
12
13
  */
13
- getRoles() {
14
+ getRoles(params = {}) {
14
15
  return this.rest.request({
15
16
  method: "GET",
16
- url: "/api/identity/roles"
17
+ url: "/api/identity/roles",
18
+ params
17
19
  });
18
20
  }
19
21
  /**
@@ -149,11 +151,13 @@ function useRoles() {
149
151
  const [selectedRole, setSelectedRole] = useState(null);
150
152
  const [isLoading, setIsLoading] = useState(false);
151
153
  const [error, setError] = useState(null);
152
- const fetchRoles = useCallback(async () => {
154
+ const [sortKey, setSortKey] = useState("name");
155
+ const [sortOrder, setSortOrder] = useState("");
156
+ const fetchRoles = useCallback(async (params) => {
153
157
  setIsLoading(true);
154
158
  setError(null);
155
159
  try {
156
- const response = await service.getRoles();
160
+ const response = await service.getRoles(params);
157
161
  setRoles(response.items || []);
158
162
  setTotalCount(response.totalCount || 0);
159
163
  setIsLoading(false);
@@ -247,12 +251,16 @@ function useRoles() {
247
251
  selectedRole,
248
252
  isLoading,
249
253
  error,
254
+ sortKey,
255
+ sortOrder,
250
256
  fetchRoles,
251
257
  getRoleById,
252
258
  createRole,
253
259
  updateRole,
254
260
  deleteRole,
255
261
  setSelectedRole,
262
+ setSortKey,
263
+ setSortOrder,
256
264
  reset
257
265
  };
258
266
  }
@@ -275,6 +283,8 @@ function useUsers() {
275
283
  const [isLoading, setIsLoading] = useState2(false);
276
284
  const [error, setError] = useState2(null);
277
285
  const [pageQuery, setPageQuery] = useState2(DEFAULT_PAGE_QUERY);
286
+ const [sortKey, setSortKey] = useState2("userName");
287
+ const [sortOrder, setSortOrder] = useState2("");
278
288
  const fetchUsers = useCallback2(
279
289
  async (params) => {
280
290
  setIsLoading(true);
@@ -399,6 +409,8 @@ function useUsers() {
399
409
  isLoading,
400
410
  error,
401
411
  pageQuery,
412
+ sortKey,
413
+ sortOrder,
402
414
  fetchUsers,
403
415
  getUserById,
404
416
  getUserRoles,
@@ -407,6 +419,8 @@ function useUsers() {
407
419
  deleteUser,
408
420
  setSelectedUser,
409
421
  setPageQuery,
422
+ setSortKey,
423
+ setSortOrder,
410
424
  reset
411
425
  };
412
426
  }
@@ -1078,35 +1092,37 @@ function UsersComponent({
1078
1092
 
1079
1093
  // src/constants/routes.ts
1080
1094
  import { eLayoutType } from "@abpjs/core";
1081
- var IDENTITY_ROUTES = [
1082
- {
1083
- name: "AbpUiNavigation::Menu:Administration",
1084
- path: "",
1085
- order: 1,
1086
- wrapper: true
1087
- },
1088
- {
1089
- name: "AbpIdentity::Menu:IdentityManagement",
1090
- path: "identity",
1091
- order: 1,
1092
- parentName: "AbpUiNavigation::Menu:Administration",
1093
- layout: eLayoutType.application,
1094
- children: [
1095
- {
1096
- path: "roles",
1097
- name: "AbpIdentity::Roles",
1098
- order: 2,
1099
- requiredPolicy: "AbpIdentity.Roles"
1100
- },
1101
- {
1102
- path: "users",
1103
- name: "AbpIdentity::Users",
1104
- order: 1,
1105
- requiredPolicy: "AbpIdentity.Users"
1106
- }
1107
- ]
1108
- }
1109
- ];
1095
+ var IDENTITY_ROUTES = {
1096
+ routes: [
1097
+ {
1098
+ name: "AbpUiNavigation::Menu:Administration",
1099
+ path: "",
1100
+ order: 1,
1101
+ wrapper: true
1102
+ },
1103
+ {
1104
+ name: "AbpIdentity::Menu:IdentityManagement",
1105
+ path: "identity",
1106
+ order: 1,
1107
+ parentName: "AbpUiNavigation::Menu:Administration",
1108
+ layout: eLayoutType.application,
1109
+ children: [
1110
+ {
1111
+ path: "roles",
1112
+ name: "AbpIdentity::Roles",
1113
+ order: 2,
1114
+ requiredPolicy: "AbpIdentity.Roles"
1115
+ },
1116
+ {
1117
+ path: "users",
1118
+ name: "AbpIdentity::Users",
1119
+ order: 1,
1120
+ requiredPolicy: "AbpIdentity.Users"
1121
+ }
1122
+ ]
1123
+ }
1124
+ ]
1125
+ };
1110
1126
  var IDENTITY_ROUTE_PATHS = {
1111
1127
  /** Base path for identity module */
1112
1128
  BASE: "/identity",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abpjs/identity",
3
- "version": "0.8.0",
3
+ "version": "1.0.0",
4
4
  "description": "ABP Framework identity components for React - translated from @abp/ng.identity",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -25,12 +25,12 @@
25
25
  "dependencies": {
26
26
  "@chakra-ui/react": "^3.2.0",
27
27
  "@emotion/react": "^11.11.0",
28
- "@abpjs/permission-management": "0.8.0",
29
- "@abpjs/core": "0.8.0",
30
- "@abpjs/theme-shared": "0.8.0"
28
+ "@abpjs/core": "1.0.0",
29
+ "@abpjs/theme-shared": "1.0.0",
30
+ "@abpjs/permission-management": "1.0.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@abp/ng.identity": "0.8.0",
33
+ "@abp/ng.identity": "0.9.0",
34
34
  "@testing-library/jest-dom": "^6.9.1",
35
35
  "@testing-library/react": "^14.0.0",
36
36
  "@testing-library/user-event": "^14.6.1",
@@ -52,7 +52,8 @@
52
52
  "tailwindcss": "^3.4.0",
53
53
  "tsup": "^8.0.0",
54
54
  "typescript": "^5.0.0",
55
- "vitest": "^1.0.0"
55
+ "vitest": "^1.0.0",
56
+ "@vitest/coverage-v8": "^1.0.0"
56
57
  },
57
58
  "author": "tekthar.com",
58
59
  "license": "LGPL-3.0",
@@ -80,6 +81,7 @@
80
81
  "format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",
81
82
  "format:check": "prettier --check \"src/**/*.{ts,tsx,json,md}\"",
82
83
  "type-check": "tsc --noEmit",
83
- "test": "vitest"
84
+ "test": "vitest run",
85
+ "test:watch": "vitest"
84
86
  }
85
87
  }