nb-js-client 0.0.13 → 0.0.15

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.
Files changed (45) hide show
  1. package/dist/api/auth-api.service.d.ts +12 -11
  2. package/dist/api/connections-api.service.d.ts +9 -1
  3. package/dist/api/divide-api.service.d.ts +3 -1
  4. package/dist/api/extensions-api.service.d.ts +11 -2
  5. package/dist/api/extensions-external-api.service.d.ts +7 -2
  6. package/dist/api/fca-api.service.d.ts +6 -2
  7. package/dist/api/gateway-api.service.d.ts +18 -2
  8. package/dist/api/group-api.service.d.ts +13 -4
  9. package/dist/api/index.d.ts +6 -2
  10. package/dist/api/links-api.service.d.ts +17 -0
  11. package/dist/api/logstash-api.service.d.ts +9 -2
  12. package/dist/api/notification-api.service.d.ts +24 -0
  13. package/dist/api/role-api.service.d.ts +14 -9
  14. package/dist/api/share-api.service.d.ts +2 -1
  15. package/dist/api/storage-element-api.service.d.ts +34 -10
  16. package/dist/api/storage-files-api.service.d.ts +9 -2
  17. package/dist/api/storage-instance-api.service.d.ts +7 -0
  18. package/dist/api/storage-trash-api.service.d.ts +2 -1
  19. package/dist/api/user-api.service.d.ts +18 -1
  20. package/dist/api/version-api.service.d.ts +19 -0
  21. package/dist/bundle.cjs.js +1 -1
  22. package/dist/bundle.esm.js +1 -1
  23. package/dist/classes/client.d.ts +25 -33
  24. package/dist/classes/http-event.d.ts +24 -0
  25. package/dist/classes/http-response.d.ts +14 -0
  26. package/dist/classes/rest.d.ts +12 -7
  27. package/dist/classes/token-update.d.ts +2 -2
  28. package/dist/index.d.ts +600 -407
  29. package/dist/tools/get-cookie-value.d.ts +1 -1
  30. package/dist/tools/index.d.ts +1 -0
  31. package/dist/tools/normalize-headers.d.ts +1 -0
  32. package/dist/types/auth.d.ts +0 -2
  33. package/dist/types/base.d.ts +7 -3
  34. package/dist/types/connection.d.ts +2 -11
  35. package/dist/types/divide.d.ts +11 -1
  36. package/dist/types/extension.d.ts +1 -14
  37. package/dist/types/index.d.ts +3 -3
  38. package/dist/types/notification.d.ts +13 -8
  39. package/dist/types/request.d.ts +43 -0
  40. package/dist/types/setting.d.ts +1 -0
  41. package/dist/types/storage-trash.d.ts +11 -0
  42. package/dist/types/storage.d.ts +22 -39
  43. package/dist/types/user-log.d.ts +0 -8
  44. package/dist/types/user.d.ts +23 -17
  45. package/package.json +1 -1
