{"version":3,"file":"methods-DeeB8yR6.mjs","names":[],"sources":["../src/modules/auth/methods.ts"],"sourcesContent":["import type { ApiResponse } from '~/lib/api';\nimport { client } from '~/lib/fetch';\n\nimport type { Namespace } from '~/modules/namespaces/types';\nimport type { User } from '~/modules/users/types';\nimport { assignPermission } from '~/helpers/permissions/decorator';\n\nimport type { UserPermissions } from './types';\n\n/**\n * Get logged user info\n *\n *\n * @returns The logged user info\n */\nexport async function getCurrentUser(): Promise<User> {\n  const { content } = await client.fetch<ApiResponse<User>>('/auth/me');\n\n  return content;\n}\nassignPermission(getCurrentUser, 'GET /auth/me');\n\n/**\n * Get logged user accessible namespaces\n *\n * @returns Namespaces\n */\nexport async function getCurrentNamespaces(): Promise<\n  Omit<Namespace, 'fetchLogin' | 'fetchOptions'>[]\n> {\n  const { content } = await client.fetch<\n    ApiResponse<Omit<Namespace, 'fetchLogin' | 'fetchOptions'>[]>\n  >('/auth/me/namespaces');\n\n  return content;\n}\nassignPermission(getCurrentNamespaces, 'GET /auth/me/namespaces');\n\n/**\n * Get logged user permissions\n *\n * @returns Permissions\n */\nexport async function getCurrentPermissions(): Promise<UserPermissions> {\n  const { content } = await client.fetch<ApiResponse<UserPermissions>>(\n    '/auth/me/permissions'\n  );\n\n  return content;\n}\nassignPermission(getCurrentPermissions, 'GET /auth/me/permissions');\n"],"mappings":";;;;;;;;;;;AAeA,SAAsB;;;;kDAAgC;EACpD,MAAM,EAAE,YAAY,MAAM,OAAO,MAAyB,UAAU;EAEpE,OAAO;CACT;;;AACA,iBAAiB,gBAAgB,cAAc;;;;;;AAO/C,SAAsB;;;;wDAEpB;EACA,MAAM,EAAE,YAAY,MAAM,OAAO,MAE/B,qBAAqB;EAEvB,OAAO;CACT;;;AACA,iBAAiB,sBAAsB,yBAAyB;;;;;;AAOhE,SAAsB;;;;yDAAkD;EACtE,MAAM,EAAE,YAAY,MAAM,OAAO,MAC/B,sBACF;EAEA,OAAO;CACT;;;AACA,iBAAiB,uBAAuB,0BAA0B"}