nb-js-client 0.0.14 → 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.
- package/dist/bundle.cjs.js +1 -1
- package/dist/bundle.esm.js +1 -1
- package/dist/classes/rest.d.ts +5 -0
- package/dist/classes/token-update.d.ts +2 -2
- package/dist/index.d.ts +18 -13
- package/dist/types/base.d.ts +2 -2
- package/package.json +1 -1
package/dist/bundle.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";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 r;exports.AccessRights=void 0,(r=exports.AccessRights||(exports.AccessRights={})).LicenseRead="license_read",r.LicenseManage="license_edit",r.UsersRead="users_read",r.UsersCreate="users_create",r.UsersActivate="users_activate",r.GroupsRead="groups_read",r.GroupsCreate="groups_create",r.RolesRead="roles_read",r.RolesCreate="roles_create",r.Share="share",r.Divide="divide",r.ExtensionsRead="extensions_read",r.ExtensionsManage="extensions_write",r.RestrictionShareRead="restriction_share_read",r.RestrictionShareWrite="restriction_share_write",r.RestrictionDivideRead="restriction_divide_read",r.RestrictionDivideWrite="restriction_divide_write",r.ReadUserLogs="read_user_logs",r.ReadSystemLogs="read_system_logs",r.ConnectionsRead="connections_read",r.ConnectionsDividing="connections_dividing",r.ConnectionsYandexDisk="connections_yandex_disk",r.ConnectionsSsh="connections_ssh",r.ConnectionsMail="connections_mail",r.ConnectionsS3="connections_s3",r.ConnectionsDiscord="connections_discord",r.ConnectionsWebdav="connections_webdav",r.ConnectionsNextcloud="connections_nextcloud",r.ConnectionsNextbox="connections_nextbox",r.ConnectionsHttpProxy="connections_http_proxy",r.SystemInfoServiceList="system_info_service_list",r.SettingsRead="settings_read",r.SettingsWrite="settings_write";const n=[exports.AccessRights.ConnectionsYandexDisk,exports.AccessRights.ConnectionsSsh,exports.AccessRights.ConnectionsMail,exports.AccessRights.ConnectionsS3,exports.AccessRights.ConnectionsS3,exports.AccessRights.ConnectionsDiscord,exports.AccessRights.ConnectionsWebdav,exports.AccessRights.ConnectionsNextcloud,exports.AccessRights.ConnectionsNextbox,exports.AccessRights.ConnectionsHttpProxy];var o,c,a,l,p,d,h,u,g,x,v,_,S,f,y,$,k,m,A,w,R,T,O,N,b,C,E,D,U,J;exports.OrderDirection=void 0,(o=exports.OrderDirection||(exports.OrderDirection={})).DEFAULT="",o.ASC="asc",o.DESC="desc",exports.EngineType=void 0,(c=exports.EngineType||(exports.EngineType={})).WebSocket="websocket",c.PostMessage="postmessage",c.Empty="",exports.ConnectionGroup=void 0,(a=exports.ConnectionGroup||(exports.ConnectionGroup={})).Storages="storages_connections_group",a.Webhooks="webhooks_connections_group",a.Unknown="unknown_connections_group",a.Proxy="proxy_connections_group",exports.ConnectionType=void 0,(l=exports.ConnectionType||(exports.ConnectionType={})).SSH="ssh_connection",l.YandexDisk="yandex_disk",l.Mail="mail",l.Discord="discord",l.Webdav="webdav_connection",l.Nextcloud="nextcloud_connection",l.NextBox="nextbox_connection",l.HttpProxy="http_proxy_connection",l.S3="s3_connection",exports.ExtensionType=void 0,(p=exports.ExtensionType||(exports.ExtensionType={})).App="app",p.File="file",p.WorkDir="work_dir",exports.ExtensionFileMode=void 0,(d=exports.ExtensionFileMode||(exports.ExtensionFileMode={})).Read="read",d.ReadAndWrite="read_and_write",d.Write="write",exports.DivideScope=void 0,(h=exports.DivideScope||(exports.DivideScope={})).Storage="/storage/element",h.Connection="/connections",exports.PermissionType=void 0,(u=exports.PermissionType||(exports.PermissionType={})).CLOSE="",u.READ="r",u.WRITE="rw",exports.RestrictionStatus=void 0,(g=exports.RestrictionStatus||(exports.RestrictionStatus={})).WAITING="waiting",g.APPROVED="approved",g.REJECTED="rejected",exports.RestrictionBooleanStatus=void 0,(x=exports.RestrictionBooleanStatus||(exports.RestrictionBooleanStatus={})).TRUE="true",x.FALSE="false",exports.DivideMode=void 0,(v=exports.DivideMode||(exports.DivideMode={})).User="to_user_id",v.Group="to_user_group_id",exports.RestrictionModeKey=void 0,(_=exports.RestrictionModeKey||(exports.RestrictionModeKey={})).Divide="divide",_.Share="share",exports.Tariff=void 0,(S=exports.Tariff||(exports.Tariff={})).Free="free",S.Business="business",S.Enterprise="enterprise",exports.LicenseError=void 0,(f=exports.LicenseError||(exports.LicenseError={})).NotActivated="License not activated",f.Blocked="License blocked",f.Expired="License has been expired",f.NotValid="License not valid",f.NotFound="license file not found",exports.NotificationEntityType=void 0,(y=exports.NotificationEntityType||(exports.NotificationEntityType={})).Dir="dir",y.File="file",y.User="user",y.Other="other",y.WorkDir="work_dir",y.License="license",y.Extension="extension",y.Connection="connection",exports.NotificationAction=void 0,($=exports.NotificationAction||(exports.NotificationAction={})).OpenSharing="open_sharing",$.ChangeSharing="change_sharing",$.CancelSharing="cancel_sharing",$.DivideDirAddFileToOwner="divide_dir_add_file_to_owner",$.DivideDirAddDirToOwner="divide_dir_add_dir_to_owner",$.DivideDirAddWorkDirToOwner="divide_dir_add_work_dir_to_owner",$.DivideConnectionAddFileToOwner="divide_connection_add_file_to_owner",$.DivideConnectionAddDirToOwner="divide_connection_add_dir_to_owner",$.CancelDivideDir="cancel_divide_dir",$.CancelDivideFile="cancel_divide_file",$.CancelDivideWorkDir="cancel_divide_work_dir",$.CancelDivideConnection="cancel_divide_connection",$.DeleteExtension="delete_extension",$.NewVersionExtension="new_version_extension",$.TransferData="transfer_data",$.AllowInternalAccessUser="allow_internal_access_to_user",$.BlockInternalAccessUser="block_internal_access_to_user",$.WaitInternalAccessUser="wait_internal_access_to_user",$.WaitInternalAccessUserCreate="wait_internal_access_to_user_create",$.AllowInternalAccessGroup="allow_internal_access_to_group",$.BlockInternalAccessGroup="block_internal_access_to_group",$.WaitInternalAccessGroup="wait_internal_access_to_group",$.WaitInternalAccessGroupCreate="wait_internal_access_to_group_create",$.AllowSharing="allow_sharing",$.BlockSharing="block_sharing",$.WaitSharing="wait_sharing",$.WaitSharingCreate="wait_sharing_create",$.Other="other",exports.NotificationRowAction=void 0,(k=exports.NotificationRowAction||(exports.NotificationRowAction={})).Read="read",k.Unread="unread",k.Delete="delete",exports.NotificationStyle=void 0,(m=exports.NotificationStyle||(exports.NotificationStyle={})).Plain="plain",m.Success="success",m.Info="info",m.Warning="warning",m.Error="error",exports.ResponseType=void 0,(A=exports.ResponseType||(exports.ResponseType={})).ArrayBuffer="arraybuffer",A.Blob="blob",A.Json="json",A.Text="text",exports.RequestMethod=void 0,(w=exports.RequestMethod||(exports.RequestMethod={})).GET="GET",w.POST="POST",w.PUT="PUT",w.PATCH="PATCH",w.DELETE="DELETE",exports.RequestObserve=void 0,(R=exports.RequestObserve||(exports.RequestObserve={})).Body="body",R.Response="response",exports.RestrictionSharing=void 0,(T=exports.RestrictionSharing||(exports.RestrictionSharing={})).NONE="none",T.SOFT="soft",T.HARD="hard",exports.UserAuthType=void 0,(O=exports.UserAuthType||(exports.UserAuthType={})).Native="native",O.Ldap="ldap",exports.UserStatus=void 0,(N=exports.UserStatus||(exports.UserStatus={})).Registering="registering",N.Activated="activated",N.Blocked="blocked",N.BlockedByLicense="blocked_by_license",exports.UserType=void 0,(b=exports.UserType||(exports.UserType={})).User="user",b.Guest="guest",b.Emperor="emperor",b.Anonymous="anonymous",exports.SettingControlType=void 0,(C=exports.SettingControlType||(exports.SettingControlType={})).Text="text",C.String="string",C.Number="number",C.CheckBox="checkbox",C.Select="select",C.RadioList="radio_list",C.ConnectionChoose="connection_choose",C.MultiConnectionChoose="multi_connection_choose",exports.StorageElementType=void 0,(E=exports.StorageElementType||(exports.StorageElementType={})).Dir="dir",E.File="file",E.WorkDir="work_dir",exports.StorageElementContentType=void 0,(D=exports.StorageElementContentType||(exports.StorageElementContentType={})).Any="any",D.Dir="dir",D.Code="code",D.Image="image",D.Audio="audio",D.Video="video",D.Text="text",D.Doc="doc",D.Xls="xls",D.Ppt="ppt",exports.StorageRoot=void 0,(U=exports.StorageRoot||(exports.StorageRoot={})).my="my",U.fca="fca",U.divide="divide",U.share="share",U.favorite="favorite",exports.StorageElementHistoryAction=void 0,(J=exports.StorageElementHistoryAction||(exports.StorageElementHistoryAction={})).Create="create",J.Update="update",J.Move="move";const P="/connections",I=`${P}/dashboard`;class L{constructor(e){this.client=e}list(e){return this.client.rest.get(P,e)}get(e){return this.client.rest.get(`${P}/${e}`)}update(e,t){return this.client.rest.put(`${P}/${e}`,JSON.stringify(t))}delete(e){return this.client.rest.delete(`${P}/${e}`)}create(e){const t={[exports.ConnectionType.SSH]:"/disk/ssh",[exports.ConnectionType.Webdav]:"/disk/webdav",[exports.ConnectionType.Nextcloud]:"/disk/nextcloud",[exports.ConnectionType.NextBox]:"/disk/nextbox",[exports.ConnectionType.Discord]:"/webhooks/discord",[exports.ConnectionType.Mail]:"/webhooks/mail",[exports.ConnectionType.HttpProxy]:"/http_proxy",[exports.ConnectionType.S3]:"/disk/s3"};return this.client.rest.post(t[e.type]||P,JSON.stringify(e))}dashboard(e){return this.client.rest.get(I,e)}}class q{constructor(e){this.client=e}discovery(e){return this.client.rest.get("/discovery",e)}}class j{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,r){const n=Object.assign(Object.assign({},this.makeParam(e,t)),{[r]:s,access_mode:i});return this.client.rest.post(`${e}/divide`,JSON.stringify(n))}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===exports.DivideScope.Connection?s.connection_id=t:s.path=t,s}}const M="/static/extensions",F="/extensions/defaults";class W{constructor(e){this.client=e}getSetting(e){return this.client.rest.get(`${M}/${e}/settings`)}setSetting(e,t){return this.client.rest.post(`${M}/${e}/settings`,JSON.stringify(t))}deleteSetting(e){return this.client.rest.delete(`${M}/${e}/settings`)}get(e){return this.client.rest.get(`${M}/${e}`)}getByKey(e){return this.client.rest.get(`${M}/${e}`)}getDefault(e=[]){return this.client.rest.get(F,{ext_code:e})}setDefault(e,t){return this.client.rest.post(F,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(M,e)}delete(e,t){return this.client.rest.delete(`${M}/${e}`)}upload(e,t){const s=new FormData;return s.set("file",t),this.client.rest.post(M,s,{onUploadProgress:t=>{e(t)}})}install(e,t){return this.client.rest.post("/static/extensions/site",JSON.stringify({uniq_key:e,version:t}))}}class B{constructor(e){this.client=e}listExtensionsSite(e){return 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 H="/disk",G=`${H}/check`;class z{constructor(e){this.client=e}info(e,t){return this.client.rest.get(`${H}/${e}/element`,{path:t})}list(e,t){return this.client.rest.get(`${H}/${e}`,t)}create(e,t){return this.client.rest.post(`${H}/${e}/element`,JSON.stringify(t))}replace(e,t,s){return this.client.rest.put(`${H}/${e}/files?path=${t}`,s)}read(e,t){return this.client.rest.get(`${H}/${e}/files?path=${t}`)}upload(e,t,s,i=""){const r=new FormData;return r.set("path",i),r.set("file",s),this.client.rest.post(`${H}/${t}/files`,r,{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(`${H}/${e}/trash/element`,{path:t})}check(e){return this.client.rest.post(G,JSON.stringify(e))}}class V{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 K="/groups";class Y{constructor(e){this.client=e}list(e){return this.client.rest.get(K,e)}listUsers(e){return this.client.rest.get(`${K}/${e}/users`)}create(e){return this.client.rest.post(K,JSON.stringify(e))}update(e,t){return this.client.rest.put(`${K}/${e}`,JSON.stringify(t))}delete(e){return this.client.rest.delete(`${K}/${e}`)}}const X="/license",Q=`${X}/manual-check`,Z=`${X}/hardware/hash`;class ee{constructor(e){this.client=e}info(){return this.client.rest.get(X)}create(e){return this.client.rest.post(X,JSON.stringify(e))}check(){return this.client.rest.post(Q)}delete(){return this.client.rest.delete(X)}getHash(){return this.client.rest.get(Z)}}class te{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post("links",JSON.stringify(e))}updateShortLink(e){return this.client.rest.put("links",JSON.stringify(e))}}const se="/logs";class ie{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get(`${se}/users`,e)}getSystemLogs(e,t,s){return this.client.rest.get(`${se}/${e}`,{},{observe:exports.RequestObserve.Response,responseType:exports.ResponseType.Text,headers:{Range:`bytes=${t}-${s}`}})}}const re="/notifications",ne=`${re}/all`,oe=`${re}/subscription`,ce=`${re}/permission`;class ae{constructor(e){this.client=e}list(e){return this.client.rest.get(re,e)}toggleStatus(e,t){return this.client.rest.put(re,JSON.stringify({ids:e,to_status:t}))}toggleAllStatus(e){return this.client.rest.put(ne,JSON.stringify({to_status:e}))}delete(e){return this.client.rest.delete(re,{id:e})}deleteAll(){return this.client.rest.delete(ne)}getPermission(){return this.client.rest.get(ce)}setPermission(e){return this.client.rest.post(ce,JSON.stringify({enabled:e}))}getSubscription(){return this.client.rest.get(oe)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(oe,JSON.stringify(t))}}const le="/roles",pe=`${le}/default`;class de{constructor(e){this.client=e}list(e){return this.client.rest.get(le,e)}get(e){return this.client.rest.get(`${le}/${e}`)}getDefault(){return this.client.rest.get(`${pe}`)}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}`)}permissionList(){return this.client.rest.get("/permissions")}addPermission(e,t){return this.client.rest.put(`${le}/${e}/permissions`,JSON.stringify({ids:t}))}deletePermission(e,t){return this.client.rest.delete(`${le}/${e}/permissions`,{ids:t})}}class he{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 ue="/storage",ge=`${ue}/element`,xe=`${ge}/move`,ve=`${ge}/copy`,_e=`${ge}/content_type_size`;class Se{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(ue,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(ge,e)}combineInfo({root:e,rootId:t,path:s,file_version_id:i}){return e===exports.StorageRoot.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(`${ge}/size`,JSON.stringify(e))}move(e,t,s){const{from_divide_id:i,to_divide_id:r}=e;let n=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return t===exports.StorageRoot.fca&&s===exports.StorageRoot.fca?this.client.rest.post(`/disk/${i}/files/move/disk/${r}`,JSON.stringify(n)):t===exports.StorageRoot.fca?(i&&(n.from_divide_id=i),this.client.rest.put(`/disk/${r}/files/from/box`,JSON.stringify(n))):s===exports.StorageRoot.fca?(r&&(n.to_divide_id=r),this.client.rest.put(`/disk/${i}/files/to/box`,JSON.stringify(n))):this.client.rest.post(xe,JSON.stringify(e))}copy(e,t,s){const{from_divide_id:i,to_divide_id:r}=e;let n=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return s===exports.StorageRoot.fca&&t===exports.StorageRoot.fca?this.client.rest.post(`/disk/${i}/files/copy/disk/${r}`,JSON.stringify(n)):s===exports.StorageRoot.fca?(i&&(n.from_divide_id=i),this.client.rest.post(`/disk/${r}/files/from/box`,JSON.stringify(n))):t===exports.StorageRoot.fca?(r&&(n.to_divide_id=r),this.client.rest.post(`/disk/${i}/files/to/box`,JSON.stringify(n))):this.client.rest.post(ve,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(ge,JSON.stringify(e))}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(ge,s)}favorite(e){return this.client.rest.put(`${ge}?path=${encodeURIComponent(e)}`,JSON.stringify({is_favorite:!0}))}removeFavorite(e){return this.client.rest.put(`${ge}?path=${encodeURIComponent(e)}`,JSON.stringify({is_favorite:!1}))}createItem(e){return this.client.rest.post(ge,JSON.stringify(e))}createWorkDir(e){return this.client.rest.post(ge,JSON.stringify(e))}sizeWithSection(e){return this.client.rest.get(_e,e)}}const fe="/storage/files",ye=`${fe}/net`;class $e{constructor(e){this.client=e}read(e,t){return t.path=e,this.client.rest.get(fe,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(`${fe}?${s.toString()}`,t)}upload(e,t,s,i){const r=new FormData;return r.set("path",s),r.set("file",t),i&&r.set("divide_id",i.toString()),this.client.rest.post(fe,r,{onUploadProgress:t=>{e(t)}})}uploadNet(e){return this.client.rest.post(ye,JSON.stringify(e))}}class ke{constructor(e){this.client=e}instance(){return this.client.rest.get("storage/instance")}}const me="/storage/element/share";class Ae{constructor(e){this.client=e}info(e){return this.client.rest.get(me,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(me,JSON.stringify(s))}change(e){return this.client.rest.put(`${me}/${e.token}`,JSON.stringify(e))}delete(e){return this.client.rest.delete(me,{path:e})}refresh(e){return this.client.rest.put(`${me}/${e}/refresh`)}}const we="/storage/trash",Re=`${we}/element`,Te=`${Re}/all`;class Oe{constructor(e){this.client=e}list(e){return this.client.rest.get(we,e)}clear(e){return this.client.rest.delete(Re,e)}clearAll(){return this.client.rest.delete(Te)}restore(e){return this.client.rest.patch(Re,JSON.stringify({del_groups:e}))}}const Ne="/users",be=`${Ne}/me`,Ce=`${be}/avatars`,Ee=`${be}/sessions`,De=`${be}/tokens`,Ue=`${be}/change-password`;class Je{constructor(e){this.client=e}list(e){return this.client.rest.get(Ne,e)}get(e){return this.client.rest.get(Ne+`/${e}`)}create(e){return this.client.rest.post(Ne,JSON.stringify(e))}update(e,t){return this.client.rest.put(Ne+`/${e}`,JSON.stringify(t))}delete(e,t){return this.client.rest.delete(`${Ne}/${e}`,t)}restore(e){return this.client.rest.post(`${Ne}/${e}/restore`)}me(){return this.client.rest.get(be)}updateMe(e){return this.client.rest.put(be,JSON.stringify(e))}createToken(e){return this.client.rest.post(De,JSON.stringify(e))}listToken(e){return this.client.rest.get(De,e)}deleteToken(e){return this.client.rest.delete(`${De}/${e}`)}changeMyPassword(e){return this.client.rest.put(Ue,JSON.stringify(e))}changeUsersPassword(e,t){return this.client.rest.put(`${Ne}/${e}/change-password`,JSON.stringify(t))}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(Ce,s)}meDeleteAvatar(){return this.client.rest.delete(Ce)}meListSession(e){return this.client.rest.get(Ee,e)}meDeleteSession(e){let t=Ee;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${Ne}/${e}/roles`,JSON.stringify({role_id:t}))}}const Pe="/storage/element",Ie=`${Pe}/history`,Le=`${Pe}/version`,qe=`${Le}/current`,je=`${Le}/size`;class Me{constructor(e){this.client=e}history(e){return this.client.rest.get(Ie,e)}versions(e){return this.client.rest.get(Le,e)}create(e){return this.client.rest.post(Le,JSON.stringify(e))}edit(e){return this.client.rest.put(Le,JSON.stringify(e))}delete(e){return this.client.rest.delete(Le,e)}size(e){return this.client.rest.get(je,e)}makeCurrent(e){return this.client.rest.post(qe,JSON.stringify(e))}}function Fe(e,t,s,i){return new(s||(s=Promise))((function(r,n){function o(e){try{a(i.next(e))}catch(e){n(e)}}function c(e){try{a(i.throw(e))}catch(e){n(e)}}function a(e){var t;e.done?r(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 We extends Error{}function Be(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 He(e,t){if("string"!=typeof e)throw new We("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 We(`Invalid token specified: missing part #${s+1}`);let r;try{r=Be(i)}catch(e){throw new We(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(r)}catch(e){throw new We(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}We.prototype.name="InvalidTokenError";const Ge=(e,t)=>Fe(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 ze(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 Ve=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 Ke(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}class Ye{constructor(e,t){this.client=e,this.tokenUpdate=t}get state(){return this.client.state}get(e,t,s){return this.request(exports.RequestMethod.GET,e,Object.assign({params:t,cache:"no-cache"},s))}post(e,t,s){return this.request(exports.RequestMethod.POST,e,Object.assign({body:t},s))}put(e,t,s){return this.request(exports.RequestMethod.PUT,e,Object.assign({body:t,cache:"no-cache"},s))}patch(e,t,s){return this.request(exports.RequestMethod.PATCH,e,Object.assign({body:t},s))}delete(e,t,s){return this.request(exports.RequestMethod.DELETE,e,Object.assign({params:t},s))}request(e,t,s){return Fe(this,void 0,void 0,(function*(){return new Promise(((i,r)=>Fe(this,void 0,void 0,(function*(){var n,o;const c=null!==(n=this.state.skipInterceptors)&&void 0!==n&&n;this.state.skipInterceptors=!1;let a=Object.assign({method:e},s);if(c||(s=yield Ge(this.client.requestInterceptors,a)),this.state.authToken)for(const[e,i]of this.state.authToken.entries()){const r=He(i.access_token),n=r&&r.is_remember&&this.tokenUpdate.isTokenExpire(r.exp);if(console.log(n),console.log(this.state.authToken),n&&!t.includes("/login")&&!t.includes("/assets")){const t=yield this.tokenUpdate.refreshToken(i);console.log(t),t&&(this.state.authToken.set(e,t),s=yield Ge(this.client.requestInterceptors,a))}}const l=new XMLHttpRequest;(null==s?void 0:s.params)&&0===Object.keys(s.params).length&&(t+="?"+Ve(s.params));const p=`${this.state.clientParams.host}${this.state.clientParams.version}${t}`;if(l.open(e,p,!0),l.withCredentials=!0,null==s?void 0:s.headers){const e=Ke(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=()=>Fe(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 exports.ResponseType.Text:t=l.responseText;case exports.ResponseType.Blob:case exports.ResponseType.ArrayBuffer:t=l.response;default:try{t=JSON.parse(l.responseText)}catch(e){t=l.responseText}}let n={status:l.status,statusText:l.statusText,headers:e,body:t};n=yield Ge(this.client.responseInterceptors,n),l.status>=200&&l.status<300?(null==s?void 0:s.observe)===exports.RequestObserve.Response?i(n):i(t):r({status:l.status,statusText:l.statusText,headers:e,error:t})})),l.onerror=()=>r(new Error("Network error")),l.send(null!==(o=null==s?void 0:s.body)&&void 0!==o?o:null)}))))}))}}class Xe{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 Fe(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 ze("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}}exports.AuthApiService=i,exports.CONNECTIONS_PERMISSION=n,exports.Client=class{constructor(e){this.AuthApiService=new i(this),this.ConnectionsApiService=new L(this),this.DiscoveryApiService=new q(this),this.DivideApiService=new j(this),this.ExtensionsApiService=new W(this),this.ExtensionsExternalApiService=new B(this),this.FcaApiService=new z(this),this.GatewayApiService=new V(this),this.GroupApiService=new Y(this),this.LicenseApiService=new ee(this),this.LinksApiService=new te(this),this.LogstashApiService=new ie(this),this.NotificationApiService=new ae(this),this.RoleApiService=new de(this),this.ShareApiService=new he(this),this.StorageElementApiService=new Se(this,this.FcaApiService),this.StorageFilesApiService=new $e(this),this.StorageInstanceApiService=new ke(this),this.StorageShareApiService=new Ae(this),this.StorageTrashApiService=new Oe(this),this.UserApiService=new Je(this),this.VersionApiService=new Me(this),this.tokenUpdate=new Xe(this.AuthApiService),this.rest=new Ye(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}}},exports.ConnectionsApiService=L,exports.DiscoveryApiService=q,exports.DivideApiService=j,exports.ExtensionsApiService=W,exports.ExtensionsExternalApiService=B,exports.FcaApiService=z,exports.GatewayApiService=V,exports.GroupApiService=Y,exports.LicenseApiService=ee,exports.LinksApiService=te,exports.LogstashApiService=ie,exports.NotificationApiService=ae,exports.Rest=Ye,exports.RoleApiService=de,exports.ShareApiService=he,exports.StorageElementApiService=Se,exports.StorageFilesApiService=$e,exports.StorageInstanceApiService=ke,exports.StorageShareApiService=Ae,exports.StorageTrashApiService=Oe,exports.TokenUpdate=Xe,exports.UserApiService=Je,exports.VersionApiService=Me,exports.applyInterceptors=Ge,exports.getCookieValue=ze,exports.makeUrlParams=Ve,exports.normalizeHeaders=Ke;
|
|
1
|
+
"use strict";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 r;exports.AccessRights=void 0,(r=exports.AccessRights||(exports.AccessRights={})).LicenseRead="license_read",r.LicenseManage="license_edit",r.UsersRead="users_read",r.UsersCreate="users_create",r.UsersActivate="users_activate",r.GroupsRead="groups_read",r.GroupsCreate="groups_create",r.RolesRead="roles_read",r.RolesCreate="roles_create",r.Share="share",r.Divide="divide",r.ExtensionsRead="extensions_read",r.ExtensionsManage="extensions_write",r.RestrictionShareRead="restriction_share_read",r.RestrictionShareWrite="restriction_share_write",r.RestrictionDivideRead="restriction_divide_read",r.RestrictionDivideWrite="restriction_divide_write",r.ReadUserLogs="read_user_logs",r.ReadSystemLogs="read_system_logs",r.ConnectionsRead="connections_read",r.ConnectionsDividing="connections_dividing",r.ConnectionsYandexDisk="connections_yandex_disk",r.ConnectionsSsh="connections_ssh",r.ConnectionsMail="connections_mail",r.ConnectionsS3="connections_s3",r.ConnectionsDiscord="connections_discord",r.ConnectionsWebdav="connections_webdav",r.ConnectionsNextcloud="connections_nextcloud",r.ConnectionsNextbox="connections_nextbox",r.ConnectionsHttpProxy="connections_http_proxy",r.SystemInfoServiceList="system_info_service_list",r.SettingsRead="settings_read",r.SettingsWrite="settings_write";const n=[exports.AccessRights.ConnectionsYandexDisk,exports.AccessRights.ConnectionsSsh,exports.AccessRights.ConnectionsMail,exports.AccessRights.ConnectionsS3,exports.AccessRights.ConnectionsS3,exports.AccessRights.ConnectionsDiscord,exports.AccessRights.ConnectionsWebdav,exports.AccessRights.ConnectionsNextcloud,exports.AccessRights.ConnectionsNextbox,exports.AccessRights.ConnectionsHttpProxy];var o,c,a,l,p,d,h,u,g,x,v,_,S,f,y,$,m,k,A,w,R,T,O,N,b,C,E,U,D,J;exports.OrderDirection=void 0,(o=exports.OrderDirection||(exports.OrderDirection={})).DEFAULT="",o.ASC="asc",o.DESC="desc",exports.EngineType=void 0,(c=exports.EngineType||(exports.EngineType={})).WebSocket="websocket",c.PostMessage="postmessage",c.Empty="",exports.ConnectionGroup=void 0,(a=exports.ConnectionGroup||(exports.ConnectionGroup={})).Storages="storages_connections_group",a.Webhooks="webhooks_connections_group",a.Unknown="unknown_connections_group",a.Proxy="proxy_connections_group",exports.ConnectionType=void 0,(l=exports.ConnectionType||(exports.ConnectionType={})).SSH="ssh_connection",l.YandexDisk="yandex_disk",l.Mail="mail",l.Discord="discord",l.Webdav="webdav_connection",l.Nextcloud="nextcloud_connection",l.NextBox="nextbox_connection",l.HttpProxy="http_proxy_connection",l.S3="s3_connection",exports.ExtensionType=void 0,(p=exports.ExtensionType||(exports.ExtensionType={})).App="app",p.File="file",p.WorkDir="work_dir",exports.ExtensionFileMode=void 0,(d=exports.ExtensionFileMode||(exports.ExtensionFileMode={})).Read="read",d.ReadAndWrite="read_and_write",d.Write="write",exports.DivideScope=void 0,(h=exports.DivideScope||(exports.DivideScope={})).Storage="/storage/element",h.Connection="/connections",exports.PermissionType=void 0,(u=exports.PermissionType||(exports.PermissionType={})).CLOSE="",u.READ="r",u.WRITE="rw",exports.RestrictionStatus=void 0,(g=exports.RestrictionStatus||(exports.RestrictionStatus={})).WAITING="waiting",g.APPROVED="approved",g.REJECTED="rejected",exports.RestrictionBooleanStatus=void 0,(x=exports.RestrictionBooleanStatus||(exports.RestrictionBooleanStatus={})).TRUE="true",x.FALSE="false",exports.DivideMode=void 0,(v=exports.DivideMode||(exports.DivideMode={})).User="to_user_id",v.Group="to_user_group_id",exports.RestrictionModeKey=void 0,(_=exports.RestrictionModeKey||(exports.RestrictionModeKey={})).Divide="divide",_.Share="share",exports.Tariff=void 0,(S=exports.Tariff||(exports.Tariff={})).Free="free",S.Business="business",S.Enterprise="enterprise",exports.LicenseError=void 0,(f=exports.LicenseError||(exports.LicenseError={})).NotActivated="License not activated",f.Blocked="License blocked",f.Expired="License has been expired",f.NotValid="License not valid",f.NotFound="license file not found",exports.NotificationEntityType=void 0,(y=exports.NotificationEntityType||(exports.NotificationEntityType={})).Dir="dir",y.File="file",y.User="user",y.Other="other",y.WorkDir="work_dir",y.License="license",y.Extension="extension",y.Connection="connection",exports.NotificationAction=void 0,($=exports.NotificationAction||(exports.NotificationAction={})).OpenSharing="open_sharing",$.ChangeSharing="change_sharing",$.CancelSharing="cancel_sharing",$.DivideDirAddFileToOwner="divide_dir_add_file_to_owner",$.DivideDirAddDirToOwner="divide_dir_add_dir_to_owner",$.DivideDirAddWorkDirToOwner="divide_dir_add_work_dir_to_owner",$.DivideConnectionAddFileToOwner="divide_connection_add_file_to_owner",$.DivideConnectionAddDirToOwner="divide_connection_add_dir_to_owner",$.CancelDivideDir="cancel_divide_dir",$.CancelDivideFile="cancel_divide_file",$.CancelDivideWorkDir="cancel_divide_work_dir",$.CancelDivideConnection="cancel_divide_connection",$.DeleteExtension="delete_extension",$.NewVersionExtension="new_version_extension",$.TransferData="transfer_data",$.AllowInternalAccessUser="allow_internal_access_to_user",$.BlockInternalAccessUser="block_internal_access_to_user",$.WaitInternalAccessUser="wait_internal_access_to_user",$.WaitInternalAccessUserCreate="wait_internal_access_to_user_create",$.AllowInternalAccessGroup="allow_internal_access_to_group",$.BlockInternalAccessGroup="block_internal_access_to_group",$.WaitInternalAccessGroup="wait_internal_access_to_group",$.WaitInternalAccessGroupCreate="wait_internal_access_to_group_create",$.AllowSharing="allow_sharing",$.BlockSharing="block_sharing",$.WaitSharing="wait_sharing",$.WaitSharingCreate="wait_sharing_create",$.Other="other",exports.NotificationRowAction=void 0,(m=exports.NotificationRowAction||(exports.NotificationRowAction={})).Read="read",m.Unread="unread",m.Delete="delete",exports.NotificationStyle=void 0,(k=exports.NotificationStyle||(exports.NotificationStyle={})).Plain="plain",k.Success="success",k.Info="info",k.Warning="warning",k.Error="error",exports.ResponseType=void 0,(A=exports.ResponseType||(exports.ResponseType={})).ArrayBuffer="arraybuffer",A.Blob="blob",A.Json="json",A.Text="text",exports.RequestMethod=void 0,(w=exports.RequestMethod||(exports.RequestMethod={})).GET="GET",w.POST="POST",w.PUT="PUT",w.PATCH="PATCH",w.DELETE="DELETE",exports.RequestObserve=void 0,(R=exports.RequestObserve||(exports.RequestObserve={})).Body="body",R.Response="response",exports.RestrictionSharing=void 0,(T=exports.RestrictionSharing||(exports.RestrictionSharing={})).NONE="none",T.SOFT="soft",T.HARD="hard",exports.UserAuthType=void 0,(O=exports.UserAuthType||(exports.UserAuthType={})).Native="native",O.Ldap="ldap",exports.UserStatus=void 0,(N=exports.UserStatus||(exports.UserStatus={})).Registering="registering",N.Activated="activated",N.Blocked="blocked",N.BlockedByLicense="blocked_by_license",exports.UserType=void 0,(b=exports.UserType||(exports.UserType={})).User="user",b.Guest="guest",b.Emperor="emperor",b.Anonymous="anonymous",exports.SettingControlType=void 0,(C=exports.SettingControlType||(exports.SettingControlType={})).Text="text",C.String="string",C.Number="number",C.CheckBox="checkbox",C.Select="select",C.RadioList="radio_list",C.ConnectionChoose="connection_choose",C.MultiConnectionChoose="multi_connection_choose",exports.StorageElementType=void 0,(E=exports.StorageElementType||(exports.StorageElementType={})).Dir="dir",E.File="file",E.WorkDir="work_dir",exports.StorageElementContentType=void 0,(U=exports.StorageElementContentType||(exports.StorageElementContentType={})).Any="any",U.Dir="dir",U.Code="code",U.Image="image",U.Audio="audio",U.Video="video",U.Text="text",U.Doc="doc",U.Xls="xls",U.Ppt="ppt",exports.StorageRoot=void 0,(D=exports.StorageRoot||(exports.StorageRoot={})).my="my",D.fca="fca",D.divide="divide",D.share="share",D.favorite="favorite",exports.StorageElementHistoryAction=void 0,(J=exports.StorageElementHistoryAction||(exports.StorageElementHistoryAction={})).Create="create",J.Update="update",J.Move="move";const P="/connections",I=`${P}/dashboard`;class L{constructor(e){this.client=e}list(e){return this.client.rest.get(P,e)}get(e){return this.client.rest.get(`${P}/${e}`)}update(e,t){return this.client.rest.put(`${P}/${e}`,JSON.stringify(t))}delete(e){return this.client.rest.delete(`${P}/${e}`)}create(e){const t={[exports.ConnectionType.SSH]:"/disk/ssh",[exports.ConnectionType.Webdav]:"/disk/webdav",[exports.ConnectionType.Nextcloud]:"/disk/nextcloud",[exports.ConnectionType.NextBox]:"/disk/nextbox",[exports.ConnectionType.Discord]:"/webhooks/discord",[exports.ConnectionType.Mail]:"/webhooks/mail",[exports.ConnectionType.HttpProxy]:"/http_proxy",[exports.ConnectionType.S3]:"/disk/s3"};return this.client.rest.post(t[e.type]||P,JSON.stringify(e))}dashboard(e){return this.client.rest.get(I,e)}}class q{constructor(e){this.client=e}discovery(e){return this.client.rest.get("/discovery",e)}}class j{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,r){const n=Object.assign(Object.assign({},this.makeParam(e,t)),{[r]:s,access_mode:i});return this.client.rest.post(`${e}/divide`,JSON.stringify(n))}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===exports.DivideScope.Connection?s.connection_id=t:s.path=t,s}}function M(e,t,s,i){return new(s||(s=Promise))((function(r,n){function o(e){try{a(i.next(e))}catch(e){n(e)}}function c(e){try{a(i.throw(e))}catch(e){n(e)}}function a(e){var t;e.done?r(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 F extends Error{}function W(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 B(e,t){if("string"!=typeof e)throw new F("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 F(`Invalid token specified: missing part #${s+1}`);let r;try{r=W(i)}catch(e){throw new F(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(r)}catch(e){throw new F(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}F.prototype.name="InvalidTokenError";const H=(e,t)=>M(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 G(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 K="/api/v2",Y=`${window.location.protocol}//${window.location.host}`;class X{constructor(e,t){this.client=e,this.tokenUpdate=t}get state(){return this.client.state}get(e,t,s){return this.request(exports.RequestMethod.GET,e,Object.assign({params:t,cache:"no-cache"},s))}post(e,t,s){return this.request(exports.RequestMethod.POST,e,Object.assign({body:t},s))}put(e,t,s){return this.request(exports.RequestMethod.PUT,e,Object.assign({body:t,cache:"no-cache"},s))}patch(e,t,s){return this.request(exports.RequestMethod.PATCH,e,Object.assign({body:t},s))}delete(e,t,s){return this.request(exports.RequestMethod.DELETE,e,Object.assign({params:t},s))}request(e,t,s){return M(this,void 0,void 0,(function*(){return new Promise(((i,r)=>M(this,void 0,void 0,(function*(){var n,o;const c=null!==(n=this.state.skipInterceptors)&&void 0!==n&&n;this.state.skipInterceptors=!1;let a=Object.assign({method:e},s);if(c||(s=yield H(this.client.requestInterceptors,a)),this.state.authToken)for(const[e,i]of this.state.authToken.entries()){const r=B(i.access_token);if(r&&r.is_remember&&this.tokenUpdate.isTokenExpire(r.exp)&&!t.includes("/login")&&!t.includes("/assets")){const t=yield this.tokenUpdate.refreshToken(i);t&&(this.state.authToken.set(e,t),s=yield H(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 p=`${this.state.clientParams.host}${this.state.clientParams.version}${t}`;if(l.open(e,p,!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=()=>M(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 exports.ResponseType.Text:t=l.responseText;case exports.ResponseType.Blob:case exports.ResponseType.ArrayBuffer:t=l.response;default:try{t=JSON.parse(l.responseText)}catch(e){t=l.responseText}}let n={status:l.status,statusText:l.statusText,headers:e,body:t};n=yield H(this.client.responseInterceptors,n),l.status>=200&&l.status<300?(null==s?void 0:s.observe)===exports.RequestObserve.Response?i(n):i(t):r({status:l.status,statusText:l.statusText,headers:e,error:t})})),l.onerror=()=>r(new Error("Network error")),l.send(null!==(o=null==s?void 0:s.body)&&void 0!==o?o:null)}))))}))}changeBaseUrlVersion(e,t){return M(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 M(this,void 0,void 0,(function*(){this.state.clientParams.host=e,this.state.requestParams.headers={};try{return yield t()}finally{this.state.clientParams.host=Y}}))}}class Q{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 M(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 G("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}}const Z="/static/extensions",ee="/extensions/defaults";class te{constructor(e){this.client=e}getSetting(e){return this.client.rest.get(`${Z}/${e}/settings`)}setSetting(e,t){return this.client.rest.post(`${Z}/${e}/settings`,JSON.stringify(t))}deleteSetting(e){return this.client.rest.delete(`${Z}/${e}/settings`)}get(e){return this.client.rest.get(`${Z}/${e}`)}getByKey(e){return this.client.rest.get(`${Z}/${e}`)}getDefault(e=[]){return this.client.rest.get(ee,{ext_code:e})}setDefault(e,t){return this.client.rest.post(ee,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(Z,e)}delete(e,t){return this.client.rest.delete(`${Z}/${e}`)}upload(e,t){const s=new FormData;return s.set("file",t),this.client.rest.changeBaseUrlVersion(K,(()=>this.client.rest.post(Z,s,{onUploadProgress:t=>{e(t)}})))}install(e,t){return this.client.rest.changeBaseUrlVersion(K,(()=>this.client.rest.post("/static/extensions/site",JSON.stringify({uniq_key:e,version:t}))))}}class se{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 ie="/disk",re=`${ie}/check`;class ne{constructor(e){this.client=e}info(e,t){return this.client.rest.get(`${ie}/${e}/element`,{path:t})}list(e,t){return this.client.rest.get(`${ie}/${e}`,t)}create(e,t){return this.client.rest.post(`${ie}/${e}/element`,JSON.stringify(t))}replace(e,t,s){return this.client.rest.put(`${ie}/${e}/files?path=${t}`,s)}read(e,t){return this.client.rest.get(`${ie}/${e}/files?path=${t}`)}upload(e,t,s,i=""){const r=new FormData;return r.set("path",i),r.set("file",s),this.client.rest.post(`${ie}/${t}/files`,r,{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(`${ie}/${e}/trash/element`,{path:t})}check(e){return this.client.rest.post(re,JSON.stringify(e))}}class oe{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 ce="/groups";class ae{constructor(e){this.client=e}list(e){return this.client.rest.get(ce,e)}listUsers(e){return this.client.rest.get(`${ce}/${e}/users`)}create(e){return this.client.rest.post(ce,JSON.stringify(e))}update(e,t){return this.client.rest.put(`${ce}/${e}`,JSON.stringify(t))}delete(e){return this.client.rest.delete(`${ce}/${e}`)}}const le="/license",pe=`${le}/manual-check`,de=`${le}/hardware/hash`;class he{constructor(e){this.client=e}info(){return this.client.rest.get(le)}create(e){return this.client.rest.post(le,JSON.stringify(e))}check(){return this.client.rest.post(pe)}delete(){return this.client.rest.delete(le)}getHash(){return this.client.rest.get(de)}}const ue="/links";class ge{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post(`${ue}`,JSON.stringify(e))}updateShortLink(e){return this.client.rest.put(`${ue}`,JSON.stringify(e))}}const xe="/logs";class ve{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get(`${xe}/users`,e)}getSystemLogs(e,t,s){return this.client.rest.get(`${xe}/${e}`,{},{observe:exports.RequestObserve.Response,responseType:exports.ResponseType.Text,headers:{Range:`bytes=${t}-${s}`}})}}const _e="/notifications",Se=`${_e}/all`,fe=`${_e}/subscription`,ye=`${_e}/permission`;class $e{constructor(e){this.client=e}list(e){return this.client.rest.get(_e,e)}toggleStatus(e,t){return this.client.rest.put(_e,JSON.stringify({ids:e,to_status:t}))}toggleAllStatus(e){return this.client.rest.put(Se,JSON.stringify({to_status:e}))}delete(e){return this.client.rest.delete(_e,{id:e})}deleteAll(){return this.client.rest.delete(Se)}getPermission(){return this.client.rest.get(ye)}setPermission(e){return this.client.rest.post(ye,JSON.stringify({enabled:e}))}getSubscription(){return this.client.rest.get(fe)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(fe,JSON.stringify(t))}}const me="/roles",ke=`${me}/default`;class Ae{constructor(e){this.client=e}list(e){return this.client.rest.get(me,e)}get(e){return this.client.rest.get(`${me}/${e}`)}getDefault(){return this.client.rest.get(`${ke}`)}create(e){return this.client.rest.post(me,JSON.stringify(e))}update(e,t){return this.client.rest.put(`${me}/${e}`,JSON.stringify(t))}delete(e){return this.client.rest.delete(`${me}/${e}`)}permissionList(){return this.client.rest.get("/permissions")}addPermission(e,t){return this.client.rest.put(`${me}/${e}/permissions`,JSON.stringify({ids:t}))}deletePermission(e,t){return this.client.rest.delete(`${me}/${e}/permissions`,{ids:t})}}class we{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 Re="/storage",Te=`${Re}/element`,Oe=`${Te}/move`,Ne=`${Te}/copy`,be=`${Te}/content_type_size`;class Ce{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(Re,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(Te,e)}combineInfo({root:e,rootId:t,path:s,file_version_id:i}){return e===exports.StorageRoot.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(`${Te}/size`,JSON.stringify(e))}move(e,t,s){const{from_divide_id:i,to_divide_id:r}=e;let n=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return t===exports.StorageRoot.fca&&s===exports.StorageRoot.fca?this.client.rest.post(`/disk/${i}/files/move/disk/${r}`,JSON.stringify(n)):t===exports.StorageRoot.fca?(i&&(n.from_divide_id=i),this.client.rest.put(`/disk/${r}/files/from/box`,JSON.stringify(n))):s===exports.StorageRoot.fca?(r&&(n.to_divide_id=r),this.client.rest.put(`/disk/${i}/files/to/box`,JSON.stringify(n))):this.client.rest.post(Oe,JSON.stringify(e))}copy(e,t,s){const{from_divide_id:i,to_divide_id:r}=e;let n=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return s===exports.StorageRoot.fca&&t===exports.StorageRoot.fca?this.client.rest.post(`/disk/${i}/files/copy/disk/${r}`,JSON.stringify(n)):s===exports.StorageRoot.fca?(i&&(n.from_divide_id=i),this.client.rest.post(`/disk/${r}/files/from/box`,JSON.stringify(n))):t===exports.StorageRoot.fca?(r&&(n.to_divide_id=r),this.client.rest.post(`/disk/${i}/files/to/box`,JSON.stringify(n))):this.client.rest.post(Ne,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(Te,JSON.stringify(e))}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(Te,s)}favorite(e){return this.client.rest.put(`${Te}?path=${encodeURIComponent(e)}`,JSON.stringify({is_favorite:!0}))}removeFavorite(e){return this.client.rest.put(`${Te}?path=${encodeURIComponent(e)}`,JSON.stringify({is_favorite:!1}))}createItem(e){return this.client.rest.post(Te,JSON.stringify(e))}createWorkDir(e){return this.client.rest.post(Te,JSON.stringify(e))}sizeWithSection(e){return this.client.rest.get(be,e)}}const Ee="/storage/files",Ue=`${Ee}/net`;class De{constructor(e){this.client=e}read(e,t){return t.path=e,this.client.rest.get(Ee,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(`${Ee}?${s.toString()}`,t)}upload(e,t,s,i){const r=new FormData;return r.set("path",s),r.set("file",t),i&&r.set("divide_id",i.toString()),this.client.rest.post(Ee,r,{onUploadProgress:t=>{e(t)}})}uploadNet(e){return this.client.rest.post(Ue,JSON.stringify(e))}}class Je{constructor(e){this.client=e}instance(){return this.client.rest.get("storage/instance")}}const Pe="/storage/element/share";class Ie{constructor(e){this.client=e}info(e){return this.client.rest.get(Pe,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(Pe,JSON.stringify(s))}change(e){return this.client.rest.put(`${Pe}/${e.token}`,JSON.stringify(e))}delete(e){return this.client.rest.delete(Pe,{path:e})}refresh(e){return this.client.rest.put(`${Pe}/${e}/refresh`)}}const Le="/storage/trash",qe=`${Le}/element`,je=`${qe}/all`;class Me{constructor(e){this.client=e}list(e){return this.client.rest.get(Le,e)}clear(e){return this.client.rest.delete(qe,e)}clearAll(){return this.client.rest.delete(je)}restore(e){return this.client.rest.patch(qe,JSON.stringify({del_groups:e}))}}const Fe="/users",We=`${Fe}/me`,Be=`${We}/avatars`,He=`${We}/sessions`,Ge=`${We}/tokens`,Ve=`${We}/change-password`;class ze{constructor(e){this.client=e}list(e){return this.client.rest.get(Fe,e)}get(e){return this.client.rest.get(Fe+`/${e}`)}create(e){return this.client.rest.post(Fe,JSON.stringify(e))}update(e,t){return this.client.rest.put(Fe+`/${e}`,JSON.stringify(t))}delete(e,t){return this.client.rest.delete(`${Fe}/${e}`,t)}restore(e){return this.client.rest.post(`${Fe}/${e}/restore`)}me(){return this.client.rest.get(We)}updateMe(e){return this.client.rest.put(We,JSON.stringify(e))}createToken(e){return this.client.rest.post(Ge,JSON.stringify(e))}listToken(e){return this.client.rest.get(Ge,e)}deleteToken(e){return this.client.rest.delete(`${Ge}/${e}`)}changeMyPassword(e){return this.client.rest.put(Ve,JSON.stringify(e))}changeUsersPassword(e,t){return this.client.rest.put(`${Fe}/${e}/change-password`,JSON.stringify(t))}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(Be,s)}meDeleteAvatar(){return this.client.rest.delete(Be)}meListSession(e){return this.client.rest.get(He,e)}meDeleteSession(e){let t=He;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${Fe}/${e}/roles`,JSON.stringify({role_id:t}))}}const Ke="/storage/element",Ye=`${Ke}/history`,Xe=`${Ke}/version`,Qe=`${Xe}/current`,Ze=`${Xe}/size`;class et{constructor(e){this.client=e}history(e){return this.client.rest.get(Ye,e)}versions(e){return this.client.rest.get(Xe,e)}create(e){return this.client.rest.post(Xe,JSON.stringify(e))}edit(e){return this.client.rest.put(Xe,JSON.stringify(e))}delete(e){return this.client.rest.delete(Xe,e)}size(e){return this.client.rest.get(Ze,e)}makeCurrent(e){return this.client.rest.post(Qe,JSON.stringify(e))}}exports.AuthApiService=i,exports.BASE_URL_V1="/api/v1",exports.BASE_URL_V2=K,exports.CONNECTIONS_PERMISSION=n,exports.Client=class{constructor(e){this.AuthApiService=new i(this),this.ConnectionsApiService=new L(this),this.DiscoveryApiService=new q(this),this.DivideApiService=new j(this),this.ExtensionsApiService=new te(this),this.ExtensionsExternalApiService=new se(this),this.FcaApiService=new ne(this),this.GatewayApiService=new oe(this),this.GroupApiService=new ae(this),this.LicenseApiService=new he(this),this.LinksApiService=new ge(this),this.LogstashApiService=new ve(this),this.NotificationApiService=new $e(this),this.RoleApiService=new Ae(this),this.ShareApiService=new we(this),this.StorageElementApiService=new Ce(this,this.FcaApiService),this.StorageFilesApiService=new De(this),this.StorageInstanceApiService=new Je(this),this.StorageShareApiService=new Ie(this),this.StorageTrashApiService=new Me(this),this.UserApiService=new ze(this),this.VersionApiService=new et(this),this.tokenUpdate=new Q(this.AuthApiService),this.rest=new X(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}}},exports.ConnectionsApiService=L,exports.DiscoveryApiService=q,exports.DivideApiService=j,exports.ExtensionsApiService=te,exports.ExtensionsExternalApiService=se,exports.FcaApiService=ne,exports.GatewayApiService=oe,exports.GroupApiService=ae,exports.HOST=Y,exports.LicenseApiService=he,exports.LinksApiService=ge,exports.LogstashApiService=ve,exports.NotificationApiService=$e,exports.Rest=X,exports.RoleApiService=Ae,exports.ShareApiService=we,exports.StorageElementApiService=Ce,exports.StorageFilesApiService=De,exports.StorageInstanceApiService=Je,exports.StorageShareApiService=Ie,exports.StorageTrashApiService=Me,exports.TokenUpdate=Q,exports.UserApiService=ze,exports.VersionApiService=et,exports.applyInterceptors=H,exports.getCookieValue=G,exports.makeUrlParams=V,exports.normalizeHeaders=z;
|
package/dist/bundle.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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,J,U,E,R;!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"}(J||(J={})),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"}(U||(U={})),function(e){e.my="my",e.fca="fca",e.divide="divide",e.share="share",e.favorite="favorite"}(E||(E={})),function(e){e.Create="create",e.Update="update",e.Move="move"}(R||(R={}));const P="/connections",I=`${P}/dashboard`;class L{constructor(e){this.client=e}list(e){return this.client.rest.get(P,e)}get(e){return this.client.rest.get(`${P}/${e}`)}update(e,t){return this.client.rest.put(`${P}/${e}`,JSON.stringify(t))}delete(e){return this.client.rest.delete(`${P}/${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]||P,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}}const F="/static/extensions",q="/extensions/defaults";class B{constructor(e){this.client=e}getSetting(e){return this.client.rest.get(`${F}/${e}/settings`)}setSetting(e,t){return this.client.rest.post(`${F}/${e}/settings`,JSON.stringify(t))}deleteSetting(e){return this.client.rest.delete(`${F}/${e}/settings`)}get(e){return this.client.rest.get(`${F}/${e}`)}getByKey(e){return this.client.rest.get(`${F}/${e}`)}getDefault(e=[]){return this.client.rest.get(q,{ext_code:e})}setDefault(e,t){return this.client.rest.post(q,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(F,e)}delete(e,t){return this.client.rest.delete(`${F}/${e}`)}upload(e,t){const s=new FormData;return s.set("file",t),this.client.rest.post(F,s,{onUploadProgress:t=>{e(t)}})}install(e,t){return this.client.rest.post("/static/extensions/site",JSON.stringify({uniq_key:e,version:t}))}}class H{constructor(e){this.client=e}listExtensionsSite(e){return 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 G="/disk",M=`${G}/check`;class z{constructor(e){this.client=e}info(e,t){return this.client.rest.get(`${G}/${e}/element`,{path:t})}list(e,t){return this.client.rest.get(`${G}/${e}`,t)}create(e,t){return this.client.rest.post(`${G}/${e}/element`,JSON.stringify(t))}replace(e,t,s){return this.client.rest.put(`${G}/${e}/files?path=${t}`,s)}read(e,t){return this.client.rest.get(`${G}/${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(`${G}/${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(`${G}/${e}/trash/element`,{path:t})}check(e){return this.client.rest.post(M,JSON.stringify(e))}}class V{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 Y="/groups";class X{constructor(e){this.client=e}list(e){return this.client.rest.get(Y,e)}listUsers(e){return this.client.rest.get(`${Y}/${e}/users`)}create(e){return this.client.rest.post(Y,JSON.stringify(e))}update(e,t){return this.client.rest.put(`${Y}/${e}`,JSON.stringify(t))}delete(e){return this.client.rest.delete(`${Y}/${e}`)}}const K="/license",Q=`${K}/manual-check`,Z=`${K}/hardware/hash`;class ee{constructor(e){this.client=e}info(){return this.client.rest.get(K)}create(e){return this.client.rest.post(K,JSON.stringify(e))}check(){return this.client.rest.post(Q)}delete(){return this.client.rest.delete(K)}getHash(){return this.client.rest.get(Z)}}class te{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post("links",JSON.stringify(e))}updateShortLink(e){return this.client.rest.put("links",JSON.stringify(e))}}const se="/logs";class ie{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get(`${se}/users`,e)}getSystemLogs(e,t,s){return this.client.rest.get(`${se}/${e}`,{},{observe:b.Response,responseType:O.Text,headers:{Range:`bytes=${t}-${s}`}})}}const ne="/notifications",re=`${ne}/all`,oe=`${ne}/subscription`,ce=`${ne}/permission`;class ae{constructor(e){this.client=e}list(e){return this.client.rest.get(ne,e)}toggleStatus(e,t){return this.client.rest.put(ne,JSON.stringify({ids:e,to_status:t}))}toggleAllStatus(e){return this.client.rest.put(re,JSON.stringify({to_status:e}))}delete(e){return this.client.rest.delete(ne,{id:e})}deleteAll(){return this.client.rest.delete(re)}getPermission(){return this.client.rest.get(ce)}setPermission(e){return this.client.rest.post(ce,JSON.stringify({enabled:e}))}getSubscription(){return this.client.rest.get(oe)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(oe,JSON.stringify(t))}}const le="/roles",de=`${le}/default`;class he{constructor(e){this.client=e}list(e){return this.client.rest.get(le,e)}get(e){return this.client.rest.get(`${le}/${e}`)}getDefault(){return this.client.rest.get(`${de}`)}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}`)}permissionList(){return this.client.rest.get("/permissions")}addPermission(e,t){return this.client.rest.put(`${le}/${e}/permissions`,JSON.stringify({ids:t}))}deletePermission(e,t){return this.client.rest.delete(`${le}/${e}/permissions`,{ids:t})}}class ue{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 pe="/storage",ge=`${pe}/element`,fe=`${ge}/move`,_e=`${ge}/copy`,ve=`${ge}/content_type_size`;class Se{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(pe,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(ge,e)}combineInfo({root:e,rootId:t,path:s,file_version_id:i}){return e===E.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(`${ge}/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===E.fca&&s===E.fca?this.client.rest.post(`/disk/${i}/files/move/disk/${n}`,JSON.stringify(r)):t===E.fca?(i&&(r.from_divide_id=i),this.client.rest.put(`/disk/${n}/files/from/box`,JSON.stringify(r))):s===E.fca?(n&&(r.to_divide_id=n),this.client.rest.put(`/disk/${i}/files/to/box`,JSON.stringify(r))):this.client.rest.post(fe,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===E.fca&&t===E.fca?this.client.rest.post(`/disk/${i}/files/copy/disk/${n}`,JSON.stringify(r)):s===E.fca?(i&&(r.from_divide_id=i),this.client.rest.post(`/disk/${n}/files/from/box`,JSON.stringify(r))):t===E.fca?(n&&(r.to_divide_id=n),this.client.rest.post(`/disk/${i}/files/to/box`,JSON.stringify(r))):this.client.rest.post(_e,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(ge,JSON.stringify(e))}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(ge,s)}favorite(e){return this.client.rest.put(`${ge}?path=${encodeURIComponent(e)}`,JSON.stringify({is_favorite:!0}))}removeFavorite(e){return this.client.rest.put(`${ge}?path=${encodeURIComponent(e)}`,JSON.stringify({is_favorite:!1}))}createItem(e){return this.client.rest.post(ge,JSON.stringify(e))}createWorkDir(e){return this.client.rest.post(ge,JSON.stringify(e))}sizeWithSection(e){return this.client.rest.get(ve,e)}}const ye="/storage/files",$e=`${ye}/net`;class ke{constructor(e){this.client=e}read(e,t){return t.path=e,this.client.rest.get(ye,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(`${ye}?${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(ye,n,{onUploadProgress:t=>{e(t)}})}uploadNet(e){return this.client.rest.post($e,JSON.stringify(e))}}class me{constructor(e){this.client=e}instance(){return this.client.rest.get("storage/instance")}}const we="/storage/element/share";class Oe{constructor(e){this.client=e}info(e){return this.client.rest.get(we,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(we,JSON.stringify(s))}change(e){return this.client.rest.put(`${we}/${e.token}`,JSON.stringify(e))}delete(e){return this.client.rest.delete(we,{path:e})}refresh(e){return this.client.rest.put(`${we}/${e}/refresh`)}}const xe="/storage/trash",be=`${xe}/element`,Ne=`${be}/all`;class Ae{constructor(e){this.client=e}list(e){return this.client.rest.get(xe,e)}clear(e){return this.client.rest.delete(be,e)}clearAll(){return this.client.rest.delete(Ne)}restore(e){return this.client.rest.patch(be,JSON.stringify({del_groups:e}))}}const Ce="/users",De=`${Ce}/me`,Te=`${De}/avatars`,Je=`${De}/sessions`,Ue=`${De}/tokens`,Ee=`${De}/change-password`;class Re{constructor(e){this.client=e}list(e){return this.client.rest.get(Ce,e)}get(e){return this.client.rest.get(Ce+`/${e}`)}create(e){return this.client.rest.post(Ce,JSON.stringify(e))}update(e,t){return this.client.rest.put(Ce+`/${e}`,JSON.stringify(t))}delete(e,t){return this.client.rest.delete(`${Ce}/${e}`,t)}restore(e){return this.client.rest.post(`${Ce}/${e}/restore`)}me(){return this.client.rest.get(De)}updateMe(e){return this.client.rest.put(De,JSON.stringify(e))}createToken(e){return this.client.rest.post(Ue,JSON.stringify(e))}listToken(e){return this.client.rest.get(Ue,e)}deleteToken(e){return this.client.rest.delete(`${Ue}/${e}`)}changeMyPassword(e){return this.client.rest.put(Ee,JSON.stringify(e))}changeUsersPassword(e,t){return this.client.rest.put(`${Ce}/${e}/change-password`,JSON.stringify(t))}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(Te,s)}meDeleteAvatar(){return this.client.rest.delete(Te)}meListSession(e){return this.client.rest.get(Je,e)}meDeleteSession(e){let t=Je;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${Ce}/${e}/roles`,JSON.stringify({role_id:t}))}}const Pe="/storage/element",Ie=`${Pe}/history`,Le=`${Pe}/version`,je=`${Le}/current`,We=`${Le}/size`;class Fe{constructor(e){this.client=e}history(e){return this.client.rest.get(Ie,e)}versions(e){return this.client.rest.get(Le,e)}create(e){return this.client.rest.post(Le,JSON.stringify(e))}edit(e){return this.client.rest.put(Le,JSON.stringify(e))}delete(e){return this.client.rest.delete(Le,e)}size(e){return this.client.rest.get(We,e)}makeCurrent(e){return this.client.rest.post(je,JSON.stringify(e))}}function qe(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 Be extends Error{}function He(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 Ge(e,t){if("string"!=typeof e)throw new Be("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 Be(`Invalid token specified: missing part #${s+1}`);let n;try{n=He(i)}catch(e){throw new Be(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(n)}catch(e){throw new Be(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}Be.prototype.name="InvalidTokenError";const Me=(e,t)=>qe(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 ze(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 Ve=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 Ye(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}class Xe{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 qe(this,void 0,void 0,(function*(){return new Promise(((i,n)=>qe(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 Me(this.client.requestInterceptors,a)),this.state.authToken)for(const[e,i]of this.state.authToken.entries()){const n=Ge(i.access_token),r=n&&n.is_remember&&this.tokenUpdate.isTokenExpire(n.exp);if(console.log(r),console.log(this.state.authToken),r&&!t.includes("/login")&&!t.includes("/assets")){const t=yield this.tokenUpdate.refreshToken(i);console.log(t),t&&(this.state.authToken.set(e,t),s=yield Me(this.client.requestInterceptors,a))}}const l=new XMLHttpRequest;(null==s?void 0:s.params)&&0===Object.keys(s.params).length&&(t+="?"+Ve(s.params));const d=`${this.state.clientParams.host}${this.state.clientParams.version}${t}`;if(l.open(e,d,!0),l.withCredentials=!0,null==s?void 0:s.headers){const e=Ye(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=()=>qe(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 Me(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)}))))}))}}class Ke{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 qe(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 ze("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 Qe{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 B(this),this.ExtensionsExternalApiService=new H(this),this.FcaApiService=new z(this),this.GatewayApiService=new V(this),this.GroupApiService=new X(this),this.LicenseApiService=new ee(this),this.LinksApiService=new te(this),this.LogstashApiService=new ie(this),this.NotificationApiService=new ae(this),this.RoleApiService=new he(this),this.ShareApiService=new ue(this),this.StorageElementApiService=new Se(this,this.FcaApiService),this.StorageFilesApiService=new ke(this),this.StorageInstanceApiService=new me(this),this.StorageShareApiService=new Oe(this),this.StorageTrashApiService=new Ae(this),this.UserApiService=new Re(this),this.VersionApiService=new Fe(this),this.tokenUpdate=new Ke(this.AuthApiService),this.rest=new Xe(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}}}export{n as AccessRights,i as AuthApiService,r as CONNECTIONS_PERMISSION,Qe 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,B as ExtensionsApiService,H as ExtensionsExternalApiService,z as FcaApiService,V as GatewayApiService,X as GroupApiService,ee as LicenseApiService,y as LicenseError,te as LinksApiService,ie as LogstashApiService,k as NotificationAction,ae 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,Xe as Rest,f as RestrictionBooleanStatus,v as RestrictionModeKey,N as RestrictionSharing,g as RestrictionStatus,he as RoleApiService,T as SettingControlType,ue as ShareApiService,Se as StorageElementApiService,U as StorageElementContentType,R as StorageElementHistoryAction,J as StorageElementType,ke as StorageFilesApiService,me as StorageInstanceApiService,E as StorageRoot,Oe as StorageShareApiService,Ae as StorageTrashApiService,S as Tariff,Ke as TokenUpdate,Re as UserApiService,A as UserAuthType,C as UserStatus,D as UserType,Fe as VersionApiService,Me as applyInterceptors,ze as getCookieValue,Ve as makeUrlParams,Ye as normalizeHeaders};
|
|
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};
|
package/dist/classes/rest.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Client } from './client';
|
|
2
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;
|
|
@@ -12,4 +15,6 @@ export declare class Rest {
|
|
|
12
15
|
patch(path: string, body?: BodyInit | null, config?: RequestConfig): Promise<any>;
|
|
13
16
|
delete(path: string, params?: Record<string, any>, config?: RequestConfig): Promise<any>;
|
|
14
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(
|
|
10
|
+
refreshToken(params: RequestAuthTokenParams): Promise<AuthToken | null>;
|
|
11
11
|
private waitForTokenUpdate;
|
|
12
12
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
interface AuthToken {
|
|
2
|
-
access_token: string;
|
|
3
|
-
refresh_token: string;
|
|
4
|
-
}
|
|
5
|
-
interface AuthType {
|
|
6
|
-
classic: boolean;
|
|
7
|
-
basic: boolean;
|
|
8
|
-
ldap: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
1
|
interface StorageElement {
|
|
12
2
|
name: string;
|
|
13
3
|
size: number;
|
|
@@ -209,7 +199,7 @@ interface NbRequestParams {
|
|
|
209
199
|
interface NbAppState {
|
|
210
200
|
clientParams: NbClientParams;
|
|
211
201
|
requestParams: NbRequestParams;
|
|
212
|
-
authToken: Map<number,
|
|
202
|
+
authToken: Map<number, RequestAuthTokenParams> | null;
|
|
213
203
|
skipInterceptors: boolean;
|
|
214
204
|
}
|
|
215
205
|
interface ResponseItem<T> {
|
|
@@ -372,6 +362,16 @@ interface AccessToken {
|
|
|
372
362
|
};
|
|
373
363
|
}
|
|
374
364
|
|
|
365
|
+
interface AuthToken {
|
|
366
|
+
access_token: string;
|
|
367
|
+
refresh_token: string;
|
|
368
|
+
}
|
|
369
|
+
interface AuthType {
|
|
370
|
+
classic: boolean;
|
|
371
|
+
basic: boolean;
|
|
372
|
+
ldap: boolean;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
375
|
interface Connection {
|
|
376
376
|
id: number;
|
|
377
377
|
name: string;
|
|
@@ -781,7 +781,7 @@ declare class TokenUpdate {
|
|
|
781
781
|
private tokenUpdateResolve;
|
|
782
782
|
constructor(authApiService: AuthApiService);
|
|
783
783
|
isTokenExpire(timestamp: number): boolean;
|
|
784
|
-
refreshToken(
|
|
784
|
+
refreshToken(params: RequestAuthTokenParams): Promise<AuthToken | null>;
|
|
785
785
|
private waitForTokenUpdate;
|
|
786
786
|
}
|
|
787
787
|
|
|
@@ -822,6 +822,9 @@ declare class Client {
|
|
|
822
822
|
};
|
|
823
823
|
}
|
|
824
824
|
|
|
825
|
+
declare const BASE_URL_V1 = "/api/v1";
|
|
826
|
+
declare const BASE_URL_V2 = "/api/v2";
|
|
827
|
+
declare const HOST: string;
|
|
825
828
|
declare class Rest {
|
|
826
829
|
private client;
|
|
827
830
|
private tokenUpdate;
|
|
@@ -833,6 +836,8 @@ declare class Rest {
|
|
|
833
836
|
patch(path: string, body?: BodyInit | null, config?: RequestConfig): Promise<any>;
|
|
834
837
|
delete(path: string, params?: Record<string, any>, config?: RequestConfig): Promise<any>;
|
|
835
838
|
request<T>(method: RequestMethod, path: string, config?: RequestConfig): Promise<T | HttpResponse<T> | HttpEvent<T>>;
|
|
839
|
+
changeBaseUrlVersion<T>(baseUrl: string, handler: () => Promise<T>): Promise<T>;
|
|
840
|
+
changeHost<T>(host: string, handler: () => Promise<T>): Promise<T>;
|
|
836
841
|
}
|
|
837
842
|
|
|
838
843
|
declare class AuthApiService {
|
|
@@ -1276,4 +1281,4 @@ declare const makeUrlParams: (params: Record<string, any>) => URLSearchParams;
|
|
|
1276
1281
|
|
|
1277
1282
|
declare function normalizeHeaders(headers: Headers | [string, string][] | Record<string, string>): Record<string, string>;
|
|
1278
1283
|
|
|
1279
|
-
export { AccessRights, type AccessToken, AuthApiService, type AuthToken, type AuthType, CONNECTIONS_PERMISSION, type ChangeLicenseParams, Client, type Connection, type ConnectionCreateParams, ConnectionGroup, ConnectionType, ConnectionsApiService, type CreateStorageElementParams, type CreateUserGroupParams, type CreateUserParams, type CreateUserRoleParams, type Discovery, DiscoveryApiService, DivideApiService, DivideMode, type DivideResourceType, type DivideResponseList, DivideScope, EngineType, type Extension, type ExtensionDefault, type ExtensionExternal, type ExtensionExternalInList, type ExtensionExternalListParams, ExtensionFileMode, type ExtensionListParams, type ExtensionMetaPayload, ExtensionType, ExtensionsApiService, ExtensionsExternalApiService, FcaApiService, GatewayApiService, GroupApiService, type HistoryListRequestParams, type HistoryNote, type HistoryRequestParams, type HttpEvent, type HttpResponse, type Lang, type License, LicenseApiService, LicenseError, LinksApiService, type LockScreen, LogstashApiService, type NbAppState, type NbClientParams, type NbRequestParams, NotificationAction, type NotificationActionGroup, NotificationApiService, NotificationEntityType, type NotificationPayload, NotificationRowAction, NotificationStyle, type OnUploadProgress, OrderDirection, type PayloadFile, type Permission, type PermissionItem, PermissionType, type ProgressEvent, type QueryInitResponse, type RequestAuthSettingsParams, type RequestAuthTokenParams, type RequestBaseParams, type RequestConfig, type RequestConnectionParams, RequestMethod, type RequestNotificationListParams, RequestObserve, type RequestStorageListParams, type RequestUserDivideParams, type RequestUserGroupListParams, type RequestUserListParams, type RequestUserRoleListParams, type RequestUsersLogParams, type RequestVersionsSizeParams, type ResponseItem, type ResponseList, type ResponseListNotification, ResponseType, Rest, type Restriction, RestrictionBooleanStatus, RestrictionModeKey, RestrictionSharing, RestrictionStatus, RoleApiService, type Setting, SettingControlType, type SettingField, type SettingFieldView, type SettingLang, type SettingValue, type SettingValueField, type SettingVariant, type SettingViewConnectionChoose, type SettingViewSelect, ShareApiService, type ShareInfo, type ShareModel, type SizeBySection, type StorageElement, StorageElementApiService, StorageElementContentType, type StorageElementHistory, StorageElementHistoryAction, type StorageElementPaste, type StorageElementPasteParams, StorageElementType, type StorageElementVersion, StorageFilesApiService, type StorageInstance, StorageInstanceApiService, StorageRoot, type StorageRouteData, StorageShareApiService, StorageTrashApiService, type StorageTrashElement, type StorageTrashItem, Tariff, TokenUpdate, type UnionRestriction, type UploadNetRequestParams, type User, UserApiService, UserAuthType, type UserDivide, type UserGroup, type UserLabel, type UserNotification, type UserRole, type UserSession, UserStatus, type UserToken, UserType, type UsersLog, VersionApiService, applyInterceptors, getCookieValue, makeUrlParams, normalizeHeaders };
|
|
1284
|
+
export { AccessRights, type AccessToken, AuthApiService, type AuthToken, type AuthType, BASE_URL_V1, BASE_URL_V2, CONNECTIONS_PERMISSION, type ChangeLicenseParams, Client, type Connection, type ConnectionCreateParams, ConnectionGroup, ConnectionType, ConnectionsApiService, type CreateStorageElementParams, type CreateUserGroupParams, type CreateUserParams, type CreateUserRoleParams, type Discovery, DiscoveryApiService, DivideApiService, DivideMode, type DivideResourceType, type DivideResponseList, DivideScope, EngineType, type Extension, type ExtensionDefault, type ExtensionExternal, type ExtensionExternalInList, type ExtensionExternalListParams, ExtensionFileMode, type ExtensionListParams, type ExtensionMetaPayload, ExtensionType, ExtensionsApiService, ExtensionsExternalApiService, FcaApiService, GatewayApiService, GroupApiService, HOST, type HistoryListRequestParams, type HistoryNote, type HistoryRequestParams, type HttpEvent, type HttpResponse, type Lang, type License, LicenseApiService, LicenseError, LinksApiService, type LockScreen, LogstashApiService, type NbAppState, type NbClientParams, type NbRequestParams, NotificationAction, type NotificationActionGroup, NotificationApiService, NotificationEntityType, type NotificationPayload, NotificationRowAction, NotificationStyle, type OnUploadProgress, OrderDirection, type PayloadFile, type Permission, type PermissionItem, PermissionType, type ProgressEvent, type QueryInitResponse, type RequestAuthSettingsParams, type RequestAuthTokenParams, type RequestBaseParams, type RequestConfig, type RequestConnectionParams, RequestMethod, type RequestNotificationListParams, RequestObserve, type RequestStorageListParams, type RequestUserDivideParams, type RequestUserGroupListParams, type RequestUserListParams, type RequestUserRoleListParams, type RequestUsersLogParams, type RequestVersionsSizeParams, type ResponseItem, type ResponseList, type ResponseListNotification, ResponseType, Rest, type Restriction, RestrictionBooleanStatus, RestrictionModeKey, RestrictionSharing, RestrictionStatus, RoleApiService, type Setting, SettingControlType, type SettingField, type SettingFieldView, type SettingLang, type SettingValue, type SettingValueField, type SettingVariant, type SettingViewConnectionChoose, type SettingViewSelect, ShareApiService, type ShareInfo, type ShareModel, type SizeBySection, type StorageElement, StorageElementApiService, StorageElementContentType, type StorageElementHistory, StorageElementHistoryAction, type StorageElementPaste, type StorageElementPasteParams, StorageElementType, type StorageElementVersion, StorageFilesApiService, type StorageInstance, StorageInstanceApiService, StorageRoot, type StorageRouteData, StorageShareApiService, StorageTrashApiService, type StorageTrashElement, type StorageTrashItem, Tariff, TokenUpdate, type UnionRestriction, type UploadNetRequestParams, type User, UserApiService, UserAuthType, type UserDivide, type UserGroup, type UserLabel, type UserNotification, type UserRole, type UserSession, UserStatus, type UserToken, UserType, type UsersLog, VersionApiService, applyInterceptors, getCookieValue, makeUrlParams, normalizeHeaders };
|
package/dist/types/base.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequestAuthTokenParams } from '../api';
|
|
2
2
|
import { PermissionType } from './divide';
|
|
3
3
|
export interface NbClientParams {
|
|
4
4
|
host?: string;
|
|
@@ -14,7 +14,7 @@ export interface NbRequestParams {
|
|
|
14
14
|
export interface NbAppState {
|
|
15
15
|
clientParams: NbClientParams;
|
|
16
16
|
requestParams: NbRequestParams;
|
|
17
|
-
authToken: Map<number,
|
|
17
|
+
authToken: Map<number, RequestAuthTokenParams> | null;
|
|
18
18
|
skipInterceptors: boolean;
|
|
19
19
|
}
|
|
20
20
|
export interface ResponseItem<T> {
|