Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@directus/sdk

Package Overview
Dependencies
Maintainers
2
Versions
133
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@directus/sdk - npm Package Compare versions

Comparing version 10.1.3 to 10.1.4

2

dist/sdk.bundler.js

@@ -41,2 +41,3 @@ import axios from 'axios';

params: {
...query,
filter: {

@@ -47,3 +48,2 @@ [primaryKeyField.field]: { _in: ids },

sort: (query === null || query === void 0 ? void 0 : query.sort) || primaryKeyField.field,
...query,
},

@@ -50,0 +50,0 @@ ...options === null || options === void 0 ? void 0 : options.requestOptions,

@@ -49,2 +49,3 @@ 'use strict';

params: {
...query,
filter: {

@@ -55,3 +56,2 @@ [primaryKeyField.field]: { _in: ids },

sort: (query === null || query === void 0 ? void 0 : query.sort) || primaryKeyField.field,
...query,
},

@@ -58,0 +58,0 @@ ...options === null || options === void 0 ? void 0 : options.requestOptions,

@@ -1,2 +0,2 @@

class t{constructor(){this.mode="undefined"==typeof window?"json":"cookie"}}var e,r;!function(t){t.TOTAL_COUNT="total_count",t.FILTER_COUNT="filter_count"}(e||(e={}));class s extends Error{constructor(t){super(`${null!=t?t:"ID"} cannot be an empty string`)}}class n{constructor(t,e){this.collection=t,this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}async readOne(t,e,r){if(""==`${t}`)throw new s("id");return(await this.transport.get(`${this.endpoint}/${encodeURI(t)}`,{params:e,...null==r?void 0:r.requestOptions})).data}async readMany(t,e,r){var s;const n=null===(s=(await this.transport.get(`/fields/${this.collection}`)).data)||void 0===s?void 0:s.find((t=>!0===t.schema.is_primary_key)),{data:i,meta:o}=await this.transport.get(`${this.endpoint}`,{params:{filter:{[n.field]:{_in:t},...null==e?void 0:e.filter},sort:(null==e?void 0:e.sort)||n.field,...e},...null==r?void 0:r.requestOptions});return{data:i,...o&&{meta:o}}}async readByQuery(t,e){const{data:r,meta:s}=await this.transport.get(`${this.endpoint}`,{params:t,...null==e?void 0:e.requestOptions});return{data:r,...s&&{meta:s}}}async createOne(t,e,r){return(await this.transport.post(`${this.endpoint}`,t,{params:e,...null==r?void 0:r.requestOptions})).data}async createMany(t,e,r){return await this.transport.post(`${this.endpoint}`,t,{params:e,...null==r?void 0:r.requestOptions})}async updateOne(t,e,r,n){if(""==`${t}`)throw new s("id");return(await this.transport.patch(`${this.endpoint}/${encodeURI(t)}`,e,{params:r,...null==n?void 0:n.requestOptions})).data}async updateMany(t,e,r,s){return await this.transport.patch(`${this.endpoint}`,{keys:t,data:e},{params:r,...null==s?void 0:s.requestOptions})}async updateByQuery(t,e,r,s){return await this.transport.patch(`${this.endpoint}`,{query:t,data:e},{params:r,...null==s?void 0:s.requestOptions})}async deleteOne(t,e){if(""==`${t}`)throw new s("id");await this.transport.delete(`${this.endpoint}/${encodeURI(t)}`,void 0,null==e?void 0:e.requestOptions)}async deleteMany(t,e){await this.transport.delete(`${this.endpoint}`,t,null==e?void 0:e.requestOptions)}}class i{constructor(t){this.transport=t}async create(t){return(await this.transport.post("/activity/comment",t)).data}async update(t,e){if(""==`${t}`)throw new s("comment_activity_id");return(await this.transport.patch(`/activity/comment/${encodeURI(t)}`,{comment:e})).data}async delete(t){if(""==`${t}`)throw new s("comment_activity_id");await this.transport.delete(`/activity/comment/${encodeURI(t)}`)}}class o extends n{constructor(t){super("directus_activity",t),this._comments=new i(this.transport)}get comments(){return this._comments}}class a{constructor(t){this.transport=t}async readOne(t){if(""==`${t}`)throw new s("collection");return(await this.transport.get(`/collections/${t}`)).data}async readAll(){const{data:t,meta:e}=await this.transport.get("/collections");return{data:t,meta:e}}async createOne(t){return(await this.transport.post("/collections",t)).data}async createMany(t){const{data:e,meta:r}=await this.transport.post("/collections",t);return{data:e,meta:r}}async updateOne(t,e,r){if(""==`${t}`)throw new s("collection");return(await this.transport.patch(`/collections/${t}`,e,{params:r})).data}async deleteOne(t){if(""==`${t}`)throw new s("collection");await this.transport.delete(`/collections/${t}`)}}class u{constructor(t){this.transport=t}async readOne(t,e){if(""==`${t}`)throw new s("collection");if(""==`${e}`)throw new s("id");return(await this.transport.get(`/fields/${t}/${e}`)).data}async readMany(t){if(""==`${t}`)throw new s("collection");return(await this.transport.get(`/fields/${t}`)).data}async readAll(){return(await this.transport.get("/fields")).data}async createOne(t,e){if(""==`${t}`)throw new s("collection");return(await this.transport.post(`/fields/${t}`,e)).data}async updateOne(t,e,r){if(""==`${t}`)throw new s("collection");if(""==`${e}`)throw new s("field");return(await this.transport.patch(`/fields/${t}/${e}`,r)).data}async deleteOne(t,e){if(""==`${t}`)throw new s("collection");if(""==`${e}`)throw new s("field");await this.transport.delete(`/fields/${t}/${e}`)}}class c extends n{constructor(t){super("directus_files",t)}async import(t){return(await this.transport.post("/files/import",t)).data}}class h extends n{constructor(t){super("directus_folders",t)}}class l extends n{constructor(t){super("directus_permissions",t)}}class p extends n{constructor(t){super("directus_presets",t)}}class d{constructor(t){this.transport=t}async readOne(t,e){if(""==`${t}`)throw new s("collection");if(""==`${e}`)throw new s("id");return(await this.transport.get(`/relations/${t}/${e}`)).data}async readMany(t){if(""==`${t}`)throw new s("collection");return(await this.transport.get(`/relations/${t}`)).data}async readAll(){return(await this.transport.get("/relations")).data}async createOne(t){return(await this.transport.post("/relations",t)).data}async updateOne(t,e,r){if(""==`${t}`)throw new s("collection");if(""==`${e}`)throw new s("field");return(await this.transport.patch(`/relations/${t}/${e}`,r)).data}async deleteOne(t,e){if(""==`${t}`)throw new s("collection");if(""==`${e}`)throw new s("field");await this.transport.delete(`/relations/${t}/${e}`)}}class f extends n{constructor(t){super("directus_revisions",t)}}class m extends n{constructor(t){super("directus_roles",t)}}class v{constructor(t){this.transport=t}async ping(){return(await this.transport.get("/server/ping")).raw}async info(){return(await this.transport.get("/server/info")).data}async oas(){return(await this.transport.get("/server/specs/oas")).raw}}class g{constructor(t,e){this.collection=t,this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}async read(t){return(await this.transport.get(`${this.endpoint}`,{params:t})).data}async update(t,e){return(await this.transport.patch(`${this.endpoint}`,t,{params:e})).data}}class w extends g{constructor(t){super("directus_settings",t)}}class _{constructor(t){this.transport=t}async send(t,e,r){await this.transport.post("/users/invite",{email:t,role:e,invite_url:r})}async accept(t,e){await this.transport.post("/users/invite/accept",{token:t,password:e})}}class y{constructor(t){this.transport=t}async generate(t){return(await this.transport.post("/users/me/tfa/generate",{password:t})).data}async enable(t,e){await this.transport.post("/users/me/tfa/enable",{secret:t,otp:e})}async disable(t){await this.transport.post("/users/me/tfa/disable",{otp:t})}}class E{constructor(t){this._transport=t}get tfa(){return this._tfa||(this._tfa=new y(this._transport))}async read(t){return(await this._transport.get("/users/me",{params:t})).data}async update(t,e){return(await this._transport.patch("/users/me",t,{params:e})).data}}class O extends n{constructor(t){super("directus_users",t)}get invites(){return this._invites||(this._invites=new _(this.transport))}get me(){return this._me||(this._me=new E(this.transport))}}class x{constructor(t){this.random={string:async(t=32)=>(await this.transport.get("/utils/random/string",{params:{length:t}})).data},this.hash={generate:async t=>(await this.transport.post("/utils/hash/generate",{string:t})).data,verify:async(t,e)=>(await this.transport.post("/utils/hash/verify",{string:t,hash:e})).data},this.transport=t}async sort(t,e,r){await this.transport.post(`/utils/sort/${encodeURI(t)}`,{item:e,to:r})}async revert(t){await this.transport.post(`/utils/revert/${encodeURI(t)}`)}}class R{}class b{}class k extends Error{constructor(t,e){var r,s;(null===(r=null==e?void 0:e.errors)||void 0===r?void 0:r.length)?super(null===(s=null==e?void 0:e.errors[0])||void 0===s?void 0:s.message):super((null==t?void 0:t.message)||"Unknown transport error"),this.parent=t,this.response=e,this.errors=(null==e?void 0:e.errors)||[],Object.values(e||{}).some((t=>void 0!==t))||(this.response=void 0),Object.setPrototypeOf(this,k.prototype)}}!function(t){t.AuthToken="auth_token",t.RefreshToken="auth_refresh_token",t.Expires="auth_expires",t.ExpiresAt="auth_expires_at"}(r||(r={}));class A extends R{constructor(t){var e;super(),this.prefix=null!==(e=null==t?void 0:t.prefix)&&void 0!==e?e:""}get auth_token(){return this.get(r.AuthToken)}set auth_token(t){null===t?this.delete(r.AuthToken):this.set(r.AuthToken,t)}get auth_expires(){const t=this.get(r.Expires);return null===t?null:parseInt(t)}set auth_expires(t){null===t?this.delete(r.Expires):this.set(r.Expires,t.toString())}get auth_expires_at(){const t=this.get(r.ExpiresAt);return null===t?null:parseInt(t)}set auth_expires_at(t){null===t?this.delete(r.ExpiresAt):this.set(r.ExpiresAt,t.toString())}get auth_refresh_token(){return this.get(r.RefreshToken)}set auth_refresh_token(t){null===t?this.delete(r.RefreshToken):this.set(r.RefreshToken,t)}}class T extends A{constructor(){super(...arguments),this.values={}}get(t){const e=this.key(t);return e in this.values?this.values[e]:null}set(t,e){return this.values[this.key(t)]=e,e}delete(t){const e=this.key(t),r=this.get(t);return e in this.values&&delete this.values[e],r}key(t){return`${this.prefix}${t}`}}class S extends A{get(t){const e=localStorage.getItem(this.key(t));return null!==e?e:null}set(t,e){return localStorage.setItem(this.key(t),e),e}delete(t){const e=this.key(t),r=this.get(e);return r&&localStorage.removeItem(e),r}key(t){return`${this.prefix}${t}`}}function $(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var j,P={exports:{}},U={exports:{}},N=function(t,e){return function(){for(var r=new Array(arguments.length),s=0;s<r.length;s++)r[s]=arguments[s];return t.apply(e,r)}},q=N,C=Object.prototype.toString,B=(j=Object.create(null),function(t){var e=C.call(t);return j[e]||(j[e]=e.slice(8,-1).toLowerCase())});function D(t){return t=t.toLowerCase(),function(e){return B(e)===t}}function L(t){return Array.isArray(t)}function I(t){return void 0===t}var F=D("ArrayBuffer");function M(t){return null!==t&&"object"==typeof t}function J(t){if("object"!==B(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}var W=D("Date"),z=D("File"),H=D("Blob"),V=D("FileList");function Q(t){return"[object Function]"===C.call(t)}var X=D("URLSearchParams");function K(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),L(t))for(var r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.call(null,t[n],n,t)}var G,Y=(G="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(t){return G&&t instanceof G}),Z={isArray:L,isArrayBuffer:F,isBuffer:function(t){return null!==t&&!I(t)&&null!==t.constructor&&!I(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){var e="[object FormData]";return t&&("function"==typeof FormData&&t instanceof FormData||C.call(t)===e||Q(t.toString)&&t.toString()===e)},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&F(t.buffer)},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:M,isPlainObject:J,isUndefined:I,isDate:W,isFile:z,isBlob:H,isFunction:Q,isStream:function(t){return M(t)&&Q(t.pipe)},isURLSearchParams:X,isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:K,merge:function t(){var e={};function r(r,s){J(e[s])&&J(r)?e[s]=t(e[s],r):J(r)?e[s]=t({},r):L(r)?e[s]=r.slice():e[s]=r}for(var s=0,n=arguments.length;s<n;s++)K(arguments[s],r);return e},extend:function(t,e,r){return K(e,(function(e,s){t[s]=r&&"function"==typeof e?q(e,r):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t},inherits:function(t,e,r,s){t.prototype=Object.create(e.prototype,s),t.prototype.constructor=t,r&&Object.assign(t.prototype,r)},toFlatObject:function(t,e,r){var s,n,i,o={};e=e||{};do{for(n=(s=Object.getOwnPropertyNames(t)).length;n-- >0;)o[i=s[n]]||(e[i]=t[i],o[i]=!0);t=Object.getPrototypeOf(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},kindOf:B,kindOfTest:D,endsWith:function(t,e,r){t=String(t),(void 0===r||r>t.length)&&(r=t.length),r-=e.length;var s=t.indexOf(e,r);return-1!==s&&s===r},toArray:function(t){if(!t)return null;var e=t.length;if(I(e))return null;for(var r=new Array(e);e-- >0;)r[e]=t[e];return r},isTypedArray:Y,isFileList:V},tt=Z;function et(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var rt=function(t,e,r){if(!e)return t;var s;if(r)s=r(e);else if(tt.isURLSearchParams(e))s=e.toString();else{var n=[];tt.forEach(e,(function(t,e){null!=t&&(tt.isArray(t)?e+="[]":t=[t],tt.forEach(t,(function(t){tt.isDate(t)?t=t.toISOString():tt.isObject(t)&&(t=JSON.stringify(t)),n.push(et(e)+"="+et(t))})))})),s=n.join("&")}if(s){var i=t.indexOf("#");-1!==i&&(t=t.slice(0,i)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t},st=Z;function nt(){this.handlers=[]}nt.prototype.use=function(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},nt.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},nt.prototype.forEach=function(t){st.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var it,ot,at=nt,ut=Z;function ct(){if(ot)return it;ot=1;var t=Z;function e(t,e,r,s,n){Error.call(this),this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),s&&(this.request=s),n&&(this.response=n)}t.inherits(e,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var r=e.prototype,s={};return["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach((function(t){s[t]={value:t}})),Object.defineProperties(e,s),Object.defineProperty(r,"isAxiosError",{value:!0}),e.from=function(s,n,i,o,a,u){var c=Object.create(r);return t.toFlatObject(s,c,(function(t){return t!==Error.prototype})),e.call(c,s.message,n,i,o,a),c.name=s.name,u&&Object.assign(c,u),c},it=e}var ht,lt,pt,dt,ft,mt,vt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};function gt(){if(lt)return ht;lt=1;var t=Z;return ht=function(e,r){r=r||new FormData;var s=[];function n(e){return null===e?"":t.isDate(e)?e.toISOString():t.isArrayBuffer(e)||t.isTypedArray(e)?"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}return function e(i,o){if(t.isPlainObject(i)||t.isArray(i)){if(-1!==s.indexOf(i))throw Error("Circular reference detected in "+o);s.push(i),t.forEach(i,(function(s,i){if(!t.isUndefined(s)){var a,u=o?o+"."+i:i;if(s&&!o&&"object"==typeof s)if(t.endsWith(i,"{}"))s=JSON.stringify(s);else if(t.endsWith(i,"[]")&&(a=t.toArray(s)))return void a.forEach((function(e){!t.isUndefined(e)&&r.append(u,n(e))}));e(s,u)}})),s.pop()}else r.append(o,n(i))}(e),r},ht}function wt(){if(dt)return pt;dt=1;var t=ct();return pt=function(e,r,s){var n=s.config.validateStatus;s.status&&n&&!n(s.status)?r(new t("Request failed with status code "+s.status,[t.ERR_BAD_REQUEST,t.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s)):e(s)}}function _t(){if(mt)return ft;mt=1;var t=Z;return ft=t.isStandardBrowserEnv()?{write:function(e,r,s,n,i,o){var a=[];a.push(e+"="+encodeURIComponent(r)),t.isNumber(s)&&a.push("expires="+new Date(s).toGMTString()),t.isString(n)&&a.push("path="+n),t.isString(i)&&a.push("domain="+i),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}}var yt,Et,Ot,xt,Rt,bt,kt,At,Tt,St,$t,jt,Pt=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)},Ut=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},Nt=function(t,e){return t&&!Pt(e)?Ut(t,e):e};function qt(){if(Et)return yt;Et=1;var t=Z,e=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return yt=function(r){var s,n,i,o={};return r?(t.forEach(r.split("\n"),(function(r){if(i=r.indexOf(":"),s=t.trim(r.substr(0,i)).toLowerCase(),n=t.trim(r.substr(i+1)),s){if(o[s]&&e.indexOf(s)>=0)return;o[s]="set-cookie"===s?(o[s]?o[s]:[]).concat([n]):o[s]?o[s]+", "+n:n}})),o):o}}function Ct(){if(xt)return Ot;xt=1;var t=Z;return Ot=t.isStandardBrowserEnv()?function(){var e,r=/(msie|trident)/i.test(navigator.userAgent),s=document.createElement("a");function n(t){var e=t;return r&&(s.setAttribute("href",e),e=s.href),s.setAttribute("href",e),{href:s.href,protocol:s.protocol?s.protocol.replace(/:$/,""):"",host:s.host,search:s.search?s.search.replace(/^\?/,""):"",hash:s.hash?s.hash.replace(/^#/,""):"",hostname:s.hostname,port:s.port,pathname:"/"===s.pathname.charAt(0)?s.pathname:"/"+s.pathname}}return e=n(window.location.href),function(r){var s=t.isString(r)?n(r):r;return s.protocol===e.protocol&&s.host===e.host}}():function(){return!0}}function Bt(){if(bt)return Rt;bt=1;var t=ct();function e(e){t.call(this,null==e?"canceled":e,t.ERR_CANCELED),this.name="CanceledError"}return Z.inherits(e,t,{__CANCEL__:!0}),Rt=e}function Dt(){return At?kt:(At=1,kt=function(t){var e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""})}function Lt(){if(St)return Tt;St=1;var t=Z,e=wt(),r=_t(),s=rt,n=Nt,i=qt(),o=Ct(),a=vt,u=ct(),c=Bt(),h=Dt();return Tt=function(l){return new Promise((function(p,d){var f,m=l.data,v=l.headers,g=l.responseType;function w(){l.cancelToken&&l.cancelToken.unsubscribe(f),l.signal&&l.signal.removeEventListener("abort",f)}t.isFormData(m)&&t.isStandardBrowserEnv()&&delete v["Content-Type"];var _=new XMLHttpRequest;if(l.auth){var y=l.auth.username||"",E=l.auth.password?unescape(encodeURIComponent(l.auth.password)):"";v.Authorization="Basic "+btoa(y+":"+E)}var O=n(l.baseURL,l.url);function x(){if(_){var t="getAllResponseHeaders"in _?i(_.getAllResponseHeaders()):null,r={data:g&&"text"!==g&&"json"!==g?_.response:_.responseText,status:_.status,statusText:_.statusText,headers:t,config:l,request:_};e((function(t){p(t),w()}),(function(t){d(t),w()}),r),_=null}}if(_.open(l.method.toUpperCase(),s(O,l.params,l.paramsSerializer),!0),_.timeout=l.timeout,"onloadend"in _?_.onloadend=x:_.onreadystatechange=function(){_&&4===_.readyState&&(0!==_.status||_.responseURL&&0===_.responseURL.indexOf("file:"))&&setTimeout(x)},_.onabort=function(){_&&(d(new u("Request aborted",u.ECONNABORTED,l,_)),_=null)},_.onerror=function(){d(new u("Network Error",u.ERR_NETWORK,l,_,_)),_=null},_.ontimeout=function(){var t=l.timeout?"timeout of "+l.timeout+"ms exceeded":"timeout exceeded",e=l.transitional||a;l.timeoutErrorMessage&&(t=l.timeoutErrorMessage),d(new u(t,e.clarifyTimeoutError?u.ETIMEDOUT:u.ECONNABORTED,l,_)),_=null},t.isStandardBrowserEnv()){var R=(l.withCredentials||o(O))&&l.xsrfCookieName?r.read(l.xsrfCookieName):void 0;R&&(v[l.xsrfHeaderName]=R)}"setRequestHeader"in _&&t.forEach(v,(function(t,e){void 0===m&&"content-type"===e.toLowerCase()?delete v[e]:_.setRequestHeader(e,t)})),t.isUndefined(l.withCredentials)||(_.withCredentials=!!l.withCredentials),g&&"json"!==g&&(_.responseType=l.responseType),"function"==typeof l.onDownloadProgress&&_.addEventListener("progress",l.onDownloadProgress),"function"==typeof l.onUploadProgress&&_.upload&&_.upload.addEventListener("progress",l.onUploadProgress),(l.cancelToken||l.signal)&&(f=function(t){_&&(d(!t||t&&t.type?new c:t),_.abort(),_=null)},l.cancelToken&&l.cancelToken.subscribe(f),l.signal&&(l.signal.aborted?f():l.signal.addEventListener("abort",f))),m||(m=null);var b=h(O);b&&-1===["http","https","file"].indexOf(b)?d(new u("Unsupported protocol "+b+":",u.ERR_BAD_REQUEST,l)):_.send(m)}))},Tt}var It=Z,Ft=function(t,e){ut.forEach(t,(function(r,s){s!==e&&s.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[s])}))},Mt=ct(),Jt=vt,Wt=gt(),zt={"Content-Type":"application/x-www-form-urlencoded"};function Ht(t,e){!It.isUndefined(t)&&It.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var Vt,Qt={transitional:Jt,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(Vt=Lt()),Vt),transformRequest:[function(t,e){if(Ft(e,"Accept"),Ft(e,"Content-Type"),It.isFormData(t)||It.isArrayBuffer(t)||It.isBuffer(t)||It.isStream(t)||It.isFile(t)||It.isBlob(t))return t;if(It.isArrayBufferView(t))return t.buffer;if(It.isURLSearchParams(t))return Ht(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString();var r,s=It.isObject(t),n=e&&e["Content-Type"];if((r=It.isFileList(t))||s&&"multipart/form-data"===n){var i=this.env&&this.env.FormData;return Wt(r?{"files[]":t}:t,i&&new i)}return s||"application/json"===n?(Ht(e,"application/json"),function(t,e,r){if(It.isString(t))try{return(e||JSON.parse)(t),It.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||Qt.transitional,r=e&&e.silentJSONParsing,s=e&&e.forcedJSONParsing,n=!r&&"json"===this.responseType;if(n||s&&It.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(n){if("SyntaxError"===t.name)throw Mt.from(t,Mt.ERR_BAD_RESPONSE,this,null,this.response);throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:jt?$t:(jt=1,$t=null)},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};It.forEach(["delete","get","head"],(function(t){Qt.headers[t]={}})),It.forEach(["post","put","patch"],(function(t){Qt.headers[t]=It.merge(zt)}));var Xt,Kt,Gt=Qt,Yt=Z,Zt=Gt;function te(){return Kt?Xt:(Kt=1,Xt=function(t){return!(!t||!t.__CANCEL__)})}var ee=Z,re=function(t,e,r){var s=this||Zt;return Yt.forEach(r,(function(r){t=r.call(s,t,e)})),t},se=te(),ne=Gt,ie=Bt();function oe(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ie}var ae,ue,ce=Z,he=function(t,e){e=e||{};var r={};function s(t,e){return ce.isPlainObject(t)&&ce.isPlainObject(e)?ce.merge(t,e):ce.isPlainObject(e)?ce.merge({},e):ce.isArray(e)?e.slice():e}function n(r){return ce.isUndefined(e[r])?ce.isUndefined(t[r])?void 0:s(void 0,t[r]):s(t[r],e[r])}function i(t){if(!ce.isUndefined(e[t]))return s(void 0,e[t])}function o(r){return ce.isUndefined(e[r])?ce.isUndefined(t[r])?void 0:s(void 0,t[r]):s(void 0,e[r])}function a(r){return r in e?s(t[r],e[r]):r in t?s(void 0,t[r]):void 0}var u={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a};return ce.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=u[t]||n,s=e(t);ce.isUndefined(s)&&e!==a||(r[t]=s)})),r};function le(){return ue?ae:(ue=1,ae={version:"0.27.2"})}var pe=le().version,de=ct(),fe={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){fe[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));var me={};fe.transitional=function(t,e,r){function s(t,e){return"[Axios v"+pe+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return function(r,n,i){if(!1===t)throw new de(s(n," has been removed"+(e?" in "+e:"")),de.ERR_DEPRECATED);return e&&!me[n]&&(me[n]=!0,console.warn(s(n," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,n,i)}};var ve,ge,we,_e,ye,Ee,Oe={assertOptions:function(t,e,r){if("object"!=typeof t)throw new de("options must be an object",de.ERR_BAD_OPTION_VALUE);for(var s=Object.keys(t),n=s.length;n-- >0;){var i=s[n],o=e[i];if(o){var a=t[i],u=void 0===a||o(a,i,t);if(!0!==u)throw new de("option "+i+" must be "+u,de.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new de("Unknown option "+i,de.ERR_BAD_OPTION)}},validators:fe},xe=Z,Re=rt,be=at,ke=function(t){return oe(t),t.headers=t.headers||{},t.data=re.call(t,t.data,t.headers,t.transformRequest),t.headers=ee.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),ee.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||ne.adapter)(t).then((function(e){return oe(t),e.data=re.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return se(e)||(oe(t),e&&e.response&&(e.response.data=re.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},Ae=he,Te=Nt,Se=Oe,$e=Se.validators;function je(t){this.defaults=t,this.interceptors={request:new be,response:new be}}je.prototype.request=function(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},(e=Ae(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;void 0!==r&&Se.assertOptions(r,{silentJSONParsing:$e.transitional($e.boolean),forcedJSONParsing:$e.transitional($e.boolean),clarifyTimeoutError:$e.transitional($e.boolean)},!1);var s=[],n=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(n=n&&t.synchronous,s.unshift(t.fulfilled,t.rejected))}));var i,o=[];if(this.interceptors.response.forEach((function(t){o.push(t.fulfilled,t.rejected)})),!n){var a=[ke,void 0];for(Array.prototype.unshift.apply(a,s),a=a.concat(o),i=Promise.resolve(e);a.length;)i=i.then(a.shift(),a.shift());return i}for(var u=e;s.length;){var c=s.shift(),h=s.shift();try{u=c(u)}catch(t){h(t);break}}try{i=ke(u)}catch(t){return Promise.reject(t)}for(;o.length;)i=i.then(o.shift(),o.shift());return i},je.prototype.getUri=function(t){t=Ae(this.defaults,t);var e=Te(t.baseURL,t.url);return Re(e,t.params,t.paramsSerializer)},xe.forEach(["delete","get","head","options"],(function(t){je.prototype[t]=function(e,r){return this.request(Ae(r||{},{method:t,url:e,data:(r||{}).data}))}})),xe.forEach(["post","put","patch"],(function(t){function e(e){return function(r,s,n){return this.request(Ae(n||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:r,data:s}))}}je.prototype[t]=e(),je.prototype[t+"Form"]=e(!0)}));var Pe=Z,Ue=N,Ne=je,qe=he;var Ce=function t(e){var r=new Ne(e),s=Ue(Ne.prototype.request,r);return Pe.extend(s,Ne.prototype,r),Pe.extend(s,r),s.create=function(r){return t(qe(e,r))},s}(Gt);Ce.Axios=Ne,Ce.CanceledError=Bt(),Ce.CancelToken=function(){if(ge)return ve;ge=1;var t=Bt();function e(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var r;this.promise=new Promise((function(t){r=t}));var s=this;this.promise.then((function(t){if(s._listeners){var e,r=s._listeners.length;for(e=0;e<r;e++)s._listeners[e](t);s._listeners=null}})),this.promise.then=function(t){var e,r=new Promise((function(t){s.subscribe(t),e=t})).then(t);return r.cancel=function(){s.unsubscribe(e)},r},e((function(e){s.reason||(s.reason=new t(e),r(s.reason))}))}return e.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},e.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},e.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},e.source=function(){var t;return{token:new e((function(e){t=e})),cancel:t}},ve=e}(),Ce.isCancel=te(),Ce.VERSION=le().version,Ce.toFormData=gt(),Ce.AxiosError=ct(),Ce.Cancel=Ce.CanceledError,Ce.all=function(t){return Promise.all(t)},Ce.spread=_e?we:(_e=1,we=function(t){return function(e){return t.apply(null,e)}}),Ce.isAxiosError=function(){if(Ee)return ye;Ee=1;var t=Z;return ye=function(e){return t.isObject(e)&&!0===e.isAxiosError}}(),U.exports=Ce,U.exports.default=Ce;var Be=$(P.exports=U.exports);class De extends b{constructor(t){var e;super(),this.config=t,this.axios=Be.create({baseURL:this.config.url,params:this.config.params,headers:this.config.headers,onUploadProgress:this.config.onUploadProgress,withCredentials:!0}),(null===(e=this.config)||void 0===e?void 0:e.beforeRequest)&&(this.beforeRequest=this.config.beforeRequest)}async beforeRequest(t){return t}get url(){return this.config.url}async request(t,e,r,s){var n,i,o,a,u;try{let n={method:t,url:e,data:r,params:null==s?void 0:s.params,headers:null==s?void 0:s.headers,onUploadProgress:null==s?void 0:s.onUploadProgress};n=await this.beforeRequest(n);const i=await this.axios.request(n),o={raw:i.data,status:i.status,statusText:i.statusText,headers:i.headers,data:i.data.data,meta:i.data.meta,errors:i.data.errors};if(i.data.errors)throw new k(null,o);return o}catch(t){if(!t||t instanceof Error==!1)throw t;if(Be.isAxiosError(t)){const e=null===(n=t.response)||void 0===n?void 0:n.data;throw new k(t,{raw:null===(i=t.response)||void 0===i?void 0:i.data,status:null===(o=t.response)||void 0===o?void 0:o.status,statusText:null===(a=t.response)||void 0===a?void 0:a.statusText,headers:null===(u=t.response)||void 0===u?void 0:u.headers,data:null==e?void 0:e.data,meta:null==e?void 0:e.meta,errors:null==e?void 0:e.errors})}throw new k(t)}}async get(t,e){return await this.request("get",t,void 0,e)}async head(t,e){return await this.request("head",t,void 0,e)}async options(t,e){return await this.request("options",t,void 0,e)}async delete(t,e,r){return await this.request("delete",t,e,r)}async put(t,e,r){return await this.request("put",t,e,r)}async post(t,e,r){return await this.request("post",t,e,r)}async patch(t,e,r){return await this.request("patch",t,e,r)}}class Le{constructor(t){this.transport=t}async request(t,e){await this.transport.post("/auth/password/request",{email:t,reset_url:e})}async reset(t,e){await this.transport.post("/auth/password/reset",{token:t,password:e})}}class Ie extends t{constructor(t){var e,r,s;super(),this.autoRefresh=!0,this.msRefreshBeforeExpires=3e4,this.staticToken="",this._transport=t.transport,this._storage=t.storage,this.autoRefresh=null!==(e=null==t?void 0:t.autoRefresh)&&void 0!==e?e:this.autoRefresh,this.mode=null!==(r=null==t?void 0:t.mode)&&void 0!==r?r:this.mode,this.msRefreshBeforeExpires=null!==(s=null==t?void 0:t.msRefreshBeforeExpires)&&void 0!==s?s:this.msRefreshBeforeExpires,(null==t?void 0:t.staticToken)&&(this.staticToken=null==t?void 0:t.staticToken,this.updateStorage({access_token:this.staticToken,expires:null,refresh_token:null}))}get storage(){return this._storage}get transport(){return this._transport}get token(){return(async()=>{if(this._refreshPromise)try{await this._refreshPromise}finally{this._refreshPromise=void 0}return this._storage.auth_token})()}get password(){return this.passwords=this.passwords||new Le(this._transport)}resetStorage(){this._storage.auth_token=null,this._storage.auth_refresh_token=null,this._storage.auth_expires=null,this._storage.auth_expires_at=null}updateStorage(t){var e,r;const s=null!==(e=t.expires)&&void 0!==e?e:null;this._storage.auth_token=t.access_token,this._storage.auth_refresh_token=null!==(r=t.refresh_token)&&void 0!==r?r:null,this._storage.auth_expires=s,this._storage.auth_expires_at=(new Date).getTime()+(null!=s?s:0)}async refreshIfExpired(){if(!this.staticToken&&this.autoRefresh)if(this._storage.auth_expires_at){this._storage.auth_expires_at<(new Date).getTime()+this.msRefreshBeforeExpires&&this.refresh();try{await this._refreshPromise}finally{this._refreshPromise=void 0}}else try{await this._refreshPromise}finally{this._refreshPromise=void 0}}refresh(){return this._refreshPromise=(async()=>{var t;const e=this._storage.auth_refresh_token;this.resetStorage();const r=await this._transport.post("/auth/refresh",{refresh_token:"json"===this.mode?e:void 0});return this.updateStorage(r.data),{access_token:r.data.access_token,...(null===(t=r.data)||void 0===t?void 0:t.refresh_token)&&{refresh_token:r.data.refresh_token},expires:r.data.expires}})()}async login(t){var e;this.resetStorage();const r=await this._transport.post("/auth/login",{mode:this.mode,...t},{headers:{Authorization:null}});return this.updateStorage(r.data),{access_token:r.data.access_token,...(null===(e=r.data)||void 0===e?void 0:e.refresh_token)&&{refresh_token:r.data.refresh_token},expires:r.data.expires}}async static(t){return this.staticToken||(this.staticToken=t),await this._transport.get("/users/me",{params:{access_token:t},headers:{Authorization:null}}),this.updateStorage({access_token:t,expires:null,refresh_token:null}),!0}async logout(){let t;"json"===this.mode&&(t=this._storage.auth_refresh_token||void 0),await this._transport.post("/auth/logout",{refresh_token:t}),this.updateStorage({access_token:null,expires:null,refresh_token:null})}}class Fe{constructor(t){this.transport=t}async request(t,e,r){return await this.transport.post(t,{query:e,variables:void 0===r?{}:r})}async items(t,e){return await this.request("/graphql",t,e)}async system(t,e){return await this.request("/graphql/system",t,e)}}class Me{constructor(e,r){var s,n,i,o,a,u,c,h,l;if(this._url=e,this._options=r,this._items={},this._singletons={},(null===(s=this._options)||void 0===s?void 0:s.storage)&&(null===(n=this._options)||void 0===n?void 0:n.storage)instanceof R)this._storage=this._options.storage;else{const t=null===(i=this._options)||void 0===i?void 0:i.storage,{mode:e,...r}=null!=t?t:{};"MemoryStorage"===e||"undefined"==typeof window?this._storage=new T(r):this._storage=new S(r)}(null===(o=this._options)||void 0===o?void 0:o.transport)&&(null===(a=this._options)||void 0===a?void 0:a.transport)instanceof b?this._transport=this._options.transport:this._transport=new De({url:this.url,beforeRequest:async t=>{await this._auth.refreshIfExpired();const e=this.storage.auth_token,r=e?e.startsWith("Bearer ")?String(this.storage.auth_token):`Bearer ${this.storage.auth_token}`:"";return{...t,headers:{Authorization:r,...t.headers}}},...null===(u=this._options)||void 0===u?void 0:u.transport}),(null===(c=this._options)||void 0===c?void 0:c.auth)&&(null===(h=this._options)||void 0===h?void 0:h.auth)instanceof t?this._auth=this._options.auth:this._auth=new Ie({transport:this._transport,storage:this._storage,...null===(l=this._options)||void 0===l?void 0:l.auth})}get url(){return this._url}get auth(){return this._auth}get storage(){return this._storage}get transport(){return this._transport}get activity(){return this._activity||(this._activity=new o(this.transport))}get collections(){return this._collections||(this._collections=new a(this.transport))}get fields(){return this._fields||(this._fields=new u(this.transport))}get files(){return this._files||(this._files=new c(this.transport))}get folders(){return this._folders||(this._folders=new h(this.transport))}get permissions(){return this._permissions||(this._permissions=new l(this.transport))}get presets(){return this._presets||(this._presets=new p(this.transport))}get relations(){return this._relations||(this._relations=new d(this.transport))}get revisions(){return this._revisions||(this._revisions=new f(this.transport))}get roles(){return this._roles||(this._roles=new m(this.transport))}get users(){return this._users||(this._users=new O(this.transport))}get settings(){return this._settings||(this._settings=new w(this.transport))}get server(){return this._server||(this._server=new v(this.transport))}get utils(){return this._utils||(this._utils=new x(this.transport))}get graphql(){return this._graphql||(this._graphql=new Fe(this.transport))}singleton(t){return this._singletons[t]||(this._singletons[t]=new g(t,this.transport))}items(t){return this._items[t]||(this._items[t]=new n(t,this.transport))}}export{o as ActivityHandler,Ie as Auth,A as BaseStorage,a as CollectionsHandler,i as CommentsHandler,Me as Directus,s as EmptyParamError,u as FieldsHandler,c as FilesHandler,h as FoldersHandler,t as IAuth,R as IStorage,b as ITransport,n as ItemsHandler,S as LocalStorage,T as MemoryStorage,e as Meta,l as PermissionsHandler,p as PresetsHandler,d as RelationsHandler,f as RevisionsHandler,m as RolesHandler,v as ServerHandler,w as SettingsHandler,De as Transport,k as TransportError,O as UsersHandler,x as UtilsHandler};
class t{constructor(){this.mode="undefined"==typeof window?"json":"cookie"}}var e,r;!function(t){t.TOTAL_COUNT="total_count",t.FILTER_COUNT="filter_count"}(e||(e={}));class s extends Error{constructor(t){super(`${null!=t?t:"ID"} cannot be an empty string`)}}class n{constructor(t,e){this.collection=t,this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}async readOne(t,e,r){if(""==`${t}`)throw new s("id");return(await this.transport.get(`${this.endpoint}/${encodeURI(t)}`,{params:e,...null==r?void 0:r.requestOptions})).data}async readMany(t,e,r){var s;const n=null===(s=(await this.transport.get(`/fields/${this.collection}`)).data)||void 0===s?void 0:s.find((t=>!0===t.schema.is_primary_key)),{data:i,meta:o}=await this.transport.get(`${this.endpoint}`,{params:{...e,filter:{[n.field]:{_in:t},...null==e?void 0:e.filter},sort:(null==e?void 0:e.sort)||n.field},...null==r?void 0:r.requestOptions});return{data:i,...o&&{meta:o}}}async readByQuery(t,e){const{data:r,meta:s}=await this.transport.get(`${this.endpoint}`,{params:t,...null==e?void 0:e.requestOptions});return{data:r,...s&&{meta:s}}}async createOne(t,e,r){return(await this.transport.post(`${this.endpoint}`,t,{params:e,...null==r?void 0:r.requestOptions})).data}async createMany(t,e,r){return await this.transport.post(`${this.endpoint}`,t,{params:e,...null==r?void 0:r.requestOptions})}async updateOne(t,e,r,n){if(""==`${t}`)throw new s("id");return(await this.transport.patch(`${this.endpoint}/${encodeURI(t)}`,e,{params:r,...null==n?void 0:n.requestOptions})).data}async updateMany(t,e,r,s){return await this.transport.patch(`${this.endpoint}`,{keys:t,data:e},{params:r,...null==s?void 0:s.requestOptions})}async updateByQuery(t,e,r,s){return await this.transport.patch(`${this.endpoint}`,{query:t,data:e},{params:r,...null==s?void 0:s.requestOptions})}async deleteOne(t,e){if(""==`${t}`)throw new s("id");await this.transport.delete(`${this.endpoint}/${encodeURI(t)}`,void 0,null==e?void 0:e.requestOptions)}async deleteMany(t,e){await this.transport.delete(`${this.endpoint}`,t,null==e?void 0:e.requestOptions)}}class i{constructor(t){this.transport=t}async create(t){return(await this.transport.post("/activity/comment",t)).data}async update(t,e){if(""==`${t}`)throw new s("comment_activity_id");return(await this.transport.patch(`/activity/comment/${encodeURI(t)}`,{comment:e})).data}async delete(t){if(""==`${t}`)throw new s("comment_activity_id");await this.transport.delete(`/activity/comment/${encodeURI(t)}`)}}class o extends n{constructor(t){super("directus_activity",t),this._comments=new i(this.transport)}get comments(){return this._comments}}class a{constructor(t){this.transport=t}async readOne(t){if(""==`${t}`)throw new s("collection");return(await this.transport.get(`/collections/${t}`)).data}async readAll(){const{data:t,meta:e}=await this.transport.get("/collections");return{data:t,meta:e}}async createOne(t){return(await this.transport.post("/collections",t)).data}async createMany(t){const{data:e,meta:r}=await this.transport.post("/collections",t);return{data:e,meta:r}}async updateOne(t,e,r){if(""==`${t}`)throw new s("collection");return(await this.transport.patch(`/collections/${t}`,e,{params:r})).data}async deleteOne(t){if(""==`${t}`)throw new s("collection");await this.transport.delete(`/collections/${t}`)}}class u{constructor(t){this.transport=t}async readOne(t,e){if(""==`${t}`)throw new s("collection");if(""==`${e}`)throw new s("id");return(await this.transport.get(`/fields/${t}/${e}`)).data}async readMany(t){if(""==`${t}`)throw new s("collection");return(await this.transport.get(`/fields/${t}`)).data}async readAll(){return(await this.transport.get("/fields")).data}async createOne(t,e){if(""==`${t}`)throw new s("collection");return(await this.transport.post(`/fields/${t}`,e)).data}async updateOne(t,e,r){if(""==`${t}`)throw new s("collection");if(""==`${e}`)throw new s("field");return(await this.transport.patch(`/fields/${t}/${e}`,r)).data}async deleteOne(t,e){if(""==`${t}`)throw new s("collection");if(""==`${e}`)throw new s("field");await this.transport.delete(`/fields/${t}/${e}`)}}class c extends n{constructor(t){super("directus_files",t)}async import(t){return(await this.transport.post("/files/import",t)).data}}class h extends n{constructor(t){super("directus_folders",t)}}class l extends n{constructor(t){super("directus_permissions",t)}}class p extends n{constructor(t){super("directus_presets",t)}}class d{constructor(t){this.transport=t}async readOne(t,e){if(""==`${t}`)throw new s("collection");if(""==`${e}`)throw new s("id");return(await this.transport.get(`/relations/${t}/${e}`)).data}async readMany(t){if(""==`${t}`)throw new s("collection");return(await this.transport.get(`/relations/${t}`)).data}async readAll(){return(await this.transport.get("/relations")).data}async createOne(t){return(await this.transport.post("/relations",t)).data}async updateOne(t,e,r){if(""==`${t}`)throw new s("collection");if(""==`${e}`)throw new s("field");return(await this.transport.patch(`/relations/${t}/${e}`,r)).data}async deleteOne(t,e){if(""==`${t}`)throw new s("collection");if(""==`${e}`)throw new s("field");await this.transport.delete(`/relations/${t}/${e}`)}}class f extends n{constructor(t){super("directus_revisions",t)}}class m extends n{constructor(t){super("directus_roles",t)}}class v{constructor(t){this.transport=t}async ping(){return(await this.transport.get("/server/ping")).raw}async info(){return(await this.transport.get("/server/info")).data}async oas(){return(await this.transport.get("/server/specs/oas")).raw}}class g{constructor(t,e){this.collection=t,this.transport=e,this.endpoint=t.startsWith("directus_")?`/${t.substring(9)}`:`/items/${t}`}async read(t){return(await this.transport.get(`${this.endpoint}`,{params:t})).data}async update(t,e){return(await this.transport.patch(`${this.endpoint}`,t,{params:e})).data}}class w extends g{constructor(t){super("directus_settings",t)}}class _{constructor(t){this.transport=t}async send(t,e,r){await this.transport.post("/users/invite",{email:t,role:e,invite_url:r})}async accept(t,e){await this.transport.post("/users/invite/accept",{token:t,password:e})}}class y{constructor(t){this.transport=t}async generate(t){return(await this.transport.post("/users/me/tfa/generate",{password:t})).data}async enable(t,e){await this.transport.post("/users/me/tfa/enable",{secret:t,otp:e})}async disable(t){await this.transport.post("/users/me/tfa/disable",{otp:t})}}class E{constructor(t){this._transport=t}get tfa(){return this._tfa||(this._tfa=new y(this._transport))}async read(t){return(await this._transport.get("/users/me",{params:t})).data}async update(t,e){return(await this._transport.patch("/users/me",t,{params:e})).data}}class O extends n{constructor(t){super("directus_users",t)}get invites(){return this._invites||(this._invites=new _(this.transport))}get me(){return this._me||(this._me=new E(this.transport))}}class x{constructor(t){this.random={string:async(t=32)=>(await this.transport.get("/utils/random/string",{params:{length:t}})).data},this.hash={generate:async t=>(await this.transport.post("/utils/hash/generate",{string:t})).data,verify:async(t,e)=>(await this.transport.post("/utils/hash/verify",{string:t,hash:e})).data},this.transport=t}async sort(t,e,r){await this.transport.post(`/utils/sort/${encodeURI(t)}`,{item:e,to:r})}async revert(t){await this.transport.post(`/utils/revert/${encodeURI(t)}`)}}class R{}class b{}class k extends Error{constructor(t,e){var r,s;(null===(r=null==e?void 0:e.errors)||void 0===r?void 0:r.length)?super(null===(s=null==e?void 0:e.errors[0])||void 0===s?void 0:s.message):super((null==t?void 0:t.message)||"Unknown transport error"),this.parent=t,this.response=e,this.errors=(null==e?void 0:e.errors)||[],Object.values(e||{}).some((t=>void 0!==t))||(this.response=void 0),Object.setPrototypeOf(this,k.prototype)}}!function(t){t.AuthToken="auth_token",t.RefreshToken="auth_refresh_token",t.Expires="auth_expires",t.ExpiresAt="auth_expires_at"}(r||(r={}));class A extends R{constructor(t){var e;super(),this.prefix=null!==(e=null==t?void 0:t.prefix)&&void 0!==e?e:""}get auth_token(){return this.get(r.AuthToken)}set auth_token(t){null===t?this.delete(r.AuthToken):this.set(r.AuthToken,t)}get auth_expires(){const t=this.get(r.Expires);return null===t?null:parseInt(t)}set auth_expires(t){null===t?this.delete(r.Expires):this.set(r.Expires,t.toString())}get auth_expires_at(){const t=this.get(r.ExpiresAt);return null===t?null:parseInt(t)}set auth_expires_at(t){null===t?this.delete(r.ExpiresAt):this.set(r.ExpiresAt,t.toString())}get auth_refresh_token(){return this.get(r.RefreshToken)}set auth_refresh_token(t){null===t?this.delete(r.RefreshToken):this.set(r.RefreshToken,t)}}class T extends A{constructor(){super(...arguments),this.values={}}get(t){const e=this.key(t);return e in this.values?this.values[e]:null}set(t,e){return this.values[this.key(t)]=e,e}delete(t){const e=this.key(t),r=this.get(t);return e in this.values&&delete this.values[e],r}key(t){return`${this.prefix}${t}`}}class S extends A{get(t){const e=localStorage.getItem(this.key(t));return null!==e?e:null}set(t,e){return localStorage.setItem(this.key(t),e),e}delete(t){const e=this.key(t),r=this.get(e);return r&&localStorage.removeItem(e),r}key(t){return`${this.prefix}${t}`}}function $(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var j,P={exports:{}},U={exports:{}},N=function(t,e){return function(){for(var r=new Array(arguments.length),s=0;s<r.length;s++)r[s]=arguments[s];return t.apply(e,r)}},q=N,C=Object.prototype.toString,B=(j=Object.create(null),function(t){var e=C.call(t);return j[e]||(j[e]=e.slice(8,-1).toLowerCase())});function D(t){return t=t.toLowerCase(),function(e){return B(e)===t}}function L(t){return Array.isArray(t)}function I(t){return void 0===t}var F=D("ArrayBuffer");function M(t){return null!==t&&"object"==typeof t}function J(t){if("object"!==B(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}var W=D("Date"),z=D("File"),H=D("Blob"),V=D("FileList");function Q(t){return"[object Function]"===C.call(t)}var X=D("URLSearchParams");function K(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),L(t))for(var r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.call(null,t[n],n,t)}var G,Y=(G="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(t){return G&&t instanceof G}),Z={isArray:L,isArrayBuffer:F,isBuffer:function(t){return null!==t&&!I(t)&&null!==t.constructor&&!I(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){var e="[object FormData]";return t&&("function"==typeof FormData&&t instanceof FormData||C.call(t)===e||Q(t.toString)&&t.toString()===e)},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&F(t.buffer)},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:M,isPlainObject:J,isUndefined:I,isDate:W,isFile:z,isBlob:H,isFunction:Q,isStream:function(t){return M(t)&&Q(t.pipe)},isURLSearchParams:X,isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:K,merge:function t(){var e={};function r(r,s){J(e[s])&&J(r)?e[s]=t(e[s],r):J(r)?e[s]=t({},r):L(r)?e[s]=r.slice():e[s]=r}for(var s=0,n=arguments.length;s<n;s++)K(arguments[s],r);return e},extend:function(t,e,r){return K(e,(function(e,s){t[s]=r&&"function"==typeof e?q(e,r):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t},inherits:function(t,e,r,s){t.prototype=Object.create(e.prototype,s),t.prototype.constructor=t,r&&Object.assign(t.prototype,r)},toFlatObject:function(t,e,r){var s,n,i,o={};e=e||{};do{for(n=(s=Object.getOwnPropertyNames(t)).length;n-- >0;)o[i=s[n]]||(e[i]=t[i],o[i]=!0);t=Object.getPrototypeOf(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},kindOf:B,kindOfTest:D,endsWith:function(t,e,r){t=String(t),(void 0===r||r>t.length)&&(r=t.length),r-=e.length;var s=t.indexOf(e,r);return-1!==s&&s===r},toArray:function(t){if(!t)return null;var e=t.length;if(I(e))return null;for(var r=new Array(e);e-- >0;)r[e]=t[e];return r},isTypedArray:Y,isFileList:V},tt=Z;function et(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var rt=function(t,e,r){if(!e)return t;var s;if(r)s=r(e);else if(tt.isURLSearchParams(e))s=e.toString();else{var n=[];tt.forEach(e,(function(t,e){null!=t&&(tt.isArray(t)?e+="[]":t=[t],tt.forEach(t,(function(t){tt.isDate(t)?t=t.toISOString():tt.isObject(t)&&(t=JSON.stringify(t)),n.push(et(e)+"="+et(t))})))})),s=n.join("&")}if(s){var i=t.indexOf("#");-1!==i&&(t=t.slice(0,i)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t},st=Z;function nt(){this.handlers=[]}nt.prototype.use=function(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},nt.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},nt.prototype.forEach=function(t){st.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var it,ot,at=nt,ut=Z;function ct(){if(ot)return it;ot=1;var t=Z;function e(t,e,r,s,n){Error.call(this),this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),s&&(this.request=s),n&&(this.response=n)}t.inherits(e,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var r=e.prototype,s={};return["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach((function(t){s[t]={value:t}})),Object.defineProperties(e,s),Object.defineProperty(r,"isAxiosError",{value:!0}),e.from=function(s,n,i,o,a,u){var c=Object.create(r);return t.toFlatObject(s,c,(function(t){return t!==Error.prototype})),e.call(c,s.message,n,i,o,a),c.name=s.name,u&&Object.assign(c,u),c},it=e}var ht,lt,pt,dt,ft,mt,vt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};function gt(){if(lt)return ht;lt=1;var t=Z;return ht=function(e,r){r=r||new FormData;var s=[];function n(e){return null===e?"":t.isDate(e)?e.toISOString():t.isArrayBuffer(e)||t.isTypedArray(e)?"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}return function e(i,o){if(t.isPlainObject(i)||t.isArray(i)){if(-1!==s.indexOf(i))throw Error("Circular reference detected in "+o);s.push(i),t.forEach(i,(function(s,i){if(!t.isUndefined(s)){var a,u=o?o+"."+i:i;if(s&&!o&&"object"==typeof s)if(t.endsWith(i,"{}"))s=JSON.stringify(s);else if(t.endsWith(i,"[]")&&(a=t.toArray(s)))return void a.forEach((function(e){!t.isUndefined(e)&&r.append(u,n(e))}));e(s,u)}})),s.pop()}else r.append(o,n(i))}(e),r},ht}function wt(){if(dt)return pt;dt=1;var t=ct();return pt=function(e,r,s){var n=s.config.validateStatus;s.status&&n&&!n(s.status)?r(new t("Request failed with status code "+s.status,[t.ERR_BAD_REQUEST,t.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s)):e(s)}}function _t(){if(mt)return ft;mt=1;var t=Z;return ft=t.isStandardBrowserEnv()?{write:function(e,r,s,n,i,o){var a=[];a.push(e+"="+encodeURIComponent(r)),t.isNumber(s)&&a.push("expires="+new Date(s).toGMTString()),t.isString(n)&&a.push("path="+n),t.isString(i)&&a.push("domain="+i),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}}var yt,Et,Ot,xt,Rt,bt,kt,At,Tt,St,$t,jt,Pt=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)},Ut=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},Nt=function(t,e){return t&&!Pt(e)?Ut(t,e):e};function qt(){if(Et)return yt;Et=1;var t=Z,e=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return yt=function(r){var s,n,i,o={};return r?(t.forEach(r.split("\n"),(function(r){if(i=r.indexOf(":"),s=t.trim(r.substr(0,i)).toLowerCase(),n=t.trim(r.substr(i+1)),s){if(o[s]&&e.indexOf(s)>=0)return;o[s]="set-cookie"===s?(o[s]?o[s]:[]).concat([n]):o[s]?o[s]+", "+n:n}})),o):o}}function Ct(){if(xt)return Ot;xt=1;var t=Z;return Ot=t.isStandardBrowserEnv()?function(){var e,r=/(msie|trident)/i.test(navigator.userAgent),s=document.createElement("a");function n(t){var e=t;return r&&(s.setAttribute("href",e),e=s.href),s.setAttribute("href",e),{href:s.href,protocol:s.protocol?s.protocol.replace(/:$/,""):"",host:s.host,search:s.search?s.search.replace(/^\?/,""):"",hash:s.hash?s.hash.replace(/^#/,""):"",hostname:s.hostname,port:s.port,pathname:"/"===s.pathname.charAt(0)?s.pathname:"/"+s.pathname}}return e=n(window.location.href),function(r){var s=t.isString(r)?n(r):r;return s.protocol===e.protocol&&s.host===e.host}}():function(){return!0}}function Bt(){if(bt)return Rt;bt=1;var t=ct();function e(e){t.call(this,null==e?"canceled":e,t.ERR_CANCELED),this.name="CanceledError"}return Z.inherits(e,t,{__CANCEL__:!0}),Rt=e}function Dt(){return At?kt:(At=1,kt=function(t){var e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""})}function Lt(){if(St)return Tt;St=1;var t=Z,e=wt(),r=_t(),s=rt,n=Nt,i=qt(),o=Ct(),a=vt,u=ct(),c=Bt(),h=Dt();return Tt=function(l){return new Promise((function(p,d){var f,m=l.data,v=l.headers,g=l.responseType;function w(){l.cancelToken&&l.cancelToken.unsubscribe(f),l.signal&&l.signal.removeEventListener("abort",f)}t.isFormData(m)&&t.isStandardBrowserEnv()&&delete v["Content-Type"];var _=new XMLHttpRequest;if(l.auth){var y=l.auth.username||"",E=l.auth.password?unescape(encodeURIComponent(l.auth.password)):"";v.Authorization="Basic "+btoa(y+":"+E)}var O=n(l.baseURL,l.url);function x(){if(_){var t="getAllResponseHeaders"in _?i(_.getAllResponseHeaders()):null,r={data:g&&"text"!==g&&"json"!==g?_.response:_.responseText,status:_.status,statusText:_.statusText,headers:t,config:l,request:_};e((function(t){p(t),w()}),(function(t){d(t),w()}),r),_=null}}if(_.open(l.method.toUpperCase(),s(O,l.params,l.paramsSerializer),!0),_.timeout=l.timeout,"onloadend"in _?_.onloadend=x:_.onreadystatechange=function(){_&&4===_.readyState&&(0!==_.status||_.responseURL&&0===_.responseURL.indexOf("file:"))&&setTimeout(x)},_.onabort=function(){_&&(d(new u("Request aborted",u.ECONNABORTED,l,_)),_=null)},_.onerror=function(){d(new u("Network Error",u.ERR_NETWORK,l,_,_)),_=null},_.ontimeout=function(){var t=l.timeout?"timeout of "+l.timeout+"ms exceeded":"timeout exceeded",e=l.transitional||a;l.timeoutErrorMessage&&(t=l.timeoutErrorMessage),d(new u(t,e.clarifyTimeoutError?u.ETIMEDOUT:u.ECONNABORTED,l,_)),_=null},t.isStandardBrowserEnv()){var R=(l.withCredentials||o(O))&&l.xsrfCookieName?r.read(l.xsrfCookieName):void 0;R&&(v[l.xsrfHeaderName]=R)}"setRequestHeader"in _&&t.forEach(v,(function(t,e){void 0===m&&"content-type"===e.toLowerCase()?delete v[e]:_.setRequestHeader(e,t)})),t.isUndefined(l.withCredentials)||(_.withCredentials=!!l.withCredentials),g&&"json"!==g&&(_.responseType=l.responseType),"function"==typeof l.onDownloadProgress&&_.addEventListener("progress",l.onDownloadProgress),"function"==typeof l.onUploadProgress&&_.upload&&_.upload.addEventListener("progress",l.onUploadProgress),(l.cancelToken||l.signal)&&(f=function(t){_&&(d(!t||t&&t.type?new c:t),_.abort(),_=null)},l.cancelToken&&l.cancelToken.subscribe(f),l.signal&&(l.signal.aborted?f():l.signal.addEventListener("abort",f))),m||(m=null);var b=h(O);b&&-1===["http","https","file"].indexOf(b)?d(new u("Unsupported protocol "+b+":",u.ERR_BAD_REQUEST,l)):_.send(m)}))},Tt}var It=Z,Ft=function(t,e){ut.forEach(t,(function(r,s){s!==e&&s.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[s])}))},Mt=ct(),Jt=vt,Wt=gt(),zt={"Content-Type":"application/x-www-form-urlencoded"};function Ht(t,e){!It.isUndefined(t)&&It.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var Vt,Qt={transitional:Jt,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(Vt=Lt()),Vt),transformRequest:[function(t,e){if(Ft(e,"Accept"),Ft(e,"Content-Type"),It.isFormData(t)||It.isArrayBuffer(t)||It.isBuffer(t)||It.isStream(t)||It.isFile(t)||It.isBlob(t))return t;if(It.isArrayBufferView(t))return t.buffer;if(It.isURLSearchParams(t))return Ht(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString();var r,s=It.isObject(t),n=e&&e["Content-Type"];if((r=It.isFileList(t))||s&&"multipart/form-data"===n){var i=this.env&&this.env.FormData;return Wt(r?{"files[]":t}:t,i&&new i)}return s||"application/json"===n?(Ht(e,"application/json"),function(t,e,r){if(It.isString(t))try{return(e||JSON.parse)(t),It.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||Qt.transitional,r=e&&e.silentJSONParsing,s=e&&e.forcedJSONParsing,n=!r&&"json"===this.responseType;if(n||s&&It.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(n){if("SyntaxError"===t.name)throw Mt.from(t,Mt.ERR_BAD_RESPONSE,this,null,this.response);throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:jt?$t:(jt=1,$t=null)},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};It.forEach(["delete","get","head"],(function(t){Qt.headers[t]={}})),It.forEach(["post","put","patch"],(function(t){Qt.headers[t]=It.merge(zt)}));var Xt,Kt,Gt=Qt,Yt=Z,Zt=Gt;function te(){return Kt?Xt:(Kt=1,Xt=function(t){return!(!t||!t.__CANCEL__)})}var ee=Z,re=function(t,e,r){var s=this||Zt;return Yt.forEach(r,(function(r){t=r.call(s,t,e)})),t},se=te(),ne=Gt,ie=Bt();function oe(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ie}var ae,ue,ce=Z,he=function(t,e){e=e||{};var r={};function s(t,e){return ce.isPlainObject(t)&&ce.isPlainObject(e)?ce.merge(t,e):ce.isPlainObject(e)?ce.merge({},e):ce.isArray(e)?e.slice():e}function n(r){return ce.isUndefined(e[r])?ce.isUndefined(t[r])?void 0:s(void 0,t[r]):s(t[r],e[r])}function i(t){if(!ce.isUndefined(e[t]))return s(void 0,e[t])}function o(r){return ce.isUndefined(e[r])?ce.isUndefined(t[r])?void 0:s(void 0,t[r]):s(void 0,e[r])}function a(r){return r in e?s(t[r],e[r]):r in t?s(void 0,t[r]):void 0}var u={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a};return ce.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=u[t]||n,s=e(t);ce.isUndefined(s)&&e!==a||(r[t]=s)})),r};function le(){return ue?ae:(ue=1,ae={version:"0.27.2"})}var pe=le().version,de=ct(),fe={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){fe[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));var me={};fe.transitional=function(t,e,r){function s(t,e){return"[Axios v"+pe+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return function(r,n,i){if(!1===t)throw new de(s(n," has been removed"+(e?" in "+e:"")),de.ERR_DEPRECATED);return e&&!me[n]&&(me[n]=!0,console.warn(s(n," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,n,i)}};var ve,ge,we,_e,ye,Ee,Oe={assertOptions:function(t,e,r){if("object"!=typeof t)throw new de("options must be an object",de.ERR_BAD_OPTION_VALUE);for(var s=Object.keys(t),n=s.length;n-- >0;){var i=s[n],o=e[i];if(o){var a=t[i],u=void 0===a||o(a,i,t);if(!0!==u)throw new de("option "+i+" must be "+u,de.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new de("Unknown option "+i,de.ERR_BAD_OPTION)}},validators:fe},xe=Z,Re=rt,be=at,ke=function(t){return oe(t),t.headers=t.headers||{},t.data=re.call(t,t.data,t.headers,t.transformRequest),t.headers=ee.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),ee.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||ne.adapter)(t).then((function(e){return oe(t),e.data=re.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return se(e)||(oe(t),e&&e.response&&(e.response.data=re.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},Ae=he,Te=Nt,Se=Oe,$e=Se.validators;function je(t){this.defaults=t,this.interceptors={request:new be,response:new be}}je.prototype.request=function(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},(e=Ae(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;void 0!==r&&Se.assertOptions(r,{silentJSONParsing:$e.transitional($e.boolean),forcedJSONParsing:$e.transitional($e.boolean),clarifyTimeoutError:$e.transitional($e.boolean)},!1);var s=[],n=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(n=n&&t.synchronous,s.unshift(t.fulfilled,t.rejected))}));var i,o=[];if(this.interceptors.response.forEach((function(t){o.push(t.fulfilled,t.rejected)})),!n){var a=[ke,void 0];for(Array.prototype.unshift.apply(a,s),a=a.concat(o),i=Promise.resolve(e);a.length;)i=i.then(a.shift(),a.shift());return i}for(var u=e;s.length;){var c=s.shift(),h=s.shift();try{u=c(u)}catch(t){h(t);break}}try{i=ke(u)}catch(t){return Promise.reject(t)}for(;o.length;)i=i.then(o.shift(),o.shift());return i},je.prototype.getUri=function(t){t=Ae(this.defaults,t);var e=Te(t.baseURL,t.url);return Re(e,t.params,t.paramsSerializer)},xe.forEach(["delete","get","head","options"],(function(t){je.prototype[t]=function(e,r){return this.request(Ae(r||{},{method:t,url:e,data:(r||{}).data}))}})),xe.forEach(["post","put","patch"],(function(t){function e(e){return function(r,s,n){return this.request(Ae(n||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:r,data:s}))}}je.prototype[t]=e(),je.prototype[t+"Form"]=e(!0)}));var Pe=Z,Ue=N,Ne=je,qe=he;var Ce=function t(e){var r=new Ne(e),s=Ue(Ne.prototype.request,r);return Pe.extend(s,Ne.prototype,r),Pe.extend(s,r),s.create=function(r){return t(qe(e,r))},s}(Gt);Ce.Axios=Ne,Ce.CanceledError=Bt(),Ce.CancelToken=function(){if(ge)return ve;ge=1;var t=Bt();function e(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var r;this.promise=new Promise((function(t){r=t}));var s=this;this.promise.then((function(t){if(s._listeners){var e,r=s._listeners.length;for(e=0;e<r;e++)s._listeners[e](t);s._listeners=null}})),this.promise.then=function(t){var e,r=new Promise((function(t){s.subscribe(t),e=t})).then(t);return r.cancel=function(){s.unsubscribe(e)},r},e((function(e){s.reason||(s.reason=new t(e),r(s.reason))}))}return e.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},e.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},e.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},e.source=function(){var t;return{token:new e((function(e){t=e})),cancel:t}},ve=e}(),Ce.isCancel=te(),Ce.VERSION=le().version,Ce.toFormData=gt(),Ce.AxiosError=ct(),Ce.Cancel=Ce.CanceledError,Ce.all=function(t){return Promise.all(t)},Ce.spread=_e?we:(_e=1,we=function(t){return function(e){return t.apply(null,e)}}),Ce.isAxiosError=function(){if(Ee)return ye;Ee=1;var t=Z;return ye=function(e){return t.isObject(e)&&!0===e.isAxiosError}}(),U.exports=Ce,U.exports.default=Ce;var Be=$(P.exports=U.exports);class De extends b{constructor(t){var e;super(),this.config=t,this.axios=Be.create({baseURL:this.config.url,params:this.config.params,headers:this.config.headers,onUploadProgress:this.config.onUploadProgress,withCredentials:!0}),(null===(e=this.config)||void 0===e?void 0:e.beforeRequest)&&(this.beforeRequest=this.config.beforeRequest)}async beforeRequest(t){return t}get url(){return this.config.url}async request(t,e,r,s){var n,i,o,a,u;try{let n={method:t,url:e,data:r,params:null==s?void 0:s.params,headers:null==s?void 0:s.headers,onUploadProgress:null==s?void 0:s.onUploadProgress};n=await this.beforeRequest(n);const i=await this.axios.request(n),o={raw:i.data,status:i.status,statusText:i.statusText,headers:i.headers,data:i.data.data,meta:i.data.meta,errors:i.data.errors};if(i.data.errors)throw new k(null,o);return o}catch(t){if(!t||t instanceof Error==!1)throw t;if(Be.isAxiosError(t)){const e=null===(n=t.response)||void 0===n?void 0:n.data;throw new k(t,{raw:null===(i=t.response)||void 0===i?void 0:i.data,status:null===(o=t.response)||void 0===o?void 0:o.status,statusText:null===(a=t.response)||void 0===a?void 0:a.statusText,headers:null===(u=t.response)||void 0===u?void 0:u.headers,data:null==e?void 0:e.data,meta:null==e?void 0:e.meta,errors:null==e?void 0:e.errors})}throw new k(t)}}async get(t,e){return await this.request("get",t,void 0,e)}async head(t,e){return await this.request("head",t,void 0,e)}async options(t,e){return await this.request("options",t,void 0,e)}async delete(t,e,r){return await this.request("delete",t,e,r)}async put(t,e,r){return await this.request("put",t,e,r)}async post(t,e,r){return await this.request("post",t,e,r)}async patch(t,e,r){return await this.request("patch",t,e,r)}}class Le{constructor(t){this.transport=t}async request(t,e){await this.transport.post("/auth/password/request",{email:t,reset_url:e})}async reset(t,e){await this.transport.post("/auth/password/reset",{token:t,password:e})}}class Ie extends t{constructor(t){var e,r,s;super(),this.autoRefresh=!0,this.msRefreshBeforeExpires=3e4,this.staticToken="",this._transport=t.transport,this._storage=t.storage,this.autoRefresh=null!==(e=null==t?void 0:t.autoRefresh)&&void 0!==e?e:this.autoRefresh,this.mode=null!==(r=null==t?void 0:t.mode)&&void 0!==r?r:this.mode,this.msRefreshBeforeExpires=null!==(s=null==t?void 0:t.msRefreshBeforeExpires)&&void 0!==s?s:this.msRefreshBeforeExpires,(null==t?void 0:t.staticToken)&&(this.staticToken=null==t?void 0:t.staticToken,this.updateStorage({access_token:this.staticToken,expires:null,refresh_token:null}))}get storage(){return this._storage}get transport(){return this._transport}get token(){return(async()=>{if(this._refreshPromise)try{await this._refreshPromise}finally{this._refreshPromise=void 0}return this._storage.auth_token})()}get password(){return this.passwords=this.passwords||new Le(this._transport)}resetStorage(){this._storage.auth_token=null,this._storage.auth_refresh_token=null,this._storage.auth_expires=null,this._storage.auth_expires_at=null}updateStorage(t){var e,r;const s=null!==(e=t.expires)&&void 0!==e?e:null;this._storage.auth_token=t.access_token,this._storage.auth_refresh_token=null!==(r=t.refresh_token)&&void 0!==r?r:null,this._storage.auth_expires=s,this._storage.auth_expires_at=(new Date).getTime()+(null!=s?s:0)}async refreshIfExpired(){if(!this.staticToken&&this.autoRefresh)if(this._storage.auth_expires_at){this._storage.auth_expires_at<(new Date).getTime()+this.msRefreshBeforeExpires&&this.refresh();try{await this._refreshPromise}finally{this._refreshPromise=void 0}}else try{await this._refreshPromise}finally{this._refreshPromise=void 0}}refresh(){return this._refreshPromise=(async()=>{var t;const e=this._storage.auth_refresh_token;this.resetStorage();const r=await this._transport.post("/auth/refresh",{refresh_token:"json"===this.mode?e:void 0});return this.updateStorage(r.data),{access_token:r.data.access_token,...(null===(t=r.data)||void 0===t?void 0:t.refresh_token)&&{refresh_token:r.data.refresh_token},expires:r.data.expires}})()}async login(t){var e;this.resetStorage();const r=await this._transport.post("/auth/login",{mode:this.mode,...t},{headers:{Authorization:null}});return this.updateStorage(r.data),{access_token:r.data.access_token,...(null===(e=r.data)||void 0===e?void 0:e.refresh_token)&&{refresh_token:r.data.refresh_token},expires:r.data.expires}}async static(t){return this.staticToken||(this.staticToken=t),await this._transport.get("/users/me",{params:{access_token:t},headers:{Authorization:null}}),this.updateStorage({access_token:t,expires:null,refresh_token:null}),!0}async logout(){let t;"json"===this.mode&&(t=this._storage.auth_refresh_token||void 0),await this._transport.post("/auth/logout",{refresh_token:t}),this.updateStorage({access_token:null,expires:null,refresh_token:null})}}class Fe{constructor(t){this.transport=t}async request(t,e,r){return await this.transport.post(t,{query:e,variables:void 0===r?{}:r})}async items(t,e){return await this.request("/graphql",t,e)}async system(t,e){return await this.request("/graphql/system",t,e)}}class Me{constructor(e,r){var s,n,i,o,a,u,c,h,l;if(this._url=e,this._options=r,this._items={},this._singletons={},(null===(s=this._options)||void 0===s?void 0:s.storage)&&(null===(n=this._options)||void 0===n?void 0:n.storage)instanceof R)this._storage=this._options.storage;else{const t=null===(i=this._options)||void 0===i?void 0:i.storage,{mode:e,...r}=null!=t?t:{};"MemoryStorage"===e||"undefined"==typeof window?this._storage=new T(r):this._storage=new S(r)}(null===(o=this._options)||void 0===o?void 0:o.transport)&&(null===(a=this._options)||void 0===a?void 0:a.transport)instanceof b?this._transport=this._options.transport:this._transport=new De({url:this.url,beforeRequest:async t=>{await this._auth.refreshIfExpired();const e=this.storage.auth_token,r=e?e.startsWith("Bearer ")?String(this.storage.auth_token):`Bearer ${this.storage.auth_token}`:"";return{...t,headers:{Authorization:r,...t.headers}}},...null===(u=this._options)||void 0===u?void 0:u.transport}),(null===(c=this._options)||void 0===c?void 0:c.auth)&&(null===(h=this._options)||void 0===h?void 0:h.auth)instanceof t?this._auth=this._options.auth:this._auth=new Ie({transport:this._transport,storage:this._storage,...null===(l=this._options)||void 0===l?void 0:l.auth})}get url(){return this._url}get auth(){return this._auth}get storage(){return this._storage}get transport(){return this._transport}get activity(){return this._activity||(this._activity=new o(this.transport))}get collections(){return this._collections||(this._collections=new a(this.transport))}get fields(){return this._fields||(this._fields=new u(this.transport))}get files(){return this._files||(this._files=new c(this.transport))}get folders(){return this._folders||(this._folders=new h(this.transport))}get permissions(){return this._permissions||(this._permissions=new l(this.transport))}get presets(){return this._presets||(this._presets=new p(this.transport))}get relations(){return this._relations||(this._relations=new d(this.transport))}get revisions(){return this._revisions||(this._revisions=new f(this.transport))}get roles(){return this._roles||(this._roles=new m(this.transport))}get users(){return this._users||(this._users=new O(this.transport))}get settings(){return this._settings||(this._settings=new w(this.transport))}get server(){return this._server||(this._server=new v(this.transport))}get utils(){return this._utils||(this._utils=new x(this.transport))}get graphql(){return this._graphql||(this._graphql=new Fe(this.transport))}singleton(t){return this._singletons[t]||(this._singletons[t]=new g(t,this.transport))}items(t){return this._items[t]||(this._items[t]=new n(t,this.transport))}}export{o as ActivityHandler,Ie as Auth,A as BaseStorage,a as CollectionsHandler,i as CommentsHandler,Me as Directus,s as EmptyParamError,u as FieldsHandler,c as FilesHandler,h as FoldersHandler,t as IAuth,R as IStorage,b as ITransport,n as ItemsHandler,S as LocalStorage,T as MemoryStorage,e as Meta,l as PermissionsHandler,p as PresetsHandler,d as RelationsHandler,f as RevisionsHandler,m as RolesHandler,v as ServerHandler,w as SettingsHandler,De as Transport,k as TransportError,O as UsersHandler,x as UtilsHandler};
//# sourceMappingURL=sdk.esm.min.js.map

@@ -1,2 +0,2 @@

var DirectusSdk=function(t,e){"use strict";function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=n(e),o=function(){this.mode="undefined"==typeof window?"json":"cookie"},i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},i(t,e)};function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var u,a=function(){return a=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},a.apply(this,arguments)};function c(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{a(r.next(t))}catch(t){i(t)}}function u(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}a((r=r.apply(t,e||[])).next())}))}function h(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}t.Meta=void 0,(u=t.Meta||(t.Meta={})).TOTAL_COUNT="total_count",u.FILTER_COUNT="filter_count";var l,p=function(t){function e(e){return t.call(this,"".concat(null!=e?e:"ID"," cannot be an empty string"))||this}return s(e,t),e}(Error),f=function(){function t(t,e){this.collection=t,this.transport=e,this.endpoint=t.startsWith("directus_")?"/".concat(t.substring(9)):"/items/".concat(t)}return t.prototype.readOne=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:if(""==="".concat(t))throw new p("id");return[4,this.transport.get("".concat(this.endpoint,"/").concat(encodeURI(t)),a({params:e},null==n?void 0:n.requestOptions))];case 1:return[2,r.sent().data]}}))}))},t.prototype.readMany=function(t,e,n){var r;return c(this,void 0,void 0,(function(){var o,i,s,u,c,l;return h(this,(function(h){switch(h.label){case 0:return[4,this.transport.get("/fields/".concat(this.collection))];case 1:return o=h.sent(),i=null===(r=o.data)||void 0===r?void 0:r.find((function(t){return!0===t.schema.is_primary_key})),[4,this.transport.get("".concat(this.endpoint),a({params:a({filter:a((l={},l[i.field]={_in:t},l),null==e?void 0:e.filter),sort:(null==e?void 0:e.sort)||i.field},e)},null==n?void 0:n.requestOptions))];case 2:return s=h.sent(),u=s.data,c=s.meta,[2,a({data:u},c&&{meta:c})]}}))}))},t.prototype.readByQuery=function(t,e){return c(this,void 0,void 0,(function(){var n,r,o;return h(this,(function(i){switch(i.label){case 0:return[4,this.transport.get("".concat(this.endpoint),a({params:t},null==e?void 0:e.requestOptions))];case 1:return n=i.sent(),r=n.data,o=n.meta,[2,a({data:r},o&&{meta:o})]}}))}))},t.prototype.createOne=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.transport.post("".concat(this.endpoint),t,a({params:e},null==n?void 0:n.requestOptions))];case 1:return[2,r.sent().data]}}))}))},t.prototype.createMany=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.transport.post("".concat(this.endpoint),t,a({params:e},null==n?void 0:n.requestOptions))];case 1:return[2,r.sent()]}}))}))},t.prototype.updateOne=function(t,e,n,r){return c(this,void 0,void 0,(function(){return h(this,(function(o){switch(o.label){case 0:if(""==="".concat(t))throw new p("id");return[4,this.transport.patch("".concat(this.endpoint,"/").concat(encodeURI(t)),e,a({params:n},null==r?void 0:r.requestOptions))];case 1:return[2,o.sent().data]}}))}))},t.prototype.updateMany=function(t,e,n,r){return c(this,void 0,void 0,(function(){return h(this,(function(o){switch(o.label){case 0:return[4,this.transport.patch("".concat(this.endpoint),{keys:t,data:e},a({params:n},null==r?void 0:r.requestOptions))];case 1:return[2,o.sent()]}}))}))},t.prototype.updateByQuery=function(t,e,n,r){return c(this,void 0,void 0,(function(){return h(this,(function(o){switch(o.label){case 0:return[4,this.transport.patch("".concat(this.endpoint),{query:t,data:e},a({params:n},null==r?void 0:r.requestOptions))];case 1:return[2,o.sent()]}}))}))},t.prototype.deleteOne=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:if(""==="".concat(t))throw new p("id");return[4,this.transport.delete("".concat(this.endpoint,"/").concat(encodeURI(t)),void 0,null==e?void 0:e.requestOptions)];case 1:return n.sent(),[2]}}))}))},t.prototype.deleteMany=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.transport.delete("".concat(this.endpoint),t,null==e?void 0:e.requestOptions)];case 1:return n.sent(),[2]}}))}))},t}(),d=function(){function t(t){this.transport=t}return t.prototype.create=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.post("/activity/comment",t)];case 1:return[2,e.sent().data]}}))}))},t.prototype.update=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:if(""==="".concat(t))throw new p("comment_activity_id");return[4,this.transport.patch("/activity/comment/".concat(encodeURI(t)),{comment:e})];case 1:return[2,n.sent().data]}}))}))},t.prototype.delete=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:if(""==="".concat(t))throw new p("comment_activity_id");return[4,this.transport.delete("/activity/comment/".concat(encodeURI(t)))];case 1:return e.sent(),[2]}}))}))},t}(),v=function(t){function e(e){var n=t.call(this,"directus_activity",e)||this;return n._comments=new d(n.transport),n}return s(e,t),Object.defineProperty(e.prototype,"comments",{get:function(){return this._comments},enumerable:!1,configurable:!0}),e}(f),y=function(){function t(t){this.transport=t}return t.prototype.readOne=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:if(""==="".concat(t))throw new p("collection");return[4,this.transport.get("/collections/".concat(t))];case 1:return[2,e.sent().data]}}))}))},t.prototype.readAll=function(){return c(this,void 0,void 0,(function(){var t,e,n;return h(this,(function(r){switch(r.label){case 0:return[4,this.transport.get("/collections")];case 1:return t=r.sent(),e=t.data,n=t.meta,[2,{data:e,meta:n}]}}))}))},t.prototype.createOne=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.post("/collections",t)];case 1:return[2,e.sent().data]}}))}))},t.prototype.createMany=function(t){return c(this,void 0,void 0,(function(){var e,n,r;return h(this,(function(o){switch(o.label){case 0:return[4,this.transport.post("/collections",t)];case 1:return e=o.sent(),n=e.data,r=e.meta,[2,{data:n,meta:r}]}}))}))},t.prototype.updateOne=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:if(""==="".concat(t))throw new p("collection");return[4,this.transport.patch("/collections/".concat(t),e,{params:n})];case 1:return[2,r.sent().data]}}))}))},t.prototype.deleteOne=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:if(""==="".concat(t))throw new p("collection");return[4,this.transport.delete("/collections/".concat(t))];case 1:return e.sent(),[2]}}))}))},t}(),b=function(){function t(t){this.transport=t}return t.prototype.readOne=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:if(""==="".concat(t))throw new p("collection");if(""==="".concat(e))throw new p("id");return[4,this.transport.get("/fields/".concat(t,"/").concat(e))];case 1:return[2,n.sent().data]}}))}))},t.prototype.readMany=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:if(""==="".concat(t))throw new p("collection");return[4,this.transport.get("/fields/".concat(t))];case 1:return[2,e.sent().data]}}))}))},t.prototype.readAll=function(){return c(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.transport.get("/fields")];case 1:return[2,t.sent().data]}}))}))},t.prototype.createOne=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:if(""==="".concat(t))throw new p("collection");return[4,this.transport.post("/fields/".concat(t),e)];case 1:return[2,n.sent().data]}}))}))},t.prototype.updateOne=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:if(""==="".concat(t))throw new p("collection");if(""==="".concat(e))throw new p("field");return[4,this.transport.patch("/fields/".concat(t,"/").concat(e),n)];case 1:return[2,r.sent().data]}}))}))},t.prototype.deleteOne=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:if(""==="".concat(t))throw new p("collection");if(""==="".concat(e))throw new p("field");return[4,this.transport.delete("/fields/".concat(t,"/").concat(e))];case 1:return n.sent(),[2]}}))}))},t}(),g=function(t){function e(e){return t.call(this,"directus_files",e)||this}return s(e,t),e.prototype.import=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.post("/files/import",t)];case 1:return[2,e.sent().data]}}))}))},e}(f),_=function(t){function e(e){return t.call(this,"directus_folders",e)||this}return s(e,t),e}(f),w=function(t){function e(e){return t.call(this,"directus_permissions",e)||this}return s(e,t),e}(f),m=function(t){function e(e){return t.call(this,"directus_presets",e)||this}return s(e,t),e}(f),O=function(){function t(t){this.transport=t}return t.prototype.readOne=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:if(""==="".concat(t))throw new p("collection");if(""==="".concat(e))throw new p("id");return[4,this.transport.get("/relations/".concat(t,"/").concat(e))];case 1:return[2,n.sent().data]}}))}))},t.prototype.readMany=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:if(""==="".concat(t))throw new p("collection");return[4,this.transport.get("/relations/".concat(t))];case 1:return[2,e.sent().data]}}))}))},t.prototype.readAll=function(){return c(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.transport.get("/relations")];case 1:return[2,t.sent().data]}}))}))},t.prototype.createOne=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.post("/relations",t)];case 1:return[2,e.sent().data]}}))}))},t.prototype.updateOne=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:if(""==="".concat(t))throw new p("collection");if(""==="".concat(e))throw new p("field");return[4,this.transport.patch("/relations/".concat(t,"/").concat(e),n)];case 1:return[2,r.sent().data]}}))}))},t.prototype.deleteOne=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:if(""==="".concat(t))throw new p("collection");if(""==="".concat(e))throw new p("field");return[4,this.transport.delete("/relations/".concat(t,"/").concat(e))];case 1:return n.sent(),[2]}}))}))},t}(),k=function(t){function e(e){return t.call(this,"directus_revisions",e)||this}return s(e,t),e}(f),P=function(t){function e(e){return t.call(this,"directus_roles",e)||this}return s(e,t),e}(f),x=function(){function t(t){this.transport=t}return t.prototype.ping=function(){return c(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.transport.get("/server/ping")];case 1:return[2,t.sent().raw]}}))}))},t.prototype.info=function(){return c(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.transport.get("/server/info")];case 1:return[2,t.sent().data]}}))}))},t.prototype.oas=function(){return c(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.transport.get("/server/specs/oas")];case 1:return[2,t.sent().raw]}}))}))},t}(),j=function(){function t(t,e){this.collection=t,this.transport=e,this.endpoint=t.startsWith("directus_")?"/".concat(t.substring(9)):"/items/".concat(t)}return t.prototype.read=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.get("".concat(this.endpoint),{params:t})];case 1:return[2,e.sent().data]}}))}))},t.prototype.update=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.transport.patch("".concat(this.endpoint),t,{params:e})];case 1:return[2,n.sent().data]}}))}))},t}(),q=function(t){function e(e){return t.call(this,"directus_settings",e)||this}return s(e,t),e}(j),R=function(){function t(t){this.transport=t}return t.prototype.send=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.transport.post("/users/invite",{email:t,role:e,invite_url:n})];case 1:return r.sent(),[2]}}))}))},t.prototype.accept=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.transport.post("/users/invite/accept",{token:t,password:e})];case 1:return n.sent(),[2]}}))}))},t}(),T=function(){function t(t){this.transport=t}return t.prototype.generate=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.post("/users/me/tfa/generate",{password:t})];case 1:return[2,e.sent().data]}}))}))},t.prototype.enable=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.transport.post("/users/me/tfa/enable",{secret:t,otp:e})];case 1:return n.sent(),[2]}}))}))},t.prototype.disable=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.post("/users/me/tfa/disable",{otp:t})];case 1:return e.sent(),[2]}}))}))},t}(),S=function(){function t(t){this._transport=t}return Object.defineProperty(t.prototype,"tfa",{get:function(){return this._tfa||(this._tfa=new T(this._transport))},enumerable:!1,configurable:!0}),t.prototype.read=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this._transport.get("/users/me",{params:t})];case 1:return[2,e.sent().data]}}))}))},t.prototype.update=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this._transport.patch("/users/me",t,{params:e})];case 1:return[2,n.sent().data]}}))}))},t}(),E=function(t){function e(e){return t.call(this,"directus_users",e)||this}return s(e,t),Object.defineProperty(e.prototype,"invites",{get:function(){return this._invites||(this._invites=new R(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"me",{get:function(){return this._me||(this._me=new S(this.transport))},enumerable:!1,configurable:!0}),e}(f),I=function(){function t(t){var e=this;this.random={string:function(t){return void 0===t&&(t=32),c(e,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.get("/utils/random/string",{params:{length:t}})];case 1:return[2,e.sent().data]}}))}))}},this.hash={generate:function(t){return c(e,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.post("/utils/hash/generate",{string:t})];case 1:return[2,e.sent().data]}}))}))},verify:function(t,n){return c(e,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.post("/utils/hash/verify",{string:t,hash:n})];case 1:return[2,e.sent().data]}}))}))}},this.transport=t}return t.prototype.sort=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.transport.post("/utils/sort/".concat(encodeURI(t)),{item:e,to:n})];case 1:return r.sent(),[2]}}))}))},t.prototype.revert=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.post("/utils/revert/".concat(encodeURI(t)))];case 1:return e.sent(),[2]}}))}))},t}(),A=function(){},U=function(){},H=function(t){function e(n,r){var o,i,s=this;return(s=(null===(o=null==r?void 0:r.errors)||void 0===o?void 0:o.length)?t.call(this,null===(i=null==r?void 0:r.errors[0])||void 0===i?void 0:i.message)||this:t.call(this,(null==n?void 0:n.message)||"Unknown transport error")||this).parent=n,s.response=r,s.errors=(null==r?void 0:r.errors)||[],Object.values(r||{}).some((function(t){return void 0!==t}))||(s.response=void 0),Object.setPrototypeOf(s,e.prototype),s}return s(e,t),e}(Error);!function(t){t.AuthToken="auth_token",t.RefreshToken="auth_refresh_token",t.Expires="auth_expires",t.ExpiresAt="auth_expires_at"}(l||(l={}));var M=function(t){function e(e){var n,r=this;return(r=t.call(this)||this).prefix=null!==(n=null==e?void 0:e.prefix)&&void 0!==n?n:"",r}return s(e,t),Object.defineProperty(e.prototype,"auth_token",{get:function(){return this.get(l.AuthToken)},set:function(t){null===t?this.delete(l.AuthToken):this.set(l.AuthToken,t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"auth_expires",{get:function(){var t=this.get(l.Expires);return null===t?null:parseInt(t)},set:function(t){null===t?this.delete(l.Expires):this.set(l.Expires,t.toString())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"auth_expires_at",{get:function(){var t=this.get(l.ExpiresAt);return null===t?null:parseInt(t)},set:function(t){null===t?this.delete(l.ExpiresAt):this.set(l.ExpiresAt,t.toString())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"auth_refresh_token",{get:function(){return this.get(l.RefreshToken)},set:function(t){null===t?this.delete(l.RefreshToken):this.set(l.RefreshToken,t)},enumerable:!1,configurable:!0}),e}(A),B=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.values={},e}return s(e,t),e.prototype.get=function(t){var e=this.key(t);return e in this.values?this.values[e]:null},e.prototype.set=function(t,e){return this.values[this.key(t)]=e,e},e.prototype.delete=function(t){var e=this.key(t),n=this.get(t);return e in this.values&&delete this.values[e],n},e.prototype.key=function(t){return"".concat(this.prefix).concat(t)},e}(M),C=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.get=function(t){var e=localStorage.getItem(this.key(t));return null!==e?e:null},e.prototype.set=function(t,e){return localStorage.setItem(this.key(t),e),e},e.prototype.delete=function(t){var e=this.key(t),n=this.get(e);return n&&localStorage.removeItem(e),n},e.prototype.key=function(t){return"".concat(this.prefix).concat(t)},e}(M),D=function(t){function e(e){var n,o=this;return(o=t.call(this)||this).config=e,o.axios=r.default.create({baseURL:o.config.url,params:o.config.params,headers:o.config.headers,onUploadProgress:o.config.onUploadProgress,withCredentials:!0}),(null===(n=o.config)||void 0===n?void 0:n.beforeRequest)&&(o.beforeRequest=o.config.beforeRequest),o}return s(e,t),e.prototype.beforeRequest=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){return[2,t]}))}))},Object.defineProperty(e.prototype,"url",{get:function(){return this.config.url},enumerable:!1,configurable:!0}),e.prototype.request=function(t,e,n,o){var i,s,u,a,l;return c(this,void 0,void 0,(function(){var c,p,f,d,v;return h(this,(function(h){switch(h.label){case 0:return h.trys.push([0,3,,4]),c={method:t,url:e,data:n,params:null==o?void 0:o.params,headers:null==o?void 0:o.headers,onUploadProgress:null==o?void 0:o.onUploadProgress},[4,this.beforeRequest(c)];case 1:return c=h.sent(),[4,this.axios.request(c)];case 2:if(p=h.sent(),f={raw:p.data,status:p.status,statusText:p.statusText,headers:p.headers,data:p.data.data,meta:p.data.meta,errors:p.data.errors},p.data.errors)throw new H(null,f);return[2,f];case 3:if(!(d=h.sent())||d instanceof Error==!1)throw d;if(r.default.isAxiosError(d))throw v=null===(i=d.response)||void 0===i?void 0:i.data,new H(d,{raw:null===(s=d.response)||void 0===s?void 0:s.data,status:null===(u=d.response)||void 0===u?void 0:u.status,statusText:null===(a=d.response)||void 0===a?void 0:a.statusText,headers:null===(l=d.response)||void 0===l?void 0:l.headers,data:null==v?void 0:v.data,meta:null==v?void 0:v.meta,errors:null==v?void 0:v.errors});throw new H(d);case 4:return[2]}}))}))},e.prototype.get=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.request("get",t,void 0,e)];case 1:return[2,n.sent()]}}))}))},e.prototype.head=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.request("head",t,void 0,e)];case 1:return[2,n.sent()]}}))}))},e.prototype.options=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.request("options",t,void 0,e)];case 1:return[2,n.sent()]}}))}))},e.prototype.delete=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.request("delete",t,e,n)];case 1:return[2,r.sent()]}}))}))},e.prototype.put=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.request("put",t,e,n)];case 1:return[2,r.sent()]}}))}))},e.prototype.post=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.request("post",t,e,n)];case 1:return[2,r.sent()]}}))}))},e.prototype.patch=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.request("patch",t,e,n)];case 1:return[2,r.sent()]}}))}))},e}(U),F=function(){function t(t){this.transport=t}return t.prototype.request=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.transport.post("/auth/password/request",{email:t,reset_url:e})];case 1:return n.sent(),[2]}}))}))},t.prototype.reset=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.transport.post("/auth/password/reset",{token:t,password:e})];case 1:return n.sent(),[2]}}))}))},t}(),L=function(t){function e(e){var n,r,o,i=this;return(i=t.call(this)||this).autoRefresh=!0,i.msRefreshBeforeExpires=3e4,i.staticToken="",i._transport=e.transport,i._storage=e.storage,i.autoRefresh=null!==(n=null==e?void 0:e.autoRefresh)&&void 0!==n?n:i.autoRefresh,i.mode=null!==(r=null==e?void 0:e.mode)&&void 0!==r?r:i.mode,i.msRefreshBeforeExpires=null!==(o=null==e?void 0:e.msRefreshBeforeExpires)&&void 0!==o?o:i.msRefreshBeforeExpires,(null==e?void 0:e.staticToken)&&(i.staticToken=null==e?void 0:e.staticToken,i.updateStorage({access_token:i.staticToken,expires:null,refresh_token:null})),i}return s(e,t),Object.defineProperty(e.prototype,"storage",{get:function(){return this._storage},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transport",{get:function(){return this._transport},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"token",{get:function(){return c(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:if(!this._refreshPromise)return[3,4];t.label=1;case 1:return t.trys.push([1,,3,4]),[4,this._refreshPromise];case 2:return t.sent(),[3,4];case 3:return this._refreshPromise=void 0,[7];case 4:return[2,this._storage.auth_token]}}))}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"password",{get:function(){return this.passwords=this.passwords||new F(this._transport)},enumerable:!1,configurable:!0}),e.prototype.resetStorage=function(){this._storage.auth_token=null,this._storage.auth_refresh_token=null,this._storage.auth_expires=null,this._storage.auth_expires_at=null},e.prototype.updateStorage=function(t){var e,n,r=null!==(e=t.expires)&&void 0!==e?e:null;this._storage.auth_token=t.access_token,this._storage.auth_refresh_token=null!==(n=t.refresh_token)&&void 0!==n?n:null,this._storage.auth_expires=r,this._storage.auth_expires_at=(new Date).getTime()+(null!=r?r:0)},e.prototype.refreshIfExpired=function(){return c(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:if(this.staticToken)return[2];if(!this.autoRefresh)return[2];if(this._storage.auth_expires_at)return[3,5];t.label=1;case 1:return t.trys.push([1,,3,4]),[4,this._refreshPromise];case 2:return t.sent(),[3,4];case 3:return this._refreshPromise=void 0,[7];case 4:return[2];case 5:this._storage.auth_expires_at<(new Date).getTime()+this.msRefreshBeforeExpires&&this.refresh(),t.label=6;case 6:return t.trys.push([6,,8,9]),[4,this._refreshPromise];case 7:return t.sent(),[3,9];case 8:return this._refreshPromise=void 0,[7];case 9:return[2]}}))}))},e.prototype.refresh=function(){var t=this;return this._refreshPromise=c(t,void 0,void 0,(function(){var t,e,n;return h(this,(function(r){switch(r.label){case 0:return t=this._storage.auth_refresh_token,this.resetStorage(),[4,this._transport.post("/auth/refresh",{refresh_token:"json"===this.mode?t:void 0})];case 1:return e=r.sent(),this.updateStorage(e.data),[2,a(a({access_token:e.data.access_token},(null===(n=e.data)||void 0===n?void 0:n.refresh_token)&&{refresh_token:e.data.refresh_token}),{expires:e.data.expires})]}}))}))},e.prototype.login=function(t){var e;return c(this,void 0,void 0,(function(){var n;return h(this,(function(r){switch(r.label){case 0:return this.resetStorage(),[4,this._transport.post("/auth/login",a({mode:this.mode},t),{headers:{Authorization:null}})];case 1:return n=r.sent(),this.updateStorage(n.data),[2,a(a({access_token:n.data.access_token},(null===(e=n.data)||void 0===e?void 0:e.refresh_token)&&{refresh_token:n.data.refresh_token}),{expires:n.data.expires})]}}))}))},e.prototype.static=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.staticToken||(this.staticToken=t),[4,this._transport.get("/users/me",{params:{access_token:t},headers:{Authorization:null}})];case 1:return e.sent(),this.updateStorage({access_token:t,expires:null,refresh_token:null}),[2,!0]}}))}))},e.prototype.logout=function(){return c(this,void 0,void 0,(function(){var t;return h(this,(function(e){switch(e.label){case 0:return"json"===this.mode&&(t=this._storage.auth_refresh_token||void 0),[4,this._transport.post("/auth/logout",{refresh_token:t})];case 1:return e.sent(),this.updateStorage({access_token:null,expires:null,refresh_token:null}),[2]}}))}))},e}(o),z=function(){function t(t){this.transport=t}return t.prototype.request=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.transport.post(t,{query:e,variables:void 0===n?{}:n})];case 1:return[2,r.sent()]}}))}))},t.prototype.items=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.request("/graphql",t,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.system=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.request("/graphql/system",t,e)];case 1:return[2,n.sent()]}}))}))},t}(),W=function(){function t(t,e){var n,r,i,s,u,l,p,f,d,v=this;if(this._url=t,this._options=e,this._items={},this._singletons={},(null===(n=this._options)||void 0===n?void 0:n.storage)&&(null===(r=this._options)||void 0===r?void 0:r.storage)instanceof A)this._storage=this._options.storage;else{var y=null===(i=this._options)||void 0===i?void 0:i.storage,b=null!=y?y:{},g=b.mode,_=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}(b,["mode"]);"MemoryStorage"===g||"undefined"==typeof window?this._storage=new B(_):this._storage=new C(_)}(null===(s=this._options)||void 0===s?void 0:s.transport)&&(null===(u=this._options)||void 0===u?void 0:u.transport)instanceof U?this._transport=this._options.transport:this._transport=new D(a({url:this.url,beforeRequest:function(t){return c(v,void 0,void 0,(function(){var e,n;return h(this,(function(r){switch(r.label){case 0:return[4,this._auth.refreshIfExpired()];case 1:return r.sent(),e=this.storage.auth_token,n=e?e.startsWith("Bearer ")?String(this.storage.auth_token):"Bearer ".concat(this.storage.auth_token):"",[2,a(a({},t),{headers:a({Authorization:n},t.headers)})]}}))}))}},null===(l=this._options)||void 0===l?void 0:l.transport)),(null===(p=this._options)||void 0===p?void 0:p.auth)&&(null===(f=this._options)||void 0===f?void 0:f.auth)instanceof o?this._auth=this._options.auth:this._auth=new L(a({transport:this._transport,storage:this._storage},null===(d=this._options)||void 0===d?void 0:d.auth))}return Object.defineProperty(t.prototype,"url",{get:function(){return this._url},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"auth",{get:function(){return this._auth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"storage",{get:function(){return this._storage},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transport",{get:function(){return this._transport},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"activity",{get:function(){return this._activity||(this._activity=new v(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"collections",{get:function(){return this._collections||(this._collections=new y(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fields",{get:function(){return this._fields||(this._fields=new b(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"files",{get:function(){return this._files||(this._files=new g(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"folders",{get:function(){return this._folders||(this._folders=new _(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"permissions",{get:function(){return this._permissions||(this._permissions=new w(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"presets",{get:function(){return this._presets||(this._presets=new m(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"relations",{get:function(){return this._relations||(this._relations=new O(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"revisions",{get:function(){return this._revisions||(this._revisions=new k(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roles",{get:function(){return this._roles||(this._roles=new P(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"users",{get:function(){return this._users||(this._users=new E(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"settings",{get:function(){return this._settings||(this._settings=new q(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"server",{get:function(){return this._server||(this._server=new x(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"utils",{get:function(){return this._utils||(this._utils=new I(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"graphql",{get:function(){return this._graphql||(this._graphql=new z(this.transport))},enumerable:!1,configurable:!0}),t.prototype.singleton=function(t){return this._singletons[t]||(this._singletons[t]=new j(t,this.transport))},t.prototype.items=function(t){return this._items[t]||(this._items[t]=new f(t,this.transport))},t}();return t.ActivityHandler=v,t.Auth=L,t.BaseStorage=M,t.CollectionsHandler=y,t.CommentsHandler=d,t.Directus=W,t.EmptyParamError=p,t.FieldsHandler=b,t.FilesHandler=g,t.FoldersHandler=_,t.IAuth=o,t.IStorage=A,t.ITransport=U,t.ItemsHandler=f,t.LocalStorage=C,t.MemoryStorage=B,t.PermissionsHandler=w,t.PresetsHandler=m,t.RelationsHandler=O,t.RevisionsHandler=k,t.RolesHandler=P,t.ServerHandler=x,t.SettingsHandler=q,t.Transport=D,t.TransportError=H,t.UsersHandler=E,t.UtilsHandler=I,Object.defineProperty(t,"__esModule",{value:!0}),t}({},axios);
var DirectusSdk=function(t,e){"use strict";function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=n(e),o=function(){this.mode="undefined"==typeof window?"json":"cookie"},i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},i(t,e)};function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var u,a=function(){return a=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},a.apply(this,arguments)};function c(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{a(r.next(t))}catch(t){i(t)}}function u(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}a((r=r.apply(t,e||[])).next())}))}function h(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}t.Meta=void 0,(u=t.Meta||(t.Meta={})).TOTAL_COUNT="total_count",u.FILTER_COUNT="filter_count";var l,p=function(t){function e(e){return t.call(this,"".concat(null!=e?e:"ID"," cannot be an empty string"))||this}return s(e,t),e}(Error),f=function(){function t(t,e){this.collection=t,this.transport=e,this.endpoint=t.startsWith("directus_")?"/".concat(t.substring(9)):"/items/".concat(t)}return t.prototype.readOne=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:if(""==="".concat(t))throw new p("id");return[4,this.transport.get("".concat(this.endpoint,"/").concat(encodeURI(t)),a({params:e},null==n?void 0:n.requestOptions))];case 1:return[2,r.sent().data]}}))}))},t.prototype.readMany=function(t,e,n){var r;return c(this,void 0,void 0,(function(){var o,i,s,u,c,l;return h(this,(function(h){switch(h.label){case 0:return[4,this.transport.get("/fields/".concat(this.collection))];case 1:return o=h.sent(),i=null===(r=o.data)||void 0===r?void 0:r.find((function(t){return!0===t.schema.is_primary_key})),[4,this.transport.get("".concat(this.endpoint),a({params:a(a({},e),{filter:a((l={},l[i.field]={_in:t},l),null==e?void 0:e.filter),sort:(null==e?void 0:e.sort)||i.field})},null==n?void 0:n.requestOptions))];case 2:return s=h.sent(),u=s.data,c=s.meta,[2,a({data:u},c&&{meta:c})]}}))}))},t.prototype.readByQuery=function(t,e){return c(this,void 0,void 0,(function(){var n,r,o;return h(this,(function(i){switch(i.label){case 0:return[4,this.transport.get("".concat(this.endpoint),a({params:t},null==e?void 0:e.requestOptions))];case 1:return n=i.sent(),r=n.data,o=n.meta,[2,a({data:r},o&&{meta:o})]}}))}))},t.prototype.createOne=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.transport.post("".concat(this.endpoint),t,a({params:e},null==n?void 0:n.requestOptions))];case 1:return[2,r.sent().data]}}))}))},t.prototype.createMany=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.transport.post("".concat(this.endpoint),t,a({params:e},null==n?void 0:n.requestOptions))];case 1:return[2,r.sent()]}}))}))},t.prototype.updateOne=function(t,e,n,r){return c(this,void 0,void 0,(function(){return h(this,(function(o){switch(o.label){case 0:if(""==="".concat(t))throw new p("id");return[4,this.transport.patch("".concat(this.endpoint,"/").concat(encodeURI(t)),e,a({params:n},null==r?void 0:r.requestOptions))];case 1:return[2,o.sent().data]}}))}))},t.prototype.updateMany=function(t,e,n,r){return c(this,void 0,void 0,(function(){return h(this,(function(o){switch(o.label){case 0:return[4,this.transport.patch("".concat(this.endpoint),{keys:t,data:e},a({params:n},null==r?void 0:r.requestOptions))];case 1:return[2,o.sent()]}}))}))},t.prototype.updateByQuery=function(t,e,n,r){return c(this,void 0,void 0,(function(){return h(this,(function(o){switch(o.label){case 0:return[4,this.transport.patch("".concat(this.endpoint),{query:t,data:e},a({params:n},null==r?void 0:r.requestOptions))];case 1:return[2,o.sent()]}}))}))},t.prototype.deleteOne=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:if(""==="".concat(t))throw new p("id");return[4,this.transport.delete("".concat(this.endpoint,"/").concat(encodeURI(t)),void 0,null==e?void 0:e.requestOptions)];case 1:return n.sent(),[2]}}))}))},t.prototype.deleteMany=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.transport.delete("".concat(this.endpoint),t,null==e?void 0:e.requestOptions)];case 1:return n.sent(),[2]}}))}))},t}(),d=function(){function t(t){this.transport=t}return t.prototype.create=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.post("/activity/comment",t)];case 1:return[2,e.sent().data]}}))}))},t.prototype.update=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:if(""==="".concat(t))throw new p("comment_activity_id");return[4,this.transport.patch("/activity/comment/".concat(encodeURI(t)),{comment:e})];case 1:return[2,n.sent().data]}}))}))},t.prototype.delete=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:if(""==="".concat(t))throw new p("comment_activity_id");return[4,this.transport.delete("/activity/comment/".concat(encodeURI(t)))];case 1:return e.sent(),[2]}}))}))},t}(),v=function(t){function e(e){var n=t.call(this,"directus_activity",e)||this;return n._comments=new d(n.transport),n}return s(e,t),Object.defineProperty(e.prototype,"comments",{get:function(){return this._comments},enumerable:!1,configurable:!0}),e}(f),y=function(){function t(t){this.transport=t}return t.prototype.readOne=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:if(""==="".concat(t))throw new p("collection");return[4,this.transport.get("/collections/".concat(t))];case 1:return[2,e.sent().data]}}))}))},t.prototype.readAll=function(){return c(this,void 0,void 0,(function(){var t,e,n;return h(this,(function(r){switch(r.label){case 0:return[4,this.transport.get("/collections")];case 1:return t=r.sent(),e=t.data,n=t.meta,[2,{data:e,meta:n}]}}))}))},t.prototype.createOne=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.post("/collections",t)];case 1:return[2,e.sent().data]}}))}))},t.prototype.createMany=function(t){return c(this,void 0,void 0,(function(){var e,n,r;return h(this,(function(o){switch(o.label){case 0:return[4,this.transport.post("/collections",t)];case 1:return e=o.sent(),n=e.data,r=e.meta,[2,{data:n,meta:r}]}}))}))},t.prototype.updateOne=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:if(""==="".concat(t))throw new p("collection");return[4,this.transport.patch("/collections/".concat(t),e,{params:n})];case 1:return[2,r.sent().data]}}))}))},t.prototype.deleteOne=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:if(""==="".concat(t))throw new p("collection");return[4,this.transport.delete("/collections/".concat(t))];case 1:return e.sent(),[2]}}))}))},t}(),b=function(){function t(t){this.transport=t}return t.prototype.readOne=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:if(""==="".concat(t))throw new p("collection");if(""==="".concat(e))throw new p("id");return[4,this.transport.get("/fields/".concat(t,"/").concat(e))];case 1:return[2,n.sent().data]}}))}))},t.prototype.readMany=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:if(""==="".concat(t))throw new p("collection");return[4,this.transport.get("/fields/".concat(t))];case 1:return[2,e.sent().data]}}))}))},t.prototype.readAll=function(){return c(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.transport.get("/fields")];case 1:return[2,t.sent().data]}}))}))},t.prototype.createOne=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:if(""==="".concat(t))throw new p("collection");return[4,this.transport.post("/fields/".concat(t),e)];case 1:return[2,n.sent().data]}}))}))},t.prototype.updateOne=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:if(""==="".concat(t))throw new p("collection");if(""==="".concat(e))throw new p("field");return[4,this.transport.patch("/fields/".concat(t,"/").concat(e),n)];case 1:return[2,r.sent().data]}}))}))},t.prototype.deleteOne=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:if(""==="".concat(t))throw new p("collection");if(""==="".concat(e))throw new p("field");return[4,this.transport.delete("/fields/".concat(t,"/").concat(e))];case 1:return n.sent(),[2]}}))}))},t}(),g=function(t){function e(e){return t.call(this,"directus_files",e)||this}return s(e,t),e.prototype.import=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.post("/files/import",t)];case 1:return[2,e.sent().data]}}))}))},e}(f),_=function(t){function e(e){return t.call(this,"directus_folders",e)||this}return s(e,t),e}(f),w=function(t){function e(e){return t.call(this,"directus_permissions",e)||this}return s(e,t),e}(f),m=function(t){function e(e){return t.call(this,"directus_presets",e)||this}return s(e,t),e}(f),O=function(){function t(t){this.transport=t}return t.prototype.readOne=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:if(""==="".concat(t))throw new p("collection");if(""==="".concat(e))throw new p("id");return[4,this.transport.get("/relations/".concat(t,"/").concat(e))];case 1:return[2,n.sent().data]}}))}))},t.prototype.readMany=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:if(""==="".concat(t))throw new p("collection");return[4,this.transport.get("/relations/".concat(t))];case 1:return[2,e.sent().data]}}))}))},t.prototype.readAll=function(){return c(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.transport.get("/relations")];case 1:return[2,t.sent().data]}}))}))},t.prototype.createOne=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.post("/relations",t)];case 1:return[2,e.sent().data]}}))}))},t.prototype.updateOne=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:if(""==="".concat(t))throw new p("collection");if(""==="".concat(e))throw new p("field");return[4,this.transport.patch("/relations/".concat(t,"/").concat(e),n)];case 1:return[2,r.sent().data]}}))}))},t.prototype.deleteOne=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:if(""==="".concat(t))throw new p("collection");if(""==="".concat(e))throw new p("field");return[4,this.transport.delete("/relations/".concat(t,"/").concat(e))];case 1:return n.sent(),[2]}}))}))},t}(),k=function(t){function e(e){return t.call(this,"directus_revisions",e)||this}return s(e,t),e}(f),P=function(t){function e(e){return t.call(this,"directus_roles",e)||this}return s(e,t),e}(f),x=function(){function t(t){this.transport=t}return t.prototype.ping=function(){return c(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.transport.get("/server/ping")];case 1:return[2,t.sent().raw]}}))}))},t.prototype.info=function(){return c(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.transport.get("/server/info")];case 1:return[2,t.sent().data]}}))}))},t.prototype.oas=function(){return c(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.transport.get("/server/specs/oas")];case 1:return[2,t.sent().raw]}}))}))},t}(),j=function(){function t(t,e){this.collection=t,this.transport=e,this.endpoint=t.startsWith("directus_")?"/".concat(t.substring(9)):"/items/".concat(t)}return t.prototype.read=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.get("".concat(this.endpoint),{params:t})];case 1:return[2,e.sent().data]}}))}))},t.prototype.update=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.transport.patch("".concat(this.endpoint),t,{params:e})];case 1:return[2,n.sent().data]}}))}))},t}(),q=function(t){function e(e){return t.call(this,"directus_settings",e)||this}return s(e,t),e}(j),R=function(){function t(t){this.transport=t}return t.prototype.send=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.transport.post("/users/invite",{email:t,role:e,invite_url:n})];case 1:return r.sent(),[2]}}))}))},t.prototype.accept=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.transport.post("/users/invite/accept",{token:t,password:e})];case 1:return n.sent(),[2]}}))}))},t}(),T=function(){function t(t){this.transport=t}return t.prototype.generate=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.post("/users/me/tfa/generate",{password:t})];case 1:return[2,e.sent().data]}}))}))},t.prototype.enable=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.transport.post("/users/me/tfa/enable",{secret:t,otp:e})];case 1:return n.sent(),[2]}}))}))},t.prototype.disable=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.post("/users/me/tfa/disable",{otp:t})];case 1:return e.sent(),[2]}}))}))},t}(),S=function(){function t(t){this._transport=t}return Object.defineProperty(t.prototype,"tfa",{get:function(){return this._tfa||(this._tfa=new T(this._transport))},enumerable:!1,configurable:!0}),t.prototype.read=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this._transport.get("/users/me",{params:t})];case 1:return[2,e.sent().data]}}))}))},t.prototype.update=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this._transport.patch("/users/me",t,{params:e})];case 1:return[2,n.sent().data]}}))}))},t}(),E=function(t){function e(e){return t.call(this,"directus_users",e)||this}return s(e,t),Object.defineProperty(e.prototype,"invites",{get:function(){return this._invites||(this._invites=new R(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"me",{get:function(){return this._me||(this._me=new S(this.transport))},enumerable:!1,configurable:!0}),e}(f),I=function(){function t(t){var e=this;this.random={string:function(t){return void 0===t&&(t=32),c(e,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.get("/utils/random/string",{params:{length:t}})];case 1:return[2,e.sent().data]}}))}))}},this.hash={generate:function(t){return c(e,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.post("/utils/hash/generate",{string:t})];case 1:return[2,e.sent().data]}}))}))},verify:function(t,n){return c(e,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.post("/utils/hash/verify",{string:t,hash:n})];case 1:return[2,e.sent().data]}}))}))}},this.transport=t}return t.prototype.sort=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.transport.post("/utils/sort/".concat(encodeURI(t)),{item:e,to:n})];case 1:return r.sent(),[2]}}))}))},t.prototype.revert=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.transport.post("/utils/revert/".concat(encodeURI(t)))];case 1:return e.sent(),[2]}}))}))},t}(),A=function(){},U=function(){},H=function(t){function e(n,r){var o,i,s=this;return(s=(null===(o=null==r?void 0:r.errors)||void 0===o?void 0:o.length)?t.call(this,null===(i=null==r?void 0:r.errors[0])||void 0===i?void 0:i.message)||this:t.call(this,(null==n?void 0:n.message)||"Unknown transport error")||this).parent=n,s.response=r,s.errors=(null==r?void 0:r.errors)||[],Object.values(r||{}).some((function(t){return void 0!==t}))||(s.response=void 0),Object.setPrototypeOf(s,e.prototype),s}return s(e,t),e}(Error);!function(t){t.AuthToken="auth_token",t.RefreshToken="auth_refresh_token",t.Expires="auth_expires",t.ExpiresAt="auth_expires_at"}(l||(l={}));var M=function(t){function e(e){var n,r=this;return(r=t.call(this)||this).prefix=null!==(n=null==e?void 0:e.prefix)&&void 0!==n?n:"",r}return s(e,t),Object.defineProperty(e.prototype,"auth_token",{get:function(){return this.get(l.AuthToken)},set:function(t){null===t?this.delete(l.AuthToken):this.set(l.AuthToken,t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"auth_expires",{get:function(){var t=this.get(l.Expires);return null===t?null:parseInt(t)},set:function(t){null===t?this.delete(l.Expires):this.set(l.Expires,t.toString())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"auth_expires_at",{get:function(){var t=this.get(l.ExpiresAt);return null===t?null:parseInt(t)},set:function(t){null===t?this.delete(l.ExpiresAt):this.set(l.ExpiresAt,t.toString())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"auth_refresh_token",{get:function(){return this.get(l.RefreshToken)},set:function(t){null===t?this.delete(l.RefreshToken):this.set(l.RefreshToken,t)},enumerable:!1,configurable:!0}),e}(A),B=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.values={},e}return s(e,t),e.prototype.get=function(t){var e=this.key(t);return e in this.values?this.values[e]:null},e.prototype.set=function(t,e){return this.values[this.key(t)]=e,e},e.prototype.delete=function(t){var e=this.key(t),n=this.get(t);return e in this.values&&delete this.values[e],n},e.prototype.key=function(t){return"".concat(this.prefix).concat(t)},e}(M),C=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.get=function(t){var e=localStorage.getItem(this.key(t));return null!==e?e:null},e.prototype.set=function(t,e){return localStorage.setItem(this.key(t),e),e},e.prototype.delete=function(t){var e=this.key(t),n=this.get(e);return n&&localStorage.removeItem(e),n},e.prototype.key=function(t){return"".concat(this.prefix).concat(t)},e}(M),D=function(t){function e(e){var n,o=this;return(o=t.call(this)||this).config=e,o.axios=r.default.create({baseURL:o.config.url,params:o.config.params,headers:o.config.headers,onUploadProgress:o.config.onUploadProgress,withCredentials:!0}),(null===(n=o.config)||void 0===n?void 0:n.beforeRequest)&&(o.beforeRequest=o.config.beforeRequest),o}return s(e,t),e.prototype.beforeRequest=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){return[2,t]}))}))},Object.defineProperty(e.prototype,"url",{get:function(){return this.config.url},enumerable:!1,configurable:!0}),e.prototype.request=function(t,e,n,o){var i,s,u,a,l;return c(this,void 0,void 0,(function(){var c,p,f,d,v;return h(this,(function(h){switch(h.label){case 0:return h.trys.push([0,3,,4]),c={method:t,url:e,data:n,params:null==o?void 0:o.params,headers:null==o?void 0:o.headers,onUploadProgress:null==o?void 0:o.onUploadProgress},[4,this.beforeRequest(c)];case 1:return c=h.sent(),[4,this.axios.request(c)];case 2:if(p=h.sent(),f={raw:p.data,status:p.status,statusText:p.statusText,headers:p.headers,data:p.data.data,meta:p.data.meta,errors:p.data.errors},p.data.errors)throw new H(null,f);return[2,f];case 3:if(!(d=h.sent())||d instanceof Error==!1)throw d;if(r.default.isAxiosError(d))throw v=null===(i=d.response)||void 0===i?void 0:i.data,new H(d,{raw:null===(s=d.response)||void 0===s?void 0:s.data,status:null===(u=d.response)||void 0===u?void 0:u.status,statusText:null===(a=d.response)||void 0===a?void 0:a.statusText,headers:null===(l=d.response)||void 0===l?void 0:l.headers,data:null==v?void 0:v.data,meta:null==v?void 0:v.meta,errors:null==v?void 0:v.errors});throw new H(d);case 4:return[2]}}))}))},e.prototype.get=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.request("get",t,void 0,e)];case 1:return[2,n.sent()]}}))}))},e.prototype.head=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.request("head",t,void 0,e)];case 1:return[2,n.sent()]}}))}))},e.prototype.options=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.request("options",t,void 0,e)];case 1:return[2,n.sent()]}}))}))},e.prototype.delete=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.request("delete",t,e,n)];case 1:return[2,r.sent()]}}))}))},e.prototype.put=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.request("put",t,e,n)];case 1:return[2,r.sent()]}}))}))},e.prototype.post=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.request("post",t,e,n)];case 1:return[2,r.sent()]}}))}))},e.prototype.patch=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.request("patch",t,e,n)];case 1:return[2,r.sent()]}}))}))},e}(U),F=function(){function t(t){this.transport=t}return t.prototype.request=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.transport.post("/auth/password/request",{email:t,reset_url:e})];case 1:return n.sent(),[2]}}))}))},t.prototype.reset=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.transport.post("/auth/password/reset",{token:t,password:e})];case 1:return n.sent(),[2]}}))}))},t}(),L=function(t){function e(e){var n,r,o,i=this;return(i=t.call(this)||this).autoRefresh=!0,i.msRefreshBeforeExpires=3e4,i.staticToken="",i._transport=e.transport,i._storage=e.storage,i.autoRefresh=null!==(n=null==e?void 0:e.autoRefresh)&&void 0!==n?n:i.autoRefresh,i.mode=null!==(r=null==e?void 0:e.mode)&&void 0!==r?r:i.mode,i.msRefreshBeforeExpires=null!==(o=null==e?void 0:e.msRefreshBeforeExpires)&&void 0!==o?o:i.msRefreshBeforeExpires,(null==e?void 0:e.staticToken)&&(i.staticToken=null==e?void 0:e.staticToken,i.updateStorage({access_token:i.staticToken,expires:null,refresh_token:null})),i}return s(e,t),Object.defineProperty(e.prototype,"storage",{get:function(){return this._storage},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transport",{get:function(){return this._transport},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"token",{get:function(){return c(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:if(!this._refreshPromise)return[3,4];t.label=1;case 1:return t.trys.push([1,,3,4]),[4,this._refreshPromise];case 2:return t.sent(),[3,4];case 3:return this._refreshPromise=void 0,[7];case 4:return[2,this._storage.auth_token]}}))}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"password",{get:function(){return this.passwords=this.passwords||new F(this._transport)},enumerable:!1,configurable:!0}),e.prototype.resetStorage=function(){this._storage.auth_token=null,this._storage.auth_refresh_token=null,this._storage.auth_expires=null,this._storage.auth_expires_at=null},e.prototype.updateStorage=function(t){var e,n,r=null!==(e=t.expires)&&void 0!==e?e:null;this._storage.auth_token=t.access_token,this._storage.auth_refresh_token=null!==(n=t.refresh_token)&&void 0!==n?n:null,this._storage.auth_expires=r,this._storage.auth_expires_at=(new Date).getTime()+(null!=r?r:0)},e.prototype.refreshIfExpired=function(){return c(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:if(this.staticToken)return[2];if(!this.autoRefresh)return[2];if(this._storage.auth_expires_at)return[3,5];t.label=1;case 1:return t.trys.push([1,,3,4]),[4,this._refreshPromise];case 2:return t.sent(),[3,4];case 3:return this._refreshPromise=void 0,[7];case 4:return[2];case 5:this._storage.auth_expires_at<(new Date).getTime()+this.msRefreshBeforeExpires&&this.refresh(),t.label=6;case 6:return t.trys.push([6,,8,9]),[4,this._refreshPromise];case 7:return t.sent(),[3,9];case 8:return this._refreshPromise=void 0,[7];case 9:return[2]}}))}))},e.prototype.refresh=function(){var t=this;return this._refreshPromise=c(t,void 0,void 0,(function(){var t,e,n;return h(this,(function(r){switch(r.label){case 0:return t=this._storage.auth_refresh_token,this.resetStorage(),[4,this._transport.post("/auth/refresh",{refresh_token:"json"===this.mode?t:void 0})];case 1:return e=r.sent(),this.updateStorage(e.data),[2,a(a({access_token:e.data.access_token},(null===(n=e.data)||void 0===n?void 0:n.refresh_token)&&{refresh_token:e.data.refresh_token}),{expires:e.data.expires})]}}))}))},e.prototype.login=function(t){var e;return c(this,void 0,void 0,(function(){var n;return h(this,(function(r){switch(r.label){case 0:return this.resetStorage(),[4,this._transport.post("/auth/login",a({mode:this.mode},t),{headers:{Authorization:null}})];case 1:return n=r.sent(),this.updateStorage(n.data),[2,a(a({access_token:n.data.access_token},(null===(e=n.data)||void 0===e?void 0:e.refresh_token)&&{refresh_token:n.data.refresh_token}),{expires:n.data.expires})]}}))}))},e.prototype.static=function(t){return c(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.staticToken||(this.staticToken=t),[4,this._transport.get("/users/me",{params:{access_token:t},headers:{Authorization:null}})];case 1:return e.sent(),this.updateStorage({access_token:t,expires:null,refresh_token:null}),[2,!0]}}))}))},e.prototype.logout=function(){return c(this,void 0,void 0,(function(){var t;return h(this,(function(e){switch(e.label){case 0:return"json"===this.mode&&(t=this._storage.auth_refresh_token||void 0),[4,this._transport.post("/auth/logout",{refresh_token:t})];case 1:return e.sent(),this.updateStorage({access_token:null,expires:null,refresh_token:null}),[2]}}))}))},e}(o),z=function(){function t(t){this.transport=t}return t.prototype.request=function(t,e,n){return c(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.transport.post(t,{query:e,variables:void 0===n?{}:n})];case 1:return[2,r.sent()]}}))}))},t.prototype.items=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.request("/graphql",t,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.system=function(t,e){return c(this,void 0,void 0,(function(){return h(this,(function(n){switch(n.label){case 0:return[4,this.request("/graphql/system",t,e)];case 1:return[2,n.sent()]}}))}))},t}(),W=function(){function t(t,e){var n,r,i,s,u,l,p,f,d,v=this;if(this._url=t,this._options=e,this._items={},this._singletons={},(null===(n=this._options)||void 0===n?void 0:n.storage)&&(null===(r=this._options)||void 0===r?void 0:r.storage)instanceof A)this._storage=this._options.storage;else{var y=null===(i=this._options)||void 0===i?void 0:i.storage,b=null!=y?y:{},g=b.mode,_=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}(b,["mode"]);"MemoryStorage"===g||"undefined"==typeof window?this._storage=new B(_):this._storage=new C(_)}(null===(s=this._options)||void 0===s?void 0:s.transport)&&(null===(u=this._options)||void 0===u?void 0:u.transport)instanceof U?this._transport=this._options.transport:this._transport=new D(a({url:this.url,beforeRequest:function(t){return c(v,void 0,void 0,(function(){var e,n;return h(this,(function(r){switch(r.label){case 0:return[4,this._auth.refreshIfExpired()];case 1:return r.sent(),e=this.storage.auth_token,n=e?e.startsWith("Bearer ")?String(this.storage.auth_token):"Bearer ".concat(this.storage.auth_token):"",[2,a(a({},t),{headers:a({Authorization:n},t.headers)})]}}))}))}},null===(l=this._options)||void 0===l?void 0:l.transport)),(null===(p=this._options)||void 0===p?void 0:p.auth)&&(null===(f=this._options)||void 0===f?void 0:f.auth)instanceof o?this._auth=this._options.auth:this._auth=new L(a({transport:this._transport,storage:this._storage},null===(d=this._options)||void 0===d?void 0:d.auth))}return Object.defineProperty(t.prototype,"url",{get:function(){return this._url},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"auth",{get:function(){return this._auth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"storage",{get:function(){return this._storage},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transport",{get:function(){return this._transport},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"activity",{get:function(){return this._activity||(this._activity=new v(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"collections",{get:function(){return this._collections||(this._collections=new y(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fields",{get:function(){return this._fields||(this._fields=new b(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"files",{get:function(){return this._files||(this._files=new g(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"folders",{get:function(){return this._folders||(this._folders=new _(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"permissions",{get:function(){return this._permissions||(this._permissions=new w(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"presets",{get:function(){return this._presets||(this._presets=new m(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"relations",{get:function(){return this._relations||(this._relations=new O(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"revisions",{get:function(){return this._revisions||(this._revisions=new k(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roles",{get:function(){return this._roles||(this._roles=new P(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"users",{get:function(){return this._users||(this._users=new E(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"settings",{get:function(){return this._settings||(this._settings=new q(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"server",{get:function(){return this._server||(this._server=new x(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"utils",{get:function(){return this._utils||(this._utils=new I(this.transport))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"graphql",{get:function(){return this._graphql||(this._graphql=new z(this.transport))},enumerable:!1,configurable:!0}),t.prototype.singleton=function(t){return this._singletons[t]||(this._singletons[t]=new j(t,this.transport))},t.prototype.items=function(t){return this._items[t]||(this._items[t]=new f(t,this.transport))},t}();return t.ActivityHandler=v,t.Auth=L,t.BaseStorage=M,t.CollectionsHandler=y,t.CommentsHandler=d,t.Directus=W,t.EmptyParamError=p,t.FieldsHandler=b,t.FilesHandler=g,t.FoldersHandler=_,t.IAuth=o,t.IStorage=A,t.ITransport=U,t.ItemsHandler=f,t.LocalStorage=C,t.MemoryStorage=B,t.PermissionsHandler=w,t.PresetsHandler=m,t.RelationsHandler=O,t.RevisionsHandler=k,t.RolesHandler=P,t.ServerHandler=x,t.SettingsHandler=q,t.Transport=D,t.TransportError=H,t.UsersHandler=E,t.UtilsHandler=I,Object.defineProperty(t,"__esModule",{value:!0}),t}({},axios);
//# sourceMappingURL=sdk.global.min.js.map
{
"name": "@directus/sdk",
"version": "10.1.3",
"version": "10.1.4",
"description": "The official Directus SDK for use in JavaScript!",

@@ -5,0 +5,0 @@ "repository": "directus/sdk",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc