nb-js-client 0.0.57 → 0.0.58
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/gateway-api.service.d.ts +2 -0
- package/dist/api/version-api.service.d.ts +8 -1
- package/dist/bundle.cjs.js +1 -1
- package/dist/bundle.esm.js +1 -1
- package/dist/classes/rest.d.ts +1 -1
- package/dist/index.d.ts +19 -2
- package/dist/types/file-locking.d.ts +4 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/storage.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Client } from '../classes';
|
|
2
2
|
import { Extension, ExtensionDefault, License, LockScreen, ResponseList, Restriction, Setting, SettingValue, User, UserNotification } from '../types';
|
|
3
|
+
import { FileLocking } from '../types/file-locking';
|
|
3
4
|
export declare class GatewayApiService {
|
|
4
5
|
private client;
|
|
5
6
|
constructor(client: Client);
|
|
@@ -18,6 +19,7 @@ export interface QueryInitResponse {
|
|
|
18
19
|
cache_users: User[];
|
|
19
20
|
lock_screen: LockScreen;
|
|
20
21
|
view_type: QueryInitViewType;
|
|
22
|
+
file_locking: FileLocking;
|
|
21
23
|
restrictions?: Restriction;
|
|
22
24
|
open_in_desktop_settings: {
|
|
23
25
|
open_in_desktop_enabled: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client } from '../classes';
|
|
2
|
-
import { HistoryNote, RequestBaseParams, ResponseItem, ResponseList, StorageElementHistory, StorageElementVersion } from '../types';
|
|
2
|
+
import { HistoryNote, RequestBaseParams, ResponseItem, ResponseList, StorageElementHistory, StorageElementVersion, StorageElementVersionLock } from '../types';
|
|
3
3
|
export declare class VersionApiService {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: Client);
|
|
@@ -10,6 +10,8 @@ export declare class VersionApiService {
|
|
|
10
10
|
delete(params: HistoryRequestParams): Promise<void>;
|
|
11
11
|
size(params: HistoryRequestParams): Promise<number>;
|
|
12
12
|
makeCurrent(params: HistoryRequestParams): Promise<void>;
|
|
13
|
+
lock(params: VersionLockRequestParams): Promise<StorageElementVersionLock>;
|
|
14
|
+
unlock(params: VersionLockRequestParams): Promise<void>;
|
|
13
15
|
}
|
|
14
16
|
export type HistoryListRequestParams = HistoryRequestParams & RequestBaseParams;
|
|
15
17
|
export interface HistoryRequestParams {
|
|
@@ -17,3 +19,8 @@ export interface HistoryRequestParams {
|
|
|
17
19
|
divide_id?: number | null;
|
|
18
20
|
file_version_id?: string;
|
|
19
21
|
}
|
|
22
|
+
export interface VersionLockRequestParams {
|
|
23
|
+
path: string;
|
|
24
|
+
file_version_id: string;
|
|
25
|
+
divide_id?: number;
|
|
26
|
+
}
|
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.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,$,m,y,k,b,A,T,w,R,C,E,U,D,P,O,L,N,I,j,q;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.LimitationType=void 0,($=exports.LimitationType||(exports.LimitationType={})).BySize="size",$.ByExt="extension",exports.LimitationSubType=void 0,(m=exports.LimitationSubType||(exports.LimitationSubType={})).Size="size",m.White="extension_white",m.Black="extension_black",exports.NotificationEntityType=void 0,(y=exports.NotificationEntityType||(exports.NotificationEntityType={})).Dir="dir",y.File="file",y.User="user",y.Other="other",y.WorkDir="work_dir",y.License="license",y.Extension="extension",y.Connection="connection",exports.NotificationAction=void 0,(k=exports.NotificationAction||(exports.NotificationAction={})).SecurityCheckNegative="action_security_check_negative",k.SecurityCheckPositive="action_security_check_positive",k.OpenSharing="open_sharing",k.ChangeSharing="change_sharing",k.CancelSharing="cancel_sharing",k.DivideDirAddFileToOwner="divide_dir_add_file_to_owner",k.DivideDirAddDirToOwner="divide_dir_add_dir_to_owner",k.DivideDirAddWorkDirToOwner="divide_dir_add_work_dir_to_owner",k.DivideConnectionAddFileToOwner="divide_connection_add_file_to_owner",k.DivideConnectionAddDirToOwner="divide_connection_add_dir_to_owner",k.CancelDivideDir="cancel_divide_dir",k.CancelDivideFile="cancel_divide_file",k.CancelDivideWorkDir="cancel_divide_work_dir",k.CancelDivideConnection="cancel_divide_connection",k.DeleteExtension="delete_extension",k.NewVersionExtension="new_version_extension",k.TransferData="transfer_data",k.AllowInternalAccessUser="allow_internal_access_to_user",k.BlockInternalAccessUser="block_internal_access_to_user",k.WaitInternalAccessUser="wait_internal_access_to_user",k.WaitInternalAccessUserCreate="wait_internal_access_to_user_create",k.AllowInternalAccessGroup="allow_internal_access_to_group",k.BlockInternalAccessGroup="block_internal_access_to_group",k.WaitInternalAccessGroup="wait_internal_access_to_group",k.WaitInternalAccessGroupCreate="wait_internal_access_to_group_create",k.AllowSharing="allow_sharing",k.BlockSharing="block_sharing",k.WaitSharing="wait_sharing",k.WaitSharingCreate="wait_sharing_create",k.Other="other",exports.NotificationRowAction=void 0,(b=exports.NotificationRowAction||(exports.NotificationRowAction={})).Read="read",b.Unread="unread",b.Delete="delete",exports.NotificationStyle=void 0,(A=exports.NotificationStyle||(exports.NotificationStyle={})).Plain="plain",A.Success="success",A.Info="info",A.Warning="warning",A.Error="error",exports.ResponseType=void 0,(T=exports.ResponseType||(exports.ResponseType={})).ArrayBuffer="arraybuffer",T.Blob="blob",T.Json="json",T.Text="text",exports.RequestMethod=void 0,(w=exports.RequestMethod||(exports.RequestMethod={})).GET="GET",w.POST="POST",w.PUT="PUT",w.PATCH="PATCH",w.DELETE="DELETE",exports.RequestObserve=void 0,(R=exports.RequestObserve||(exports.RequestObserve={})).Body="body",R.Response="response",exports.RestrictionSharing=void 0,(C=exports.RestrictionSharing||(exports.RestrictionSharing={})).NONE="none",C.SOFT="soft",C.HARD="hard",exports.UserAuthType=void 0,(E=exports.UserAuthType||(exports.UserAuthType={})).Native="native",E.Ldap="ldap",E.Vk="vk",exports.UserStatus=void 0,(U=exports.UserStatus||(exports.UserStatus={})).Registering="registering",U.Activated="activated",U.Blocked="blocked",U.BlockedByLicense="blocked_by_license",exports.UserType=void 0,(D=exports.UserType||(exports.UserType={})).User="user",D.Guest="guest",D.Emperor="emperor",D.Anonymous="anonymous",exports.UserParamsLabel=void 0,(P=exports.UserParamsLabel||(exports.UserParamsLabel={})).Theme="theme",P.Lang="lang",P.Sort="sort",exports.SettingControlType=void 0,(O=exports.SettingControlType||(exports.SettingControlType={})).Text="text",O.String="string",O.Number="number",O.CheckBox="checkbox",O.Select="select",O.RadioList="radio_list",O.ConnectionChoose="connection_choose",O.MultiConnectionChoose="multi_connection_choose",exports.StorageElementType=void 0,(L=exports.StorageElementType||(exports.StorageElementType={})).Dir="dir",L.File="file",L.WorkDir="work_dir",exports.StorageElementContentType=void 0,(N=exports.StorageElementContentType||(exports.StorageElementContentType={})).Any="any",N.Dir="dir",N.Code="code",N.Image="image",N.Audio="audio",N.Video="video",N.Text="text",N.Doc="doc",N.Xls="xls",N.Ppt="ppt",exports.StorageRoot=void 0,(I=exports.StorageRoot||(exports.StorageRoot={})).my="my",I.fca="fca",I.divide="divide",I.share="share",I.favorite="favorite",I.trash="trash",exports.StorageElementHistoryAction=void 0,(j=exports.StorageElementHistoryAction||(exports.StorageElementHistoryAction={})).Create="create",j.Update="update",j.Move="move",exports.StorageElementCheckStatus=void 0,(q=exports.StorageElementCheckStatus||(exports.StorageElementCheckStatus={}))[q.CheckNull=0]="CheckNull",q[q.CheckInProgress=1]="CheckInProgress",q[q.CheckPositive=2]="CheckPositive",q[q.CheckNegative=3]="CheckNegative";const M="/connections",H=`${M}/dashboard`;class B{constructor(e){this.client=e}list(e){return this.client.rest.get(M,e)}get(e){return this.client.rest.get(`${M}/${e}`)}update(e,t){return this.client.rest.put(`${M}/${e}`,t)}delete(e){return this.client.rest.delete(`${M}/${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]||M,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 W="/divide",G=`${W}/restrictions`;class V{constructor(e){this.client=e}divideDelete(e,t){return this.client.rest.delete(`${e}/${W}/${t}`)}divideDeleteAll(e,t,s,r){return this.client.rest.delete(`${e}/${W}`,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}/${W}`,n)}divideUsers(e,t,s){return this.client.rest.get(`${e}/${W}/users`,Object.assign(Object.assign({},this.makeParam(e,t)),s))}getRestriction(e){return this.client.rest.get(`${G}/${e}`)}restrictionSize(e,t){return this.client.rest.get(`/${t}/restrictions/${e}/size`)}restrictions(e){return this.client.rest.get(`${G}`,e)}restrictionsChange(e,t){return this.client.rest.put(`${G}/${e}`,t)}makeParam(e,t){const s={};return e===exports.DivideScope.Connection?s.connection_id=t:s.path=t,s}}function z(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 J extends Error{}function K(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 Q(e,t){if("string"!=typeof e)throw new J("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 J(`Invalid token specified: missing part #${s+1}`);let i;try{i=K(r)}catch(e){throw new J(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new J(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}J.prototype.name="InvalidTokenError";const X=(e,t)=>z(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 Z=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 ee(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}function te(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 se="update black token";class re{constructor(){this.isUpdating=!1,this.tokenUpdateResolve=null}isTokenExpire(e){if(!e)return!1;return 1e3*e<=(new Date).getTime()+3e3}refreshToken(e,t){return z(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}${ie}/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};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)},n.onerror=()=>{i(new Error("Network error occurred"))},n.onloadend=()=>{this.isUpdating=!1}}))):null}))}waitForTokenUpdate(){return z(this,void 0,void 0,(function*(){return new Promise((e=>{const t=setInterval((()=>{this.isUpdating||(clearInterval(t),e())}),100)}))}))}}const ie="/api/v1",ne="/api/v2";class oe{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 z(this,void 0,void 0,(function*(){return new Promise(((r,i)=>z(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 X(this.client.requestInterceptors,c)),this.state.authToken)for(const[e,r]of this.state.authToken.entries()){const i=Q(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 X(this.client.requestInterceptors,c))}}const a=new XMLHttpRequest;(null==s?void 0:s.params)&&0!==Object.keys(s.params).length&&(t+="?"+Z(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=ee(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=()=>z(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===se){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({},n),{error:e})),i(Object.assign(Object.assign({},n),{error:e}))}n=yield X(this.client.responseInterceptors,n)})),a.onerror=()=>{i({status:a.status,statusText:a.statusText,url:a.responseURL,error:"Network error"})},a.send(te(null==s?void 0:s.body))}))))}))}changeBaseUrlVersion(e,t){return z(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 z(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 ce="/static/extensions",ae="/extensions/defaults",le=`${ce}/names/users`,pe=`${ce}/names/system`;class de{constructor(e){this.client=e}getSetting(e){return this.client.rest.get(`${ce}/${e}/settings`)}setSetting(e,t){return this.client.rest.post(`${ce}/${e}/settings`,t)}deleteSetting(e){return this.client.rest.delete(`${ce}/${e}/settings`)}get(e){return this.client.rest.get(`${ce}/${e}`)}getByKey(e){return this.client.rest.get(`${ce}/${e}`)}getDefault(e=[]){return this.client.rest.get(ae,{ext_code:e})}setDefault(e,t){return this.client.rest.post(ae,{ext_code:e,ext_uniq_key:t})}checkUpdates(){return this.client.rest.post(`${ce}/check_updates`)}updateVersion(e,t){return this.client.rest.put(`${ce}/${e}`,{version:t})}list(e){return this.client.rest.get(ce,e)}delete(e,t){return this.client.rest.delete(`${ce}/${e}`)}upload(e,t){const s=new FormData;s.set("file",t);const{promise:r,abort:i}=this.client.rest.upload(ce,s,{onUploadProgress:t=>{e(t)}});return{promise:this.client.rest.changeBaseUrlVersion(ne,(()=>r)),abort:i}}install(e,t){return this.client.rest.changeBaseUrlVersion(ne,(()=>this.client.rest.post(`${ce}/site`,{uniq_key:e,version:t})))}getSystemNameExts(e){return this.client.rest.get(pe,e)}getUserNameExts(e){return this.client.rest.get(le,e)}createUserNameExt(e){return this.client.rest.post(`${le}`,{name:e})}deleteUserNameExt(e){return this.client.rest.delete(`${le}/${e}`)}deleteAllUserNameExts(){return this.client.rest.delete(`${le}`)}}const he="/anons_ext/extensions";class ue{constructor(e){this.client=e}listExtensionsSite(e){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(he,e)))}extensionDetailSite(e){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(`${he}/${e}`)))}extensionMarkdown(e,t){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(`${he}/${e}/readme`,{},t)))}}const ge="/disk",xe=`${ge}/check`;class ve{constructor(e){this.client=e}info(e,t){return this.client.rest.get(`${ge}/${e}/element`,{path:t})}list(e,t){return this.client.rest.get(`${ge}/${e}`,t)}create(e,t){return this.client.rest.post(`${ge}/${e}/element`,t)}replace(e,t,s){return this.client.rest.put(`${ge}/${e}/files?path=${t}`,s)}read(e,t){return this.client.rest.get(`${ge}/${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(`${ge}/${t}/files`,i,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e,t){return this.client.rest.post(`${ge}/${e}/files/net`,t)}delete(e,t){return this.client.rest.delete(`${ge}/${e}/trash/element`,{path:t})}check(e){return this.client.rest.post(xe,e)}}const _e="/settings";class Se{constructor(e){this.client=e}settings(){return this.client.rest.get(_e)}changeSettings(e){return this.client.rest.post(_e,e)}queryInit(){return this.client.rest.get("/query/init")}}var fe;exports.QueryInitViewType=void 0,(fe=exports.QueryInitViewType||(exports.QueryInitViewType={})).Standard="Standard",fe.Simple="Simple";const $e="/groups";class me{constructor(e){this.client=e}list(e){return this.client.rest.get($e,e)}listUsers(e){return this.client.rest.get(`${$e}/${e}/users`)}create(e){return this.client.rest.post($e,e)}update(e,t){return this.client.rest.put(`${$e}/${e}`,t)}delete(e){return this.client.rest.delete(`${$e}/${e}`)}}const ye="/license",ke=`${ye}/manual-check`,be=`${ye}/hardware/hash`;class Ae{constructor(e){this.client=e}info(){return this.client.rest.get(ye)}create(e){return this.client.rest.post(ye,e)}check(){return this.client.rest.post(ke)}delete(){return this.client.rest.delete(ye)}getHash(){return this.client.rest.get(be)}}const Te="/links";class we{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post(Te,e)}updateShortLink(e){return this.client.rest.put(Te,e)}}const Re="/limitations";class Ce{constructor(e){this.client=e}list(e){return this.client.rest.get(Re,e)}listUsers(e){return this.client.rest.get(`${Re}/${e}/users`)}create(e){return this.client.rest.post(Re,e)}get(e){return this.client.rest.get(`${Re}/${e}`)}update(e,t){return this.client.rest.put(`${Re}/${e}`,t)}delete(e){return this.client.rest.delete(`${Re}/${e}`)}}class Ee{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get("/logs/users",e)}}const Ue="/notifications",De=`${Ue}/all`,Pe=`${Ue}/subscription`,Oe=`${Ue}/permission`;class Le{constructor(e){this.client=e}list(e){return this.client.rest.get(Ue,e)}toggleStatus(e,t){return this.client.rest.put(Ue,{ids:e,to_status:t})}toggleAllStatus(e){return this.client.rest.put(De,{to_status:e})}delete(e){return this.client.rest.delete(Ue,{id:e})}deleteAll(){return this.client.rest.delete(De)}getPermission(){return this.client.rest.get(Oe)}setPermission(e){return this.client.rest.post(Oe,{enabled:e})}getSubscription(){return this.client.rest.get(Pe)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(Pe,t)}}const Ne="/roles",Ie=`${Ne}/default`,je="/permissions";class qe{constructor(e){this.client=e}list(e){return this.client.rest.get(Ne,e)}get(e){return this.client.rest.get(`${Ne}/${e}`)}getDefault(){return this.client.rest.get(`${Ie}`)}create(e){return this.client.rest.post(Ne,e)}update(e,t){return this.client.rest.put(`${Ne}/${e}`,t)}delete(e){return this.client.rest.delete(`${Ne}/${e}`)}permissionList(){return this.client.rest.get(je)}addPermission(e,t){return this.client.rest.put(`${Ne}/${e}/permissions`,{ids:t})}deletePermission(e,t){return this.client.rest.delete(`${Ne}/${e}/${je}`,{ids:t})}}const Me="/share",He=`${Me}/restrictions`;class Be{constructor(e){this.client=e}info(e,t){const s=new URLSearchParams({path:e,share_token:t});return this.client.rest.get(`${Me}?${s.toString()}`)}checkPassword(e,t){const s=encodeURIComponent(e);return this.client.rest.get(`${Me}/password?share_token=${t}&share_pass=${s}`)}checkToken(e){return this.client.rest.get(`${Me}?share_token=${e}`)}getRestriction(e){return this.client.rest.get(`${He}/${e}`)}restrictions(e){return this.client.rest.get(He,e)}restrictionsChange(e,t){return this.client.rest.put(`${He}/${e}`,t)}}const Fe="/storage",We=`${Fe}/element`,Ge=`${We}/move`,Ve=`${We}/copy`,ze=`${We}/content_type_size`,Je="/disk";class Ke{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(Fe,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(We,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(`${We}/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(`${Je}/${r}/files/move${Je}/${i}`,n):t===exports.StorageRoot.fca?(r&&(n.from_divide_id=r),this.client.rest.put(`${Je}/${i}/files/from/box`,n)):s===exports.StorageRoot.fca?(i&&(n.to_divide_id=i),this.client.rest.put(`${Je}/${r}/files/to/box`,n)):this.client.rest.post(Ge,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(`${Je}/${r}/files/copy${Je}/${i}`,n):s===exports.StorageRoot.fca?(r&&(n.from_divide_id=r),this.client.rest.post(`${Je}/${i}/files/from/box`,n)):t===exports.StorageRoot.fca?(i&&(n.to_divide_id=i),this.client.rest.post(`${Je}/${r}/files/to/box`,n)):this.client.rest.post(Ve,e)}pasteFromShared(e,t,s){const r={from_sharing_token:e,from_sharing_password:s,paths:t};return this.client.rest.post(`${We}/copy`,r)}create(e){return this.client.rest.post(We,e)}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(We,s)}favorite(e){return this.client.rest.put(`${We}?path=${encodeURIComponent(e)}`,{is_favorite:!0})}removeFavorite(e){return this.client.rest.put(`${We}?path=${encodeURIComponent(e)}`,{is_favorite:!1})}createItem(e){return this.client.rest.post(We,e)}createWorkDir(e){return this.client.rest.post(We,e)}sizeWithSection(e){return this.client.rest.get(ze,e)}}const Qe="/storage/files",Xe=`${Qe}/net`;class Ye{constructor(e){this.client=e}read(e,t){return t.path=e,this.client.rest.get(Qe,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(`${Qe}?${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(Qe,i,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e){return this.client.rest.post(Xe,e)}}class Ze{constructor(e){this.client=e}instance(){return this.client.rest.get("/storage/instance")}}const et="/storage/element/share";class tt{constructor(e){this.client=e}info(e){return this.client.rest.get(et,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(et,s)}change(e){return this.client.rest.put(`${et}/${e.token}`,e)}delete(e){return this.client.rest.delete(et,{path:e})}refresh(e){return this.client.rest.put(`${et}/${e}/refresh`)}}const st="/storage/trash/element",rt=`${st}/all`;class it{constructor(e){this.client=e}clear(e){return this.client.rest.delete(st,e)}clearAll(){return this.client.rest.delete(rt)}restore(e){return this.client.rest.patch(st,{del_groups:e})}restoreAll(){return this.client.rest.patch(rt)}}const nt="/users",ot=`${nt}/me`,ct=`${ot}/avatars`,at=`${ot}/sessions`,lt=`${ot}/tokens`,pt=`${ot}/params`,dt=`${ot}/change-password`,ht=`${nt}/initial`,ut=`${ot}/phone`,gt=`${ut}/confirm`;class xt{constructor(e){this.client=e}initial(e){return this.client.rest.post(ht,e)}list(e){return this.client.rest.get(nt,e)}get(e){return this.client.rest.get(nt+`/${e}`)}create(e){return this.client.rest.post(nt,e)}update(e,t){return this.client.rest.put(nt+`/${e}`,t)}delete(e,t){return this.client.rest.delete(`${nt}/${e}`,t)}restore(e){return this.client.rest.post(`${nt}/${e}/restore`)}me(){return this.client.rest.get(ot)}updateMe(e){return this.client.rest.put(ot,e)}createToken(e){return this.client.rest.post(lt,e)}listToken(e){return this.client.rest.get(lt,e)}deleteToken(e){return this.client.rest.delete(`${lt}/${e}`)}changeMyPassword(e){return this.client.rest.put(dt,e)}changeUsersPassword(e,t){return this.client.rest.put(`${nt}/${e}/change-password`,t)}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(ct,s)}meDeleteAvatar(){return this.client.rest.delete(ct)}meListSession(e){return this.client.rest.get(at,e)}meDeleteSession(e){let t=at;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${nt}/${e}/roles`,{role_id:t})}meParams(e){return this.client.rest.get(pt,{name:e})}meSetParams(e,t){return this.client.rest.post(`${pt}/${e}`,t)}meListParams(){return this.client.rest.get(pt)}phone(e){return this.client.rest.post(ut,e)}phoneConfirm(e){return this.client.rest.post(`${gt}/${e}`)}}const vt="/storage/element",_t=`${vt}/history`,St=`${vt}/version`,ft=`${St}/current`,$t=`${St}/size`;class mt{constructor(e){this.client=e}history(e){return this.client.rest.get(_t,e)}versions(e){return this.client.rest.get(St,e)}create(e){return this.client.rest.post(St,e)}edit(e){return this.client.rest.put(St,e)}delete(e){return this.client.rest.delete(St,e)}size(e){return this.client.rest.get($t,e)}makeCurrent(e){return this.client.rest.post(ft,e)}}exports.AuthApiService=r,exports.BASE_URL_V1=ie,exports.BASE_URL_V2=ne,exports.CONNECTIONS_PERMISSION=n,exports.Client=class{constructor(e){this.AuthApiService=new r(this),this.ConnectionsApiService=new B(this),this.DiscoveryApiService=new F(this),this.DivideApiService=new V(this),this.ExtensionsApiService=new de(this),this.ExtensionsExternalApiService=new ue(this),this.FcaApiService=new ve(this),this.GatewayApiService=new Se(this),this.GroupApiService=new me(this),this.LicenseApiService=new Ae(this),this.LinksApiService=new we(this),this.LimitationsApiService=new Ce(this),this.LogstashApiService=new Ee(this),this.NotificationApiService=new Le(this),this.RoleApiService=new qe(this),this.ShareApiService=new Be(this),this.StorageElementApiService=new Ke(this,this.FcaApiService),this.StorageFilesApiService=new Ye(this),this.StorageInstanceApiService=new Ze(this),this.StorageShareApiService=new tt(this),this.StorageTrashApiService=new it(this),this.UserApiService=new xt(this),this.VersionApiService=new mt(this),this.tokenUpdate=new re,this.rest=new oe(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)||ie},requestParams:{path:"",headers:{},query:{},body:null,cache:"no-cache"},authToken:null,skipInterceptors:!1},this.rest.baseHost=this.state.clientParams.host||""}},exports.ConnectionsApiService=B,exports.DiscoveryApiService=F,exports.DivideApiService=V,exports.ExtensionsApiService=de,exports.ExtensionsExternalApiService=ue,exports.FcaApiService=ve,exports.GatewayApiService=Se,exports.GroupApiService=me,exports.LicenseApiService=Ae,exports.LimitationsApiService=Ce,exports.LinksApiService=we,exports.LogstashApiService=Ee,exports.NEED_TOKEN_UPDATE_ERROR=se,exports.NotificationApiService=Le,exports.Rest=oe,exports.RoleApiService=qe,exports.ShareApiService=Be,exports.StorageElementApiService=Ke,exports.StorageFilesApiService=Ye,exports.StorageInstanceApiService=Ze,exports.StorageShareApiService=tt,exports.StorageTrashApiService=it,exports.TokenUpdate=re,exports.UserApiService=xt,exports.VersionApiService=mt,exports.applyInterceptors=X,exports.getCookieValue=Y,exports.makeUrlParams=Z,exports.normalizeHeaders=ee,exports.prepareRequestBody=te;
|
|
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,_,S,f,$,m,y,k,b,A,T,w,R,C,E,U,D,P,O,L,N,I,j,q;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.LimitationType=void 0,($=exports.LimitationType||(exports.LimitationType={})).BySize="size",$.ByExt="extension",exports.LimitationSubType=void 0,(m=exports.LimitationSubType||(exports.LimitationSubType={})).Size="size",m.White="extension_white",m.Black="extension_black",exports.NotificationEntityType=void 0,(y=exports.NotificationEntityType||(exports.NotificationEntityType={})).Dir="dir",y.File="file",y.User="user",y.Other="other",y.WorkDir="work_dir",y.License="license",y.Extension="extension",y.Connection="connection",exports.NotificationAction=void 0,(k=exports.NotificationAction||(exports.NotificationAction={})).SecurityCheckNegative="action_security_check_negative",k.SecurityCheckPositive="action_security_check_positive",k.OpenSharing="open_sharing",k.ChangeSharing="change_sharing",k.CancelSharing="cancel_sharing",k.DivideDirAddFileToOwner="divide_dir_add_file_to_owner",k.DivideDirAddDirToOwner="divide_dir_add_dir_to_owner",k.DivideDirAddWorkDirToOwner="divide_dir_add_work_dir_to_owner",k.DivideConnectionAddFileToOwner="divide_connection_add_file_to_owner",k.DivideConnectionAddDirToOwner="divide_connection_add_dir_to_owner",k.CancelDivideDir="cancel_divide_dir",k.CancelDivideFile="cancel_divide_file",k.CancelDivideWorkDir="cancel_divide_work_dir",k.CancelDivideConnection="cancel_divide_connection",k.DeleteExtension="delete_extension",k.NewVersionExtension="new_version_extension",k.TransferData="transfer_data",k.AllowInternalAccessUser="allow_internal_access_to_user",k.BlockInternalAccessUser="block_internal_access_to_user",k.WaitInternalAccessUser="wait_internal_access_to_user",k.WaitInternalAccessUserCreate="wait_internal_access_to_user_create",k.AllowInternalAccessGroup="allow_internal_access_to_group",k.BlockInternalAccessGroup="block_internal_access_to_group",k.WaitInternalAccessGroup="wait_internal_access_to_group",k.WaitInternalAccessGroupCreate="wait_internal_access_to_group_create",k.AllowSharing="allow_sharing",k.BlockSharing="block_sharing",k.WaitSharing="wait_sharing",k.WaitSharingCreate="wait_sharing_create",k.Other="other",exports.NotificationRowAction=void 0,(b=exports.NotificationRowAction||(exports.NotificationRowAction={})).Read="read",b.Unread="unread",b.Delete="delete",exports.NotificationStyle=void 0,(A=exports.NotificationStyle||(exports.NotificationStyle={})).Plain="plain",A.Success="success",A.Info="info",A.Warning="warning",A.Error="error",exports.ResponseType=void 0,(T=exports.ResponseType||(exports.ResponseType={})).ArrayBuffer="arraybuffer",T.Blob="blob",T.Json="json",T.Text="text",exports.RequestMethod=void 0,(w=exports.RequestMethod||(exports.RequestMethod={})).GET="GET",w.POST="POST",w.PUT="PUT",w.PATCH="PATCH",w.DELETE="DELETE",exports.RequestObserve=void 0,(R=exports.RequestObserve||(exports.RequestObserve={})).Body="body",R.Response="response",exports.RestrictionSharing=void 0,(C=exports.RestrictionSharing||(exports.RestrictionSharing={})).NONE="none",C.SOFT="soft",C.HARD="hard",exports.UserAuthType=void 0,(E=exports.UserAuthType||(exports.UserAuthType={})).Native="native",E.Ldap="ldap",E.Vk="vk",exports.UserStatus=void 0,(U=exports.UserStatus||(exports.UserStatus={})).Registering="registering",U.Activated="activated",U.Blocked="blocked",U.BlockedByLicense="blocked_by_license",exports.UserType=void 0,(D=exports.UserType||(exports.UserType={})).User="user",D.Guest="guest",D.Emperor="emperor",D.Anonymous="anonymous",exports.UserParamsLabel=void 0,(P=exports.UserParamsLabel||(exports.UserParamsLabel={})).Theme="theme",P.Lang="lang",P.Sort="sort",exports.SettingControlType=void 0,(O=exports.SettingControlType||(exports.SettingControlType={})).Text="text",O.String="string",O.Number="number",O.CheckBox="checkbox",O.Select="select",O.RadioList="radio_list",O.ConnectionChoose="connection_choose",O.MultiConnectionChoose="multi_connection_choose",exports.StorageElementType=void 0,(L=exports.StorageElementType||(exports.StorageElementType={})).Dir="dir",L.File="file",L.WorkDir="work_dir",exports.StorageElementContentType=void 0,(N=exports.StorageElementContentType||(exports.StorageElementContentType={})).Any="any",N.Dir="dir",N.Code="code",N.Image="image",N.Audio="audio",N.Video="video",N.Text="text",N.Doc="doc",N.Xls="xls",N.Ppt="ppt",exports.StorageRoot=void 0,(I=exports.StorageRoot||(exports.StorageRoot={})).my="my",I.fca="fca",I.divide="divide",I.share="share",I.favorite="favorite",I.trash="trash",exports.StorageElementHistoryAction=void 0,(j=exports.StorageElementHistoryAction||(exports.StorageElementHistoryAction={})).Create="create",j.Update="update",j.Move="move",exports.StorageElementCheckStatus=void 0,(q=exports.StorageElementCheckStatus||(exports.StorageElementCheckStatus={}))[q.CheckNull=0]="CheckNull",q[q.CheckInProgress=1]="CheckInProgress",q[q.CheckPositive=2]="CheckPositive",q[q.CheckNegative=3]="CheckNegative";const M="/connections",H=`${M}/dashboard`;class B{constructor(e){this.client=e}list(e){return this.client.rest.get(M,e)}get(e){return this.client.rest.get(`${M}/${e}`)}update(e,t){return this.client.rest.put(`${M}/${e}`,t)}delete(e){return this.client.rest.delete(`${M}/${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]||M,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 W="/divide",G=`${W}/restrictions`;class V{constructor(e){this.client=e}divideDelete(e,t){return this.client.rest.delete(`${e}/${W}/${t}`)}divideDeleteAll(e,t,s,r){return this.client.rest.delete(`${e}/${W}`,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}/${W}`,n)}divideUsers(e,t,s){return this.client.rest.get(`${e}/${W}/users`,Object.assign(Object.assign({},this.makeParam(e,t)),s))}getRestriction(e){return this.client.rest.get(`${G}/${e}`)}restrictionSize(e,t){return this.client.rest.get(`/${t}/restrictions/${e}/size`)}restrictions(e){return this.client.rest.get(`${G}`,e)}restrictionsChange(e,t){return this.client.rest.put(`${G}/${e}`,t)}makeParam(e,t){const s={};return e===exports.DivideScope.Connection?s.connection_id=t:s.path=t,s}}function z(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 J extends Error{}function K(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 Q(e,t){if("string"!=typeof e)throw new J("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 J(`Invalid token specified: missing part #${s+1}`);let i;try{i=K(r)}catch(e){throw new J(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new J(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}J.prototype.name="InvalidTokenError";const X=(e,t)=>z(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 Z=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 ee(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}function te(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 se="update black token";class re{constructor(){this.isUpdating=!1,this.tokenUpdateResolve=null}isTokenExpire(e){if(!e)return!1;return 1e3*e<=(new Date).getTime()+3e3}refreshToken(e,t){return z(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}${ie}/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};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)},n.onerror=()=>{i(new Error("Network error occurred"))},n.onloadend=()=>{this.isUpdating=!1}}))):null}))}waitForTokenUpdate(){return z(this,void 0,void 0,(function*(){return new Promise((e=>{const t=setInterval((()=>{this.isUpdating||(clearInterval(t),e())}),100)}))}))}}const ie="/api/v1",ne="/api/v2";class oe{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({params: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 z(this,void 0,void 0,(function*(){return new Promise(((r,i)=>z(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 X(this.client.requestInterceptors,c)),this.state.authToken)for(const[e,r]of this.state.authToken.entries()){const i=Q(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 X(this.client.requestInterceptors,c))}}const a=new XMLHttpRequest;(null==s?void 0:s.params)&&0!==Object.keys(s.params).length&&(t+="?"+Z(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=ee(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=()=>z(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===se){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({},n),{error:e})),i(Object.assign(Object.assign({},n),{error:e}))}n=yield X(this.client.responseInterceptors,n)})),a.onerror=()=>{i({status:a.status,statusText:a.statusText,url:a.responseURL,error:"Network error"})},a.send(te(null==s?void 0:s.body))}))))}))}changeBaseUrlVersion(e,t){return z(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 z(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 ce="/static/extensions",ae="/extensions/defaults",le=`${ce}/names/users`,pe=`${ce}/names/system`;class de{constructor(e){this.client=e}getSetting(e){return this.client.rest.get(`${ce}/${e}/settings`)}setSetting(e,t){return this.client.rest.post(`${ce}/${e}/settings`,t)}deleteSetting(e){return this.client.rest.delete(`${ce}/${e}/settings`)}get(e){return this.client.rest.get(`${ce}/${e}`)}getByKey(e){return this.client.rest.get(`${ce}/${e}`)}getDefault(e=[]){return this.client.rest.get(ae,{ext_code:e})}setDefault(e,t){return this.client.rest.post(ae,{ext_code:e,ext_uniq_key:t})}checkUpdates(){return this.client.rest.post(`${ce}/check_updates`)}updateVersion(e,t){return this.client.rest.put(`${ce}/${e}`,{version:t})}list(e){return this.client.rest.get(ce,e)}delete(e,t){return this.client.rest.delete(`${ce}/${e}`)}upload(e,t){const s=new FormData;s.set("file",t);const{promise:r,abort:i}=this.client.rest.upload(ce,s,{onUploadProgress:t=>{e(t)}});return{promise:this.client.rest.changeBaseUrlVersion(ne,(()=>r)),abort:i}}install(e,t){return this.client.rest.changeBaseUrlVersion(ne,(()=>this.client.rest.post(`${ce}/site`,{uniq_key:e,version:t})))}getSystemNameExts(e){return this.client.rest.get(pe,e)}getUserNameExts(e){return this.client.rest.get(le,e)}createUserNameExt(e){return this.client.rest.post(`${le}`,{name:e})}deleteUserNameExt(e){return this.client.rest.delete(`${le}/${e}`)}deleteAllUserNameExts(){return this.client.rest.delete(`${le}`)}}const he="/anons_ext/extensions";class ue{constructor(e){this.client=e}listExtensionsSite(e){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(he,e)))}extensionDetailSite(e){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(`${he}/${e}`)))}extensionMarkdown(e,t){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(`${he}/${e}/readme`,{},t)))}}const ge="/disk",xe=`${ge}/check`;class ve{constructor(e){this.client=e}info(e,t){return this.client.rest.get(`${ge}/${e}/element`,{path:t})}list(e,t){return this.client.rest.get(`${ge}/${e}`,t)}create(e,t){return this.client.rest.post(`${ge}/${e}/element`,t)}replace(e,t,s){return this.client.rest.put(`${ge}/${e}/files?path=${t}`,s)}read(e,t){return this.client.rest.get(`${ge}/${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(`${ge}/${t}/files`,i,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e,t){return this.client.rest.post(`${ge}/${e}/files/net`,t)}delete(e,t){return this.client.rest.delete(`${ge}/${e}/trash/element`,{path:t})}check(e){return this.client.rest.post(xe,e)}}const _e="/settings";class Se{constructor(e){this.client=e}settings(){return this.client.rest.get(_e)}changeSettings(e){return this.client.rest.post(_e,e)}queryInit(){return this.client.rest.get("/query/init")}}var fe;exports.QueryInitViewType=void 0,(fe=exports.QueryInitViewType||(exports.QueryInitViewType={})).Standard="Standard",fe.Simple="Simple";const $e="/groups";class me{constructor(e){this.client=e}list(e){return this.client.rest.get($e,e)}listUsers(e){return this.client.rest.get(`${$e}/${e}/users`)}create(e){return this.client.rest.post($e,e)}update(e,t){return this.client.rest.put(`${$e}/${e}`,t)}delete(e){return this.client.rest.delete(`${$e}/${e}`)}}const ye="/license",ke=`${ye}/manual-check`,be=`${ye}/hardware/hash`;class Ae{constructor(e){this.client=e}info(){return this.client.rest.get(ye)}create(e){return this.client.rest.post(ye,e)}check(){return this.client.rest.post(ke)}delete(){return this.client.rest.delete(ye)}getHash(){return this.client.rest.get(be)}}const Te="/links";class we{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post(Te,e)}updateShortLink(e){return this.client.rest.put(Te,e)}}const Re="/limitations";class Ce{constructor(e){this.client=e}list(e){return this.client.rest.get(Re,e)}listUsers(e){return this.client.rest.get(`${Re}/${e}/users`)}create(e){return this.client.rest.post(Re,e)}get(e){return this.client.rest.get(`${Re}/${e}`)}update(e,t){return this.client.rest.put(`${Re}/${e}`,t)}delete(e){return this.client.rest.delete(`${Re}/${e}`)}}class Ee{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get("/logs/users",e)}}const Ue="/notifications",De=`${Ue}/all`,Pe=`${Ue}/subscription`,Oe=`${Ue}/permission`;class Le{constructor(e){this.client=e}list(e){return this.client.rest.get(Ue,e)}toggleStatus(e,t){return this.client.rest.put(Ue,{ids:e,to_status:t})}toggleAllStatus(e){return this.client.rest.put(De,{to_status:e})}delete(e){return this.client.rest.delete(Ue,{id:e})}deleteAll(){return this.client.rest.delete(De)}getPermission(){return this.client.rest.get(Oe)}setPermission(e){return this.client.rest.post(Oe,{enabled:e})}getSubscription(){return this.client.rest.get(Pe)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(Pe,t)}}const Ne="/roles",Ie=`${Ne}/default`,je="/permissions";class qe{constructor(e){this.client=e}list(e){return this.client.rest.get(Ne,e)}get(e){return this.client.rest.get(`${Ne}/${e}`)}getDefault(){return this.client.rest.get(`${Ie}`)}create(e){return this.client.rest.post(Ne,e)}update(e,t){return this.client.rest.put(`${Ne}/${e}`,t)}delete(e){return this.client.rest.delete(`${Ne}/${e}`)}permissionList(){return this.client.rest.get(je)}addPermission(e,t){return this.client.rest.put(`${Ne}/${e}/permissions`,{ids:t})}deletePermission(e,t){return this.client.rest.delete(`${Ne}/${e}/${je}`,{ids:t})}}const Me="/share",He=`${Me}/restrictions`;class Be{constructor(e){this.client=e}info(e,t){const s=new URLSearchParams({path:e,share_token:t});return this.client.rest.get(`${Me}?${s.toString()}`)}checkPassword(e,t){const s=encodeURIComponent(e);return this.client.rest.get(`${Me}/password?share_token=${t}&share_pass=${s}`)}checkToken(e){return this.client.rest.get(`${Me}?share_token=${e}`)}getRestriction(e){return this.client.rest.get(`${He}/${e}`)}restrictions(e){return this.client.rest.get(He,e)}restrictionsChange(e,t){return this.client.rest.put(`${He}/${e}`,t)}}const Fe="/storage",We=`${Fe}/element`,Ge=`${We}/move`,Ve=`${We}/copy`,ze=`${We}/content_type_size`,Je="/disk";class Ke{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(Fe,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(We,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(`${We}/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(`${Je}/${r}/files/move${Je}/${i}`,n):t===exports.StorageRoot.fca?(r&&(n.from_divide_id=r),this.client.rest.put(`${Je}/${i}/files/from/box`,n)):s===exports.StorageRoot.fca?(i&&(n.to_divide_id=i),this.client.rest.put(`${Je}/${r}/files/to/box`,n)):this.client.rest.post(Ge,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(`${Je}/${r}/files/copy${Je}/${i}`,n):s===exports.StorageRoot.fca?(r&&(n.from_divide_id=r),this.client.rest.post(`${Je}/${i}/files/from/box`,n)):t===exports.StorageRoot.fca?(i&&(n.to_divide_id=i),this.client.rest.post(`${Je}/${r}/files/to/box`,n)):this.client.rest.post(Ve,e)}pasteFromShared(e,t,s){const r={from_sharing_token:e,from_sharing_password:s,paths:t};return this.client.rest.post(`${We}/copy`,r)}create(e){return this.client.rest.post(We,e)}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(We,s)}favorite(e){return this.client.rest.put(`${We}?path=${encodeURIComponent(e)}`,{is_favorite:!0})}removeFavorite(e){return this.client.rest.put(`${We}?path=${encodeURIComponent(e)}`,{is_favorite:!1})}createItem(e){return this.client.rest.post(We,e)}createWorkDir(e){return this.client.rest.post(We,e)}sizeWithSection(e){return this.client.rest.get(ze,e)}}const Qe="/storage/files",Xe=`${Qe}/net`;class Ye{constructor(e){this.client=e}read(e,t){return t.path=e,this.client.rest.get(Qe,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(`${Qe}?${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(Qe,i,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e){return this.client.rest.post(Xe,e)}}class Ze{constructor(e){this.client=e}instance(){return this.client.rest.get("/storage/instance")}}const et="/storage/element/share";class tt{constructor(e){this.client=e}info(e){return this.client.rest.get(et,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(et,s)}change(e){return this.client.rest.put(`${et}/${e.token}`,e)}delete(e){return this.client.rest.delete(et,{path:e})}refresh(e){return this.client.rest.put(`${et}/${e}/refresh`)}}const st="/storage/trash/element",rt=`${st}/all`;class it{constructor(e){this.client=e}clear(e){return this.client.rest.delete(st,e)}clearAll(){return this.client.rest.delete(rt)}restore(e){return this.client.rest.patch(st,{del_groups:e})}restoreAll(){return this.client.rest.patch(rt)}}const nt="/users",ot=`${nt}/me`,ct=`${ot}/avatars`,at=`${ot}/sessions`,lt=`${ot}/tokens`,pt=`${ot}/params`,dt=`${ot}/change-password`,ht=`${nt}/initial`,ut=`${ot}/phone`,gt=`${ut}/confirm`;class xt{constructor(e){this.client=e}initial(e){return this.client.rest.post(ht,e)}list(e){return this.client.rest.get(nt,e)}get(e){return this.client.rest.get(nt+`/${e}`)}create(e){return this.client.rest.post(nt,e)}update(e,t){return this.client.rest.put(nt+`/${e}`,t)}delete(e,t){return this.client.rest.delete(`${nt}/${e}`,t)}restore(e){return this.client.rest.post(`${nt}/${e}/restore`)}me(){return this.client.rest.get(ot)}updateMe(e){return this.client.rest.put(ot,e)}createToken(e){return this.client.rest.post(lt,e)}listToken(e){return this.client.rest.get(lt,e)}deleteToken(e){return this.client.rest.delete(`${lt}/${e}`)}changeMyPassword(e){return this.client.rest.put(dt,e)}changeUsersPassword(e,t){return this.client.rest.put(`${nt}/${e}/change-password`,t)}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(ct,s)}meDeleteAvatar(){return this.client.rest.delete(ct)}meListSession(e){return this.client.rest.get(at,e)}meDeleteSession(e){let t=at;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${nt}/${e}/roles`,{role_id:t})}meParams(e){return this.client.rest.get(pt,{name:e})}meSetParams(e,t){return this.client.rest.post(`${pt}/${e}`,t)}meListParams(){return this.client.rest.get(pt)}phone(e){return this.client.rest.post(ut,e)}phoneConfirm(e){return this.client.rest.post(`${gt}/${e}`)}}const vt="/storage/element",_t=`${vt}/history`,St=`${vt}/version`,ft=`${St}/lock`,$t=`${St}/unlock`,mt=`${St}/current`,yt=`${St}/size`;class kt{constructor(e){this.client=e}history(e){return this.client.rest.get(_t,e)}versions(e){return this.client.rest.get(St,e)}create(e){return this.client.rest.post(St,e)}edit(e){return this.client.rest.put(St,e)}delete(e){return this.client.rest.delete(St,e)}size(e){return this.client.rest.get(yt,e)}makeCurrent(e){return this.client.rest.post(mt,e)}lock(e){return this.client.rest.patch(ft,e)}unlock(e){return this.client.rest.patch($t,e)}}exports.AuthApiService=r,exports.BASE_URL_V1=ie,exports.BASE_URL_V2=ne,exports.CONNECTIONS_PERMISSION=n,exports.Client=class{constructor(e){this.AuthApiService=new r(this),this.ConnectionsApiService=new B(this),this.DiscoveryApiService=new F(this),this.DivideApiService=new V(this),this.ExtensionsApiService=new de(this),this.ExtensionsExternalApiService=new ue(this),this.FcaApiService=new ve(this),this.GatewayApiService=new Se(this),this.GroupApiService=new me(this),this.LicenseApiService=new Ae(this),this.LinksApiService=new we(this),this.LimitationsApiService=new Ce(this),this.LogstashApiService=new Ee(this),this.NotificationApiService=new Le(this),this.RoleApiService=new qe(this),this.ShareApiService=new Be(this),this.StorageElementApiService=new Ke(this,this.FcaApiService),this.StorageFilesApiService=new Ye(this),this.StorageInstanceApiService=new Ze(this),this.StorageShareApiService=new tt(this),this.StorageTrashApiService=new it(this),this.UserApiService=new xt(this),this.VersionApiService=new kt(this),this.tokenUpdate=new re,this.rest=new oe(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)||ie},requestParams:{path:"",headers:{},query:{},body:null,cache:"no-cache"},authToken:null,skipInterceptors:!1},this.rest.baseHost=this.state.clientParams.host||""}},exports.ConnectionsApiService=B,exports.DiscoveryApiService=F,exports.DivideApiService=V,exports.ExtensionsApiService=de,exports.ExtensionsExternalApiService=ue,exports.FcaApiService=ve,exports.GatewayApiService=Se,exports.GroupApiService=me,exports.LicenseApiService=Ae,exports.LimitationsApiService=Ce,exports.LinksApiService=we,exports.LogstashApiService=Ee,exports.NEED_TOKEN_UPDATE_ERROR=se,exports.NotificationApiService=Le,exports.Rest=oe,exports.RoleApiService=qe,exports.ShareApiService=Be,exports.StorageElementApiService=Ke,exports.StorageFilesApiService=Ye,exports.StorageInstanceApiService=Ze,exports.StorageShareApiService=tt,exports.StorageTrashApiService=it,exports.TokenUpdate=re,exports.UserApiService=xt,exports.VersionApiService=kt,exports.applyInterceptors=X,exports.getCookieValue=Y,exports.makeUrlParams=Z,exports.normalizeHeaders=ee,exports.prepareRequestBody=te;
|
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.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,u,d,p,g,_,f,v,$,m,k,b,w,S,y,x,C,A,T,U,P,D,E,O,R,I,j,L,N,H;!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"}(u||(u={})),function(e){e.Storage="/storage/element",e.Connection="/connections"}(d||(d={})),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"}(m||(m={})),function(e){e.BySize="size",e.ByExt="extension"}(k||(k={})),function(e){e.Size="size",e.White="extension_white",e.Black="extension_black"}(b||(b={})),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"}(w||(w={})),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"}(S||(S={})),function(e){e.Read="read",e.Unread="unread",e.Delete="delete"}(y||(y={})),function(e){e.Plain="plain",e.Success="success",e.Info="info",e.Warning="warning",e.Error="error"}(x||(x={})),function(e){e.ArrayBuffer="arraybuffer",e.Blob="blob",e.Json="json",e.Text="text"}(C||(C={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH",e.DELETE="DELETE"}(A||(A={})),function(e){e.Body="body",e.Response="response"}(T||(T={})),function(e){e.NONE="none",e.SOFT="soft",e.HARD="hard"}(U||(U={})),function(e){e.Native="native",e.Ldap="ldap",e.Vk="vk"}(P||(P={})),function(e){e.Registering="registering",e.Activated="activated",e.Blocked="blocked",e.BlockedByLicense="blocked_by_license"}(D||(D={})),function(e){e.User="user",e.Guest="guest",e.Emperor="emperor",e.Anonymous="anonymous"}(E||(E={})),function(e){e.Theme="theme",e.Lang="lang",e.Sort="sort"}(O||(O={})),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"}(R||(R={})),function(e){e.Dir="dir",e.File="file",e.WorkDir="work_dir"}(I||(I={})),function(e){e.Any="any",e.Dir="dir",e.Code="code",e.Image="image",e.Audio="audio",e.Video="video",e.Text="text",e.Doc="doc",e.Xls="xls",e.Ppt="ppt"}(j||(j={})),function(e){e.my="my",e.fca="fca",e.divide="divide",e.share="share",e.favorite="favorite",e.trash="trash"}(L||(L={})),function(e){e.Create="create",e.Update="update",e.Move="move"}(N||(N={})),function(e){e[e.CheckNull=0]="CheckNull",e[e.CheckInProgress=1]="CheckInProgress",e[e.CheckPositive=2]="CheckPositive",e[e.CheckNegative=3]="CheckNegative"}(H||(H={}));const W="/connections",B=`${W}/dashboard`;class F{constructor(e){this.client=e}list(e){return this.client.rest.get(W,e)}get(e){return this.client.rest.get(`${W}/${e}`)}update(e,t){return this.client.rest.put(`${W}/${e}`,t)}delete(e){return this.client.rest.delete(`${W}/${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]||W,e)}dashboard(e){return this.client.rest.get(B,e)}}class q{constructor(e){this.client=e}discovery(e){return this.client.rest.get("/discovery",e)}}const G="/divide",M=`${G}/restrictions`;class z{constructor(e){this.client=e}divideDelete(e,t){return this.client.rest.delete(`${e}/${G}/${t}`)}divideDeleteAll(e,t,s,n){return this.client.rest.delete(`${e}/${G}`,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}/${G}`,r)}divideUsers(e,t,s){return this.client.rest.get(`${e}/${G}/users`,Object.assign(Object.assign({},this.makeParam(e,t)),s))}getRestriction(e){return this.client.rest.get(`${M}/${e}`)}restrictionSize(e,t){return this.client.rest.get(`/${t}/restrictions/${e}/size`)}restrictions(e){return this.client.rest.get(`${M}`,e)}restrictionsChange(e,t){return this.client.rest.put(`${M}/${e}`,t)}makeParam(e,t){const s={};return e===d.Connection?s.connection_id=t:s.path=t,s}}function V(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 J extends Error{}function X(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 Y(e,t){if("string"!=typeof e)throw new J("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 J(`Invalid token specified: missing part #${s+1}`);let i;try{i=X(n)}catch(e){throw new J(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new J(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}J.prototype.name="InvalidTokenError";const K=(e,t)=>V(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 Q(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 Z=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 ee(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}function te(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 se="update black token";class ne{constructor(){this.isUpdating=!1,this.tokenUpdateResolve=null}isTokenExpire(e){if(!e)return!1;return 1e3*e<=(new Date).getTime()+3e3}refreshToken(e,t){return V(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}${ie}/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};Q("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 V(this,void 0,void 0,(function*(){return new Promise((e=>{const t=setInterval((()=>{this.isUpdating||(clearInterval(t),e())}),100)}))}))}}const ie="/api/v1",re="/api/v2";class oe{constructor(e,t){this.client=e,this.tokenUpdate=t,this.baseHost=""}get state(){return this.client.state}get(e,t,s){return this.request(A.GET,e,Object.assign({params:t,cache:"no-cache"},s))}post(e,t,s){return this.request(A.POST,e,Object.assign({body:t},s))}put(e,t,s){return this.request(A.PUT,e,Object.assign({body:t,cache:"no-cache"},s))}patch(e,t,s){return this.request(A.PATCH,e,Object.assign({body:t},s))}delete(e,t,s){return this.request(A.DELETE,e,Object.assign({params:t},s))}upload(e,t,s){const n=new AbortController,i=n.signal;return{promise:this.request(A.POST,e,Object.assign({body:t,signal:i},s)),abort:()=>n.abort()}}request(e,t,s){return V(this,void 0,void 0,(function*(){return new Promise(((n,i)=>V(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 K(this.client.requestInterceptors,c)),this.state.authToken)for(const[e,n]of this.state.authToken.entries()){const i=Y(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 K(this.client.requestInterceptors,c))}}const a=new XMLHttpRequest;(null==s?void 0:s.params)&&0!==Object.keys(s.params).length&&(t+="?"+Z(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=ee(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&&[A.POST,A.PUT,A.PATCH].includes(e)&&(a.upload.onprogress=e=>{e.lengthComputable&&(null==s?void 0:s.onUploadProgress)&&s.onUploadProgress(e)}),a.onload=()=>V(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 C.Text:e=a.responseText;break;case C.Blob:case C.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)===T.Response?n(Object.assign(Object.assign({},r),{body:e})):n(e);else{if(this.state.authToken&&e.code===se){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({},r),{error:e})),i(Object.assign(Object.assign({},r),{error:e}))}r=yield K(this.client.responseInterceptors,r)})),a.onerror=()=>{i({status:a.status,statusText:a.statusText,url:a.responseURL,error:"Network error"})},a.send(te(null==s?void 0:s.body))}))))}))}changeBaseUrlVersion(e,t){return V(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 V(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 ce{constructor(e){this.AuthApiService=new n(this),this.ConnectionsApiService=new F(this),this.DiscoveryApiService=new q(this),this.DivideApiService=new z(this),this.ExtensionsApiService=new de(this),this.ExtensionsExternalApiService=new ge(this),this.FcaApiService=new ve(this),this.GatewayApiService=new me(this),this.GroupApiService=new we(this),this.LicenseApiService=new Ce(this),this.LinksApiService=new Te(this),this.LimitationsApiService=new Pe(this),this.LogstashApiService=new De(this),this.NotificationApiService=new je(this),this.RoleApiService=new We(this),this.ShareApiService=new qe(this),this.StorageElementApiService=new Ye(this,this.FcaApiService),this.StorageFilesApiService=new Ze(this),this.StorageInstanceApiService=new et(this),this.StorageShareApiService=new st(this),this.StorageTrashApiService=new rt(this),this.UserApiService=new ft(this),this.VersionApiService=new wt(this),this.tokenUpdate=new ne,this.rest=new oe(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)||ie},requestParams:{path:"",headers:{},query:{},body:null,cache:"no-cache"},authToken:null,skipInterceptors:!1},this.rest.baseHost=this.state.clientParams.host||""}}const ae="/static/extensions",le="/extensions/defaults",he=`${ae}/names/users`,ue=`${ae}/names/system`;class de{constructor(e){this.client=e}getSetting(e){return this.client.rest.get(`${ae}/${e}/settings`)}setSetting(e,t){return this.client.rest.post(`${ae}/${e}/settings`,t)}deleteSetting(e){return this.client.rest.delete(`${ae}/${e}/settings`)}get(e){return this.client.rest.get(`${ae}/${e}`)}getByKey(e){return this.client.rest.get(`${ae}/${e}`)}getDefault(e=[]){return this.client.rest.get(le,{ext_code:e})}setDefault(e,t){return this.client.rest.post(le,{ext_code:e,ext_uniq_key:t})}checkUpdates(){return this.client.rest.post(`${ae}/check_updates`)}updateVersion(e,t){return this.client.rest.put(`${ae}/${e}`,{version:t})}list(e){return this.client.rest.get(ae,e)}delete(e,t){return this.client.rest.delete(`${ae}/${e}`)}upload(e,t){const s=new FormData;s.set("file",t);const{promise:n,abort:i}=this.client.rest.upload(ae,s,{onUploadProgress:t=>{e(t)}});return{promise:this.client.rest.changeBaseUrlVersion(re,(()=>n)),abort:i}}install(e,t){return this.client.rest.changeBaseUrlVersion(re,(()=>this.client.rest.post(`${ae}/site`,{uniq_key:e,version:t})))}getSystemNameExts(e){return this.client.rest.get(ue,e)}getUserNameExts(e){return this.client.rest.get(he,e)}createUserNameExt(e){return this.client.rest.post(`${he}`,{name:e})}deleteUserNameExt(e){return this.client.rest.delete(`${he}/${e}`)}deleteAllUserNameExts(){return this.client.rest.delete(`${he}`)}}const pe="/anons_ext/extensions";class ge{constructor(e){this.client=e}listExtensionsSite(e){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(pe,e)))}extensionDetailSite(e){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(`${pe}/${e}`)))}extensionMarkdown(e,t){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(`${pe}/${e}/readme`,{},t)))}}const _e="/disk",fe=`${_e}/check`;class ve{constructor(e){this.client=e}info(e,t){return this.client.rest.get(`${_e}/${e}/element`,{path:t})}list(e,t){return this.client.rest.get(`${_e}/${e}`,t)}create(e,t){return this.client.rest.post(`${_e}/${e}/element`,t)}replace(e,t,s){return this.client.rest.put(`${_e}/${e}/files?path=${t}`,s)}read(e,t){return this.client.rest.get(`${_e}/${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(`${_e}/${t}/files`,i,{onUploadProgress:t=>{e(t)}});return{promise:r,abort:o}}uploadNet(e,t){return this.client.rest.post(`${_e}/${e}/files/net`,t)}delete(e,t){return this.client.rest.delete(`${_e}/${e}/trash/element`,{path:t})}check(e){return this.client.rest.post(fe,e)}}const $e="/settings";class me{constructor(e){this.client=e}settings(){return this.client.rest.get($e)}changeSettings(e){return this.client.rest.post($e,e)}queryInit(){return this.client.rest.get("/query/init")}}var ke;!function(e){e.Standard="Standard",e.Simple="Simple"}(ke||(ke={}));const be="/groups";class we{constructor(e){this.client=e}list(e){return this.client.rest.get(be,e)}listUsers(e){return this.client.rest.get(`${be}/${e}/users`)}create(e){return this.client.rest.post(be,e)}update(e,t){return this.client.rest.put(`${be}/${e}`,t)}delete(e){return this.client.rest.delete(`${be}/${e}`)}}const Se="/license",ye=`${Se}/manual-check`,xe=`${Se}/hardware/hash`;class Ce{constructor(e){this.client=e}info(){return this.client.rest.get(Se)}create(e){return this.client.rest.post(Se,e)}check(){return this.client.rest.post(ye)}delete(){return this.client.rest.delete(Se)}getHash(){return this.client.rest.get(xe)}}const Ae="/links";class Te{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post(Ae,e)}updateShortLink(e){return this.client.rest.put(Ae,e)}}const Ue="/limitations";class Pe{constructor(e){this.client=e}list(e){return this.client.rest.get(Ue,e)}listUsers(e){return this.client.rest.get(`${Ue}/${e}/users`)}create(e){return this.client.rest.post(Ue,e)}get(e){return this.client.rest.get(`${Ue}/${e}`)}update(e,t){return this.client.rest.put(`${Ue}/${e}`,t)}delete(e){return this.client.rest.delete(`${Ue}/${e}`)}}class De{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get("/logs/users",e)}}const Ee="/notifications",Oe=`${Ee}/all`,Re=`${Ee}/subscription`,Ie=`${Ee}/permission`;class je{constructor(e){this.client=e}list(e){return this.client.rest.get(Ee,e)}toggleStatus(e,t){return this.client.rest.put(Ee,{ids:e,to_status:t})}toggleAllStatus(e){return this.client.rest.put(Oe,{to_status:e})}delete(e){return this.client.rest.delete(Ee,{id:e})}deleteAll(){return this.client.rest.delete(Oe)}getPermission(){return this.client.rest.get(Ie)}setPermission(e){return this.client.rest.post(Ie,{enabled:e})}getSubscription(){return this.client.rest.get(Re)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(Re,t)}}const Le="/roles",Ne=`${Le}/default`,He="/permissions";class We{constructor(e){this.client=e}list(e){return this.client.rest.get(Le,e)}get(e){return this.client.rest.get(`${Le}/${e}`)}getDefault(){return this.client.rest.get(`${Ne}`)}create(e){return this.client.rest.post(Le,e)}update(e,t){return this.client.rest.put(`${Le}/${e}`,t)}delete(e){return this.client.rest.delete(`${Le}/${e}`)}permissionList(){return this.client.rest.get(He)}addPermission(e,t){return this.client.rest.put(`${Le}/${e}/permissions`,{ids:t})}deletePermission(e,t){return this.client.rest.delete(`${Le}/${e}/${He}`,{ids:t})}}const Be="/share",Fe=`${Be}/restrictions`;class qe{constructor(e){this.client=e}info(e,t){const s=new URLSearchParams({path:e,share_token:t});return this.client.rest.get(`${Be}?${s.toString()}`)}checkPassword(e,t){const s=encodeURIComponent(e);return this.client.rest.get(`${Be}/password?share_token=${t}&share_pass=${s}`)}checkToken(e){return this.client.rest.get(`${Be}?share_token=${e}`)}getRestriction(e){return this.client.rest.get(`${Fe}/${e}`)}restrictions(e){return this.client.rest.get(Fe,e)}restrictionsChange(e,t){return this.client.rest.put(`${Fe}/${e}`,t)}}const Ge="/storage",Me=`${Ge}/element`,ze=`${Me}/move`,Ve=`${Me}/copy`,Je=`${Me}/content_type_size`,Xe="/disk";class Ye{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(Ge,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(Me,e)}combineInfo({root:e,rootId:t,path:s,file_version_id:n}){return e===L.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(`${Me}/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===L.fca&&s===L.fca?this.client.rest.post(`${Xe}/${n}/files/move${Xe}/${i}`,r):t===L.fca?(n&&(r.from_divide_id=n),this.client.rest.put(`${Xe}/${i}/files/from/box`,r)):s===L.fca?(i&&(r.to_divide_id=i),this.client.rest.put(`${Xe}/${n}/files/to/box`,r)):this.client.rest.post(ze,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===L.fca&&t===L.fca?this.client.rest.post(`${Xe}/${n}/files/copy${Xe}/${i}`,r):s===L.fca?(n&&(r.from_divide_id=n),this.client.rest.post(`${Xe}/${i}/files/from/box`,r)):t===L.fca?(i&&(r.to_divide_id=i),this.client.rest.post(`${Xe}/${n}/files/to/box`,r)):this.client.rest.post(Ve,e)}pasteFromShared(e,t,s){const n={from_sharing_token:e,from_sharing_password:s,paths:t};return this.client.rest.post(`${Me}/copy`,n)}create(e){return this.client.rest.post(Me,e)}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(Me,s)}favorite(e){return this.client.rest.put(`${Me}?path=${encodeURIComponent(e)}`,{is_favorite:!0})}removeFavorite(e){return this.client.rest.put(`${Me}?path=${encodeURIComponent(e)}`,{is_favorite:!1})}createItem(e){return this.client.rest.post(Me,e)}createWorkDir(e){return this.client.rest.post(Me,e)}sizeWithSection(e){return this.client.rest.get(Je,e)}}const Ke="/storage/files",Qe=`${Ke}/net`;class Ze{constructor(e){this.client=e}read(e,t){return t.path=e,this.client.rest.get(Ke,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(`${Ke}?${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(Ke,i,{onUploadProgress:t=>{e(t)}});return{promise:r,abort:o}}uploadNet(e){return this.client.rest.post(Qe,e)}}class et{constructor(e){this.client=e}instance(){return this.client.rest.get("/storage/instance")}}const tt="/storage/element/share";class st{constructor(e){this.client=e}info(e){return this.client.rest.get(tt,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(tt,s)}change(e){return this.client.rest.put(`${tt}/${e.token}`,e)}delete(e){return this.client.rest.delete(tt,{path:e})}refresh(e){return this.client.rest.put(`${tt}/${e}/refresh`)}}const nt="/storage/trash/element",it=`${nt}/all`;class rt{constructor(e){this.client=e}clear(e){return this.client.rest.delete(nt,e)}clearAll(){return this.client.rest.delete(it)}restore(e){return this.client.rest.patch(nt,{del_groups:e})}restoreAll(){return this.client.rest.patch(it)}}const ot="/users",ct=`${ot}/me`,at=`${ct}/avatars`,lt=`${ct}/sessions`,ht=`${ct}/tokens`,ut=`${ct}/params`,dt=`${ct}/change-password`,pt=`${ot}/initial`,gt=`${ct}/phone`,_t=`${gt}/confirm`;class ft{constructor(e){this.client=e}initial(e){return this.client.rest.post(pt,e)}list(e){return this.client.rest.get(ot,e)}get(e){return this.client.rest.get(ot+`/${e}`)}create(e){return this.client.rest.post(ot,e)}update(e,t){return this.client.rest.put(ot+`/${e}`,t)}delete(e,t){return this.client.rest.delete(`${ot}/${e}`,t)}restore(e){return this.client.rest.post(`${ot}/${e}/restore`)}me(){return this.client.rest.get(ct)}updateMe(e){return this.client.rest.put(ct,e)}createToken(e){return this.client.rest.post(ht,e)}listToken(e){return this.client.rest.get(ht,e)}deleteToken(e){return this.client.rest.delete(`${ht}/${e}`)}changeMyPassword(e){return this.client.rest.put(dt,e)}changeUsersPassword(e,t){return this.client.rest.put(`${ot}/${e}/change-password`,t)}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(at,s)}meDeleteAvatar(){return this.client.rest.delete(at)}meListSession(e){return this.client.rest.get(lt,e)}meDeleteSession(e){let t=lt;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${ot}/${e}/roles`,{role_id:t})}meParams(e){return this.client.rest.get(ut,{name:e})}meSetParams(e,t){return this.client.rest.post(`${ut}/${e}`,t)}meListParams(){return this.client.rest.get(ut)}phone(e){return this.client.rest.post(gt,e)}phoneConfirm(e){return this.client.rest.post(`${_t}/${e}`)}}const vt="/storage/element",$t=`${vt}/history`,mt=`${vt}/version`,kt=`${mt}/current`,bt=`${mt}/size`;class wt{constructor(e){this.client=e}history(e){return this.client.rest.get($t,e)}versions(e){return this.client.rest.get(mt,e)}create(e){return this.client.rest.post(mt,e)}edit(e){return this.client.rest.put(mt,e)}delete(e){return this.client.rest.delete(mt,e)}size(e){return this.client.rest.get(bt,e)}makeCurrent(e){return this.client.rest.post(kt,e)}}export{i as AccessRights,n as AuthApiService,ie as BASE_URL_V1,re as BASE_URL_V2,r as CONNECTIONS_PERMISSION,ce as Client,a as ConnectionGroup,l as ConnectionType,F as ConnectionsApiService,q as DiscoveryApiService,z as DivideApiService,f as DivideMode,d as DivideScope,c as EngineType,u as ExtensionFileMode,h as ExtensionType,de as ExtensionsApiService,ge as ExtensionsExternalApiService,ve as FcaApiService,me as GatewayApiService,we as GroupApiService,Ce as LicenseApiService,m as LicenseError,b as LimitationSubType,k as LimitationType,Pe as LimitationsApiService,Te as LinksApiService,De as LogstashApiService,se as NEED_TOKEN_UPDATE_ERROR,S as NotificationAction,je as NotificationApiService,w as NotificationEntityType,y as NotificationRowAction,x as NotificationStyle,o as OrderDirection,p as PermissionType,ke as QueryInitViewType,A as RequestMethod,T as RequestObserve,C as ResponseType,oe as Rest,_ as RestrictionBooleanStatus,v as RestrictionModeKey,U as RestrictionSharing,g as RestrictionStatus,We as RoleApiService,R as SettingControlType,qe as ShareApiService,Ye as StorageElementApiService,H as StorageElementCheckStatus,j as StorageElementContentType,N as StorageElementHistoryAction,I as StorageElementType,Ze as StorageFilesApiService,et as StorageInstanceApiService,L as StorageRoot,st as StorageShareApiService,rt as StorageTrashApiService,$ as Tariff,ne as TokenUpdate,ft as UserApiService,P as UserAuthType,O as UserParamsLabel,D as UserStatus,E as UserType,wt as VersionApiService,K as applyInterceptors,Q as getCookieValue,Z as makeUrlParams,ee as normalizeHeaders,te 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,u,d,p,g,_,f,v,$,m,k,b,w,S,y,x,C,A,T,U,P,D,E,O,R,I,j,L,N,H;!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"}(u||(u={})),function(e){e.Storage="/storage/element",e.Connection="/connections"}(d||(d={})),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"}(m||(m={})),function(e){e.BySize="size",e.ByExt="extension"}(k||(k={})),function(e){e.Size="size",e.White="extension_white",e.Black="extension_black"}(b||(b={})),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"}(w||(w={})),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"}(S||(S={})),function(e){e.Read="read",e.Unread="unread",e.Delete="delete"}(y||(y={})),function(e){e.Plain="plain",e.Success="success",e.Info="info",e.Warning="warning",e.Error="error"}(x||(x={})),function(e){e.ArrayBuffer="arraybuffer",e.Blob="blob",e.Json="json",e.Text="text"}(C||(C={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH",e.DELETE="DELETE"}(A||(A={})),function(e){e.Body="body",e.Response="response"}(T||(T={})),function(e){e.NONE="none",e.SOFT="soft",e.HARD="hard"}(U||(U={})),function(e){e.Native="native",e.Ldap="ldap",e.Vk="vk"}(P||(P={})),function(e){e.Registering="registering",e.Activated="activated",e.Blocked="blocked",e.BlockedByLicense="blocked_by_license"}(D||(D={})),function(e){e.User="user",e.Guest="guest",e.Emperor="emperor",e.Anonymous="anonymous"}(E||(E={})),function(e){e.Theme="theme",e.Lang="lang",e.Sort="sort"}(O||(O={})),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"}(R||(R={})),function(e){e.Dir="dir",e.File="file",e.WorkDir="work_dir"}(I||(I={})),function(e){e.Any="any",e.Dir="dir",e.Code="code",e.Image="image",e.Audio="audio",e.Video="video",e.Text="text",e.Doc="doc",e.Xls="xls",e.Ppt="ppt"}(j||(j={})),function(e){e.my="my",e.fca="fca",e.divide="divide",e.share="share",e.favorite="favorite",e.trash="trash"}(L||(L={})),function(e){e.Create="create",e.Update="update",e.Move="move"}(N||(N={})),function(e){e[e.CheckNull=0]="CheckNull",e[e.CheckInProgress=1]="CheckInProgress",e[e.CheckPositive=2]="CheckPositive",e[e.CheckNegative=3]="CheckNegative"}(H||(H={}));const W="/connections",B=`${W}/dashboard`;class F{constructor(e){this.client=e}list(e){return this.client.rest.get(W,e)}get(e){return this.client.rest.get(`${W}/${e}`)}update(e,t){return this.client.rest.put(`${W}/${e}`,t)}delete(e){return this.client.rest.delete(`${W}/${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]||W,e)}dashboard(e){return this.client.rest.get(B,e)}}class q{constructor(e){this.client=e}discovery(e){return this.client.rest.get("/discovery",e)}}const G="/divide",M=`${G}/restrictions`;class z{constructor(e){this.client=e}divideDelete(e,t){return this.client.rest.delete(`${e}/${G}/${t}`)}divideDeleteAll(e,t,s,n){return this.client.rest.delete(`${e}/${G}`,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}/${G}`,r)}divideUsers(e,t,s){return this.client.rest.get(`${e}/${G}/users`,Object.assign(Object.assign({},this.makeParam(e,t)),s))}getRestriction(e){return this.client.rest.get(`${M}/${e}`)}restrictionSize(e,t){return this.client.rest.get(`/${t}/restrictions/${e}/size`)}restrictions(e){return this.client.rest.get(`${M}`,e)}restrictionsChange(e,t){return this.client.rest.put(`${M}/${e}`,t)}makeParam(e,t){const s={};return e===d.Connection?s.connection_id=t:s.path=t,s}}function V(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 J extends Error{}function X(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 Y(e,t){if("string"!=typeof e)throw new J("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 J(`Invalid token specified: missing part #${s+1}`);let i;try{i=X(n)}catch(e){throw new J(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new J(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}J.prototype.name="InvalidTokenError";const K=(e,t)=>V(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 Q(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 Z=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 ee(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}function te(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 se="update black token";class ne{constructor(){this.isUpdating=!1,this.tokenUpdateResolve=null}isTokenExpire(e){if(!e)return!1;return 1e3*e<=(new Date).getTime()+3e3}refreshToken(e,t){return V(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}${ie}/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};Q("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 V(this,void 0,void 0,(function*(){return new Promise((e=>{const t=setInterval((()=>{this.isUpdating||(clearInterval(t),e())}),100)}))}))}}const ie="/api/v1",re="/api/v2";class oe{constructor(e,t){this.client=e,this.tokenUpdate=t,this.baseHost=""}get state(){return this.client.state}get(e,t,s){return this.request(A.GET,e,Object.assign({params:t,cache:"no-cache"},s))}post(e,t,s){return this.request(A.POST,e,Object.assign({body:t},s))}put(e,t,s){return this.request(A.PUT,e,Object.assign({body:t,cache:"no-cache"},s))}patch(e,t,s){return this.request(A.PATCH,e,Object.assign({params:t},s))}delete(e,t,s){return this.request(A.DELETE,e,Object.assign({params:t},s))}upload(e,t,s){const n=new AbortController,i=n.signal;return{promise:this.request(A.POST,e,Object.assign({body:t,signal:i},s)),abort:()=>n.abort()}}request(e,t,s){return V(this,void 0,void 0,(function*(){return new Promise(((n,i)=>V(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 K(this.client.requestInterceptors,c)),this.state.authToken)for(const[e,n]of this.state.authToken.entries()){const i=Y(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 K(this.client.requestInterceptors,c))}}const a=new XMLHttpRequest;(null==s?void 0:s.params)&&0!==Object.keys(s.params).length&&(t+="?"+Z(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=ee(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&&[A.POST,A.PUT,A.PATCH].includes(e)&&(a.upload.onprogress=e=>{e.lengthComputable&&(null==s?void 0:s.onUploadProgress)&&s.onUploadProgress(e)}),a.onload=()=>V(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 C.Text:e=a.responseText;break;case C.Blob:case C.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)===T.Response?n(Object.assign(Object.assign({},r),{body:e})):n(e);else{if(this.state.authToken&&e.code===se){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({},r),{error:e})),i(Object.assign(Object.assign({},r),{error:e}))}r=yield K(this.client.responseInterceptors,r)})),a.onerror=()=>{i({status:a.status,statusText:a.statusText,url:a.responseURL,error:"Network error"})},a.send(te(null==s?void 0:s.body))}))))}))}changeBaseUrlVersion(e,t){return V(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 V(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 ce{constructor(e){this.AuthApiService=new n(this),this.ConnectionsApiService=new F(this),this.DiscoveryApiService=new q(this),this.DivideApiService=new z(this),this.ExtensionsApiService=new de(this),this.ExtensionsExternalApiService=new ge(this),this.FcaApiService=new ve(this),this.GatewayApiService=new me(this),this.GroupApiService=new we(this),this.LicenseApiService=new Ce(this),this.LinksApiService=new Te(this),this.LimitationsApiService=new Pe(this),this.LogstashApiService=new De(this),this.NotificationApiService=new je(this),this.RoleApiService=new We(this),this.ShareApiService=new qe(this),this.StorageElementApiService=new Ye(this,this.FcaApiService),this.StorageFilesApiService=new Ze(this),this.StorageInstanceApiService=new et(this),this.StorageShareApiService=new st(this),this.StorageTrashApiService=new rt(this),this.UserApiService=new ft(this),this.VersionApiService=new yt(this),this.tokenUpdate=new ne,this.rest=new oe(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)||ie},requestParams:{path:"",headers:{},query:{},body:null,cache:"no-cache"},authToken:null,skipInterceptors:!1},this.rest.baseHost=this.state.clientParams.host||""}}const ae="/static/extensions",le="/extensions/defaults",he=`${ae}/names/users`,ue=`${ae}/names/system`;class de{constructor(e){this.client=e}getSetting(e){return this.client.rest.get(`${ae}/${e}/settings`)}setSetting(e,t){return this.client.rest.post(`${ae}/${e}/settings`,t)}deleteSetting(e){return this.client.rest.delete(`${ae}/${e}/settings`)}get(e){return this.client.rest.get(`${ae}/${e}`)}getByKey(e){return this.client.rest.get(`${ae}/${e}`)}getDefault(e=[]){return this.client.rest.get(le,{ext_code:e})}setDefault(e,t){return this.client.rest.post(le,{ext_code:e,ext_uniq_key:t})}checkUpdates(){return this.client.rest.post(`${ae}/check_updates`)}updateVersion(e,t){return this.client.rest.put(`${ae}/${e}`,{version:t})}list(e){return this.client.rest.get(ae,e)}delete(e,t){return this.client.rest.delete(`${ae}/${e}`)}upload(e,t){const s=new FormData;s.set("file",t);const{promise:n,abort:i}=this.client.rest.upload(ae,s,{onUploadProgress:t=>{e(t)}});return{promise:this.client.rest.changeBaseUrlVersion(re,(()=>n)),abort:i}}install(e,t){return this.client.rest.changeBaseUrlVersion(re,(()=>this.client.rest.post(`${ae}/site`,{uniq_key:e,version:t})))}getSystemNameExts(e){return this.client.rest.get(ue,e)}getUserNameExts(e){return this.client.rest.get(he,e)}createUserNameExt(e){return this.client.rest.post(`${he}`,{name:e})}deleteUserNameExt(e){return this.client.rest.delete(`${he}/${e}`)}deleteAllUserNameExts(){return this.client.rest.delete(`${he}`)}}const pe="/anons_ext/extensions";class ge{constructor(e){this.client=e}listExtensionsSite(e){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(pe,e)))}extensionDetailSite(e){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(`${pe}/${e}`)))}extensionMarkdown(e,t){return this.client.rest.changeHost("https://next-box.ru",(()=>this.client.rest.get(`${pe}/${e}/readme`,{},t)))}}const _e="/disk",fe=`${_e}/check`;class ve{constructor(e){this.client=e}info(e,t){return this.client.rest.get(`${_e}/${e}/element`,{path:t})}list(e,t){return this.client.rest.get(`${_e}/${e}`,t)}create(e,t){return this.client.rest.post(`${_e}/${e}/element`,t)}replace(e,t,s){return this.client.rest.put(`${_e}/${e}/files?path=${t}`,s)}read(e,t){return this.client.rest.get(`${_e}/${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(`${_e}/${t}/files`,i,{onUploadProgress:t=>{e(t)}});return{promise:r,abort:o}}uploadNet(e,t){return this.client.rest.post(`${_e}/${e}/files/net`,t)}delete(e,t){return this.client.rest.delete(`${_e}/${e}/trash/element`,{path:t})}check(e){return this.client.rest.post(fe,e)}}const $e="/settings";class me{constructor(e){this.client=e}settings(){return this.client.rest.get($e)}changeSettings(e){return this.client.rest.post($e,e)}queryInit(){return this.client.rest.get("/query/init")}}var ke;!function(e){e.Standard="Standard",e.Simple="Simple"}(ke||(ke={}));const be="/groups";class we{constructor(e){this.client=e}list(e){return this.client.rest.get(be,e)}listUsers(e){return this.client.rest.get(`${be}/${e}/users`)}create(e){return this.client.rest.post(be,e)}update(e,t){return this.client.rest.put(`${be}/${e}`,t)}delete(e){return this.client.rest.delete(`${be}/${e}`)}}const Se="/license",ye=`${Se}/manual-check`,xe=`${Se}/hardware/hash`;class Ce{constructor(e){this.client=e}info(){return this.client.rest.get(Se)}create(e){return this.client.rest.post(Se,e)}check(){return this.client.rest.post(ye)}delete(){return this.client.rest.delete(Se)}getHash(){return this.client.rest.get(xe)}}const Ae="/links";class Te{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post(Ae,e)}updateShortLink(e){return this.client.rest.put(Ae,e)}}const Ue="/limitations";class Pe{constructor(e){this.client=e}list(e){return this.client.rest.get(Ue,e)}listUsers(e){return this.client.rest.get(`${Ue}/${e}/users`)}create(e){return this.client.rest.post(Ue,e)}get(e){return this.client.rest.get(`${Ue}/${e}`)}update(e,t){return this.client.rest.put(`${Ue}/${e}`,t)}delete(e){return this.client.rest.delete(`${Ue}/${e}`)}}class De{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get("/logs/users",e)}}const Ee="/notifications",Oe=`${Ee}/all`,Re=`${Ee}/subscription`,Ie=`${Ee}/permission`;class je{constructor(e){this.client=e}list(e){return this.client.rest.get(Ee,e)}toggleStatus(e,t){return this.client.rest.put(Ee,{ids:e,to_status:t})}toggleAllStatus(e){return this.client.rest.put(Oe,{to_status:e})}delete(e){return this.client.rest.delete(Ee,{id:e})}deleteAll(){return this.client.rest.delete(Oe)}getPermission(){return this.client.rest.get(Ie)}setPermission(e){return this.client.rest.post(Ie,{enabled:e})}getSubscription(){return this.client.rest.get(Re)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(Re,t)}}const Le="/roles",Ne=`${Le}/default`,He="/permissions";class We{constructor(e){this.client=e}list(e){return this.client.rest.get(Le,e)}get(e){return this.client.rest.get(`${Le}/${e}`)}getDefault(){return this.client.rest.get(`${Ne}`)}create(e){return this.client.rest.post(Le,e)}update(e,t){return this.client.rest.put(`${Le}/${e}`,t)}delete(e){return this.client.rest.delete(`${Le}/${e}`)}permissionList(){return this.client.rest.get(He)}addPermission(e,t){return this.client.rest.put(`${Le}/${e}/permissions`,{ids:t})}deletePermission(e,t){return this.client.rest.delete(`${Le}/${e}/${He}`,{ids:t})}}const Be="/share",Fe=`${Be}/restrictions`;class qe{constructor(e){this.client=e}info(e,t){const s=new URLSearchParams({path:e,share_token:t});return this.client.rest.get(`${Be}?${s.toString()}`)}checkPassword(e,t){const s=encodeURIComponent(e);return this.client.rest.get(`${Be}/password?share_token=${t}&share_pass=${s}`)}checkToken(e){return this.client.rest.get(`${Be}?share_token=${e}`)}getRestriction(e){return this.client.rest.get(`${Fe}/${e}`)}restrictions(e){return this.client.rest.get(Fe,e)}restrictionsChange(e,t){return this.client.rest.put(`${Fe}/${e}`,t)}}const Ge="/storage",Me=`${Ge}/element`,ze=`${Me}/move`,Ve=`${Me}/copy`,Je=`${Me}/content_type_size`,Xe="/disk";class Ye{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(Ge,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(Me,e)}combineInfo({root:e,rootId:t,path:s,file_version_id:n}){return e===L.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(`${Me}/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===L.fca&&s===L.fca?this.client.rest.post(`${Xe}/${n}/files/move${Xe}/${i}`,r):t===L.fca?(n&&(r.from_divide_id=n),this.client.rest.put(`${Xe}/${i}/files/from/box`,r)):s===L.fca?(i&&(r.to_divide_id=i),this.client.rest.put(`${Xe}/${n}/files/to/box`,r)):this.client.rest.post(ze,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===L.fca&&t===L.fca?this.client.rest.post(`${Xe}/${n}/files/copy${Xe}/${i}`,r):s===L.fca?(n&&(r.from_divide_id=n),this.client.rest.post(`${Xe}/${i}/files/from/box`,r)):t===L.fca?(i&&(r.to_divide_id=i),this.client.rest.post(`${Xe}/${n}/files/to/box`,r)):this.client.rest.post(Ve,e)}pasteFromShared(e,t,s){const n={from_sharing_token:e,from_sharing_password:s,paths:t};return this.client.rest.post(`${Me}/copy`,n)}create(e){return this.client.rest.post(Me,e)}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(Me,s)}favorite(e){return this.client.rest.put(`${Me}?path=${encodeURIComponent(e)}`,{is_favorite:!0})}removeFavorite(e){return this.client.rest.put(`${Me}?path=${encodeURIComponent(e)}`,{is_favorite:!1})}createItem(e){return this.client.rest.post(Me,e)}createWorkDir(e){return this.client.rest.post(Me,e)}sizeWithSection(e){return this.client.rest.get(Je,e)}}const Ke="/storage/files",Qe=`${Ke}/net`;class Ze{constructor(e){this.client=e}read(e,t){return t.path=e,this.client.rest.get(Ke,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(`${Ke}?${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(Ke,i,{onUploadProgress:t=>{e(t)}});return{promise:r,abort:o}}uploadNet(e){return this.client.rest.post(Qe,e)}}class et{constructor(e){this.client=e}instance(){return this.client.rest.get("/storage/instance")}}const tt="/storage/element/share";class st{constructor(e){this.client=e}info(e){return this.client.rest.get(tt,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(tt,s)}change(e){return this.client.rest.put(`${tt}/${e.token}`,e)}delete(e){return this.client.rest.delete(tt,{path:e})}refresh(e){return this.client.rest.put(`${tt}/${e}/refresh`)}}const nt="/storage/trash/element",it=`${nt}/all`;class rt{constructor(e){this.client=e}clear(e){return this.client.rest.delete(nt,e)}clearAll(){return this.client.rest.delete(it)}restore(e){return this.client.rest.patch(nt,{del_groups:e})}restoreAll(){return this.client.rest.patch(it)}}const ot="/users",ct=`${ot}/me`,at=`${ct}/avatars`,lt=`${ct}/sessions`,ht=`${ct}/tokens`,ut=`${ct}/params`,dt=`${ct}/change-password`,pt=`${ot}/initial`,gt=`${ct}/phone`,_t=`${gt}/confirm`;class ft{constructor(e){this.client=e}initial(e){return this.client.rest.post(pt,e)}list(e){return this.client.rest.get(ot,e)}get(e){return this.client.rest.get(ot+`/${e}`)}create(e){return this.client.rest.post(ot,e)}update(e,t){return this.client.rest.put(ot+`/${e}`,t)}delete(e,t){return this.client.rest.delete(`${ot}/${e}`,t)}restore(e){return this.client.rest.post(`${ot}/${e}/restore`)}me(){return this.client.rest.get(ct)}updateMe(e){return this.client.rest.put(ct,e)}createToken(e){return this.client.rest.post(ht,e)}listToken(e){return this.client.rest.get(ht,e)}deleteToken(e){return this.client.rest.delete(`${ht}/${e}`)}changeMyPassword(e){return this.client.rest.put(dt,e)}changeUsersPassword(e,t){return this.client.rest.put(`${ot}/${e}/change-password`,t)}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(at,s)}meDeleteAvatar(){return this.client.rest.delete(at)}meListSession(e){return this.client.rest.get(lt,e)}meDeleteSession(e){let t=lt;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${ot}/${e}/roles`,{role_id:t})}meParams(e){return this.client.rest.get(ut,{name:e})}meSetParams(e,t){return this.client.rest.post(`${ut}/${e}`,t)}meListParams(){return this.client.rest.get(ut)}phone(e){return this.client.rest.post(gt,e)}phoneConfirm(e){return this.client.rest.post(`${_t}/${e}`)}}const vt="/storage/element",$t=`${vt}/history`,mt=`${vt}/version`,kt=`${mt}/lock`,bt=`${mt}/unlock`,wt=`${mt}/current`,St=`${mt}/size`;class yt{constructor(e){this.client=e}history(e){return this.client.rest.get($t,e)}versions(e){return this.client.rest.get(mt,e)}create(e){return this.client.rest.post(mt,e)}edit(e){return this.client.rest.put(mt,e)}delete(e){return this.client.rest.delete(mt,e)}size(e){return this.client.rest.get(St,e)}makeCurrent(e){return this.client.rest.post(wt,e)}lock(e){return this.client.rest.patch(kt,e)}unlock(e){return this.client.rest.patch(bt,e)}}export{i as AccessRights,n as AuthApiService,ie as BASE_URL_V1,re as BASE_URL_V2,r as CONNECTIONS_PERMISSION,ce as Client,a as ConnectionGroup,l as ConnectionType,F as ConnectionsApiService,q as DiscoveryApiService,z as DivideApiService,f as DivideMode,d as DivideScope,c as EngineType,u as ExtensionFileMode,h as ExtensionType,de as ExtensionsApiService,ge as ExtensionsExternalApiService,ve as FcaApiService,me as GatewayApiService,we as GroupApiService,Ce as LicenseApiService,m as LicenseError,b as LimitationSubType,k as LimitationType,Pe as LimitationsApiService,Te as LinksApiService,De as LogstashApiService,se as NEED_TOKEN_UPDATE_ERROR,S as NotificationAction,je as NotificationApiService,w as NotificationEntityType,y as NotificationRowAction,x as NotificationStyle,o as OrderDirection,p as PermissionType,ke as QueryInitViewType,A as RequestMethod,T as RequestObserve,C as ResponseType,oe as Rest,_ as RestrictionBooleanStatus,v as RestrictionModeKey,U as RestrictionSharing,g as RestrictionStatus,We as RoleApiService,R as SettingControlType,qe as ShareApiService,Ye as StorageElementApiService,H as StorageElementCheckStatus,j as StorageElementContentType,N as StorageElementHistoryAction,I as StorageElementType,Ze as StorageFilesApiService,et as StorageInstanceApiService,L as StorageRoot,st as StorageShareApiService,rt as StorageTrashApiService,$ as Tariff,ne as TokenUpdate,ft as UserApiService,P as UserAuthType,O as UserParamsLabel,D as UserStatus,E as UserType,yt as VersionApiService,K as applyInterceptors,Q as getCookieValue,Z as makeUrlParams,ee as normalizeHeaders,te as prepareRequestBody};
|
package/dist/classes/rest.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare class Rest {
|
|
|
12
12
|
get(path: string, params?: Record<string, any>, config?: RequestConfig): Promise<any>;
|
|
13
13
|
post(path: string, body?: any, config?: RequestConfig): Promise<any>;
|
|
14
14
|
put(path: string, body?: any, config?: RequestConfig): Promise<any>;
|
|
15
|
-
patch(path: string,
|
|
15
|
+
patch(path: string, params?: Record<string, any>, config?: RequestConfig): Promise<any>;
|
|
16
16
|
delete(path: string, params?: Record<string, any>, config?: RequestConfig): Promise<any>;
|
|
17
17
|
upload(path: string, body: FormData, config?: RequestConfig): {
|
|
18
18
|
promise: Promise<any>;
|
package/dist/index.d.ts
CHANGED
|
@@ -75,6 +75,10 @@ interface StorageElementVersion {
|
|
|
75
75
|
update_date: string;
|
|
76
76
|
is_current_version: boolean;
|
|
77
77
|
}
|
|
78
|
+
interface StorageElementVersionLock {
|
|
79
|
+
lock_begin: string;
|
|
80
|
+
timeout: number;
|
|
81
|
+
}
|
|
78
82
|
declare enum StorageElementHistoryAction {
|
|
79
83
|
Create = "create",
|
|
80
84
|
Update = "update",
|
|
@@ -641,6 +645,11 @@ interface ExtensionListParams extends RequestBaseParams {
|
|
|
641
645
|
lang?: string;
|
|
642
646
|
}
|
|
643
647
|
|
|
648
|
+
interface FileLocking {
|
|
649
|
+
enabled: boolean;
|
|
650
|
+
timeout: number;
|
|
651
|
+
}
|
|
652
|
+
|
|
644
653
|
interface License {
|
|
645
654
|
custom_max_users_count: number | null;
|
|
646
655
|
expire_in: string;
|
|
@@ -884,7 +893,7 @@ declare class Rest {
|
|
|
884
893
|
get(path: string, params?: Record<string, any>, config?: RequestConfig): Promise<any>;
|
|
885
894
|
post(path: string, body?: any, config?: RequestConfig): Promise<any>;
|
|
886
895
|
put(path: string, body?: any, config?: RequestConfig): Promise<any>;
|
|
887
|
-
patch(path: string,
|
|
896
|
+
patch(path: string, params?: Record<string, any>, config?: RequestConfig): Promise<any>;
|
|
888
897
|
delete(path: string, params?: Record<string, any>, config?: RequestConfig): Promise<any>;
|
|
889
898
|
upload(path: string, body: FormData, config?: RequestConfig): {
|
|
890
899
|
promise: Promise<any>;
|
|
@@ -1115,6 +1124,7 @@ interface QueryInitResponse {
|
|
|
1115
1124
|
cache_users: User[];
|
|
1116
1125
|
lock_screen: LockScreen;
|
|
1117
1126
|
view_type: QueryInitViewType;
|
|
1127
|
+
file_locking: FileLocking;
|
|
1118
1128
|
restrictions?: Restriction;
|
|
1119
1129
|
open_in_desktop_settings: {
|
|
1120
1130
|
open_in_desktop_enabled: boolean;
|
|
@@ -1363,6 +1373,8 @@ declare class VersionApiService {
|
|
|
1363
1373
|
delete(params: HistoryRequestParams): Promise<void>;
|
|
1364
1374
|
size(params: HistoryRequestParams): Promise<number>;
|
|
1365
1375
|
makeCurrent(params: HistoryRequestParams): Promise<void>;
|
|
1376
|
+
lock(params: VersionLockRequestParams): Promise<StorageElementVersionLock>;
|
|
1377
|
+
unlock(params: VersionLockRequestParams): Promise<void>;
|
|
1366
1378
|
}
|
|
1367
1379
|
type HistoryListRequestParams = HistoryRequestParams & RequestBaseParams;
|
|
1368
1380
|
interface HistoryRequestParams {
|
|
@@ -1370,6 +1382,11 @@ interface HistoryRequestParams {
|
|
|
1370
1382
|
divide_id?: number | null;
|
|
1371
1383
|
file_version_id?: string;
|
|
1372
1384
|
}
|
|
1385
|
+
interface VersionLockRequestParams {
|
|
1386
|
+
path: string;
|
|
1387
|
+
file_version_id: string;
|
|
1388
|
+
divide_id?: number;
|
|
1389
|
+
}
|
|
1373
1390
|
|
|
1374
1391
|
declare const applyInterceptors: <T>(interceptors: {
|
|
1375
1392
|
fulfilled: (arg: T) => T | Promise<T>;
|
|
@@ -1384,4 +1401,4 @@ declare function normalizeHeaders(headers: Headers | [string, string][] | Record
|
|
|
1384
1401
|
|
|
1385
1402
|
declare function prepareRequestBody(body: unknown): XMLHttpRequestBodyInit | Document | null;
|
|
1386
1403
|
|
|
1387
|
-
export { AccessRights, type AccessToken, AuthApiService, type AuthToken, type AuthType, BASE_URL_V1, BASE_URL_V2, CONNECTIONS_PERMISSION, type ChangeLicenseParams, Client, type Connection, type ConnectionCreateParams, ConnectionGroup, ConnectionType, ConnectionsApiService, type CreateLimitationsParams, type CreateStorageElementParams, type CreateUserGroupParams, type CreateUserParams, type CreateUserRoleParams, type CutLinkRequest, type Discovery, DiscoveryApiService, DivideApiService, DivideMode, type DivideResourceType, type DivideResponseList, DivideScope, EngineType, type Extension, type ExtensionDefault, type ExtensionExternal, type ExtensionExternalInList, type ExtensionExternalListParams, ExtensionFileMode, type ExtensionListParams, type ExtensionMetaPayload, ExtensionType, ExtensionsApiService, ExtensionsExternalApiService, FcaApiService, GatewayApiService, GroupApiService, type HistoryListRequestParams, type HistoryNote, type HistoryRequestParams, type HttpEvent, type HttpResponse, type Lang, type License, LicenseApiService, LicenseError, type Limitation, LimitationSubType, LimitationType, LimitationsApiService, LinksApiService, type LockScreen, LogstashApiService, NEED_TOKEN_UPDATE_ERROR, type NameExtensionListParams, type NbAppState, type NbClientParams, type NbRequestParams, NotificationAction, type NotificationActionGroup, NotificationApiService, NotificationEntityType, type NotificationPayload, NotificationRowAction, NotificationStyle, type OnUploadProgress, OrderDirection, type PayloadFile, type Permission, type PermissionItem, PermissionType, type ProgressEvent, type QueryInitResponse, QueryInitViewType, type RequestAuthSettingsParams, type RequestAuthTokenParams, type RequestBaseParams, type RequestConfig, type RequestConnectionParams, type RequestLimitationsListParams, RequestMethod, type RequestNotificationListParams, RequestObserve, type RequestStorageListParams, type RequestUserDivideParams, type RequestUserGroupListParams, type RequestUserListParams, type RequestUserRoleListParams, type RequestUsersLogParams, type RequestVersionsSizeParams, type ResponseItem, type ResponseList, type ResponseListNotification, ResponseType, Rest, type Restriction, RestrictionBooleanStatus, RestrictionModeKey, RestrictionSharing, RestrictionStatus, RoleApiService, type Setting, SettingControlType, type SettingField, type SettingFieldView, type SettingLang, type SettingValue, type SettingValueField, type SettingVariant, type SettingViewConnectionChoose, type SettingViewSelect, ShareApiService, type ShareInfo, type ShareModel, type SizeBySection, type StorageElement, StorageElementApiService, StorageElementCheckStatus, StorageElementContentType, type StorageElementHistory, StorageElementHistoryAction, type StorageElementPaste, type StorageElementPasteParams, StorageElementType, type StorageElementVersion, StorageFilesApiService, type StorageInstance, StorageInstanceApiService, type StorageItemSizeParams, type StorageItemSizePathParams, StorageRoot, type StorageRouteData, StorageShareApiService, StorageTrashApiService, type StorageTrashElement, type StorageTrashItem, Tariff, TokenUpdate, type UnionRestriction, type UploadNetRequestParams, type User, UserApiService, UserAuthType, type UserDivide, type UserGroup, type UserLabel, type UserNamesExtension, type UserNotification, type UserParams, UserParamsLabel, type UserPhone, type UserRole, type UserSession, UserStatus, type UserToken, UserType, type UsersLog, VersionApiService, applyInterceptors, getCookieValue, makeUrlParams, normalizeHeaders, prepareRequestBody };
|
|
1404
|
+
export { AccessRights, type AccessToken, AuthApiService, type AuthToken, type AuthType, BASE_URL_V1, BASE_URL_V2, CONNECTIONS_PERMISSION, type ChangeLicenseParams, Client, type Connection, type ConnectionCreateParams, ConnectionGroup, ConnectionType, ConnectionsApiService, type CreateLimitationsParams, type CreateStorageElementParams, type CreateUserGroupParams, type CreateUserParams, type CreateUserRoleParams, type CutLinkRequest, type Discovery, DiscoveryApiService, DivideApiService, DivideMode, type DivideResourceType, type DivideResponseList, DivideScope, EngineType, type Extension, type ExtensionDefault, type ExtensionExternal, type ExtensionExternalInList, type ExtensionExternalListParams, ExtensionFileMode, type ExtensionListParams, type ExtensionMetaPayload, ExtensionType, ExtensionsApiService, ExtensionsExternalApiService, FcaApiService, type FileLocking, GatewayApiService, GroupApiService, type HistoryListRequestParams, type HistoryNote, type HistoryRequestParams, type HttpEvent, type HttpResponse, type Lang, type License, LicenseApiService, LicenseError, type Limitation, LimitationSubType, LimitationType, LimitationsApiService, LinksApiService, type LockScreen, LogstashApiService, NEED_TOKEN_UPDATE_ERROR, type NameExtensionListParams, type NbAppState, type NbClientParams, type NbRequestParams, NotificationAction, type NotificationActionGroup, NotificationApiService, NotificationEntityType, type NotificationPayload, NotificationRowAction, NotificationStyle, type OnUploadProgress, OrderDirection, type PayloadFile, type Permission, type PermissionItem, PermissionType, type ProgressEvent, type QueryInitResponse, QueryInitViewType, type RequestAuthSettingsParams, type RequestAuthTokenParams, type RequestBaseParams, type RequestConfig, type RequestConnectionParams, type RequestLimitationsListParams, RequestMethod, type RequestNotificationListParams, RequestObserve, type RequestStorageListParams, type RequestUserDivideParams, type RequestUserGroupListParams, type RequestUserListParams, type RequestUserRoleListParams, type RequestUsersLogParams, type RequestVersionsSizeParams, type ResponseItem, type ResponseList, type ResponseListNotification, ResponseType, Rest, type Restriction, RestrictionBooleanStatus, RestrictionModeKey, RestrictionSharing, RestrictionStatus, RoleApiService, type Setting, SettingControlType, type SettingField, type SettingFieldView, type SettingLang, type SettingValue, type SettingValueField, type SettingVariant, type SettingViewConnectionChoose, type SettingViewSelect, ShareApiService, type ShareInfo, type ShareModel, type SizeBySection, type StorageElement, StorageElementApiService, StorageElementCheckStatus, StorageElementContentType, type StorageElementHistory, StorageElementHistoryAction, type StorageElementPaste, type StorageElementPasteParams, StorageElementType, type StorageElementVersion, type StorageElementVersionLock, StorageFilesApiService, type StorageInstance, StorageInstanceApiService, type StorageItemSizeParams, type StorageItemSizePathParams, StorageRoot, type StorageRouteData, StorageShareApiService, StorageTrashApiService, type StorageTrashElement, type StorageTrashItem, Tariff, TokenUpdate, type UnionRestriction, type UploadNetRequestParams, type User, UserApiService, UserAuthType, type UserDivide, type UserGroup, type UserLabel, type UserNamesExtension, type UserNotification, type UserParams, UserParamsLabel, type UserPhone, type UserRole, type UserSession, UserStatus, type UserToken, UserType, type UsersLog, VersionApiService, type VersionLockRequestParams, applyInterceptors, getCookieValue, makeUrlParams, normalizeHeaders, prepareRequestBody };
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/storage.d.ts
CHANGED
|
@@ -76,6 +76,10 @@ export interface StorageElementVersion {
|
|
|
76
76
|
update_date: string;
|
|
77
77
|
is_current_version: boolean;
|
|
78
78
|
}
|
|
79
|
+
export interface StorageElementVersionLock {
|
|
80
|
+
lock_begin: string;
|
|
81
|
+
timeout: number;
|
|
82
|
+
}
|
|
79
83
|
export declare enum StorageElementHistoryAction {
|
|
80
84
|
Create = "create",
|
|
81
85
|
Update = "update",
|