@autional/api-rbac 0.2.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/README.md +53 -0
- package/package.json +36 -0
- package/src/index.ts +188 -0
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# @authms/api-identity
|
|
2
|
+
|
|
3
|
+
AuthMS Identity Service API — auto-generated TypeScript client for identity-service (21 functions).
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description |
|
|
8
|
+
|----------|-------------|
|
|
9
|
+
| `login(client, data)` | Authenticate with email/phone/username and password |
|
|
10
|
+
| `register(client, data)` | Register a new user account |
|
|
11
|
+
| `refreshToken(client, data)` | Refresh access token using refresh token |
|
|
12
|
+
| `getProfile(client)` | Get current user profile |
|
|
13
|
+
| `updateProfile(client, data)` | Update current user profile |
|
|
14
|
+
| `logout(client)` | Logout and revoke tokens |
|
|
15
|
+
| `verifyEmail(client, data)` | Verify email with verification code |
|
|
16
|
+
| `sendVerificationEmail(client, data)` | Send email verification code |
|
|
17
|
+
| `changePassword(client, data)` | Change password (requires current password) |
|
|
18
|
+
| `forgotPassword(client, data)` | Request password reset email |
|
|
19
|
+
| `resetPassword(client, data)` | Reset password with token from email |
|
|
20
|
+
| `checkPermission(client, data)` | Check if user has a specific permission |
|
|
21
|
+
| `getPermissions(client)` | Get user's permission list |
|
|
22
|
+
| `getTenants(client)` | Get user's tenants |
|
|
23
|
+
| `switchTenant(client, data)` | Switch active tenant |
|
|
24
|
+
| `requestRoleActivation(client, data)` | Request PIM/JIT role activation |
|
|
25
|
+
| `getRoleActivations(client)` | Get active role activations |
|
|
26
|
+
| `deleteAccount(client)` | Delete current user account |
|
|
27
|
+
| `getSessions(client)` | Get user's sessions |
|
|
28
|
+
| `deleteSession(client, sessionId)` | Delete a specific session |
|
|
29
|
+
| `getMFAMethods(client)` | Get user's MFA methods |
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install @authms/core @authms/api-identity
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { AuthMS, browserPlatform } from '@authms/core';
|
|
41
|
+
import { login, getProfile } from '@authms/api-identity';
|
|
42
|
+
|
|
43
|
+
const authms = new AuthMS({ appId: 'my-app', issuer: 'https://auth.iam.tianv.com', platform: browserPlatform });
|
|
44
|
+
await authms.initialize();
|
|
45
|
+
|
|
46
|
+
const result = await login(authms.api, { email: 'user@example.com', password: 's3cret' });
|
|
47
|
+
console.log(result.user);
|
|
48
|
+
|
|
49
|
+
const profile = await getProfile(authms.api);
|
|
50
|
+
console.log(profile);
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
See the [root SDK README](../../README.md) for full documentation.
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@autional/api-rbac",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "AuthMS Identity Service API \u2014 auto-generated TypeScript client",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsup src/index.ts --format cjs,esm --dts --clean --external @autional/core",
|
|
18
|
+
"typecheck": "tsc --noEmit",
|
|
19
|
+
"clean": "rimraf dist"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"src"
|
|
24
|
+
],
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@autional/core": ">=0.1.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@autional/core": ">=0.1.0",
|
|
30
|
+
"rimraf": "^5.0.0",
|
|
31
|
+
"tsup": "^8.4.0",
|
|
32
|
+
"typescript": "^5.8.0",
|
|
33
|
+
"vitest": "^3.0.0"
|
|
34
|
+
},
|
|
35
|
+
"license": "MIT"
|
|
36
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
// @ts-nocheck — auto-generated from swagger.json
|
|
2
|
+
/** @authms/api-rbac — auto-generated */
|
|
3
|
+
import type { ApiClient } from '@authms/core';
|
|
4
|
+
|
|
5
|
+
export function adminApprovalRequests(client: ApiClient, data?: Record<string, unknown>) {
|
|
6
|
+
return client.get(`/rbac/api/v1/admin/approval-requests`, { params });
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function adminApprovalRequestsApproveByApprovalRequestsPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
10
|
+
return client.post(`/rbac/api/v1/admin/approval-requests/${requestId}/approve`, data);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function adminApprovalRequestsRejectByApprovalRequestsPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
14
|
+
return client.post(`/rbac/api/v1/admin/approval-requests/${requestId}/reject`, data);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function adminPermissions(client: ApiClient, data?: Record<string, unknown>) {
|
|
18
|
+
return client.get(`/rbac/api/v1/admin/permissions`, { params });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function adminPermissionsPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
22
|
+
return client.post(`/rbac/api/v1/admin/permissions`, data);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function adminPermissionsSimulatePost(client: ApiClient, data?: Record<string, unknown>) {
|
|
26
|
+
return client.post(`/rbac/api/v1/admin/permissions/simulate`, data);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function adminPermissionsByPermissionsDelete(client: ApiClient, data?: Record<string, unknown>) {
|
|
30
|
+
return client.delete(`/rbac/api/v1/admin/permissions/${permissionId}`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function adminPermissionsByPermissions(client: ApiClient, data?: Record<string, unknown>) {
|
|
34
|
+
return client.get(`/rbac/api/v1/admin/permissions/${permissionId}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function adminPermissionsByPermissionsPut(client: ApiClient, data?: Record<string, unknown>) {
|
|
38
|
+
return client.put(`/rbac/api/v1/admin/permissions/${permissionId}`, data);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function adminPermissionsRolesByPermissions(client: ApiClient, data?: Record<string, unknown>) {
|
|
42
|
+
return client.get(`/rbac/api/v1/admin/permissions/${permissionId}/roles`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function adminPermissionsUsersByPermissions(client: ApiClient, data?: Record<string, unknown>) {
|
|
46
|
+
return client.get(`/rbac/api/v1/admin/permissions/${permissionId}/users`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function adminRoles(client: ApiClient, data?: Record<string, unknown>) {
|
|
50
|
+
return client.get(`/rbac/api/v1/admin/roles`, { params });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function adminRolesPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
54
|
+
return client.post(`/rbac/api/v1/admin/roles`, data);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function adminRolesBatchPermissionsDelete(client: ApiClient, data?: Record<string, unknown>) {
|
|
58
|
+
return client.delete(`/rbac/api/v1/admin/roles/batch/permissions`, { data });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function adminRolesBatchPermissionsPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
62
|
+
return client.post(`/rbac/api/v1/admin/roles/batch/permissions`, data);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function adminRolesConflictPairs(client: ApiClient, data?: Record<string, unknown>) {
|
|
66
|
+
return client.get(`/rbac/api/v1/admin/roles/conflict-pairs`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function adminRolesConflictPairsPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
70
|
+
return client.post(`/rbac/api/v1/admin/roles/conflict-pairs`, data);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function adminRolesConflictPairsByConflictPairsDelete(client: ApiClient, data?: Record<string, unknown>) {
|
|
74
|
+
return client.delete(`/rbac/api/v1/admin/roles/conflict-pairs/${pairId}`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function adminRolesDefaults(client: ApiClient, data?: Record<string, unknown>) {
|
|
78
|
+
return client.get(`/rbac/api/v1/admin/roles/defaults`);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function adminRolesDefaultsPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
82
|
+
return client.post(`/rbac/api/v1/admin/roles/defaults`, data);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function adminRolesDefaultsByDefaultsDelete(client: ApiClient, data?: Record<string, unknown>) {
|
|
86
|
+
return client.delete(`/rbac/api/v1/admin/roles/defaults/${roleId}`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function adminRolesByRolesDelete(client: ApiClient, data?: Record<string, unknown>) {
|
|
90
|
+
return client.delete(`/rbac/api/v1/admin/roles/${roleId}`);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function adminRolesByRoles(client: ApiClient, data?: Record<string, unknown>) {
|
|
94
|
+
return client.get(`/rbac/api/v1/admin/roles/${roleId}`);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function adminRolesByRolesPut(client: ApiClient, data?: Record<string, unknown>) {
|
|
98
|
+
return client.put(`/rbac/api/v1/admin/roles/${roleId}`, data);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function adminRolesApprovalRequestsByRolesPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
102
|
+
return client.post(`/rbac/api/v1/admin/roles/${roleId}/approval-requests`, data);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function adminRolesChildrenByRoles(client: ApiClient, data?: Record<string, unknown>) {
|
|
106
|
+
return client.get(`/rbac/api/v1/admin/roles/${roleId}/children`);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function adminRolesChildrenByRolesPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
110
|
+
return client.post(`/rbac/api/v1/admin/roles/${roleId}/children`, data);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function adminRolesChildrenByRolesByChildrenDelete(client: ApiClient, data?: Record<string, unknown>) {
|
|
114
|
+
return client.delete(`/rbac/api/v1/admin/roles/${roleId}/children/${childId}`);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function adminRolesCloneByRolesPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
118
|
+
return client.post(`/rbac/api/v1/admin/roles/${roleId}/clone`, data);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function adminRolesEffectivePermissionsByRoles(client: ApiClient, data?: Record<string, unknown>) {
|
|
122
|
+
return client.get(`/rbac/api/v1/admin/roles/${roleId}/effective-permissions`);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export function adminRolesParentsByRoles(client: ApiClient, data?: Record<string, unknown>) {
|
|
126
|
+
return client.get(`/rbac/api/v1/admin/roles/${roleId}/parents`);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function adminRolesPermissionsByRolesDelete(client: ApiClient, data?: Record<string, unknown>) {
|
|
130
|
+
return client.delete(`/rbac/api/v1/admin/roles/${roleId}/permissions`, { data });
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function adminRolesPermissionsByRoles(client: ApiClient, data?: Record<string, unknown>) {
|
|
134
|
+
return client.get(`/rbac/api/v1/admin/roles/${roleId}/permissions`);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function adminRolesPermissionsByRolesPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
138
|
+
return client.post(`/rbac/api/v1/admin/roles/${roleId}/permissions`, data);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export function adminRolesUsersByRoles(client: ApiClient, data?: Record<string, unknown>) {
|
|
142
|
+
return client.get(`/rbac/api/v1/admin/roles/${roleId}/users`);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function adminUsersBatchRolesDelete(client: ApiClient, data?: Record<string, unknown>) {
|
|
146
|
+
return client.delete(`/rbac/api/v1/admin/users/batch/roles`, { data });
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function adminUsersBatchRolesPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
150
|
+
return client.post(`/rbac/api/v1/admin/users/batch/roles`, data);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function adminUsersPermissionsByUsersDelete(client: ApiClient, data?: Record<string, unknown>) {
|
|
154
|
+
return client.delete(`/rbac/api/v1/admin/users/${userId}/permissions`, { data });
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function adminUsersPermissionsByUsers(client: ApiClient, data?: Record<string, unknown>) {
|
|
158
|
+
return client.get(`/rbac/api/v1/admin/users/${userId}/permissions`);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function adminUsersPermissionsByUsersPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
162
|
+
return client.post(`/rbac/api/v1/admin/users/${userId}/permissions`, data);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export function adminUsersRolesByUsersDelete(client: ApiClient, data?: Record<string, unknown>) {
|
|
166
|
+
return client.delete(`/rbac/api/v1/admin/users/${userId}/roles`, { data });
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function adminUsersRolesByUsers(client: ApiClient, data?: Record<string, unknown>) {
|
|
170
|
+
return client.get(`/rbac/api/v1/admin/users/${userId}/roles`);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export function adminUsersRolesByUsersPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
174
|
+
return client.post(`/rbac/api/v1/admin/users/${userId}/roles`, data);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export function adminUsersRolesValidateByUsersPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
178
|
+
return client.post(`/rbac/api/v1/admin/users/${userId}/roles/validate`);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export function authCheckPermissionPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
182
|
+
return client.post(`/rbac/api/v1/auth/check-permission`, data);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export function authCheckRolePost(client: ApiClient, data?: Record<string, unknown>) {
|
|
186
|
+
return client.post(`/rbac/api/v1/auth/check-role`, data);
|
|
187
|
+
}
|
|
188
|
+
|