@@ -1 +1 @@
1
- const t="/login",e=`${t}/ldap`,s=`${t}/update`;class i{constructor(t){this.client=t}info(){return this.client.rest.get(t)}login(e){return this.client.rest.post(t,JSON.stringify(e))}ldapLogin(t){return this.client.rest.post(e,JSON.stringify(t))}updateToken(t){const e=t.path?`${t.path}/${s}`:s;return t.path&&delete t.path,this.client.rest.post(e,JSON.stringify(t))}logout(){return this.client.rest.post("/logout")}}var r,n,o,c,a,l,h,d,u,p,g,f,_,$,v,y,k,m,S,w,O,x,N,b,J,A;!function(t){t.DEFAULT="",t.ASC="asc",t.DESC="desc"}(r||(r={})),function(t){t.WebSocket="websocket",t.PostMessage="postmessage",t.Empty=""}(n||(n={})),function(t){t.Storages="storages_connections_group",t.Webhooks="webhooks_connections_group",t.Unknown="unknown_connections_group",t.Proxy="proxy_connections_group"}(o||(o={})),function(t){t.SSH="ssh_connection",t.YandexDisk="yandex_disk",t.Mail="mail",t.Discord="discord",t.Webdav="webdav_connection",t.Nextcloud="nextcloud_connection",t.NextBox="nextbox_connection",t.HttpProxy="http_proxy_connection",t.S3="s3_connection"}(c||(c={})),function(t){t.App="app",t.File="file",t.WorkDir="work_dir"}(a||(a={})),function(t){t.Read="read",t.ReadAndWrite="read_and_write",t.Write="write"}(l||(l={})),function(t){t.Storage="/storage/element",t.Connection="/connections"}(h||(h={})),function(t){t.CLOSE="",t.READ="r",t.WRITE="rw"}(d||(d={})),function(t){t.WAITING="waiting",t.APPROVED="approved",t.REJECTED="rejected"}(u||(u={})),function(t){t.TRUE="true",t.FALSE="false"}(p||(p={})),function(t){t.User="to_user_id",t.Group="to_user_group_id"}(g||(g={})),function(t){t.Free="free",t.Business="business",t.Enterprise="enterprise"}(f||(f={})),function(t){t.NotActivated="License not activated",t.Blocked="License blocked",t.Expired="License has been expired",t.NotValid="License not valid",t.NotFound="license file not found"}(_||(_={})),function(t){t.Dir="dir",t.File="file",t.User="user",t.Other="other",t.WorkDir="work_dir",t.License="license",t.Extension="extension",t.Connection="connection"}($||($={})),function(t){t.OpenSharing="open_sharing",t.ChangeSharing="change_sharing",t.CancelSharing="cancel_sharing",t.DivideDirAddFileToOwner="divide_dir_add_file_to_owner",t.DivideDirAddDirToOwner="divide_dir_add_dir_to_owner",t.DivideDirAddWorkDirToOwner="divide_dir_add_work_dir_to_owner",t.DivideConnectionAddFileToOwner="divide_connection_add_file_to_owner",t.DivideConnectionAddDirToOwner="divide_connection_add_dir_to_owner",t.CancelDivideDir="cancel_divide_dir",t.CancelDivideFile="cancel_divide_file",t.CancelDivideWorkDir="cancel_divide_work_dir",t.CancelDivideConnection="cancel_divide_connection",t.DeleteExtension="delete_extension",t.NewVersionExtension="new_version_extension",t.Other="other"}(v||(v={})),function(t){t.Read="read",t.Unread="unread",t.Delete="delete"}(y||(y={})),function(t){t.Plain="plain",t.Success="success",t.Info="info",t.Warning="warning",t.Error="error"}(k||(k={})),function(t){t.NONE="none",t.SOFT="soft",t.HARD="hard"}(m||(m={})),function(t){t.Native="native",t.Ldap="ldap"}(S||(S={})),function(t){t.Registering="registering",t.Activated="activated",t.Blocked="blocked",t.BlockedByLicense="blocked_by_license"}(w||(w={})),function(t){t.User="user",t.Guest="guest",t.Emperor="emperor",t.Anonymous="anonymous"}(O||(O={})),function(t){t.Text="text",t.String="string",t.Number="number",t.CheckBox="checkbox",t.Select="select",t.RadioList="radio_list",t.ConnectionChoose="connection_choose",t.MultiConnectionChoose="multi_connection_choose"}(x||(x={})),function(t){t.Dir="dir",t.File="file",t.WorkDir="work_dir"}(N||(N={})),function(t){t.Any="any",t.Dir="dir",t.Code="code",t.Image="image",t.Audio="audio",t.Video="video",t.Text="text",t.Doc="doc",t.Xls="xls",t.Ppt="ppt"}(b||(b={})),function(t){t.my="my",t.fca="fca",t.divide="divide",t.share="share",t.favorite="favorite"}(J||(J={})),function(t){t.Create="create",t.Update="update",t.Move="move"}(A||(A={}));const D="/connections",P=`${D}/dashboard`;class U{constructor(t){this.client=t}list(t){return this.client.rest.get(D,t)}get(t){return this.client.rest.get(`${D}/${t}`)}update(t,e){return this.client.rest.put(`${D}/${t}`,JSON.stringify(e))}delete(t){return this.client.rest.delete(`${D}/${t}`)}create(t){const e={[c.SSH]:"/disk/ssh",[c.Webdav]:"/disk/webdav",[c.Nextcloud]:"/disk/nextcloud",[c.NextBox]:"/disk/nextbox",[c.Discord]:"/webhooks/discord",[c.Mail]:"/webhooks/mail",[c.HttpProxy]:"/http_proxy",[c.S3]:"/disk/s3"};return this.client.rest.post(e[t.type]||D,JSON.stringify(t))}dashboard(t){return this.client.rest.get(P,t)}}class T{constructor(t){this.client=t}discovery(t){return this.client.rest.get("/discovery",t)}}class E{constructor(t){this.client=t}divideDelete(t,e){return this.client.rest.delete(`${t}/divide/${e}`)}divideDeleteAll(t,e,s,i){return this.client.rest.delete(`${t}/divide`,Object.assign(Object.assign({},this.makeParam(t,e)),{is_to_user_group:i,access_mode:s}))}divideChange(t,e,s){return this.client.rest.put(`${t}/divide/${e}`,JSON.stringify({access_mode:s}))}divideCreate(t,e,s,i,r){const n=Object.assign(Object.assign({},this.makeParam(t,e)),{[r]:s,access_mode:i});return this.client.rest.post(`${t}/divide`,JSON.stringify(n))}divideUsers(t,e,s){return this.client.rest.get(`${t}/divide/users`,Object.assign(Object.assign({},this.makeParam(t,e)),s))}restrictions(t){return this.client.rest.get("/divide/restrictions",t)}restrictionsChange(t,e){return this.client.rest.put(`/divide/restrictions/${t}`,JSON.stringify(e))}makeParam(t,e){const s={};return t===h.Connection?s.connection_id=e:s.path=e,s}}const C="/static/extensions",I="/extensions/defaults";class R{constructor(t){this.client=t}getSetting(t){return this.client.rest.get(`${C}/${t}/settings`)}setSetting(t,e){return this.client.rest.post(`${C}/${t}/settings`,JSON.stringify(e))}deleteSetting(t){return this.client.rest.delete(`${C}/${t}/settings`)}get(t){return this.client.rest.get(`${C}/${t}`)}getByKey(t){return this.client.rest.get(`${C}/${t}`)}getDefault(t=[]){return this.client.rest.get(I,{ext_code:t})}setDefault(t,e){return this.client.rest.post(I,JSON.stringify({ext_code:t,ext_uniq_key:e}))}checkUpdates(){return this.client.rest.post("/static/extensions/check_updates")}updateVersion(t,e){return this.client.rest.put(`/static/extensions/${t}`,JSON.stringify({version:e}))}list(t){return this.client.rest.get(C,t)}delete(t,e){return this.client.rest.delete(`${C}/${t}`)}upload(t){const e=new FormData;return e.set("file",t),this.client.rest.post(C,e)}install(t,e){return this.client.rest.post("/static/extensions/site",JSON.stringify({uniq_key:t,version:e}))}}class q{constructor(t){this.client=t}listExtensionsSite(t){return this.client.rest.get("/anons_ext/extensions",t)}extensionDetailSite(t){return this.client.rest.get(`/anons_ext/extensions/${t}`)}extensionMarkdown(t){return this.client.rest.get(`/anons_ext/extensions/${t}/readme`)}}const j="/disk",F=`${j}/check`;class L{constructor(t){this.client=t}info(t,e){return this.client.rest.get(`${j}/${t}/element`,{path:e})}list(t,e){return this.client.rest.get(`${j}/${t}`,e)}create(t,e){return this.client.rest.post(`${j}/${t}/element`,JSON.stringify(e))}replace(t,e,s){return this.client.rest.put(`${j}/${t}/files?path=${e}`,s)}read(t,e){return this.client.rest.get(`${j}/${t}/files?path=${e}`)}upload(t,e,s=""){const i=new FormData;return i.set("path",s),i.set("file",e),this.client.rest.post(`${j}/${t}/files`,i)}delete(t,e){return this.client.rest.delete(`${j}/${t}/trash/element`,{path:e})}check(t){return this.client.rest.post(F,JSON.stringify(t))}}class W{constructor(t){this.client=t}settings(){return this.client.rest.get("/settings")}changeSettings(t){return this.client.rest.post("/settings",JSON.stringify(t))}queryInit(){return this.client.rest.get("/query/init")}}const B="/groups";class H{constructor(t){this.client=t}list(t){return this.client.rest.get(B,t)}listUsers(t){return this.client.rest.get(`${B}/${t}/users`)}create(t){return this.client.rest.post(B,JSON.stringify(t))}update(t,e){return this.client.rest.put(`${B}/${t}`,JSON.stringify(e))}delete(t){return this.client.rest.delete(`${B}/${t}`)}}const V="/license",M=`${V}/manual-check`,G=`${V}/hardware/hash`;class z{constructor(t){this.client=t}info(){return this.client.rest.get(V)}create(t){return this.client.rest.post(V,JSON.stringify(t))}check(){return this.client.rest.post(M)}delete(){return this.client.rest.delete(V)}getHash(){return this.client.rest.get(G)}}class K{constructor(t){this.client=t}getUsersLogs(t){return this.client.rest.get("/logs/users",t)}getSystemLogs(t){return this.client.rest.get(t)}}const X="/roles",Y=`${X}/default`;class Q{constructor(t){this.client=t}list(t){return this.client.rest.get(X,t)}get(t){return this.client.rest.get(`${X}/${t}`)}getDefault(){return this.client.rest.get(`${Y}`)}create(t){return this.client.rest.post(X,JSON.stringify(t))}update(t,e){return this.client.rest.put(`${X}/${t}`,JSON.stringify(e))}delete(t){return this.client.rest.delete(`${X}/${t}`)}permissions(){return this.client.rest.get("/permissions")}addPermissions(t,e){return this.client.rest.put(`${X}/${t}/permissions`,JSON.stringify({ids:e}))}deletePermissions(t,e){return this.client.rest.delete(`${X}/${t}/permissions`,{ids:e})}}const Z="/users",tt=`${Z}/me`,et=`${tt}/avatars`,st=`${tt}/sessions`,it=`${tt}/tokens`,rt=`${tt}/change-password`;class nt{constructor(t){this.client=t}list(t){return this.client.rest.get(Z,t)}get(t){return this.client.rest.get(Z+`/${t}`)}create(t){return this.client.rest.post(Z,JSON.stringify(t))}update(t,e){return this.client.rest.put(Z+`/${t}`,JSON.stringify(e))}delete(t,e){return this.client.rest.delete(`${Z}/${t}`,e)}restore(t){return this.client.rest.post(`${Z}/${t}/restore`)}me(){return this.client.rest.get(tt)}updateMe(t){return this.client.rest.put(tt,JSON.stringify(t))}createToken(t){return this.client.rest.post(it,JSON.stringify(t))}listToken(t){return this.client.rest.get(it,t)}deleteToken(t){return this.client.rest.delete(`${it}/${t}`)}changeMyPassword(t){return this.client.rest.put(rt,JSON.stringify(t))}changeUsersPassword(t,e){return this.client.rest.put(`${Z}/${t}/change-password`,JSON.stringify(e))}meUploadAvatar(t,e){const s=new FormData;return s.append("file",t,e),this.client.rest.post(et,s)}meDeleteAvatar(){return this.client.rest.delete(et)}meListSession(t){return this.client.rest.get(st,t)}meDeleteSession(t){let e=st;return t&&(e+=`/${t}`),this.client.rest.delete(e)}setRole(t,e=null){return this.client.rest.put(`${Z}/${t}/roles`,JSON.stringify({role_id:e}))}}class ot{constructor(t){this.client=t}info(t,e){const s=new URLSearchParams({path:t,share_token:e});return this.client.rest.get(`/share?${s.toString()}`)}checkPassword(t,e){const s=encodeURIComponent(t);return this.client.rest.get(`share/password?share_token=${e}&share_pass=${s}`)}checkToken(t){return this.client.rest.get(`share?share_token=${t}`)}restrictions(t){return this.client.rest.get("/share/restrictions",t)}restrictionsChange(t,e){return this.client.rest.put(`/share/restrictions/${t}`,JSON.stringify(e))}}const ct="/storage/element/share";class at{constructor(t){this.client=t}info(t){return this.client.rest.get(ct,{path:t})}create(t,e){const s={path:t,permissions_type:e};return this.client.rest.post(ct,JSON.stringify(s))}change(t){return this.client.rest.put(`${ct}/${t.token}`,JSON.stringify(t))}delete(t){return this.client.rest.delete(ct,{path:t})}refresh(t){return this.client.rest.put(`${ct}/${t}/refresh`)}}const lt="/storage",ht=`${lt}/element`,dt=`${ht}/move`,ut=`${ht}/copy`,pt=`${ht}/history`,gt=`${ht}/version`,ft=`${gt}/current`;class _t{constructor(t){this.client=t}list(t){return this.client.rest.get(lt,t)}info(t){var e;return parseInt((null===(e=t.divide_id)||void 0===e?void 0:e.toString())||"")||delete t.divide_id,t.file_version_id||delete t.file_version_id,this.client.rest.get(ht,t)}size(t){var e;return parseInt((null===(e=t.divide_id)||void 0===e?void 0:e.toString())||"")||delete t.divide_id,this.client.rest.post(`${ht}/size`,JSON.stringify(t))}move(t,e=!1){const{from_divide_id:s,to_divide_id:i}=t,r=Object.assign(Object.assign({},t),{from_divide_id:null,to_divide_id:null});return e?s?i?this.client.rest.post(`/disk/${s}/files/move/disk/${i}`,JSON.stringify(r)):this.client.rest.put(`/disk/${s}/files/to/box`,JSON.stringify(r)):this.client.rest.put(`/disk/${i}/files/from/box`,JSON.stringify(r)):this.client.rest.post(dt,JSON.stringify(t))}copy(t,e,s){const{from_divide_id:i,to_divide_id:r}=t;let n=Object.assign(Object.assign({},t),{from_divide_id:null,to_divide_id:null});return s===J.fca&&e===J.fca?this.client.rest.post(`/disk/${i}/files/copy/disk/${r}`,JSON.stringify(n)):s===J.fca?(i&&(n.from_divide_id=i),this.client.rest.post(`/disk/${r}/files/from/box`,JSON.stringify(n))):e===J.fca?(r&&(n.to_divide_id=r),this.client.rest.post(`/disk/${i}/files/to/box`,JSON.stringify(n))):this.client.rest.post(ut,JSON.stringify(t))}pasteFromShared(t,e,s){const i={from_sharing_token:t,from_sharing_password:s,paths:e};return this.client.rest.post("/storage/element/copy",JSON.stringify(i))}create(t){return this.client.rest.post(ht,JSON.stringify(t))}delete(t,e){const s={path:t};return e&&(s.divide_id=e),this.client.rest.delete(ht,s)}favorite(t){return this.client.rest.put(`${ht}?path=${encodeURIComponent(t)}`,JSON.stringify({is_favorite:!0}))}removeFavorite(t){return this.client.rest.put(`${ht}?path=${encodeURIComponent(t)}`,JSON.stringify({is_favorite:!1}))}createItem(t){return this.client.rest.post(ht,JSON.stringify(t))}createWorkDir(t){return this.client.rest.post(ht,JSON.stringify(t))}history(t){return this.client.rest.get(pt,t)}versions(t){return this.client.rest.get(gt,t)}createVersion(t){return this.client.rest.post(gt,JSON.stringify(t))}editVersion(t){return this.client.rest.put(gt,JSON.stringify(t))}deleteVersion(t){return this.client.rest.delete(gt,t)}makeCurrentVersion(t){return this.client.rest.post(ft,JSON.stringify(t))}}const $t="/storage/trash",vt=`${$t}/element`,yt=`${vt}/all`;class kt{constructor(t){this.client=t}list(t){return this.client.rest.get($t,t)}clear(t){return this.client.rest.delete(vt,t)}clearAll(){return this.client.rest.delete(yt)}restore(t){return this.client.rest.patch(vt,JSON.stringify({del_groups:t}))}}function mt(t,e,s,i){return new(s||(s=Promise))((function(r,n){function o(t){try{a(i.next(t))}catch(t){n(t)}}function c(t){try{a(i.throw(t))}catch(t){n(t)}}function a(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,c)}a((i=i.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class St extends Error{}function wt(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(t){return decodeURIComponent(atob(t).replace(/(.)/g,((t,e)=>{let s=e.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s})))}(e)}catch(t){return atob(e)}}function Ot(t,e){if("string"!=typeof t)throw new St("Invalid token specified: must be a string");e||(e={});const s=!0===e.header?0:1,i=t.split(".")[s];if("string"!=typeof i)throw new St(`Invalid token specified: missing part #${s+1}`);let r;try{r=wt(i)}catch(t){throw new St(`Invalid token specified: invalid base64 for part #${s+1} (${t.message})`)}try{return JSON.parse(r)}catch(t){throw new St(`Invalid token specified: invalid json for part #${s+1} (${t.message})`)}}St.prototype.name="InvalidTokenError";class xt{constructor(t){var e,s;this.name="HttpErrorResponse",this.ok=!1,this.message=t.error?`${t.error.message}`:"HttpErrorResponse",this.error=t.error||null,this.status=null!==(e=t.status)&&void 0!==e?e:500,this.statusText=null!==(s=t.statusText)&&void 0!==s?s:"Internal Server Error",this.headers=t.headers,this.url=t.url}}const Nt=(t,e)=>mt(void 0,void 0,void 0,(function*(){let s=e;for(const e of t)try{s=yield e.fulfilled(s)}catch(t){if(!e.rejected)throw t;s=yield e.rejected(t)}return s})),bt=t=>{const e=document.cookie.split(";"),s=t+"=";for(let t of e)if(t=t.trim(),t.startsWith(s)){let e=t.substring(s.length);return decodeURIComponent(e)}return null},Jt=t=>{const e=new URLSearchParams;return Object.keys(t).forEach((s=>{Array.isArray(t[s])?t[s].forEach((t=>{e.append(s,t)})):e.append(s,t[s])})),e};class At{constructor(t,e){this.client=t,this.tokenUpdate=e}get state(){return this.client.state}get(t,e){return this.sendRequest("GET",t,{query:e,cache:"no-cache"})}post(t,e){return this.sendRequest("POST",t,{body:e})}put(t,e){return this.sendRequest("PUT",t,{body:e,cache:"no-cache"})}patch(t,e){return this.sendRequest("PATCH",t,{body:e})}delete(t,e){return this.sendRequest("DELETE",t,{query:e})}sendRequest(t,e){return mt(this,arguments,void 0,(function*(t,e,s={}){var i;const r=null!==(i=this.state.skipInterceptors)&&void 0!==i&&i;this.state.skipInterceptors=!1;let n={method:t,headers:this.state.requestParams.headers,cache:s.cache||this.state.requestParams.cache,body:s.body||this.state.requestParams.body};if(r||(n=yield Nt(this.client.requestInterceptors,n)),this.state.authToken)for(const[t,s]of this.state.authToken.entries()){const i=Ot(s.access_token);if(i&&i.is_remember&&this.tokenUpdate.isTokenExpire(i.exp)&&!e.includes("/login")&&!e.includes("/assets")){const e=yield this.tokenUpdate.refreshToken(s);e&&(this.state.authToken.set(t,e),n=yield Nt(this.client.requestInterceptors,n))}}s.query&&(e+="?"+Jt(s.query));const o=`${this.state.clientParams.host}/api/v${this.state.clientParams.version||1}${e}`.replace(/([^:]\/)+\/+/g,"$1");let c=yield((t,e)=>mt(this,void 0,void 0,(function*(){try{const s=yield fetch(t,e);let i;try{i=yield s.clone().json()}catch(t){i=yield s.text()}if(!s.ok)throw new xt({error:i,status:s.status,statusText:s.statusText,url:s.url});return s}catch(t){throw yield Nt(this.client.responseInterceptors,t),t}})))(o,n);return c=yield Nt(this.client.responseInterceptors,c),c}))}}const Dt="/notifications",Pt=`${Dt}/all`,Ut=`${Dt}/subscription`,Tt=`${Dt}/permission`;class Et{constructor(t){this.client=t}list(t){return this.client.rest.get(Dt,t)}toggleStatus(t,e){return this.client.rest.put(Dt,JSON.stringify({ids:t,to_status:e}))}toggleAllStatus(t){return this.client.rest.put(Pt,JSON.stringify({to_status:t}))}delete(t){return this.client.rest.delete(Dt,{id:t})}deleteAll(){return this.client.rest.delete(Pt)}getPermission(){return this.client.rest.get(Tt)}setPermission(t){return this.client.rest.post(Tt,JSON.stringify({enabled:t}))}getSubscription(){return this.client.rest.get(Ut)}setSubscription(t){const e={action_groups:Object.assign({},t)};return this.client.rest.post(Ut,JSON.stringify(e))}}const Ct="/storage/files",It=`${Ct}/net`;class Rt{constructor(t){this.client=t}read(t,e){return e.path=t,this.client.rest.get(Ct,e)}replace(t,e){const s=new URLSearchParams;return Object.keys(t).forEach((e=>{t[e]&&s.append(e,t[e])})),this.client.rest.put(`${Ct}?${s.toString()}`,e)}upload(t,e,s){const i=new FormData;return i.set("path",e),i.set("file",t),s&&i.set("divide_id",s.toString()),this.client.rest.post(Ct,i)}uploadNet(t){return this.client.rest.post(It,JSON.stringify(t))}}class qt{constructor(t){this.authApiService=t,this.isUpdating=!1,this.tokenUpdatePromise=null,this.tokenUpdateResolve=null}isTokenExpire(t){if(!t)return!1;return 1e3*t<=(new Date).getTime()+3e3}refreshToken(t){return mt(this,void 0,void 0,(function*(){const{access_token:e,refresh_token:s}=t;if(!e||!s)return null;if(this.isUpdating)return this.waitForTokenUpdate();this.isUpdating=!0;try{const e=yield this.authApiService.updateToken(t);if(e&&e.access_token&&e.refresh_token){const t={access_token:e.access_token,refresh_token:e.refresh_token};return bt("access_token")===t.access_token&&localStorage.setItem("refresh-token",t.refresh_token),this.tokenUpdateResolve&&(this.tokenUpdateResolve(t),this.tokenUpdateResolve=null),t}return null}catch(t){throw t}finally{this.isUpdating=!1}}))}waitForTokenUpdate(){return this.tokenUpdatePromise||(this.tokenUpdatePromise=new Promise((t=>{this.tokenUpdateResolve=t}))),this.tokenUpdatePromise}}class jt{constructor(t){this.AuthApi=new i(this),this.ConnectionsApi=new U(this),this.DiscoveryApi=new T(this),this.DivideApi=new E(this),this.ExtensionsApi=new R(this),this.ExtensionsExternalApi=new q(this),this.FcaApi=new L(this),this.GatewayApi=new W(this),this.GroupApi=new H(this),this.LicenseApi=new z(this),this.LogstashApi=new K(this),this.NotificationsApi=new Et(this),this.RoleApi=new Q(this),this.ShareApi=new ot(this),this.StorageElementApi=new _t(this),this.StorageFilesApi=new Rt(this),this.StorageShareApi=new at(this),this.StorageTrashApi=new kt(this),this.UserApi=new nt(this),this.tokenUpdate=new qt(this.AuthApi),this.rest=new At(this,this.tokenUpdate),this.requestInterceptors=[],this.responseInterceptors=[],this.request={use:(t,e)=>{this.requestInterceptors.push({fulfilled:t,rejected:e})}},this.response={use:(t,e)=>{this.responseInterceptors.push({fulfilled:t,rejected:e})}},this.state={clientParams:{host:(null==t?void 0:t.host)||"",version:(null==t?void 0:t.version)||1},requestParams:{path:"",headers:{},query:{},body:null,cache:"no-cache"},authToken:null,skipInterceptors:!1}}resetParams(t){return new Promise((e=>{const{host:s,version:i,headers:r,cache:n,authTokens:o,skipInterceptors:c}=t;this.state={clientParams:{host:s||this.state.clientParams.host,version:null!=i?i:this.state.clientParams.version},requestParams:Object.assign(Object.assign({},this.state.requestParams),{headers:r||this.state.requestParams.headers,cache:n||this.state.requestParams.cache}),authToken:o||this.state.authToken,skipInterceptors:c||this.state.skipInterceptors},e()}))}}export{i as AuthApiService,jt as Client,o as ConnectionGroup,c as ConnectionType,U as ConnectionsApiService,T as DiscoveryApiService,E as DivideApiService,g as DivideMode,h as DivideScope,n as EngineType,l as ExtensionFileMode,a as ExtensionType,R as ExtensionsApiService,q as ExtensionsExternalApiService,L as FcaApiService,W as GatewayApiService,H as GroupApiService,z as LicenseApiService,_ as LicenseError,K as LogstashApiService,v as NotificationAction,$ as NotificationEntityType,y as NotificationRowAction,k as NotificationStyle,r as OrderDirection,d as PermissionType,At as Rest,p as RestrictionBooleanStatus,m as RestrictionSharing,u as RestrictionStatus,Q as RoleApiService,x as SettingControlType,ot as ShareApiService,_t as StorageElementApiService,b as StorageElementContentType,A as StorageElementHistoryAction,N as StorageElementType,J as StorageRoot,at as StorageShareApiService,kt as StorageTrashApiService,f as Tariff,qt as TokenUpdate,nt as UserApiService,S as UserAuthType,w as UserStatus,O as UserType,Nt as applyInterceptors,bt as getCookieValue,Jt as makeUrlParams};
1
+ const e="/login",t=`${e}/ldap`,s=`${e}/update`;class i{constructor(e){this.client=e}info(){return this.client.rest.get(e)}login(t){return this.client.rest.post(e,JSON.stringify(t))}ldapLogin(e){return this.client.rest.post(t,JSON.stringify(e))}updateToken(e){const t=e.path?`${e.path}/${s}`:s;return e.path&&delete e.path,this.client.rest.post(t,JSON.stringify(e))}logout(){return this.client.rest.post("/logout")}}var n;!function(e){e.LicenseRead="license_read",e.LicenseManage="license_edit",e.UsersRead="users_read",e.UsersCreate="users_create",e.UsersActivate="users_activate",e.GroupsRead="groups_read",e.GroupsCreate="groups_create",e.RolesRead="roles_read",e.RolesCreate="roles_create",e.Share="share",e.Divide="divide",e.ExtensionsRead="extensions_read",e.ExtensionsManage="extensions_write",e.RestrictionShareRead="restriction_share_read",e.RestrictionShareWrite="restriction_share_write",e.RestrictionDivideRead="restriction_divide_read",e.RestrictionDivideWrite="restriction_divide_write",e.ReadUserLogs="read_user_logs",e.ReadSystemLogs="read_system_logs",e.ConnectionsRead="connections_read",e.ConnectionsDividing="connections_dividing",e.ConnectionsYandexDisk="connections_yandex_disk",e.ConnectionsSsh="connections_ssh",e.ConnectionsMail="connections_mail",e.ConnectionsS3="connections_s3",e.ConnectionsDiscord="connections_discord",e.ConnectionsWebdav="connections_webdav",e.ConnectionsNextcloud="connections_nextcloud",e.ConnectionsNextbox="connections_nextbox",e.ConnectionsHttpProxy="connections_http_proxy",e.SystemInfoServiceList="system_info_service_list",e.SettingsRead="settings_read",e.SettingsWrite="settings_write"}(n||(n={}));const r=[n.ConnectionsYandexDisk,n.ConnectionsSsh,n.ConnectionsMail,n.ConnectionsS3,n.ConnectionsS3,n.ConnectionsDiscord,n.ConnectionsWebdav,n.ConnectionsNextcloud,n.ConnectionsNextbox,n.ConnectionsHttpProxy];var o,c,a,l,d,h,u,p,g,f,_,v,S,y,$,k,m,w,O,x,b,N,A,C,D,T,U,J,P,E;!function(e){e.DEFAULT="",e.ASC="asc",e.DESC="desc"}(o||(o={})),function(e){e.WebSocket="websocket",e.PostMessage="postmessage",e.Empty=""}(c||(c={})),function(e){e.Storages="storages_connections_group",e.Webhooks="webhooks_connections_group",e.Unknown="unknown_connections_group",e.Proxy="proxy_connections_group"}(a||(a={})),function(e){e.SSH="ssh_connection",e.YandexDisk="yandex_disk",e.Mail="mail",e.Discord="discord",e.Webdav="webdav_connection",e.Nextcloud="nextcloud_connection",e.NextBox="nextbox_connection",e.HttpProxy="http_proxy_connection",e.S3="s3_connection"}(l||(l={})),function(e){e.App="app",e.File="file",e.WorkDir="work_dir"}(d||(d={})),function(e){e.Read="read",e.ReadAndWrite="read_and_write",e.Write="write"}(h||(h={})),function(e){e.Storage="/storage/element",e.Connection="/connections"}(u||(u={})),function(e){e.CLOSE="",e.READ="r",e.WRITE="rw"}(p||(p={})),function(e){e.WAITING="waiting",e.APPROVED="approved",e.REJECTED="rejected"}(g||(g={})),function(e){e.TRUE="true",e.FALSE="false"}(f||(f={})),function(e){e.User="to_user_id",e.Group="to_user_group_id"}(_||(_={})),function(e){e.Divide="divide",e.Share="share"}(v||(v={})),function(e){e.Free="free",e.Business="business",e.Enterprise="enterprise"}(S||(S={})),function(e){e.NotActivated="License not activated",e.Blocked="License blocked",e.Expired="License has been expired",e.NotValid="License not valid",e.NotFound="license file not found"}(y||(y={})),function(e){e.Dir="dir",e.File="file",e.User="user",e.Other="other",e.WorkDir="work_dir",e.License="license",e.Extension="extension",e.Connection="connection"}($||($={})),function(e){e.OpenSharing="open_sharing",e.ChangeSharing="change_sharing",e.CancelSharing="cancel_sharing",e.DivideDirAddFileToOwner="divide_dir_add_file_to_owner",e.DivideDirAddDirToOwner="divide_dir_add_dir_to_owner",e.DivideDirAddWorkDirToOwner="divide_dir_add_work_dir_to_owner",e.DivideConnectionAddFileToOwner="divide_connection_add_file_to_owner",e.DivideConnectionAddDirToOwner="divide_connection_add_dir_to_owner",e.CancelDivideDir="cancel_divide_dir",e.CancelDivideFile="cancel_divide_file",e.CancelDivideWorkDir="cancel_divide_work_dir",e.CancelDivideConnection="cancel_divide_connection",e.DeleteExtension="delete_extension",e.NewVersionExtension="new_version_extension",e.TransferData="transfer_data",e.AllowInternalAccessUser="allow_internal_access_to_user",e.BlockInternalAccessUser="block_internal_access_to_user",e.WaitInternalAccessUser="wait_internal_access_to_user",e.WaitInternalAccessUserCreate="wait_internal_access_to_user_create",e.AllowInternalAccessGroup="allow_internal_access_to_group",e.BlockInternalAccessGroup="block_internal_access_to_group",e.WaitInternalAccessGroup="wait_internal_access_to_group",e.WaitInternalAccessGroupCreate="wait_internal_access_to_group_create",e.AllowSharing="allow_sharing",e.BlockSharing="block_sharing",e.WaitSharing="wait_sharing",e.WaitSharingCreate="wait_sharing_create",e.Other="other"}(k||(k={})),function(e){e.Read="read",e.Unread="unread",e.Delete="delete"}(m||(m={})),function(e){e.Plain="plain",e.Success="success",e.Info="info",e.Warning="warning",e.Error="error"}(w||(w={})),function(e){e.ArrayBuffer="arraybuffer",e.Blob="blob",e.Json="json",e.Text="text"}(O||(O={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH",e.DELETE="DELETE"}(x||(x={})),function(e){e.Body="body",e.Response="response"}(b||(b={})),function(e){e.NONE="none",e.SOFT="soft",e.HARD="hard"}(N||(N={})),function(e){e.Native="native",e.Ldap="ldap"}(A||(A={})),function(e){e.Registering="registering",e.Activated="activated",e.Blocked="blocked",e.BlockedByLicense="blocked_by_license"}(C||(C={})),function(e){e.User="user",e.Guest="guest",e.Emperor="emperor",e.Anonymous="anonymous"}(D||(D={})),function(e){e.Text="text",e.String="string",e.Number="number",e.CheckBox="checkbox",e.Select="select",e.RadioList="radio_list",e.ConnectionChoose="connection_choose",e.MultiConnectionChoose="multi_connection_choose"}(T||(T={})),function(e){e.Dir="dir",e.File="file",e.WorkDir="work_dir"}(U||(U={})),function(e){e.Any="any",e.Dir="dir",e.Code="code",e.Image="image",e.Audio="audio",e.Video="video",e.Text="text",e.Doc="doc",e.Xls="xls",e.Ppt="ppt"}(J||(J={})),function(e){e.my="my",e.fca="fca",e.divide="divide",e.share="share",e.favorite="favorite"}(P||(P={})),function(e){e.Create="create",e.Update="update",e.Move="move"}(E||(E={}));const R="/connections",I=`${R}/dashboard`;class L{constructor(e){this.client=e}list(e){return this.client.rest.get(R,e)}get(e){return this.client.rest.get(`${R}/${e}`)}update(e,t){return this.client.rest.put(`${R}/${e}`,JSON.stringify(t))}delete(e){return this.client.rest.delete(`${R}/${e}`)}create(e){const t={[l.SSH]:"/disk/ssh",[l.Webdav]:"/disk/webdav",[l.Nextcloud]:"/disk/nextcloud",[l.NextBox]:"/disk/nextbox",[l.Discord]:"/webhooks/discord",[l.Mail]:"/webhooks/mail",[l.HttpProxy]:"/http_proxy",[l.S3]:"/disk/s3"};return this.client.rest.post(t[e.type]||R,JSON.stringify(e))}dashboard(e){return this.client.rest.get(I,e)}}class j{constructor(e){this.client=e}discovery(e){return this.client.rest.get("/discovery",e)}}class W{constructor(e){this.client=e}divideDelete(e,t){return this.client.rest.delete(`${e}/divide/${t}`)}divideDeleteAll(e,t,s,i){return this.client.rest.delete(`${e}/divide`,Object.assign(Object.assign({},this.makeParam(e,t)),{is_to_user_group:i,access_mode:s}))}divideChange(e,t,s){return this.client.rest.put(`${e}/divide/${t}`,JSON.stringify({access_mode:s}))}divideCreate(e,t,s,i,n){const r=Object.assign(Object.assign({},this.makeParam(e,t)),{[n]:s,access_mode:i});return this.client.rest.post(`${e}/divide`,JSON.stringify(r))}divideUsers(e,t,s){return this.client.rest.get(`${e}/divide/users`,Object.assign(Object.assign({},this.makeParam(e,t)),s))}getRestriction(e){return this.client.rest.get(`/divide/restrictions/${e}`)}restrictionSize(e,t){return this.client.rest.get(`/${t}/restrictions/${e}/size`)}restrictions(e){return this.client.rest.get("/divide/restrictions",e)}restrictionsChange(e,t){return this.client.rest.put(`/divide/restrictions/${e}`,JSON.stringify(t))}makeParam(e,t){const s={};return e===u.Connection?s.connection_id=t:s.path=t,s}}function F(e,t,s,i){return new(s||(s=Promise))((function(n,r){function o(e){try{a(i.next(e))}catch(e){r(e)}}function c(e){try{a(i.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,c)}a((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class q extends Error{}function B(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let s=t.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s})))}(t)}catch(e){return atob(t)}}function H(e,t){if("string"!=typeof e)throw new q("Invalid token specified: must be a string");t||(t={});const s=!0===t.header?0:1,i=e.split(".")[s];if("string"!=typeof i)throw new q(`Invalid token specified: missing part #${s+1}`);let n;try{n=B(i)}catch(e){throw new q(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(n)}catch(e){throw new q(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}q.prototype.name="InvalidTokenError";const G=(e,t)=>F(void 0,void 0,void 0,(function*(){let s=t;for(const t of e)try{s=yield t.fulfilled(s)}catch(e){if(!t.rejected)throw e;s=yield t.rejected(e)}return s}));function M(e){var t;return null!==(t=Object.fromEntries(document.cookie.split(";").map((e=>e.split("="))).map((([e,t])=>[e.trim(),decodeURIComponent(t||"")])))[e])&&void 0!==t?t:null}const V=e=>{const t=new URLSearchParams;return Object.keys(e).forEach((s=>{Array.isArray(e[s])?e[s].forEach((e=>{t.append(s,e)})):t.append(s,e[s])})),t};function z(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}const Y="/api/v1",X="/api/v2",K=`${window.location.protocol}//${window.location.host}`;class Q{constructor(e,t){this.client=e,this.tokenUpdate=t}get state(){return this.client.state}get(e,t,s){return this.request(x.GET,e,Object.assign({params:t,cache:"no-cache"},s))}post(e,t,s){return this.request(x.POST,e,Object.assign({body:t},s))}put(e,t,s){return this.request(x.PUT,e,Object.assign({body:t,cache:"no-cache"},s))}patch(e,t,s){return this.request(x.PATCH,e,Object.assign({body:t},s))}delete(e,t,s){return this.request(x.DELETE,e,Object.assign({params:t},s))}request(e,t,s){return F(this,void 0,void 0,(function*(){return new Promise(((i,n)=>F(this,void 0,void 0,(function*(){var r,o;const c=null!==(r=this.state.skipInterceptors)&&void 0!==r&&r;this.state.skipInterceptors=!1;let a=Object.assign({method:e},s);if(c||(s=yield G(this.client.requestInterceptors,a)),this.state.authToken)for(const[e,i]of this.state.authToken.entries()){const n=H(i.access_token);if(n&&n.is_remember&&this.tokenUpdate.isTokenExpire(n.exp)&&!t.includes("/login")&&!t.includes("/assets")){const t=yield this.tokenUpdate.refreshToken(i);t&&(this.state.authToken.set(e,t),s=yield G(this.client.requestInterceptors,a))}}const l=new XMLHttpRequest;(null==s?void 0:s.params)&&0!==Object.keys(s.params).length&&(t+="?"+V(s.params));const d=`${this.state.clientParams.host}${this.state.clientParams.version}${t}`;if(l.open(e,d,!0),null==s?void 0:s.headers){const e=z(s.headers);for(const[t,s]of Object.entries(e))l.setRequestHeader(t,s)}(null==s?void 0:s.responseType)&&(l.responseType=s.responseType),l.upload&&(l.upload.onprogress=e=>{e.lengthComputable&&(null==s?void 0:s.onUploadProgress)&&s.onUploadProgress(e)}),l.onload=()=>F(this,void 0,void 0,(function*(){const e=new Headers;let t;switch(l.getAllResponseHeaders().split("\r\n").forEach((t=>{const[s,i]=t.split(": ");s&&i&&e.append(s,i)})),null==s?void 0:s.responseType){case O.Text:t=l.responseText;case O.Blob:case O.ArrayBuffer:t=l.response;default:try{t=JSON.parse(l.responseText)}catch(e){t=l.responseText}}let r={status:l.status,statusText:l.statusText,headers:e,body:t};r=yield G(this.client.responseInterceptors,r),l.status>=200&&l.status<300?(null==s?void 0:s.observe)===b.Response?i(r):i(t):n({status:l.status,statusText:l.statusText,headers:e,error:t})})),l.onerror=()=>n(new Error("Network error")),l.send(null!==(o=null==s?void 0:s.body)&&void 0!==o?o:null)}))))}))}changeBaseUrlVersion(e,t){return F(this,void 0,void 0,(function*(){const s=this.state.clientParams.version;this.state.clientParams.version=e;try{return yield t()}finally{this.state.clientParams.version=s}}))}changeHost(e,t){return F(this,void 0,void 0,(function*(){this.state.clientParams.host=e,this.state.requestParams.headers={};try{return yield t()}finally{this.state.clientParams.host=K}}))}}class Z{constructor(e){this.authApiService=e,this.isUpdating=!1,this.tokenUpdatePromise=null,this.tokenUpdateResolve=null}isTokenExpire(e){if(!e)return!1;return 1e3*e<=(new Date).getTime()+3e3}refreshToken(e){return F(this,void 0,void 0,(function*(){const{access_token:t,refresh_token:s}=e;if(!t||!s)return null;if(this.isUpdating)return this.waitForTokenUpdate();this.isUpdating=!0;try{const t=yield this.authApiService.updateToken(e);if(t&&t.access_token&&t.refresh_token){const e={access_token:t.access_token,refresh_token:t.refresh_token};return M("access_token")===e.access_token&&localStorage.setItem("refresh-token",e.refresh_token),this.tokenUpdateResolve&&(this.tokenUpdateResolve(e),this.tokenUpdateResolve=null),e}return null}catch(e){throw e}finally{this.isUpdating=!1}}))}waitForTokenUpdate(){return this.tokenUpdatePromise||(this.tokenUpdatePromise=new Promise((e=>{this.tokenUpdateResolve=e}))),this.tokenUpdatePromise}}class ee{constructor(e){this.AuthApiService=new i(this),this.ConnectionsApiService=new L(this),this.DiscoveryApiService=new j(this),this.DivideApiService=new W(this),this.ExtensionsApiService=new ie(this),this.ExtensionsExternalApiService=new ne(this),this.FcaApiService=new ce(this),this.GatewayApiService=new ae(this),this.GroupApiService=new de(this),this.LicenseApiService=new ge(this),this.LinksApiService=new _e(this),this.LogstashApiService=new Se(this),this.NotificationApiService=new we(this),this.RoleApiService=new be(this),this.ShareApiService=new Ne(this),this.StorageElementApiService=new Je(this,this.FcaApiService),this.StorageFilesApiService=new Re(this),this.StorageInstanceApiService=new Ie(this),this.StorageShareApiService=new je(this),this.StorageTrashApiService=new Be(this),this.UserApiService=new Xe(this),this.VersionApiService=new st(this),this.tokenUpdate=new Z(this.AuthApiService),this.rest=new Q(this,this.tokenUpdate),this.requestInterceptors=[],this.responseInterceptors=[],this.request={use:(e,t)=>{this.requestInterceptors.push({fulfilled:e,rejected:t})}},this.response={use:(e,t)=>{this.responseInterceptors.push({fulfilled:e,rejected:t})}},this.state={clientParams:{host:(null==e?void 0:e.host)||`${window.location.protocol}//${window.location.host}`,version:(null==e?void 0:e.version)||"/api/v1"},requestParams:{path:"",headers:{},query:{},body:null,cache:"no-cache"},authToken:null,skipInterceptors:!1}}}const te="/static/extensions",se="/extensions/defaults";class ie{constructor(e){this.client=e}getSetting(e){return this.client.rest.get(`${te}/${e}/settings`)}setSetting(e,t){return this.client.rest.post(`${te}/${e}/settings`,JSON.stringify(t))}deleteSetting(e){return this.client.rest.delete(`${te}/${e}/settings`)}get(e){return this.client.rest.get(`${te}/${e}`)}getByKey(e){return this.client.rest.get(`${te}/${e}`)}getDefault(e=[]){return this.client.rest.get(se,{ext_code:e})}setDefault(e,t){return this.client.rest.post(se,JSON.stringify({ext_code:e,ext_uniq_key:t}))}checkUpdates(){return this.client.rest.post("/static/extensions/check_updates")}updateVersion(e,t){return this.client.rest.put(`/static/extensions/${e}`,JSON.stringify({version:t}))}list(e){return this.client.rest.get(te,e)}delete(e,t){return this.client.rest.delete(`${te}/${e}`)}upload(e,t){const s=new FormData;return s.set("file",t),this.client.rest.changeBaseUrlVersion(X,(()=>this.client.rest.post(te,s,{onUploadProgress:t=>{e(t)}})))}install(e,t){return this.client.rest.changeBaseUrlVersion(X,(()=>this.client.rest.post("/static/extensions/site",JSON.stringify({uniq_key:e,version:t}))))}}class ne{constructor(e){this.client=e}listExtensionsSite(e){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get("/anons_ext/extensions",e)))}extensionDetailSite(e){return this.client.rest.get(`/anons_ext/extensions/${e}`)}extensionMarkdown(e,t){return this.client.rest.get(`/anons_ext/extensions/${e}/readme`,{},t)}}const re="/disk",oe=`${re}/check`;class ce{constructor(e){this.client=e}info(e,t){return this.client.rest.get(`${re}/${e}/element`,{path:t})}list(e,t){return this.client.rest.get(`${re}/${e}`,t)}create(e,t){return this.client.rest.post(`${re}/${e}/element`,JSON.stringify(t))}replace(e,t,s){return this.client.rest.put(`${re}/${e}/files?path=${t}`,s)}read(e,t){return this.client.rest.get(`${re}/${e}/files?path=${t}`)}upload(e,t,s,i=""){const n=new FormData;return n.set("path",i),n.set("file",s),this.client.rest.post(`${re}/${t}/files`,n,{onUploadProgress:t=>{e(t)}})}uploadNet(e,t){return this.client.rest.post(`/disk/${e}/files/net`,JSON.stringify(t))}delete(e,t){return this.client.rest.delete(`${re}/${e}/trash/element`,{path:t})}check(e){return this.client.rest.post(oe,JSON.stringify(e))}}class ae{constructor(e){this.client=e}settings(){return this.client.rest.get("/settings")}changeSettings(e){return this.client.rest.post("/settings",JSON.stringify(e))}queryInit(){return this.client.rest.get("/query/init")}}const le="/groups";class de{constructor(e){this.client=e}list(e){return this.client.rest.get(le,e)}listUsers(e){return this.client.rest.get(`${le}/${e}/users`)}create(e){return this.client.rest.post(le,JSON.stringify(e))}update(e,t){return this.client.rest.put(`${le}/${e}`,JSON.stringify(t))}delete(e){return this.client.rest.delete(`${le}/${e}`)}}const he="/license",ue=`${he}/manual-check`,pe=`${he}/hardware/hash`;class ge{constructor(e){this.client=e}info(){return this.client.rest.get(he)}create(e){return this.client.rest.post(he,JSON.stringify(e))}check(){return this.client.rest.post(ue)}delete(){return this.client.rest.delete(he)}getHash(){return this.client.rest.get(pe)}}const fe="/links";class _e{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post(`${fe}`,JSON.stringify(e))}updateShortLink(e){return this.client.rest.put(`${fe}`,JSON.stringify(e))}}const ve="/logs";class Se{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get(`${ve}/users`,e)}getSystemLogs(e,t,s){return this.client.rest.get(`${ve}/${e}`,{},{observe:b.Response,responseType:O.Text,headers:{Range:`bytes=${t}-${s}`}})}}const ye="/notifications",$e=`${ye}/all`,ke=`${ye}/subscription`,me=`${ye}/permission`;class we{constructor(e){this.client=e}list(e){return this.client.rest.get(ye,e)}toggleStatus(e,t){return this.client.rest.put(ye,JSON.stringify({ids:e,to_status:t}))}toggleAllStatus(e){return this.client.rest.put($e,JSON.stringify({to_status:e}))}delete(e){return this.client.rest.delete(ye,{id:e})}deleteAll(){return this.client.rest.delete($e)}getPermission(){return this.client.rest.get(me)}setPermission(e){return this.client.rest.post(me,JSON.stringify({enabled:e}))}getSubscription(){return this.client.rest.get(ke)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(ke,JSON.stringify(t))}}const Oe="/roles",xe=`${Oe}/default`;class be{constructor(e){this.client=e}list(e){return this.client.rest.get(Oe,e)}get(e){return this.client.rest.get(`${Oe}/${e}`)}getDefault(){return this.client.rest.get(`${xe}`)}create(e){return this.client.rest.post(Oe,JSON.stringify(e))}update(e,t){return this.client.rest.put(`${Oe}/${e}`,JSON.stringify(t))}delete(e){return this.client.rest.delete(`${Oe}/${e}`)}permissionList(){return this.client.rest.get("/permissions")}addPermission(e,t){return this.client.rest.put(`${Oe}/${e}/permissions`,JSON.stringify({ids:t}))}deletePermission(e,t){return this.client.rest.delete(`${Oe}/${e}/permissions`,{ids:t})}}class Ne{constructor(e){this.client=e}info(e,t){const s=new URLSearchParams({path:e,share_token:t});return this.client.rest.get(`/share?${s.toString()}`)}checkPassword(e,t){const s=encodeURIComponent(e);return this.client.rest.get(`share/password?share_token=${t}&share_pass=${s}`)}checkToken(e){return this.client.rest.get(`share?share_token=${e}`)}getRestriction(e){return this.client.rest.get(`/share/restrictions/${e}`)}restrictions(e){return this.client.rest.get("/share/restrictions",e)}restrictionsChange(e,t){return this.client.rest.put(`/share/restrictions/${e}`,JSON.stringify(t))}}const Ae="/storage",Ce=`${Ae}/element`,De=`${Ce}/move`,Te=`${Ce}/copy`,Ue=`${Ce}/content_type_size`;class Je{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(Ae,e)}info(e){var t;return parseInt((null===(t=e.divide_id)||void 0===t?void 0:t.toString())||"")||delete e.divide_id,e.file_version_id||delete e.file_version_id,this.client.rest.get(Ce,e)}combineInfo({root:e,rootId:t,path:s,file_version_id:i}){return e===P.fca&&t?this.fcaApiService.info(t,s):this.info({path:s,divide_id:t,file_version_id:i})}size(e){var t;return parseInt((null===(t=e.divide_id)||void 0===t?void 0:t.toString())||"")||delete e.divide_id,this.client.rest.post(`${Ce}/size`,JSON.stringify(e))}move(e,t,s){const{from_divide_id:i,to_divide_id:n}=e;let r=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return t===P.fca&&s===P.fca?this.client.rest.post(`/disk/${i}/files/move/disk/${n}`,JSON.stringify(r)):t===P.fca?(i&&(r.from_divide_id=i),this.client.rest.put(`/disk/${n}/files/from/box`,JSON.stringify(r))):s===P.fca?(n&&(r.to_divide_id=n),this.client.rest.put(`/disk/${i}/files/to/box`,JSON.stringify(r))):this.client.rest.post(De,JSON.stringify(e))}copy(e,t,s){const{from_divide_id:i,to_divide_id:n}=e;let r=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return s===P.fca&&t===P.fca?this.client.rest.post(`/disk/${i}/files/copy/disk/${n}`,JSON.stringify(r)):s===P.fca?(i&&(r.from_divide_id=i),this.client.rest.post(`/disk/${n}/files/from/box`,JSON.stringify(r))):t===P.fca?(n&&(r.to_divide_id=n),this.client.rest.post(`/disk/${i}/files/to/box`,JSON.stringify(r))):this.client.rest.post(Te,JSON.stringify(e))}pasteFromShared(e,t,s){const i={from_sharing_token:e,from_sharing_password:s,paths:t};return this.client.rest.post("/storage/element/copy",JSON.stringify(i))}create(e){return this.client.rest.post(Ce,JSON.stringify(e))}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(Ce,s)}favorite(e){return this.client.rest.put(`${Ce}?path=${encodeURIComponent(e)}`,JSON.stringify({is_favorite:!0}))}removeFavorite(e){return this.client.rest.put(`${Ce}?path=${encodeURIComponent(e)}`,JSON.stringify({is_favorite:!1}))}createItem(e){return this.client.rest.post(Ce,JSON.stringify(e))}createWorkDir(e){return this.client.rest.post(Ce,JSON.stringify(e))}sizeWithSection(e){return this.client.rest.get(Ue,e)}}const Pe="/storage/files",Ee=`${Pe}/net`;class Re{constructor(e){this.client=e}read(e,t){return t.path=e,this.client.rest.get(Pe,t)}replace(e,t){const s=new URLSearchParams;return Object.keys(e).forEach((t=>{e[t]&&s.append(t,e[t])})),this.client.rest.put(`${Pe}?${s.toString()}`,t)}upload(e,t,s,i){const n=new FormData;return n.set("path",s),n.set("file",t),i&&n.set("divide_id",i.toString()),this.client.rest.post(Pe,n,{onUploadProgress:t=>{e(t)}})}uploadNet(e){return this.client.rest.post(Ee,JSON.stringify(e))}}class Ie{constructor(e){this.client=e}instance(){return this.client.rest.get("storage/instance")}}const Le="/storage/element/share";class je{constructor(e){this.client=e}info(e){return this.client.rest.get(Le,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(Le,JSON.stringify(s))}change(e){return this.client.rest.put(`${Le}/${e.token}`,JSON.stringify(e))}delete(e){return this.client.rest.delete(Le,{path:e})}refresh(e){return this.client.rest.put(`${Le}/${e}/refresh`)}}const We="/storage/trash",Fe=`${We}/element`,qe=`${Fe}/all`;class Be{constructor(e){this.client=e}list(e){return this.client.rest.get(We,e)}clear(e){return this.client.rest.delete(Fe,e)}clearAll(){return this.client.rest.delete(qe)}restore(e){return this.client.rest.patch(Fe,JSON.stringify({del_groups:e}))}}const He="/users",Ge=`${He}/me`,Me=`${Ge}/avatars`,Ve=`${Ge}/sessions`,ze=`${Ge}/tokens`,Ye=`${Ge}/change-password`;class Xe{constructor(e){this.client=e}list(e){return this.client.rest.get(He,e)}get(e){return this.client.rest.get(He+`/${e}`)}create(e){return this.client.rest.post(He,JSON.stringify(e))}update(e,t){return this.client.rest.put(He+`/${e}`,JSON.stringify(t))}delete(e,t){return this.client.rest.delete(`${He}/${e}`,t)}restore(e){return this.client.rest.post(`${He}/${e}/restore`)}me(){return this.client.rest.get(Ge)}updateMe(e){return this.client.rest.put(Ge,JSON.stringify(e))}createToken(e){return this.client.rest.post(ze,JSON.stringify(e))}listToken(e){return this.client.rest.get(ze,e)}deleteToken(e){return this.client.rest.delete(`${ze}/${e}`)}changeMyPassword(e){return this.client.rest.put(Ye,JSON.stringify(e))}changeUsersPassword(e,t){return this.client.rest.put(`${He}/${e}/change-password`,JSON.stringify(t))}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(Me,s)}meDeleteAvatar(){return this.client.rest.delete(Me)}meListSession(e){return this.client.rest.get(Ve,e)}meDeleteSession(e){let t=Ve;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${He}/${e}/roles`,JSON.stringify({role_id:t}))}}const Ke="/storage/element",Qe=`${Ke}/history`,Ze=`${Ke}/version`,et=`${Ze}/current`,tt=`${Ze}/size`;class st{constructor(e){this.client=e}history(e){return this.client.rest.get(Qe,e)}versions(e){return this.client.rest.get(Ze,e)}create(e){return this.client.rest.post(Ze,JSON.stringify(e))}edit(e){return this.client.rest.put(Ze,JSON.stringify(e))}delete(e){return this.client.rest.delete(Ze,e)}size(e){return this.client.rest.get(tt,e)}makeCurrent(e){return this.client.rest.post(et,JSON.stringify(e))}}export{n as AccessRights,i as AuthApiService,Y as BASE_URL_V1,X as BASE_URL_V2,r as CONNECTIONS_PERMISSION,ee as Client,a as ConnectionGroup,l as ConnectionType,L as ConnectionsApiService,j as DiscoveryApiService,W as DivideApiService,_ as DivideMode,u as DivideScope,c as EngineType,h as ExtensionFileMode,d as ExtensionType,ie as ExtensionsApiService,ne as ExtensionsExternalApiService,ce as FcaApiService,ae as GatewayApiService,de as GroupApiService,K as HOST,ge as LicenseApiService,y as LicenseError,_e as LinksApiService,Se as LogstashApiService,k as NotificationAction,we as NotificationApiService,$ as NotificationEntityType,m as NotificationRowAction,w as NotificationStyle,o as OrderDirection,p as PermissionType,x as RequestMethod,b as RequestObserve,O as ResponseType,Q as Rest,f as RestrictionBooleanStatus,v as RestrictionModeKey,N as RestrictionSharing,g as RestrictionStatus,be as RoleApiService,T as SettingControlType,Ne as ShareApiService,Je as StorageElementApiService,J as StorageElementContentType,E as StorageElementHistoryAction,U as StorageElementType,Re as StorageFilesApiService,Ie as StorageInstanceApiService,P as StorageRoot,je as StorageShareApiService,Be as StorageTrashApiService,S as Tariff,Z as TokenUpdate,Xe as UserApiService,A as UserAuthType,C as UserStatus,D as UserType,st as VersionApiService,G as applyInterceptors,M as getCookieValue,V as makeUrlParams,z as normalizeHeaders};
@@ -1,49 +1,41 @@
1
- import { AuthApiService, ConnectionsApiService, DiscoveryApiService, DivideApiService, ExtensionsApiService, ExtensionsExternalApiService, FcaApiService, GatewayApiService, GroupApiService, LicenseApiService, LogstashApiService, RoleApiService, ShareApiService, StorageElementApiService, StorageShareApiService, StorageTrashApiService, UserApiService } from '../api';
2
- import { NotificationsApiService } from '../api/notifications-api.service';
3
- import { StorageFilesApiService } from '../api/storage-files-api.service';
4
- import { AuthToken } from '../types';
1
+ import { AuthApiService, ConnectionsApiService, DiscoveryApiService, DivideApiService, ExtensionsApiService, ExtensionsExternalApiService, FcaApiService, GatewayApiService, GroupApiService, LicenseApiService, LinksApiService, LogstashApiService, NotificationApiService, RoleApiService, ShareApiService, StorageElementApiService, StorageFilesApiService, StorageInstanceApiService, StorageShareApiService, StorageTrashApiService, UserApiService, VersionApiService } from '../api';
5
2
  import { NbAppState, NbClientParams } from '../types/base';
6
3
  import { Interceptor } from '../types/interceptor';
7
4
  import { Rest } from './rest';
8
5
  import { TokenUpdate } from './token-update';
9
6
  export declare class Client {
10
7
  state: NbAppState;
11
- AuthApi: AuthApiService;
12
- ConnectionsApi: ConnectionsApiService;
13
- DiscoveryApi: DiscoveryApiService;
14
- DivideApi: DivideApiService;
15
- ExtensionsApi: ExtensionsApiService;
16
- ExtensionsExternalApi: ExtensionsExternalApiService;
17
- FcaApi: FcaApiService;
18
- GatewayApi: GatewayApiService;
19
- GroupApi: GroupApiService;
20
- LicenseApi: LicenseApiService;
21
- LogstashApi: LogstashApiService;
22
- NotificationsApi: NotificationsApiService;
23
- RoleApi: RoleApiService;
24
- ShareApi: ShareApiService;
25
- StorageElementApi: StorageElementApiService;
26
- StorageFilesApi: StorageFilesApiService;
27
- StorageShareApi: StorageShareApiService;
28
- StorageTrashApi: StorageTrashApiService;
29
- UserApi: UserApiService;
8
+ AuthApiService: AuthApiService;
9
+ ConnectionsApiService: ConnectionsApiService;
10
+ DiscoveryApiService: DiscoveryApiService;
11
+ DivideApiService: DivideApiService;
12
+ ExtensionsApiService: ExtensionsApiService;
13
+ ExtensionsExternalApiService: ExtensionsExternalApiService;
14
+ FcaApiService: FcaApiService;
15
+ GatewayApiService: GatewayApiService;
16
+ GroupApiService: GroupApiService;
17
+ LicenseApiService: LicenseApiService;
18
+ LinksApiService: LinksApiService;
19
+ LogstashApiService: LogstashApiService;
20
+ NotificationApiService: NotificationApiService;
21
+ RoleApiService: RoleApiService;
22
+ ShareApiService: ShareApiService;
23
+ StorageElementApiService: StorageElementApiService;
24
+ StorageFilesApiService: StorageFilesApiService;
25
+ StorageInstanceApiService: StorageInstanceApiService;
26
+ StorageShareApiService: StorageShareApiService;
27
+ StorageTrashApiService: StorageTrashApiService;
28
+ UserApiService: UserApiService;
29
+ VersionApiService: VersionApiService;
30
30
  tokenUpdate: TokenUpdate;
31
31
  rest: Rest;
32
32
  requestInterceptors: Interceptor<RequestInit>[];
33
- responseInterceptors: Interceptor<Response>[];
33
+ responseInterceptors: Interceptor<any>[];
34
34
  constructor(clientParams: NbClientParams);
35
35
  request: {
36
36
  use: (fulfilled: (config: RequestInit) => RequestInit | Promise<RequestInit>, rejected: (error: any) => any) => void;
37
37
  };
38
38
  response: {
39
- use: (fulfilled: (response: Response) => Response | Promise<Response>, rejected: (error: any) => any) => void;
39
+ use: (fulfilled: (response: any) => any | Promise<any>, rejected: (error: any) => any) => void;
40
40
  };
41
- resetParams(params: {
42
- host?: string;
43
- version?: number;
44
- headers?: Record<string, any>;
45
- cache?: RequestCache;
46
- authTokens?: Map<number, AuthToken> | null;
47
- skipInterceptors?: boolean;
48
- }): Promise<void>;
49
41
  }
@@ -0,0 +1,24 @@
1
+ export declare enum HttpEventType {
2
+ Sent = 0,
3
+ UploadProgress = 1,
4
+ ResponseHeader = 2,
5
+ DownloadProgress = 3,
6
+ Response = 4,
7
+ User = 5
8
+ }
9
+ export declare type HttpEvent<T> = HttpResponse<T> | HttpProgressEvent;
10
+ export declare class HttpResponse<T> {
11
+ body: T | null;
12
+ status: number;
13
+ statusText: string;
14
+ headers: Headers;
15
+ url?: string | undefined;
16
+ readonly type: HttpEventType;
17
+ constructor(body: T | null, status: number, statusText: string, headers: Headers, url?: string | undefined);
18
+ }
19
+ export declare class HttpProgressEvent {
20
+ progress: number;
21
+ headers: Headers;
22
+ readonly type: HttpEventType;
23
+ constructor(progress: number, headers: Headers, isUpload?: boolean);
24
+ }
@@ -0,0 +1,14 @@
1
+ export declare class HttpResponse<T> {
2
+ body: T | null;
3
+ status: number;
4
+ statusText: string;
5
+ headers: Headers;
6
+ url: string;
7
+ constructor(init: {
8
+ body?: T | null;
9
+ status: number;
10
+ statusText: string;
11
+ headers: Headers;
12
+ url: string;
13
+ });
14
+ }
@@ -1,15 +1,20 @@
1
1
  import { Client } from './client';
2
- import { NbAppState } from '../types';
2
+ import { NbAppState, RequestMethod, HttpResponse, RequestConfig, HttpEvent } from '../types';
3
3
  import { TokenUpdate } from './token-update';
4
+ export declare const BASE_URL_V1 = "/api/v1";
5
+ export declare const BASE_URL_V2 = "/api/v2";
6
+ export declare const HOST: string;
4
7
  export declare class Rest {
5
8
  private client;
6
9
  private tokenUpdate;
7
10
  constructor(client: Client, tokenUpdate: TokenUpdate);
8
11
  get state(): NbAppState;
9
- get(path: string, query?: Record<string, any>): Promise<any>;
10
- post(path: string, body?: BodyInit | null): Promise<any>;
11
- put(path: string, body?: BodyInit | null): Promise<any>;
12
- patch(path: string, body?: BodyInit | null): Promise<any>;
13
- delete(path: string, query?: Record<string, any>): Promise<any>;
14
- private sendRequest;
12
+ get(path: string, params?: Record<string, any>, config?: RequestConfig): Promise<any>;
13
+ post(path: string, body?: BodyInit | null, config?: RequestConfig): Promise<any>;
14
+ put(path: string, body?: BodyInit | null, config?: RequestConfig): Promise<any>;
15
+ patch(path: string, body?: BodyInit | null, config?: RequestConfig): Promise<any>;
16
+ delete(path: string, params?: Record<string, any>, config?: RequestConfig): Promise<any>;
17
+ request<T>(method: RequestMethod, path: string, config?: RequestConfig): Promise<T | HttpResponse<T> | HttpEvent<T>>;
18
+ changeBaseUrlVersion<T>(baseUrl: string, handler: () => Promise<T>): Promise<T>;
19
+ changeHost<T>(host: string, handler: () => Promise<T>): Promise<T>;
15
20
  }
@@ -1,4 +1,4 @@
1
- import { AuthApiService } from '../api';
1
+ import { AuthApiService, RequestAuthTokenParams } from '../api';
2
2
  import { AuthToken } from '../types';
3
3
  export declare class TokenUpdate {
4
4
  private authApiService;
@@ -7,6 +7,6 @@ export declare class TokenUpdate {
7
7
  private tokenUpdateResolve;
8
8
  constructor(authApiService: AuthApiService);
9
9
  isTokenExpire(timestamp: number): boolean;
10
- refreshToken(authToken: AuthToken): Promise<AuthToken | null>;
10
+ refreshToken(params: RequestAuthTokenParams): Promise<AuthToken | null>;
11
11
  private waitForTokenUpdate;
12
12
  }