88} from '../openapi/types.js' ;
99import { Role } from '../roles/types.js' ;
1010import { Map } from '../roles/util.js' ;
11- import { User , UserDB } from './types.js' ;
11+ import { AssignRevokeOptions , GetAssignedRolesOptions , User , UserDB } from './types.js' ;
1212
1313/**
1414 * Operations supported for 'db', 'oidc', and legacy (non-namespaced) users.
@@ -60,7 +60,7 @@ export interface DBUsers extends UsersBase {
6060 * @param {string } userId The ID of the user to retrieve the assigned roles for.
6161 * @returns {Promise<Record<string, Role>> } A map of role names to their respective roles.
6262 */
63- getAssignedRoles : ( userId : string , opts ?: GetAssingedRolesOptions ) => Promise < Record < string , Role > > ;
63+ getAssignedRoles : ( userId : string , opts ?: GetAssignedRolesOptions ) => Promise < Record < string , Role > > ;
6464
6565 create : ( userId : string ) => Promise < string > ;
6666 delete : ( userId : string ) => Promise < boolean > ;
@@ -71,10 +71,6 @@ export interface DBUsers extends UsersBase {
7171 listAll : ( ) => Promise < UserDB [ ] > ;
7272}
7373
74- type GetAssingedRolesOptions = {
75- includePermissions ?: boolean ;
76- } ;
77-
7874/** Operations supported for namespaced 'oidc' users.*/
7975export interface OIDCUsers extends UsersBase {
8076 /**
@@ -83,7 +79,7 @@ export interface OIDCUsers extends UsersBase {
8379 * @param {string } userId The ID of the user to retrieve the assigned roles for.
8480 * @returns {Promise<Record<string, Role>> } A map of role names to their respective roles.
8581 */
86- getAssignedRoles : ( userId : string , opts ?: GetAssingedRolesOptions ) => Promise < Record < string , Role > > ;
82+ getAssignedRoles : ( userId : string , opts ?: GetAssignedRolesOptions ) => Promise < Record < string , Role > > ;
8783}
8884
8985const users = ( connection : ConnectionREST ) : Users => {
@@ -115,7 +111,7 @@ const db = (connection: ConnectionREST): DBUsers => {
115111
116112 type APIKeyResponse = { apikey : string } ;
117113 return {
118- getAssignedRoles : ( userId : string , opts ?: GetAssingedRolesOptions ) =>
114+ getAssignedRoles : ( userId : string , opts ?: GetAssignedRolesOptions ) =>
119115 ns . getAssignedRoles ( 'db' , userId , opts ) ,
120116 assignRoles : ( roleNames : string | string [ ] , userId : string ) =>
121117 ns . assignRoles ( roleNames , userId , { userType : 'db' } ) ,
@@ -149,7 +145,7 @@ const db = (connection: ConnectionREST): DBUsers => {
149145const oidc = ( connection : ConnectionREST ) : OIDCUsers => {
150146 const ns = namespacedUsers ( connection ) ;
151147 return {
152- getAssignedRoles : ( userId : string , opts ?: GetAssingedRolesOptions ) =>
148+ getAssignedRoles : ( userId : string , opts ?: GetAssignedRolesOptions ) =>
153149 ns . getAssignedRoles ( 'oidc' , userId , opts ) ,
154150 assignRoles : ( roleNames : string | string [ ] , userId : string ) =>
155151 ns . assignRoles ( roleNames , userId , { userType : 'oidc' } ) ,
@@ -163,7 +159,7 @@ interface NamespacedUsers {
163159 getAssignedRoles : (
164160 userType : UserTypeInternal ,
165161 userId : string ,
166- opts ?: GetAssingedRolesOptions
162+ opts ?: GetAssignedRolesOptions
167163 ) => Promise < Record < string , Role > > ;
168164 assignRoles : ( roleNames : string | string [ ] , userId : string , opts ?: AssignRevokeOptions ) => Promise < void > ;
169165 revokeRoles : ( roleNames : string | string [ ] , userId : string , opts ?: AssignRevokeOptions ) => Promise < void > ;
@@ -177,12 +173,9 @@ const baseUsers = (connection: ConnectionREST): UsersBase => {
177173 } ;
178174} ;
179175
180- /** Optional arguments to /assign and /revoke endpoints. */
181- type AssignRevokeOptions = { userType ?: UserTypeInternal } ;
182-
183176const namespacedUsers = ( connection : ConnectionREST ) : NamespacedUsers => {
184177 return {
185- getAssignedRoles : ( userType : UserTypeInternal , userId : string , opts ?: GetAssingedRolesOptions ) =>
178+ getAssignedRoles : ( userType : UserTypeInternal , userId : string , opts ?: GetAssignedRolesOptions ) =>
186179 connection
187180 . get < WeaviateRole [ ] > (
188181 `/authz/users/${ userId } /roles/${ userType } ${ opts ?. includePermissions ? '?&includeFullRoles=true' : ''
0 commit comments