@directus/sdk
Advanced tools
Comparing version 16.2.0-rc.1 to 17.0.0
@@ -1,2 +0,2 @@ | ||
function I(e){return e?`/auth/login/${e}`:"/auth/login"}var A="/",W=(e,t)=>(e.endsWith(A)&&(e=e.slice(0,-1)),t.startsWith(A)||(t=A+t),e+t),b=(e,t,r)=>{let a=e.pathname===A?t:W(e.pathname,t),s=new globalThis.URL(a,e);if(r)for(let[p,i]of Object.entries(v(r)))if(i&&typeof i=="object"&&!Array.isArray(i))for(let[c,y]of Object.entries(i))s.searchParams.set(`${p}[${c}]`,String(y));else s.searchParams.set(p,i);return s};function U(e){return typeof e!="object"||!e?!1:"headers"in e&&"ok"in e&&"json"in e&&typeof e.json=="function"&&"text"in e&&typeof e.json=="function"}async function J(e){if(!(typeof e!="object"||!e)){if(U(e)){let t=e.headers.get("Content-Type")?.toLowerCase();if(t?.startsWith("application/json")||t?.startsWith("application/health+json")){let r=await e.json();if(!e.ok)throw r;return"data"in r?r.data:r}if(t?.startsWith("text/html")||t?.startsWith("text/plain")){let r=await e.text();if(!e.ok)throw r;return r}return e}return"data"in e?e.data:e}}var D=async(e,t,r=globalThis.fetch)=>(t.headers=typeof t.headers=="object"&&!Array.isArray(t.headers)?t.headers:{},r(e,t).then(a=>J(a).catch(s=>{let p=typeof s=="object"&&"errors"in s?s.errors:s;return Promise.reject({errors:p,response:a})})));var $=()=>{let e=null;return{get:async()=>e,set:async t=>{e=t}}};var L={msRefreshBeforeExpires:3e4,autoRefresh:!0},H=2**31-1,ce=(e="cookie",t={})=>r=>{let a={...L,...t},s=null,p=null,i=a.storage??$(),c=async()=>i.set({access_token:null,refresh_token:null,expires:null,expires_at:null}),y=async()=>{try{await s}finally{s=null}},x=async()=>{let d=await i.get();return s||!d?.expires_at||d.expires_at<new Date().getTime()+a.msRefreshBeforeExpires&&T().catch(l=>{}),y()},O=async d=>{let l=d.expires??0;d.expires_at=new Date().getTime()+l,await i.set(d),a.autoRefresh&&l>a.msRefreshBeforeExpires&&l<H&&(p&&clearTimeout(p),p=setTimeout(()=>{p=null,T().catch(f=>{})},l-a.msRefreshBeforeExpires))},T=async()=>(s=(async()=>{let l=await i.get();await c();let f={method:"POST",headers:{"Content-Type":"application/json"}};"credentials"in a&&(f.credentials=a.credentials);let m={mode:e};e==="json"&&l?.refresh_token&&(m.refresh_token=l.refresh_token),f.body=JSON.stringify(m);let n=b(r.url,"/auth/refresh");return D(n.toString(),f,r.globals.fetch).then(u=>O(u).then(()=>u))})(),s);return{refresh:T,async login(d,l,f={}){await c();let m={email:d,password:l};"otp"in f&&(m.otp=f.otp),m.mode=f.mode??e;let n=I(f.provider),u=b(r.url,n),h={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(m)};"credentials"in a&&(h.credentials=a.credentials);let R=await D(u.toString(),h,r.globals.fetch);return await O(R),R},async logout(){let d=await i.get(),l={method:"POST",headers:{"Content-Type":"application/json"}};"credentials"in a&&(l.credentials=a.credentials);let f={mode:e};e==="json"&&d?.refresh_token&&(f.refresh_token=d.refresh_token),l.body=JSON.stringify(f);let m=b(r.url,"/auth/logout");await D(m.toString(),l,r.globals.fetch),this.stopRefreshing(),await c()},stopRefreshing(){p&&clearTimeout(p)},async getToken(){return await x().catch(()=>{}),(await i.get())?.access_token??null},async setToken(d){return i.set({access_token:d,refresh_token:null,expires:null,expires_at:null})}}};var ue=e=>t=>{let r=e??null;return{async getToken(){return r},async setToken(a){r=a}}};var k={fetch:globalThis.fetch,WebSocket:globalThis.WebSocket,URL:globalThis.URL,logger:globalThis.console},fe=(e,t={})=>{let r=t.globals?{...k,...t.globals}:k;return{globals:r,url:new r.URL(e),with(a){return{...this,...a(this)}}}};var V={},Ce=(e={})=>t=>{let r={...V,...e};return{async query(a,s,p="items"){let i={method:"POST",body:JSON.stringify({query:a,variables:s})};"credentials"in r&&(i.credentials=r.credentials);let c={};if("getToken"in this){let O=await this.getToken();O&&(c.Authorization=`Bearer ${O}`)}"Content-Type"in c||(c["Content-Type"]="application/json"),i.headers=c;let y=p==="items"?"/graphql":"/graphql/system",x=b(t.url,y);return await D(x.toString(),i,t.globals.fetch)}}};function E(e){return JSON.stringify({...e,type:"auth"})}var G=()=>JSON.stringify({type:"pong"});var F=(e,t=1e3)=>new Promise((r,a)=>{let s=y=>{try{let x=JSON.parse(y.data);typeof x=="object"&&!Array.isArray(x)&&x!==null?(i(),r(x)):(i(),p())}catch{i(),r(y)}},p=()=>a(),i=()=>{clearTimeout(c),e.removeEventListener("message",s),e.removeEventListener("error",p),e.removeEventListener("close",p)};e.addEventListener("message",s),e.addEventListener("error",p),e.addEventListener("close",p);let c=setTimeout(()=>{i(),r(void 0)},t)});function*w(){let e=1;for(;;)yield String(e),e++}var M={authMode:"handshake",heartbeat:!0,debug:!1,reconnect:{delay:1e3,retries:10}};function Ue(e={}){return t=>{e={...M,...e};let r=w(),a={code:"closed"},s={attempts:0,active:!1},p=new Set,i=m=>"getToken"in m,c=(m,...n)=>e.debug&&t.globals.logger[m]("[Directus SDK]",...n),y=async(m,n)=>{let u=new t.globals.URL(m);if(e.authMode==="strict"&&i(n)){let h=await n.getToken();h&&u.searchParams.set("access_token",h)}return u.toString()},x=async m=>{if("url"in e)return await y(e.url,m);if(["ws:","wss:"].includes(t.url.protocol))return await y(t.url,m);let n=new t.globals.URL(t.url.toString());return n.protocol=t.url.protocol==="https:"?"wss:":"ws:",n.pathname="/websocket",await y(n,m)},O=m=>{let n=new Promise((u,h)=>{if(!e.reconnect)return h();if(c("info",`reconnect #${s.attempts} `+(s.attempts>=e.reconnect.retries?"maximum retries reached":`trying again in ${Math.max(100,e.reconnect.delay)}ms`)),s.active)return s.active;if(s.attempts>=e.reconnect.retries)return h();setTimeout(()=>m.connect().then(R=>(p.forEach(S=>{m.sendMessage(S)}),R)).then(u).catch(h),Math.max(100,e.reconnect.delay))});s.attempts+=1,s.active=n.catch(()=>{}).finally(()=>{s.active=!1})},T={open:new Set([]),error:new Set([]),close:new Set([]),message:new Set([])};function d(m){return"type"in m&&"status"in m&&"error"in m&&"code"in m.error&&"message"in m.error&&m.type==="auth"&&m.status==="error"}async function l(m,n){if(a.code==="open"){if(m.error.code==="TOKEN_EXPIRED"&&(c("warn","Authentication token expired!"),i(n))){let u=await n.getToken();if(!u)throw Error("No token for re-authenticating the websocket");a.connection.send(E({access_token:u}))}if(m.error.code==="AUTH_TIMEOUT")return a.firstMessage&&e.authMode==="public"?(c("warn",'Authentication failed! Currently the "authMode" is "public" try using "handshake" instead'),e.reconnect=!1):c("warn","Authentication timed out!"),a.connection.close();if(m.error.code==="AUTH_FAILED"){if(a.firstMessage&&e.authMode==="public")return c("warn",'Authentication failed! Currently the "authMode" is "public" try using "handshake" instead'),e.reconnect=!1,a.connection.close();c("warn","Authentication failed!")}}}let f=async m=>{for(;a.code==="open";){let n=await F(a.connection).catch(()=>{});if(n){if(d(n)){await l(n,m),a.firstMessage=!1;continue}if(e.heartbeat&&n.type==="ping"){a.connection.send(G()),a.firstMessage=!1;continue}T.message.forEach(u=>{a.code==="open"&&u.call(a.connection,n)}),a.firstMessage=!1}}};return{async connect(){if(a.code==="connecting")return await a.connection;if(a.code!=="closed")throw new Error(`Cannot connect when state is "${a.code}"`);let m=this,n=await x(m);c("info",`Connecting to ${n}...`);let u=new Promise((h,R)=>{let S=!1,C=new t.globals.WebSocket(n);C.addEventListener("open",async P=>{if(c("info","Connection open."),a={code:"open",connection:C,firstMessage:!0},s.attempts=0,s.active=!1,f(m),e.authMode==="handshake"&&i(m)){let g=await m.getToken();if(!g)throw Error("No token for authenticating the websocket. Make sure to provide one or call the login() function beforehand.");C.send(E({access_token:g}));let j=await F(C);if(j&&"type"in j&&"status"in j&&j.type==="auth"&&j.status==="ok")c("info","Authentication successful!");else return R("Authentication failed while opening websocket connection")}T.open.forEach(g=>g.call(C,P)),S=!0,h(C)}),C.addEventListener("error",P=>{c("warn","Connection errored."),T.error.forEach(g=>g.call(C,P)),C.close(),a={code:"error"},S||R(P)}),C.addEventListener("close",P=>{c("info","Connection closed."),T.close.forEach(g=>g.call(C,P)),r=w(),a={code:"closed"},O(this),S||R(P)})});return a={code:"connecting",connection:u},u},disconnect(){a.code==="open"&&a.connection.close()},onWebSocket(m,n){if(m==="message"){let u=function(h){if(typeof h.data!="string")return n.call(this,h);try{return n.call(this,JSON.parse(h.data))}catch{return n.call(this,h)}};return T[m].add(u),()=>T[m].delete(u)}return T[m].add(n),()=>T[m].delete(n)},sendMessage(m){if(a.code!=="open")throw new Error('Cannot send messages without an open connection. Make sure you are calling "await client.connect()".');if(typeof m=="string")return a.connection.send(m);"uid"in m||(m.uid=r.next().value),a.connection.send(JSON.stringify(m))},async subscribe(m,n={}){"uid"in n||(n.uid=r.next().value),p.add({...n,collection:m,type:"subscribe"}),a.code!=="open"&&(c("info","No connection available for subscribing!"),await this.connect()),this.sendMessage({...n,collection:m,type:"subscribe"});let u=!0;async function*h(){for(;u&&a.code==="open";){let S=await F(a.connection).catch(()=>{});if(S){if("type"in S&&"status"in S&&S.type==="subscribe"&&S.status==="error")throw S;"type"in S&&"uid"in S&&S.type==="subscription"&&S.uid===n.uid&&(yield S)}}e.reconnect&&s.active&&(await s.active,a.code==="open"&&(a.connection.send(JSON.stringify({...n,collection:m,type:"subscribe"})),yield*h()))}let R=()=>{p.delete({...n,collection:m,type:"subscribe"}),this.sendMessage({uid:n.uid,type:"unsubscribe"}),u=!1};return{subscription:h(),unsubscribe:R}}}}}var $e=e=>new Promise(t=>setTimeout(()=>t(),e));var ze=(e,t,r={})=>()=>{let a=I(r.provider),s={email:e,password:t};return"otp"in r&&(s.otp=r.otp),s.mode=r.mode??"cookie",{path:a,method:"POST",body:JSON.stringify(s)}};var Ye=(e,t="cookie")=>()=>({path:"/auth/logout",method:"POST",body:JSON.stringify(e?{refresh_token:e,mode:t}:{mode:t})});var et=(e,t)=>()=>({path:"/auth/password/request",method:"POST",body:JSON.stringify({email:e,...t?{reset_url:t}:{}})});var rt=(e,t)=>()=>({path:"/auth/password/reset",method:"POST",body:JSON.stringify({token:e,password:t})});var at=(e=!1)=>()=>({path:e?"/auth?sessionOnly":"/auth",method:"GET"});var mt=(e="cookie",t)=>()=>({path:"/auth/refresh",method:"POST",body:JSON.stringify(e==="json"?{refresh_token:t,mode:e}:{mode:e})});var St=(e,t)=>()=>({path:"/activity/comment",params:t??{},body:JSON.stringify(e),method:"POST"});var ft=(e,t)=>()=>({path:"/collections",params:t??{},body:JSON.stringify(e),method:"POST"});var xt=(e,t)=>()=>({path:"/dashboards",params:t??{},body:JSON.stringify(e),method:"POST"}),Tt=(e,t)=>()=>({path:"/dashboards",params:t??{},body:JSON.stringify(e),method:"POST"});var Rt=(e,t,r)=>()=>({path:`/fields/${e}`,params:r??{},body:JSON.stringify(t),method:"POST"});var bt=(e,t)=>()=>({path:"/files",method:"POST",body:e,params:t??{},headers:{"Content-Type":"multipart/form-data"}}),Dt=(e,t={},r)=>()=>({path:"/files/import",method:"POST",body:JSON.stringify({url:e,data:t}),params:r??{}});var Pt=(e,t)=>()=>({path:"/flows",params:t??{},body:JSON.stringify(e),method:"POST"}),jt=(e,t)=>()=>({path:"/flows",params:t??{},body:JSON.stringify(e),method:"POST"});var At=(e,t)=>()=>({path:"/folders",params:t??{},body:JSON.stringify(e),method:"POST"}),Ft=(e,t)=>()=>({path:"/folders",params:t??{},body:JSON.stringify(e),method:"POST"});import{isSystemCollection as K}from"@directus/system-data";var Nt=(e,t,r)=>()=>{let a=String(e);if(K(a))throw new Error("Cannot use createItems for core collections");return{path:`/items/${a}`,params:r??{},body:JSON.stringify(t),method:"POST"}},vt=(e,t,r)=>()=>{let a=String(e);if(K(a))throw new Error("Cannot use createItem for core collections");return{path:`/items/${a}`,params:r??{},body:JSON.stringify(t),method:"POST"}};var Jt=(e,t)=>()=>({path:"/notifications",params:t??{},body:JSON.stringify(e),method:"POST"}),$t=(e,t)=>()=>({path:"/notifications",params:t??{},body:JSON.stringify(e),method:"POST"});var Gt=(e,t)=>()=>({path:"/operations",params:t??{},body:JSON.stringify(e),method:"POST"}),Kt=(e,t)=>()=>({path:"/operations",params:t??{},body:JSON.stringify(e),method:"POST"});var Lt=(e,t)=>()=>({path:"/panels",params:t??{},body:JSON.stringify(e),method:"POST"}),Ht=(e,t)=>()=>({path:"/panels",params:t??{},body:JSON.stringify(e),method:"POST"});var Mt=(e,t)=>()=>({path:"/permissions",params:t??{},body:JSON.stringify(e),method:"POST"}),_t=(e,t)=>()=>({path:"/permissions",params:t??{},body:JSON.stringify(e),method:"POST"});var qt=(e,t)=>()=>({path:"/policies",params:t??{},body:JSON.stringify(e),method:"POST"}),zt=(e,t)=>()=>({path:"/policies",params:t??{},body:JSON.stringify(e),method:"POST"});var Yt=(e,t)=>()=>({path:"/presets",params:t??{},body:JSON.stringify(e),method:"POST"}),Zt=(e,t)=>()=>({path:"/presets",params:t??{},body:JSON.stringify(e),method:"POST"});var tr=e=>()=>({path:"/relations",body:JSON.stringify(e),method:"POST"});var or=(e,t)=>()=>({path:"/roles",params:t??{},body:JSON.stringify(e),method:"POST"}),ar=(e,t)=>()=>({path:"/roles",params:t??{},body:JSON.stringify(e),method:"POST"});var mr=(e,t)=>()=>({path:"/shares",params:t??{},body:JSON.stringify(e),method:"POST"}),ir=(e,t)=>()=>({path:"/shares",params:t??{},body:JSON.stringify(e),method:"POST"});var cr=(e,t)=>()=>({path:"/translations",params:t??{},body:JSON.stringify(e),method:"POST"}),pr=(e,t)=>()=>({path:"/translations",params:t??{},body:JSON.stringify(e),method:"POST"});var hr=(e,t)=>()=>({path:"/users",params:t??{},body:JSON.stringify(e),method:"POST"}),yr=(e,t)=>()=>({path:"/users",params:t??{},body:JSON.stringify(e),method:"POST"});var Sr=(e,t)=>()=>({path:"/versions",params:t??{},body:JSON.stringify(e),method:"POST"}),lr=(e,t)=>()=>({path:"/versions",params:t??{},body:JSON.stringify(e),method:"POST"});var Qr=(e,t)=>()=>({path:"/webhooks",params:t??{},body:JSON.stringify(e),method:"POST"}),xr=(e,t)=>()=>({path:"/webhooks",params:t??{},body:JSON.stringify(e),method:"POST"});var Lr=e=>()=>({path:`/activity/comment/${e}`,method:"DELETE"});var Vr=e=>()=>({path:`/collections/${e}`,method:"DELETE"});var N=e=>{let t=(r,a=[])=>{if(typeof r=="object"){let s=[];for(let p in r){let i=r[p]??[];if(Array.isArray(i))for(let c of i)s.push(t(c,[...a,p]));else if(typeof i=="object")for(let c of Object.keys(i)){let y=i[c];for(let x of y)s.push(t(x,[...a,`${p}:${c}`]))}}return s.flatMap(p=>p)}return[...a,String(r)].join(".")};return e.flatMap(r=>t(r))},v=e=>{let t={};Array.isArray(e.fields)&&e.fields.length>0&&(t.fields=N(e.fields).join(",")),e.filter&&Object.keys(e.filter).length>0&&(t.filter=JSON.stringify(e.filter)),e.search&&(t.search=e.search),"sort"in e&&e.sort&&(t.sort=typeof e.sort=="string"?e.sort:e.sort.join(",")),typeof e.limit=="number"&&e.limit>=-1&&(t.limit=String(e.limit)),typeof e.offset=="number"&&e.offset>=0&&(t.offset=String(e.offset)),typeof e.page=="number"&&e.page>=1&&(t.page=String(e.page)),e.deep&&Object.keys(e.deep).length>0&&(t.deep=JSON.stringify(e.deep)),e.alias&&Object.keys(e.alias).length>0&&(t.alias=JSON.stringify(e.alias)),e.aggregate&&Object.keys(e.aggregate).length>0&&(t.aggregate=JSON.stringify(e.aggregate)),e.groupBy&&e.groupBy.length>0&&(t.groupBy=e.groupBy.join(","));for(let[r,a]of Object.entries(e))r in t||(typeof a=="string"||typeof a=="number"||typeof a=="boolean"?t[r]=String(a):t[r]=JSON.stringify(a));return t};var o=(e,t)=>{if(e.length===0)throw new Error(t)};import{isSystemCollection as _}from"@directus/system-data";var Q=(e,t)=>{if(_(String(e)))throw new Error(t)};var oo=e=>()=>(o(e,"Keys cannot be empty"),{path:"/dashboards",body:JSON.stringify(e),method:"DELETE"}),ao=e=>()=>(o(e,"Key cannot be empty"),{path:`/dashboards/${e}`,method:"DELETE"});var io=(e,t)=>()=>(o(e,"Collection cannot be empty"),o(t,"Field cannot be empty"),{path:`/fields/${e}/${t}`,method:"DELETE"});var po=e=>()=>(o(e,"Keys cannot be empty"),{path:"/files",body:JSON.stringify(e),method:"DELETE"}),uo=e=>()=>(o(e,"Key cannot be empty"),{path:`/files/${e}`,method:"DELETE"});var So=e=>()=>(o(e,"Keys cannot be empty"),{path:"/flows",body:JSON.stringify(e),method:"DELETE"}),lo=e=>()=>(o(e,"Key cannot be empty"),{path:`/flows/${e}`,method:"DELETE"});var xo=e=>()=>(o(e,"Keys cannot be empty"),{path:"/folders",body:JSON.stringify(e),method:"DELETE"}),To=e=>()=>(o(e,"Key cannot be empty"),{path:`/folders/${e}`,method:"DELETE"});var go=(e,t)=>()=>{let r={};return o(String(e),"Collection cannot be empty"),Q(e,"Cannot use deleteItems for core collections"),Array.isArray(t)?(o(t,"keysOrQuery cannot be empty"),r={keys:t}):(o(Object.keys(t),"keysOrQuery cannot be empty"),r={query:t}),{path:`/items/${e}`,body:JSON.stringify(r),method:"DELETE"}},bo=(e,t)=>()=>(o(String(e),"Collection cannot be empty"),Q(e,"Cannot use deleteItem for core collections"),o(String(t),"Key cannot be empty"),{path:`/items/${e}/${t}`,method:"DELETE"});var Po=e=>()=>(o(e,"Keys cannot be empty"),{path:"/notifications",body:JSON.stringify(e),method:"DELETE"}),jo=e=>()=>(o(e,"Key cannot be empty"),{path:`/notifications/${e}`,method:"DELETE"});var Fo=e=>()=>(o(e,"Keys cannot be empty"),{path:"/operations",body:JSON.stringify(e),method:"DELETE"}),Eo=e=>()=>(o(e,"Key cannot be empty"),{path:`/operations/${e}`,method:"DELETE"});var vo=e=>()=>(o(e,"Keys cannot be empty"),{path:"/panels",body:JSON.stringify(e),method:"DELETE"}),Uo=e=>()=>(o(e,"Key cannot be empty"),{path:`/panels/${e}`,method:"DELETE"});var ko=e=>()=>(o(e,"Keys cannot be empty"),{path:"/permissions",body:JSON.stringify(e),method:"DELETE"}),Go=e=>()=>(o(String(e),"Key cannot be empty"),{path:`/permissions/${e}`,method:"DELETE"});var Lo=e=>()=>(o(e,"Keys cannot be empty"),{path:"/policies",body:JSON.stringify(e),method:"DELETE"}),Ho=e=>()=>(o(String(e),"Key cannot be empty"),{path:`/policies/${e}`,method:"DELETE"});var _o=e=>()=>(o(e,"Keys cannot be empty"),{path:"/presets",body:JSON.stringify(e),method:"DELETE"}),Bo=e=>()=>(o(String(e),"Key cannot be empty"),{path:`/presets/${e}`,method:"DELETE"});var Xo=(e,t)=>()=>(o(e,"Collection cannot be empty"),o(t,"Field cannot be empty"),{path:`/relations/${e}/${t}`,method:"DELETE"});var ea=e=>()=>(o(e,"Keys cannot be empty"),{path:"/roles",body:JSON.stringify(e),method:"DELETE"}),ta=e=>()=>(o(String(e),"Key cannot be empty"),{path:`/roles/${e}`,method:"DELETE"});var aa=e=>()=>(o(e,"Keys cannot be empty"),{path:"/shares",body:JSON.stringify(e),method:"DELETE"}),sa=e=>()=>(o(String(e),"Key cannot be empty"),{path:`/shares/${e}`,method:"DELETE"});var na=e=>()=>(o(e,"Keys cannot be empty"),{path:"/translations",body:JSON.stringify(e),method:"DELETE"}),ca=e=>()=>(o(String(e),"Key cannot be empty"),{path:`/translations/${e}`,method:"DELETE"});var ha=e=>()=>(o(e,"Keys cannot be empty"),{path:"/users",body:JSON.stringify(e),method:"DELETE"}),ya=e=>()=>(o(String(e),"Key cannot be empty"),{path:`/users/${e}`,method:"DELETE"});var la=e=>()=>(o(e,"Keys cannot be empty"),{path:"/versions",body:JSON.stringify(e),method:"DELETE"}),fa=e=>()=>(o(e,"Key cannot be empty"),{path:`/versions/${e}`,method:"DELETE"});var Ta=e=>()=>(o(e,"Keys cannot be empty"),{path:"/webhooks",body:JSON.stringify(e),method:"DELETE"}),Ca=e=>()=>(o(String(e),"Key cannot be empty"),{path:`/webhooks/${e}`,method:"DELETE"});var Ma=e=>()=>({path:"/activity",params:e??{},method:"GET"}),_a=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/activity/${e}`,params:t??{},method:"GET"});import{isSystemCollection as B}from"@directus/system-data";var Ya=(e,t)=>()=>{let r=String(e);return o(r,"Collection cannot be empty"),{path:B(r)?`/${r.substring(9)}`:`/items/${r}`,method:"GET",params:{...t.query??{},...t.groupBy?{groupBy:t.groupBy}:{},aggregate:t.aggregate}}};var ts=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/assets/${e}`,params:t??{},method:"GET",onResponse:r=>r.body}),rs=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/assets/${e}`,params:t??{},method:"GET",onResponse:r=>r.blob()}),os=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/assets/${e}`,params:t??{},method:"GET",onResponse:r=>r.arrayBuffer()});var ms=()=>()=>({path:"/collections",method:"GET"}),is=e=>()=>(o(e,"Collection cannot be empty"),{path:`/collections/${e}`,method:"GET"});var ps=e=>()=>({path:"/dashboards",params:e??{},method:"GET"}),us=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/dashboards/${e}`,params:t??{},method:"GET"});var ys=()=>()=>({path:"/extensions/",method:"GET"});var ls=()=>()=>({path:"/fields",method:"GET"}),fs=e=>()=>(o(e,"Collection cannot be empty"),{path:`/fields/${e}`,method:"GET"}),Qs=(e,t)=>()=>(o(e,"Collection cannot be empty"),o(t,"Field cannot be empty"),{path:`/fields/${e}/${t}`,method:"GET"});var Cs=e=>()=>({path:"/files",params:e??{},method:"GET"}),Rs=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/files/${e}`,params:t??{},method:"GET"});var Ds=e=>()=>({path:"/flows",params:e??{},method:"GET"}),Os=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/flows/${e}`,params:t??{},method:"GET"});var Is=e=>()=>({path:"/folders",params:e??{},method:"GET"}),As=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/folders/${e}`,params:t??{},method:"GET"});var ws=(e,t)=>()=>(o(String(e),"Collection cannot be empty"),Q(e,"Cannot use readItems for core collections"),{path:`/items/${e}`,params:t??{},method:"GET"}),Ns=(e,t,r)=>()=>(o(String(e),"Collection cannot be empty"),Q(e,"Cannot use readItem for core collections"),o(String(t),"Key cannot be empty"),{path:`/items/${e}/${t}`,params:r??{},method:"GET"});var Js=e=>()=>({path:"/notifications",params:e??{},method:"GET"}),$s=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/notifications/${e}`,params:t??{},method:"GET"});var Ks=e=>()=>({path:"/operations",params:e??{},method:"GET"}),Ws=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/operations/${e}`,params:t??{},method:"GET"});var Vs=e=>()=>({path:"/panels",params:e??{},method:"GET"}),Ms=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/panels/${e}`,params:t??{},method:"GET"});var qs=e=>()=>({path:"/permissions",params:e??{},method:"GET"}),zs=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/permissions/${e}`,params:t??{},method:"GET"}),Xs=(e,t)=>()=>(o(String(e),"Collection cannot be empty"),{path:`/permissions/me/${t?`${e}/${t}`:`${e}`}`,method:"GET"}),Ys=()=>()=>({path:"/permissions/me",method:"GET"});var tm=e=>()=>({path:"/policies",params:e??{},method:"GET"}),rm=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/policies/${e}`,params:t??{},method:"GET"}),om=()=>()=>({path:"/policies/me/globals",method:"GET"});var mm=e=>()=>({path:"/presets",params:e??{},method:"GET"}),im=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/presets/${e}`,params:t??{},method:"GET"});var pm=()=>()=>({path:"/relations",method:"GET"}),um=e=>()=>({path:`/relations/${e}`,method:"GET"}),hm=(e,t)=>()=>(o(e,"Collection cannot be empty"),o(t,"Field cannot be empty"),{path:`/relations/${e}/${t}`,method:"GET"});var Sm=e=>()=>({path:"/revisions",params:e??{},method:"GET"}),lm=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/revisions/${e}`,params:t??{},method:"GET"});var xm=e=>()=>({path:"/roles",params:e??{},method:"GET"}),Tm=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/roles/${e}`,params:t??{},method:"GET"}),Cm=e=>()=>({path:"/roles/me",params:e??{},method:"GET"});var gm=e=>()=>({path:"/settings",params:e??{},method:"GET"});var Om=e=>()=>({path:"/shares",params:e??{},method:"GET"}),Pm=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/shares/${e}`,params:t??{},method:"GET"});var Am=(e,t)=>()=>(o(String(e),"Collection cannot be empty"),Q(e,"Cannot use readSingleton for core collections"),{path:`/items/${e}`,params:t??{},method:"GET"});var wm=e=>()=>({path:"/translations",params:e??{},method:"GET"}),Nm=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/translations/${e}`,params:t??{},method:"GET"});var Jm=e=>()=>({path:"/users",params:e??{},method:"GET"}),$m=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/users/${e}`,params:t??{},method:"GET"}),km=e=>()=>({path:"/users/me",params:e??{},method:"GET"});var Wm=e=>()=>({path:"/versions",params:e??{},method:"GET"}),Lm=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/versions/${e}`,params:t??{},method:"GET"});var Mm=e=>()=>({path:"/webhooks",params:e??{},method:"GET"}),_m=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/webhooks/${e}`,params:t??{},method:"GET"});var gi=e=>()=>({method:"POST",path:"/schema/apply",body:JSON.stringify(e)});var Di=(e,t=!1)=>()=>({method:"POST",path:"/schema/diff",params:t?{force:t}:{},body:JSON.stringify(e)});var Pi=()=>()=>({method:"GET",path:"/schema/snapshot"});var wi=(e="item")=>()=>({method:"GET",path:e==="item"?"/server/specs/graphql":"/server/specs/graphql/system"});var vi=()=>()=>({method:"GET",path:"/server/health"});var Ji=()=>()=>({method:"GET",path:"/server/info"});var ki=()=>()=>({method:"GET",path:"/server/specs/oas"});var Ki=()=>()=>({method:"GET",path:"/server/ping"});var zi=(e,t,r)=>()=>(o(String(e),"Key cannot be empty"),{path:`/activity/comment/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var Zi=(e,t,r)=>()=>(o(e,"Collection cannot be empty"),{path:`/collections/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"}),en=(e,t)=>()=>({path:"/collections",params:t??{},body:JSON.stringify(e),method:"PATCH"});var on=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/dashboards",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),an=(e,t)=>()=>({path:"/dashboards",params:t??{},body:JSON.stringify(e),method:"PATCH"}),sn=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/dashboards/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var cn=(e,t,r)=>()=>(e!==null&&o(e,"Bundle cannot be an empty string"),o(t,"Name cannot be empty"),{path:e?`/extensions/${e}/${t}`:`/extensions/${t}`,params:{},body:JSON.stringify(r),method:"PATCH"});var hn=(e,t,r,a)=>()=>(o(e,"Keys cannot be empty"),o(t,"Field cannot be empty"),{path:`/fields/${e}/${t}`,params:a??{},body:JSON.stringify(r),method:"PATCH"});var Sn=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/files",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),ln=(e,t)=>()=>({path:"/files",params:t??{},body:JSON.stringify(e),method:"PATCH"}),fn=(e,t,r)=>()=>(o(e,"Key cannot be empty"),t instanceof FormData?{path:`/files/${e}`,params:r??{},body:t,method:"PATCH",headers:{"Content-Type":"multipart/form-data"}}:{path:`/files/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var Tn=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/flows",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Cn=(e,t)=>()=>({path:"/flows",params:t??{},body:JSON.stringify(e),method:"PATCH"}),Rn=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/flows/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var Dn=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/folders",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),On=(e,t)=>()=>({path:"/folders",params:t??{},body:JSON.stringify(e),method:"PATCH"}),Pn=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/folders/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var An=(e,t,r,a)=>()=>{let s={};return o(String(e),"Collection cannot be empty"),Q(e,"Cannot use updateItems for core collections"),Array.isArray(t)?(o(t,"keysOrQuery cannot be empty"),s={keys:t}):(o(Object.keys(t),"keysOrQuery cannot be empty"),s={query:t}),s.data=r,{path:`/items/${e}`,params:a??{},body:JSON.stringify(s),method:"PATCH"}},Fn=(e,t,r)=>()=>(o(String(e),"Collection cannot be empty"),Q(e,"Cannot use updateItems for core collections"),{path:`/items/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"}),En=(e,t,r,a)=>()=>(o(String(t),"Key cannot be empty"),o(String(e),"Collection cannot be empty"),Q(e,"Cannot use updateItem for core collections"),{path:`/items/${e}/${t}`,params:a??{},body:JSON.stringify(r),method:"PATCH"});var vn=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/notifications",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Un=(e,t)=>()=>({path:"/notifications",params:t??{},body:JSON.stringify(e),method:"PATCH"}),Jn=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/notifications/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var Gn=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/operations",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Kn=(e,t)=>()=>({path:"/operations",params:t??{},body:JSON.stringify(e),method:"PATCH"}),Wn=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/operations/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var Vn=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/panels",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Mn=(e,t)=>()=>({path:"/panels",params:t??{},body:JSON.stringify(e),method:"PATCH"}),_n=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/panels/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var zn=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/permissions",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Xn=(e,t)=>()=>({path:"/permissions",params:t??{},body:JSON.stringify(e),method:"PATCH"}),Yn=(e,t,r)=>()=>(o(String(e),"Key cannot be empty"),{path:`/permissions/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var tc=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/policies",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),rc=(e,t)=>()=>({path:"/policies",params:t??{},body:JSON.stringify(e),method:"PATCH"}),oc=(e,t,r)=>()=>(o(String(e),"Key cannot be empty"),{path:`/policies/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var mc=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/presets",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),ic=(e,t)=>()=>({path:"/presets",params:t??{},body:JSON.stringify(e),method:"PATCH"}),nc=(e,t,r)=>()=>(o(String(e),"Key cannot be empty"),{path:`/presets/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var uc=(e,t,r,a)=>()=>(o(e,"Collection cannot be empty"),o(t,"Field cannot be empty"),{path:`/relations/${e}/${t}`,params:a??{},body:JSON.stringify(r),method:"PATCH"});var dc=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/roles",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Sc=(e,t)=>()=>({path:"/roles",params:t??{},body:JSON.stringify(e),method:"PATCH"}),lc=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/roles/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var Qc=(e,t)=>()=>({path:"/settings",params:t??{},body:JSON.stringify(e),method:"PATCH"});var Cc=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/shares",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Rc=(e,t)=>()=>({path:"/shares",params:t??{},body:JSON.stringify(e),method:"PATCH"}),gc=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/shares/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var Oc=(e,t,r)=>()=>(o(String(e),"Collection cannot be empty"),Q(e,"Cannot use updateSingleton for core collections"),{path:`/items/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var Ic=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/translations",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Ac=(e,t)=>()=>({path:"/translations",params:t??{},body:JSON.stringify(e),method:"PATCH"}),Fc=(e,t,r)=>()=>(o(String(e),"Key cannot be empty"),{path:`/translations/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var Nc=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/users",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),vc=(e,t)=>()=>({path:"/users",params:t??{},body:JSON.stringify(e),method:"PATCH"}),Uc=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/users/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"}),Jc=(e,t)=>()=>({path:"/users/me",params:t??{},body:JSON.stringify(e),method:"PATCH"});var Gc=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/versions",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Kc=(e,t)=>()=>({path:"/versions",params:t??{},body:JSON.stringify(e),method:"PATCH"}),Wc=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/versions/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var Vc=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/webhooks",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Mc=(e,t,r)=>()=>(o(String(e),"Key cannot be empty"),{path:`/webhooks/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var xp=()=>()=>({method:"POST",path:"/utils/cache/clear"});var Cp=(e,t,r,a)=>()=>({method:"POST",path:`/utils/export/${e}`,body:JSON.stringify({format:t,query:r,file:a})});var gp=(e,t,r)=>()=>e==="GET"?{path:`/flows/trigger/${t}`,params:r??{},method:"GET"}:{path:`/flows/trigger/${t}`,body:JSON.stringify(r??{}),method:"POST"};var Dp=e=>()=>({method:"POST",path:"/utils/hash/generate",body:JSON.stringify({string:e})}),Op=(e,t)=>()=>({method:"POST",path:"/utils/hash/verify",body:JSON.stringify({string:e,hash:t})});var jp=(e,t)=>()=>({path:`/utils/import/${e}`,method:"POST",body:t,headers:{"Content-Type":"multipart/form-data"}});var Ap=(e,t)=>()=>({path:`/operations/trigger/${e}`,body:JSON.stringify(t??{}),method:"POST"});var Ep=(e,t,r="cookie")=>()=>({path:"/shares/auth",method:"POST",body:JSON.stringify({share:e,password:t,mode:r})}),wp=(e,t)=>()=>({path:"/shares/invite",method:"POST",body:JSON.stringify({share:e,emails:t})}),Np=e=>()=>({path:`/shares/info/${e}`,method:"GET"});var Up=(e,t,r)=>()=>({method:"POST",path:`/utils/sort/${e}`,body:JSON.stringify({item:t,to:r})});var $p=(e,t,r)=>()=>({path:"/users/invite",method:"POST",body:JSON.stringify({email:e,role:t,...r?{invite_url:r}:{}})}),kp=(e,t)=>()=>({path:"/users/invite/accept",method:"POST",body:JSON.stringify({token:e,password:t})}),Gp=(e,t,r={})=>()=>({path:"/users/register",method:"POST",body:JSON.stringify({email:e,password:t,...r})}),Kp=e=>()=>({path:"/users/register/verify-email",params:{token:e},method:"GET"}),Wp=e=>()=>({path:"/users/me/tfa/generate",method:"POST",body:JSON.stringify({password:e})}),Lp=(e,t)=>()=>({path:"/users/me/tfa/enable",method:"POST",body:JSON.stringify({secret:e,otp:t})}),Hp=e=>()=>({path:"/users/me/tfa/disable",method:"POST",body:JSON.stringify({otp:e})});var _p=(e,t)=>()=>(o(e,"ID cannot be empty"),{path:`/versions/${e}/save`,method:"POST",body:JSON.stringify(t)}),Bp=e=>()=>(o(e,"ID cannot be empty"),{path:`/versions/${e}/compare`,method:"GET"}),qp=(e,t,r)=>()=>(o(e,"ID cannot be empty"),{path:`/versions/${e}/promote`,method:"POST",body:JSON.stringify(r?{mainHash:t,fields:r}:{mainHash:t})});var Xp=e=>()=>({method:"GET",path:"/utils/random/string",params:e!==void 0?{length:e}:{}});var q={},Ru=(e={})=>t=>{let r={...q,...e};return{async request(a){let s=a();if(s.headers||(s.headers={}),"Content-Type"in s.headers?s.headers["Content-Type"]==="multipart/form-data"&&delete s.headers["Content-Type"]:s.headers["Content-Type"]="application/json","getToken"in this){let y=await this.getToken();y&&(s.headers||(s.headers={}),s.headers.Authorization=`Bearer ${y}`)}let p=b(t.url,s.path,s.params),i={method:s.method??"GET",headers:s.headers??{}};"credentials"in r&&(i.credentials=r.credentials),s.body&&(i.body=s.body),s.onRequest&&(i=await s.onRequest(i)),r.onRequest&&(i=await r.onRequest(i));let c=await D(p.toString(),i,t.globals.fetch);return"onResponse"in s&&(c=await s.onResponse(c,i)),"onResponse"in e&&(c=await e.onResponse(c,i)),c}}};function bu(e,t){return()=>{let r=e();return typeof t=="function"?r.onRequest=t:r.onRequest=a=>({...a,...t}),r}}function Pu(e){return()=>{let t=e();return t.method==="GET"&&t.params&&(t.method="SEARCH",t.body=JSON.stringify({query:{...t.params,fields:N(t.params.fields??[])}}),delete t.params),t}}function Iu(e,t){return()=>{let r=t();return e&&(r.headers||(r.headers={}),r.headers.Authorization=`Bearer ${e}`),r}}function Fu(e){return()=>e}export{kp as acceptUserInvite,Ya as aggregate,E as auth,Ep as authenticateShare,ce as authentication,xp as clearCache,Bp as compareContentVersion,ft as createCollection,St as createComment,lr as createContentVersion,Sr as createContentVersions,Tt as createDashboard,xt as createDashboards,fe as createDirectus,Rt as createField,jt as createFlow,Pt as createFlows,Ft as createFolder,At as createFolders,vt as createItem,Nt as createItems,$t as createNotification,Jt as createNotifications,Kt as createOperation,Gt as createOperations,Ht as createPanel,Lt as createPanels,_t as createPermission,Mt as createPermissions,qt as createPolicies,zt as createPolicy,Zt as createPreset,Yt as createPresets,tr as createRelation,ar as createRole,or as createRoles,ir as createShare,mr as createShares,pr as createTranslation,cr as createTranslations,yr as createUser,hr as createUsers,xr as createWebhook,Qr as createWebhooks,Fu as customEndpoint,Vr as deleteCollection,Lr as deleteComment,fa as deleteContentVersion,la as deleteContentVersions,ao as deleteDashboard,oo as deleteDashboards,io as deleteField,uo as deleteFile,po as deleteFiles,lo as deleteFlow,So as deleteFlows,To as deleteFolder,xo as deleteFolders,bo as deleteItem,go as deleteItems,jo as deleteNotification,Po as deleteNotifications,Eo as deleteOperation,Fo as deleteOperations,Uo as deletePanel,vo as deletePanels,Go as deletePermission,ko as deletePermissions,Lo as deletePolicies,Ho as deletePolicy,Bo as deletePreset,_o as deletePresets,Xo as deleteRelation,ta as deleteRole,ea as deleteRoles,sa as deleteShare,aa as deleteShares,ca as deleteTranslation,na as deleteTranslations,ya as deleteUser,ha as deleteUsers,Ca as deleteWebhook,Ta as deleteWebhooks,Hp as disableTwoFactor,Lp as enableTwoFactor,N as formatFields,Dp as generateHash,Wp as generateTwoFactorSecret,w as generateUid,I as getAuthEndpoint,Ce as graphql,Dt as importFile,wp as inviteShare,$p as inviteUser,ze as login,Ye as logout,$ as memoryStorage,F as messageCallback,et as passwordRequest,rt as passwordReset,G as pong,qp as promoteContentVersion,v as queryToParams,Xp as randomString,Ma as readActivities,_a as readActivity,os as readAssetArrayBuffer,rs as readAssetBlob,ts as readAssetRaw,is as readCollection,ms as readCollections,Lm as readContentVersion,Wm as readContentVersions,us as readDashboard,ps as readDashboards,ys as readExtensions,Qs as readField,ls as readFields,fs as readFieldsByCollection,Rs as readFile,Cs as readFiles,Os as readFlow,Ds as readFlows,As as readFolder,Is as readFolders,wi as readGraphqlSdl,Ns as readItem,Xs as readItemPermissions,ws as readItems,km as readMe,$s as readNotification,Js as readNotifications,ki as readOpenApiSpec,Ws as readOperation,Ks as readOperations,Ms as readPanel,Vs as readPanels,zs as readPermission,qs as readPermissions,tm as readPolicies,rm as readPolicy,om as readPolicyGlobals,im as readPreset,mm as readPresets,at as readProviders,hm as readRelation,um as readRelationByCollection,pm as readRelations,lm as readRevision,Sm as readRevisions,Tm as readRole,xm as readRoles,Cm as readRolesMe,gm as readSettings,Pm as readShare,Np as readShareInfo,Om as readShares,Am as readSingleton,Nm as readTranslation,wm as readTranslations,$m as readUser,Ys as readUserPermissions,Jm as readUsers,_m as readWebhook,Mm as readWebhooks,Ue as realtime,mt as refresh,Gp as registerUser,Kp as registerUserVerify,Ru as rest,_p as saveToContentVersion,gi as schemaApply,Di as schemaDiff,Pi as schemaSnapshot,vi as serverHealth,Ji as serverInfo,Ki as serverPing,$e as sleep,ue as staticToken,Q as throwIfCoreCollection,o as throwIfEmpty,gp as triggerFlow,Ap as triggerOperation,Zi as updateCollection,en as updateCollectionsBatch,zi as updateComment,Wc as updateContentVersion,Gc as updateContentVersions,Kc as updateContentVersionsBatch,sn as updateDashboard,on as updateDashboards,an as updateDashboardsBatch,cn as updateExtension,hn as updateField,fn as updateFile,Sn as updateFiles,ln as updateFilesBatch,Rn as updateFlow,Tn as updateFlows,Cn as updateFlowsBatch,Pn as updateFolder,Dn as updateFolders,On as updateFoldersBatch,En as updateItem,An as updateItems,Fn as updateItemsBatch,Jc as updateMe,Jn as updateNotification,vn as updateNotifications,Un as updateNotificationsBatch,Wn as updateOperation,Gn as updateOperations,Kn as updateOperationsBatch,_n as updatePanel,Vn as updatePanels,Mn as updatePanelsBatch,Yn as updatePermission,zn as updatePermissions,Xn as updatePermissionsBatch,tc as updatePolicies,rc as updatePoliciesBatch,oc as updatePolicy,nc as updatePreset,mc as updatePresets,ic as updatePresetsBatch,uc as updateRelation,lc as updateRole,dc as updateRoles,Sc as updateRolesBatch,Qc as updateSettings,gc as updateShare,Cc as updateShares,Rc as updateSharesBatch,Oc as updateSingleton,Fc as updateTranslation,Ic as updateTranslations,Ac as updateTranslationsBatch,Uc as updateUser,Nc as updateUsers,vc as updateUsersBatch,Mc as updateWebhook,Vc as updateWebhooks,bt as uploadFiles,Up as utilitySort,Cp as utilsExport,jp as utilsImport,Op as verifyHash,bu as withOptions,Pu as withSearch,Iu as withToken}; | ||
function F(e){return e?`/auth/login/${e}`:"/auth/login"}var E="/",L=(e,t)=>(e.endsWith(E)&&(e=e.slice(0,-1)),t.startsWith(E)||(t=E+t),e+t),g=(e,t,r)=>{let a=e.pathname===E?t:L(e.pathname,t),s=new globalThis.URL(a,e);if(r)for(let[c,i]of Object.entries(J(r)))if(i&&typeof i=="object"&&!Array.isArray(i))for(let[p,u]of Object.entries(i))s.searchParams.set(`${c}[${p}]`,String(u));else s.searchParams.set(c,i);return s};function $(e){return typeof e!="object"||!e?!1:"headers"in e&&"ok"in e&&"json"in e&&typeof e.json=="function"&&"text"in e&&typeof e.json=="function"}async function k(e){if(!(typeof e!="object"||!e)){if($(e)){let t=e.headers.get("Content-Type")?.toLowerCase();if(t?.startsWith("application/json")||t?.startsWith("application/health+json")){let r=await e.json();if(!e.ok)throw r;return"data"in r?r.data:r}if(t?.startsWith("text/html")||t?.startsWith("text/plain")){let r=await e.text();if(!e.ok)throw r;return r}return e}return"data"in e?e.data:e}}var b=async(e,t,r=globalThis.fetch)=>(t.headers=typeof t.headers=="object"&&!Array.isArray(t.headers)?t.headers:{},r(e,t).then(a=>k(a).catch(s=>{let c=typeof s=="object"&&"errors"in s?s.errors:s;return Promise.reject({errors:c,response:a})})));var G=()=>{let e=null;return{get:async()=>e,set:async t=>{e=t}}};var H={msRefreshBeforeExpires:3e4,autoRefresh:!0},_=2**31-1,ne=(e="cookie",t={})=>r=>{let a={...H,...t},s=null,c=null,i=a.storage??G(),p=async()=>i.set({access_token:null,refresh_token:null,expires:null,expires_at:null}),u=async()=>{try{await s}finally{s=null}},f=async()=>{let h=await i.get();return s||!h?.expires_at||h.expires_at<new Date().getTime()+a.msRefreshBeforeExpires&&I().catch(l=>{}),u()},D=async h=>{let l=h.expires??0;h.expires_at=new Date().getTime()+l,await i.set(h),a.autoRefresh&&l>a.msRefreshBeforeExpires&&l<_&&(c&&clearTimeout(c),c=setTimeout(()=>{c=null,I().catch(Q=>{})},l-a.msRefreshBeforeExpires))},I=async()=>(s=(async()=>{let l=await i.get();await p();let Q={method:"POST",headers:{"Content-Type":"application/json"}};"credentials"in a&&(Q.credentials=a.credentials);let C={mode:e};e==="json"&&l?.refresh_token&&(C.refresh_token=l.refresh_token),Q.body=JSON.stringify(C);let m=g(r.url,"/auth/refresh");return b(m.toString(),Q,r.globals.fetch).then(n=>D(n).then(()=>n))})(),s);return{refresh:I,async login(h,l,Q={}){await p();let C={email:h,password:l};"otp"in Q&&(C.otp=Q.otp),C.mode=Q.mode??e;let m=F(Q.provider),n=g(r.url,m),y={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)};"credentials"in a&&(y.credentials=a.credentials);let d=await b(n.toString(),y,r.globals.fetch);return await D(d),d},async logout(){let h=await i.get(),l={method:"POST",headers:{"Content-Type":"application/json"}};"credentials"in a&&(l.credentials=a.credentials);let Q={mode:e};e==="json"&&h?.refresh_token&&(Q.refresh_token=h.refresh_token),l.body=JSON.stringify(Q);let C=g(r.url,"/auth/logout");await b(C.toString(),l,r.globals.fetch),this.stopRefreshing(),await p()},stopRefreshing(){c&&clearTimeout(c)},async getToken(){return await f().catch(()=>{}),(await i.get())?.access_token??null},async setToken(h){return i.set({access_token:h,refresh_token:null,expires:null,expires_at:null})}}};var pe=e=>t=>{let r=e??null;return{async getToken(){return r},async setToken(a){r=a}}};var K={fetch:globalThis.fetch,WebSocket:globalThis.WebSocket,URL:globalThis.URL,logger:globalThis.console},le=(e,t={})=>{let r=t.globals?{...K,...t.globals}:K;return{globals:r,url:new r.URL(e),with(a){return{...this,...a(this)}}}};var V={},Te=(e={})=>t=>{let r={...V,...e};return{async query(a,s,c="items"){let i={method:"POST",body:JSON.stringify({query:a,variables:s})};"credentials"in r&&(i.credentials=r.credentials);let p={};if("getToken"in this){let D=await this.getToken();D&&(p.Authorization=`Bearer ${D}`)}"Content-Type"in p||(p["Content-Type"]="application/json"),i.headers=p;let u=c==="items"?"/graphql":"/graphql/system",f=g(t.url,u);return await b(f.toString(),i,t.globals.fetch)}}};function N(e){return JSON.stringify({...e,type:"auth"})}var W=()=>JSON.stringify({type:"pong"});function*v(){let e=1;for(;;)yield String(e),e++}var w=(e,t=1e3)=>new Promise((r,a)=>{let s=u=>{try{let f=JSON.parse(u.data);typeof f=="object"&&!Array.isArray(f)&&f!==null?(i(),r(f)):(i(),c())}catch{i(),r(u)}},c=()=>a(),i=()=>{clearTimeout(p),e.removeEventListener("message",s),e.removeEventListener("error",c),e.removeEventListener("close",c)};e.addEventListener("message",s),e.addEventListener("error",c),e.addEventListener("close",c);let p=setTimeout(()=>{i(),r(void 0)},t)});var M={authMode:"handshake",heartbeat:!0,debug:!1,reconnect:{delay:1e3,retries:10}};function ve(e={}){return t=>{e={...M,...e};let r=v(),a={code:"closed"},s={attempts:0,active:!1},c=!1,i=new Set,p=m=>"getToken"in m,u=(m,...n)=>e.debug&&t.globals.logger[m]("[Directus SDK]",...n),f=async(m,n)=>{let y=new t.globals.URL(m);if(e.authMode==="strict"&&p(n)){let d=await n.getToken();d&&y.searchParams.set("access_token",d)}return y.toString()},D=async m=>{if("url"in e)return await f(e.url,m);if(["ws:","wss:"].includes(t.url.protocol))return await f(t.url,m);let n=new t.globals.URL(t.url.toString());return n.protocol=t.url.protocol==="https:"?"wss:":"ws:",n.pathname="/websocket",await f(n,m)},I=m=>{let n=new Promise((y,d)=>{if(!e.reconnect||c)return d();if(u("info",`reconnect #${s.attempts} `+(s.attempts>=e.reconnect.retries?"maximum retries reached":`trying again in ${Math.max(100,e.reconnect.delay)}ms`)),s.active)return s.active;if(s.attempts>=e.reconnect.retries)return d();setTimeout(()=>m.connect().then(O=>(i.forEach(S=>{m.sendMessage(S)}),O)).then(y).catch(d),Math.max(100,e.reconnect.delay))});s.attempts+=1,s.active=n.catch(()=>{}).finally(()=>{s.active=!1})},h={open:new Set([]),error:new Set([]),close:new Set([]),message:new Set([])};function l(m){return"type"in m&&"status"in m&&"error"in m&&"code"in m.error&&"message"in m.error&&m.type==="auth"&&m.status==="error"}async function Q(m,n){if(a.code==="open"){if(m.error.code==="TOKEN_EXPIRED"&&(u("warn","Authentication token expired!"),p(n))){let y=await n.getToken();if(!y)throw Error("No token for re-authenticating the websocket");a.connection.send(N({access_token:y}))}if(m.error.code==="AUTH_TIMEOUT")return a.firstMessage&&e.authMode==="public"?(u("warn",'Authentication failed! Currently the "authMode" is "public" try using "handshake" instead'),e.reconnect=!1):u("warn","Authentication timed out!"),a.connection.close();if(m.error.code==="AUTH_FAILED"){if(a.firstMessage&&e.authMode==="public")return u("warn",'Authentication failed! Currently the "authMode" is "public" try using "handshake" instead'),e.reconnect=!1,a.connection.close();u("warn","Authentication failed!")}}}let C=async m=>{for(;a.code==="open";){let n=await w(a.connection).catch(()=>{});if(n){if(l(n)){await Q(n,m),a.firstMessage=!1;continue}if(e.heartbeat&&n.type==="ping"){a.connection.send(W()),a.firstMessage=!1;continue}h.message.forEach(y=>{a.code==="open"&&y.call(a.connection,n)}),a.firstMessage=!1}}};return{async connect(){if(c=!1,a.code==="connecting")return await a.connection;if(a.code!=="closed")throw new Error(`Cannot connect when state is "${a.code}"`);let m=this,n=await D(m);u("info",`Connecting to ${n}...`);let y=new Promise((d,O)=>{let S=!1,T=new t.globals.WebSocket(n);T.addEventListener("open",async P=>{if(u("info","Connection open."),a={code:"open",connection:T,firstMessage:!0},s.attempts=0,s.active=!1,C(m),e.authMode==="handshake"&&p(m)){let R=await m.getToken();if(!R)throw Error("No token for authenticating the websocket. Make sure to provide one or call the login() function beforehand.");T.send(N({access_token:R}));let A=await w(T);if(A&&"type"in A&&"status"in A&&A.type==="auth"&&A.status==="ok")u("info","Authentication successful!");else return O("Authentication failed while opening websocket connection")}h.open.forEach(R=>R.call(T,P)),S=!0,d(T)}),T.addEventListener("error",P=>{u("warn","Connection errored."),h.error.forEach(R=>R.call(T,P)),T.close(),a={code:"error"},S||O(P)}),T.addEventListener("close",P=>{u("info","Connection closed."),h.close.forEach(R=>R.call(T,P)),r=v(),a={code:"closed"},I(this),S||O(P)})});return a={code:"connecting",connection:y},y},disconnect(){c=!0,a.code==="open"&&a.connection.close()},onWebSocket(m,n){if(m==="message"){let y=function(d){if(typeof d.data!="string")return n.call(this,d);try{return n.call(this,JSON.parse(d.data))}catch{return n.call(this,d)}};return h[m].add(y),()=>h[m].delete(y)}return h[m].add(n),()=>h[m].delete(n)},sendMessage(m){if(a.code!=="open")throw new Error('Cannot send messages without an open connection. Make sure you are calling "await client.connect()".');if(typeof m=="string")return a.connection.send(m);"uid"in m||(m.uid=r.next().value),a.connection.send(JSON.stringify(m))},async subscribe(m,n={}){"uid"in n||(n.uid=r.next().value),i.add({...n,collection:m,type:"subscribe"}),a.code!=="open"&&(u("info","No connection available for subscribing!"),await this.connect()),this.sendMessage({...n,collection:m,type:"subscribe"});let y=!0;async function*d(){for(;y&&a.code==="open";){let S=await w(a.connection).catch(()=>{});if(S){if("type"in S&&"status"in S&&S.type==="subscribe"&&S.status==="error")throw S;"type"in S&&"uid"in S&&S.type==="subscription"&&S.uid===n.uid&&(yield S)}}e.reconnect&&s.active&&(await s.active,a.code==="open"&&(a.connection.send(JSON.stringify({...n,collection:m,type:"subscribe"})),yield*d()))}let O=()=>{i.delete({...n,collection:m,type:"subscribe"}),this.sendMessage({uid:n.uid,type:"unsubscribe"}),y=!1};return{subscription:d(),unsubscribe:O}}}}}var Je=e=>new Promise(t=>setTimeout(()=>t(),e));var qe=(e,t,r={})=>()=>{let a=F(r.provider),s={email:e,password:t};return"otp"in r&&(s.otp=r.otp),s.mode=r.mode??"cookie",{path:a,method:"POST",body:JSON.stringify(s)}};var Xe=(e,t="cookie")=>()=>({path:"/auth/logout",method:"POST",body:JSON.stringify(e?{refresh_token:e,mode:t}:{mode:t})});var Ze=(e,t)=>()=>({path:"/auth/password/request",method:"POST",body:JSON.stringify({email:e,...t?{reset_url:t}:{}})});var tt=(e,t)=>()=>({path:"/auth/password/reset",method:"POST",body:JSON.stringify({token:e,password:t})});var ot=(e=!1)=>()=>({path:e?"/auth?sessionOnly":"/auth",method:"GET"});var st=(e="cookie",t)=>()=>({path:"/auth/refresh",method:"POST",body:JSON.stringify(e==="json"?{refresh_token:t,mode:e}:{mode:e})});var dt=(e,t)=>()=>({path:"/activity/comment",params:t??{},body:JSON.stringify(e),method:"POST"});var lt=(e,t)=>()=>({path:"/collections",params:t??{},body:JSON.stringify(e),method:"POST"});var Qt=(e,t)=>()=>({path:"/dashboards",params:t??{},body:JSON.stringify(e),method:"POST"}),xt=(e,t)=>()=>({path:"/dashboards",params:t??{},body:JSON.stringify(e),method:"POST"});var Ct=(e,t,r)=>()=>({path:`/fields/${e}`,params:r??{},body:JSON.stringify(t),method:"POST"});var gt=(e,t)=>()=>({path:"/files",method:"POST",body:e,params:t??{},headers:{"Content-Type":"multipart/form-data"}}),bt=(e,t={},r)=>()=>({path:"/files/import",method:"POST",body:JSON.stringify({url:e,data:t}),params:r??{}});var Ot=(e,t)=>()=>({path:"/flows",params:t??{},body:JSON.stringify(e),method:"POST"}),Pt=(e,t)=>()=>({path:"/flows",params:t??{},body:JSON.stringify(e),method:"POST"});var It=(e,t)=>()=>({path:"/folders",params:t??{},body:JSON.stringify(e),method:"POST"}),At=(e,t)=>()=>({path:"/folders",params:t??{},body:JSON.stringify(e),method:"POST"});function j(e){return["directus_access","directus_activity","directus_collections","directus_fields","directus_files","directus_folders","directus_migrations","directus_permissions","directus_policies","directus_presets","directus_relations","directus_revisions","directus_roles","directus_sessions","directus_settings","directus_users","directus_webhooks","directus_dashboards","directus_panels","directus_notifications","directus_shares","directus_flows","directus_operations","directus_translations","directus_versions","directus_extensions"].includes(e)}var Nt=(e,t,r)=>()=>{let a=String(e);if(j(a))throw new Error("Cannot use createItems for core collections");return{path:`/items/${a}`,params:r??{},body:JSON.stringify(t),method:"POST"}},vt=(e,t,r)=>()=>{let a=String(e);if(j(a))throw new Error("Cannot use createItem for core collections");return{path:`/items/${a}`,params:r??{},body:JSON.stringify(t),method:"POST"}};var Jt=(e,t)=>()=>({path:"/notifications",params:t??{},body:JSON.stringify(e),method:"POST"}),$t=(e,t)=>()=>({path:"/notifications",params:t??{},body:JSON.stringify(e),method:"POST"});var Gt=(e,t)=>()=>({path:"/operations",params:t??{},body:JSON.stringify(e),method:"POST"}),Kt=(e,t)=>()=>({path:"/operations",params:t??{},body:JSON.stringify(e),method:"POST"});var Lt=(e,t)=>()=>({path:"/panels",params:t??{},body:JSON.stringify(e),method:"POST"}),Ht=(e,t)=>()=>({path:"/panels",params:t??{},body:JSON.stringify(e),method:"POST"});var Vt=(e,t)=>()=>({path:"/permissions",params:t??{},body:JSON.stringify(e),method:"POST"}),Mt=(e,t)=>()=>({path:"/permissions",params:t??{},body:JSON.stringify(e),method:"POST"});var qt=(e,t)=>()=>({path:"/policies",params:t??{},body:JSON.stringify(e),method:"POST"}),zt=(e,t)=>()=>({path:"/policies",params:t??{},body:JSON.stringify(e),method:"POST"});var Yt=(e,t)=>()=>({path:"/presets",params:t??{},body:JSON.stringify(e),method:"POST"}),Zt=(e,t)=>()=>({path:"/presets",params:t??{},body:JSON.stringify(e),method:"POST"});var tr=e=>()=>({path:"/relations",body:JSON.stringify(e),method:"POST"});var or=(e,t)=>()=>({path:"/roles",params:t??{},body:JSON.stringify(e),method:"POST"}),ar=(e,t)=>()=>({path:"/roles",params:t??{},body:JSON.stringify(e),method:"POST"});var mr=(e,t)=>()=>({path:"/shares",params:t??{},body:JSON.stringify(e),method:"POST"}),ir=(e,t)=>()=>({path:"/shares",params:t??{},body:JSON.stringify(e),method:"POST"});var cr=(e,t)=>()=>({path:"/translations",params:t??{},body:JSON.stringify(e),method:"POST"}),pr=(e,t)=>()=>({path:"/translations",params:t??{},body:JSON.stringify(e),method:"POST"});var hr=(e,t)=>()=>({path:"/users",params:t??{},body:JSON.stringify(e),method:"POST"}),yr=(e,t)=>()=>({path:"/users",params:t??{},body:JSON.stringify(e),method:"POST"});var Sr=(e,t)=>()=>({path:"/versions",params:t??{},body:JSON.stringify(e),method:"POST"}),lr=(e,t)=>()=>({path:"/versions",params:t??{},body:JSON.stringify(e),method:"POST"});var Qr=(e,t)=>()=>({path:"/webhooks",params:t??{},body:JSON.stringify(e),method:"POST"}),xr=(e,t)=>()=>({path:"/webhooks",params:t??{},body:JSON.stringify(e),method:"POST"});var Lr=e=>()=>({path:`/activity/comment/${e}`,method:"DELETE"});var _r=e=>()=>({path:`/collections/${e}`,method:"DELETE"});var U=e=>{let t=(r,a=[])=>{if(typeof r=="object"){let s=[];for(let c in r){let i=r[c]??[];if(Array.isArray(i))for(let p of i)s.push(t(p,[...a,c]));else if(typeof i=="object")for(let p of Object.keys(i)){let u=i[p];for(let f of u)s.push(t(f,[...a,`${c}:${p}`]))}}return s.flatMap(c=>c)}return[...a,String(r)].join(".")};return e.flatMap(r=>t(r))},J=e=>{let t={};Array.isArray(e.fields)&&e.fields.length>0&&(t.fields=U(e.fields).join(",")),e.filter&&Object.keys(e.filter).length>0&&(t.filter=JSON.stringify(e.filter)),e.search&&(t.search=e.search),"sort"in e&&e.sort&&(t.sort=typeof e.sort=="string"?e.sort:e.sort.join(",")),typeof e.limit=="number"&&e.limit>=-1&&(t.limit=String(e.limit)),typeof e.offset=="number"&&e.offset>=0&&(t.offset=String(e.offset)),typeof e.page=="number"&&e.page>=1&&(t.page=String(e.page)),e.deep&&Object.keys(e.deep).length>0&&(t.deep=JSON.stringify(e.deep)),e.alias&&Object.keys(e.alias).length>0&&(t.alias=JSON.stringify(e.alias)),e.aggregate&&Object.keys(e.aggregate).length>0&&(t.aggregate=JSON.stringify(e.aggregate)),e.groupBy&&e.groupBy.length>0&&(t.groupBy=e.groupBy.join(","));for(let[r,a]of Object.entries(e))r in t||(typeof a=="string"||typeof a=="number"||typeof a=="boolean"?t[r]=String(a):t[r]=JSON.stringify(a));return t};var o=(e,t)=>{if(e.length===0)throw new Error(t)};var x=(e,t)=>{if(j(String(e)))throw new Error(t)};var oo=e=>()=>(o(e,"Keys cannot be empty"),{path:"/dashboards",body:JSON.stringify(e),method:"DELETE"}),ao=e=>()=>(o(e,"Key cannot be empty"),{path:`/dashboards/${e}`,method:"DELETE"});var io=(e,t)=>()=>(o(e,"Collection cannot be empty"),o(t,"Field cannot be empty"),{path:`/fields/${e}/${t}`,method:"DELETE"});var po=e=>()=>(o(e,"Keys cannot be empty"),{path:"/files",body:JSON.stringify(e),method:"DELETE"}),uo=e=>()=>(o(e,"Key cannot be empty"),{path:`/files/${e}`,method:"DELETE"});var So=e=>()=>(o(e,"Keys cannot be empty"),{path:"/flows",body:JSON.stringify(e),method:"DELETE"}),lo=e=>()=>(o(e,"Key cannot be empty"),{path:`/flows/${e}`,method:"DELETE"});var xo=e=>()=>(o(e,"Keys cannot be empty"),{path:"/folders",body:JSON.stringify(e),method:"DELETE"}),To=e=>()=>(o(e,"Key cannot be empty"),{path:`/folders/${e}`,method:"DELETE"});var go=(e,t)=>()=>{let r={};return o(String(e),"Collection cannot be empty"),x(e,"Cannot use deleteItems for core collections"),Array.isArray(t)?(o(t,"keysOrQuery cannot be empty"),r={keys:t}):(o(Object.keys(t),"keysOrQuery cannot be empty"),r={query:t}),{path:`/items/${e}`,body:JSON.stringify(r),method:"DELETE"}},bo=(e,t)=>()=>(o(String(e),"Collection cannot be empty"),x(e,"Cannot use deleteItem for core collections"),o(String(t),"Key cannot be empty"),{path:`/items/${e}/${t}`,method:"DELETE"});var Po=e=>()=>(o(e,"Keys cannot be empty"),{path:"/notifications",body:JSON.stringify(e),method:"DELETE"}),jo=e=>()=>(o(e,"Key cannot be empty"),{path:`/notifications/${e}`,method:"DELETE"});var Fo=e=>()=>(o(e,"Keys cannot be empty"),{path:"/operations",body:JSON.stringify(e),method:"DELETE"}),Eo=e=>()=>(o(e,"Key cannot be empty"),{path:`/operations/${e}`,method:"DELETE"});var vo=e=>()=>(o(e,"Keys cannot be empty"),{path:"/panels",body:JSON.stringify(e),method:"DELETE"}),Uo=e=>()=>(o(e,"Key cannot be empty"),{path:`/panels/${e}`,method:"DELETE"});var ko=e=>()=>(o(e,"Keys cannot be empty"),{path:"/permissions",body:JSON.stringify(e),method:"DELETE"}),Go=e=>()=>(o(String(e),"Key cannot be empty"),{path:`/permissions/${e}`,method:"DELETE"});var Lo=e=>()=>(o(e,"Keys cannot be empty"),{path:"/policies",body:JSON.stringify(e),method:"DELETE"}),Ho=e=>()=>(o(String(e),"Key cannot be empty"),{path:`/policies/${e}`,method:"DELETE"});var Mo=e=>()=>(o(e,"Keys cannot be empty"),{path:"/presets",body:JSON.stringify(e),method:"DELETE"}),Bo=e=>()=>(o(String(e),"Key cannot be empty"),{path:`/presets/${e}`,method:"DELETE"});var Xo=(e,t)=>()=>(o(e,"Collection cannot be empty"),o(t,"Field cannot be empty"),{path:`/relations/${e}/${t}`,method:"DELETE"});var ea=e=>()=>(o(e,"Keys cannot be empty"),{path:"/roles",body:JSON.stringify(e),method:"DELETE"}),ta=e=>()=>(o(String(e),"Key cannot be empty"),{path:`/roles/${e}`,method:"DELETE"});var aa=e=>()=>(o(e,"Keys cannot be empty"),{path:"/shares",body:JSON.stringify(e),method:"DELETE"}),sa=e=>()=>(o(String(e),"Key cannot be empty"),{path:`/shares/${e}`,method:"DELETE"});var na=e=>()=>(o(e,"Keys cannot be empty"),{path:"/translations",body:JSON.stringify(e),method:"DELETE"}),ca=e=>()=>(o(String(e),"Key cannot be empty"),{path:`/translations/${e}`,method:"DELETE"});var ha=e=>()=>(o(e,"Keys cannot be empty"),{path:"/users",body:JSON.stringify(e),method:"DELETE"}),ya=e=>()=>(o(String(e),"Key cannot be empty"),{path:`/users/${e}`,method:"DELETE"});var la=e=>()=>(o(e,"Keys cannot be empty"),{path:"/versions",body:JSON.stringify(e),method:"DELETE"}),fa=e=>()=>(o(e,"Key cannot be empty"),{path:`/versions/${e}`,method:"DELETE"});var Ta=e=>()=>(o(e,"Keys cannot be empty"),{path:"/webhooks",body:JSON.stringify(e),method:"DELETE"}),Ca=e=>()=>(o(String(e),"Key cannot be empty"),{path:`/webhooks/${e}`,method:"DELETE"});var Va=e=>()=>({path:"/activity",params:e??{},method:"GET"}),Ma=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/activity/${e}`,params:t??{},method:"GET"});var Ya=(e,t)=>()=>{let r=String(e);return o(r,"Collection cannot be empty"),{path:j(r)?`/${r.substring(9)}`:`/items/${r}`,method:"GET",params:{...t.query??{},...t.groupBy?{groupBy:t.groupBy}:{},aggregate:t.aggregate}}};var ts=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/assets/${e}`,params:t??{},method:"GET",onResponse:r=>r.body}),rs=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/assets/${e}`,params:t??{},method:"GET",onResponse:r=>r.blob()}),os=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/assets/${e}`,params:t??{},method:"GET",onResponse:r=>r.arrayBuffer()});var ms=()=>()=>({path:"/collections",method:"GET"}),is=e=>()=>(o(e,"Collection cannot be empty"),{path:`/collections/${e}`,method:"GET"});var ps=e=>()=>({path:"/dashboards",params:e??{},method:"GET"}),us=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/dashboards/${e}`,params:t??{},method:"GET"});var ys=()=>()=>({path:"/extensions/",method:"GET"});var ls=()=>()=>({path:"/fields",method:"GET"}),fs=e=>()=>(o(e,"Collection cannot be empty"),{path:`/fields/${e}`,method:"GET"}),Qs=(e,t)=>()=>(o(e,"Collection cannot be empty"),o(t,"Field cannot be empty"),{path:`/fields/${e}/${t}`,method:"GET"});var Cs=e=>()=>({path:"/files",params:e??{},method:"GET"}),Rs=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/files/${e}`,params:t??{},method:"GET"});var Ds=e=>()=>({path:"/flows",params:e??{},method:"GET"}),Os=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/flows/${e}`,params:t??{},method:"GET"});var Is=e=>()=>({path:"/folders",params:e??{},method:"GET"}),As=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/folders/${e}`,params:t??{},method:"GET"});var ws=(e,t)=>()=>(o(String(e),"Collection cannot be empty"),x(e,"Cannot use readItems for core collections"),{path:`/items/${e}`,params:t??{},method:"GET"}),Ns=(e,t,r)=>()=>(o(String(e),"Collection cannot be empty"),x(e,"Cannot use readItem for core collections"),o(String(t),"Key cannot be empty"),{path:`/items/${e}/${t}`,params:r??{},method:"GET"});var Js=e=>()=>({path:"/notifications",params:e??{},method:"GET"}),$s=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/notifications/${e}`,params:t??{},method:"GET"});var Ks=e=>()=>({path:"/operations",params:e??{},method:"GET"}),Ws=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/operations/${e}`,params:t??{},method:"GET"});var _s=e=>()=>({path:"/panels",params:e??{},method:"GET"}),Vs=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/panels/${e}`,params:t??{},method:"GET"});var qs=e=>()=>({path:"/permissions",params:e??{},method:"GET"}),zs=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/permissions/${e}`,params:t??{},method:"GET"}),Xs=(e,t)=>()=>(o(String(e),"Collection cannot be empty"),{path:`/permissions/me/${t?`${e}/${t}`:`${e}`}`,method:"GET"}),Ys=()=>()=>({path:"/permissions/me",method:"GET"});var tm=e=>()=>({path:"/policies",params:e??{},method:"GET"}),rm=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/policies/${e}`,params:t??{},method:"GET"}),om=()=>()=>({path:"/policies/me/globals",method:"GET"});var mm=e=>()=>({path:"/presets",params:e??{},method:"GET"}),im=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/presets/${e}`,params:t??{},method:"GET"});var pm=()=>()=>({path:"/relations",method:"GET"}),um=e=>()=>({path:`/relations/${e}`,method:"GET"}),hm=(e,t)=>()=>(o(e,"Collection cannot be empty"),o(t,"Field cannot be empty"),{path:`/relations/${e}/${t}`,method:"GET"});var Sm=e=>()=>({path:"/revisions",params:e??{},method:"GET"}),lm=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/revisions/${e}`,params:t??{},method:"GET"});var xm=e=>()=>({path:"/roles",params:e??{},method:"GET"}),Tm=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/roles/${e}`,params:t??{},method:"GET"}),Cm=e=>()=>({path:"/roles/me",params:e??{},method:"GET"});var gm=e=>()=>({path:"/settings",params:e??{},method:"GET"});var Om=e=>()=>({path:"/shares",params:e??{},method:"GET"}),Pm=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/shares/${e}`,params:t??{},method:"GET"});var Am=(e,t)=>()=>(o(String(e),"Collection cannot be empty"),x(e,"Cannot use readSingleton for core collections"),{path:`/items/${e}`,params:t??{},method:"GET"});var wm=e=>()=>({path:"/translations",params:e??{},method:"GET"}),Nm=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/translations/${e}`,params:t??{},method:"GET"});var Jm=e=>()=>({path:"/users",params:e??{},method:"GET"}),$m=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/users/${e}`,params:t??{},method:"GET"}),km=e=>()=>({path:"/users/me",params:e??{},method:"GET"});var Wm=e=>()=>({path:"/versions",params:e??{},method:"GET"}),Lm=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/versions/${e}`,params:t??{},method:"GET"});var Vm=e=>()=>({path:"/webhooks",params:e??{},method:"GET"}),Mm=(e,t)=>()=>(o(String(e),"Key cannot be empty"),{path:`/webhooks/${e}`,params:t??{},method:"GET"});var gi=e=>()=>({method:"POST",path:"/schema/apply",body:JSON.stringify(e)});var Di=(e,t=!1)=>()=>({method:"POST",path:"/schema/diff",params:t?{force:t}:{},body:JSON.stringify(e)});var Pi=()=>()=>({method:"GET",path:"/schema/snapshot"});var wi=(e="item")=>()=>({method:"GET",path:e==="item"?"/server/specs/graphql":"/server/specs/graphql/system"});var vi=()=>()=>({method:"GET",path:"/server/health"});var Ji=()=>()=>({method:"GET",path:"/server/info"});var ki=()=>()=>({method:"GET",path:"/server/specs/oas"});var Ki=()=>()=>({method:"GET",path:"/server/ping"});var zi=(e,t,r)=>()=>(o(String(e),"Key cannot be empty"),{path:`/activity/comment/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var Zi=(e,t,r)=>()=>(o(e,"Collection cannot be empty"),{path:`/collections/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"}),en=(e,t)=>()=>({path:"/collections",params:t??{},body:JSON.stringify(e),method:"PATCH"});var on=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/dashboards",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),an=(e,t)=>()=>({path:"/dashboards",params:t??{},body:JSON.stringify(e),method:"PATCH"}),sn=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/dashboards/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var cn=(e,t,r)=>()=>(e!==null&&o(e,"Bundle cannot be an empty string"),o(t,"Name cannot be empty"),{path:e?`/extensions/${e}/${t}`:`/extensions/${t}`,params:{},body:JSON.stringify(r),method:"PATCH"});var hn=(e,t,r,a)=>()=>(o(e,"Keys cannot be empty"),o(t,"Field cannot be empty"),{path:`/fields/${e}/${t}`,params:a??{},body:JSON.stringify(r),method:"PATCH"});var Sn=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/files",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),ln=(e,t)=>()=>({path:"/files",params:t??{},body:JSON.stringify(e),method:"PATCH"}),fn=(e,t,r)=>()=>(o(e,"Key cannot be empty"),t instanceof FormData?{path:`/files/${e}`,params:r??{},body:t,method:"PATCH",headers:{"Content-Type":"multipart/form-data"}}:{path:`/files/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var Tn=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/flows",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Cn=(e,t)=>()=>({path:"/flows",params:t??{},body:JSON.stringify(e),method:"PATCH"}),Rn=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/flows/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var Dn=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/folders",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),On=(e,t)=>()=>({path:"/folders",params:t??{},body:JSON.stringify(e),method:"PATCH"}),Pn=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/folders/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var An=(e,t,r,a)=>()=>{let s={};return o(String(e),"Collection cannot be empty"),x(e,"Cannot use updateItems for core collections"),Array.isArray(t)?(o(t,"keysOrQuery cannot be empty"),s={keys:t}):(o(Object.keys(t),"keysOrQuery cannot be empty"),s={query:t}),s.data=r,{path:`/items/${e}`,params:a??{},body:JSON.stringify(s),method:"PATCH"}},Fn=(e,t,r)=>()=>(o(String(e),"Collection cannot be empty"),x(e,"Cannot use updateItems for core collections"),{path:`/items/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"}),En=(e,t,r,a)=>()=>(o(String(t),"Key cannot be empty"),o(String(e),"Collection cannot be empty"),x(e,"Cannot use updateItem for core collections"),{path:`/items/${e}/${t}`,params:a??{},body:JSON.stringify(r),method:"PATCH"});var vn=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/notifications",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Un=(e,t)=>()=>({path:"/notifications",params:t??{},body:JSON.stringify(e),method:"PATCH"}),Jn=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/notifications/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var Gn=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/operations",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Kn=(e,t)=>()=>({path:"/operations",params:t??{},body:JSON.stringify(e),method:"PATCH"}),Wn=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/operations/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var _n=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/panels",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Vn=(e,t)=>()=>({path:"/panels",params:t??{},body:JSON.stringify(e),method:"PATCH"}),Mn=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/panels/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var zn=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/permissions",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Xn=(e,t)=>()=>({path:"/permissions",params:t??{},body:JSON.stringify(e),method:"PATCH"}),Yn=(e,t,r)=>()=>(o(String(e),"Key cannot be empty"),{path:`/permissions/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var tc=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/policies",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),rc=(e,t)=>()=>({path:"/policies",params:t??{},body:JSON.stringify(e),method:"PATCH"}),oc=(e,t,r)=>()=>(o(String(e),"Key cannot be empty"),{path:`/policies/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var mc=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/presets",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),ic=(e,t)=>()=>({path:"/presets",params:t??{},body:JSON.stringify(e),method:"PATCH"}),nc=(e,t,r)=>()=>(o(String(e),"Key cannot be empty"),{path:`/presets/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var uc=(e,t,r,a)=>()=>(o(e,"Collection cannot be empty"),o(t,"Field cannot be empty"),{path:`/relations/${e}/${t}`,params:a??{},body:JSON.stringify(r),method:"PATCH"});var dc=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/roles",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Sc=(e,t)=>()=>({path:"/roles",params:t??{},body:JSON.stringify(e),method:"PATCH"}),lc=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/roles/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var Qc=(e,t)=>()=>({path:"/settings",params:t??{},body:JSON.stringify(e),method:"PATCH"});var Cc=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/shares",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Rc=(e,t)=>()=>({path:"/shares",params:t??{},body:JSON.stringify(e),method:"PATCH"}),gc=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/shares/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var Oc=(e,t,r)=>()=>(o(String(e),"Collection cannot be empty"),x(e,"Cannot use updateSingleton for core collections"),{path:`/items/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var Ic=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/translations",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Ac=(e,t)=>()=>({path:"/translations",params:t??{},body:JSON.stringify(e),method:"PATCH"}),Fc=(e,t,r)=>()=>(o(String(e),"Key cannot be empty"),{path:`/translations/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var Nc=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/users",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),vc=(e,t)=>()=>({path:"/users",params:t??{},body:JSON.stringify(e),method:"PATCH"}),Uc=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/users/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"}),Jc=(e,t)=>()=>({path:"/users/me",params:t??{},body:JSON.stringify(e),method:"PATCH"});var Gc=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/versions",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Kc=(e,t)=>()=>({path:"/versions",params:t??{},body:JSON.stringify(e),method:"PATCH"}),Wc=(e,t,r)=>()=>(o(e,"Key cannot be empty"),{path:`/versions/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var _c=(e,t,r)=>()=>(o(e,"Keys cannot be empty"),{path:"/webhooks",params:r??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Vc=(e,t,r)=>()=>(o(String(e),"Key cannot be empty"),{path:`/webhooks/${e}`,params:r??{},body:JSON.stringify(t),method:"PATCH"});var xp=()=>()=>({method:"POST",path:"/utils/cache/clear"});var Cp=(e,t,r,a)=>()=>({method:"POST",path:`/utils/export/${e}`,body:JSON.stringify({format:t,query:r,file:a})});var gp=(e,t,r)=>()=>e==="GET"?{path:`/flows/trigger/${t}`,params:r??{},method:"GET"}:{path:`/flows/trigger/${t}`,body:JSON.stringify(r??{}),method:"POST"};var Dp=e=>()=>({method:"POST",path:"/utils/hash/generate",body:JSON.stringify({string:e})}),Op=(e,t)=>()=>({method:"POST",path:"/utils/hash/verify",body:JSON.stringify({string:e,hash:t})});var jp=(e,t)=>()=>({path:`/utils/import/${e}`,method:"POST",body:t,headers:{"Content-Type":"multipart/form-data"}});var Ap=(e,t)=>()=>({path:`/operations/trigger/${e}`,body:JSON.stringify(t??{}),method:"POST"});var Ep=(e,t,r="cookie")=>()=>({path:"/shares/auth",method:"POST",body:JSON.stringify({share:e,password:t,mode:r})}),wp=(e,t)=>()=>({path:"/shares/invite",method:"POST",body:JSON.stringify({share:e,emails:t})}),Np=e=>()=>({path:`/shares/info/${e}`,method:"GET"});var Up=(e,t,r)=>()=>({method:"POST",path:`/utils/sort/${e}`,body:JSON.stringify({item:t,to:r})});var $p=(e,t,r)=>()=>({path:"/users/invite",method:"POST",body:JSON.stringify({email:e,role:t,...r?{invite_url:r}:{}})}),kp=(e,t)=>()=>({path:"/users/invite/accept",method:"POST",body:JSON.stringify({token:e,password:t})}),Gp=(e,t,r={})=>()=>({path:"/users/register",method:"POST",body:JSON.stringify({email:e,password:t,...r})}),Kp=e=>()=>({path:"/users/register/verify-email",params:{token:e},method:"GET"}),Wp=e=>()=>({path:"/users/me/tfa/generate",method:"POST",body:JSON.stringify({password:e})}),Lp=(e,t)=>()=>({path:"/users/me/tfa/enable",method:"POST",body:JSON.stringify({secret:e,otp:t})}),Hp=e=>()=>({path:"/users/me/tfa/disable",method:"POST",body:JSON.stringify({otp:e})});var Mp=(e,t)=>()=>(o(e,"ID cannot be empty"),{path:`/versions/${e}/save`,method:"POST",body:JSON.stringify(t)}),Bp=e=>()=>(o(e,"ID cannot be empty"),{path:`/versions/${e}/compare`,method:"GET"}),qp=(e,t,r)=>()=>(o(e,"ID cannot be empty"),{path:`/versions/${e}/promote`,method:"POST",body:JSON.stringify(r?{mainHash:t,fields:r}:{mainHash:t})});var Xp=e=>()=>({method:"GET",path:"/utils/random/string",params:e!==void 0?{length:e}:{}});var B={},Ru=(e={})=>t=>{let r={...B,...e};return{async request(a){let s=a();if(s.headers||(s.headers={}),"Content-Type"in s.headers?s.headers["Content-Type"]==="multipart/form-data"&&delete s.headers["Content-Type"]:s.headers["Content-Type"]="application/json","getToken"in this){let u=await this.getToken();u&&(s.headers||(s.headers={}),s.headers.Authorization=`Bearer ${u}`)}let c=g(t.url,s.path,s.params),i={method:s.method??"GET",headers:s.headers??{}};"credentials"in r&&(i.credentials=r.credentials),s.body&&(i.body=s.body),s.onRequest&&(i=await s.onRequest(i)),r.onRequest&&(i=await r.onRequest(i));let p=await b(c.toString(),i,t.globals.fetch);return"onResponse"in s&&(p=await s.onResponse(p,i)),"onResponse"in e&&(p=await e.onResponse(p,i)),p}}};function bu(e,t){return()=>{let r=e();return typeof t=="function"?r.onRequest=t:r.onRequest=a=>({...a,...t}),r}}function Pu(e){return()=>{let t=e();return t.method==="GET"&&t.params&&(t.method="SEARCH",t.body=JSON.stringify({query:{...t.params,fields:U(t.params.fields??[])}}),delete t.params),t}}function Iu(e,t){return()=>{let r=t();return e&&(r.headers||(r.headers={}),r.headers.Authorization=`Bearer ${e}`),r}}function Fu(e){return()=>e}export{kp as acceptUserInvite,Ya as aggregate,N as auth,Ep as authenticateShare,ne as authentication,xp as clearCache,Bp as compareContentVersion,lt as createCollection,dt as createComment,lr as createContentVersion,Sr as createContentVersions,xt as createDashboard,Qt as createDashboards,le as createDirectus,Ct as createField,Pt as createFlow,Ot as createFlows,At as createFolder,It as createFolders,vt as createItem,Nt as createItems,$t as createNotification,Jt as createNotifications,Kt as createOperation,Gt as createOperations,Ht as createPanel,Lt as createPanels,Mt as createPermission,Vt as createPermissions,qt as createPolicies,zt as createPolicy,Zt as createPreset,Yt as createPresets,tr as createRelation,ar as createRole,or as createRoles,ir as createShare,mr as createShares,pr as createTranslation,cr as createTranslations,yr as createUser,hr as createUsers,xr as createWebhook,Qr as createWebhooks,Fu as customEndpoint,_r as deleteCollection,Lr as deleteComment,fa as deleteContentVersion,la as deleteContentVersions,ao as deleteDashboard,oo as deleteDashboards,io as deleteField,uo as deleteFile,po as deleteFiles,lo as deleteFlow,So as deleteFlows,To as deleteFolder,xo as deleteFolders,bo as deleteItem,go as deleteItems,jo as deleteNotification,Po as deleteNotifications,Eo as deleteOperation,Fo as deleteOperations,Uo as deletePanel,vo as deletePanels,Go as deletePermission,ko as deletePermissions,Lo as deletePolicies,Ho as deletePolicy,Bo as deletePreset,Mo as deletePresets,Xo as deleteRelation,ta as deleteRole,ea as deleteRoles,sa as deleteShare,aa as deleteShares,ca as deleteTranslation,na as deleteTranslations,ya as deleteUser,ha as deleteUsers,Ca as deleteWebhook,Ta as deleteWebhooks,Hp as disableTwoFactor,Lp as enableTwoFactor,U as formatFields,Dp as generateHash,Wp as generateTwoFactorSecret,v as generateUid,F as getAuthEndpoint,Te as graphql,bt as importFile,wp as inviteShare,$p as inviteUser,qe as login,Xe as logout,G as memoryStorage,w as messageCallback,Ze as passwordRequest,tt as passwordReset,W as pong,qp as promoteContentVersion,J as queryToParams,Xp as randomString,Va as readActivities,Ma as readActivity,os as readAssetArrayBuffer,rs as readAssetBlob,ts as readAssetRaw,is as readCollection,ms as readCollections,Lm as readContentVersion,Wm as readContentVersions,us as readDashboard,ps as readDashboards,ys as readExtensions,Qs as readField,ls as readFields,fs as readFieldsByCollection,Rs as readFile,Cs as readFiles,Os as readFlow,Ds as readFlows,As as readFolder,Is as readFolders,wi as readGraphqlSdl,Ns as readItem,Xs as readItemPermissions,ws as readItems,km as readMe,$s as readNotification,Js as readNotifications,ki as readOpenApiSpec,Ws as readOperation,Ks as readOperations,Vs as readPanel,_s as readPanels,zs as readPermission,qs as readPermissions,tm as readPolicies,rm as readPolicy,om as readPolicyGlobals,im as readPreset,mm as readPresets,ot as readProviders,hm as readRelation,um as readRelationByCollection,pm as readRelations,lm as readRevision,Sm as readRevisions,Tm as readRole,xm as readRoles,Cm as readRolesMe,gm as readSettings,Pm as readShare,Np as readShareInfo,Om as readShares,Am as readSingleton,Nm as readTranslation,wm as readTranslations,$m as readUser,Ys as readUserPermissions,Jm as readUsers,Mm as readWebhook,Vm as readWebhooks,ve as realtime,st as refresh,Gp as registerUser,Kp as registerUserVerify,Ru as rest,Mp as saveToContentVersion,gi as schemaApply,Di as schemaDiff,Pi as schemaSnapshot,vi as serverHealth,Ji as serverInfo,Ki as serverPing,Je as sleep,pe as staticToken,x as throwIfCoreCollection,o as throwIfEmpty,gp as triggerFlow,Ap as triggerOperation,Zi as updateCollection,en as updateCollectionsBatch,zi as updateComment,Wc as updateContentVersion,Gc as updateContentVersions,Kc as updateContentVersionsBatch,sn as updateDashboard,on as updateDashboards,an as updateDashboardsBatch,cn as updateExtension,hn as updateField,fn as updateFile,Sn as updateFiles,ln as updateFilesBatch,Rn as updateFlow,Tn as updateFlows,Cn as updateFlowsBatch,Pn as updateFolder,Dn as updateFolders,On as updateFoldersBatch,En as updateItem,An as updateItems,Fn as updateItemsBatch,Jc as updateMe,Jn as updateNotification,vn as updateNotifications,Un as updateNotificationsBatch,Wn as updateOperation,Gn as updateOperations,Kn as updateOperationsBatch,Mn as updatePanel,_n as updatePanels,Vn as updatePanelsBatch,Yn as updatePermission,zn as updatePermissions,Xn as updatePermissionsBatch,tc as updatePolicies,rc as updatePoliciesBatch,oc as updatePolicy,nc as updatePreset,mc as updatePresets,ic as updatePresetsBatch,uc as updateRelation,lc as updateRole,dc as updateRoles,Sc as updateRolesBatch,Qc as updateSettings,gc as updateShare,Cc as updateShares,Rc as updateSharesBatch,Oc as updateSingleton,Fc as updateTranslation,Ic as updateTranslations,Ac as updateTranslationsBatch,Uc as updateUser,Nc as updateUsers,vc as updateUsersBatch,Vc as updateWebhook,_c as updateWebhooks,gt as uploadFiles,Up as utilitySort,Cp as utilsExport,jp as utilsImport,Op as verifyHash,bu as withOptions,Pu as withSearch,Iu as withToken}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@directus/sdk", | ||
"version": "16.2.0-rc.1", | ||
"version": "17.0.0", | ||
"description": "Directus JavaScript SDK", | ||
@@ -25,11 +25,10 @@ "homepage": "https://directus.io", | ||
], | ||
"dependencies": { | ||
"@directus/system-data": "2.0.0-rc.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node-fetch": "2.6.11", | ||
"tsup": "8.1.0", | ||
"tsup": "8.2.2", | ||
"esbuild-plugin-replace": "1.4.0", | ||
"typescript": "5.4.5", | ||
"vitest": "1.5.3", | ||
"@directus/tsconfig": "1.0.1" | ||
"@directus/system-data": "2.0.0", | ||
"@directus/tsconfig": "2.0.0" | ||
}, | ||
@@ -36,0 +35,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
535152
0
3634
0
7
- Removed@directus/system-data@2.0.0-rc.1
- Removed@directus/system-data@2.0.0-rc.1(transitive)