'use strict';
import { getUserPermissions } from './permission-checker.js';
import { getUserId } from '../auth/users/current-user-id-provider.js';
import { apiNotFoundError, apiInternalServerError } from '../../../../fd-toolbox/server/web/errors.js';
import { metaErrorMessages } from '../../constants/meta-error-messages-constants.js';
import { isPromiseFulfilled } from '../../../../fd-toolbox/lib/utils.js';
import { basicErrorMessages } from '../../../../base-repo/constants/internal-common-strings.js';

var __defProp=Object['defineProperty'],__name=(_0x1c891b,_0x1a7be1)=>__defProp(_0x1c891b,'name',{'value':_0x1a7be1,'configurable':!![]});async function buildUserPermissions(_0xa0cc45){const _0x498581=_0xa0cc45??await getUserId();if(!_0x498581)throw apiNotFoundError(basicErrorMessages['userNotFound']);const [_0x18d960]=await Promise['allSettled']([getUserPermissions(_0x498581)]);let _0x169b5f;if(isPromiseFulfilled(_0x18d960))_0x169b5f=_0x18d960['value'];else throw apiInternalServerError(metaErrorMessages['unexpectedPermissionError']);return _0x169b5f;}__name(buildUserPermissions,'buildUserPermissions');

export { buildUserPermissions };
