nb-js-client 0.0.49 → 0.0.51
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/api/logstash-api.service.d.ts +1 -2
- package/dist/api/storage-element-api.service.d.ts +1 -0
- package/dist/api/storage-trash-api.service.d.ts +2 -3
- package/dist/bundle.cjs.js +1 -1
- package/dist/bundle.esm.js +1 -1
- package/dist/index.d.ts +6 -25
- package/dist/types/access-rights.d.ts +0 -1
- package/dist/types/storage-trash.d.ts +3 -23
- package/dist/types/storage.d.ts +2 -1
- package/package.json +1 -1
- package/dist/api/notifications-api.service.d.ts +0 -17
- 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/tokenUpdate.d.ts +0 -12
- package/dist/helpers/index.d.ts +0 -1
- package/dist/helpers/send-request.d.ts +0 -10
- package/dist/types/group.d.ts +0 -23
- package/dist/types/query-init.d.ts +0 -23
- package/dist/types/role.d.ts +0 -17
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Client } from '../classes';
|
|
2
|
-
import {
|
|
2
|
+
import { RequestBaseParams, ResponseList, UsersLog } from '../types';
|
|
3
3
|
export declare class LogstashApiService {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: Client);
|
|
6
6
|
getUsersLogs(params: RequestUsersLogParams): Promise<ResponseList<UsersLog>>;
|
|
7
|
-
getSystemLogs(path: string, start: number, end: number): Promise<HttpResponse<string>>;
|
|
8
7
|
}
|
|
9
8
|
export interface RequestUsersLogParams extends RequestBaseParams {
|
|
10
9
|
user_id?: string;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Client } from '../classes';
|
|
2
|
-
import {
|
|
3
|
-
import { RequestStorageListParams } from './storage-element-api.service';
|
|
2
|
+
import { StorageTrashItem } from '../types';
|
|
4
3
|
export declare class StorageTrashApiService {
|
|
5
4
|
private client;
|
|
6
5
|
constructor(client: Client);
|
|
7
|
-
list(params: RequestStorageListParams): Promise<ResponseList<StorageTrashElement>>;
|
|
8
6
|
clear(item: StorageTrashItem): Promise<void>;
|
|
9
7
|
clearAll(): Promise<void>;
|
|
10
8
|
restore(del_groups: StorageTrashItem[]): Promise<void>;
|
|
9
|
+
restoreAll(): Promise<void>;
|
|
11
10
|
}
|
package/dist/bundle.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e="/login",t=`${e}/ldap`,s=`${e}/update`;class r{constructor(e){this.client=e}info(){return this.client.rest.get(e)}login(t){return this.client.rest.post(e,t)}ldapLogin(e){return this.client.rest.post(t,e)}updateToken(e){const t=e.path?`${e.path}/${s}`:s;return e.path&&delete e.path,this.client.rest.post(t,e)}logout(){return this.client.rest.post("/logout")}}var i;exports.AccessRights=void 0,(i=exports.AccessRights||(exports.AccessRights={})).LicenseRead="license_read",i.LicenseManage="license_edit",i.UsersRead="users_read",i.UsersCreate="users_create",i.UsersActivate="users_activate",i.GroupsRead="groups_read",i.GroupsCreate="groups_create",i.RolesRead="roles_read",i.RolesCreate="roles_create",i.Share="share",i.Divide="divide",i.ExtensionsRead="extensions_read",i.ExtensionsManage="extensions_write",i.RestrictionShareRead="restriction_share_read",i.RestrictionShareWrite="restriction_share_write",i.RestrictionDivideRead="restriction_divide_read",i.RestrictionDivideWrite="restriction_divide_write",i.ReadUserLogs="read_user_logs",i.ReadSystemLogs="read_system_logs",i.ConnectionsRead="connections_read",i.ConnectionsDividing="connections_dividing",i.ConnectionsYandexDisk="connections_yandex_disk",i.ConnectionsSsh="connections_ssh",i.ConnectionsMail="connections_mail",i.ConnectionsS3="connections_s3",i.ConnectionsDiscord="connections_discord",i.ConnectionsWebdav="connections_webdav",i.ConnectionsNextcloud="connections_nextcloud",i.ConnectionsNextbox="connections_nextbox",i.ConnectionsHttpProxy="connections_http_proxy",i.SystemInfoServiceList="system_info_service_list",i.SettingsRead="settings_read",i.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,b,A,R,T,w,C,E,U,D,P,O,L,N,I;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,($=exports.NotificationEntityType||(exports.NotificationEntityType={})).Dir="dir",$.File="file",$.User="user",$.Other="other",$.WorkDir="work_dir",$.License="license",$.Extension="extension",$.Connection="connection",exports.NotificationAction=void 0,(y=exports.NotificationAction||(exports.NotificationAction={})).SecurityCheckNegative="action_security_check_negative",y.SecurityCheckPositive="action_security_check_positive",y.OpenSharing="open_sharing",y.ChangeSharing="change_sharing",y.CancelSharing="cancel_sharing",y.DivideDirAddFileToOwner="divide_dir_add_file_to_owner",y.DivideDirAddDirToOwner="divide_dir_add_dir_to_owner",y.DivideDirAddWorkDirToOwner="divide_dir_add_work_dir_to_owner",y.DivideConnectionAddFileToOwner="divide_connection_add_file_to_owner",y.DivideConnectionAddDirToOwner="divide_connection_add_dir_to_owner",y.CancelDivideDir="cancel_divide_dir",y.CancelDivideFile="cancel_divide_file",y.CancelDivideWorkDir="cancel_divide_work_dir",y.CancelDivideConnection="cancel_divide_connection",y.DeleteExtension="delete_extension",y.NewVersionExtension="new_version_extension",y.TransferData="transfer_data",y.AllowInternalAccessUser="allow_internal_access_to_user",y.BlockInternalAccessUser="block_internal_access_to_user",y.WaitInternalAccessUser="wait_internal_access_to_user",y.WaitInternalAccessUserCreate="wait_internal_access_to_user_create",y.AllowInternalAccessGroup="allow_internal_access_to_group",y.BlockInternalAccessGroup="block_internal_access_to_group",y.WaitInternalAccessGroup="wait_internal_access_to_group",y.WaitInternalAccessGroupCreate="wait_internal_access_to_group_create",y.AllowSharing="allow_sharing",y.BlockSharing="block_sharing",y.WaitSharing="wait_sharing",y.WaitSharingCreate="wait_sharing_create",y.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,(b=exports.ResponseType||(exports.ResponseType={})).ArrayBuffer="arraybuffer",b.Blob="blob",b.Json="json",b.Text="text",exports.RequestMethod=void 0,(A=exports.RequestMethod||(exports.RequestMethod={})).GET="GET",A.POST="POST",A.PUT="PUT",A.PATCH="PATCH",A.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,(w=exports.UserAuthType||(exports.UserAuthType={})).Native="native",w.Ldap="ldap",w.Vk="vk",exports.UserStatus=void 0,(C=exports.UserStatus||(exports.UserStatus={})).Registering="registering",C.Activated="activated",C.Blocked="blocked",C.BlockedByLicense="blocked_by_license",exports.UserType=void 0,(E=exports.UserType||(exports.UserType={})).User="user",E.Guest="guest",E.Emperor="emperor",E.Anonymous="anonymous",exports.UserParamsLabel=void 0,(U=exports.UserParamsLabel||(exports.UserParamsLabel={})).Theme="theme",U.Lang="lang",U.Sort="sort",exports.SettingControlType=void 0,(D=exports.SettingControlType||(exports.SettingControlType={})).Text="text",D.String="string",D.Number="number",D.CheckBox="checkbox",D.Select="select",D.RadioList="radio_list",D.ConnectionChoose="connection_choose",D.MultiConnectionChoose="multi_connection_choose",exports.StorageElementType=void 0,(P=exports.StorageElementType||(exports.StorageElementType={})).Dir="dir",P.File="file",P.WorkDir="work_dir",exports.StorageElementContentType=void 0,(O=exports.StorageElementContentType||(exports.StorageElementContentType={})).Any="any",O.Dir="dir",O.Code="code",O.Image="image",O.Audio="audio",O.Video="video",O.Text="text",O.Doc="doc",O.Xls="xls",O.Ppt="ppt",exports.StorageRoot=void 0,(L=exports.StorageRoot||(exports.StorageRoot={})).my="my",L.fca="fca",L.divide="divide",L.share="share",L.favorite="favorite",exports.StorageElementHistoryAction=void 0,(N=exports.StorageElementHistoryAction||(exports.StorageElementHistoryAction={})).Create="create",N.Update="update",N.Move="move",exports.StorageElementCheckStatus=void 0,(I=exports.StorageElementCheckStatus||(exports.StorageElementCheckStatus={}))[I.CheckNull=0]="CheckNull",I[I.CheckInProgress=1]="CheckInProgress",I[I.CheckPositive=2]="CheckPositive",I[I.CheckNegative=3]="CheckNegative";const q="/connections",j=`${q}/dashboard`;class M{constructor(e){this.client=e}list(e){return this.client.rest.get(q,e)}get(e){return this.client.rest.get(`${q}/${e}`)}update(e,t){return this.client.rest.put(`${q}/${e}`,t)}delete(e){return this.client.rest.delete(`${q}/${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]||q,e)}dashboard(e){return this.client.rest.get(j,e)}}class H{constructor(e){this.client=e}discovery(e){return this.client.rest.get("/discovery",e)}}const B="/divide",F=`${B}/restrictions`;class W{constructor(e){this.client=e}divideDelete(e,t){return this.client.rest.delete(`${e}/${B}/${t}`)}divideDeleteAll(e,t,s,r){return this.client.rest.delete(`${e}/${B}`,Object.assign(Object.assign({},this.makeParam(e,t)),{is_to_user_group:r,access_mode:s}))}divideChange(e,t,s){return this.client.rest.put(`${e}/divide/${t}`,{access_mode:s})}divideCreate(e,t,s,r,i){const n=Object.assign(Object.assign({},this.makeParam(e,t)),{[i]:s,access_mode:r});return this.client.rest.post(`${e}/${B}`,n)}divideUsers(e,t,s){return this.client.rest.get(`${e}/${B}/users`,Object.assign(Object.assign({},this.makeParam(e,t)),s))}getRestriction(e){return this.client.rest.get(`${F}/${e}`)}restrictionSize(e,t){return this.client.rest.get(`/${t}/restrictions/${e}/size`)}restrictions(e){return this.client.rest.get(`${F}`,e)}restrictionsChange(e,t){return this.client.rest.put(`${F}/${e}`,t)}makeParam(e,t){const s={};return e===exports.DivideScope.Connection?s.connection_id=t:s.path=t,s}}function G(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{a(r.next(e))}catch(e){n(e)}}function c(e){try{a(r.throw(e))}catch(e){n(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,c)}a((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class V extends Error{}function z(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 J(e,t){if("string"!=typeof e)throw new V("Invalid token specified: must be a string");t||(t={});const s=!0===t.header?0:1,r=e.split(".")[s];if("string"!=typeof r)throw new V(`Invalid token specified: missing part #${s+1}`);let i;try{i=z(r)}catch(e){throw new V(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new V(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}V.prototype.name="InvalidTokenError";const K=(e,t)=>G(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 X(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 Y=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 Q(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}function Z(e){return e?e instanceof FormData||e instanceof Blob||e instanceof ArrayBuffer||e instanceof URLSearchParams||e instanceof Document||ArrayBuffer.isView(e)?e:"object"==typeof e?JSON.stringify(e):"string"==typeof e?e:null:null}const ee="update black token";class te{constructor(){this.isUpdating=!1,this.tokenUpdateResolve=null}isTokenExpire(e){if(!e)return!1;return 1e3*e<=(new Date).getTime()+3e3}refreshToken(e,t){return G(this,void 0,void 0,(function*(){const{access_token:s,refresh_token:r}=e;return s&&r?this.isUpdating?this.waitForTokenUpdate():(this.isUpdating=!0,new Promise(((e,i)=>{const n=new XMLHttpRequest,o=`${t}${se}/login/update`;n.open("POST",o,!0),n.setRequestHeader("Content-Type","application/json"),n.send(JSON.stringify({access_token:s,refresh_token:r})),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};X("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 e(null)},n.onerror=()=>{i(new Error("Network error occurred"))},n.onloadend=()=>{this.isUpdating=!1}}))):null}))}waitForTokenUpdate(){return G(this,void 0,void 0,(function*(){return new Promise((e=>{const t=setInterval((()=>{this.isUpdating||(clearInterval(t),e())}),100)}))}))}}const se="/api/v1",re="/api/v2";class ie{constructor(e,t){this.client=e,this.tokenUpdate=t,this.baseHost=""}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))}upload(e,t,s){const r=new AbortController,i=r.signal;return{promise:this.request(exports.RequestMethod.POST,e,Object.assign({body:t,signal:i},s)),abort:()=>r.abort()}}request(e,t,s){return G(this,void 0,void 0,(function*(){return new Promise(((r,i)=>G(this,void 0,void 0,(function*(){var n;const o=null!==(n=this.state.skipInterceptors)&&void 0!==n&&n;this.state.skipInterceptors=!1;let c=Object.assign({method:e},s);if((null==s?void 0:s.signal)&&(c.signal=s.signal),o||(s=yield K(this.client.requestInterceptors,c)),this.state.authToken)for(const[e,r]of this.state.authToken.entries()){const i=J(r.access_token);if(i&&i.is_remember&&this.tokenUpdate.isTokenExpire(i.exp)&&!t.includes("/login")&&!t.includes("/assets")){const t=yield this.tokenUpdate.refreshToken(r,this.baseHost);t&&(this.state.authToken.set(e,t),s=yield K(this.client.requestInterceptors,c))}}const a=new XMLHttpRequest;(null==s?void 0:s.params)&&0!==Object.keys(s.params).length&&(t+="?"+Y(s.params));const l=`${this.state.clientParams.host}${this.state.clientParams.version}${t}`;if(a.open(e,l,!0),null==s?void 0:s.headers){const e=Q(s.headers);for(const[t,s]of Object.entries(e))(this.state.clientParams.host===this.baseHost||"content-type"!==t.toLowerCase())&&a.setRequestHeader(t,s)}(null==s?void 0:s.responseType)&&(a.responseType=s.responseType),(null==s?void 0:s.signal)&&s.signal.addEventListener("abort",(()=>{a.abort(),i(new Error("Upload aborted"))})),a.upload&&[exports.RequestMethod.POST,exports.RequestMethod.PUT,exports.RequestMethod.PATCH].includes(e)&&(a.upload.onprogress=e=>{e.lengthComputable&&(null==s?void 0:s.onUploadProgress)&&s.onUploadProgress(e)}),a.onload=()=>G(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 exports.ResponseType.Text:e=a.responseText;break;case exports.ResponseType.Blob:case exports.ResponseType.ArrayBuffer:e=a.response;break;default:try{e=JSON.parse(a.responseText)}catch(t){e=a.responseText}}const t=new Headers;a.getAllResponseHeaders().split("\r\n").forEach((e=>{const[s,r]=e.split(": ");s&&r&&t.append(s,r)}));let n={status:a.status,statusText:a.statusText,headers:t,url:a.responseURL};if(a.status>=200&&a.status<300)(null==s?void 0:s.observe)===exports.RequestObserve.Response?r(Object.assign(Object.assign({},n),{body:e})):r(e);else{if(this.state.authToken&&e.code===ee){const e=yield this.tokenUpdate.refreshToken(this.state.authToken.get(0),this.baseHost);e&&this.state.authToken.set(0,e)}s=yield K(this.client.responseInterceptors,Object.assign(Object.assign({},n),{error:e})),i(Object.assign(Object.assign({},n),{error:e}))}n=yield K(this.client.responseInterceptors,n)})),a.onerror=()=>{i({status:a.status,statusText:a.statusText,url:a.responseURL,error:"Network error"})},a.send(Z(null==s?void 0:s.body))}))))}))}changeBaseUrlVersion(e,t){return G(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 G(this,void 0,void 0,(function*(){this.state.clientParams.host=e,this.state.requestParams.headers={};try{return yield t()}finally{this.state.clientParams.host=this.baseHost}}))}}const ne="/static/extensions",oe="/extensions/defaults";class ce{constructor(e){this.client=e}getSetting(e){return this.client.rest.get(`${ne}/${e}/settings`)}setSetting(e,t){return this.client.rest.post(`${ne}/${e}/settings`,t)}deleteSetting(e){return this.client.rest.delete(`${ne}/${e}/settings`)}get(e){return this.client.rest.get(`${ne}/${e}`)}getByKey(e){return this.client.rest.get(`${ne}/${e}`)}getDefault(e=[]){return this.client.rest.get(oe,{ext_code:e})}setDefault(e,t){return this.client.rest.post(oe,{ext_code:e,ext_uniq_key:t})}checkUpdates(){return this.client.rest.post(`${ne}/check_updates`)}updateVersion(e,t){return this.client.rest.put(`${ne}/${e}`,{version:t})}list(e){return this.client.rest.get(ne,e)}delete(e,t){return this.client.rest.delete(`${ne}/${e}`)}upload(e,t){const s=new FormData;s.set("file",t);const{promise:r,abort:i}=this.client.rest.upload(ne,s,{onUploadProgress:t=>{e(t)}});return{promise:this.client.rest.changeBaseUrlVersion(re,(()=>r)),abort:i}}install(e,t){return this.client.rest.changeBaseUrlVersion(re,(()=>this.client.rest.post(`${ne}/site`,{uniq_key:e,version:t})))}}const ae="/anons_ext/extensions";class le{constructor(e){this.client=e}listExtensionsSite(e){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(ae,e)))}extensionDetailSite(e){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(`${ae}/${e}`)))}extensionMarkdown(e,t){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(`${ae}/${e}/readme`,{},t)))}}const pe="/disk",de=`${pe}/check`;class he{constructor(e){this.client=e}info(e,t){return this.client.rest.get(`${pe}/${e}/element`,{path:t})}list(e,t){return this.client.rest.get(`${pe}/${e}`,t)}create(e,t){return this.client.rest.post(`${pe}/${e}/element`,t)}replace(e,t,s){return this.client.rest.put(`${pe}/${e}/files?path=${t}`,s)}read(e,t){return this.client.rest.get(`${pe}/${e}/files?path=${t}`)}upload(e,t,s,r=""){const i=new FormData;i.set("path",r),i.set("file",s);const{promise:n,abort:o}=this.client.rest.upload(`${pe}/${t}/files`,i,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e,t){return this.client.rest.post(`${pe}/${e}/files/net`,t)}delete(e,t){return this.client.rest.delete(`${pe}/${e}/trash/element`,{path:t})}check(e){return this.client.rest.post(de,e)}}const ue="/settings";class ge{constructor(e){this.client=e}settings(){return this.client.rest.get(ue)}changeSettings(e){return this.client.rest.post(ue,e)}queryInit(){return this.client.rest.get("/query/init")}}const xe="/groups";class ve{constructor(e){this.client=e}list(e){return this.client.rest.get(xe,e)}listUsers(e){return this.client.rest.get(`${xe}/${e}/users`)}create(e){return this.client.rest.post(xe,e)}update(e,t){return this.client.rest.put(`${xe}/${e}`,t)}delete(e){return this.client.rest.delete(`${xe}/${e}`)}}const _e="/license",Se=`${_e}/manual-check`,fe=`${_e}/hardware/hash`;class $e{constructor(e){this.client=e}info(){return this.client.rest.get(_e)}create(e){return this.client.rest.post(_e,e)}check(){return this.client.rest.post(Se)}delete(){return this.client.rest.delete(_e)}getHash(){return this.client.rest.get(fe)}}const ye="/links";class me{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post(ye,e)}updateShortLink(e){return this.client.rest.put(ye,e)}}const ke="/logs";class be{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get(`${ke}/users`,e)}getSystemLogs(e,t,s){return this.client.rest.get(`${ke}/${e}`,{},{observe:exports.RequestObserve.Response,responseType:exports.ResponseType.Text,headers:{Range:`bytes=${t}-${s}`}})}}const Ae="/notifications",Re=`${Ae}/all`,Te=`${Ae}/subscription`,we=`${Ae}/permission`;class Ce{constructor(e){this.client=e}list(e){return this.client.rest.get(Ae,e)}toggleStatus(e,t){return this.client.rest.put(Ae,{ids:e,to_status:t})}toggleAllStatus(e){return this.client.rest.put(Re,{to_status:e})}delete(e){return this.client.rest.delete(Ae,{id:e})}deleteAll(){return this.client.rest.delete(Re)}getPermission(){return this.client.rest.get(we)}setPermission(e){return this.client.rest.post(we,{enabled:e})}getSubscription(){return this.client.rest.get(Te)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(Te,t)}}const Ee="/roles",Ue=`${Ee}/default`,De="/permissions";class Pe{constructor(e){this.client=e}list(e){return this.client.rest.get(Ee,e)}get(e){return this.client.rest.get(`${Ee}/${e}`)}getDefault(){return this.client.rest.get(`${Ue}`)}create(e){return this.client.rest.post(Ee,e)}update(e,t){return this.client.rest.put(`${Ee}/${e}`,t)}delete(e){return this.client.rest.delete(`${Ee}/${e}`)}permissionList(){return this.client.rest.get(De)}addPermission(e,t){return this.client.rest.put(`${Ee}/${e}/permissions`,{ids:t})}deletePermission(e,t){return this.client.rest.delete(`${Ee}/${e}/${De}`,{ids:t})}}const Oe="/share",Le=`${Oe}/restrictions`;class Ne{constructor(e){this.client=e}info(e,t){const s=new URLSearchParams({path:e,share_token:t});return this.client.rest.get(`${Oe}?${s.toString()}`)}checkPassword(e,t){const s=encodeURIComponent(e);return this.client.rest.get(`${Oe}/password?share_token=${t}&share_pass=${s}`)}checkToken(e){return this.client.rest.get(`${Oe}?share_token=${e}`)}getRestriction(e){return this.client.rest.get(`${Le}/${e}`)}restrictions(e){return this.client.rest.get(Le,e)}restrictionsChange(e,t){return this.client.rest.put(`${Le}/${e}`,t)}}const Ie="/storage",qe=`${Ie}/element`,je=`${qe}/move`,Me=`${qe}/copy`,He=`${qe}/content_type_size`,Be="/disk";class Fe{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(Ie,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(qe,e)}combineInfo({root:e,rootId:t,path:s,file_version_id:r}){return e===exports.StorageRoot.fca&&t?this.fcaApiService.info(t,s):this.info({path:s,divide_id:t,file_version_id:r})}size(e){return this.client.rest.post(`${qe}/size`,e)}move(e,t,s){const{from_divide_id:r,to_divide_id:i}=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(`${Be}/${r}/files/move${Be}/${i}`,n):t===exports.StorageRoot.fca?(r&&(n.from_divide_id=r),this.client.rest.put(`${Be}/${i}/files/from/box`,n)):s===exports.StorageRoot.fca?(i&&(n.to_divide_id=i),this.client.rest.put(`${Be}/${r}/files/to/box`,n)):this.client.rest.post(je,e)}copy(e,t,s){const{from_divide_id:r,to_divide_id:i}=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(`${Be}/${r}/files/copy${Be}/${i}`,n):s===exports.StorageRoot.fca?(r&&(n.from_divide_id=r),this.client.rest.post(`${Be}/${i}/files/from/box`,n)):t===exports.StorageRoot.fca?(i&&(n.to_divide_id=i),this.client.rest.post(`${Be}/${r}/files/to/box`,n)):this.client.rest.post(Me,e)}pasteFromShared(e,t,s){const r={from_sharing_token:e,from_sharing_password:s,paths:t};return this.client.rest.post(`${qe}/copy`,r)}create(e){return this.client.rest.post(qe,e)}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(qe,s)}favorite(e){return this.client.rest.put(`${qe}?path=${encodeURIComponent(e)}`,{is_favorite:!0})}removeFavorite(e){return this.client.rest.put(`${qe}?path=${encodeURIComponent(e)}`,{is_favorite:!1})}createItem(e){return this.client.rest.post(qe,e)}createWorkDir(e){return this.client.rest.post(qe,e)}sizeWithSection(e){return this.client.rest.get(He,e)}}const We="/storage/files",Ge=`${We}/net`;class Ve{constructor(e){this.client=e}read(e,t){return t.path=e,this.client.rest.get(We,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(`${We}?${s.toString()}`,t)}upload(e,t,s,r){const i=new FormData;i.set("path",s),r&&i.set("divide_id",r.toString()),i.set("file",t);const{promise:n,abort:o}=this.client.rest.upload(We,i,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e){return this.client.rest.post(Ge,e)}}class ze{constructor(e){this.client=e}instance(){return this.client.rest.get("/storage/instance")}}const Je="/storage/element/share";class Ke{constructor(e){this.client=e}info(e){return this.client.rest.get(Je,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(Je,s)}change(e){return this.client.rest.put(`${Je}/${e.token}`,e)}delete(e){return this.client.rest.delete(Je,{path:e})}refresh(e){return this.client.rest.put(`${Je}/${e}/refresh`)}}const Xe="/storage/trash",Ye=`${Xe}/element`,Qe=`${Ye}/all`;class Ze{constructor(e){this.client=e}list(e){return this.client.rest.get(Xe,e)}clear(e){return this.client.rest.delete(Ye,e)}clearAll(){return this.client.rest.delete(Qe)}restore(e){return this.client.rest.patch(Ye,{del_groups:e})}}const et="/users",tt=`${et}/me`,st=`${tt}/avatars`,rt=`${tt}/sessions`,it=`${tt}/tokens`,nt=`${tt}/params`,ot=`${tt}/change-password`;class ct{constructor(e){this.client=e}list(e){return this.client.rest.get(et,e)}get(e){return this.client.rest.get(et+`/${e}`)}create(e){return this.client.rest.post(et,e)}update(e,t){return this.client.rest.put(et+`/${e}`,t)}delete(e,t){return this.client.rest.delete(`${et}/${e}`,t)}restore(e){return this.client.rest.post(`${et}/${e}/restore`)}me(){return this.client.rest.get(tt)}updateMe(e){return this.client.rest.put(tt,e)}createToken(e){return this.client.rest.post(it,e)}listToken(e){return this.client.rest.get(it,e)}deleteToken(e){return this.client.rest.delete(`${it}/${e}`)}changeMyPassword(e){return this.client.rest.put(ot,e)}changeUsersPassword(e,t){return this.client.rest.put(`${et}/${e}/change-password`,t)}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(st,s)}meDeleteAvatar(){return this.client.rest.delete(st)}meListSession(e){return this.client.rest.get(rt,e)}meDeleteSession(e){let t=rt;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${et}/${e}/roles`,{role_id:t})}meParams(e){return this.client.rest.get(nt,{name:e})}meSetParams(e,t){return this.client.rest.post(`${nt}/${e}`,t)}meListParams(){return this.client.rest.get(nt)}}const at="/storage/element",lt=`${at}/history`,pt=`${at}/version`,dt=`${pt}/current`,ht=`${pt}/size`;class ut{constructor(e){this.client=e}history(e){return this.client.rest.get(lt,e)}versions(e){return this.client.rest.get(pt,e)}create(e){return this.client.rest.post(pt,e)}edit(e){return this.client.rest.put(pt,e)}delete(e){return this.client.rest.delete(pt,e)}size(e){return this.client.rest.get(ht,e)}makeCurrent(e){return this.client.rest.post(dt,e)}}exports.AuthApiService=r,exports.BASE_URL_V1=se,exports.BASE_URL_V2=re,exports.CONNECTIONS_PERMISSION=n,exports.Client=class{constructor(e){this.AuthApiService=new r(this),this.ConnectionsApiService=new M(this),this.DiscoveryApiService=new H(this),this.DivideApiService=new W(this),this.ExtensionsApiService=new ce(this),this.ExtensionsExternalApiService=new le(this),this.FcaApiService=new he(this),this.GatewayApiService=new ge(this),this.GroupApiService=new ve(this),this.LicenseApiService=new $e(this),this.LinksApiService=new me(this),this.LogstashApiService=new be(this),this.NotificationApiService=new Ce(this),this.RoleApiService=new Pe(this),this.ShareApiService=new Ne(this),this.StorageElementApiService=new Fe(this,this.FcaApiService),this.StorageFilesApiService=new Ve(this),this.StorageInstanceApiService=new ze(this),this.StorageShareApiService=new Ke(this),this.StorageTrashApiService=new Ze(this),this.UserApiService=new ct(this),this.VersionApiService=new ut(this),this.tokenUpdate=new te,this.rest=new ie(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,version:(null==e?void 0:e.version)||se},requestParams:{path:"",headers:{},query:{},body:null,cache:"no-cache"},authToken:null,skipInterceptors:!1},this.rest.baseHost=this.state.clientParams.host||""}},exports.ConnectionsApiService=M,exports.DiscoveryApiService=H,exports.DivideApiService=W,exports.ExtensionsApiService=ce,exports.ExtensionsExternalApiService=le,exports.FcaApiService=he,exports.GatewayApiService=ge,exports.GroupApiService=ve,exports.LicenseApiService=$e,exports.LinksApiService=me,exports.LogstashApiService=be,exports.NEED_TOKEN_UPDATE_ERROR=ee,exports.NotificationApiService=Ce,exports.Rest=ie,exports.RoleApiService=Pe,exports.ShareApiService=Ne,exports.StorageElementApiService=Fe,exports.StorageFilesApiService=Ve,exports.StorageInstanceApiService=ze,exports.StorageShareApiService=Ke,exports.StorageTrashApiService=Ze,exports.TokenUpdate=te,exports.UserApiService=ct,exports.VersionApiService=ut,exports.applyInterceptors=K,exports.getCookieValue=X,exports.makeUrlParams=Y,exports.normalizeHeaders=Q,exports.prepareRequestBody=Z;
|
|
1
|
+
"use strict";const e="/login",t=`${e}/ldap`,s=`${e}/update`;class r{constructor(e){this.client=e}info(){return this.client.rest.get(e)}login(t){return this.client.rest.post(e,t)}ldapLogin(e){return this.client.rest.post(t,e)}updateToken(e){const t=e.path?`${e.path}/${s}`:s;return e.path&&delete e.path,this.client.rest.post(t,e)}logout(){return this.client.rest.post("/logout")}}var i;exports.AccessRights=void 0,(i=exports.AccessRights||(exports.AccessRights={})).LicenseRead="license_read",i.LicenseManage="license_edit",i.UsersRead="users_read",i.UsersCreate="users_create",i.UsersActivate="users_activate",i.GroupsRead="groups_read",i.GroupsCreate="groups_create",i.RolesRead="roles_read",i.RolesCreate="roles_create",i.Share="share",i.Divide="divide",i.ExtensionsRead="extensions_read",i.ExtensionsManage="extensions_write",i.RestrictionShareRead="restriction_share_read",i.RestrictionShareWrite="restriction_share_write",i.RestrictionDivideRead="restriction_divide_read",i.RestrictionDivideWrite="restriction_divide_write",i.ReadUserLogs="read_user_logs",i.ConnectionsRead="connections_read",i.ConnectionsDividing="connections_dividing",i.ConnectionsYandexDisk="connections_yandex_disk",i.ConnectionsSsh="connections_ssh",i.ConnectionsMail="connections_mail",i.ConnectionsS3="connections_s3",i.ConnectionsDiscord="connections_discord",i.ConnectionsWebdav="connections_webdav",i.ConnectionsNextcloud="connections_nextcloud",i.ConnectionsNextbox="connections_nextbox",i.ConnectionsHttpProxy="connections_http_proxy",i.SystemInfoServiceList="system_info_service_list",i.SettingsRead="settings_read",i.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,_,f,S,$,m,y,k,b,A,w,R,T,C,E,U,D,P,O,N,I,L;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,(f=exports.Tariff||(exports.Tariff={})).Free="free",f.Business="business",f.Enterprise="enterprise",exports.LicenseError=void 0,(S=exports.LicenseError||(exports.LicenseError={})).NotActivated="License not activated",S.Blocked="License blocked",S.Expired="License has been expired",S.NotValid="License not valid",S.NotFound="license file not found",exports.NotificationEntityType=void 0,($=exports.NotificationEntityType||(exports.NotificationEntityType={})).Dir="dir",$.File="file",$.User="user",$.Other="other",$.WorkDir="work_dir",$.License="license",$.Extension="extension",$.Connection="connection",exports.NotificationAction=void 0,(m=exports.NotificationAction||(exports.NotificationAction={})).SecurityCheckNegative="action_security_check_negative",m.SecurityCheckPositive="action_security_check_positive",m.OpenSharing="open_sharing",m.ChangeSharing="change_sharing",m.CancelSharing="cancel_sharing",m.DivideDirAddFileToOwner="divide_dir_add_file_to_owner",m.DivideDirAddDirToOwner="divide_dir_add_dir_to_owner",m.DivideDirAddWorkDirToOwner="divide_dir_add_work_dir_to_owner",m.DivideConnectionAddFileToOwner="divide_connection_add_file_to_owner",m.DivideConnectionAddDirToOwner="divide_connection_add_dir_to_owner",m.CancelDivideDir="cancel_divide_dir",m.CancelDivideFile="cancel_divide_file",m.CancelDivideWorkDir="cancel_divide_work_dir",m.CancelDivideConnection="cancel_divide_connection",m.DeleteExtension="delete_extension",m.NewVersionExtension="new_version_extension",m.TransferData="transfer_data",m.AllowInternalAccessUser="allow_internal_access_to_user",m.BlockInternalAccessUser="block_internal_access_to_user",m.WaitInternalAccessUser="wait_internal_access_to_user",m.WaitInternalAccessUserCreate="wait_internal_access_to_user_create",m.AllowInternalAccessGroup="allow_internal_access_to_group",m.BlockInternalAccessGroup="block_internal_access_to_group",m.WaitInternalAccessGroup="wait_internal_access_to_group",m.WaitInternalAccessGroupCreate="wait_internal_access_to_group_create",m.AllowSharing="allow_sharing",m.BlockSharing="block_sharing",m.WaitSharing="wait_sharing",m.WaitSharingCreate="wait_sharing_create",m.Other="other",exports.NotificationRowAction=void 0,(y=exports.NotificationRowAction||(exports.NotificationRowAction={})).Read="read",y.Unread="unread",y.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,(b=exports.ResponseType||(exports.ResponseType={})).ArrayBuffer="arraybuffer",b.Blob="blob",b.Json="json",b.Text="text",exports.RequestMethod=void 0,(A=exports.RequestMethod||(exports.RequestMethod={})).GET="GET",A.POST="POST",A.PUT="PUT",A.PATCH="PATCH",A.DELETE="DELETE",exports.RequestObserve=void 0,(w=exports.RequestObserve||(exports.RequestObserve={})).Body="body",w.Response="response",exports.RestrictionSharing=void 0,(R=exports.RestrictionSharing||(exports.RestrictionSharing={})).NONE="none",R.SOFT="soft",R.HARD="hard",exports.UserAuthType=void 0,(T=exports.UserAuthType||(exports.UserAuthType={})).Native="native",T.Ldap="ldap",T.Vk="vk",exports.UserStatus=void 0,(C=exports.UserStatus||(exports.UserStatus={})).Registering="registering",C.Activated="activated",C.Blocked="blocked",C.BlockedByLicense="blocked_by_license",exports.UserType=void 0,(E=exports.UserType||(exports.UserType={})).User="user",E.Guest="guest",E.Emperor="emperor",E.Anonymous="anonymous",exports.UserParamsLabel=void 0,(U=exports.UserParamsLabel||(exports.UserParamsLabel={})).Theme="theme",U.Lang="lang",U.Sort="sort",exports.SettingControlType=void 0,(D=exports.SettingControlType||(exports.SettingControlType={})).Text="text",D.String="string",D.Number="number",D.CheckBox="checkbox",D.Select="select",D.RadioList="radio_list",D.ConnectionChoose="connection_choose",D.MultiConnectionChoose="multi_connection_choose",exports.StorageElementType=void 0,(P=exports.StorageElementType||(exports.StorageElementType={})).Dir="dir",P.File="file",P.WorkDir="work_dir",exports.StorageElementContentType=void 0,(O=exports.StorageElementContentType||(exports.StorageElementContentType={})).Any="any",O.Dir="dir",O.Code="code",O.Image="image",O.Audio="audio",O.Video="video",O.Text="text",O.Doc="doc",O.Xls="xls",O.Ppt="ppt",exports.StorageRoot=void 0,(N=exports.StorageRoot||(exports.StorageRoot={})).my="my",N.fca="fca",N.divide="divide",N.share="share",N.favorite="favorite",N.trash="trash",exports.StorageElementHistoryAction=void 0,(I=exports.StorageElementHistoryAction||(exports.StorageElementHistoryAction={})).Create="create",I.Update="update",I.Move="move",exports.StorageElementCheckStatus=void 0,(L=exports.StorageElementCheckStatus||(exports.StorageElementCheckStatus={}))[L.CheckNull=0]="CheckNull",L[L.CheckInProgress=1]="CheckInProgress",L[L.CheckPositive=2]="CheckPositive",L[L.CheckNegative=3]="CheckNegative";const j="/connections",q=`${j}/dashboard`;class M{constructor(e){this.client=e}list(e){return this.client.rest.get(j,e)}get(e){return this.client.rest.get(`${j}/${e}`)}update(e,t){return this.client.rest.put(`${j}/${e}`,t)}delete(e){return this.client.rest.delete(`${j}/${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]||j,e)}dashboard(e){return this.client.rest.get(q,e)}}class H{constructor(e){this.client=e}discovery(e){return this.client.rest.get("/discovery",e)}}const B="/divide",F=`${B}/restrictions`;class W{constructor(e){this.client=e}divideDelete(e,t){return this.client.rest.delete(`${e}/${B}/${t}`)}divideDeleteAll(e,t,s,r){return this.client.rest.delete(`${e}/${B}`,Object.assign(Object.assign({},this.makeParam(e,t)),{is_to_user_group:r,access_mode:s}))}divideChange(e,t,s){return this.client.rest.put(`${e}/divide/${t}`,{access_mode:s})}divideCreate(e,t,s,r,i){const n=Object.assign(Object.assign({},this.makeParam(e,t)),{[i]:s,access_mode:r});return this.client.rest.post(`${e}/${B}`,n)}divideUsers(e,t,s){return this.client.rest.get(`${e}/${B}/users`,Object.assign(Object.assign({},this.makeParam(e,t)),s))}getRestriction(e){return this.client.rest.get(`${F}/${e}`)}restrictionSize(e,t){return this.client.rest.get(`/${t}/restrictions/${e}/size`)}restrictions(e){return this.client.rest.get(`${F}`,e)}restrictionsChange(e,t){return this.client.rest.put(`${F}/${e}`,t)}makeParam(e,t){const s={};return e===exports.DivideScope.Connection?s.connection_id=t:s.path=t,s}}function G(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{a(r.next(e))}catch(e){n(e)}}function c(e){try{a(r.throw(e))}catch(e){n(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,c)}a((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class V extends Error{}function z(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 J(e,t){if("string"!=typeof e)throw new V("Invalid token specified: must be a string");t||(t={});const s=!0===t.header?0:1,r=e.split(".")[s];if("string"!=typeof r)throw new V(`Invalid token specified: missing part #${s+1}`);let i;try{i=z(r)}catch(e){throw new V(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new V(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}V.prototype.name="InvalidTokenError";const K=(e,t)=>G(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 X(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 Y=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 Q(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}function Z(e){return e?e instanceof FormData||e instanceof Blob||e instanceof ArrayBuffer||e instanceof URLSearchParams||e instanceof Document||ArrayBuffer.isView(e)?e:"object"==typeof e?JSON.stringify(e):"string"==typeof e?e:null:null}const ee="update black token";class te{constructor(){this.isUpdating=!1,this.tokenUpdateResolve=null}isTokenExpire(e){if(!e)return!1;return 1e3*e<=(new Date).getTime()+3e3}refreshToken(e,t){return G(this,void 0,void 0,(function*(){const{access_token:s,refresh_token:r}=e;return s&&r?this.isUpdating?this.waitForTokenUpdate():(this.isUpdating=!0,new Promise(((e,i)=>{const n=new XMLHttpRequest,o=`${t}${se}/login/update`;n.open("POST",o,!0),n.setRequestHeader("Content-Type","application/json"),n.send(JSON.stringify({access_token:s,refresh_token:r})),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};X("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 e(null)},n.onerror=()=>{i(new Error("Network error occurred"))},n.onloadend=()=>{this.isUpdating=!1}}))):null}))}waitForTokenUpdate(){return G(this,void 0,void 0,(function*(){return new Promise((e=>{const t=setInterval((()=>{this.isUpdating||(clearInterval(t),e())}),100)}))}))}}const se="/api/v1",re="/api/v2";class ie{constructor(e,t){this.client=e,this.tokenUpdate=t,this.baseHost=""}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))}upload(e,t,s){const r=new AbortController,i=r.signal;return{promise:this.request(exports.RequestMethod.POST,e,Object.assign({body:t,signal:i},s)),abort:()=>r.abort()}}request(e,t,s){return G(this,void 0,void 0,(function*(){return new Promise(((r,i)=>G(this,void 0,void 0,(function*(){var n;const o=null!==(n=this.state.skipInterceptors)&&void 0!==n&&n;this.state.skipInterceptors=!1;let c=Object.assign({method:e},s);if((null==s?void 0:s.signal)&&(c.signal=s.signal),o||(s=yield K(this.client.requestInterceptors,c)),this.state.authToken)for(const[e,r]of this.state.authToken.entries()){const i=J(r.access_token);if(i&&i.is_remember&&this.tokenUpdate.isTokenExpire(i.exp)&&!t.includes("/login")&&!t.includes("/assets")){const t=yield this.tokenUpdate.refreshToken(r,this.baseHost);t&&(this.state.authToken.set(e,t),s=yield K(this.client.requestInterceptors,c))}}const a=new XMLHttpRequest;(null==s?void 0:s.params)&&0!==Object.keys(s.params).length&&(t+="?"+Y(s.params));const l=`${this.state.clientParams.host}${this.state.clientParams.version}${t}`;if(a.open(e,l,!0),null==s?void 0:s.headers){const e=Q(s.headers);for(const[t,s]of Object.entries(e))(this.state.clientParams.host===this.baseHost||"content-type"!==t.toLowerCase())&&a.setRequestHeader(t,s)}(null==s?void 0:s.responseType)&&(a.responseType=s.responseType),(null==s?void 0:s.signal)&&s.signal.addEventListener("abort",(()=>{a.abort(),i(new Error("Upload aborted"))})),a.upload&&[exports.RequestMethod.POST,exports.RequestMethod.PUT,exports.RequestMethod.PATCH].includes(e)&&(a.upload.onprogress=e=>{e.lengthComputable&&(null==s?void 0:s.onUploadProgress)&&s.onUploadProgress(e)}),a.onload=()=>G(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 exports.ResponseType.Text:e=a.responseText;break;case exports.ResponseType.Blob:case exports.ResponseType.ArrayBuffer:e=a.response;break;default:try{e=JSON.parse(a.responseText)}catch(t){e=a.responseText}}const t=new Headers;a.getAllResponseHeaders().split("\r\n").forEach((e=>{const[s,r]=e.split(": ");s&&r&&t.append(s,r)}));let n={status:a.status,statusText:a.statusText,headers:t,url:a.responseURL};if(a.status>=200&&a.status<300)(null==s?void 0:s.observe)===exports.RequestObserve.Response?r(Object.assign(Object.assign({},n),{body:e})):r(e);else{if(this.state.authToken&&e.code===ee){const e=yield this.tokenUpdate.refreshToken(this.state.authToken.get(0),this.baseHost);e&&this.state.authToken.set(0,e)}s=yield K(this.client.responseInterceptors,Object.assign(Object.assign({},n),{error:e})),i(Object.assign(Object.assign({},n),{error:e}))}n=yield K(this.client.responseInterceptors,n)})),a.onerror=()=>{i({status:a.status,statusText:a.statusText,url:a.responseURL,error:"Network error"})},a.send(Z(null==s?void 0:s.body))}))))}))}changeBaseUrlVersion(e,t){return G(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 G(this,void 0,void 0,(function*(){this.state.clientParams.host=e,this.state.requestParams.headers={};try{return yield t()}finally{this.state.clientParams.host=this.baseHost}}))}}const ne="/static/extensions",oe="/extensions/defaults";class ce{constructor(e){this.client=e}getSetting(e){return this.client.rest.get(`${ne}/${e}/settings`)}setSetting(e,t){return this.client.rest.post(`${ne}/${e}/settings`,t)}deleteSetting(e){return this.client.rest.delete(`${ne}/${e}/settings`)}get(e){return this.client.rest.get(`${ne}/${e}`)}getByKey(e){return this.client.rest.get(`${ne}/${e}`)}getDefault(e=[]){return this.client.rest.get(oe,{ext_code:e})}setDefault(e,t){return this.client.rest.post(oe,{ext_code:e,ext_uniq_key:t})}checkUpdates(){return this.client.rest.post(`${ne}/check_updates`)}updateVersion(e,t){return this.client.rest.put(`${ne}/${e}`,{version:t})}list(e){return this.client.rest.get(ne,e)}delete(e,t){return this.client.rest.delete(`${ne}/${e}`)}upload(e,t){const s=new FormData;s.set("file",t);const{promise:r,abort:i}=this.client.rest.upload(ne,s,{onUploadProgress:t=>{e(t)}});return{promise:this.client.rest.changeBaseUrlVersion(re,(()=>r)),abort:i}}install(e,t){return this.client.rest.changeBaseUrlVersion(re,(()=>this.client.rest.post(`${ne}/site`,{uniq_key:e,version:t})))}}const ae="/anons_ext/extensions";class le{constructor(e){this.client=e}listExtensionsSite(e){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(ae,e)))}extensionDetailSite(e){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(`${ae}/${e}`)))}extensionMarkdown(e,t){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(`${ae}/${e}/readme`,{},t)))}}const pe="/disk",de=`${pe}/check`;class he{constructor(e){this.client=e}info(e,t){return this.client.rest.get(`${pe}/${e}/element`,{path:t})}list(e,t){return this.client.rest.get(`${pe}/${e}`,t)}create(e,t){return this.client.rest.post(`${pe}/${e}/element`,t)}replace(e,t,s){return this.client.rest.put(`${pe}/${e}/files?path=${t}`,s)}read(e,t){return this.client.rest.get(`${pe}/${e}/files?path=${t}`)}upload(e,t,s,r=""){const i=new FormData;i.set("path",r),i.set("file",s);const{promise:n,abort:o}=this.client.rest.upload(`${pe}/${t}/files`,i,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e,t){return this.client.rest.post(`${pe}/${e}/files/net`,t)}delete(e,t){return this.client.rest.delete(`${pe}/${e}/trash/element`,{path:t})}check(e){return this.client.rest.post(de,e)}}const ue="/settings";class ge{constructor(e){this.client=e}settings(){return this.client.rest.get(ue)}changeSettings(e){return this.client.rest.post(ue,e)}queryInit(){return this.client.rest.get("/query/init")}}const xe="/groups";class ve{constructor(e){this.client=e}list(e){return this.client.rest.get(xe,e)}listUsers(e){return this.client.rest.get(`${xe}/${e}/users`)}create(e){return this.client.rest.post(xe,e)}update(e,t){return this.client.rest.put(`${xe}/${e}`,t)}delete(e){return this.client.rest.delete(`${xe}/${e}`)}}const _e="/license",fe=`${_e}/manual-check`,Se=`${_e}/hardware/hash`;class $e{constructor(e){this.client=e}info(){return this.client.rest.get(_e)}create(e){return this.client.rest.post(_e,e)}check(){return this.client.rest.post(fe)}delete(){return this.client.rest.delete(_e)}getHash(){return this.client.rest.get(Se)}}const me="/links";class ye{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post(me,e)}updateShortLink(e){return this.client.rest.put(me,e)}}class ke{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get("/logs/users",e)}}const be="/notifications",Ae=`${be}/all`,we=`${be}/subscription`,Re=`${be}/permission`;class Te{constructor(e){this.client=e}list(e){return this.client.rest.get(be,e)}toggleStatus(e,t){return this.client.rest.put(be,{ids:e,to_status:t})}toggleAllStatus(e){return this.client.rest.put(Ae,{to_status:e})}delete(e){return this.client.rest.delete(be,{id:e})}deleteAll(){return this.client.rest.delete(Ae)}getPermission(){return this.client.rest.get(Re)}setPermission(e){return this.client.rest.post(Re,{enabled:e})}getSubscription(){return this.client.rest.get(we)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(we,t)}}const Ce="/roles",Ee=`${Ce}/default`,Ue="/permissions";class De{constructor(e){this.client=e}list(e){return this.client.rest.get(Ce,e)}get(e){return this.client.rest.get(`${Ce}/${e}`)}getDefault(){return this.client.rest.get(`${Ee}`)}create(e){return this.client.rest.post(Ce,e)}update(e,t){return this.client.rest.put(`${Ce}/${e}`,t)}delete(e){return this.client.rest.delete(`${Ce}/${e}`)}permissionList(){return this.client.rest.get(Ue)}addPermission(e,t){return this.client.rest.put(`${Ce}/${e}/permissions`,{ids:t})}deletePermission(e,t){return this.client.rest.delete(`${Ce}/${e}/${Ue}`,{ids:t})}}const Pe="/share",Oe=`${Pe}/restrictions`;class Ne{constructor(e){this.client=e}info(e,t){const s=new URLSearchParams({path:e,share_token:t});return this.client.rest.get(`${Pe}?${s.toString()}`)}checkPassword(e,t){const s=encodeURIComponent(e);return this.client.rest.get(`${Pe}/password?share_token=${t}&share_pass=${s}`)}checkToken(e){return this.client.rest.get(`${Pe}?share_token=${e}`)}getRestriction(e){return this.client.rest.get(`${Oe}/${e}`)}restrictions(e){return this.client.rest.get(Oe,e)}restrictionsChange(e,t){return this.client.rest.put(`${Oe}/${e}`,t)}}const Ie="/storage",Le=`${Ie}/element`,je=`${Le}/move`,qe=`${Le}/copy`,Me=`${Le}/content_type_size`,He="/disk";class Be{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(Ie,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(Le,e)}combineInfo({root:e,rootId:t,path:s,file_version_id:r}){return e===exports.StorageRoot.fca&&t?this.fcaApiService.info(t,s):this.info({path:s,divide_id:t,file_version_id:r})}size(e){return this.client.rest.post(`${Le}/size`,e)}move(e,t,s){const{from_divide_id:r,to_divide_id:i}=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(`${He}/${r}/files/move${He}/${i}`,n):t===exports.StorageRoot.fca?(r&&(n.from_divide_id=r),this.client.rest.put(`${He}/${i}/files/from/box`,n)):s===exports.StorageRoot.fca?(i&&(n.to_divide_id=i),this.client.rest.put(`${He}/${r}/files/to/box`,n)):this.client.rest.post(je,e)}copy(e,t,s){const{from_divide_id:r,to_divide_id:i}=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(`${He}/${r}/files/copy${He}/${i}`,n):s===exports.StorageRoot.fca?(r&&(n.from_divide_id=r),this.client.rest.post(`${He}/${i}/files/from/box`,n)):t===exports.StorageRoot.fca?(i&&(n.to_divide_id=i),this.client.rest.post(`${He}/${r}/files/to/box`,n)):this.client.rest.post(qe,e)}pasteFromShared(e,t,s){const r={from_sharing_token:e,from_sharing_password:s,paths:t};return this.client.rest.post(`${Le}/copy`,r)}create(e){return this.client.rest.post(Le,e)}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(Le,s)}favorite(e){return this.client.rest.put(`${Le}?path=${encodeURIComponent(e)}`,{is_favorite:!0})}removeFavorite(e){return this.client.rest.put(`${Le}?path=${encodeURIComponent(e)}`,{is_favorite:!1})}createItem(e){return this.client.rest.post(Le,e)}createWorkDir(e){return this.client.rest.post(Le,e)}sizeWithSection(e){return this.client.rest.get(Me,e)}}const Fe="/storage/files",We=`${Fe}/net`;class Ge{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,r){const i=new FormData;i.set("path",s),r&&i.set("divide_id",r.toString()),i.set("file",t);const{promise:n,abort:o}=this.client.rest.upload(Fe,i,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e){return this.client.rest.post(We,e)}}class Ve{constructor(e){this.client=e}instance(){return this.client.rest.get("/storage/instance")}}const ze="/storage/element/share";class Je{constructor(e){this.client=e}info(e){return this.client.rest.get(ze,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(ze,s)}change(e){return this.client.rest.put(`${ze}/${e.token}`,e)}delete(e){return this.client.rest.delete(ze,{path:e})}refresh(e){return this.client.rest.put(`${ze}/${e}/refresh`)}}const Ke="/storage/trash/element",Xe=`${Ke}/all`;class Ye{constructor(e){this.client=e}clear(e){return this.client.rest.delete(Ke,e)}clearAll(){return this.client.rest.delete(Xe)}restore(e){return this.client.rest.patch(Ke,{del_groups:e})}restoreAll(){return this.client.rest.patch(Xe)}}const Qe="/users",Ze=`${Qe}/me`,et=`${Ze}/avatars`,tt=`${Ze}/sessions`,st=`${Ze}/tokens`,rt=`${Ze}/params`,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,e)}update(e,t){return this.client.rest.put(Qe+`/${e}`,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,e)}createToken(e){return this.client.rest.post(st,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,e)}changeUsersPassword(e,t){return this.client.rest.put(`${Qe}/${e}/change-password`,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`,{role_id:t})}meParams(e){return this.client.rest.get(rt,{name:e})}meSetParams(e,t){return this.client.rest.post(`${rt}/${e}`,t)}meListParams(){return this.client.rest.get(rt)}}const ot="/storage/element",ct=`${ot}/history`,at=`${ot}/version`,lt=`${at}/current`,pt=`${at}/size`;class dt{constructor(e){this.client=e}history(e){return this.client.rest.get(ct,e)}versions(e){return this.client.rest.get(at,e)}create(e){return this.client.rest.post(at,e)}edit(e){return this.client.rest.put(at,e)}delete(e){return this.client.rest.delete(at,e)}size(e){return this.client.rest.get(pt,e)}makeCurrent(e){return this.client.rest.post(lt,e)}}exports.AuthApiService=r,exports.BASE_URL_V1=se,exports.BASE_URL_V2=re,exports.CONNECTIONS_PERMISSION=n,exports.Client=class{constructor(e){this.AuthApiService=new r(this),this.ConnectionsApiService=new M(this),this.DiscoveryApiService=new H(this),this.DivideApiService=new W(this),this.ExtensionsApiService=new ce(this),this.ExtensionsExternalApiService=new le(this),this.FcaApiService=new he(this),this.GatewayApiService=new ge(this),this.GroupApiService=new ve(this),this.LicenseApiService=new $e(this),this.LinksApiService=new ye(this),this.LogstashApiService=new ke(this),this.NotificationApiService=new Te(this),this.RoleApiService=new De(this),this.ShareApiService=new Ne(this),this.StorageElementApiService=new Be(this,this.FcaApiService),this.StorageFilesApiService=new Ge(this),this.StorageInstanceApiService=new Ve(this),this.StorageShareApiService=new Je(this),this.StorageTrashApiService=new Ye(this),this.UserApiService=new nt(this),this.VersionApiService=new dt(this),this.tokenUpdate=new te,this.rest=new ie(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,version:(null==e?void 0:e.version)||se},requestParams:{path:"",headers:{},query:{},body:null,cache:"no-cache"},authToken:null,skipInterceptors:!1},this.rest.baseHost=this.state.clientParams.host||""}},exports.ConnectionsApiService=M,exports.DiscoveryApiService=H,exports.DivideApiService=W,exports.ExtensionsApiService=ce,exports.ExtensionsExternalApiService=le,exports.FcaApiService=he,exports.GatewayApiService=ge,exports.GroupApiService=ve,exports.LicenseApiService=$e,exports.LinksApiService=ye,exports.LogstashApiService=ke,exports.NEED_TOKEN_UPDATE_ERROR=ee,exports.NotificationApiService=Te,exports.Rest=ie,exports.RoleApiService=De,exports.ShareApiService=Ne,exports.StorageElementApiService=Be,exports.StorageFilesApiService=Ge,exports.StorageInstanceApiService=Ve,exports.StorageShareApiService=Je,exports.StorageTrashApiService=Ye,exports.TokenUpdate=te,exports.UserApiService=nt,exports.VersionApiService=dt,exports.applyInterceptors=K,exports.getCookieValue=X,exports.makeUrlParams=Y,exports.normalizeHeaders=Q,exports.prepareRequestBody=Z;
|
package/dist/bundle.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="/login",t=`${e}/ldap`,s=`${e}/update`;class n{constructor(e){this.client=e}info(){return this.client.rest.get(e)}login(t){return this.client.rest.post(e,t)}ldapLogin(e){return this.client.rest.post(t,e)}updateToken(e){const t=e.path?`${e.path}/${s}`:s;return e.path&&delete e.path,this.client.rest.post(t,e)}logout(){return this.client.rest.post("/logout")}}var i;!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"}(i||(i={}));const r=[i.ConnectionsYandexDisk,i.ConnectionsSsh,i.ConnectionsMail,i.ConnectionsS3,i.ConnectionsS3,i.ConnectionsDiscord,i.ConnectionsWebdav,i.ConnectionsNextcloud,i.ConnectionsNextbox,i.ConnectionsHttpProxy];var o,c,a,l,h,d,u,p,g,_,f,v,$,k,m,b,w,S,y,x,C,A,T,P,D,U,E,R,O,I,L,j;!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"}(h||(h={})),function(e){e.Read="read",e.ReadAndWrite="read_and_write",e.Write="write"}(d||(d={})),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"}(_||(_={})),function(e){e.User="to_user_id",e.Group="to_user_group_id"}(f||(f={})),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"}(k||(k={})),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"}(m||(m={})),function(e){e.SecurityCheckNegative="action_security_check_negative",e.SecurityCheckPositive="action_security_check_positive",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"}(b||(b={})),function(e){e.Read="read",e.Unread="unread",e.Delete="delete"}(w||(w={})),function(e){e.Plain="plain",e.Success="success",e.Info="info",e.Warning="warning",e.Error="error"}(S||(S={})),function(e){e.ArrayBuffer="arraybuffer",e.Blob="blob",e.Json="json",e.Text="text"}(y||(y={})),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"}(C||(C={})),function(e){e.NONE="none",e.SOFT="soft",e.HARD="hard"}(A||(A={})),function(e){e.Native="native",e.Ldap="ldap",e.Vk="vk"}(T||(T={})),function(e){e.Registering="registering",e.Activated="activated",e.Blocked="blocked",e.BlockedByLicense="blocked_by_license"}(P||(P={})),function(e){e.User="user",e.Guest="guest",e.Emperor="emperor",e.Anonymous="anonymous"}(D||(D={})),function(e){e.Theme="theme",e.Lang="lang",e.Sort="sort"}(U||(U={})),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"}(E||(E={})),function(e){e.Dir="dir",e.File="file",e.WorkDir="work_dir"}(R||(R={})),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"}(O||(O={})),function(e){e.my="my",e.fca="fca",e.divide="divide",e.share="share",e.favorite="favorite"}(I||(I={})),function(e){e.Create="create",e.Update="update",e.Move="move"}(L||(L={})),function(e){e[e.CheckNull=0]="CheckNull",e[e.CheckInProgress=1]="CheckInProgress",e[e.CheckPositive=2]="CheckPositive",e[e.CheckNegative=3]="CheckNegative"}(j||(j={}));const N="/connections",H=`${N}/dashboard`;class W{constructor(e){this.client=e}list(e){return this.client.rest.get(N,e)}get(e){return this.client.rest.get(`${N}/${e}`)}update(e,t){return this.client.rest.put(`${N}/${e}`,t)}delete(e){return this.client.rest.delete(`${N}/${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]||N,e)}dashboard(e){return this.client.rest.get(H,e)}}class F{constructor(e){this.client=e}discovery(e){return this.client.rest.get("/discovery",e)}}const q="/divide",B=`${q}/restrictions`;class G{constructor(e){this.client=e}divideDelete(e,t){return this.client.rest.delete(`${e}/${q}/${t}`)}divideDeleteAll(e,t,s,n){return this.client.rest.delete(`${e}/${q}`,Object.assign(Object.assign({},this.makeParam(e,t)),{is_to_user_group:n,access_mode:s}))}divideChange(e,t,s){return this.client.rest.put(`${e}/divide/${t}`,{access_mode:s})}divideCreate(e,t,s,n,i){const r=Object.assign(Object.assign({},this.makeParam(e,t)),{[i]:s,access_mode:n});return this.client.rest.post(`${e}/${q}`,r)}divideUsers(e,t,s){return this.client.rest.get(`${e}/${q}/users`,Object.assign(Object.assign({},this.makeParam(e,t)),s))}getRestriction(e){return this.client.rest.get(`${B}/${e}`)}restrictionSize(e,t){return this.client.rest.get(`/${t}/restrictions/${e}/size`)}restrictions(e){return this.client.rest.get(`${B}`,e)}restrictionsChange(e,t){return this.client.rest.put(`${B}/${e}`,t)}makeParam(e,t){const s={};return e===u.Connection?s.connection_id=t:s.path=t,s}}function M(e,t,s,n){return new(s||(s=Promise))((function(i,r){function o(e){try{a(n.next(e))}catch(e){r(e)}}function c(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,c)}a((n=n.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class V extends Error{}function z(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 J(e,t){if("string"!=typeof e)throw new V("Invalid token specified: must be a string");t||(t={});const s=!0===t.header?0:1,n=e.split(".")[s];if("string"!=typeof n)throw new V(`Invalid token specified: missing part #${s+1}`);let i;try{i=z(n)}catch(e){throw new V(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new V(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}V.prototype.name="InvalidTokenError";const X=(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 Y(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 K=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 Q(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}function Z(e){return e?e instanceof FormData||e instanceof Blob||e instanceof ArrayBuffer||e instanceof URLSearchParams||e instanceof Document||ArrayBuffer.isView(e)?e:"object"==typeof e?JSON.stringify(e):"string"==typeof e?e:null:null}const ee="update black token";class te{constructor(){this.isUpdating=!1,this.tokenUpdateResolve=null}isTokenExpire(e){if(!e)return!1;return 1e3*e<=(new Date).getTime()+3e3}refreshToken(e,t){return M(this,void 0,void 0,(function*(){const{access_token:s,refresh_token:n}=e;return s&&n?this.isUpdating?this.waitForTokenUpdate():(this.isUpdating=!0,new Promise(((e,i)=>{const r=new XMLHttpRequest,o=`${t}${se}/login/update`;r.open("POST",o,!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify({access_token:s,refresh_token:n})),r.onload=()=>{if(r.status>=200&&r.status<300)try{const t=JSON.parse(r.responseText);if(t&&t.access_token&&t.refresh_token){const s={access_token:t.access_token,refresh_token:t.refresh_token};Y("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 e(null)},r.onerror=()=>{i(new Error("Network error occurred"))},r.onloadend=()=>{this.isUpdating=!1}}))):null}))}waitForTokenUpdate(){return M(this,void 0,void 0,(function*(){return new Promise((e=>{const t=setInterval((()=>{this.isUpdating||(clearInterval(t),e())}),100)}))}))}}const se="/api/v1",ne="/api/v2";class ie{constructor(e,t){this.client=e,this.tokenUpdate=t,this.baseHost=""}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))}upload(e,t,s){const n=new AbortController,i=n.signal;return{promise:this.request(x.POST,e,Object.assign({body:t,signal:i},s)),abort:()=>n.abort()}}request(e,t,s){return M(this,void 0,void 0,(function*(){return new Promise(((n,i)=>M(this,void 0,void 0,(function*(){var r;const o=null!==(r=this.state.skipInterceptors)&&void 0!==r&&r;this.state.skipInterceptors=!1;let c=Object.assign({method:e},s);if((null==s?void 0:s.signal)&&(c.signal=s.signal),o||(s=yield X(this.client.requestInterceptors,c)),this.state.authToken)for(const[e,n]of this.state.authToken.entries()){const i=J(n.access_token);if(i&&i.is_remember&&this.tokenUpdate.isTokenExpire(i.exp)&&!t.includes("/login")&&!t.includes("/assets")){const t=yield this.tokenUpdate.refreshToken(n,this.baseHost);t&&(this.state.authToken.set(e,t),s=yield X(this.client.requestInterceptors,c))}}const a=new XMLHttpRequest;(null==s?void 0:s.params)&&0!==Object.keys(s.params).length&&(t+="?"+K(s.params));const l=`${this.state.clientParams.host}${this.state.clientParams.version}${t}`;if(a.open(e,l,!0),null==s?void 0:s.headers){const e=Q(s.headers);for(const[t,s]of Object.entries(e))(this.state.clientParams.host===this.baseHost||"content-type"!==t.toLowerCase())&&a.setRequestHeader(t,s)}(null==s?void 0:s.responseType)&&(a.responseType=s.responseType),(null==s?void 0:s.signal)&&s.signal.addEventListener("abort",(()=>{a.abort(),i(new Error("Upload aborted"))})),a.upload&&[x.POST,x.PUT,x.PATCH].includes(e)&&(a.upload.onprogress=e=>{e.lengthComputable&&(null==s?void 0:s.onUploadProgress)&&s.onUploadProgress(e)}),a.onload=()=>M(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 y.Text:e=a.responseText;break;case y.Blob:case y.ArrayBuffer:e=a.response;break;default:try{e=JSON.parse(a.responseText)}catch(t){e=a.responseText}}const t=new Headers;a.getAllResponseHeaders().split("\r\n").forEach((e=>{const[s,n]=e.split(": ");s&&n&&t.append(s,n)}));let r={status:a.status,statusText:a.statusText,headers:t,url:a.responseURL};if(a.status>=200&&a.status<300)(null==s?void 0:s.observe)===C.Response?n(Object.assign(Object.assign({},r),{body:e})):n(e);else{if(this.state.authToken&&e.code===ee){const e=yield this.tokenUpdate.refreshToken(this.state.authToken.get(0),this.baseHost);e&&this.state.authToken.set(0,e)}s=yield X(this.client.responseInterceptors,Object.assign(Object.assign({},r),{error:e})),i(Object.assign(Object.assign({},r),{error:e}))}r=yield X(this.client.responseInterceptors,r)})),a.onerror=()=>{i({status:a.status,statusText:a.statusText,url:a.responseURL,error:"Network error"})},a.send(Z(null==s?void 0:s.body))}))))}))}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=this.baseHost}}))}}class re{constructor(e){this.AuthApiService=new n(this),this.ConnectionsApiService=new W(this),this.DiscoveryApiService=new F(this),this.DivideApiService=new G(this),this.ExtensionsApiService=new ae(this),this.ExtensionsExternalApiService=new he(this),this.FcaApiService=new pe(this),this.GatewayApiService=new _e(this),this.GroupApiService=new ve(this),this.LicenseApiService=new be(this),this.LinksApiService=new Se(this),this.LogstashApiService=new xe(this),this.NotificationApiService=new De(this),this.RoleApiService=new Oe(this),this.ShareApiService=new je(this),this.StorageElementApiService=new Ge(this,this.FcaApiService),this.StorageFilesApiService=new ze(this),this.StorageInstanceApiService=new Je(this),this.StorageShareApiService=new Ye(this),this.StorageTrashApiService=new et(this),this.UserApiService=new at(this),this.VersionApiService=new gt(this),this.tokenUpdate=new te,this.rest=new ie(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,version:(null==e?void 0:e.version)||se},requestParams:{path:"",headers:{},query:{},body:null,cache:"no-cache"},authToken:null,skipInterceptors:!1},this.rest.baseHost=this.state.clientParams.host||""}}const oe="/static/extensions",ce="/extensions/defaults";class ae{constructor(e){this.client=e}getSetting(e){return this.client.rest.get(`${oe}/${e}/settings`)}setSetting(e,t){return this.client.rest.post(`${oe}/${e}/settings`,t)}deleteSetting(e){return this.client.rest.delete(`${oe}/${e}/settings`)}get(e){return this.client.rest.get(`${oe}/${e}`)}getByKey(e){return this.client.rest.get(`${oe}/${e}`)}getDefault(e=[]){return this.client.rest.get(ce,{ext_code:e})}setDefault(e,t){return this.client.rest.post(ce,{ext_code:e,ext_uniq_key:t})}checkUpdates(){return this.client.rest.post(`${oe}/check_updates`)}updateVersion(e,t){return this.client.rest.put(`${oe}/${e}`,{version:t})}list(e){return this.client.rest.get(oe,e)}delete(e,t){return this.client.rest.delete(`${oe}/${e}`)}upload(e,t){const s=new FormData;s.set("file",t);const{promise:n,abort:i}=this.client.rest.upload(oe,s,{onUploadProgress:t=>{e(t)}});return{promise:this.client.rest.changeBaseUrlVersion(ne,(()=>n)),abort:i}}install(e,t){return this.client.rest.changeBaseUrlVersion(ne,(()=>this.client.rest.post(`${oe}/site`,{uniq_key:e,version:t})))}}const le="/anons_ext/extensions";class he{constructor(e){this.client=e}listExtensionsSite(e){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(le,e)))}extensionDetailSite(e){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(`${le}/${e}`)))}extensionMarkdown(e,t){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(`${le}/${e}/readme`,{},t)))}}const de="/disk",ue=`${de}/check`;class pe{constructor(e){this.client=e}info(e,t){return this.client.rest.get(`${de}/${e}/element`,{path:t})}list(e,t){return this.client.rest.get(`${de}/${e}`,t)}create(e,t){return this.client.rest.post(`${de}/${e}/element`,t)}replace(e,t,s){return this.client.rest.put(`${de}/${e}/files?path=${t}`,s)}read(e,t){return this.client.rest.get(`${de}/${e}/files?path=${t}`)}upload(e,t,s,n=""){const i=new FormData;i.set("path",n),i.set("file",s);const{promise:r,abort:o}=this.client.rest.upload(`${de}/${t}/files`,i,{onUploadProgress:t=>{e(t)}});return{promise:r,abort:o}}uploadNet(e,t){return this.client.rest.post(`${de}/${e}/files/net`,t)}delete(e,t){return this.client.rest.delete(`${de}/${e}/trash/element`,{path:t})}check(e){return this.client.rest.post(ue,e)}}const ge="/settings";class _e{constructor(e){this.client=e}settings(){return this.client.rest.get(ge)}changeSettings(e){return this.client.rest.post(ge,e)}queryInit(){return this.client.rest.get("/query/init")}}const fe="/groups";class ve{constructor(e){this.client=e}list(e){return this.client.rest.get(fe,e)}listUsers(e){return this.client.rest.get(`${fe}/${e}/users`)}create(e){return this.client.rest.post(fe,e)}update(e,t){return this.client.rest.put(`${fe}/${e}`,t)}delete(e){return this.client.rest.delete(`${fe}/${e}`)}}const $e="/license",ke=`${$e}/manual-check`,me=`${$e}/hardware/hash`;class be{constructor(e){this.client=e}info(){return this.client.rest.get($e)}create(e){return this.client.rest.post($e,e)}check(){return this.client.rest.post(ke)}delete(){return this.client.rest.delete($e)}getHash(){return this.client.rest.get(me)}}const we="/links";class Se{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post(we,e)}updateShortLink(e){return this.client.rest.put(we,e)}}const ye="/logs";class xe{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get(`${ye}/users`,e)}getSystemLogs(e,t,s){return this.client.rest.get(`${ye}/${e}`,{},{observe:C.Response,responseType:y.Text,headers:{Range:`bytes=${t}-${s}`}})}}const Ce="/notifications",Ae=`${Ce}/all`,Te=`${Ce}/subscription`,Pe=`${Ce}/permission`;class De{constructor(e){this.client=e}list(e){return this.client.rest.get(Ce,e)}toggleStatus(e,t){return this.client.rest.put(Ce,{ids:e,to_status:t})}toggleAllStatus(e){return this.client.rest.put(Ae,{to_status:e})}delete(e){return this.client.rest.delete(Ce,{id:e})}deleteAll(){return this.client.rest.delete(Ae)}getPermission(){return this.client.rest.get(Pe)}setPermission(e){return this.client.rest.post(Pe,{enabled:e})}getSubscription(){return this.client.rest.get(Te)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(Te,t)}}const Ue="/roles",Ee=`${Ue}/default`,Re="/permissions";class Oe{constructor(e){this.client=e}list(e){return this.client.rest.get(Ue,e)}get(e){return this.client.rest.get(`${Ue}/${e}`)}getDefault(){return this.client.rest.get(`${Ee}`)}create(e){return this.client.rest.post(Ue,e)}update(e,t){return this.client.rest.put(`${Ue}/${e}`,t)}delete(e){return this.client.rest.delete(`${Ue}/${e}`)}permissionList(){return this.client.rest.get(Re)}addPermission(e,t){return this.client.rest.put(`${Ue}/${e}/permissions`,{ids:t})}deletePermission(e,t){return this.client.rest.delete(`${Ue}/${e}/${Re}`,{ids:t})}}const Ie="/share",Le=`${Ie}/restrictions`;class je{constructor(e){this.client=e}info(e,t){const s=new URLSearchParams({path:e,share_token:t});return this.client.rest.get(`${Ie}?${s.toString()}`)}checkPassword(e,t){const s=encodeURIComponent(e);return this.client.rest.get(`${Ie}/password?share_token=${t}&share_pass=${s}`)}checkToken(e){return this.client.rest.get(`${Ie}?share_token=${e}`)}getRestriction(e){return this.client.rest.get(`${Le}/${e}`)}restrictions(e){return this.client.rest.get(Le,e)}restrictionsChange(e,t){return this.client.rest.put(`${Le}/${e}`,t)}}const Ne="/storage",He=`${Ne}/element`,We=`${He}/move`,Fe=`${He}/copy`,qe=`${He}/content_type_size`,Be="/disk";class Ge{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(Ne,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(He,e)}combineInfo({root:e,rootId:t,path:s,file_version_id:n}){return e===I.fca&&t?this.fcaApiService.info(t,s):this.info({path:s,divide_id:t,file_version_id:n})}size(e){return this.client.rest.post(`${He}/size`,e)}move(e,t,s){const{from_divide_id:n,to_divide_id:i}=e;let r=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return t===I.fca&&s===I.fca?this.client.rest.post(`${Be}/${n}/files/move${Be}/${i}`,r):t===I.fca?(n&&(r.from_divide_id=n),this.client.rest.put(`${Be}/${i}/files/from/box`,r)):s===I.fca?(i&&(r.to_divide_id=i),this.client.rest.put(`${Be}/${n}/files/to/box`,r)):this.client.rest.post(We,e)}copy(e,t,s){const{from_divide_id:n,to_divide_id:i}=e;let r=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return s===I.fca&&t===I.fca?this.client.rest.post(`${Be}/${n}/files/copy${Be}/${i}`,r):s===I.fca?(n&&(r.from_divide_id=n),this.client.rest.post(`${Be}/${i}/files/from/box`,r)):t===I.fca?(i&&(r.to_divide_id=i),this.client.rest.post(`${Be}/${n}/files/to/box`,r)):this.client.rest.post(Fe,e)}pasteFromShared(e,t,s){const n={from_sharing_token:e,from_sharing_password:s,paths:t};return this.client.rest.post(`${He}/copy`,n)}create(e){return this.client.rest.post(He,e)}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(He,s)}favorite(e){return this.client.rest.put(`${He}?path=${encodeURIComponent(e)}`,{is_favorite:!0})}removeFavorite(e){return this.client.rest.put(`${He}?path=${encodeURIComponent(e)}`,{is_favorite:!1})}createItem(e){return this.client.rest.post(He,e)}createWorkDir(e){return this.client.rest.post(He,e)}sizeWithSection(e){return this.client.rest.get(qe,e)}}const Me="/storage/files",Ve=`${Me}/net`;class ze{constructor(e){this.client=e}read(e,t){return t.path=e,this.client.rest.get(Me,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(`${Me}?${s.toString()}`,t)}upload(e,t,s,n){const i=new FormData;i.set("path",s),n&&i.set("divide_id",n.toString()),i.set("file",t);const{promise:r,abort:o}=this.client.rest.upload(Me,i,{onUploadProgress:t=>{e(t)}});return{promise:r,abort:o}}uploadNet(e){return this.client.rest.post(Ve,e)}}class Je{constructor(e){this.client=e}instance(){return this.client.rest.get("/storage/instance")}}const Xe="/storage/element/share";class Ye{constructor(e){this.client=e}info(e){return this.client.rest.get(Xe,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(Xe,s)}change(e){return this.client.rest.put(`${Xe}/${e.token}`,e)}delete(e){return this.client.rest.delete(Xe,{path:e})}refresh(e){return this.client.rest.put(`${Xe}/${e}/refresh`)}}const Ke="/storage/trash",Qe=`${Ke}/element`,Ze=`${Qe}/all`;class et{constructor(e){this.client=e}list(e){return this.client.rest.get(Ke,e)}clear(e){return this.client.rest.delete(Qe,e)}clearAll(){return this.client.rest.delete(Ze)}restore(e){return this.client.rest.patch(Qe,{del_groups:e})}}const tt="/users",st=`${tt}/me`,nt=`${st}/avatars`,it=`${st}/sessions`,rt=`${st}/tokens`,ot=`${st}/params`,ct=`${st}/change-password`;class at{constructor(e){this.client=e}list(e){return this.client.rest.get(tt,e)}get(e){return this.client.rest.get(tt+`/${e}`)}create(e){return this.client.rest.post(tt,e)}update(e,t){return this.client.rest.put(tt+`/${e}`,t)}delete(e,t){return this.client.rest.delete(`${tt}/${e}`,t)}restore(e){return this.client.rest.post(`${tt}/${e}/restore`)}me(){return this.client.rest.get(st)}updateMe(e){return this.client.rest.put(st,e)}createToken(e){return this.client.rest.post(rt,e)}listToken(e){return this.client.rest.get(rt,e)}deleteToken(e){return this.client.rest.delete(`${rt}/${e}`)}changeMyPassword(e){return this.client.rest.put(ct,e)}changeUsersPassword(e,t){return this.client.rest.put(`${tt}/${e}/change-password`,t)}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(nt,s)}meDeleteAvatar(){return this.client.rest.delete(nt)}meListSession(e){return this.client.rest.get(it,e)}meDeleteSession(e){let t=it;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${tt}/${e}/roles`,{role_id:t})}meParams(e){return this.client.rest.get(ot,{name:e})}meSetParams(e,t){return this.client.rest.post(`${ot}/${e}`,t)}meListParams(){return this.client.rest.get(ot)}}const lt="/storage/element",ht=`${lt}/history`,dt=`${lt}/version`,ut=`${dt}/current`,pt=`${dt}/size`;class gt{constructor(e){this.client=e}history(e){return this.client.rest.get(ht,e)}versions(e){return this.client.rest.get(dt,e)}create(e){return this.client.rest.post(dt,e)}edit(e){return this.client.rest.put(dt,e)}delete(e){return this.client.rest.delete(dt,e)}size(e){return this.client.rest.get(pt,e)}makeCurrent(e){return this.client.rest.post(ut,e)}}export{i as AccessRights,n as AuthApiService,se as BASE_URL_V1,ne as BASE_URL_V2,r as CONNECTIONS_PERMISSION,re as Client,a as ConnectionGroup,l as ConnectionType,W as ConnectionsApiService,F as DiscoveryApiService,G as DivideApiService,f as DivideMode,u as DivideScope,c as EngineType,d as ExtensionFileMode,h as ExtensionType,ae as ExtensionsApiService,he as ExtensionsExternalApiService,pe as FcaApiService,_e as GatewayApiService,ve as GroupApiService,be as LicenseApiService,k as LicenseError,Se as LinksApiService,xe as LogstashApiService,ee as NEED_TOKEN_UPDATE_ERROR,b as NotificationAction,De as NotificationApiService,m as NotificationEntityType,w as NotificationRowAction,S as NotificationStyle,o as OrderDirection,p as PermissionType,x as RequestMethod,C as RequestObserve,y as ResponseType,ie as Rest,_ as RestrictionBooleanStatus,v as RestrictionModeKey,A as RestrictionSharing,g as RestrictionStatus,Oe as RoleApiService,E as SettingControlType,je as ShareApiService,Ge as StorageElementApiService,j as StorageElementCheckStatus,O as StorageElementContentType,L as StorageElementHistoryAction,R as StorageElementType,ze as StorageFilesApiService,Je as StorageInstanceApiService,I as StorageRoot,Ye as StorageShareApiService,et as StorageTrashApiService,$ as Tariff,te as TokenUpdate,at as UserApiService,T as UserAuthType,U as UserParamsLabel,P as UserStatus,D as UserType,gt as VersionApiService,X as applyInterceptors,Y as getCookieValue,K as makeUrlParams,Q as normalizeHeaders,Z as prepareRequestBody};
|
|
1
|
+
const e="/login",t=`${e}/ldap`,s=`${e}/update`;class n{constructor(e){this.client=e}info(){return this.client.rest.get(e)}login(t){return this.client.rest.post(e,t)}ldapLogin(e){return this.client.rest.post(t,e)}updateToken(e){const t=e.path?`${e.path}/${s}`:s;return e.path&&delete e.path,this.client.rest.post(t,e)}logout(){return this.client.rest.post("/logout")}}var i;!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.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"}(i||(i={}));const r=[i.ConnectionsYandexDisk,i.ConnectionsSsh,i.ConnectionsMail,i.ConnectionsS3,i.ConnectionsS3,i.ConnectionsDiscord,i.ConnectionsWebdav,i.ConnectionsNextcloud,i.ConnectionsNextbox,i.ConnectionsHttpProxy];var o,c,a,l,h,d,u,p,g,_,f,v,$,k,m,b,w,S,y,x,C,A,T,P,D,U,E,O,R,I,j,L;!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"}(h||(h={})),function(e){e.Read="read",e.ReadAndWrite="read_and_write",e.Write="write"}(d||(d={})),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"}(_||(_={})),function(e){e.User="to_user_id",e.Group="to_user_group_id"}(f||(f={})),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"}(k||(k={})),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"}(m||(m={})),function(e){e.SecurityCheckNegative="action_security_check_negative",e.SecurityCheckPositive="action_security_check_positive",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"}(b||(b={})),function(e){e.Read="read",e.Unread="unread",e.Delete="delete"}(w||(w={})),function(e){e.Plain="plain",e.Success="success",e.Info="info",e.Warning="warning",e.Error="error"}(S||(S={})),function(e){e.ArrayBuffer="arraybuffer",e.Blob="blob",e.Json="json",e.Text="text"}(y||(y={})),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"}(C||(C={})),function(e){e.NONE="none",e.SOFT="soft",e.HARD="hard"}(A||(A={})),function(e){e.Native="native",e.Ldap="ldap",e.Vk="vk"}(T||(T={})),function(e){e.Registering="registering",e.Activated="activated",e.Blocked="blocked",e.BlockedByLicense="blocked_by_license"}(P||(P={})),function(e){e.User="user",e.Guest="guest",e.Emperor="emperor",e.Anonymous="anonymous"}(D||(D={})),function(e){e.Theme="theme",e.Lang="lang",e.Sort="sort"}(U||(U={})),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"}(E||(E={})),function(e){e.Dir="dir",e.File="file",e.WorkDir="work_dir"}(O||(O={})),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"}(R||(R={})),function(e){e.my="my",e.fca="fca",e.divide="divide",e.share="share",e.favorite="favorite",e.trash="trash"}(I||(I={})),function(e){e.Create="create",e.Update="update",e.Move="move"}(j||(j={})),function(e){e[e.CheckNull=0]="CheckNull",e[e.CheckInProgress=1]="CheckInProgress",e[e.CheckPositive=2]="CheckPositive",e[e.CheckNegative=3]="CheckNegative"}(L||(L={}));const N="/connections",H=`${N}/dashboard`;class W{constructor(e){this.client=e}list(e){return this.client.rest.get(N,e)}get(e){return this.client.rest.get(`${N}/${e}`)}update(e,t){return this.client.rest.put(`${N}/${e}`,t)}delete(e){return this.client.rest.delete(`${N}/${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]||N,e)}dashboard(e){return this.client.rest.get(H,e)}}class F{constructor(e){this.client=e}discovery(e){return this.client.rest.get("/discovery",e)}}const q="/divide",B=`${q}/restrictions`;class G{constructor(e){this.client=e}divideDelete(e,t){return this.client.rest.delete(`${e}/${q}/${t}`)}divideDeleteAll(e,t,s,n){return this.client.rest.delete(`${e}/${q}`,Object.assign(Object.assign({},this.makeParam(e,t)),{is_to_user_group:n,access_mode:s}))}divideChange(e,t,s){return this.client.rest.put(`${e}/divide/${t}`,{access_mode:s})}divideCreate(e,t,s,n,i){const r=Object.assign(Object.assign({},this.makeParam(e,t)),{[i]:s,access_mode:n});return this.client.rest.post(`${e}/${q}`,r)}divideUsers(e,t,s){return this.client.rest.get(`${e}/${q}/users`,Object.assign(Object.assign({},this.makeParam(e,t)),s))}getRestriction(e){return this.client.rest.get(`${B}/${e}`)}restrictionSize(e,t){return this.client.rest.get(`/${t}/restrictions/${e}/size`)}restrictions(e){return this.client.rest.get(`${B}`,e)}restrictionsChange(e,t){return this.client.rest.put(`${B}/${e}`,t)}makeParam(e,t){const s={};return e===u.Connection?s.connection_id=t:s.path=t,s}}function M(e,t,s,n){return new(s||(s=Promise))((function(i,r){function o(e){try{a(n.next(e))}catch(e){r(e)}}function c(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,c)}a((n=n.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class V extends Error{}function z(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 J(e,t){if("string"!=typeof e)throw new V("Invalid token specified: must be a string");t||(t={});const s=!0===t.header?0:1,n=e.split(".")[s];if("string"!=typeof n)throw new V(`Invalid token specified: missing part #${s+1}`);let i;try{i=z(n)}catch(e){throw new V(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new V(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}V.prototype.name="InvalidTokenError";const X=(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 Y(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 K=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 Q(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}function Z(e){return e?e instanceof FormData||e instanceof Blob||e instanceof ArrayBuffer||e instanceof URLSearchParams||e instanceof Document||ArrayBuffer.isView(e)?e:"object"==typeof e?JSON.stringify(e):"string"==typeof e?e:null:null}const ee="update black token";class te{constructor(){this.isUpdating=!1,this.tokenUpdateResolve=null}isTokenExpire(e){if(!e)return!1;return 1e3*e<=(new Date).getTime()+3e3}refreshToken(e,t){return M(this,void 0,void 0,(function*(){const{access_token:s,refresh_token:n}=e;return s&&n?this.isUpdating?this.waitForTokenUpdate():(this.isUpdating=!0,new Promise(((e,i)=>{const r=new XMLHttpRequest,o=`${t}${se}/login/update`;r.open("POST",o,!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify({access_token:s,refresh_token:n})),r.onload=()=>{if(r.status>=200&&r.status<300)try{const t=JSON.parse(r.responseText);if(t&&t.access_token&&t.refresh_token){const s={access_token:t.access_token,refresh_token:t.refresh_token};Y("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 e(null)},r.onerror=()=>{i(new Error("Network error occurred"))},r.onloadend=()=>{this.isUpdating=!1}}))):null}))}waitForTokenUpdate(){return M(this,void 0,void 0,(function*(){return new Promise((e=>{const t=setInterval((()=>{this.isUpdating||(clearInterval(t),e())}),100)}))}))}}const se="/api/v1",ne="/api/v2";class ie{constructor(e,t){this.client=e,this.tokenUpdate=t,this.baseHost=""}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))}upload(e,t,s){const n=new AbortController,i=n.signal;return{promise:this.request(x.POST,e,Object.assign({body:t,signal:i},s)),abort:()=>n.abort()}}request(e,t,s){return M(this,void 0,void 0,(function*(){return new Promise(((n,i)=>M(this,void 0,void 0,(function*(){var r;const o=null!==(r=this.state.skipInterceptors)&&void 0!==r&&r;this.state.skipInterceptors=!1;let c=Object.assign({method:e},s);if((null==s?void 0:s.signal)&&(c.signal=s.signal),o||(s=yield X(this.client.requestInterceptors,c)),this.state.authToken)for(const[e,n]of this.state.authToken.entries()){const i=J(n.access_token);if(i&&i.is_remember&&this.tokenUpdate.isTokenExpire(i.exp)&&!t.includes("/login")&&!t.includes("/assets")){const t=yield this.tokenUpdate.refreshToken(n,this.baseHost);t&&(this.state.authToken.set(e,t),s=yield X(this.client.requestInterceptors,c))}}const a=new XMLHttpRequest;(null==s?void 0:s.params)&&0!==Object.keys(s.params).length&&(t+="?"+K(s.params));const l=`${this.state.clientParams.host}${this.state.clientParams.version}${t}`;if(a.open(e,l,!0),null==s?void 0:s.headers){const e=Q(s.headers);for(const[t,s]of Object.entries(e))(this.state.clientParams.host===this.baseHost||"content-type"!==t.toLowerCase())&&a.setRequestHeader(t,s)}(null==s?void 0:s.responseType)&&(a.responseType=s.responseType),(null==s?void 0:s.signal)&&s.signal.addEventListener("abort",(()=>{a.abort(),i(new Error("Upload aborted"))})),a.upload&&[x.POST,x.PUT,x.PATCH].includes(e)&&(a.upload.onprogress=e=>{e.lengthComputable&&(null==s?void 0:s.onUploadProgress)&&s.onUploadProgress(e)}),a.onload=()=>M(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 y.Text:e=a.responseText;break;case y.Blob:case y.ArrayBuffer:e=a.response;break;default:try{e=JSON.parse(a.responseText)}catch(t){e=a.responseText}}const t=new Headers;a.getAllResponseHeaders().split("\r\n").forEach((e=>{const[s,n]=e.split(": ");s&&n&&t.append(s,n)}));let r={status:a.status,statusText:a.statusText,headers:t,url:a.responseURL};if(a.status>=200&&a.status<300)(null==s?void 0:s.observe)===C.Response?n(Object.assign(Object.assign({},r),{body:e})):n(e);else{if(this.state.authToken&&e.code===ee){const e=yield this.tokenUpdate.refreshToken(this.state.authToken.get(0),this.baseHost);e&&this.state.authToken.set(0,e)}s=yield X(this.client.responseInterceptors,Object.assign(Object.assign({},r),{error:e})),i(Object.assign(Object.assign({},r),{error:e}))}r=yield X(this.client.responseInterceptors,r)})),a.onerror=()=>{i({status:a.status,statusText:a.statusText,url:a.responseURL,error:"Network error"})},a.send(Z(null==s?void 0:s.body))}))))}))}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=this.baseHost}}))}}class re{constructor(e){this.AuthApiService=new n(this),this.ConnectionsApiService=new W(this),this.DiscoveryApiService=new F(this),this.DivideApiService=new G(this),this.ExtensionsApiService=new ae(this),this.ExtensionsExternalApiService=new he(this),this.FcaApiService=new pe(this),this.GatewayApiService=new _e(this),this.GroupApiService=new ve(this),this.LicenseApiService=new be(this),this.LinksApiService=new Se(this),this.LogstashApiService=new ye(this),this.NotificationApiService=new Pe(this),this.RoleApiService=new Oe(this),this.ShareApiService=new je(this),this.StorageElementApiService=new Be(this,this.FcaApiService),this.StorageFilesApiService=new Ve(this),this.StorageInstanceApiService=new ze(this),this.StorageShareApiService=new Xe(this),this.StorageTrashApiService=new Qe(this),this.UserApiService=new ot(this),this.VersionApiService=new ut(this),this.tokenUpdate=new te,this.rest=new ie(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,version:(null==e?void 0:e.version)||se},requestParams:{path:"",headers:{},query:{},body:null,cache:"no-cache"},authToken:null,skipInterceptors:!1},this.rest.baseHost=this.state.clientParams.host||""}}const oe="/static/extensions",ce="/extensions/defaults";class ae{constructor(e){this.client=e}getSetting(e){return this.client.rest.get(`${oe}/${e}/settings`)}setSetting(e,t){return this.client.rest.post(`${oe}/${e}/settings`,t)}deleteSetting(e){return this.client.rest.delete(`${oe}/${e}/settings`)}get(e){return this.client.rest.get(`${oe}/${e}`)}getByKey(e){return this.client.rest.get(`${oe}/${e}`)}getDefault(e=[]){return this.client.rest.get(ce,{ext_code:e})}setDefault(e,t){return this.client.rest.post(ce,{ext_code:e,ext_uniq_key:t})}checkUpdates(){return this.client.rest.post(`${oe}/check_updates`)}updateVersion(e,t){return this.client.rest.put(`${oe}/${e}`,{version:t})}list(e){return this.client.rest.get(oe,e)}delete(e,t){return this.client.rest.delete(`${oe}/${e}`)}upload(e,t){const s=new FormData;s.set("file",t);const{promise:n,abort:i}=this.client.rest.upload(oe,s,{onUploadProgress:t=>{e(t)}});return{promise:this.client.rest.changeBaseUrlVersion(ne,(()=>n)),abort:i}}install(e,t){return this.client.rest.changeBaseUrlVersion(ne,(()=>this.client.rest.post(`${oe}/site`,{uniq_key:e,version:t})))}}const le="/anons_ext/extensions";class he{constructor(e){this.client=e}listExtensionsSite(e){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(le,e)))}extensionDetailSite(e){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(`${le}/${e}`)))}extensionMarkdown(e,t){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(`${le}/${e}/readme`,{},t)))}}const de="/disk",ue=`${de}/check`;class pe{constructor(e){this.client=e}info(e,t){return this.client.rest.get(`${de}/${e}/element`,{path:t})}list(e,t){return this.client.rest.get(`${de}/${e}`,t)}create(e,t){return this.client.rest.post(`${de}/${e}/element`,t)}replace(e,t,s){return this.client.rest.put(`${de}/${e}/files?path=${t}`,s)}read(e,t){return this.client.rest.get(`${de}/${e}/files?path=${t}`)}upload(e,t,s,n=""){const i=new FormData;i.set("path",n),i.set("file",s);const{promise:r,abort:o}=this.client.rest.upload(`${de}/${t}/files`,i,{onUploadProgress:t=>{e(t)}});return{promise:r,abort:o}}uploadNet(e,t){return this.client.rest.post(`${de}/${e}/files/net`,t)}delete(e,t){return this.client.rest.delete(`${de}/${e}/trash/element`,{path:t})}check(e){return this.client.rest.post(ue,e)}}const ge="/settings";class _e{constructor(e){this.client=e}settings(){return this.client.rest.get(ge)}changeSettings(e){return this.client.rest.post(ge,e)}queryInit(){return this.client.rest.get("/query/init")}}const fe="/groups";class ve{constructor(e){this.client=e}list(e){return this.client.rest.get(fe,e)}listUsers(e){return this.client.rest.get(`${fe}/${e}/users`)}create(e){return this.client.rest.post(fe,e)}update(e,t){return this.client.rest.put(`${fe}/${e}`,t)}delete(e){return this.client.rest.delete(`${fe}/${e}`)}}const $e="/license",ke=`${$e}/manual-check`,me=`${$e}/hardware/hash`;class be{constructor(e){this.client=e}info(){return this.client.rest.get($e)}create(e){return this.client.rest.post($e,e)}check(){return this.client.rest.post(ke)}delete(){return this.client.rest.delete($e)}getHash(){return this.client.rest.get(me)}}const we="/links";class Se{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post(we,e)}updateShortLink(e){return this.client.rest.put(we,e)}}class ye{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get("/logs/users",e)}}const xe="/notifications",Ce=`${xe}/all`,Ae=`${xe}/subscription`,Te=`${xe}/permission`;class Pe{constructor(e){this.client=e}list(e){return this.client.rest.get(xe,e)}toggleStatus(e,t){return this.client.rest.put(xe,{ids:e,to_status:t})}toggleAllStatus(e){return this.client.rest.put(Ce,{to_status:e})}delete(e){return this.client.rest.delete(xe,{id:e})}deleteAll(){return this.client.rest.delete(Ce)}getPermission(){return this.client.rest.get(Te)}setPermission(e){return this.client.rest.post(Te,{enabled:e})}getSubscription(){return this.client.rest.get(Ae)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(Ae,t)}}const De="/roles",Ue=`${De}/default`,Ee="/permissions";class Oe{constructor(e){this.client=e}list(e){return this.client.rest.get(De,e)}get(e){return this.client.rest.get(`${De}/${e}`)}getDefault(){return this.client.rest.get(`${Ue}`)}create(e){return this.client.rest.post(De,e)}update(e,t){return this.client.rest.put(`${De}/${e}`,t)}delete(e){return this.client.rest.delete(`${De}/${e}`)}permissionList(){return this.client.rest.get(Ee)}addPermission(e,t){return this.client.rest.put(`${De}/${e}/permissions`,{ids:t})}deletePermission(e,t){return this.client.rest.delete(`${De}/${e}/${Ee}`,{ids:t})}}const Re="/share",Ie=`${Re}/restrictions`;class je{constructor(e){this.client=e}info(e,t){const s=new URLSearchParams({path:e,share_token:t});return this.client.rest.get(`${Re}?${s.toString()}`)}checkPassword(e,t){const s=encodeURIComponent(e);return this.client.rest.get(`${Re}/password?share_token=${t}&share_pass=${s}`)}checkToken(e){return this.client.rest.get(`${Re}?share_token=${e}`)}getRestriction(e){return this.client.rest.get(`${Ie}/${e}`)}restrictions(e){return this.client.rest.get(Ie,e)}restrictionsChange(e,t){return this.client.rest.put(`${Ie}/${e}`,t)}}const Le="/storage",Ne=`${Le}/element`,He=`${Ne}/move`,We=`${Ne}/copy`,Fe=`${Ne}/content_type_size`,qe="/disk";class Be{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(Le,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(Ne,e)}combineInfo({root:e,rootId:t,path:s,file_version_id:n}){return e===I.fca&&t?this.fcaApiService.info(t,s):this.info({path:s,divide_id:t,file_version_id:n})}size(e){return this.client.rest.post(`${Ne}/size`,e)}move(e,t,s){const{from_divide_id:n,to_divide_id:i}=e;let r=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return t===I.fca&&s===I.fca?this.client.rest.post(`${qe}/${n}/files/move${qe}/${i}`,r):t===I.fca?(n&&(r.from_divide_id=n),this.client.rest.put(`${qe}/${i}/files/from/box`,r)):s===I.fca?(i&&(r.to_divide_id=i),this.client.rest.put(`${qe}/${n}/files/to/box`,r)):this.client.rest.post(He,e)}copy(e,t,s){const{from_divide_id:n,to_divide_id:i}=e;let r=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return s===I.fca&&t===I.fca?this.client.rest.post(`${qe}/${n}/files/copy${qe}/${i}`,r):s===I.fca?(n&&(r.from_divide_id=n),this.client.rest.post(`${qe}/${i}/files/from/box`,r)):t===I.fca?(i&&(r.to_divide_id=i),this.client.rest.post(`${qe}/${n}/files/to/box`,r)):this.client.rest.post(We,e)}pasteFromShared(e,t,s){const n={from_sharing_token:e,from_sharing_password:s,paths:t};return this.client.rest.post(`${Ne}/copy`,n)}create(e){return this.client.rest.post(Ne,e)}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(Ne,s)}favorite(e){return this.client.rest.put(`${Ne}?path=${encodeURIComponent(e)}`,{is_favorite:!0})}removeFavorite(e){return this.client.rest.put(`${Ne}?path=${encodeURIComponent(e)}`,{is_favorite:!1})}createItem(e){return this.client.rest.post(Ne,e)}createWorkDir(e){return this.client.rest.post(Ne,e)}sizeWithSection(e){return this.client.rest.get(Fe,e)}}const Ge="/storage/files",Me=`${Ge}/net`;class Ve{constructor(e){this.client=e}read(e,t){return t.path=e,this.client.rest.get(Ge,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(`${Ge}?${s.toString()}`,t)}upload(e,t,s,n){const i=new FormData;i.set("path",s),n&&i.set("divide_id",n.toString()),i.set("file",t);const{promise:r,abort:o}=this.client.rest.upload(Ge,i,{onUploadProgress:t=>{e(t)}});return{promise:r,abort:o}}uploadNet(e){return this.client.rest.post(Me,e)}}class ze{constructor(e){this.client=e}instance(){return this.client.rest.get("/storage/instance")}}const Je="/storage/element/share";class Xe{constructor(e){this.client=e}info(e){return this.client.rest.get(Je,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(Je,s)}change(e){return this.client.rest.put(`${Je}/${e.token}`,e)}delete(e){return this.client.rest.delete(Je,{path:e})}refresh(e){return this.client.rest.put(`${Je}/${e}/refresh`)}}const Ye="/storage/trash/element",Ke=`${Ye}/all`;class Qe{constructor(e){this.client=e}clear(e){return this.client.rest.delete(Ye,e)}clearAll(){return this.client.rest.delete(Ke)}restore(e){return this.client.rest.patch(Ye,{del_groups:e})}restoreAll(){return this.client.rest.patch(Ke)}}const Ze="/users",et=`${Ze}/me`,tt=`${et}/avatars`,st=`${et}/sessions`,nt=`${et}/tokens`,it=`${et}/params`,rt=`${et}/change-password`;class ot{constructor(e){this.client=e}list(e){return this.client.rest.get(Ze,e)}get(e){return this.client.rest.get(Ze+`/${e}`)}create(e){return this.client.rest.post(Ze,e)}update(e,t){return this.client.rest.put(Ze+`/${e}`,t)}delete(e,t){return this.client.rest.delete(`${Ze}/${e}`,t)}restore(e){return this.client.rest.post(`${Ze}/${e}/restore`)}me(){return this.client.rest.get(et)}updateMe(e){return this.client.rest.put(et,e)}createToken(e){return this.client.rest.post(nt,e)}listToken(e){return this.client.rest.get(nt,e)}deleteToken(e){return this.client.rest.delete(`${nt}/${e}`)}changeMyPassword(e){return this.client.rest.put(rt,e)}changeUsersPassword(e,t){return this.client.rest.put(`${Ze}/${e}/change-password`,t)}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(tt,s)}meDeleteAvatar(){return this.client.rest.delete(tt)}meListSession(e){return this.client.rest.get(st,e)}meDeleteSession(e){let t=st;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${Ze}/${e}/roles`,{role_id:t})}meParams(e){return this.client.rest.get(it,{name:e})}meSetParams(e,t){return this.client.rest.post(`${it}/${e}`,t)}meListParams(){return this.client.rest.get(it)}}const ct="/storage/element",at=`${ct}/history`,lt=`${ct}/version`,ht=`${lt}/current`,dt=`${lt}/size`;class ut{constructor(e){this.client=e}history(e){return this.client.rest.get(at,e)}versions(e){return this.client.rest.get(lt,e)}create(e){return this.client.rest.post(lt,e)}edit(e){return this.client.rest.put(lt,e)}delete(e){return this.client.rest.delete(lt,e)}size(e){return this.client.rest.get(dt,e)}makeCurrent(e){return this.client.rest.post(ht,e)}}export{i as AccessRights,n as AuthApiService,se as BASE_URL_V1,ne as BASE_URL_V2,r as CONNECTIONS_PERMISSION,re as Client,a as ConnectionGroup,l as ConnectionType,W as ConnectionsApiService,F as DiscoveryApiService,G as DivideApiService,f as DivideMode,u as DivideScope,c as EngineType,d as ExtensionFileMode,h as ExtensionType,ae as ExtensionsApiService,he as ExtensionsExternalApiService,pe as FcaApiService,_e as GatewayApiService,ve as GroupApiService,be as LicenseApiService,k as LicenseError,Se as LinksApiService,ye as LogstashApiService,ee as NEED_TOKEN_UPDATE_ERROR,b as NotificationAction,Pe as NotificationApiService,m as NotificationEntityType,w as NotificationRowAction,S as NotificationStyle,o as OrderDirection,p as PermissionType,x as RequestMethod,C as RequestObserve,y as ResponseType,ie as Rest,_ as RestrictionBooleanStatus,v as RestrictionModeKey,A as RestrictionSharing,g as RestrictionStatus,Oe as RoleApiService,E as SettingControlType,je as ShareApiService,Be as StorageElementApiService,L as StorageElementCheckStatus,R as StorageElementContentType,j as StorageElementHistoryAction,O as StorageElementType,Ve as StorageFilesApiService,ze as StorageInstanceApiService,I as StorageRoot,Xe as StorageShareApiService,Qe as StorageTrashApiService,$ as Tariff,te as TokenUpdate,ot as UserApiService,T as UserAuthType,U as UserParamsLabel,P as UserStatus,D as UserType,ut as VersionApiService,X as applyInterceptors,Y as getCookieValue,K as makeUrlParams,Q as normalizeHeaders,Z as prepareRequestBody};
|
package/dist/index.d.ts
CHANGED
|
@@ -41,7 +41,8 @@ declare enum StorageRoot {
|
|
|
41
41
|
fca = "fca",
|
|
42
42
|
divide = "divide",
|
|
43
43
|
share = "share",
|
|
44
|
-
favorite = "favorite"
|
|
44
|
+
favorite = "favorite",
|
|
45
|
+
trash = "trash"
|
|
45
46
|
}
|
|
46
47
|
interface StorageRouteData {
|
|
47
48
|
path: string;
|
|
@@ -309,7 +310,6 @@ declare enum AccessRights {
|
|
|
309
310
|
RestrictionDivideRead = "restriction_divide_read",// Просмотр
|
|
310
311
|
RestrictionDivideWrite = "restriction_divide_write",// Управление доступами
|
|
311
312
|
ReadUserLogs = "read_user_logs",// Просмотр пользовательских логов
|
|
312
|
-
ReadSystemLogs = "read_system_logs",// Просмотр системных логов
|
|
313
313
|
ConnectionsRead = "connections_read",// Просмотр
|
|
314
314
|
ConnectionsDividing = "connections_dividing",// Предоставление доступа(поделиться)
|
|
315
315
|
ConnectionsYandexDisk = "connections_yandex_disk",// Yandex диск
|
|
@@ -817,28 +817,9 @@ interface UsersLog {
|
|
|
817
817
|
ip: string;
|
|
818
818
|
}
|
|
819
819
|
|
|
820
|
-
|
|
821
|
-
content_type: StorageElementContentType;
|
|
820
|
+
type StorageTrashElement = StorageElement & {
|
|
822
821
|
del_group_id: number;
|
|
823
|
-
|
|
824
|
-
full_path: string;
|
|
825
|
-
name: string;
|
|
826
|
-
path: string;
|
|
827
|
-
size: number;
|
|
828
|
-
type: StorageElementType;
|
|
829
|
-
update_date: string;
|
|
830
|
-
version: VersionStorageTrashElement;
|
|
831
|
-
with_preview: boolean;
|
|
832
|
-
}
|
|
833
|
-
interface VersionStorageTrashElement {
|
|
834
|
-
create_date: string;
|
|
835
|
-
description: string;
|
|
836
|
-
id: string;
|
|
837
|
-
name: string | null;
|
|
838
|
-
size: number;
|
|
839
|
-
update_date: string;
|
|
840
|
-
user_id: number;
|
|
841
|
-
}
|
|
822
|
+
};
|
|
842
823
|
type StorageTrashItem = Pick<StorageTrashElement, 'del_group_id' | 'path'>;
|
|
843
824
|
|
|
844
825
|
declare const BASE_URL_V1 = "/api/v1";
|
|
@@ -1001,6 +982,7 @@ interface RequestStorageListParams extends RequestBaseParams {
|
|
|
1001
982
|
is_favorite?: boolean;
|
|
1002
983
|
is_divided?: boolean;
|
|
1003
984
|
divide_id?: number | null;
|
|
985
|
+
is_trash?: boolean;
|
|
1004
986
|
path?: string;
|
|
1005
987
|
min_size?: number | null;
|
|
1006
988
|
max_size?: number | null;
|
|
@@ -1144,7 +1126,6 @@ declare class LogstashApiService {
|
|
|
1144
1126
|
private client;
|
|
1145
1127
|
constructor(client: Client);
|
|
1146
1128
|
getUsersLogs(params: RequestUsersLogParams): Promise<ResponseList<UsersLog>>;
|
|
1147
|
-
getSystemLogs(path: string, start: number, end: number): Promise<HttpResponse<string>>;
|
|
1148
1129
|
}
|
|
1149
1130
|
interface RequestUsersLogParams extends RequestBaseParams {
|
|
1150
1131
|
user_id?: string;
|
|
@@ -1230,10 +1211,10 @@ declare class StorageShareApiService {
|
|
|
1230
1211
|
declare class StorageTrashApiService {
|
|
1231
1212
|
private client;
|
|
1232
1213
|
constructor(client: Client);
|
|
1233
|
-
list(params: RequestStorageListParams): Promise<ResponseList<StorageTrashElement>>;
|
|
1234
1214
|
clear(item: StorageTrashItem): Promise<void>;
|
|
1235
1215
|
clearAll(): Promise<void>;
|
|
1236
1216
|
restore(del_groups: StorageTrashItem[]): Promise<void>;
|
|
1217
|
+
restoreAll(): Promise<void>;
|
|
1237
1218
|
}
|
|
1238
1219
|
|
|
1239
1220
|
declare class UserApiService {
|
|
@@ -17,7 +17,6 @@ export declare enum AccessRights {
|
|
|
17
17
|
RestrictionDivideRead = "restriction_divide_read",// Просмотр
|
|
18
18
|
RestrictionDivideWrite = "restriction_divide_write",// Управление доступами
|
|
19
19
|
ReadUserLogs = "read_user_logs",// Просмотр пользовательских логов
|
|
20
|
-
ReadSystemLogs = "read_system_logs",// Просмотр системных логов
|
|
21
20
|
ConnectionsRead = "connections_read",// Просмотр
|
|
22
21
|
ConnectionsDividing = "connections_dividing",// Предоставление доступа(поделиться)
|
|
23
22
|
ConnectionsYandexDisk = "connections_yandex_disk",// Yandex диск
|
|
@@ -1,25 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
content_type: StorageElementContentType;
|
|
1
|
+
import { StorageElement } from './storage';
|
|
2
|
+
export type StorageTrashElement = StorageElement & {
|
|
4
3
|
del_group_id: number;
|
|
5
|
-
|
|
6
|
-
full_path: string;
|
|
7
|
-
name: string;
|
|
8
|
-
path: string;
|
|
9
|
-
size: number;
|
|
10
|
-
type: StorageElementType;
|
|
11
|
-
update_date: string;
|
|
12
|
-
version: VersionStorageTrashElement;
|
|
13
|
-
with_preview: boolean;
|
|
14
|
-
}
|
|
15
|
-
interface VersionStorageTrashElement {
|
|
16
|
-
create_date: string;
|
|
17
|
-
description: string;
|
|
18
|
-
id: string;
|
|
19
|
-
name: string | null;
|
|
20
|
-
size: number;
|
|
21
|
-
update_date: string;
|
|
22
|
-
user_id: number;
|
|
23
|
-
}
|
|
4
|
+
};
|
|
24
5
|
export type StorageTrashItem = Pick<StorageTrashElement, 'del_group_id' | 'path'>;
|
|
25
|
-
export {};
|
package/dist/types/storage.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Client } from '../classes';
|
|
2
|
-
import { NotificationActionGroup, NotificationRowAction, RequestNotificationListParams, ResponseListNotification } from '../types';
|
|
3
|
-
export declare class NotificationsApiService {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(client: Client);
|
|
6
|
-
list(params?: RequestNotificationListParams): Promise<ResponseListNotification>;
|
|
7
|
-
toggleStatus(ids: number[], to_status: NotificationRowAction): Promise<void>;
|
|
8
|
-
toggleAllStatus(to_status: NotificationRowAction): Promise<void>;
|
|
9
|
-
delete(id: number[]): Promise<void>;
|
|
10
|
-
deleteAll(): Promise<void>;
|
|
11
|
-
getPermission(): Promise<{
|
|
12
|
-
enabled: boolean;
|
|
13
|
-
}>;
|
|
14
|
-
setPermission(permission: boolean): Promise<void>;
|
|
15
|
-
getSubscription(): Promise<NotificationActionGroup>;
|
|
16
|
-
setSubscription(data: NotificationActionGroup): Promise<void>;
|
|
17
|
-
}
|
|
@@ -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
|
-
}
|
|
@@ -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>;
|
package/dist/types/group.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { RequestBaseParams } from './base';
|
|
2
|
-
import { UserLabel } from './user';
|
|
3
|
-
export interface Group {
|
|
4
|
-
id: number;
|
|
5
|
-
name: string;
|
|
6
|
-
description: string;
|
|
7
|
-
amount_users: number;
|
|
8
|
-
create_date: string;
|
|
9
|
-
owner_id: number;
|
|
10
|
-
owner: UserLabel;
|
|
11
|
-
update_date: string;
|
|
12
|
-
icon: string;
|
|
13
|
-
icon_color: string;
|
|
14
|
-
}
|
|
15
|
-
export interface RequestGroupListParams extends RequestBaseParams {
|
|
16
|
-
id?: number[];
|
|
17
|
-
name?: string;
|
|
18
|
-
description?: string;
|
|
19
|
-
search_field?: string;
|
|
20
|
-
}
|
|
21
|
-
export type CreateGroupParams = Pick<Group, 'name' | 'description'> & {
|
|
22
|
-
users?: number[];
|
|
23
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ResponseList } from './base';
|
|
2
|
-
import { Extension, ExtensionDefault } from './extension';
|
|
3
|
-
import { License } from './license';
|
|
4
|
-
import { LockScreen } from './lock-screen';
|
|
5
|
-
import { UserNotification } from './notification';
|
|
6
|
-
import { Restriction } from './restriction';
|
|
7
|
-
import { User } from './user';
|
|
8
|
-
export interface QueryInit {
|
|
9
|
-
license?: License;
|
|
10
|
-
unread_notifications?: ResponseList<UserNotification> & {
|
|
11
|
-
total_all: number;
|
|
12
|
-
};
|
|
13
|
-
extensions_apps?: ResponseList<Extension>;
|
|
14
|
-
extensions_defaults: ResponseList<ExtensionDefault>;
|
|
15
|
-
me?: User;
|
|
16
|
-
cache_users: User[];
|
|
17
|
-
lock_screen: LockScreen;
|
|
18
|
-
restrictions?: Restriction;
|
|
19
|
-
open_in_desktop_settings: {
|
|
20
|
-
open_in_desktop_enabled: boolean;
|
|
21
|
-
};
|
|
22
|
-
inject_scripts?: string[];
|
|
23
|
-
}
|
package/dist/types/role.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { RequestBaseParams } from './base';
|
|
2
|
-
export interface Role {
|
|
3
|
-
id: number;
|
|
4
|
-
name: string;
|
|
5
|
-
description: string;
|
|
6
|
-
create_date: string;
|
|
7
|
-
update_date: string;
|
|
8
|
-
is_default: boolean;
|
|
9
|
-
owner_id: number;
|
|
10
|
-
grant_access_all: boolean;
|
|
11
|
-
permissions_id?: number[];
|
|
12
|
-
}
|
|
13
|
-
export interface RequestRoleListParams extends RequestBaseParams {
|
|
14
|
-
id?: number[];
|
|
15
|
-
search_field?: string;
|
|
16
|
-
}
|
|
17
|
-
export type CreateRoleParams = Pick<Role, 'name' | 'description' | 'grant_access_all' | 'is_default'>;
|