nb-js-client 0.0.82 → 0.0.84
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/notifications-api.service.d.ts +17 -0
- package/dist/api/share-api.service.d.ts +8 -2
- package/dist/bundle.cjs.js +1 -1
- package/dist/bundle.esm.js +1 -1
- package/dist/classes/http-error-response.d.ts +17 -0
- package/dist/classes/http-event.d.ts +24 -0
- package/dist/classes/http-response.d.ts +14 -0
- package/dist/classes/tokenUpdate.d.ts +12 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/send-request.d.ts +10 -0
- package/dist/index.d.ts +12 -3
- package/dist/types/group.d.ts +23 -0
- package/dist/types/notification.d.ts +2 -0
- package/dist/types/query-init.d.ts +23 -0
- package/dist/types/role.d.ts +17 -0
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Client } from '../classes';
|
|
2
|
+
import { NotificationActionGroup, NotificationRowAction, RequestNotificationListParams, ResponseListNotification } from '../types';
|
|
3
|
+
export declare class NotificationsApiService {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: Client);
|
|
6
|
+
list(params?: RequestNotificationListParams): Promise<ResponseListNotification>;
|
|
7
|
+
toggleStatus(ids: number[], to_status: NotificationRowAction): Promise<void>;
|
|
8
|
+
toggleAllStatus(to_status: NotificationRowAction): Promise<void>;
|
|
9
|
+
delete(id: number[]): Promise<void>;
|
|
10
|
+
deleteAll(): Promise<void>;
|
|
11
|
+
getPermission(): Promise<{
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
setPermission(permission: boolean): Promise<void>;
|
|
15
|
+
getSubscription(): Promise<NotificationActionGroup>;
|
|
16
|
+
setSubscription(data: NotificationActionGroup): Promise<void>;
|
|
17
|
+
}
|
|
@@ -3,13 +3,19 @@ import { RequestBaseParams, ResponseList, RestrictionStatus, ShareInfo, UnionRes
|
|
|
3
3
|
export declare class ShareApiService {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: Client);
|
|
6
|
-
info(
|
|
6
|
+
info(share_token: string): Promise<ShareInfo>;
|
|
7
7
|
checkPassword(password: string, share_token: string): Promise<any>;
|
|
8
|
-
checkToken(share_token: string): Promise<any>;
|
|
9
8
|
getRestriction(token: string): Promise<UnionRestriction>;
|
|
10
9
|
restrictions(params?: RequestBaseParams): Promise<ResponseList<ShareInfo>>;
|
|
11
10
|
restrictionsChange(token: string, data: {
|
|
12
11
|
status: RestrictionStatus;
|
|
13
12
|
comment: string;
|
|
14
13
|
}): Promise<ResponseList<ShareInfo>>;
|
|
14
|
+
login(data: RequestShareLoginParams): Promise<{
|
|
15
|
+
share_token: string;
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
export interface RequestShareLoginParams {
|
|
19
|
+
share_key: string;
|
|
20
|
+
share_password?: string;
|
|
15
21
|
}
|
package/dist/bundle.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e="/login",t=`${e}/ldap`,s=`${e}/update`,r=`${e}/tfa`;class i{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)}loginTfa(e){return this.client.rest.post(r,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 n;exports.AccessRights=void 0,(n=exports.AccessRights||(exports.AccessRights={})).LicenseRead="license_read",n.LicenseManage="license_edit",n.UsersRead="users_read",n.UsersCreate="users_create",n.UsersActivate="users_activate",n.GroupsRead="groups_read",n.GroupsCreate="groups_create",n.RolesRead="roles_read",n.RolesCreate="roles_create",n.Share="share",n.Divide="divide",n.ExtensionsRead="extensions_read",n.ExtensionsManage="extensions_write",n.RestrictionShareRead="restriction_share_read",n.RestrictionShareWrite="restriction_share_write",n.RestrictionDivideRead="restriction_divide_read",n.RestrictionDivideWrite="restriction_divide_write",n.LimitationsRead="limitations_read",n.LimitationsEdit="limitations_edit",n.ReadUserLogs="read_user_logs",n.ConnectionsRead="connections_read",n.ConnectionsDividing="connections_dividing",n.ConnectionsYandexDisk="connections_yandex_disk",n.ConnectionsSsh="connections_ssh",n.ConnectionsMail="connections_mail",n.ConnectionsS3="connections_s3",n.ConnectionsDiscord="connections_discord",n.ConnectionsWebdav="connections_webdav",n.ConnectionsNextcloud="connections_nextcloud",n.ConnectionsNextbox="connections_nextbox",n.ConnectionsHttpProxy="connections_http_proxy",n.SystemInfoServiceList="system_info_service_list",n.SettingsRead="settings_read",n.SettingsWrite="settings_write";const o=[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 c,a,l,p,d,h,u,g,x,v,_,S,$,m,f,y,k,A,b,w,T,R,C,E,U,D,P,O,L,N,I,j,q,M;exports.OrderDirection=void 0,(c=exports.OrderDirection||(exports.OrderDirection={})).DEFAULT="",c.ASC="asc",c.DESC="desc",exports.EngineType=void 0,(a=exports.EngineType||(exports.EngineType={})).WebSocket="websocket",a.PostMessage="postmessage",a.Empty="",exports.ConnectionGroup=void 0,(l=exports.ConnectionGroup||(exports.ConnectionGroup={})).Storages="storages_connections_group",l.Webhooks="webhooks_connections_group",l.Unknown="unknown_connections_group",l.Proxy="proxy_connections_group",exports.ConnectionType=void 0,(p=exports.ConnectionType||(exports.ConnectionType={})).SSH="ssh_connection",p.YandexDisk="yandex_disk",p.Mail="mail",p.Discord="discord",p.Webdav="webdav_connection",p.Nextcloud="nextcloud_connection",p.NextBox="nextbox_connection",p.HttpProxy="http_proxy_connection",p.S3="s3_connection",exports.ExtensionType=void 0,(d=exports.ExtensionType||(exports.ExtensionType={})).App="app",d.File="file",d.WorkDir="work_dir",exports.ExtensionFileMode=void 0,(h=exports.ExtensionFileMode||(exports.ExtensionFileMode={})).Read="read",h.ReadAndWrite="read_and_write",h.Write="write",exports.DivideScope=void 0,(u=exports.DivideScope||(exports.DivideScope={})).Storage="/storage/element",u.Connection="/connections",exports.PermissionType=void 0,(g=exports.PermissionType||(exports.PermissionType={})).CLOSE="",g.READ="r",g.WRITE="rw",exports.RestrictionStatus=void 0,(x=exports.RestrictionStatus||(exports.RestrictionStatus={})).WAITING="waiting",x.APPROVED="approved",x.REJECTED="rejected",exports.RestrictionBooleanStatus=void 0,(v=exports.RestrictionBooleanStatus||(exports.RestrictionBooleanStatus={})).TRUE="true",v.FALSE="false",exports.DivideMode=void 0,(_=exports.DivideMode||(exports.DivideMode={})).User="to_user_id",_.Group="to_user_group_id",exports.RestrictionModeKey=void 0,(S=exports.RestrictionModeKey||(exports.RestrictionModeKey={})).Divide="divide",S.Share="share",exports.Tariff=void 0,($=exports.Tariff||(exports.Tariff={})).Free="free",$.Business="business",$.Enterprise="enterprise",exports.LicenseError=void 0,(m=exports.LicenseError||(exports.LicenseError={})).NotActivated="License not activated",m.Blocked="License blocked",m.Expired="License has been expired",m.NotValid="License not valid",m.NotFound="license file not found",exports.LimitationType=void 0,(f=exports.LimitationType||(exports.LimitationType={})).BySize="size",f.ByExt="extension",exports.LimitationSubType=void 0,(y=exports.LimitationSubType||(exports.LimitationSubType={})).Size="size",y.White="extension_white",y.Black="extension_black",exports.NotificationEntityType=void 0,(k=exports.NotificationEntityType||(exports.NotificationEntityType={})).Dir="dir",k.File="file",k.User="user",k.Other="other",k.WorkDir="work_dir",k.License="license",k.Extension="extension",k.Connection="connection",exports.NotificationAction=void 0,(A=exports.NotificationAction||(exports.NotificationAction={})).SecurityCheckNegative="action_security_check_negative",A.SecurityCheckPositive="action_security_check_positive",A.CommentVersionMention="action_version_comment_mention",A.OpenSharing="open_sharing",A.ChangeSharing="change_sharing",A.CancelSharing="cancel_sharing",A.DivideDirAddFileToOwner="divide_dir_add_file_to_owner",A.DivideDirAddDirToOwner="divide_dir_add_dir_to_owner",A.DivideDirAddWorkDirToOwner="divide_dir_add_work_dir_to_owner",A.DivideConnectionAddFileToOwner="divide_connection_add_file_to_owner",A.DivideConnectionAddDirToOwner="divide_connection_add_dir_to_owner",A.CancelDivideDir="cancel_divide_dir",A.CancelDivideFile="cancel_divide_file",A.CancelDivideWorkDir="cancel_divide_work_dir",A.CancelDivideConnection="cancel_divide_connection",A.DeleteExtension="delete_extension",A.NewVersionExtension="new_version_extension",A.TransferData="transfer_data",A.AllowInternalAccessUser="allow_internal_access_to_user",A.BlockInternalAccessUser="block_internal_access_to_user",A.WaitInternalAccessUser="wait_internal_access_to_user",A.WaitInternalAccessUserCreate="wait_internal_access_to_user_create",A.AllowInternalAccessGroup="allow_internal_access_to_group",A.BlockInternalAccessGroup="block_internal_access_to_group",A.WaitInternalAccessGroup="wait_internal_access_to_group",A.WaitInternalAccessGroupCreate="wait_internal_access_to_group_create",A.AllowSharing="allow_sharing",A.BlockSharing="block_sharing",A.WaitSharing="wait_sharing",A.WaitSharingCreate="wait_sharing_create",A.Other="other",exports.NotificationRowAction=void 0,(b=exports.NotificationRowAction||(exports.NotificationRowAction={})).Read="read",b.Unread="unread",b.Delete="delete",exports.NotificationStyle=void 0,(w=exports.NotificationStyle||(exports.NotificationStyle={})).Plain="plain",w.Success="success",w.Info="info",w.Warning="warning",w.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,(R=exports.RequestMethod||(exports.RequestMethod={})).GET="GET",R.POST="POST",R.PUT="PUT",R.PATCH="PATCH",R.DELETE="DELETE",exports.RequestObserve=void 0,(C=exports.RequestObserve||(exports.RequestObserve={})).Body="body",C.Response="response",exports.RestrictionSharing=void 0,(E=exports.RestrictionSharing||(exports.RestrictionSharing={})).NONE="none",E.SOFT="soft",E.HARD="hard",exports.UserAuthType=void 0,(U=exports.UserAuthType||(exports.UserAuthType={})).Native="native",U.Ldap="ldap",U.Vk="vk",exports.UserStatus=void 0,(D=exports.UserStatus||(exports.UserStatus={})).Registering="registering",D.Activated="activated",D.Blocked="blocked",D.BlockedByLicense="blocked_by_license",exports.UserType=void 0,(P=exports.UserType||(exports.UserType={})).User="user",P.Guest="guest",P.Emperor="emperor",P.Anonymous="anonymous",exports.UserParamsLabel=void 0,(O=exports.UserParamsLabel||(exports.UserParamsLabel={})).Theme="theme",O.Lang="lang",O.Sort="sort",O.ViewApps="viewApps",O.WithoutContentWorkDir="withoutContentWorkDir",O.DashboardGrid="dashboardGrid",exports.UserAppType=void 0,(exports.UserAppType||(exports.UserAppType={})).Webdav="webdav",exports.SettingControlType=void 0,(L=exports.SettingControlType||(exports.SettingControlType={})).Text="text",L.String="string",L.Number="number",L.CheckBox="checkbox",L.Select="select",L.RadioList="radio_list",L.ConnectionChoose="connection_choose",L.MultiConnectionChoose="multi_connection_choose",exports.StorageElementType=void 0,(N=exports.StorageElementType||(exports.StorageElementType={})).Dir="dir",N.File="file",N.WorkDir="work_dir",exports.StorageElementContentType=void 0,(I=exports.StorageElementContentType||(exports.StorageElementContentType={})).Any="any",I.Dir="dir",I.Code="code",I.Image="image",I.Audio="audio",I.Video="video",I.Text="text",I.Doc="doc",I.Xls="xls",I.Ppt="ppt",exports.StorageRoot=void 0,(j=exports.StorageRoot||(exports.StorageRoot={})).my="my",j.fca="fca",j.divide="divide",j.share="share",j.favorite="favorite",j.trash="trash",exports.StorageElementHistoryAction=void 0,(q=exports.StorageElementHistoryAction||(exports.StorageElementHistoryAction={})).Create="create",q.Update="update",q.Move="move",exports.StorageElementCheckStatus=void 0,(M=exports.StorageElementCheckStatus||(exports.StorageElementCheckStatus={}))[M.CheckNull=0]="CheckNull",M[M.CheckInProgress=1]="CheckInProgress",M[M.CheckPositive=2]="CheckPositive",M[M.CheckNegative=3]="CheckNegative";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={[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]||W,e)}dashboard(e){return this.client.rest.get(B,e)}}class H{constructor(e){this.client=e}discovery(e){return this.client.rest.get("/discovery",e)}}const G="/divide",V=`${G}/restrictions`;class z{constructor(e){this.client=e}divideDelete(e,t){return this.client.rest.delete(`${e}${G}/${t}`)}divideDeleteAll(e,t,s,r){return this.client.rest.delete(`${e}${G}`,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}${G}/${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}${G}`,n)}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(`${V}/${e}`)}restrictionSize(e,t){return this.client.rest.get(`/${t}/restrictions/${e}/size`)}restrictions(e){return this.client.rest.get(`${V}`,e)}restrictionsChange(e,t){return this.client.rest.put(`${V}/${e}`,t)}makeParam(e,t){const s={};return e===exports.DivideScope.Connection?s.connection_id=t:s.path=t,s}}function J(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 K extends Error{}function Q(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 X(e,t){if("string"!=typeof e)throw new K("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 K(`Invalid token specified: missing part #${s+1}`);let i;try{i=Q(r)}catch(e){throw new K(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new K(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}K.prototype.name="InvalidTokenError";const Y=(e,t)=>J(void 0,void 0,void 0,(function*(){let s=t;for(const t of e)try{s=yield t.fulfilled(s)}catch(e){if(!t.rejected)throw e;s=yield t.rejected(e)}return s}));function Z(e){var t;return null!==(t=Object.fromEntries(document.cookie.split(";").map((e=>e.split("="))).map((([e,t])=>[e.trim(),decodeURIComponent(t||"")])))[e])&&void 0!==t?t:null}const ee=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 te(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}function se(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 re="update black token";class ie{constructor(){this.isUpdating=!1,this.tokenUpdateResolve=null}isTokenExpire(e){if(!e)return!1;return 1e3*e<=(new Date).getTime()+3e3}refreshToken(e,t){return J(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}${ne}/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};Z("access_token")===s.access_token&&localStorage.setItem("refresh-token",s.refresh_token),this.tokenUpdateResolve&&(this.tokenUpdateResolve(s),this.tokenUpdateResolve=null),e(s)}else e(null)}catch(e){i(new Error("Failed to parse response JSON."))}else e(null)},n.onerror=()=>{i(new Error("Network error occurred"))},n.onloadend=()=>{this.isUpdating=!1}}))):null}))}waitForTokenUpdate(){return J(this,void 0,void 0,(function*(){return new Promise((e=>{const t=setInterval((()=>{this.isUpdating||(clearInterval(t),e())}),100)}))}))}}const ne="/api/v1",oe="/api/v2";class ce{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 J(this,void 0,void 0,(function*(){return new Promise(((r,i)=>J(this,void 0,void 0,(function*(){var n,o,c;const a=null!==(n=this.state.skipInterceptors)&&void 0!==n&&n;this.state.skipInterceptors=!1;let l=Object.assign({method:e},s);if((null==s?void 0:s.signal)&&(l.signal=s.signal),a||(s=yield Y(this.client.requestInterceptors,l)),this.state.authToken)for(const[e,r]of this.state.authToken.entries()){const i=X(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 Y(this.client.requestInterceptors,l))}}const p=new XMLHttpRequest;(null==s?void 0:s.params)&&0!==Object.keys(s.params).length&&(t+="?"+ee(s.params));const d=null!==(o=null==s?void 0:s.host)&&void 0!==o?o:this.state.clientParams.host,h=`${d}${null!==(c=null==s?void 0:s.version)&&void 0!==c?c:this.state.clientParams.version}${t}`;if(p.open(e,h,!0),null==s?void 0:s.headers){const e=te(s.headers);for(const[t,s]of Object.entries(e))(d===this.baseHost||"content-type"!==t.toLowerCase())&&p.setRequestHeader(t,s)}(null==s?void 0:s.responseType)&&(p.responseType=s.responseType),(null==s?void 0:s.signal)&&s.signal.addEventListener("abort",(()=>{p.abort(),i(new Error("Upload aborted"))})),p.upload&&[exports.RequestMethod.POST,exports.RequestMethod.PUT,exports.RequestMethod.PATCH].includes(e)&&(p.upload.onprogress=e=>{e.lengthComputable&&(null==s?void 0:s.onUploadProgress)&&s.onUploadProgress(e)}),p.onload=()=>J(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=p.responseText;break;case exports.ResponseType.Blob:case exports.ResponseType.ArrayBuffer:e=p.response;break;default:try{e=JSON.parse(p.responseText)}catch(t){e=p.responseText}}const t=new Headers;p.getAllResponseHeaders().split("\r\n").forEach((e=>{const[s,r]=e.split(": ");s&&r&&t.append(s,r)}));let n={status:p.status,statusText:p.statusText,headers:t,url:p.responseURL};if(p.status>=200&&p.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===re){const e=yield this.tokenUpdate.refreshToken(this.state.authToken.get(0),this.baseHost);e&&this.state.authToken.set(0,e)}s=yield Y(this.client.responseInterceptors,Object.assign(Object.assign({},n),{error:e})),i(Object.assign(Object.assign({},n),{error:e}))}n=yield Y(this.client.responseInterceptors,n)})),p.onerror=()=>{i({status:p.status,statusText:p.statusText,url:p.responseURL,error:"Network error"})},p.send(se(null==s?void 0:s.body))}))))}))}}const ae="/static/extensions",le="/extensions/defaults",pe=`${ae}/names/users`,de=`${ae}/names/system`;class he{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:r,abort:i}=this.client.rest.upload(ae,s,{version:oe,onUploadProgress:t=>{e(t)}});return{promise:r,abort:i}}install(e,t){return this.client.rest.post(`${ae}/site`,{uniq_key:e,version:t},{version:oe})}getSystemNameExts(e){return this.client.rest.get(de,e)}getUserNameExts(e){return this.client.rest.get(pe,e)}createUserNameExt(e){return this.client.rest.post(`${pe}`,{name:e})}deleteUserNameExt(e){return this.client.rest.delete(`${pe}/${e}`)}deleteAllUserNameExts(){return this.client.rest.delete(`${pe}`)}}const ue="/anons_ext/extensions";class ge{constructor(e){this.client=e}listExtensionsSite(e){return this.client.rest.get(ue,e,{host:"https://next-box.ru"})}extensionDetailSite(e){return this.client.rest.get(`${ue}/${e}`,{},{host:"https://next-box.ru"})}extensionMarkdown(e,t){return this.client.rest.get(`${ue}/${e}/readme`,{},Object.assign(Object.assign({},t),{host:"https://next-box.ru"}))}}const xe="/disk",ve=`${xe}/check`;class _e{constructor(e){this.client=e}info(e,t){return this.client.rest.get(`${xe}/${e}/element`,{path:t})}list(e,t){return this.client.rest.get(`${xe}/${e}`,t)}create(e,t){return this.client.rest.post(`${xe}/${e}/element`,t)}replace(e,t,s){return this.client.rest.put(`${xe}/${e}/files?path=${t}`,s)}read(e,t){return this.client.rest.get(`${xe}/${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(`${xe}/${t}/files`,i,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e,t){return this.client.rest.post(`${xe}/${e}/files/net`,t)}delete(e,t){return this.client.rest.delete(`${xe}/${e}/trash/element`,{path:t})}check(e){return this.client.rest.post(ve,e)}}const Se="/settings";class $e{constructor(e){this.client=e}settings(){return this.client.rest.get(Se)}changeSettings(e){return this.client.rest.post(Se,e)}queryInit(){return this.client.rest.get("/query/init")}}var me;exports.QueryInitViewType=void 0,(me=exports.QueryInitViewType||(exports.QueryInitViewType={})).Standard="Standard",me.Simple="Simple";const fe="/groups";class ye{constructor(e){this.client=e}list(e){return this.client.rest.get(fe,e)}listUsers(e){return this.client.rest.get(`${fe}/${e}/users`)}create(e){return this.client.rest.post(fe,e)}update(e,t){return this.client.rest.put(`${fe}/${e}`,t)}delete(e){return this.client.rest.delete(`${fe}/${e}`)}}const ke="/license",Ae=`${ke}/manual-check`,be=`${ke}/hardware/hash`;class we{constructor(e){this.client=e}info(){return this.client.rest.get(ke)}create(e){return this.client.rest.post(ke,e)}check(){return this.client.rest.post(Ae)}delete(){return this.client.rest.delete(ke)}getHash(){return this.client.rest.get(be)}}const Te="/links";class Re{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post(Te,e)}updateShortLink(e){return this.client.rest.put(Te,e)}}const Ce="/limitations";class Ee{constructor(e){this.client=e}me(){return this.client.rest.get("/limitations/user/me")}list(e){return this.client.rest.get(Ce,e)}listUsers(e,t){return this.client.rest.get(`${Ce}/${e}/users`,t)}create(e){return this.client.rest.post(Ce,e)}get(e){return this.client.rest.get(`${Ce}/${e}`)}update(e,t){return this.client.rest.put(`${Ce}/${e}`,t)}delete(e){return this.client.rest.delete(`${Ce}/${e}`)}getLimitationsByUser(e){return this.client.rest.get(`/limitations/user/${e}`)}addUserToLimitation(e,t){return this.client.rest.patch(`${Ce}/${e}/user`,{id:t})}deleteUserFromLimitation(e,t){return this.client.rest.delete(`${Ce}/${e}/user/${t}`)}}class Ue{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get("/logs/users",e)}}const De="/notifications",Pe=`${De}/all`,Oe=`${De}/subscription`,Le=`${De}/permission`;class Ne{constructor(e){this.client=e}list(e){return this.client.rest.get(De,e)}toggleStatus(e,t){return this.client.rest.put(De,{ids:e,to_status:t})}toggleAllStatus(e){return this.client.rest.put(Pe,{to_status:e})}delete(e){return this.client.rest.delete(De,{id:e})}deleteAll(){return this.client.rest.delete(Pe)}getPermission(){return this.client.rest.get(Le)}setPermission(e){return this.client.rest.post(Le,{enabled:e})}getSubscription(){return this.client.rest.get(Oe)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(Oe,t)}}const Ie="/roles",je=`${Ie}/default`,qe="/permissions";class Me{constructor(e){this.client=e}list(e){return this.client.rest.get(Ie,e)}get(e){return this.client.rest.get(`${Ie}/${e}`)}getDefault(){return this.client.rest.get(`${je}`)}create(e){return this.client.rest.post(Ie,e)}update(e,t){return this.client.rest.put(`${Ie}/${e}`,t)}delete(e){return this.client.rest.delete(`${Ie}/${e}`)}permissionList(){return this.client.rest.get(qe)}addPermission(e,t){return this.client.rest.put(`${Ie}/${e}/permissions`,{ids:t})}deletePermission(e,t){return this.client.rest.delete(`${Ie}/${e}/${qe}`,{ids:t})}}const We="/share",Be=`${We}/restrictions`;class Fe{constructor(e){this.client=e}info(e,t){const s=new URLSearchParams({path:e,share_token:t});return this.client.rest.get(`${We}?${s.toString()}`)}checkPassword(e,t){const s=encodeURIComponent(e);return this.client.rest.get(`${We}/password?share_token=${t}&share_pass=${s}`)}checkToken(e){return this.client.rest.get(`${We}?share_token=${e}`)}getRestriction(e){return this.client.rest.get(`${Be}/${e}`)}restrictions(e){return this.client.rest.get(Be,e)}restrictionsChange(e,t){return this.client.rest.put(`${Be}/${e}`,t)}}const He="/storage/element/version/comment",Ge=`${He}/all`;class Ve{constructor(e){this.client=e}list(e){return this.client.rest.get(`${He}`,e)}create(e){return this.client.rest.post(`${He}`,e)}update(e){return this.client.rest.put(`${He}`,e)}delete(e){return this.client.rest.delete(`${He}`,e)}deleteAll(e){return this.client.rest.delete(`${Ge}`,e)}}const ze="/storage",Je=`${ze}/element`,Ke=`${Je}/divide/resource`,Qe=`${Je}/move`,Xe=`${Je}/copy`,Ye=`${Je}/content_type_size`,Ze="/disk";class et{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(ze,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(Je,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(`${Je}/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(`${Ze}/${r}/files/move${Ze}/${i}`,n):t===exports.StorageRoot.fca?(r&&(n.from_divide_id=r),this.client.rest.put(`${Ze}/${i}/files/from/box`,n)):s===exports.StorageRoot.fca?(i&&(n.to_divide_id=i),this.client.rest.put(`${Ze}/${r}/files/to/box`,n)):this.client.rest.post(Qe,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(`${Ze}/${r}/files/copy${Ze}/${i}`,n):s===exports.StorageRoot.fca?(r&&(n.from_divide_id=r),this.client.rest.post(`${Ze}/${i}/files/from/box`,n)):t===exports.StorageRoot.fca?(i&&(n.to_divide_id=i),this.client.rest.post(`${Ze}/${r}/files/to/box`,n)):this.client.rest.post(Xe,e)}pasteFromShared(e,t,s){const r={from_sharing_token:e,from_sharing_password:s,paths:t};return this.client.rest.post(`${Je}/copy`,r)}create(e){return this.client.rest.post(Je,e)}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(Je,s)}favorite(e){return this.client.rest.put(`${Je}?path=${encodeURIComponent(e)}`,{is_favorite:!0})}removeFavorite(e){return this.client.rest.put(`${Je}?path=${encodeURIComponent(e)}`,{is_favorite:!1})}createItem(e){return this.client.rest.post(Je,e)}createWorkDir(e){return this.client.rest.post(Je,e)}sizeWithSection(e){return this.client.rest.get(Ye,e)}getDivideResources(e){return this.client.rest.get(Ke,e)}}const tt="/storage/files",st=`${tt}/net`;class rt{constructor(e){this.client=e}read(e,t){return t.path=e,this.client.rest.get(tt,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(`${tt}?${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(tt,i,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e){return this.client.rest.post(st,e)}}class it{constructor(e){this.client=e}instance(){return this.client.rest.get("/storage/instance")}}const nt="/storage/element/share";class ot{constructor(e){this.client=e}info(e){return this.client.rest.get(nt,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(nt,s)}change(e){return this.client.rest.put(`${nt}/${e.token}`,e)}delete(e){return this.client.rest.delete(nt,{path:e})}refresh(e){return this.client.rest.put(`${nt}/${e}/refresh`)}}const ct="/storage/trash/element",at=`${ct}/all`;class lt{constructor(e){this.client=e}clear(e){return this.client.rest.delete(ct,e)}clearAll(){return this.client.rest.delete(at)}restore(e){return this.client.rest.patch(ct,{del_groups:e})}restoreAll(){return this.client.rest.patch(at)}}const pt="/users",dt=`${pt}/me`,ht=`${dt}/avatars`,ut=`${dt}/sessions`,gt=`${dt}/tokens`,xt=`${dt}/params`,vt=`${dt}/app-passwords`,_t=`${dt}/change-password`,St=`${pt}/initial`,$t=`${dt}/phone`,mt=`${$t}/confirm`;class ft{constructor(e){this.client=e}initial(e){return this.client.rest.post(St,e)}list(e){return this.client.rest.get(pt,e)}get(e){return this.client.rest.get(pt+`/${e}`)}create(e){return this.client.rest.post(pt,e)}update(e,t){return this.client.rest.put(pt+`/${e}`,t)}delete(e,t){return this.client.rest.delete(`${pt}/${e}`,t)}restore(e){return this.client.rest.post(`${pt}/${e}/restore`)}me(){return this.client.rest.get(dt)}updateMe(e){return this.client.rest.put(dt,e)}createToken(e){return this.client.rest.post(gt,e)}listToken(e){return this.client.rest.get(gt,e)}deleteToken(e){return this.client.rest.delete(`${gt}/${e}`)}changeMyPassword(e){return this.client.rest.put(_t,e)}changeUsersPassword(e,t){return this.client.rest.put(`${pt}/${e}/change-password`,t)}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(ht,s)}meDeleteAvatar(){return this.client.rest.delete(ht)}meListSession(e){return this.client.rest.get(ut,e)}meDeleteSession(e){let t=ut;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${pt}/${e}/roles`,{role_id:t})}meParams(e){return this.client.rest.get(xt,{name:e})}meSetParams(e,t){return this.client.rest.post(`${xt}/${e}`,t)}meListParams(){return this.client.rest.get(xt)}phone(e){return this.client.rest.post($t,e)}phoneConfirm(e){return this.client.rest.post(`${mt}/${e}`)}appPasswordsList(e){return this.client.rest.get(vt,e)}createAppPasswords(e){return this.client.rest.post(vt,e)}deleteAppPasswords(e){return this.client.rest.delete(`${vt}/${e}`)}}const yt="/storage/element",kt=`${yt}/history`,At=`${yt}/version`,bt=`${At}/lock`,wt=`${At}/unlock`,Tt=`${At}/current`,Rt=`${At}/size`;class Ct{constructor(e){this.client=e}history(e){return this.client.rest.get(kt,e)}versions(e){return this.client.rest.get(At,e)}create(e){return this.client.rest.post(At,e)}edit(e){return this.client.rest.put(At,e)}delete(e){return this.client.rest.delete(At,e)}size(e){return this.client.rest.get(Rt,e)}makeCurrent(e){return this.client.rest.post(Tt,e)}lock(e){return this.client.rest.post(bt,e)}unlock(e){return this.client.rest.post(wt,e)}}exports.AuthApiService=i,exports.BASE_URL_V1=ne,exports.BASE_URL_V2=oe,exports.CONNECTIONS_PERMISSION=o,exports.Client=class{constructor(e){this.AuthApiService=new i(this),this.ConnectionsApiService=new F(this),this.DiscoveryApiService=new H(this),this.DivideApiService=new z(this),this.ExtensionsApiService=new he(this),this.ExtensionsExternalApiService=new ge(this),this.FcaApiService=new _e(this),this.GatewayApiService=new $e(this),this.GroupApiService=new ye(this),this.LicenseApiService=new we(this),this.LinksApiService=new Re(this),this.LimitationsApiService=new Ee(this),this.LogstashApiService=new Ue(this),this.NotificationApiService=new Ne(this),this.RoleApiService=new Me(this),this.ShareApiService=new Fe(this),this.StorageCommentApiService=new Ve(this),this.StorageElementApiService=new et(this,this.FcaApiService),this.StorageFilesApiService=new rt(this),this.StorageInstanceApiService=new it(this),this.StorageShareApiService=new ot(this),this.StorageTrashApiService=new lt(this),this.UserApiService=new ft(this),this.VersionApiService=new Ct(this),this.tokenUpdate=new ie,this.rest=new ce(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)||ne},requestParams:{path:"",headers:{},query:{},body:null,cache:"no-cache"},authToken:null,skipInterceptors:!1},this.rest.baseHost=this.state.clientParams.host||""}},exports.ConnectionsApiService=F,exports.DiscoveryApiService=H,exports.DivideApiService=z,exports.ExtensionsApiService=he,exports.ExtensionsExternalApiService=ge,exports.FcaApiService=_e,exports.GatewayApiService=$e,exports.GroupApiService=ye,exports.LicenseApiService=we,exports.LimitationsApiService=Ee,exports.LinksApiService=Re,exports.LogstashApiService=Ue,exports.NEED_TOKEN_UPDATE_ERROR=re,exports.NotificationApiService=Ne,exports.Rest=ce,exports.RoleApiService=Me,exports.ShareApiService=Fe,exports.StorageCommentApiService=Ve,exports.StorageElementApiService=et,exports.StorageFilesApiService=rt,exports.StorageInstanceApiService=it,exports.StorageShareApiService=ot,exports.StorageTrashApiService=lt,exports.TokenUpdate=ie,exports.UserApiService=ft,exports.VersionApiService=Ct,exports.applyInterceptors=Y,exports.getCookieValue=Z,exports.makeUrlParams=ee,exports.normalizeHeaders=te,exports.prepareRequestBody=se;
|
|
1
|
+
"use strict";const e="/login",t=`${e}/ldap`,s=`${e}/update`,r=`${e}/tfa`;class i{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)}loginTfa(e){return this.client.rest.post(r,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 n;exports.AccessRights=void 0,(n=exports.AccessRights||(exports.AccessRights={})).LicenseRead="license_read",n.LicenseManage="license_edit",n.UsersRead="users_read",n.UsersCreate="users_create",n.UsersActivate="users_activate",n.GroupsRead="groups_read",n.GroupsCreate="groups_create",n.RolesRead="roles_read",n.RolesCreate="roles_create",n.Share="share",n.Divide="divide",n.ExtensionsRead="extensions_read",n.ExtensionsManage="extensions_write",n.RestrictionShareRead="restriction_share_read",n.RestrictionShareWrite="restriction_share_write",n.RestrictionDivideRead="restriction_divide_read",n.RestrictionDivideWrite="restriction_divide_write",n.LimitationsRead="limitations_read",n.LimitationsEdit="limitations_edit",n.ReadUserLogs="read_user_logs",n.ConnectionsRead="connections_read",n.ConnectionsDividing="connections_dividing",n.ConnectionsYandexDisk="connections_yandex_disk",n.ConnectionsSsh="connections_ssh",n.ConnectionsMail="connections_mail",n.ConnectionsS3="connections_s3",n.ConnectionsDiscord="connections_discord",n.ConnectionsWebdav="connections_webdav",n.ConnectionsNextcloud="connections_nextcloud",n.ConnectionsNextbox="connections_nextbox",n.ConnectionsHttpProxy="connections_http_proxy",n.SystemInfoServiceList="system_info_service_list",n.SettingsRead="settings_read",n.SettingsWrite="settings_write";const o=[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 c,a,l,p,d,h,u,g,x,v,_,S,$,m,f,y,k,A,w,b,T,R,C,E,U,D,P,O,L,N,I,j,q,M;exports.OrderDirection=void 0,(c=exports.OrderDirection||(exports.OrderDirection={})).DEFAULT="",c.ASC="asc",c.DESC="desc",exports.EngineType=void 0,(a=exports.EngineType||(exports.EngineType={})).WebSocket="websocket",a.PostMessage="postmessage",a.Empty="",exports.ConnectionGroup=void 0,(l=exports.ConnectionGroup||(exports.ConnectionGroup={})).Storages="storages_connections_group",l.Webhooks="webhooks_connections_group",l.Unknown="unknown_connections_group",l.Proxy="proxy_connections_group",exports.ConnectionType=void 0,(p=exports.ConnectionType||(exports.ConnectionType={})).SSH="ssh_connection",p.YandexDisk="yandex_disk",p.Mail="mail",p.Discord="discord",p.Webdav="webdav_connection",p.Nextcloud="nextcloud_connection",p.NextBox="nextbox_connection",p.HttpProxy="http_proxy_connection",p.S3="s3_connection",exports.ExtensionType=void 0,(d=exports.ExtensionType||(exports.ExtensionType={})).App="app",d.File="file",d.WorkDir="work_dir",exports.ExtensionFileMode=void 0,(h=exports.ExtensionFileMode||(exports.ExtensionFileMode={})).Read="read",h.ReadAndWrite="read_and_write",h.Write="write",exports.DivideScope=void 0,(u=exports.DivideScope||(exports.DivideScope={})).Storage="/storage/element",u.Connection="/connections",exports.PermissionType=void 0,(g=exports.PermissionType||(exports.PermissionType={})).CLOSE="",g.READ="r",g.WRITE="rw",exports.RestrictionStatus=void 0,(x=exports.RestrictionStatus||(exports.RestrictionStatus={})).WAITING="waiting",x.APPROVED="approved",x.REJECTED="rejected",exports.RestrictionBooleanStatus=void 0,(v=exports.RestrictionBooleanStatus||(exports.RestrictionBooleanStatus={})).TRUE="true",v.FALSE="false",exports.DivideMode=void 0,(_=exports.DivideMode||(exports.DivideMode={})).User="to_user_id",_.Group="to_user_group_id",exports.RestrictionModeKey=void 0,(S=exports.RestrictionModeKey||(exports.RestrictionModeKey={})).Divide="divide",S.Share="share",exports.Tariff=void 0,($=exports.Tariff||(exports.Tariff={})).Free="free",$.Business="business",$.Enterprise="enterprise",exports.LicenseError=void 0,(m=exports.LicenseError||(exports.LicenseError={})).NotActivated="License not activated",m.Blocked="License blocked",m.Expired="License has been expired",m.NotValid="License not valid",m.NotFound="license file not found",exports.LimitationType=void 0,(f=exports.LimitationType||(exports.LimitationType={})).BySize="size",f.ByExt="extension",exports.LimitationSubType=void 0,(y=exports.LimitationSubType||(exports.LimitationSubType={})).Size="size",y.White="extension_white",y.Black="extension_black",exports.NotificationEntityType=void 0,(k=exports.NotificationEntityType||(exports.NotificationEntityType={})).Dir="dir",k.File="file",k.User="user",k.Other="other",k.WorkDir="work_dir",k.License="license",k.Extension="extension",k.Connection="connection",exports.NotificationAction=void 0,(A=exports.NotificationAction||(exports.NotificationAction={})).SecurityCheckNegative="action_security_check_negative",A.SecurityCheckPositive="action_security_check_positive",A.CommentVersionMention="action_version_comment_mention",A.OpenSharing="open_sharing",A.ChangeSharing="change_sharing",A.CancelSharing="cancel_sharing",A.DivideDirAddFileToOwner="divide_dir_add_file_to_owner",A.DivideDirAddDirToOwner="divide_dir_add_dir_to_owner",A.DivideDirAddWorkDirToOwner="divide_dir_add_work_dir_to_owner",A.DivideConnectionAddFileToOwner="divide_connection_add_file_to_owner",A.DivideConnectionAddDirToOwner="divide_connection_add_dir_to_owner",A.CancelDivideDir="cancel_divide_dir",A.CancelDivideFile="cancel_divide_file",A.CancelDivideWorkDir="cancel_divide_work_dir",A.CancelDivideConnection="cancel_divide_connection",A.DeleteExtension="delete_extension",A.NewVersionExtension="new_version_extension",A.TransferData="transfer_data",A.AllowInternalAccessUser="allow_internal_access_to_user",A.BlockInternalAccessUser="block_internal_access_to_user",A.WaitInternalAccessUser="wait_internal_access_to_user",A.WaitInternalAccessUserCreate="wait_internal_access_to_user_create",A.AllowInternalAccessGroup="allow_internal_access_to_group",A.BlockInternalAccessGroup="block_internal_access_to_group",A.WaitInternalAccessGroup="wait_internal_access_to_group",A.WaitInternalAccessGroupCreate="wait_internal_access_to_group_create",A.AllowSharing="allow_sharing",A.BlockSharing="block_sharing",A.WaitSharing="wait_sharing",A.WaitSharingCreate="wait_sharing_create",A.StatusCreateZipProcess="status_create_zip_process",A.DownloadZipSuccess="download_zip_success",A.Other="other",exports.NotificationRowAction=void 0,(w=exports.NotificationRowAction||(exports.NotificationRowAction={})).Read="read",w.Unread="unread",w.Delete="delete",exports.NotificationStyle=void 0,(b=exports.NotificationStyle||(exports.NotificationStyle={})).Plain="plain",b.Success="success",b.Info="info",b.Warning="warning",b.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,(R=exports.RequestMethod||(exports.RequestMethod={})).GET="GET",R.POST="POST",R.PUT="PUT",R.PATCH="PATCH",R.DELETE="DELETE",exports.RequestObserve=void 0,(C=exports.RequestObserve||(exports.RequestObserve={})).Body="body",C.Response="response",exports.RestrictionSharing=void 0,(E=exports.RestrictionSharing||(exports.RestrictionSharing={})).NONE="none",E.SOFT="soft",E.HARD="hard",exports.UserAuthType=void 0,(U=exports.UserAuthType||(exports.UserAuthType={})).Native="native",U.Ldap="ldap",U.Vk="vk",exports.UserStatus=void 0,(D=exports.UserStatus||(exports.UserStatus={})).Registering="registering",D.Activated="activated",D.Blocked="blocked",D.BlockedByLicense="blocked_by_license",exports.UserType=void 0,(P=exports.UserType||(exports.UserType={})).User="user",P.Guest="guest",P.Emperor="emperor",P.Anonymous="anonymous",exports.UserParamsLabel=void 0,(O=exports.UserParamsLabel||(exports.UserParamsLabel={})).Theme="theme",O.Lang="lang",O.Sort="sort",O.ViewApps="viewApps",O.WithoutContentWorkDir="withoutContentWorkDir",O.DashboardGrid="dashboardGrid",exports.UserAppType=void 0,(exports.UserAppType||(exports.UserAppType={})).Webdav="webdav",exports.SettingControlType=void 0,(L=exports.SettingControlType||(exports.SettingControlType={})).Text="text",L.String="string",L.Number="number",L.CheckBox="checkbox",L.Select="select",L.RadioList="radio_list",L.ConnectionChoose="connection_choose",L.MultiConnectionChoose="multi_connection_choose",exports.StorageElementType=void 0,(N=exports.StorageElementType||(exports.StorageElementType={})).Dir="dir",N.File="file",N.WorkDir="work_dir",exports.StorageElementContentType=void 0,(I=exports.StorageElementContentType||(exports.StorageElementContentType={})).Any="any",I.Dir="dir",I.Code="code",I.Image="image",I.Audio="audio",I.Video="video",I.Text="text",I.Doc="doc",I.Xls="xls",I.Ppt="ppt",exports.StorageRoot=void 0,(j=exports.StorageRoot||(exports.StorageRoot={})).my="my",j.fca="fca",j.divide="divide",j.share="share",j.favorite="favorite",j.trash="trash",exports.StorageElementHistoryAction=void 0,(q=exports.StorageElementHistoryAction||(exports.StorageElementHistoryAction={})).Create="create",q.Update="update",q.Move="move",exports.StorageElementCheckStatus=void 0,(M=exports.StorageElementCheckStatus||(exports.StorageElementCheckStatus={}))[M.CheckNull=0]="CheckNull",M[M.CheckInProgress=1]="CheckInProgress",M[M.CheckPositive=2]="CheckPositive",M[M.CheckNegative=3]="CheckNegative";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={[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]||W,e)}dashboard(e){return this.client.rest.get(B,e)}}class H{constructor(e){this.client=e}discovery(e){return this.client.rest.get("/discovery",e)}}const G="/divide",V=`${G}/restrictions`;class z{constructor(e){this.client=e}divideDelete(e,t){return this.client.rest.delete(`${e}${G}/${t}`)}divideDeleteAll(e,t,s,r){return this.client.rest.delete(`${e}${G}`,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}${G}/${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}${G}`,n)}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(`${V}/${e}`)}restrictionSize(e,t){return this.client.rest.get(`/${t}/restrictions/${e}/size`)}restrictions(e){return this.client.rest.get(`${V}`,e)}restrictionsChange(e,t){return this.client.rest.put(`${V}/${e}`,t)}makeParam(e,t){const s={};return e===exports.DivideScope.Connection?s.connection_id=t:s.path=t,s}}function J(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 K extends Error{}function Q(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 X(e,t){if("string"!=typeof e)throw new K("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 K(`Invalid token specified: missing part #${s+1}`);let i;try{i=Q(r)}catch(e){throw new K(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new K(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}K.prototype.name="InvalidTokenError";const Y=(e,t)=>J(void 0,void 0,void 0,(function*(){let s=t;for(const t of e)try{s=yield t.fulfilled(s)}catch(e){if(!t.rejected)throw e;s=yield t.rejected(e)}return s}));function Z(e){var t;return null!==(t=Object.fromEntries(document.cookie.split(";").map((e=>e.split("="))).map((([e,t])=>[e.trim(),decodeURIComponent(t||"")])))[e])&&void 0!==t?t:null}const ee=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 te(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}function se(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 re="update black token";class ie{constructor(){this.isUpdating=!1,this.tokenUpdateResolve=null}isTokenExpire(e){if(!e)return!1;return 1e3*e<=(new Date).getTime()+3e3}refreshToken(e,t){return J(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}${ne}/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};Z("access_token")===s.access_token&&localStorage.setItem("refresh-token",s.refresh_token),this.tokenUpdateResolve&&(this.tokenUpdateResolve(s),this.tokenUpdateResolve=null),e(s)}else e(null)}catch(e){i(new Error("Failed to parse response JSON."))}else e(null)},n.onerror=()=>{i(new Error("Network error occurred"))},n.onloadend=()=>{this.isUpdating=!1}}))):null}))}waitForTokenUpdate(){return J(this,void 0,void 0,(function*(){return new Promise((e=>{const t=setInterval((()=>{this.isUpdating||(clearInterval(t),e())}),100)}))}))}}const ne="/api/v1",oe="/api/v2";class ce{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 J(this,void 0,void 0,(function*(){return new Promise(((r,i)=>J(this,void 0,void 0,(function*(){var n,o,c;const a=null!==(n=this.state.skipInterceptors)&&void 0!==n&&n;this.state.skipInterceptors=!1;let l=Object.assign({method:e},s);if((null==s?void 0:s.signal)&&(l.signal=s.signal),a||(s=yield Y(this.client.requestInterceptors,l)),this.state.authToken)for(const[e,r]of this.state.authToken.entries()){const i=X(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 Y(this.client.requestInterceptors,l))}}const p=new XMLHttpRequest;(null==s?void 0:s.params)&&0!==Object.keys(s.params).length&&(t+="?"+ee(s.params));const d=null!==(o=null==s?void 0:s.host)&&void 0!==o?o:this.state.clientParams.host,h=`${d}${null!==(c=null==s?void 0:s.version)&&void 0!==c?c:this.state.clientParams.version}${t}`;if(p.open(e,h,!0),null==s?void 0:s.headers){const e=te(s.headers);for(const[t,s]of Object.entries(e))(d===this.baseHost||"content-type"!==t.toLowerCase())&&p.setRequestHeader(t,s)}(null==s?void 0:s.responseType)&&(p.responseType=s.responseType),(null==s?void 0:s.signal)&&s.signal.addEventListener("abort",(()=>{p.abort(),i(new Error("Upload aborted"))})),p.upload&&[exports.RequestMethod.POST,exports.RequestMethod.PUT,exports.RequestMethod.PATCH].includes(e)&&(p.upload.onprogress=e=>{e.lengthComputable&&(null==s?void 0:s.onUploadProgress)&&s.onUploadProgress(e)}),p.onload=()=>J(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=p.responseText;break;case exports.ResponseType.Blob:case exports.ResponseType.ArrayBuffer:e=p.response;break;default:try{e=JSON.parse(p.responseText)}catch(t){e=p.responseText}}const t=new Headers;p.getAllResponseHeaders().split("\r\n").forEach((e=>{const[s,r]=e.split(": ");s&&r&&t.append(s,r)}));let n={status:p.status,statusText:p.statusText,headers:t,url:p.responseURL};if(p.status>=200&&p.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===re){const e=yield this.tokenUpdate.refreshToken(this.state.authToken.get(0),this.baseHost);e&&this.state.authToken.set(0,e)}s=yield Y(this.client.responseInterceptors,Object.assign(Object.assign({},n),{error:e})),i(Object.assign(Object.assign({},n),{error:e}))}n=yield Y(this.client.responseInterceptors,n)})),p.onerror=()=>{i({status:p.status,statusText:p.statusText,url:p.responseURL,error:"Network error"})},p.send(se(null==s?void 0:s.body))}))))}))}}const ae="/static/extensions",le="/extensions/defaults",pe=`${ae}/names/users`,de=`${ae}/names/system`;class he{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:r,abort:i}=this.client.rest.upload(ae,s,{version:oe,onUploadProgress:t=>{e(t)}});return{promise:r,abort:i}}install(e,t){return this.client.rest.post(`${ae}/site`,{uniq_key:e,version:t},{version:oe})}getSystemNameExts(e){return this.client.rest.get(de,e)}getUserNameExts(e){return this.client.rest.get(pe,e)}createUserNameExt(e){return this.client.rest.post(`${pe}`,{name:e})}deleteUserNameExt(e){return this.client.rest.delete(`${pe}/${e}`)}deleteAllUserNameExts(){return this.client.rest.delete(`${pe}`)}}const ue="/anons_ext/extensions";class ge{constructor(e){this.client=e}listExtensionsSite(e){return this.client.rest.get(ue,e,{host:"https://next-box.ru"})}extensionDetailSite(e){return this.client.rest.get(`${ue}/${e}`,{},{host:"https://next-box.ru"})}extensionMarkdown(e,t){return this.client.rest.get(`${ue}/${e}/readme`,{},Object.assign(Object.assign({},t),{host:"https://next-box.ru"}))}}const xe="/disk",ve=`${xe}/check`;class _e{constructor(e){this.client=e}info(e,t){return this.client.rest.get(`${xe}/${e}/element`,{path:t})}list(e,t){return this.client.rest.get(`${xe}/${e}`,t)}create(e,t){return this.client.rest.post(`${xe}/${e}/element`,t)}replace(e,t,s){return this.client.rest.put(`${xe}/${e}/files?path=${t}`,s)}read(e,t){return this.client.rest.get(`${xe}/${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(`${xe}/${t}/files`,i,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e,t){return this.client.rest.post(`${xe}/${e}/files/net`,t)}delete(e,t){return this.client.rest.delete(`${xe}/${e}/trash/element`,{path:t})}check(e){return this.client.rest.post(ve,e)}}const Se="/settings";class $e{constructor(e){this.client=e}settings(){return this.client.rest.get(Se)}changeSettings(e){return this.client.rest.post(Se,e)}queryInit(){return this.client.rest.get("/query/init")}}var me;exports.QueryInitViewType=void 0,(me=exports.QueryInitViewType||(exports.QueryInitViewType={})).Standard="Standard",me.Simple="Simple";const fe="/groups";class ye{constructor(e){this.client=e}list(e){return this.client.rest.get(fe,e)}listUsers(e){return this.client.rest.get(`${fe}/${e}/users`)}create(e){return this.client.rest.post(fe,e)}update(e,t){return this.client.rest.put(`${fe}/${e}`,t)}delete(e){return this.client.rest.delete(`${fe}/${e}`)}}const ke="/license",Ae=`${ke}/manual-check`,we=`${ke}/hardware/hash`;class be{constructor(e){this.client=e}info(){return this.client.rest.get(ke)}create(e){return this.client.rest.post(ke,e)}check(){return this.client.rest.post(Ae)}delete(){return this.client.rest.delete(ke)}getHash(){return this.client.rest.get(we)}}const Te="/links";class Re{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post(Te,e)}updateShortLink(e){return this.client.rest.put(Te,e)}}const Ce="/limitations";class Ee{constructor(e){this.client=e}me(){return this.client.rest.get("/limitations/user/me")}list(e){return this.client.rest.get(Ce,e)}listUsers(e,t){return this.client.rest.get(`${Ce}/${e}/users`,t)}create(e){return this.client.rest.post(Ce,e)}get(e){return this.client.rest.get(`${Ce}/${e}`)}update(e,t){return this.client.rest.put(`${Ce}/${e}`,t)}delete(e){return this.client.rest.delete(`${Ce}/${e}`)}getLimitationsByUser(e){return this.client.rest.get(`/limitations/user/${e}`)}addUserToLimitation(e,t){return this.client.rest.patch(`${Ce}/${e}/user`,{id:t})}deleteUserFromLimitation(e,t){return this.client.rest.delete(`${Ce}/${e}/user/${t}`)}}class Ue{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get("/logs/users",e)}}const De="/notifications",Pe=`${De}/all`,Oe=`${De}/subscription`,Le=`${De}/permission`;class Ne{constructor(e){this.client=e}list(e){return this.client.rest.get(De,e)}toggleStatus(e,t){return this.client.rest.put(De,{ids:e,to_status:t})}toggleAllStatus(e){return this.client.rest.put(Pe,{to_status:e})}delete(e){return this.client.rest.delete(De,{id:e})}deleteAll(){return this.client.rest.delete(Pe)}getPermission(){return this.client.rest.get(Le)}setPermission(e){return this.client.rest.post(Le,{enabled:e})}getSubscription(){return this.client.rest.get(Oe)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(Oe,t)}}const Ie="/roles",je=`${Ie}/default`,qe="/permissions";class Me{constructor(e){this.client=e}list(e){return this.client.rest.get(Ie,e)}get(e){return this.client.rest.get(`${Ie}/${e}`)}getDefault(){return this.client.rest.get(`${je}`)}create(e){return this.client.rest.post(Ie,e)}update(e,t){return this.client.rest.put(`${Ie}/${e}`,t)}delete(e){return this.client.rest.delete(`${Ie}/${e}`)}permissionList(){return this.client.rest.get(qe)}addPermission(e,t){return this.client.rest.put(`${Ie}/${e}/permissions`,{ids:t})}deletePermission(e,t){return this.client.rest.delete(`${Ie}/${e}/${qe}`,{ids:t})}}const We="/share",Be=`${We}/restrictions`,Fe=`${We}/login`;class He{constructor(e){this.client=e}info(e){return this.client.rest.get(`${We}?share_token=${e}`)}checkPassword(e,t){const s=encodeURIComponent(e);return this.client.rest.get(`${We}/password?share_token=${t}&share_pass=${s}`)}getRestriction(e){return this.client.rest.get(`${Be}/${e}`)}restrictions(e){return this.client.rest.get(Be,e)}restrictionsChange(e,t){return this.client.rest.put(`${Be}/${e}`,t)}login(e){return this.client.rest.post(`${Fe}`,e)}}const Ge="/storage/element/version/comment",Ve=`${Ge}/all`;class ze{constructor(e){this.client=e}list(e){return this.client.rest.get(`${Ge}`,e)}create(e){return this.client.rest.post(`${Ge}`,e)}update(e){return this.client.rest.put(`${Ge}`,e)}delete(e){return this.client.rest.delete(`${Ge}`,e)}deleteAll(e){return this.client.rest.delete(`${Ve}`,e)}}const Je="/storage",Ke=`${Je}/element`,Qe=`${Ke}/divide/resource`,Xe=`${Ke}/move`,Ye=`${Ke}/copy`,Ze=`${Ke}/content_type_size`,et="/disk";class tt{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(Je,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(Ke,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(`${Ke}/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(`${et}/${r}/files/move${et}/${i}`,n):t===exports.StorageRoot.fca?(r&&(n.from_divide_id=r),this.client.rest.put(`${et}/${i}/files/from/box`,n)):s===exports.StorageRoot.fca?(i&&(n.to_divide_id=i),this.client.rest.put(`${et}/${r}/files/to/box`,n)):this.client.rest.post(Xe,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(`${et}/${r}/files/copy${et}/${i}`,n):s===exports.StorageRoot.fca?(r&&(n.from_divide_id=r),this.client.rest.post(`${et}/${i}/files/from/box`,n)):t===exports.StorageRoot.fca?(i&&(n.to_divide_id=i),this.client.rest.post(`${et}/${r}/files/to/box`,n)):this.client.rest.post(Ye,e)}pasteFromShared(e,t,s){const r={from_sharing_token:e,from_sharing_password:s,paths:t};return this.client.rest.post(`${Ke}/copy`,r)}create(e){return this.client.rest.post(Ke,e)}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(Ke,s)}favorite(e){return this.client.rest.put(`${Ke}?path=${encodeURIComponent(e)}`,{is_favorite:!0})}removeFavorite(e){return this.client.rest.put(`${Ke}?path=${encodeURIComponent(e)}`,{is_favorite:!1})}createItem(e){return this.client.rest.post(Ke,e)}createWorkDir(e){return this.client.rest.post(Ke,e)}sizeWithSection(e){return this.client.rest.get(Ze,e)}getDivideResources(e){return this.client.rest.get(Qe,e)}}const st="/storage/files",rt=`${st}/net`;class it{constructor(e){this.client=e}read(e,t){return t.path=e,this.client.rest.get(st,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(`${st}?${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(st,i,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e){return this.client.rest.post(rt,e)}}class nt{constructor(e){this.client=e}instance(){return this.client.rest.get("/storage/instance")}}const ot="/storage/element/share";class ct{constructor(e){this.client=e}info(e){return this.client.rest.get(ot,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(ot,s)}change(e){return this.client.rest.put(`${ot}/${e.token}`,e)}delete(e){return this.client.rest.delete(ot,{path:e})}refresh(e){return this.client.rest.put(`${ot}/${e}/refresh`)}}const at="/storage/trash/element",lt=`${at}/all`;class pt{constructor(e){this.client=e}clear(e){return this.client.rest.delete(at,e)}clearAll(){return this.client.rest.delete(lt)}restore(e){return this.client.rest.patch(at,{del_groups:e})}restoreAll(){return this.client.rest.patch(lt)}}const dt="/users",ht=`${dt}/me`,ut=`${ht}/avatars`,gt=`${ht}/sessions`,xt=`${ht}/tokens`,vt=`${ht}/params`,_t=`${ht}/app-passwords`,St=`${ht}/change-password`,$t=`${dt}/initial`,mt=`${ht}/phone`,ft=`${mt}/confirm`;class yt{constructor(e){this.client=e}initial(e){return this.client.rest.post($t,e)}list(e){return this.client.rest.get(dt,e)}get(e){return this.client.rest.get(dt+`/${e}`)}create(e){return this.client.rest.post(dt,e)}update(e,t){return this.client.rest.put(dt+`/${e}`,t)}delete(e,t){return this.client.rest.delete(`${dt}/${e}`,t)}restore(e){return this.client.rest.post(`${dt}/${e}/restore`)}me(){return this.client.rest.get(ht)}updateMe(e){return this.client.rest.put(ht,e)}createToken(e){return this.client.rest.post(xt,e)}listToken(e){return this.client.rest.get(xt,e)}deleteToken(e){return this.client.rest.delete(`${xt}/${e}`)}changeMyPassword(e){return this.client.rest.put(St,e)}changeUsersPassword(e,t){return this.client.rest.put(`${dt}/${e}/change-password`,t)}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(ut,s)}meDeleteAvatar(){return this.client.rest.delete(ut)}meListSession(e){return this.client.rest.get(gt,e)}meDeleteSession(e){let t=gt;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${dt}/${e}/roles`,{role_id:t})}meParams(e){return this.client.rest.get(vt,{name:e})}meSetParams(e,t){return this.client.rest.post(`${vt}/${e}`,t)}meListParams(){return this.client.rest.get(vt)}phone(e){return this.client.rest.post(mt,e)}phoneConfirm(e){return this.client.rest.post(`${ft}/${e}`)}appPasswordsList(e){return this.client.rest.get(_t,e)}createAppPasswords(e){return this.client.rest.post(_t,e)}deleteAppPasswords(e){return this.client.rest.delete(`${_t}/${e}`)}}const kt="/storage/element",At=`${kt}/history`,wt=`${kt}/version`,bt=`${wt}/lock`,Tt=`${wt}/unlock`,Rt=`${wt}/current`,Ct=`${wt}/size`;class Et{constructor(e){this.client=e}history(e){return this.client.rest.get(At,e)}versions(e){return this.client.rest.get(wt,e)}create(e){return this.client.rest.post(wt,e)}edit(e){return this.client.rest.put(wt,e)}delete(e){return this.client.rest.delete(wt,e)}size(e){return this.client.rest.get(Ct,e)}makeCurrent(e){return this.client.rest.post(Rt,e)}lock(e){return this.client.rest.post(bt,e)}unlock(e){return this.client.rest.post(Tt,e)}}exports.AuthApiService=i,exports.BASE_URL_V1=ne,exports.BASE_URL_V2=oe,exports.CONNECTIONS_PERMISSION=o,exports.Client=class{constructor(e){this.AuthApiService=new i(this),this.ConnectionsApiService=new F(this),this.DiscoveryApiService=new H(this),this.DivideApiService=new z(this),this.ExtensionsApiService=new he(this),this.ExtensionsExternalApiService=new ge(this),this.FcaApiService=new _e(this),this.GatewayApiService=new $e(this),this.GroupApiService=new ye(this),this.LicenseApiService=new be(this),this.LinksApiService=new Re(this),this.LimitationsApiService=new Ee(this),this.LogstashApiService=new Ue(this),this.NotificationApiService=new Ne(this),this.RoleApiService=new Me(this),this.ShareApiService=new He(this),this.StorageCommentApiService=new ze(this),this.StorageElementApiService=new tt(this,this.FcaApiService),this.StorageFilesApiService=new it(this),this.StorageInstanceApiService=new nt(this),this.StorageShareApiService=new ct(this),this.StorageTrashApiService=new pt(this),this.UserApiService=new yt(this),this.VersionApiService=new Et(this),this.tokenUpdate=new ie,this.rest=new ce(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)||ne},requestParams:{path:"",headers:{},query:{},body:null,cache:"no-cache"},authToken:null,skipInterceptors:!1},this.rest.baseHost=this.state.clientParams.host||""}},exports.ConnectionsApiService=F,exports.DiscoveryApiService=H,exports.DivideApiService=z,exports.ExtensionsApiService=he,exports.ExtensionsExternalApiService=ge,exports.FcaApiService=_e,exports.GatewayApiService=$e,exports.GroupApiService=ye,exports.LicenseApiService=be,exports.LimitationsApiService=Ee,exports.LinksApiService=Re,exports.LogstashApiService=Ue,exports.NEED_TOKEN_UPDATE_ERROR=re,exports.NotificationApiService=Ne,exports.Rest=ce,exports.RoleApiService=Me,exports.ShareApiService=He,exports.StorageCommentApiService=ze,exports.StorageElementApiService=tt,exports.StorageFilesApiService=it,exports.StorageInstanceApiService=nt,exports.StorageShareApiService=ct,exports.StorageTrashApiService=pt,exports.TokenUpdate=ie,exports.UserApiService=yt,exports.VersionApiService=Et,exports.applyInterceptors=Y,exports.getCookieValue=Z,exports.makeUrlParams=ee,exports.normalizeHeaders=te,exports.prepareRequestBody=se;
|
package/dist/bundle.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="/login",t=`${e}/ldap`,s=`${e}/update`,i=`${e}/tfa`;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)}loginTfa(e){return this.client.rest.post(i,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 r;!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.LimitationsRead="limitations_read",e.LimitationsEdit="limitations_edit",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"}(r||(r={}));const o=[r.ConnectionsYandexDisk,r.ConnectionsSsh,r.ConnectionsMail,r.ConnectionsS3,r.ConnectionsS3,r.ConnectionsDiscord,r.ConnectionsWebdav,r.ConnectionsNextcloud,r.ConnectionsNextbox,r.ConnectionsHttpProxy];var c,a,l,u,d,h,p,g,_,f,$,v,m,k,w,b,S,x,y,A,C,T,D,U,E,P,O,R,I,L,j,N,W,F,B;!function(e){e.DEFAULT="",e.ASC="asc",e.DESC="desc"}(c||(c={})),function(e){e.WebSocket="websocket",e.PostMessage="postmessage",e.Empty=""}(a||(a={})),function(e){e.Storages="storages_connections_group",e.Webhooks="webhooks_connections_group",e.Unknown="unknown_connections_group",e.Proxy="proxy_connections_group"}(l||(l={})),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"}(u||(u={})),function(e){e.App="app",e.File="file",e.WorkDir="work_dir"}(d||(d={})),function(e){e.Read="read",e.ReadAndWrite="read_and_write",e.Write="write"}(h||(h={})),function(e){e.Storage="/storage/element",e.Connection="/connections"}(p||(p={})),function(e){e.CLOSE="",e.READ="r",e.WRITE="rw"}(g||(g={})),function(e){e.WAITING="waiting",e.APPROVED="approved",e.REJECTED="rejected"}(_||(_={})),function(e){e.TRUE="true",e.FALSE="false"}(f||(f={})),function(e){e.User="to_user_id",e.Group="to_user_group_id"}($||($={})),function(e){e.Divide="divide",e.Share="share"}(v||(v={})),function(e){e.Free="free",e.Business="business",e.Enterprise="enterprise"}(m||(m={})),function(e){e.NotActivated="License not activated",e.Blocked="License blocked",e.Expired="License has been expired",e.NotValid="License not valid",e.NotFound="license file not found"}(k||(k={})),function(e){e.BySize="size",e.ByExt="extension"}(w||(w={})),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"}(S||(S={})),function(e){e.SecurityCheckNegative="action_security_check_negative",e.SecurityCheckPositive="action_security_check_positive",e.CommentVersionMention="action_version_comment_mention",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"}(x||(x={})),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"}(A||(A={})),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"}(T||(T={})),function(e){e.Body="body",e.Response="response"}(D||(D={})),function(e){e.NONE="none",e.SOFT="soft",e.HARD="hard"}(U||(U={})),function(e){e.Native="native",e.Ldap="ldap",e.Vk="vk"}(E||(E={})),function(e){e.Registering="registering",e.Activated="activated",e.Blocked="blocked",e.BlockedByLicense="blocked_by_license"}(P||(P={})),function(e){e.User="user",e.Guest="guest",e.Emperor="emperor",e.Anonymous="anonymous"}(O||(O={})),function(e){e.Theme="theme",e.Lang="lang",e.Sort="sort",e.ViewApps="viewApps",e.WithoutContentWorkDir="withoutContentWorkDir",e.DashboardGrid="dashboardGrid"}(R||(R={})),function(e){e.Webdav="webdav"}(I||(I={})),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"}(L||(L={})),function(e){e.Dir="dir",e.File="file",e.WorkDir="work_dir"}(j||(j={})),function(e){e.Any="any",e.Dir="dir",e.Code="code",e.Image="image",e.Audio="audio",e.Video="video",e.Text="text",e.Doc="doc",e.Xls="xls",e.Ppt="ppt"}(N||(N={})),function(e){e.my="my",e.fca="fca",e.divide="divide",e.share="share",e.favorite="favorite",e.trash="trash"}(W||(W={})),function(e){e.Create="create",e.Update="update",e.Move="move"}(F||(F={})),function(e){e[e.CheckNull=0]="CheckNull",e[e.CheckInProgress=1]="CheckInProgress",e[e.CheckPositive=2]="CheckPositive",e[e.CheckNegative=3]="CheckNegative"}(B||(B={}));const H="/connections",q=`${H}/dashboard`;class G{constructor(e){this.client=e}list(e){return this.client.rest.get(H,e)}get(e){return this.client.rest.get(`${H}/${e}`)}update(e,t){return this.client.rest.put(`${H}/${e}`,t)}delete(e){return this.client.rest.delete(`${H}/${e}`)}create(e){const t={[u.SSH]:"/disk/ssh",[u.Webdav]:"/disk/webdav",[u.Nextcloud]:"/disk/nextcloud",[u.NextBox]:"/disk/nextbox",[u.Discord]:"/webhooks/discord",[u.Mail]:"/webhooks/mail",[u.HttpProxy]:"/http_proxy",[u.S3]:"/disk/s3"};return this.client.rest.post(t[e.type]||H,e)}dashboard(e){return this.client.rest.get(q,e)}}class M{constructor(e){this.client=e}discovery(e){return this.client.rest.get("/discovery",e)}}const z="/divide",V=`${z}/restrictions`;class J{constructor(e){this.client=e}divideDelete(e,t){return this.client.rest.delete(`${e}${z}/${t}`)}divideDeleteAll(e,t,s,i){return this.client.rest.delete(`${e}${z}`,Object.assign(Object.assign({},this.makeParam(e,t)),{is_to_user_group:i,access_mode:s}))}divideChange(e,t,s){return this.client.rest.put(`${e}${z}/${t}`,{access_mode:s})}divideCreate(e,t,s,i,n){const r=Object.assign(Object.assign({},this.makeParam(e,t)),{[n]:s,access_mode:i});return this.client.rest.post(`${e}${z}`,r)}divideUsers(e,t,s){return this.client.rest.get(`${e}${z}/users`,Object.assign(Object.assign({},this.makeParam(e,t)),s))}getRestriction(e){return this.client.rest.get(`${V}/${e}`)}restrictionSize(e,t){return this.client.rest.get(`/${t}/restrictions/${e}/size`)}restrictions(e){return this.client.rest.get(`${V}`,e)}restrictionsChange(e,t){return this.client.rest.put(`${V}/${e}`,t)}makeParam(e,t){const s={};return e===p.Connection?s.connection_id=t:s.path=t,s}}function X(e,t,s,i){return new(s||(s=Promise))((function(n,r){function o(e){try{a(i.next(e))}catch(e){r(e)}}function c(e){try{a(i.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,c)}a((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class Y 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 Y("Invalid token specified: must be a string");t||(t={});const s=!0===t.header?0:1,i=e.split(".")[s];if("string"!=typeof i)throw new Y(`Invalid token specified: missing part #${s+1}`);let n;try{n=K(i)}catch(e){throw new Y(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(n)}catch(e){throw new Y(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}Y.prototype.name="InvalidTokenError";const Z=(e,t)=>X(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 ee(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 te=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 se(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}function ie(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 ne="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 X(this,void 0,void 0,(function*(){const{access_token:s,refresh_token:i}=e;return s&&i?this.isUpdating?this.waitForTokenUpdate():(this.isUpdating=!0,new Promise(((e,n)=>{const r=new XMLHttpRequest,o=`${t}${oe}/login/update`;r.open("POST",o,!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify({access_token:s,refresh_token:i})),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};ee("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){n(new Error("Failed to parse response JSON."))}else e(null)},r.onerror=()=>{n(new Error("Network error occurred"))},r.onloadend=()=>{this.isUpdating=!1}}))):null}))}waitForTokenUpdate(){return X(this,void 0,void 0,(function*(){return new Promise((e=>{const t=setInterval((()=>{this.isUpdating||(clearInterval(t),e())}),100)}))}))}}const oe="/api/v1",ce="/api/v2";class ae{constructor(e,t){this.client=e,this.tokenUpdate=t,this.baseHost=""}get state(){return this.client.state}get(e,t,s){return this.request(T.GET,e,Object.assign({params:t,cache:"no-cache"},s))}post(e,t,s){return this.request(T.POST,e,Object.assign({body:t},s))}put(e,t,s){return this.request(T.PUT,e,Object.assign({body:t,cache:"no-cache"},s))}patch(e,t,s){return this.request(T.PATCH,e,Object.assign({body:t},s))}delete(e,t,s){return this.request(T.DELETE,e,Object.assign({params:t},s))}upload(e,t,s){const i=new AbortController,n=i.signal;return{promise:this.request(T.POST,e,Object.assign({body:t,signal:n},s)),abort:()=>i.abort()}}request(e,t,s){return X(this,void 0,void 0,(function*(){return new Promise(((i,n)=>X(this,void 0,void 0,(function*(){var r,o,c;const a=null!==(r=this.state.skipInterceptors)&&void 0!==r&&r;this.state.skipInterceptors=!1;let l=Object.assign({method:e},s);if((null==s?void 0:s.signal)&&(l.signal=s.signal),a||(s=yield Z(this.client.requestInterceptors,l)),this.state.authToken)for(const[e,i]of this.state.authToken.entries()){const n=Q(i.access_token);if(n&&n.is_remember&&this.tokenUpdate.isTokenExpire(n.exp)&&!t.includes("/login")&&!t.includes("/assets")){const t=yield this.tokenUpdate.refreshToken(i,this.baseHost);t&&(this.state.authToken.set(e,t),s=yield Z(this.client.requestInterceptors,l))}}const u=new XMLHttpRequest;(null==s?void 0:s.params)&&0!==Object.keys(s.params).length&&(t+="?"+te(s.params));const d=null!==(o=null==s?void 0:s.host)&&void 0!==o?o:this.state.clientParams.host,h=`${d}${null!==(c=null==s?void 0:s.version)&&void 0!==c?c:this.state.clientParams.version}${t}`;if(u.open(e,h,!0),null==s?void 0:s.headers){const e=se(s.headers);for(const[t,s]of Object.entries(e))(d===this.baseHost||"content-type"!==t.toLowerCase())&&u.setRequestHeader(t,s)}(null==s?void 0:s.responseType)&&(u.responseType=s.responseType),(null==s?void 0:s.signal)&&s.signal.addEventListener("abort",(()=>{u.abort(),n(new Error("Upload aborted"))})),u.upload&&[T.POST,T.PUT,T.PATCH].includes(e)&&(u.upload.onprogress=e=>{e.lengthComputable&&(null==s?void 0:s.onUploadProgress)&&s.onUploadProgress(e)}),u.onload=()=>X(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=u.responseText;break;case C.Blob:case C.ArrayBuffer:e=u.response;break;default:try{e=JSON.parse(u.responseText)}catch(t){e=u.responseText}}const t=new Headers;u.getAllResponseHeaders().split("\r\n").forEach((e=>{const[s,i]=e.split(": ");s&&i&&t.append(s,i)}));let r={status:u.status,statusText:u.statusText,headers:t,url:u.responseURL};if(u.status>=200&&u.status<300)(null==s?void 0:s.observe)===D.Response?i(Object.assign(Object.assign({},r),{body:e})):i(e);else{if(this.state.authToken&&e.code===ne){const e=yield this.tokenUpdate.refreshToken(this.state.authToken.get(0),this.baseHost);e&&this.state.authToken.set(0,e)}s=yield Z(this.client.responseInterceptors,Object.assign(Object.assign({},r),{error:e})),n(Object.assign(Object.assign({},r),{error:e}))}r=yield Z(this.client.responseInterceptors,r)})),u.onerror=()=>{n({status:u.status,statusText:u.statusText,url:u.responseURL,error:"Network error"})},u.send(ie(null==s?void 0:s.body))}))))}))}}class le{constructor(e){this.AuthApiService=new n(this),this.ConnectionsApiService=new G(this),this.DiscoveryApiService=new M(this),this.DivideApiService=new J(this),this.ExtensionsApiService=new ge(this),this.ExtensionsExternalApiService=new fe(this),this.FcaApiService=new me(this),this.GatewayApiService=new we(this),this.GroupApiService=new xe(this),this.LicenseApiService=new Te(this),this.LinksApiService=new Ue(this),this.LimitationsApiService=new Pe(this),this.LogstashApiService=new Oe(this),this.NotificationApiService=new Ne(this),this.RoleApiService=new He(this),this.ShareApiService=new Me(this),this.StorageCommentApiService=new Je(this),this.StorageElementApiService=new st(this,this.FcaApiService),this.StorageFilesApiService=new rt(this),this.StorageInstanceApiService=new ot(this),this.StorageShareApiService=new at(this),this.StorageTrashApiService=new dt(this),this.UserApiService=new St(this),this.VersionApiService=new Et(this),this.tokenUpdate=new re,this.rest=new ae(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)||oe},requestParams:{path:"",headers:{},query:{},body:null,cache:"no-cache"},authToken:null,skipInterceptors:!1},this.rest.baseHost=this.state.clientParams.host||""}}const ue="/static/extensions",de="/extensions/defaults",he=`${ue}/names/users`,pe=`${ue}/names/system`;class ge{constructor(e){this.client=e}getSetting(e){return this.client.rest.get(`${ue}/${e}/settings`)}setSetting(e,t){return this.client.rest.post(`${ue}/${e}/settings`,t)}deleteSetting(e){return this.client.rest.delete(`${ue}/${e}/settings`)}get(e){return this.client.rest.get(`${ue}/${e}`)}getByKey(e){return this.client.rest.get(`${ue}/${e}`)}getDefault(e=[]){return this.client.rest.get(de,{ext_code:e})}setDefault(e,t){return this.client.rest.post(de,{ext_code:e,ext_uniq_key:t})}checkUpdates(){return this.client.rest.post(`${ue}/check_updates`)}updateVersion(e,t){return this.client.rest.put(`${ue}/${e}`,{version:t})}list(e){return this.client.rest.get(ue,e)}delete(e,t){return this.client.rest.delete(`${ue}/${e}`)}upload(e,t){const s=new FormData;s.set("file",t);const{promise:i,abort:n}=this.client.rest.upload(ue,s,{version:ce,onUploadProgress:t=>{e(t)}});return{promise:i,abort:n}}install(e,t){return this.client.rest.post(`${ue}/site`,{uniq_key:e,version:t},{version:ce})}getSystemNameExts(e){return this.client.rest.get(pe,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 _e="/anons_ext/extensions";class fe{constructor(e){this.client=e}listExtensionsSite(e){return this.client.rest.get(_e,e,{host:"https://next-box.ru"})}extensionDetailSite(e){return this.client.rest.get(`${_e}/${e}`,{},{host:"https://next-box.ru"})}extensionMarkdown(e,t){return this.client.rest.get(`${_e}/${e}/readme`,{},Object.assign(Object.assign({},t),{host:"https://next-box.ru"}))}}const $e="/disk",ve=`${$e}/check`;class me{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,i=""){const n=new FormData;n.set("path",i),n.set("file",s);const{promise:r,abort:o}=this.client.rest.upload(`${$e}/${t}/files`,n,{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(ve,e)}}const ke="/settings";class we{constructor(e){this.client=e}settings(){return this.client.rest.get(ke)}changeSettings(e){return this.client.rest.post(ke,e)}queryInit(){return this.client.rest.get("/query/init")}}var be;!function(e){e.Standard="Standard",e.Simple="Simple"}(be||(be={}));const Se="/groups";class xe{constructor(e){this.client=e}list(e){return this.client.rest.get(Se,e)}listUsers(e){return this.client.rest.get(`${Se}/${e}/users`)}create(e){return this.client.rest.post(Se,e)}update(e,t){return this.client.rest.put(`${Se}/${e}`,t)}delete(e){return this.client.rest.delete(`${Se}/${e}`)}}const ye="/license",Ae=`${ye}/manual-check`,Ce=`${ye}/hardware/hash`;class Te{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(Ae)}delete(){return this.client.rest.delete(ye)}getHash(){return this.client.rest.get(Ce)}}const De="/links";class Ue{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post(De,e)}updateShortLink(e){return this.client.rest.put(De,e)}}const Ee="/limitations";class Pe{constructor(e){this.client=e}me(){return this.client.rest.get("/limitations/user/me")}list(e){return this.client.rest.get(Ee,e)}listUsers(e,t){return this.client.rest.get(`${Ee}/${e}/users`,t)}create(e){return this.client.rest.post(Ee,e)}get(e){return this.client.rest.get(`${Ee}/${e}`)}update(e,t){return this.client.rest.put(`${Ee}/${e}`,t)}delete(e){return this.client.rest.delete(`${Ee}/${e}`)}getLimitationsByUser(e){return this.client.rest.get(`/limitations/user/${e}`)}addUserToLimitation(e,t){return this.client.rest.patch(`${Ee}/${e}/user`,{id:t})}deleteUserFromLimitation(e,t){return this.client.rest.delete(`${Ee}/${e}/user/${t}`)}}class Oe{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get("/logs/users",e)}}const Re="/notifications",Ie=`${Re}/all`,Le=`${Re}/subscription`,je=`${Re}/permission`;class Ne{constructor(e){this.client=e}list(e){return this.client.rest.get(Re,e)}toggleStatus(e,t){return this.client.rest.put(Re,{ids:e,to_status:t})}toggleAllStatus(e){return this.client.rest.put(Ie,{to_status:e})}delete(e){return this.client.rest.delete(Re,{id:e})}deleteAll(){return this.client.rest.delete(Ie)}getPermission(){return this.client.rest.get(je)}setPermission(e){return this.client.rest.post(je,{enabled:e})}getSubscription(){return this.client.rest.get(Le)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(Le,t)}}const We="/roles",Fe=`${We}/default`,Be="/permissions";class He{constructor(e){this.client=e}list(e){return this.client.rest.get(We,e)}get(e){return this.client.rest.get(`${We}/${e}`)}getDefault(){return this.client.rest.get(`${Fe}`)}create(e){return this.client.rest.post(We,e)}update(e,t){return this.client.rest.put(`${We}/${e}`,t)}delete(e){return this.client.rest.delete(`${We}/${e}`)}permissionList(){return this.client.rest.get(Be)}addPermission(e,t){return this.client.rest.put(`${We}/${e}/permissions`,{ids:t})}deletePermission(e,t){return this.client.rest.delete(`${We}/${e}/${Be}`,{ids:t})}}const qe="/share",Ge=`${qe}/restrictions`;class Me{constructor(e){this.client=e}info(e,t){const s=new URLSearchParams({path:e,share_token:t});return this.client.rest.get(`${qe}?${s.toString()}`)}checkPassword(e,t){const s=encodeURIComponent(e);return this.client.rest.get(`${qe}/password?share_token=${t}&share_pass=${s}`)}checkToken(e){return this.client.rest.get(`${qe}?share_token=${e}`)}getRestriction(e){return this.client.rest.get(`${Ge}/${e}`)}restrictions(e){return this.client.rest.get(Ge,e)}restrictionsChange(e,t){return this.client.rest.put(`${Ge}/${e}`,t)}}const ze="/storage/element/version/comment",Ve=`${ze}/all`;class Je{constructor(e){this.client=e}list(e){return this.client.rest.get(`${ze}`,e)}create(e){return this.client.rest.post(`${ze}`,e)}update(e){return this.client.rest.put(`${ze}`,e)}delete(e){return this.client.rest.delete(`${ze}`,e)}deleteAll(e){return this.client.rest.delete(`${Ve}`,e)}}const Xe="/storage",Ye=`${Xe}/element`,Ke=`${Ye}/divide/resource`,Qe=`${Ye}/move`,Ze=`${Ye}/copy`,et=`${Ye}/content_type_size`,tt="/disk";class st{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(Xe,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(Ye,e)}combineInfo({root:e,rootId:t,path:s,file_version_id:i}){return e===W.fca&&t?this.fcaApiService.info(t,s):this.info({path:s,divide_id:t,file_version_id:i})}size(e){return this.client.rest.post(`${Ye}/size`,e)}move(e,t,s){const{from_divide_id:i,to_divide_id:n}=e;let r=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return t===W.fca&&s===W.fca?this.client.rest.post(`${tt}/${i}/files/move${tt}/${n}`,r):t===W.fca?(i&&(r.from_divide_id=i),this.client.rest.put(`${tt}/${n}/files/from/box`,r)):s===W.fca?(n&&(r.to_divide_id=n),this.client.rest.put(`${tt}/${i}/files/to/box`,r)):this.client.rest.post(Qe,e)}copy(e,t,s){const{from_divide_id:i,to_divide_id:n}=e;let r=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return s===W.fca&&t===W.fca?this.client.rest.post(`${tt}/${i}/files/copy${tt}/${n}`,r):s===W.fca?(i&&(r.from_divide_id=i),this.client.rest.post(`${tt}/${n}/files/from/box`,r)):t===W.fca?(n&&(r.to_divide_id=n),this.client.rest.post(`${tt}/${i}/files/to/box`,r)):this.client.rest.post(Ze,e)}pasteFromShared(e,t,s){const i={from_sharing_token:e,from_sharing_password:s,paths:t};return this.client.rest.post(`${Ye}/copy`,i)}create(e){return this.client.rest.post(Ye,e)}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(Ye,s)}favorite(e){return this.client.rest.put(`${Ye}?path=${encodeURIComponent(e)}`,{is_favorite:!0})}removeFavorite(e){return this.client.rest.put(`${Ye}?path=${encodeURIComponent(e)}`,{is_favorite:!1})}createItem(e){return this.client.rest.post(Ye,e)}createWorkDir(e){return this.client.rest.post(Ye,e)}sizeWithSection(e){return this.client.rest.get(et,e)}getDivideResources(e){return this.client.rest.get(Ke,e)}}const it="/storage/files",nt=`${it}/net`;class rt{constructor(e){this.client=e}read(e,t){return t.path=e,this.client.rest.get(it,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(`${it}?${s.toString()}`,t)}upload(e,t,s,i){const n=new FormData;n.set("path",s),i&&n.set("divide_id",i.toString()),n.set("file",t);const{promise:r,abort:o}=this.client.rest.upload(it,n,{onUploadProgress:t=>{e(t)}});return{promise:r,abort:o}}uploadNet(e){return this.client.rest.post(nt,e)}}class ot{constructor(e){this.client=e}instance(){return this.client.rest.get("/storage/instance")}}const ct="/storage/element/share";class at{constructor(e){this.client=e}info(e){return this.client.rest.get(ct,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(ct,s)}change(e){return this.client.rest.put(`${ct}/${e.token}`,e)}delete(e){return this.client.rest.delete(ct,{path:e})}refresh(e){return this.client.rest.put(`${ct}/${e}/refresh`)}}const lt="/storage/trash/element",ut=`${lt}/all`;class dt{constructor(e){this.client=e}clear(e){return this.client.rest.delete(lt,e)}clearAll(){return this.client.rest.delete(ut)}restore(e){return this.client.rest.patch(lt,{del_groups:e})}restoreAll(){return this.client.rest.patch(ut)}}const ht="/users",pt=`${ht}/me`,gt=`${pt}/avatars`,_t=`${pt}/sessions`,ft=`${pt}/tokens`,$t=`${pt}/params`,vt=`${pt}/app-passwords`,mt=`${pt}/change-password`,kt=`${ht}/initial`,wt=`${pt}/phone`,bt=`${wt}/confirm`;class St{constructor(e){this.client=e}initial(e){return this.client.rest.post(kt,e)}list(e){return this.client.rest.get(ht,e)}get(e){return this.client.rest.get(ht+`/${e}`)}create(e){return this.client.rest.post(ht,e)}update(e,t){return this.client.rest.put(ht+`/${e}`,t)}delete(e,t){return this.client.rest.delete(`${ht}/${e}`,t)}restore(e){return this.client.rest.post(`${ht}/${e}/restore`)}me(){return this.client.rest.get(pt)}updateMe(e){return this.client.rest.put(pt,e)}createToken(e){return this.client.rest.post(ft,e)}listToken(e){return this.client.rest.get(ft,e)}deleteToken(e){return this.client.rest.delete(`${ft}/${e}`)}changeMyPassword(e){return this.client.rest.put(mt,e)}changeUsersPassword(e,t){return this.client.rest.put(`${ht}/${e}/change-password`,t)}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(gt,s)}meDeleteAvatar(){return this.client.rest.delete(gt)}meListSession(e){return this.client.rest.get(_t,e)}meDeleteSession(e){let t=_t;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${ht}/${e}/roles`,{role_id:t})}meParams(e){return this.client.rest.get($t,{name:e})}meSetParams(e,t){return this.client.rest.post(`${$t}/${e}`,t)}meListParams(){return this.client.rest.get($t)}phone(e){return this.client.rest.post(wt,e)}phoneConfirm(e){return this.client.rest.post(`${bt}/${e}`)}appPasswordsList(e){return this.client.rest.get(vt,e)}createAppPasswords(e){return this.client.rest.post(vt,e)}deleteAppPasswords(e){return this.client.rest.delete(`${vt}/${e}`)}}const xt="/storage/element",yt=`${xt}/history`,At=`${xt}/version`,Ct=`${At}/lock`,Tt=`${At}/unlock`,Dt=`${At}/current`,Ut=`${At}/size`;class Et{constructor(e){this.client=e}history(e){return this.client.rest.get(yt,e)}versions(e){return this.client.rest.get(At,e)}create(e){return this.client.rest.post(At,e)}edit(e){return this.client.rest.put(At,e)}delete(e){return this.client.rest.delete(At,e)}size(e){return this.client.rest.get(Ut,e)}makeCurrent(e){return this.client.rest.post(Dt,e)}lock(e){return this.client.rest.post(Ct,e)}unlock(e){return this.client.rest.post(Tt,e)}}export{r as AccessRights,n as AuthApiService,oe as BASE_URL_V1,ce as BASE_URL_V2,o as CONNECTIONS_PERMISSION,le as Client,l as ConnectionGroup,u as ConnectionType,G as ConnectionsApiService,M as DiscoveryApiService,J as DivideApiService,$ as DivideMode,p as DivideScope,a as EngineType,h as ExtensionFileMode,d as ExtensionType,ge as ExtensionsApiService,fe as ExtensionsExternalApiService,me as FcaApiService,we as GatewayApiService,xe as GroupApiService,Te as LicenseApiService,k as LicenseError,b as LimitationSubType,w as LimitationType,Pe as LimitationsApiService,Ue as LinksApiService,Oe as LogstashApiService,ne as NEED_TOKEN_UPDATE_ERROR,x as NotificationAction,Ne as NotificationApiService,S as NotificationEntityType,y as NotificationRowAction,A as NotificationStyle,c as OrderDirection,g as PermissionType,be as QueryInitViewType,T as RequestMethod,D as RequestObserve,C as ResponseType,ae as Rest,f as RestrictionBooleanStatus,v as RestrictionModeKey,U as RestrictionSharing,_ as RestrictionStatus,He as RoleApiService,L as SettingControlType,Me as ShareApiService,Je as StorageCommentApiService,st as StorageElementApiService,B as StorageElementCheckStatus,N as StorageElementContentType,F as StorageElementHistoryAction,j as StorageElementType,rt as StorageFilesApiService,ot as StorageInstanceApiService,W as StorageRoot,at as StorageShareApiService,dt as StorageTrashApiService,m as Tariff,re as TokenUpdate,St as UserApiService,I as UserAppType,E as UserAuthType,R as UserParamsLabel,P as UserStatus,O as UserType,Et as VersionApiService,Z as applyInterceptors,ee as getCookieValue,te as makeUrlParams,se as normalizeHeaders,ie as prepareRequestBody};
|
|
1
|
+
const e="/login",t=`${e}/ldap`,s=`${e}/update`,i=`${e}/tfa`;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)}loginTfa(e){return this.client.rest.post(i,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 r;!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.LimitationsRead="limitations_read",e.LimitationsEdit="limitations_edit",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"}(r||(r={}));const o=[r.ConnectionsYandexDisk,r.ConnectionsSsh,r.ConnectionsMail,r.ConnectionsS3,r.ConnectionsS3,r.ConnectionsDiscord,r.ConnectionsWebdav,r.ConnectionsNextcloud,r.ConnectionsNextbox,r.ConnectionsHttpProxy];var c,a,l,u,d,h,p,g,_,f,$,v,m,k,w,b,S,x,y,A,C,T,D,U,E,P,O,R,I,L,j,N,W,F,B;!function(e){e.DEFAULT="",e.ASC="asc",e.DESC="desc"}(c||(c={})),function(e){e.WebSocket="websocket",e.PostMessage="postmessage",e.Empty=""}(a||(a={})),function(e){e.Storages="storages_connections_group",e.Webhooks="webhooks_connections_group",e.Unknown="unknown_connections_group",e.Proxy="proxy_connections_group"}(l||(l={})),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"}(u||(u={})),function(e){e.App="app",e.File="file",e.WorkDir="work_dir"}(d||(d={})),function(e){e.Read="read",e.ReadAndWrite="read_and_write",e.Write="write"}(h||(h={})),function(e){e.Storage="/storage/element",e.Connection="/connections"}(p||(p={})),function(e){e.CLOSE="",e.READ="r",e.WRITE="rw"}(g||(g={})),function(e){e.WAITING="waiting",e.APPROVED="approved",e.REJECTED="rejected"}(_||(_={})),function(e){e.TRUE="true",e.FALSE="false"}(f||(f={})),function(e){e.User="to_user_id",e.Group="to_user_group_id"}($||($={})),function(e){e.Divide="divide",e.Share="share"}(v||(v={})),function(e){e.Free="free",e.Business="business",e.Enterprise="enterprise"}(m||(m={})),function(e){e.NotActivated="License not activated",e.Blocked="License blocked",e.Expired="License has been expired",e.NotValid="License not valid",e.NotFound="license file not found"}(k||(k={})),function(e){e.BySize="size",e.ByExt="extension"}(w||(w={})),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"}(S||(S={})),function(e){e.SecurityCheckNegative="action_security_check_negative",e.SecurityCheckPositive="action_security_check_positive",e.CommentVersionMention="action_version_comment_mention",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.StatusCreateZipProcess="status_create_zip_process",e.DownloadZipSuccess="download_zip_success",e.Other="other"}(x||(x={})),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"}(A||(A={})),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"}(T||(T={})),function(e){e.Body="body",e.Response="response"}(D||(D={})),function(e){e.NONE="none",e.SOFT="soft",e.HARD="hard"}(U||(U={})),function(e){e.Native="native",e.Ldap="ldap",e.Vk="vk"}(E||(E={})),function(e){e.Registering="registering",e.Activated="activated",e.Blocked="blocked",e.BlockedByLicense="blocked_by_license"}(P||(P={})),function(e){e.User="user",e.Guest="guest",e.Emperor="emperor",e.Anonymous="anonymous"}(O||(O={})),function(e){e.Theme="theme",e.Lang="lang",e.Sort="sort",e.ViewApps="viewApps",e.WithoutContentWorkDir="withoutContentWorkDir",e.DashboardGrid="dashboardGrid"}(R||(R={})),function(e){e.Webdav="webdav"}(I||(I={})),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"}(L||(L={})),function(e){e.Dir="dir",e.File="file",e.WorkDir="work_dir"}(j||(j={})),function(e){e.Any="any",e.Dir="dir",e.Code="code",e.Image="image",e.Audio="audio",e.Video="video",e.Text="text",e.Doc="doc",e.Xls="xls",e.Ppt="ppt"}(N||(N={})),function(e){e.my="my",e.fca="fca",e.divide="divide",e.share="share",e.favorite="favorite",e.trash="trash"}(W||(W={})),function(e){e.Create="create",e.Update="update",e.Move="move"}(F||(F={})),function(e){e[e.CheckNull=0]="CheckNull",e[e.CheckInProgress=1]="CheckInProgress",e[e.CheckPositive=2]="CheckPositive",e[e.CheckNegative=3]="CheckNegative"}(B||(B={}));const H="/connections",q=`${H}/dashboard`;class G{constructor(e){this.client=e}list(e){return this.client.rest.get(H,e)}get(e){return this.client.rest.get(`${H}/${e}`)}update(e,t){return this.client.rest.put(`${H}/${e}`,t)}delete(e){return this.client.rest.delete(`${H}/${e}`)}create(e){const t={[u.SSH]:"/disk/ssh",[u.Webdav]:"/disk/webdav",[u.Nextcloud]:"/disk/nextcloud",[u.NextBox]:"/disk/nextbox",[u.Discord]:"/webhooks/discord",[u.Mail]:"/webhooks/mail",[u.HttpProxy]:"/http_proxy",[u.S3]:"/disk/s3"};return this.client.rest.post(t[e.type]||H,e)}dashboard(e){return this.client.rest.get(q,e)}}class M{constructor(e){this.client=e}discovery(e){return this.client.rest.get("/discovery",e)}}const z="/divide",V=`${z}/restrictions`;class J{constructor(e){this.client=e}divideDelete(e,t){return this.client.rest.delete(`${e}${z}/${t}`)}divideDeleteAll(e,t,s,i){return this.client.rest.delete(`${e}${z}`,Object.assign(Object.assign({},this.makeParam(e,t)),{is_to_user_group:i,access_mode:s}))}divideChange(e,t,s){return this.client.rest.put(`${e}${z}/${t}`,{access_mode:s})}divideCreate(e,t,s,i,n){const r=Object.assign(Object.assign({},this.makeParam(e,t)),{[n]:s,access_mode:i});return this.client.rest.post(`${e}${z}`,r)}divideUsers(e,t,s){return this.client.rest.get(`${e}${z}/users`,Object.assign(Object.assign({},this.makeParam(e,t)),s))}getRestriction(e){return this.client.rest.get(`${V}/${e}`)}restrictionSize(e,t){return this.client.rest.get(`/${t}/restrictions/${e}/size`)}restrictions(e){return this.client.rest.get(`${V}`,e)}restrictionsChange(e,t){return this.client.rest.put(`${V}/${e}`,t)}makeParam(e,t){const s={};return e===p.Connection?s.connection_id=t:s.path=t,s}}function X(e,t,s,i){return new(s||(s=Promise))((function(n,r){function o(e){try{a(i.next(e))}catch(e){r(e)}}function c(e){try{a(i.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,c)}a((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class Y extends Error{}function Z(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let s=t.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s})))}(t)}catch(e){return atob(t)}}function K(e,t){if("string"!=typeof e)throw new Y("Invalid token specified: must be a string");t||(t={});const s=!0===t.header?0:1,i=e.split(".")[s];if("string"!=typeof i)throw new Y(`Invalid token specified: missing part #${s+1}`);let n;try{n=Z(i)}catch(e){throw new Y(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(n)}catch(e){throw new Y(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}Y.prototype.name="InvalidTokenError";const Q=(e,t)=>X(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 ee(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 te=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 se(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}function ie(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 ne="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 X(this,void 0,void 0,(function*(){const{access_token:s,refresh_token:i}=e;return s&&i?this.isUpdating?this.waitForTokenUpdate():(this.isUpdating=!0,new Promise(((e,n)=>{const r=new XMLHttpRequest,o=`${t}${oe}/login/update`;r.open("POST",o,!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify({access_token:s,refresh_token:i})),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};ee("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){n(new Error("Failed to parse response JSON."))}else e(null)},r.onerror=()=>{n(new Error("Network error occurred"))},r.onloadend=()=>{this.isUpdating=!1}}))):null}))}waitForTokenUpdate(){return X(this,void 0,void 0,(function*(){return new Promise((e=>{const t=setInterval((()=>{this.isUpdating||(clearInterval(t),e())}),100)}))}))}}const oe="/api/v1",ce="/api/v2";class ae{constructor(e,t){this.client=e,this.tokenUpdate=t,this.baseHost=""}get state(){return this.client.state}get(e,t,s){return this.request(T.GET,e,Object.assign({params:t,cache:"no-cache"},s))}post(e,t,s){return this.request(T.POST,e,Object.assign({body:t},s))}put(e,t,s){return this.request(T.PUT,e,Object.assign({body:t,cache:"no-cache"},s))}patch(e,t,s){return this.request(T.PATCH,e,Object.assign({body:t},s))}delete(e,t,s){return this.request(T.DELETE,e,Object.assign({params:t},s))}upload(e,t,s){const i=new AbortController,n=i.signal;return{promise:this.request(T.POST,e,Object.assign({body:t,signal:n},s)),abort:()=>i.abort()}}request(e,t,s){return X(this,void 0,void 0,(function*(){return new Promise(((i,n)=>X(this,void 0,void 0,(function*(){var r,o,c;const a=null!==(r=this.state.skipInterceptors)&&void 0!==r&&r;this.state.skipInterceptors=!1;let l=Object.assign({method:e},s);if((null==s?void 0:s.signal)&&(l.signal=s.signal),a||(s=yield Q(this.client.requestInterceptors,l)),this.state.authToken)for(const[e,i]of this.state.authToken.entries()){const n=K(i.access_token);if(n&&n.is_remember&&this.tokenUpdate.isTokenExpire(n.exp)&&!t.includes("/login")&&!t.includes("/assets")){const t=yield this.tokenUpdate.refreshToken(i,this.baseHost);t&&(this.state.authToken.set(e,t),s=yield Q(this.client.requestInterceptors,l))}}const u=new XMLHttpRequest;(null==s?void 0:s.params)&&0!==Object.keys(s.params).length&&(t+="?"+te(s.params));const d=null!==(o=null==s?void 0:s.host)&&void 0!==o?o:this.state.clientParams.host,h=`${d}${null!==(c=null==s?void 0:s.version)&&void 0!==c?c:this.state.clientParams.version}${t}`;if(u.open(e,h,!0),null==s?void 0:s.headers){const e=se(s.headers);for(const[t,s]of Object.entries(e))(d===this.baseHost||"content-type"!==t.toLowerCase())&&u.setRequestHeader(t,s)}(null==s?void 0:s.responseType)&&(u.responseType=s.responseType),(null==s?void 0:s.signal)&&s.signal.addEventListener("abort",(()=>{u.abort(),n(new Error("Upload aborted"))})),u.upload&&[T.POST,T.PUT,T.PATCH].includes(e)&&(u.upload.onprogress=e=>{e.lengthComputable&&(null==s?void 0:s.onUploadProgress)&&s.onUploadProgress(e)}),u.onload=()=>X(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=u.responseText;break;case C.Blob:case C.ArrayBuffer:e=u.response;break;default:try{e=JSON.parse(u.responseText)}catch(t){e=u.responseText}}const t=new Headers;u.getAllResponseHeaders().split("\r\n").forEach((e=>{const[s,i]=e.split(": ");s&&i&&t.append(s,i)}));let r={status:u.status,statusText:u.statusText,headers:t,url:u.responseURL};if(u.status>=200&&u.status<300)(null==s?void 0:s.observe)===D.Response?i(Object.assign(Object.assign({},r),{body:e})):i(e);else{if(this.state.authToken&&e.code===ne){const e=yield this.tokenUpdate.refreshToken(this.state.authToken.get(0),this.baseHost);e&&this.state.authToken.set(0,e)}s=yield Q(this.client.responseInterceptors,Object.assign(Object.assign({},r),{error:e})),n(Object.assign(Object.assign({},r),{error:e}))}r=yield Q(this.client.responseInterceptors,r)})),u.onerror=()=>{n({status:u.status,statusText:u.statusText,url:u.responseURL,error:"Network error"})},u.send(ie(null==s?void 0:s.body))}))))}))}}class le{constructor(e){this.AuthApiService=new n(this),this.ConnectionsApiService=new G(this),this.DiscoveryApiService=new M(this),this.DivideApiService=new J(this),this.ExtensionsApiService=new ge(this),this.ExtensionsExternalApiService=new fe(this),this.FcaApiService=new me(this),this.GatewayApiService=new we(this),this.GroupApiService=new xe(this),this.LicenseApiService=new Te(this),this.LinksApiService=new Ue(this),this.LimitationsApiService=new Pe(this),this.LogstashApiService=new Oe(this),this.NotificationApiService=new Ne(this),this.RoleApiService=new He(this),this.ShareApiService=new ze(this),this.StorageCommentApiService=new Xe(this),this.StorageElementApiService=new it(this,this.FcaApiService),this.StorageFilesApiService=new ot(this),this.StorageInstanceApiService=new ct(this),this.StorageShareApiService=new lt(this),this.StorageTrashApiService=new ht(this),this.UserApiService=new xt(this),this.VersionApiService=new Pt(this),this.tokenUpdate=new re,this.rest=new ae(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)||oe},requestParams:{path:"",headers:{},query:{},body:null,cache:"no-cache"},authToken:null,skipInterceptors:!1},this.rest.baseHost=this.state.clientParams.host||""}}const ue="/static/extensions",de="/extensions/defaults",he=`${ue}/names/users`,pe=`${ue}/names/system`;class ge{constructor(e){this.client=e}getSetting(e){return this.client.rest.get(`${ue}/${e}/settings`)}setSetting(e,t){return this.client.rest.post(`${ue}/${e}/settings`,t)}deleteSetting(e){return this.client.rest.delete(`${ue}/${e}/settings`)}get(e){return this.client.rest.get(`${ue}/${e}`)}getByKey(e){return this.client.rest.get(`${ue}/${e}`)}getDefault(e=[]){return this.client.rest.get(de,{ext_code:e})}setDefault(e,t){return this.client.rest.post(de,{ext_code:e,ext_uniq_key:t})}checkUpdates(){return this.client.rest.post(`${ue}/check_updates`)}updateVersion(e,t){return this.client.rest.put(`${ue}/${e}`,{version:t})}list(e){return this.client.rest.get(ue,e)}delete(e,t){return this.client.rest.delete(`${ue}/${e}`)}upload(e,t){const s=new FormData;s.set("file",t);const{promise:i,abort:n}=this.client.rest.upload(ue,s,{version:ce,onUploadProgress:t=>{e(t)}});return{promise:i,abort:n}}install(e,t){return this.client.rest.post(`${ue}/site`,{uniq_key:e,version:t},{version:ce})}getSystemNameExts(e){return this.client.rest.get(pe,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 _e="/anons_ext/extensions";class fe{constructor(e){this.client=e}listExtensionsSite(e){return this.client.rest.get(_e,e,{host:"https://next-box.ru"})}extensionDetailSite(e){return this.client.rest.get(`${_e}/${e}`,{},{host:"https://next-box.ru"})}extensionMarkdown(e,t){return this.client.rest.get(`${_e}/${e}/readme`,{},Object.assign(Object.assign({},t),{host:"https://next-box.ru"}))}}const $e="/disk",ve=`${$e}/check`;class me{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,i=""){const n=new FormData;n.set("path",i),n.set("file",s);const{promise:r,abort:o}=this.client.rest.upload(`${$e}/${t}/files`,n,{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(ve,e)}}const ke="/settings";class we{constructor(e){this.client=e}settings(){return this.client.rest.get(ke)}changeSettings(e){return this.client.rest.post(ke,e)}queryInit(){return this.client.rest.get("/query/init")}}var be;!function(e){e.Standard="Standard",e.Simple="Simple"}(be||(be={}));const Se="/groups";class xe{constructor(e){this.client=e}list(e){return this.client.rest.get(Se,e)}listUsers(e){return this.client.rest.get(`${Se}/${e}/users`)}create(e){return this.client.rest.post(Se,e)}update(e,t){return this.client.rest.put(`${Se}/${e}`,t)}delete(e){return this.client.rest.delete(`${Se}/${e}`)}}const ye="/license",Ae=`${ye}/manual-check`,Ce=`${ye}/hardware/hash`;class Te{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(Ae)}delete(){return this.client.rest.delete(ye)}getHash(){return this.client.rest.get(Ce)}}const De="/links";class Ue{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post(De,e)}updateShortLink(e){return this.client.rest.put(De,e)}}const Ee="/limitations";class Pe{constructor(e){this.client=e}me(){return this.client.rest.get("/limitations/user/me")}list(e){return this.client.rest.get(Ee,e)}listUsers(e,t){return this.client.rest.get(`${Ee}/${e}/users`,t)}create(e){return this.client.rest.post(Ee,e)}get(e){return this.client.rest.get(`${Ee}/${e}`)}update(e,t){return this.client.rest.put(`${Ee}/${e}`,t)}delete(e){return this.client.rest.delete(`${Ee}/${e}`)}getLimitationsByUser(e){return this.client.rest.get(`/limitations/user/${e}`)}addUserToLimitation(e,t){return this.client.rest.patch(`${Ee}/${e}/user`,{id:t})}deleteUserFromLimitation(e,t){return this.client.rest.delete(`${Ee}/${e}/user/${t}`)}}class Oe{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get("/logs/users",e)}}const Re="/notifications",Ie=`${Re}/all`,Le=`${Re}/subscription`,je=`${Re}/permission`;class Ne{constructor(e){this.client=e}list(e){return this.client.rest.get(Re,e)}toggleStatus(e,t){return this.client.rest.put(Re,{ids:e,to_status:t})}toggleAllStatus(e){return this.client.rest.put(Ie,{to_status:e})}delete(e){return this.client.rest.delete(Re,{id:e})}deleteAll(){return this.client.rest.delete(Ie)}getPermission(){return this.client.rest.get(je)}setPermission(e){return this.client.rest.post(je,{enabled:e})}getSubscription(){return this.client.rest.get(Le)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(Le,t)}}const We="/roles",Fe=`${We}/default`,Be="/permissions";class He{constructor(e){this.client=e}list(e){return this.client.rest.get(We,e)}get(e){return this.client.rest.get(`${We}/${e}`)}getDefault(){return this.client.rest.get(`${Fe}`)}create(e){return this.client.rest.post(We,e)}update(e,t){return this.client.rest.put(`${We}/${e}`,t)}delete(e){return this.client.rest.delete(`${We}/${e}`)}permissionList(){return this.client.rest.get(Be)}addPermission(e,t){return this.client.rest.put(`${We}/${e}/permissions`,{ids:t})}deletePermission(e,t){return this.client.rest.delete(`${We}/${e}/${Be}`,{ids:t})}}const qe="/share",Ge=`${qe}/restrictions`,Me=`${qe}/login`;class ze{constructor(e){this.client=e}info(e){return this.client.rest.get(`${qe}?share_token=${e}`)}checkPassword(e,t){const s=encodeURIComponent(e);return this.client.rest.get(`${qe}/password?share_token=${t}&share_pass=${s}`)}getRestriction(e){return this.client.rest.get(`${Ge}/${e}`)}restrictions(e){return this.client.rest.get(Ge,e)}restrictionsChange(e,t){return this.client.rest.put(`${Ge}/${e}`,t)}login(e){return this.client.rest.post(`${Me}`,e)}}const Ve="/storage/element/version/comment",Je=`${Ve}/all`;class Xe{constructor(e){this.client=e}list(e){return this.client.rest.get(`${Ve}`,e)}create(e){return this.client.rest.post(`${Ve}`,e)}update(e){return this.client.rest.put(`${Ve}`,e)}delete(e){return this.client.rest.delete(`${Ve}`,e)}deleteAll(e){return this.client.rest.delete(`${Je}`,e)}}const Ye="/storage",Ze=`${Ye}/element`,Ke=`${Ze}/divide/resource`,Qe=`${Ze}/move`,et=`${Ze}/copy`,tt=`${Ze}/content_type_size`,st="/disk";class it{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(Ye,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(Ze,e)}combineInfo({root:e,rootId:t,path:s,file_version_id:i}){return e===W.fca&&t?this.fcaApiService.info(t,s):this.info({path:s,divide_id:t,file_version_id:i})}size(e){return this.client.rest.post(`${Ze}/size`,e)}move(e,t,s){const{from_divide_id:i,to_divide_id:n}=e;let r=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return t===W.fca&&s===W.fca?this.client.rest.post(`${st}/${i}/files/move${st}/${n}`,r):t===W.fca?(i&&(r.from_divide_id=i),this.client.rest.put(`${st}/${n}/files/from/box`,r)):s===W.fca?(n&&(r.to_divide_id=n),this.client.rest.put(`${st}/${i}/files/to/box`,r)):this.client.rest.post(Qe,e)}copy(e,t,s){const{from_divide_id:i,to_divide_id:n}=e;let r=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return s===W.fca&&t===W.fca?this.client.rest.post(`${st}/${i}/files/copy${st}/${n}`,r):s===W.fca?(i&&(r.from_divide_id=i),this.client.rest.post(`${st}/${n}/files/from/box`,r)):t===W.fca?(n&&(r.to_divide_id=n),this.client.rest.post(`${st}/${i}/files/to/box`,r)):this.client.rest.post(et,e)}pasteFromShared(e,t,s){const i={from_sharing_token:e,from_sharing_password:s,paths:t};return this.client.rest.post(`${Ze}/copy`,i)}create(e){return this.client.rest.post(Ze,e)}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(Ze,s)}favorite(e){return this.client.rest.put(`${Ze}?path=${encodeURIComponent(e)}`,{is_favorite:!0})}removeFavorite(e){return this.client.rest.put(`${Ze}?path=${encodeURIComponent(e)}`,{is_favorite:!1})}createItem(e){return this.client.rest.post(Ze,e)}createWorkDir(e){return this.client.rest.post(Ze,e)}sizeWithSection(e){return this.client.rest.get(tt,e)}getDivideResources(e){return this.client.rest.get(Ke,e)}}const nt="/storage/files",rt=`${nt}/net`;class ot{constructor(e){this.client=e}read(e,t){return t.path=e,this.client.rest.get(nt,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(`${nt}?${s.toString()}`,t)}upload(e,t,s,i){const n=new FormData;n.set("path",s),i&&n.set("divide_id",i.toString()),n.set("file",t);const{promise:r,abort:o}=this.client.rest.upload(nt,n,{onUploadProgress:t=>{e(t)}});return{promise:r,abort:o}}uploadNet(e){return this.client.rest.post(rt,e)}}class ct{constructor(e){this.client=e}instance(){return this.client.rest.get("/storage/instance")}}const at="/storage/element/share";class lt{constructor(e){this.client=e}info(e){return this.client.rest.get(at,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(at,s)}change(e){return this.client.rest.put(`${at}/${e.token}`,e)}delete(e){return this.client.rest.delete(at,{path:e})}refresh(e){return this.client.rest.put(`${at}/${e}/refresh`)}}const ut="/storage/trash/element",dt=`${ut}/all`;class ht{constructor(e){this.client=e}clear(e){return this.client.rest.delete(ut,e)}clearAll(){return this.client.rest.delete(dt)}restore(e){return this.client.rest.patch(ut,{del_groups:e})}restoreAll(){return this.client.rest.patch(dt)}}const pt="/users",gt=`${pt}/me`,_t=`${gt}/avatars`,ft=`${gt}/sessions`,$t=`${gt}/tokens`,vt=`${gt}/params`,mt=`${gt}/app-passwords`,kt=`${gt}/change-password`,wt=`${pt}/initial`,bt=`${gt}/phone`,St=`${bt}/confirm`;class xt{constructor(e){this.client=e}initial(e){return this.client.rest.post(wt,e)}list(e){return this.client.rest.get(pt,e)}get(e){return this.client.rest.get(pt+`/${e}`)}create(e){return this.client.rest.post(pt,e)}update(e,t){return this.client.rest.put(pt+`/${e}`,t)}delete(e,t){return this.client.rest.delete(`${pt}/${e}`,t)}restore(e){return this.client.rest.post(`${pt}/${e}/restore`)}me(){return this.client.rest.get(gt)}updateMe(e){return this.client.rest.put(gt,e)}createToken(e){return this.client.rest.post($t,e)}listToken(e){return this.client.rest.get($t,e)}deleteToken(e){return this.client.rest.delete(`${$t}/${e}`)}changeMyPassword(e){return this.client.rest.put(kt,e)}changeUsersPassword(e,t){return this.client.rest.put(`${pt}/${e}/change-password`,t)}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(_t,s)}meDeleteAvatar(){return this.client.rest.delete(_t)}meListSession(e){return this.client.rest.get(ft,e)}meDeleteSession(e){let t=ft;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${pt}/${e}/roles`,{role_id:t})}meParams(e){return this.client.rest.get(vt,{name:e})}meSetParams(e,t){return this.client.rest.post(`${vt}/${e}`,t)}meListParams(){return this.client.rest.get(vt)}phone(e){return this.client.rest.post(bt,e)}phoneConfirm(e){return this.client.rest.post(`${St}/${e}`)}appPasswordsList(e){return this.client.rest.get(mt,e)}createAppPasswords(e){return this.client.rest.post(mt,e)}deleteAppPasswords(e){return this.client.rest.delete(`${mt}/${e}`)}}const yt="/storage/element",At=`${yt}/history`,Ct=`${yt}/version`,Tt=`${Ct}/lock`,Dt=`${Ct}/unlock`,Ut=`${Ct}/current`,Et=`${Ct}/size`;class Pt{constructor(e){this.client=e}history(e){return this.client.rest.get(At,e)}versions(e){return this.client.rest.get(Ct,e)}create(e){return this.client.rest.post(Ct,e)}edit(e){return this.client.rest.put(Ct,e)}delete(e){return this.client.rest.delete(Ct,e)}size(e){return this.client.rest.get(Et,e)}makeCurrent(e){return this.client.rest.post(Ut,e)}lock(e){return this.client.rest.post(Tt,e)}unlock(e){return this.client.rest.post(Dt,e)}}export{r as AccessRights,n as AuthApiService,oe as BASE_URL_V1,ce as BASE_URL_V2,o as CONNECTIONS_PERMISSION,le as Client,l as ConnectionGroup,u as ConnectionType,G as ConnectionsApiService,M as DiscoveryApiService,J as DivideApiService,$ as DivideMode,p as DivideScope,a as EngineType,h as ExtensionFileMode,d as ExtensionType,ge as ExtensionsApiService,fe as ExtensionsExternalApiService,me as FcaApiService,we as GatewayApiService,xe as GroupApiService,Te as LicenseApiService,k as LicenseError,b as LimitationSubType,w as LimitationType,Pe as LimitationsApiService,Ue as LinksApiService,Oe as LogstashApiService,ne as NEED_TOKEN_UPDATE_ERROR,x as NotificationAction,Ne as NotificationApiService,S as NotificationEntityType,y as NotificationRowAction,A as NotificationStyle,c as OrderDirection,g as PermissionType,be as QueryInitViewType,T as RequestMethod,D as RequestObserve,C as ResponseType,ae as Rest,f as RestrictionBooleanStatus,v as RestrictionModeKey,U as RestrictionSharing,_ as RestrictionStatus,He as RoleApiService,L as SettingControlType,ze as ShareApiService,Xe as StorageCommentApiService,it as StorageElementApiService,B as StorageElementCheckStatus,N as StorageElementContentType,F as StorageElementHistoryAction,j as StorageElementType,ot as StorageFilesApiService,ct as StorageInstanceApiService,W as StorageRoot,lt as StorageShareApiService,ht as StorageTrashApiService,m as Tariff,re as TokenUpdate,xt as UserApiService,I as UserAppType,E as UserAuthType,R as UserParamsLabel,P as UserStatus,O as UserType,Pt as VersionApiService,Q as applyInterceptors,ee as getCookieValue,te as makeUrlParams,se as normalizeHeaders,ie as prepareRequestBody};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class HttpErrorResponse implements Error {
|
|
2
|
+
readonly name: string;
|
|
3
|
+
readonly message: string;
|
|
4
|
+
readonly error: any | null;
|
|
5
|
+
readonly status: number;
|
|
6
|
+
readonly statusText: string;
|
|
7
|
+
readonly headers: Headers | undefined;
|
|
8
|
+
readonly url: string | undefined;
|
|
9
|
+
readonly ok: boolean;
|
|
10
|
+
constructor(init: {
|
|
11
|
+
error?: any;
|
|
12
|
+
status?: number;
|
|
13
|
+
statusText?: string;
|
|
14
|
+
headers?: Headers;
|
|
15
|
+
url?: string;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare enum HttpEventType {
|
|
2
|
+
Sent = 0,
|
|
3
|
+
UploadProgress = 1,
|
|
4
|
+
ResponseHeader = 2,
|
|
5
|
+
DownloadProgress = 3,
|
|
6
|
+
Response = 4,
|
|
7
|
+
User = 5
|
|
8
|
+
}
|
|
9
|
+
export declare type HttpEvent<T> = HttpResponse<T> | HttpProgressEvent;
|
|
10
|
+
export declare class HttpResponse<T> {
|
|
11
|
+
body: T | null;
|
|
12
|
+
status: number;
|
|
13
|
+
statusText: string;
|
|
14
|
+
headers: Headers;
|
|
15
|
+
url?: string | undefined;
|
|
16
|
+
readonly type: HttpEventType;
|
|
17
|
+
constructor(body: T | null, status: number, statusText: string, headers: Headers, url?: string | undefined);
|
|
18
|
+
}
|
|
19
|
+
export declare class HttpProgressEvent {
|
|
20
|
+
progress: number;
|
|
21
|
+
headers: Headers;
|
|
22
|
+
readonly type: HttpEventType;
|
|
23
|
+
constructor(progress: number, headers: Headers, isUpload?: boolean);
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class HttpResponse<T> {
|
|
2
|
+
body: T | null;
|
|
3
|
+
status: number;
|
|
4
|
+
statusText: string;
|
|
5
|
+
headers: Headers;
|
|
6
|
+
url: string;
|
|
7
|
+
constructor(init: {
|
|
8
|
+
body?: T | null;
|
|
9
|
+
status: number;
|
|
10
|
+
statusText: string;
|
|
11
|
+
headers: Headers;
|
|
12
|
+
url: string;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AuthApiService } from '../api';
|
|
2
|
+
import { AuthToken } from '../types';
|
|
3
|
+
export declare class TokenUpdate {
|
|
4
|
+
private authApiService;
|
|
5
|
+
private isUpdating;
|
|
6
|
+
private tokenUpdatePromise;
|
|
7
|
+
private tokenUpdateResolve;
|
|
8
|
+
constructor(authApiService: AuthApiService);
|
|
9
|
+
isTokenExpire(timestamp: number): boolean;
|
|
10
|
+
refreshToken(authToken: AuthToken): Promise<AuthToken | null>;
|
|
11
|
+
private waitForTokenUpdate;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './send-request';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NbAppState } from '../types/base';
|
|
2
|
+
import { Interceptor } from '../types/interceptor';
|
|
3
|
+
export declare function sendRequest(method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE', path: string, options: {
|
|
4
|
+
query?: Record<string, any>;
|
|
5
|
+
body?: BodyInit | null;
|
|
6
|
+
cache?: RequestCache;
|
|
7
|
+
}, state: NbAppState, interceptors: {
|
|
8
|
+
request: Interceptor<RequestInit>[];
|
|
9
|
+
response: Interceptor<Response>[];
|
|
10
|
+
}): Promise<Response>;
|
package/dist/index.d.ts
CHANGED
|
@@ -860,6 +860,8 @@ declare enum NotificationAction {
|
|
|
860
860
|
BlockSharing = "block_sharing",
|
|
861
861
|
WaitSharing = "wait_sharing",
|
|
862
862
|
WaitSharingCreate = "wait_sharing_create",
|
|
863
|
+
StatusCreateZipProcess = "status_create_zip_process",
|
|
864
|
+
DownloadZipSuccess = "download_zip_success",
|
|
863
865
|
Other = "other"
|
|
864
866
|
}
|
|
865
867
|
declare enum NotificationRowAction {
|
|
@@ -1372,15 +1374,21 @@ type CreateUserRoleParams = Pick<UserRole, 'name' | 'description' | 'grant_acces
|
|
|
1372
1374
|
declare class ShareApiService {
|
|
1373
1375
|
private client;
|
|
1374
1376
|
constructor(client: Client);
|
|
1375
|
-
info(
|
|
1377
|
+
info(share_token: string): Promise<ShareInfo>;
|
|
1376
1378
|
checkPassword(password: string, share_token: string): Promise<any>;
|
|
1377
|
-
checkToken(share_token: string): Promise<any>;
|
|
1378
1379
|
getRestriction(token: string): Promise<UnionRestriction>;
|
|
1379
1380
|
restrictions(params?: RequestBaseParams): Promise<ResponseList<ShareInfo>>;
|
|
1380
1381
|
restrictionsChange(token: string, data: {
|
|
1381
1382
|
status: RestrictionStatus;
|
|
1382
1383
|
comment: string;
|
|
1383
1384
|
}): Promise<ResponseList<ShareInfo>>;
|
|
1385
|
+
login(data: RequestShareLoginParams): Promise<{
|
|
1386
|
+
share_token: string;
|
|
1387
|
+
}>;
|
|
1388
|
+
}
|
|
1389
|
+
interface RequestShareLoginParams {
|
|
1390
|
+
share_key: string;
|
|
1391
|
+
share_password?: string;
|
|
1384
1392
|
}
|
|
1385
1393
|
|
|
1386
1394
|
declare class StorageCommentApiService {
|
|
@@ -1534,4 +1542,5 @@ declare function normalizeHeaders(headers: Headers | [string, string][] | Record
|
|
|
1534
1542
|
|
|
1535
1543
|
declare function prepareRequestBody(body: unknown): XMLHttpRequestBodyInit | Document | null;
|
|
1536
1544
|
|
|
1537
|
-
export { AccessRights,
|
|
1545
|
+
export { AccessRights, AuthApiService, BASE_URL_V1, BASE_URL_V2, CONNECTIONS_PERMISSION, Client, ConnectionGroup, ConnectionType, ConnectionsApiService, DiscoveryApiService, DivideApiService, DivideMode, DivideScope, EngineType, ExtensionFileMode, ExtensionType, ExtensionsApiService, ExtensionsExternalApiService, FcaApiService, GatewayApiService, GroupApiService, LicenseApiService, LicenseError, LimitationSubType, LimitationType, LimitationsApiService, LinksApiService, LogstashApiService, NEED_TOKEN_UPDATE_ERROR, NotificationAction, NotificationApiService, NotificationEntityType, NotificationRowAction, NotificationStyle, OrderDirection, PermissionType, QueryInitViewType, RequestMethod, RequestObserve, ResponseType, Rest, RestrictionBooleanStatus, RestrictionModeKey, RestrictionSharing, RestrictionStatus, RoleApiService, SettingControlType, ShareApiService, StorageCommentApiService, StorageElementApiService, StorageElementCheckStatus, StorageElementContentType, StorageElementHistoryAction, StorageElementType, StorageFilesApiService, StorageInstanceApiService, StorageRoot, StorageShareApiService, StorageTrashApiService, Tariff, TokenUpdate, UserApiService, UserAppType, UserAuthType, UserParamsLabel, UserStatus, UserType, VersionApiService, applyInterceptors, getCookieValue, makeUrlParams, normalizeHeaders, prepareRequestBody };
|
|
1546
|
+
export type { AccessToken, AuthToken, AuthTokenUpdate, AuthType, ChangeLicenseParams, Comment, CommentParams, Connection, ConnectionCreateParams, CopyResponse, CreateCommentParams, CreateLimitationsParams, CreateStorageElementParams, CreateUserGroupParams, CreateUserParams, CreateUserRoleParams, CutLinkRequest, DeleteAllCommentParams, DeleteCommentParams, Discovery, DivideResourceParams, DivideResourceType, DivideResponseList, Extension, ExtensionDefault, ExtensionExternal, ExtensionExternalInList, ExtensionExternalListParams, ExtensionListParams, ExtensionMetaPayload, FileLocking, HistoryListRequestParams, HistoryNote, HistoryRequestParams, HttpEvent, HttpResponse, Lang, License, Limitation, LockScreen, NameExtensionListParams, NbAppState, NbClientParams, NbRequestParams, NotificationActionGroup, NotificationPayload, OnUploadProgress, PayloadFile, Permission, PermissionItem, ProgressEvent, QueryInitResponse, RequestAuthSettingsParams, RequestAuthTfaParams, RequestAuthTokenParams, RequestBaseParams, RequestConfig, RequestConnectionParams, RequestLimitationsListParams, RequestNotificationListParams, RequestShareLoginParams, RequestStorageListParams, RequestUserDivideParams, RequestUserGroupListParams, RequestUserListParams, RequestUserRoleListParams, RequestUsersLogParams, RequestVersionsSizeParams, ResourceAccess, ResponseItem, ResponseList, ResponseListNotification, Restriction, Setting, SettingField, SettingFieldView, SettingLang, SettingValue, SettingValueField, SettingVariant, SettingViewConnectionChoose, SettingViewSelect, ShareInfo, ShareModel, SizeBySection, StorageElement, StorageElementHistory, StorageElementPaste, StorageElementPasteParams, StorageElementVersion, StorageElementVersionLock, StorageInstance, StorageItemSizeParams, StorageItemSizePathParams, StorageRouteData, StorageTrashElement, StorageTrashItem, UnionRestriction, UpdateCommentParams, UploadNetRequestParams, User, UserAppPasswordInfo, UserAppPasswords, UserDivide, UserGroup, UserInfo, UserLabel, UserNamesExtension, UserNotification, UserParams, UserPhone, UserRole, UserSession, UserToken, UsersLog, VersionLockRequestParams };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RequestBaseParams } from './base';
|
|
2
|
+
import { UserLabel } from './user';
|
|
3
|
+
export interface Group {
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
amount_users: number;
|
|
8
|
+
create_date: string;
|
|
9
|
+
owner_id: number;
|
|
10
|
+
owner: UserLabel;
|
|
11
|
+
update_date: string;
|
|
12
|
+
icon: string;
|
|
13
|
+
icon_color: string;
|
|
14
|
+
}
|
|
15
|
+
export interface RequestGroupListParams extends RequestBaseParams {
|
|
16
|
+
id?: number[];
|
|
17
|
+
name?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
search_field?: string;
|
|
20
|
+
}
|
|
21
|
+
export type CreateGroupParams = Pick<Group, 'name' | 'description'> & {
|
|
22
|
+
users?: number[];
|
|
23
|
+
};
|
|
@@ -57,6 +57,8 @@ export declare enum NotificationAction {
|
|
|
57
57
|
BlockSharing = "block_sharing",
|
|
58
58
|
WaitSharing = "wait_sharing",
|
|
59
59
|
WaitSharingCreate = "wait_sharing_create",
|
|
60
|
+
StatusCreateZipProcess = "status_create_zip_process",
|
|
61
|
+
DownloadZipSuccess = "download_zip_success",
|
|
60
62
|
Other = "other"
|
|
61
63
|
}
|
|
62
64
|
export declare enum NotificationRowAction {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ResponseList } from './base';
|
|
2
|
+
import { Extension, ExtensionDefault } from './extension';
|
|
3
|
+
import { License } from './license';
|
|
4
|
+
import { LockScreen } from './lock-screen';
|
|
5
|
+
import { UserNotification } from './notification';
|
|
6
|
+
import { Restriction } from './restriction';
|
|
7
|
+
import { User } from './user';
|
|
8
|
+
export interface QueryInit {
|
|
9
|
+
license?: License;
|
|
10
|
+
unread_notifications?: ResponseList<UserNotification> & {
|
|
11
|
+
total_all: number;
|
|
12
|
+
};
|
|
13
|
+
extensions_apps?: ResponseList<Extension>;
|
|
14
|
+
extensions_defaults: ResponseList<ExtensionDefault>;
|
|
15
|
+
me?: User;
|
|
16
|
+
cache_users: User[];
|
|
17
|
+
lock_screen: LockScreen;
|
|
18
|
+
restrictions?: Restriction;
|
|
19
|
+
open_in_desktop_settings: {
|
|
20
|
+
open_in_desktop_enabled: boolean;
|
|
21
|
+
};
|
|
22
|
+
inject_scripts?: string[];
|
|
23
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RequestBaseParams } from './base';
|
|
2
|
+
export interface Role {
|
|
3
|
+
id: number;
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
create_date: string;
|
|
7
|
+
update_date: string;
|
|
8
|
+
is_default: boolean;
|
|
9
|
+
owner_id: number;
|
|
10
|
+
grant_access_all: boolean;
|
|
11
|
+
permissions_id?: number[];
|
|
12
|
+
}
|
|
13
|
+
export interface RequestRoleListParams extends RequestBaseParams {
|
|
14
|
+
id?: number[];
|
|
15
|
+
search_field?: string;
|
|
16
|
+
}
|
|
17
|
+
export type CreateRoleParams = Pick<Role, 'name' | 'description' | 'grant_access_all' | 'is_default'>;
|