PageSourceSearch

https://platform.unago.ai/assets/SecurityApiClient-CcFXgwTP.js

js unago.ai collected 2026-10-05 13:11:25 UTC 12,979 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AuthService-RwBp9Rl0.js","assets/rolldown-runtime-ChpBd9eV.js","assets/endpoints-DRdKXMZW.js","assets/authErrors-BJPPLK2J.js","assets/platformRoles-BJ7huaTr.js"])))=>i.map(i=>d[i]);
2import{t as p}from"./preload-helper-BrnWUoxD.js";import{n as c,t as u}from"./endpoints-DRdKXMZW.js";import{t as l}from"./BaseApiClient-CZoqO0gj.js";function h(e){if(!(e instanceof Error))return!1;const{status:t,errorKey:a}=e;return t===403&&a==="company_phone_management_required"}var m=class extends l{constructor(){super({baseURL:c(u.SECURITY.BASE),serviceName:"security-api",timeout:3e4,retryAttempts:2})}async getCompany(){try{const e=await this.get("/api/v1/company"),t=e?.data||e;return this.normalizeCompany(t)}catch(e){return console.error("[SecurityApiClient] getCompany error:",e),this.getDefaultCompany()}}async getCompanyById(e){return this.get(`/api/v1/companies/${e}`)}async updateCompany(e){try{const t=await this.patch("/api/v1/company",e),a=t?.data||t;return this.normalizeCompany(a)}catch(t){throw console.error("[SecurityApiClient] updateCompany error:",t),t}}async updateCompanyById(e,t){return this.patch(`/api/v1/companies/${e}`,t)}async discoverCompany(e){return this.post("/api/v1/companies/discover",{email:e})}async getRegistrationSettings(){return this.get("/api/v1/company/registration-settings")}async updateRegistrationSettings(e){return this.patch("/api/v1/company/registration-settings",e)}async listCompanyUsers(e){return this.get(`/api/v1/companies/${e}/users`)}async getCompanyUser(e,t){return this.get(`/api/v1/companies/${e}/users/${t}`)}async createCompanyUser(e,t){return this.post(`/api/v1/companies/${e}/users`,t)}async updateCompanyUser(e,t,a){return this.patch(`/api/v1/companies/${e}/users/${t}`,a)}async deleteCompanyUser(e,t){return this.delete(`/api/v1/companies/${e}/users/${t}`)}async login(e,t){return this.post("/api/v1/auth/login",{email:e,password:t})}async logout(){return this.post("/api/v1/auth/logout",{})}async deleteCurrentAccount(){const{authService:e}=await p(async()=>{const{authService:t}=await import("./AuthService-RwBp9Rl0.js").then(a=>a.n);return{authService:t}},__vite__mapDeps([0,1,2,3,4]));return e.deleteCurrentAccount()}async getAccountPhoneStatus(){const e=await this.get("/api/v1/auth/account/phone/status");return"data"in e?e.data:e}async initiateAccountPhoneVerification(e){const t=await this.post("/api/v1/auth/account/phone/initiate",{phoneNumber:e});return"data"in t?t.data:t}async verifyAccountPhone(e,t){const a=await this.post("/api/v1/auth/account/phone/ver
2ify",{phoneNumber:e,code:t});return"data"in a?a.data:a}async retryAccountSignupBonus(){await this.post("/api/v1/auth/account/phone/retry-bonus",{})}async getAuthEvents(e){const t=new URLSearchParams;e&&(e.companyId&&t.append("companyId",e.companyId),e.userId&&t.append("userId",e.userId),e.eventType&&t.append("eventType",e.eventType),e.authProvider&&t.append("authProvider",e.authProvider),e.success!==void 0&&t.append("success",String(e.success)),e.startTime&&t.append("startTime",e.startTime),e.endTime&&t.append("endTime",e.endTime),e.limit!==void 0&&t.append("limit",String(e.limit)),e.offset!==void 0&&t.append("offset",String(e.offset)));const a=t.toString(),i=a?`/api/v1/auth/events?${a}`:"/api/v1/auth/events",s=await this.get(i);return s?.data||s}async getHealthStatus(){return this.get("/health")}async getCompanyMetrics(){return console.warn("[SecurityApiClient] getCompanyMetrics: Backend endpoint not implemented, returning N/A placeholders"),{totalUsers:null,activeUsers:null,totalRoles:null,mcpToolsEnabled:null,lastKeyRotation:null}}async getCompanyRoles(){try{const e=await this.get("/api/v1/company/roles"),t=e?.data?.roles||e?.roles;let a=[];return Array.isArray(t)?a=t:t&&typeof t=="object"&&(a=Object.values(t)),{roles:a}}catch(e){return console.error("[SecurityApiClient] getCompanyRoles error:",e),{roles:[]}}}async createCompanyRole(e){try{const t=await this.post("/api/v1/company/roles",e);return t?.data?.role||t?.role||t}catch(t){throw console.error("[SecurityApiClient] createCompanyRole error:",t),t}}async updateCompanyRole(e,t){try{const a=await this.put(`/api/v1/company/roles/${encodeURIComponent(e)}`,t);return a?.data?.role||a?.role||a}catch(a){throw console.error("[SecurityApiClient] updateCompanyRole error:",a),a}}async deleteCompanyRole(e){try{await this.delete(`/api/v1/company/roles/${encodeURIComponent(e)}`)}catch(t){throw console.error("[SecurityApiClient] deleteCompanyRole error:",t),t}}normalizeCompany(e){return e?{...e,emailDomains:Array.isArray(e.emailDomains)?e.emailDomains:[],settings:{allowSelfRegistration:e?.settings?.allowSelfRegistration||!1,requireEmailVerification:e?.settings?.requireEmailVerification||!1,sessionTimeout:e?.settings?.sessionTimeout||30,maxLoginAttempts:e?.settings?.maxLoginAttempts||5,passwordPolicy:{minLength:e?.settings?.passwordPolicy?.minLength??12,requireUppercase:e?.settings?.passwordPolicy?.requireUppercase??!1,requireLowercase:e?.settings?.passwordPolicy?.requireLowercase??!1,requireNumbers:e?.settings?.passwordPolicy?.requireNumbers??!1,requireSymbols:e?.settings?.passwordPolicy?.requireSymbols??!1,maxAge:e?.settings?.passwordPolicy?.maxAge||90},mcpToolsEnabled:e?.settings?.mcpToolsEnabled||!1,auditLogRetention:e?.settings?.auditLogRetention||90,defaultRoles:Array.isArray(e?.settings?.defaultRoles)?e.settings.defaultRoles:[]}}:this.getDefaultCompany()}getDefaultCompany(){return{id:"",name:"Loading...",status:"active",emailDomains:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),createdBy:{type:"system",name:"System",id:"system"},settings:{allowSelfRegistration:!1,requireEmailVerification:!1,sessionTimeout:30,maxLoginAttempts:5,passwordPolicy:{minLength:8,requireUppercase:!1,requireLowercase:!1,requireNumbers:!1,requireSymbols:!1,maxAge:90},mcpToolsEnabled:!1,auditLogRetention:90,defaultRoles:[]}}}async adminListCompanies(){const e=await this.get("/api/v1/companies?limit=500");return e?.data||e}async adminGetCompanyDetail(e){const t=await this.get(`/api/v1/admin/companies/${e}/detail`),a=t?.data||t,i=a?.company||a;return{id:i?.id||e,name:i?.name||"",status:i?.status||"active",plan:i?.plan,emailDomains:i?.emailDomains,userCount:a?.userCount??a?.activeUserCount,users:(a?.users||[]).map(s=>{const n=(s.name||"").split(" "),r=n[0]||"",o=n.slice(1).join(" ")||"";return{id:s.id||s.userId,email:s.email,firstName:s.firstName||r,lastName:s.lastName||o,companyRoles:s.companyRoles||s.roles||[],active:s.active??(s.status==="active"||s.status===void 0),lastLogin:s.lastLogin||s.joinedAt||s.updatedAt,createdAt:s.createdAt||s.joinedAt}}),settings:i?.settings,createdAt:i?.createdAt||"",updatedAt:i?.updatedAt}}async adminListAllUsers(e){const t=new URLSearchParams;e?.companyId&&t.append("companyId",e.companyId),e?.search&&t.append("search",e.search),e?.limit&&t.append("limit",e.limit.toString()),e?.offset&&t.append("offset",e.offset.toString());const a=t.toString(),i=`/api/v1/admin/users${a?`?${a}`:""}`,s=await this.get(i);return s?.data||s}async adminUpdateSubscription(e,t){const a=await this.patch(`/api/v1/admin/companies/${e}/subscription`,t);return a?.data||a}async getUserApprovalRules(){return{rules:(await this.get("/api/v1/tools/approvals")).data||[]}}async deleteApprovalRule(e){return this.delete(`/api/v1/tools/approvals
2/${e}`)}async getCompanyToolPolicies(){const e=await this.get("/api/v1/tools/company-policies");return{policies:e.data?.policies||[],canManage:e.data?.canManage??!1}}async upsertCompanyToolPolicy(e){return(await this.put("/api/v1/tools/company-policies",e)).data}async deleteCompanyToolPolicy(e){return this.delete(`/api/v1/tools/company-policies/${e}`)}async getApprovalPolicy(){const e=await this.get("/api/v1/tools/approval-policy");return{configured:e.data.configured,policy:e.data.policy??null,canManage:e.data.canManage}}async getDefaultApprovalPolicy(){return(await this.get("/api/v1/tools/approval-policy/default")).data.policy}async saveApprovalPolicy(e){return(await this.put("/api/v1/tools/approval-policy",e)).data}async deleteApprovalPolicy(){return this.delete("/api/v1/tools/approval-policy")}async getCurrentCompanyUsers(){return(await this.get("/api/v1/company/users"))?.data?.users||[]}async getCompanyUsers(){try{return await this.getCurrentCompanyUsers()}catch(e){return console.error("[SecurityApiClient] getCompanyUsers error:",e),[]}}async deleteUser(e){return this.delete(`/api/v1/users/${e}`)}async createUser(e){const t=await this.post("/api/v1/users",e);return t?.data||t}async updateUser(e,t){const a=await this.put(`/api/v1/users/${e}`,t);return a?.data||a}async resetPassword(e,t){await this.post(`/api/v1/users/${e}/reset-password`,{newPassword:t})}async reconcileUsers(){const e=await this.post("/api/v1/admin/users/reconcile",{}),t=e?.data||e;return{totalKeycloakUsers:t?.totalKeycloakUsers||0,created:t?.created||0,updated:t?.updated||0,skipped:t?.skipped||0,errors:t?.errorDetails?.map(a=>a.error||a.message)||[]}}async getAvailableMCPTools(){try{return console.warn("[SecurityApiClient] getAvailableMCPTools: Backend endpoint not yet implemented (GET /api/v1/company/mcp-tools)"),[]}catch(e){return console.error("[SecurityApiClient] getAvailableMCPTools error:",e),[]}}async getAuditLogs(e){try{return console.warn("[SecurityApiClient] getAuditLogs: Backend endpoint not yet implemented (GET /api/v1/company/audit-logs)"),[]}catch(t){return console.error("[SecurityApiClient] getAuditLogs error:",t),[]}}async listPermissions(e){const t=new URLSearchParams;e?.scope&&t.append("scope",e.scope),e?.resource&&t.append("resource",e.resource),e?.category&&t.append("category",e.category),e?.isActive!==void 0&&t.append("isActive",e.isActive.toString()),e?.search&&t.append("search",e.search),e?.limit&&t.append("limit",e.limit.toString()),e?.offset&&t.append("offset",e.offset.toString());const a=`/api/v1/admin/permissions${t.toString()?"?"+t.toString():""}`,i=await this.get(a);return i?.data||i}async getPermission(e){const t=await this.get(`/api/v1/admin/permissions/${e}`);return t?.data||t}async createPermission(e){const t=await this.post("/api/v1/admin/permissions",e);return t?.data||t}async updatePermission(e,t){const a=await this.put(`/api/v1/admin/permissions/${e}`,t);return a?.data||a}async deletePermission(e){return this.delete(`/api/v1/admin/permissions/${e}`)}async listPermissionsByScope(e){const t=await this.get(`/api/v1/admin/permissions/scope/${e}`);return t?.data?.permissions||t?.permissions||[]}async getPermissionCategories(){const e=await this.get("/api/v1/permissions/categories");return e?.data||e?.categories||[]}async getPermissionsGrouped(){const e=await this.get("/api/v1/permissions/grouped");return e?.data||e?.categories||[]}async seedPermissions(){const e=await this.post("/api/v1/admin/permissions/seed",{});return e?.data||e}async listPages(){const e=await this.get("/api/v1/admin/pages");return e?.data?.pages||e?.pages||[]}async getPage(e){const t=await this.get(`/api/v1/admin/pages/${e}`);return t?.data||t}async createPage(e){const t=await this.post("/api/v1/admin/pages",e);return t?.data||t}async updatePage(e,t){const a=await this.put(`/api/v1/admin/pages/${e}`,t);return a?.data||a}async deletePage(e){return this.delete(`/api/v1/admin/pages/${e}`)}async getNavigationTree(){const e=await this.get("/api/v1/admin/pages/navigation");return e?.data?.pages||e?.pages||[]}async listPendingMembershipRequests(e,t){const a=new URLSearchParams;e!==void 0&&a.append("limit",String(e)),t!==void 0&&a.append("offset",String(t));const i=a.toString(),s=i?`/api/v2/membership/requests?${i}`:"/api/v2/membership/requests";return this.get(s)}async approveMembershipRequest(e){const t=await this.post(`/api/v2/membership/requests/${e}/approve`,{});return t?.data||t}async rejectMembershipRequest(e,t){const a=await this.post(`/api/v2/membership/requests/${e}/reject`,{reason:t});return a?.data||a}async createInvitation(e){const t=await this.post("/api/v2/membership/invitations",e);return{data:t?.data??t,emailSent:!!t?.emailSent,emailError:t?.emailError||void 0,message:t?.message}}async listInvitations(e){const t=new URLSearchParams;e&&t.append("status",e);const a=t.toString(),i=a?`/api/v2/membership/invitations?${a}`:"/api/v2/membership/invitations";return this.get(i)}async cancelInvitation(e){await this.delete(`/api/v2/membership/invitations/${e}`)}async resendInvitation(e){const t=await this.post(`/api/v2/membership/invitations/${e}/resend`,{});return{data:t?.data??t,emailSent:!!t?.emailSent,emailError:t?.emailError||void 0,message:t?.message}}async getInvitationByToken(e){const t=await this.get(`/api/v2/membership/invitations/token/${e}`,{skipAuth:!0});return t?.data||t}async acceptInvitation(e){const t=await this.post("/api/v2/membership/invitations/accept",e,{skipAuth:!0});return t?.data||t}async declineInvitation(e){await this.post("/api/v2/membership/invitations/decline",{token:e},{skipAuth:!0})}},v=new m;export{v as n,h as t};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.