nb-js-client 0.0.32 → 0.0.34
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/package.json +1 -1
- package/dist/api/auth-api.service.d.ts +0 -20
- package/dist/api/connections-api.service.d.ts +0 -20
- package/dist/api/discovery-api.service.d.ts +0 -8
- package/dist/api/divide-api.service.d.ts +0 -19
- package/dist/api/extensions-api.service.d.ts +0 -33
- package/dist/api/extensions-external-api.service.d.ts +0 -14
- package/dist/api/fca-api.service.d.ts +0 -21
- package/dist/api/gateway-api.service.d.ts +0 -25
- package/dist/api/group-api.service.d.ts +0 -20
- package/dist/api/index.d.ts +0 -22
- package/dist/api/license-api.service.d.ts +0 -13
- package/dist/api/links-api.service.d.ts +0 -18
- package/dist/api/logstash-api.service.d.ts +0 -15
- package/dist/api/notification-api.service.d.ts +0 -25
- package/dist/api/notifications-api.service.d.ts +0 -17
- package/dist/api/role-api.service.d.ts +0 -20
- package/dist/api/share-api.service.d.ts +0 -15
- package/dist/api/storage-element-api.service.d.ts +0 -56
- package/dist/api/storage-files-api.service.d.ts +0 -23
- package/dist/api/storage-instance-api.service.d.ts +0 -7
- package/dist/api/storage-share-api.service.d.ts +0 -11
- package/dist/api/storage-trash-api.service.d.ts +0 -11
- package/dist/api/user-api.service.d.ts +0 -57
- package/dist/api/version-api.service.d.ts +0 -19
- package/dist/bundle.cjs.js +0 -1
- package/dist/bundle.esm.js +0 -1
- package/dist/classes/client.d.ts +0 -41
- package/dist/classes/http-error-response.d.ts +0 -17
- package/dist/classes/http-event.d.ts +0 -24
- package/dist/classes/http-response.d.ts +0 -14
- package/dist/classes/index.d.ts +0 -3
- package/dist/classes/rest.d.ts +0 -24
- package/dist/classes/token-update.d.ts +0 -10
- package/dist/classes/tokenUpdate.d.ts +0 -12
- package/dist/helpers/index.d.ts +0 -1
- package/dist/helpers/send-request.d.ts +0 -10
- package/dist/index.d.ts +0 -1300
- package/dist/tools/apply-interceptors.d.ts +0 -4
- package/dist/tools/get-cookie-value.d.ts +0 -1
- package/dist/tools/index.d.ts +0 -4
- package/dist/tools/make-url-params.d.ts +0 -1
- package/dist/tools/normalize-headers.d.ts +0 -1
- package/dist/types/access-rights.d.ts +0 -36
- package/dist/types/access-token.d.ts +0 -15
- package/dist/types/auth.d.ts +0 -9
- package/dist/types/base.d.ts +0 -48
- package/dist/types/connection.d.ts +0 -36
- package/dist/types/discovery.d.ts +0 -15
- package/dist/types/divide.d.ts +0 -82
- package/dist/types/extension.d.ts +0 -80
- package/dist/types/group.d.ts +0 -23
- package/dist/types/index.d.ts +0 -19
- package/dist/types/interceptor.d.ts +0 -4
- package/dist/types/license.d.ts +0 -23
- package/dist/types/lock-screen.d.ts +0 -4
- package/dist/types/notification.d.ts +0 -90
- package/dist/types/permission.d.ts +0 -10
- package/dist/types/query-init.d.ts +0 -23
- package/dist/types/request.d.ts +0 -44
- package/dist/types/restriction.d.ts +0 -9
- package/dist/types/role.d.ts +0 -17
- package/dist/types/setting.d.ts +0 -58
- package/dist/types/storage-trash.d.ts +0 -25
- package/dist/types/storage.d.ts +0 -107
- package/dist/types/user-log.d.ts +0 -9
- package/dist/types/user.d.ts +0 -74
package/dist/bundle.esm.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,m,k,w,b,O,x,N,A,C,T,J,D,U,E,P;!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"}($||($={})),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"}(S||(S={})),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"}(y||(y={})),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"}(m||(m={})),function(e){e.Read="read",e.Unread="unread",e.Delete="delete"}(k||(k={})),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"}(b||(b={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH",e.DELETE="DELETE"}(O||(O={})),function(e){e.Body="body",e.Response="response"}(x||(x={})),function(e){e.NONE="none",e.SOFT="soft",e.HARD="hard"}(N||(N={})),function(e){e.Native="native",e.Ldap="ldap",e.Vk="vk"}(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"}(T||(T={})),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"}(J||(J={})),function(e){e.Dir="dir",e.File="file",e.WorkDir="work_dir"}(D||(D={})),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"}(P||(P={}));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)}}const W="/divide",q=`${W}/restrictions`;class F{constructor(e){this.client=e}divideDelete(e,t){return this.client.rest.delete(`${e}/${W}/${t}`)}divideDeleteAll(e,t,s,i){return this.client.rest.delete(`${e}/${W}`,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}/${W}`,JSON.stringify(r))}divideUsers(e,t,s){return this.client.rest.get(`${e}/${W}/users`,Object.assign(Object.assign({},this.makeParam(e,t)),s))}getRestriction(e){return this.client.rest.get(`${q}/${e}`)}restrictionSize(e,t){return this.client.rest.get(`/${t}/restrictions/${e}/size`)}restrictions(e){return this.client.rest.get(`${q}`,e)}restrictionsChange(e,t){return this.client.rest.put(`${q}/${e}`,JSON.stringify(t))}makeParam(e,t){const s={};return e===u.Connection?s.connection_id=t:s.path=t,s}}function H(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 B extends Error{}function G(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 M(e,t){if("string"!=typeof e)throw new B("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 B(`Invalid token specified: missing part #${s+1}`);let n;try{n=G(i)}catch(e){throw new B(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(n)}catch(e){throw new B(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}B.prototype.name="InvalidTokenError";const V=(e,t)=>H(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 z(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 X=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 Y(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}const K="/api/v1",Q="/api/v2",Z=`${window.location.protocol}//${window.location.host}`;class ee{constructor(e,t){this.client=e,this.tokenUpdate=t}get state(){return this.client.state}get(e,t,s){return this.request(O.GET,e,Object.assign({params:t,cache:"no-cache"},s))}post(e,t,s){return this.request(O.POST,e,Object.assign({body:t},s))}put(e,t,s){return this.request(O.PUT,e,Object.assign({body:t,cache:"no-cache"},s))}patch(e,t,s){return this.request(O.PATCH,e,Object.assign({body:t},s))}delete(e,t,s){return this.request(O.DELETE,e,Object.assign({params:t},s))}upload(e,t,s){const i=new AbortController,n=i.signal;return{promise:this.request(O.POST,e,Object.assign({body:t,signal:n},s)),abort:()=>i.abort()}}request(e,t,s){return H(this,void 0,void 0,(function*(){return new Promise(((i,n)=>H(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((null==s?void 0:s.signal)&&(a.signal=s.signal),c||(s=yield V(this.client.requestInterceptors,a)),this.state.authToken)for(const[e,i]of this.state.authToken.entries()){const n=M(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 V(this.client.requestInterceptors,a))}}const l=new XMLHttpRequest;(null==s?void 0:s.params)&&0!==Object.keys(s.params).length&&(t+="?"+X(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=Y(s.headers);for(const[t,s]of Object.entries(e))(this.state.clientParams.host===Z||"content-type"!==t.toLowerCase())&&l.setRequestHeader(t,s)}(null==s?void 0:s.responseType)&&(l.responseType=s.responseType),(null==s?void 0:s.signal)&&s.signal.addEventListener("abort",(()=>{l.abort(),n(new Error("Upload aborted"))})),l.upload&&[O.POST,O.PUT,O.PATCH].includes(e)&&(l.upload.onprogress=e=>{e.lengthComputable&&(null==s?void 0:s.onUploadProgress)&&s.onUploadProgress(e)}),l.onload=()=>H(this,void 0,void 0,(function*(){if((null==s?void 0:s.signal)&&s.signal.aborted)return;let e;switch(null==s?void 0:s.responseType){case b.Text:e=l.responseText;break;case b.Blob:case b.ArrayBuffer:e=l.response;break;default:try{e=JSON.parse(l.responseText)}catch(t){e=l.responseText}}const t=new Headers;l.getAllResponseHeaders().split("\r\n").forEach((e=>{const[s,i]=e.split(": ");s&&i&&t.append(s,i)}));let r={status:l.status,statusText:l.statusText,headers:t,url:l.responseURL};l.status>=200&&l.status<300?(null==s?void 0:s.observe)===x.Response?i(Object.assign(Object.assign({},r),{body:e})):i(e):n(Object.assign(Object.assign({},r),{error:e})),r=yield V(this.client.responseInterceptors,r)})),l.onerror=()=>{n({status:l.status,statusText:l.statusText,url:l.responseURL,error:"Network error"})},l.send(null!==(o=null==s?void 0:s.body)&&void 0!==o?o:null)}))))}))}changeBaseUrlVersion(e,t){return H(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 H(this,void 0,void 0,(function*(){this.state.clientParams.host=e,this.state.requestParams.headers={};try{return yield t()}finally{this.state.clientParams.host=Z}}))}}class te{constructor(e){this.authApiService=e,this.isUpdating=!1,this.tokenUpdateResolve=null}isTokenExpire(e){if(!e)return!1;return 1e3*e<=(new Date).getTime()+3e3}refreshToken(e){return H(this,void 0,void 0,(function*(){const{access_token:t,refresh_token:s}=e;return t&&s?this.isUpdating?this.waitForTokenUpdate():(this.isUpdating=!0,new Promise(((e,i)=>{const n=new XMLHttpRequest,r=`${Z}${K}/login/update`;n.open("POST",r,!0),n.setRequestHeader("Content-Type","application/json"),n.send(JSON.stringify({access_token:t,refresh_token:s})),n.onload=()=>{if(n.status>=200&&n.status<300)try{const t=JSON.parse(n.responseText);if(t&&t.access_token&&t.refresh_token){const s={access_token:t.access_token,refresh_token:t.refresh_token};z("access_token")===s.access_token&&localStorage.setItem("refresh-token",s.refresh_token),this.tokenUpdateResolve&&(this.tokenUpdateResolve(s),this.tokenUpdateResolve=null),e(s)}else e(null)}catch(e){i(new Error("Failed to parse response JSON."))}else i(new Error(`Request failed with status: ${n.status}`))},n.onerror=()=>{i(new Error("Network error occurred"))},n.onloadend=()=>{this.isUpdating=!1}}))):null}))}waitForTokenUpdate(){return H(this,void 0,void 0,(function*(){return new Promise((e=>{const t=setInterval((()=>{this.isUpdating||(clearInterval(t),e())}),100)}))}))}}class se{constructor(e){this.AuthApiService=new i(this),this.ConnectionsApiService=new L(this),this.DiscoveryApiService=new j(this),this.DivideApiService=new F(this),this.ExtensionsApiService=new re(this),this.ExtensionsExternalApiService=new ce(this),this.FcaApiService=new de(this),this.GatewayApiService=new ue(this),this.GroupApiService=new ge(this),this.LicenseApiService=new $e(this),this.LinksApiService=new ye(this),this.LogstashApiService=new ke(this),this.NotificationApiService=new Ne(this),this.RoleApiService=new Je(this),this.ShareApiService=new Ee(this),this.StorageElementApiService=new qe(this,this.FcaApiService),this.StorageFilesApiService=new Be(this),this.StorageInstanceApiService=new Ge(this),this.StorageShareApiService=new Ve(this),this.StorageTrashApiService=new Ke(this),this.UserApiService=new nt(this),this.VersionApiService=new dt(this),this.tokenUpdate=new te(this.AuthApiService),this.rest=new ee(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 ie="/static/extensions",ne="/extensions/defaults";class re{constructor(e){this.client=e}getSetting(e){return this.client.rest.get(`${ie}/${e}/settings`)}setSetting(e,t){return this.client.rest.post(`${ie}/${e}/settings`,JSON.stringify(t))}deleteSetting(e){return this.client.rest.delete(`${ie}/${e}/settings`)}get(e){return this.client.rest.get(`${ie}/${e}`)}getByKey(e){return this.client.rest.get(`${ie}/${e}`)}getDefault(e=[]){return this.client.rest.get(ne,{ext_code:e})}setDefault(e,t){return this.client.rest.post(ne,JSON.stringify({ext_code:e,ext_uniq_key:t}))}checkUpdates(){return this.client.rest.post(`${ie}/check_updates`)}updateVersion(e,t){return this.client.rest.put(`${ie}/${e}`,JSON.stringify({version:t}))}list(e){return this.client.rest.get(ie,e)}delete(e,t){return this.client.rest.delete(`${ie}/${e}`)}upload(e,t){const s=new FormData;s.set("file",t);const{promise:i,abort:n}=this.client.rest.upload(ie,s,{onUploadProgress:t=>{e(t)}});return{promise:this.client.rest.changeBaseUrlVersion(Q,(()=>i)),abort:n}}install(e,t){return this.client.rest.changeBaseUrlVersion(Q,(()=>this.client.rest.post(`${ie}/site`,JSON.stringify({uniq_key:e,version:t}))))}}const oe="/anons_ext/extensions";class ce{constructor(e){this.client=e}listExtensionsSite(e){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(oe,e)))}extensionDetailSite(e){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(`${oe}/${e}`)))}extensionMarkdown(e,t){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(`${oe}/${e}/readme`,{},t)))}}const ae="/disk",le=`${ae}/check`;class de{constructor(e){this.client=e}info(e,t){return this.client.rest.get(`${ae}/${e}/element`,{path:t})}list(e,t){return this.client.rest.get(`${ae}/${e}`,t)}create(e,t){return this.client.rest.post(`${ae}/${e}/element`,JSON.stringify(t))}replace(e,t,s){return this.client.rest.put(`${ae}/${e}/files?path=${t}`,s)}read(e,t){return this.client.rest.get(`${ae}/${e}/files?path=${t}`)}upload(e,t,s,i=""){const n=new FormData;n.set("path",i),n.set("file",s);const{promise:r,abort:o}=this.client.rest.upload(`${ae}/${t}/files`,n,{onUploadProgress:t=>{e(t)}});return{promise:r,abort:o}}uploadNet(e,t){return this.client.rest.post(`${ae}/${e}/files/net`,JSON.stringify(t))}delete(e,t){return this.client.rest.delete(`${ae}/${e}/trash/element`,{path:t})}check(e){return this.client.rest.post(le,JSON.stringify(e))}}const he="/settings";class ue{constructor(e){this.client=e}settings(){return this.client.rest.get(he)}changeSettings(e){return this.client.rest.post(he,JSON.stringify(e))}queryInit(){return this.client.rest.get("/query/init")}}const pe="/groups";class ge{constructor(e){this.client=e}list(e){return this.client.rest.get(pe,e)}listUsers(e){return this.client.rest.get(`${pe}/${e}/users`)}create(e){return this.client.rest.post(pe,JSON.stringify(e))}update(e,t){return this.client.rest.put(`${pe}/${e}`,JSON.stringify(t))}delete(e){return this.client.rest.delete(`${pe}/${e}`)}}const fe="/license",_e=`${fe}/manual-check`,ve=`${fe}/hardware/hash`;class $e{constructor(e){this.client=e}info(){return this.client.rest.get(fe)}create(e){return this.client.rest.post(fe,JSON.stringify(e))}check(){return this.client.rest.post(_e)}delete(){return this.client.rest.delete(fe)}getHash(){return this.client.rest.get(ve)}}const Se="/links";class ye{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post(Se,JSON.stringify(e))}updateShortLink(e){return this.client.rest.put(Se,JSON.stringify(e))}}const me="/logs";class ke{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get(`${me}/users`,e)}getSystemLogs(e,t,s){return this.client.rest.get(`${me}/${e}`,{},{observe:x.Response,responseType:b.Text,headers:{Range:`bytes=${t}-${s}`}})}}const we="/notifications",be=`${we}/all`,Oe=`${we}/subscription`,xe=`${we}/permission`;class Ne{constructor(e){this.client=e}list(e){return this.client.rest.get(we,e)}toggleStatus(e,t){return this.client.rest.put(we,JSON.stringify({ids:e,to_status:t}))}toggleAllStatus(e){return this.client.rest.put(be,JSON.stringify({to_status:e}))}delete(e){return this.client.rest.delete(we,{id:e})}deleteAll(){return this.client.rest.delete(be)}getPermission(){return this.client.rest.get(xe)}setPermission(e){return this.client.rest.post(xe,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 Ae="/roles",Ce=`${Ae}/default`,Te="/permissions";class Je{constructor(e){this.client=e}list(e){return this.client.rest.get(Ae,e)}get(e){return this.client.rest.get(`${Ae}/${e}`)}getDefault(){return this.client.rest.get(`${Ce}`)}create(e){return this.client.rest.post(Ae,JSON.stringify(e))}update(e,t){return this.client.rest.put(`${Ae}/${e}`,JSON.stringify(t))}delete(e){return this.client.rest.delete(`${Ae}/${e}`)}permissionList(){return this.client.rest.get(Te)}addPermission(e,t){return this.client.rest.put(`${Ae}/${e}/permissions`,JSON.stringify({ids:t}))}deletePermission(e,t){return this.client.rest.delete(`${Ae}/${e}/${Te}`,{ids:t})}}const De="/share",Ue=`${De}/restrictions`;class Ee{constructor(e){this.client=e}info(e,t){const s=new URLSearchParams({path:e,share_token:t});return this.client.rest.get(`${De}?${s.toString()}`)}checkPassword(e,t){const s=encodeURIComponent(e);return this.client.rest.get(`${De}/password?share_token=${t}&share_pass=${s}`)}checkToken(e){return this.client.rest.get(`${De}?share_token=${e}`)}getRestriction(e){return this.client.rest.get(`${Ue}/${e}`)}restrictions(e){return this.client.rest.get(Ue,e)}restrictionsChange(e,t){return this.client.rest.put(`${Ue}/${e}`,JSON.stringify(t))}}const Pe="/storage",Re=`${Pe}/element`,Ie=`${Re}/move`,Le=`${Re}/copy`,je=`${Re}/content_type_size`,We="/disk";class qe{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(Re,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(`${Re}/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(`${We}/${i}/files/move${We}/${n}`,JSON.stringify(r)):t===E.fca?(i&&(r.from_divide_id=i),this.client.rest.put(`${We}/${n}/files/from/box`,JSON.stringify(r))):s===E.fca?(n&&(r.to_divide_id=n),this.client.rest.put(`${We}/${i}/files/to/box`,JSON.stringify(r))):this.client.rest.post(Ie,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(`${We}/${i}/files/copy${We}/${n}`,JSON.stringify(r)):s===E.fca?(i&&(r.from_divide_id=i),this.client.rest.post(`${We}/${n}/files/from/box`,JSON.stringify(r))):t===E.fca?(n&&(r.to_divide_id=n),this.client.rest.post(`${We}/${i}/files/to/box`,JSON.stringify(r))):this.client.rest.post(Le,JSON.stringify(e))}pasteFromShared(e,t,s){const i={from_sharing_token:e,from_sharing_password:s,paths:t};return this.client.rest.post(`${Re}/copy`,JSON.stringify(i))}create(e){return this.client.rest.post(Re,JSON.stringify(e))}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(Re,s)}favorite(e){return this.client.rest.put(`${Re}?path=${encodeURIComponent(e)}`,JSON.stringify({is_favorite:!0}))}removeFavorite(e){return this.client.rest.put(`${Re}?path=${encodeURIComponent(e)}`,JSON.stringify({is_favorite:!1}))}createItem(e){return this.client.rest.post(Re,JSON.stringify(e))}createWorkDir(e){return this.client.rest.post(Re,JSON.stringify(e))}sizeWithSection(e){return this.client.rest.get(je,e)}}const Fe="/storage/files",He=`${Fe}/net`;class Be{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 n=new FormData;n.set("path",s),i&&n.set("divide_id",i.toString()),n.set("file",t);const{promise:r,abort:o}=this.client.rest.upload(Fe,n,{onUploadProgress:t=>{e(t)}});return{promise:r,abort:o}}uploadNet(e){return this.client.rest.post(He,JSON.stringify(e))}}class Ge{constructor(e){this.client=e}instance(){return this.client.rest.get("/storage/instance")}}const Me="/storage/element/share";class Ve{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 ze="/storage/trash",Xe=`${ze}/element`,Ye=`${Xe}/all`;class Ke{constructor(e){this.client=e}list(e){return this.client.rest.get(ze,e)}clear(e){return this.client.rest.delete(Xe,e)}clearAll(){return this.client.rest.delete(Ye)}restore(e){return this.client.rest.patch(Xe,JSON.stringify({del_groups:e}))}}const Qe="/users",Ze=`${Qe}/me`,et=`${Ze}/avatars`,tt=`${Ze}/sessions`,st=`${Ze}/tokens`,it=`${Ze}/change-password`;class nt{constructor(e){this.client=e}list(e){return this.client.rest.get(Qe,e)}get(e){return this.client.rest.get(Qe+`/${e}`)}create(e){return this.client.rest.post(Qe,JSON.stringify(e))}update(e,t){return this.client.rest.put(Qe+`/${e}`,JSON.stringify(t))}delete(e,t){return this.client.rest.delete(`${Qe}/${e}`,t)}restore(e){return this.client.rest.post(`${Qe}/${e}/restore`)}me(){return this.client.rest.get(Ze)}updateMe(e){return this.client.rest.put(Ze,JSON.stringify(e))}createToken(e){return this.client.rest.post(st,JSON.stringify(e))}listToken(e){return this.client.rest.get(st,e)}deleteToken(e){return this.client.rest.delete(`${st}/${e}`)}changeMyPassword(e){return this.client.rest.put(it,JSON.stringify(e))}changeUsersPassword(e,t){return this.client.rest.put(`${Qe}/${e}/change-password`,JSON.stringify(t))}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(et,s)}meDeleteAvatar(){return this.client.rest.delete(et)}meListSession(e){return this.client.rest.get(tt,e)}meDeleteSession(e){let t=tt;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${Qe}/${e}/roles`,JSON.stringify({role_id:t}))}}const rt="/storage/element",ot=`${rt}/history`,ct=`${rt}/version`,at=`${ct}/current`,lt=`${ct}/size`;class dt{constructor(e){this.client=e}history(e){return this.client.rest.get(ot,e)}versions(e){return this.client.rest.get(ct,e)}create(e){return this.client.rest.post(ct,JSON.stringify(e))}edit(e){return this.client.rest.put(ct,JSON.stringify(e))}delete(e){return this.client.rest.delete(ct,e)}size(e){return this.client.rest.get(lt,e)}makeCurrent(e){return this.client.rest.post(at,JSON.stringify(e))}}export{n as AccessRights,i as AuthApiService,K as BASE_URL_V1,Q as BASE_URL_V2,r as CONNECTIONS_PERMISSION,se as Client,a as ConnectionGroup,l as ConnectionType,L as ConnectionsApiService,j as DiscoveryApiService,F as DivideApiService,_ as DivideMode,u as DivideScope,c as EngineType,h as ExtensionFileMode,d as ExtensionType,re as ExtensionsApiService,ce as ExtensionsExternalApiService,de as FcaApiService,ue as GatewayApiService,ge as GroupApiService,Z as HOST,$e as LicenseApiService,S as LicenseError,ye as LinksApiService,ke as LogstashApiService,m as NotificationAction,Ne as NotificationApiService,y as NotificationEntityType,k as NotificationRowAction,w as NotificationStyle,o as OrderDirection,p as PermissionType,O as RequestMethod,x as RequestObserve,b as ResponseType,ee as Rest,f as RestrictionBooleanStatus,v as RestrictionModeKey,N as RestrictionSharing,g as RestrictionStatus,Je as RoleApiService,J as SettingControlType,Ee as ShareApiService,qe as StorageElementApiService,U as StorageElementContentType,P as StorageElementHistoryAction,D as StorageElementType,Be as StorageFilesApiService,Ge as StorageInstanceApiService,E as StorageRoot,Ve as StorageShareApiService,Ke as StorageTrashApiService,$ as Tariff,te as TokenUpdate,nt as UserApiService,A as UserAuthType,C as UserStatus,T as UserType,dt as VersionApiService,V as applyInterceptors,z as getCookieValue,X as makeUrlParams,Y as normalizeHeaders};
|
package/dist/classes/client.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { AuthApiService, ConnectionsApiService, DiscoveryApiService, DivideApiService, ExtensionsApiService, ExtensionsExternalApiService, FcaApiService, GatewayApiService, GroupApiService, LicenseApiService, LinksApiService, LogstashApiService, NotificationApiService, RoleApiService, ShareApiService, StorageElementApiService, StorageFilesApiService, StorageInstanceApiService, StorageShareApiService, StorageTrashApiService, UserApiService, VersionApiService } from '../api';
|
|
2
|
-
import { NbAppState, NbClientParams } from '../types/base';
|
|
3
|
-
import { Interceptor } from '../types/interceptor';
|
|
4
|
-
import { Rest } from './rest';
|
|
5
|
-
import { TokenUpdate } from './token-update';
|
|
6
|
-
export declare class Client {
|
|
7
|
-
state: NbAppState;
|
|
8
|
-
AuthApiService: AuthApiService;
|
|
9
|
-
ConnectionsApiService: ConnectionsApiService;
|
|
10
|
-
DiscoveryApiService: DiscoveryApiService;
|
|
11
|
-
DivideApiService: DivideApiService;
|
|
12
|
-
ExtensionsApiService: ExtensionsApiService;
|
|
13
|
-
ExtensionsExternalApiService: ExtensionsExternalApiService;
|
|
14
|
-
FcaApiService: FcaApiService;
|
|
15
|
-
GatewayApiService: GatewayApiService;
|
|
16
|
-
GroupApiService: GroupApiService;
|
|
17
|
-
LicenseApiService: LicenseApiService;
|
|
18
|
-
LinksApiService: LinksApiService;
|
|
19
|
-
LogstashApiService: LogstashApiService;
|
|
20
|
-
NotificationApiService: NotificationApiService;
|
|
21
|
-
RoleApiService: RoleApiService;
|
|
22
|
-
ShareApiService: ShareApiService;
|
|
23
|
-
StorageElementApiService: StorageElementApiService;
|
|
24
|
-
StorageFilesApiService: StorageFilesApiService;
|
|
25
|
-
StorageInstanceApiService: StorageInstanceApiService;
|
|
26
|
-
StorageShareApiService: StorageShareApiService;
|
|
27
|
-
StorageTrashApiService: StorageTrashApiService;
|
|
28
|
-
UserApiService: UserApiService;
|
|
29
|
-
VersionApiService: VersionApiService;
|
|
30
|
-
tokenUpdate: TokenUpdate;
|
|
31
|
-
rest: Rest;
|
|
32
|
-
requestInterceptors: Interceptor<RequestInit>[];
|
|
33
|
-
responseInterceptors: Interceptor<any>[];
|
|
34
|
-
constructor(clientParams: NbClientParams);
|
|
35
|
-
request: {
|
|
36
|
-
use: (fulfilled: (config: RequestInit) => RequestInit | Promise<RequestInit>, rejected: (error: any) => any) => void;
|
|
37
|
-
};
|
|
38
|
-
response: {
|
|
39
|
-
use: (fulfilled: (response: any) => any | Promise<any>, rejected: (error: any) => any) => void;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare class HttpErrorResponse implements Error {
|
|
2
|
-
readonly name: string;
|
|
3
|
-
readonly message: string;
|
|
4
|
-
readonly error: any | null;
|
|
5
|
-
readonly status: number;
|
|
6
|
-
readonly statusText: string;
|
|
7
|
-
readonly headers: Headers | undefined;
|
|
8
|
-
readonly url: string | undefined;
|
|
9
|
-
readonly ok: boolean;
|
|
10
|
-
constructor(init: {
|
|
11
|
-
error?: any;
|
|
12
|
-
status?: number;
|
|
13
|
-
statusText?: string;
|
|
14
|
-
headers?: Headers;
|
|
15
|
-
url?: string;
|
|
16
|
-
});
|
|
17
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export declare enum HttpEventType {
|
|
2
|
-
Sent = 0,
|
|
3
|
-
UploadProgress = 1,
|
|
4
|
-
ResponseHeader = 2,
|
|
5
|
-
DownloadProgress = 3,
|
|
6
|
-
Response = 4,
|
|
7
|
-
User = 5
|
|
8
|
-
}
|
|
9
|
-
export declare type HttpEvent<T> = HttpResponse<T> | HttpProgressEvent;
|
|
10
|
-
export declare class HttpResponse<T> {
|
|
11
|
-
body: T | null;
|
|
12
|
-
status: number;
|
|
13
|
-
statusText: string;
|
|
14
|
-
headers: Headers;
|
|
15
|
-
url?: string | undefined;
|
|
16
|
-
readonly type: HttpEventType;
|
|
17
|
-
constructor(body: T | null, status: number, statusText: string, headers: Headers, url?: string | undefined);
|
|
18
|
-
}
|
|
19
|
-
export declare class HttpProgressEvent {
|
|
20
|
-
progress: number;
|
|
21
|
-
headers: Headers;
|
|
22
|
-
readonly type: HttpEventType;
|
|
23
|
-
constructor(progress: number, headers: Headers, isUpload?: boolean);
|
|
24
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare class HttpResponse<T> {
|
|
2
|
-
body: T | null;
|
|
3
|
-
status: number;
|
|
4
|
-
statusText: string;
|
|
5
|
-
headers: Headers;
|
|
6
|
-
url: string;
|
|
7
|
-
constructor(init: {
|
|
8
|
-
body?: T | null;
|
|
9
|
-
status: number;
|
|
10
|
-
statusText: string;
|
|
11
|
-
headers: Headers;
|
|
12
|
-
url: string;
|
|
13
|
-
});
|
|
14
|
-
}
|
package/dist/classes/index.d.ts
DELETED
package/dist/classes/rest.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Client } from './client';
|
|
2
|
-
import { NbAppState, RequestMethod, HttpResponse, RequestConfig, HttpEvent } from '../types';
|
|
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;
|
|
7
|
-
export declare class Rest {
|
|
8
|
-
private client;
|
|
9
|
-
private tokenUpdate;
|
|
10
|
-
constructor(client: Client, tokenUpdate: TokenUpdate);
|
|
11
|
-
get state(): NbAppState;
|
|
12
|
-
get(path: string, params?: Record<string, any>, config?: RequestConfig): Promise<any>;
|
|
13
|
-
post(path: string, body?: BodyInit | null, config?: RequestConfig): Promise<any>;
|
|
14
|
-
put(path: string, body?: BodyInit | null, config?: RequestConfig): Promise<any>;
|
|
15
|
-
patch(path: string, body?: BodyInit | null, config?: RequestConfig): Promise<any>;
|
|
16
|
-
delete(path: string, params?: Record<string, any>, config?: RequestConfig): Promise<any>;
|
|
17
|
-
upload(path: string, body?: BodyInit | null, config?: RequestConfig): {
|
|
18
|
-
promise: Promise<any>;
|
|
19
|
-
abort: () => void;
|
|
20
|
-
};
|
|
21
|
-
request<T>(method: RequestMethod, path: string, config?: RequestConfig): Promise<T | HttpResponse<T> | HttpEvent<T>>;
|
|
22
|
-
changeBaseUrlVersion<T>(baseUrl: string, handler: () => Promise<T>): Promise<T>;
|
|
23
|
-
changeHost<T>(host: string, handler: () => Promise<T>): Promise<T>;
|
|
24
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { AuthApiService, RequestAuthTokenParams } from '../api';
|
|
2
|
-
export declare class TokenUpdate {
|
|
3
|
-
private authApiService;
|
|
4
|
-
isUpdating: boolean;
|
|
5
|
-
private tokenUpdateResolve;
|
|
6
|
-
constructor(authApiService: AuthApiService);
|
|
7
|
-
isTokenExpire(timestamp: number): boolean;
|
|
8
|
-
refreshToken(params: RequestAuthTokenParams): Promise<any>;
|
|
9
|
-
waitForTokenUpdate(): Promise<void>;
|
|
10
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { AuthApiService } from '../api';
|
|
2
|
-
import { AuthToken } from '../types';
|
|
3
|
-
export declare class TokenUpdate {
|
|
4
|
-
private authApiService;
|
|
5
|
-
private isUpdating;
|
|
6
|
-
private tokenUpdatePromise;
|
|
7
|
-
private tokenUpdateResolve;
|
|
8
|
-
constructor(authApiService: AuthApiService);
|
|
9
|
-
isTokenExpire(timestamp: number): boolean;
|
|
10
|
-
refreshToken(authToken: AuthToken): Promise<AuthToken | null>;
|
|
11
|
-
private waitForTokenUpdate;
|
|
12
|
-
}
|
package/dist/helpers/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './send-request';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { NbAppState } from '../types/base';
|
|
2
|
-
import { Interceptor } from '../types/interceptor';
|
|
3
|
-
export declare function sendRequest(method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE', path: string, options: {
|
|
4
|
-
query?: Record<string, any>;
|
|
5
|
-
body?: BodyInit | null;
|
|
6
|
-
cache?: RequestCache;
|
|
7
|
-
}, state: NbAppState, interceptors: {
|
|
8
|
-
request: Interceptor<RequestInit>[];
|
|
9
|
-
response: Interceptor<Response>[];
|
|
10
|
-
}): Promise<Response>;
|