@directus/sdk
Advanced tools
Comparing version 14.0.0 to 15.0.0
@@ -1,2 +0,2 @@ | ||
import{$ as fa,$a as fb,$b as fc,A as G,Aa as Ga,Ab as Gb,Ac as Gc,B as H,Ba as Ha,Bb as Hb,Bc as Hc,C as I,Ca as Ia,Cb as Ib,Cc as Ic,D as J,Da as Ja,Db as Jb,Dc as Jc,E as K,Ea as Ka,Eb as Kb,Ec as Kc,F as L,Fa as La,Fb as Lb,Fc as Lc,G as M,Ga as Ma,Gb as Mb,Gc as Mc,H as N,Ha as Na,Hb as Nb,Hc as Nc,I as O,Ia as Oa,Ib as Ob,Ic as Oc,J as P,Ja as Pa,Jb as Pb,Jc as Pc,K as Q,Ka as Qa,Kb as Qb,Kc as Qc,L as R,La as Ra,Lb as Rb,Lc as Rc,M as S,Ma as Sa,Mb as Sb,Mc as Sc,N as T,Na as Ta,Nb as Tb,Nc as Tc,O as U,Oa as Ua,Ob as Ub,Oc as Uc,P as V,Pa as Va,Pb as Vb,Pc as Vc,Q as W,Qa as Wa,Qb as Wb,Qc as Wc,R as X,Ra as Xa,Rb as Xb,Rc as Xc,S as Y,Sa as Ya,Sb as Yb,Sc as Yc,T as Z,Ta as Za,Tb as Zb,Tc as Zc,U as _,Ua as _a,Ub as _b,Uc as _c,V as $,Va as $a,Vb as $b,W as aa,Wa as ab,Wb as ac,X as ba,Xa as bb,Xb as bc,Y as ca,Ya as cb,Yb as cc,Z as da,Za as db,Zb as dc,_ as ea,_a as eb,_b as ec,a,aa as ga,ab as gb,ac as gc,b,ba as ha,bb as hb,bc as hc,c,ca as ia,cb as ib,cc as ic,d,da as ja,db as jb,dc as jc,e,ea as ka,eb as kb,ec as kc,f as l,fa as la,fb as lb,fc as lc,g as m,ga as ma,gb as mb,gc as mc,h as n,ha as na,hb as nb,hc as nc,i as o,ia as oa,ib as ob,ic as oc,j as p,ja as pa,jb as pb,jc as pc,k as q,ka as qa,kb as qb,kc as qc,l as r,la as ra,lb as rb,lc as rc,m as s,ma as sa,mb as sb,mc as sc,n as t,na as ta,nb as tb,nc as tc,o as u,oa as ua,ob as ub,oc as uc,p as v,pa as va,pb as vb,pc as vc,q as w,qa as wa,qb as wb,qc as wc,r as x,ra as xa,rb as xb,rc as xc,s as y,sa as ya,sb as yb,sc as yc,t as z,ta as za,tb as zb,tc as zc,u as A,ua as Aa,ub as Ab,uc as Ac,v as B,va as Ba,vb as Bb,vc as Bc,w as C,wa as Ca,wb as Cb,wc as Cc,x as D,xa as Da,xb as Db,xc as Dc,y as E,ya as Ea,yb as Eb,yc as Ec,z as F,za as Fa,zb as Fb,zc as Fc}from"./chunk-LDFD35JM.js";import{a as f,b as g,c as h,d as i,e as j,f as k}from"./chunk-ARANAX6L.js";export{Qc as acceptUserInvite,Oa as aggregate,f as auth,Lc as authenticateShare,b as authentication,Ec as clearCache,Vc as compareContentVersion,s as createCollection,r as createComment,Y as createContentVersion,X as createContentVersions,u as createDashboard,t as createDashboards,d as createDirectus,v as createField,z as createFlow,y as createFlows,B as createFolder,A as createFolders,D as createItem,C as createItems,F as createNotification,E as createNotifications,H as createOperation,G as createOperations,J as createPanel,I as createPanels,L as createPermission,K as createPermissions,N as createPreset,M as createPresets,O as createRelation,Q as createRole,P as createRoles,S as createShare,R as createShares,U as createTranslation,T as createTranslations,W as createUser,V as createUsers,_ as createWebhook,Z as createWebhooks,aa as deleteCollection,$ as deleteComment,Ja as deleteContentVersion,Ia as deleteContentVersions,fa as deleteDashboard,ea as deleteDashboards,ga as deleteField,ia as deleteFile,ha as deleteFiles,ka as deleteFlow,ja as deleteFlows,ma as deleteFolder,la as deleteFolders,oa as deleteItem,na as deleteItems,qa as deleteNotification,pa as deleteNotifications,sa as deleteOperation,ra as deleteOperations,ua as deletePanel,ta as deletePanels,wa as deletePermission,va as deletePermissions,ya as deletePreset,xa as deletePresets,za as deleteRelation,Ba as deleteRole,Aa as deleteRoles,Da as deleteShare,Ca as deleteShares,Fa as deleteTranslation,Ea as deleteTranslations,Ha as deleteUser,Ga as deleteUsers,La as deleteWebhook,Ka as deleteWebhooks,Tc as disableTwoFactor,Sc as enableTwoFactor,Hc as generateHash,Rc as generateTwoFactorSecret,i as generateUid,e as graphql,x as importFile,Mc as inviteShare,Pc as inviteUser,l as login,m as logout,a as memoryStorage,h as messageCallback,n as passwordRequest,o as passwordReset,g as pong,Wc as promoteContentVersion,ba as queryToParams,Ma as readActivities,Na as readActivity,Ra as readAssetArrayBuffer,Qa as readAssetBlob,Pa as readAssetRaw,Ta as readCollection,Sa as readCollections,Hb as readContentVersion,Gb as readContentVersions,Va as readDashboard,Ua as readDashboards,Wa as readExtensions,Za as readField,Xa as readFields,Ya as readFieldsByCollection,$a as readFile,_a as readFiles,bb as readFlow,ab as readFlows,db as readFolder,cb as readFolders,Nb as readGraphqlSdl,fb as readItem,eb as readItems,Fb as readMe,hb as readNotification,gb as readNotifications,Qb as readOpenApiSpec,jb as readOperation,ib as readOperations,lb as readPanel,kb as readPanels,nb as readPermission,mb as readPermissions,pb as readPreset,ob as readPresets,p as readProviders,sb as readRelation,rb as readRelationByCollection,qb as readRelations,ub as readRevision,tb as readRevisions,wb as readRole,vb as readRoles,xb as readSettings,zb as readShare,Nc as readShareInfo,yb as readShares,Ab as readSingleton,Cb as readTranslation,Bb as readTranslations,Eb as readUser,Db as readUsers,Jb as readWebhook,Ib as readWebhooks,j as realtime,q as refresh,Xc as rest,Uc as saveToContentVersion,Kb as schemaApply,Lb as schemaDiff,Mb as schemaSnapshot,Ob as serverHealth,Pb as serverInfo,Rb as serverPing,k as sleep,c as staticToken,da as throwIfCoreCollection,ca as throwIfEmpty,Gc as triggerFlow,Kc as triggerOperation,Tb as updateCollection,Sb as updateComment,Bc as updateContentVersion,Ac as updateContentVersions,Vb as updateDashboard,Ub as updateDashboards,Wb as updateExtension,Xb as updateField,Zb as updateFile,Yb as updateFiles,$b as updateFlow,_b as updateFlows,bc as updateFolder,ac as updateFolders,dc as updateItem,cc as updateItems,zc as updateMe,fc as updateNotification,ec as updateNotifications,hc as updateOperation,gc as updateOperations,jc as updatePanel,ic as updatePanels,lc as updatePermission,kc as updatePermissions,nc as updatePreset,mc as updatePresets,oc as updateRelation,qc as updateRole,pc as updateRoles,rc as updateSettings,tc as updateShare,sc as updateShares,uc as updateSingleton,wc as updateTranslation,vc as updateTranslations,yc as updateUser,xc as updateUsers,Dc as updateWebhook,Cc as updateWebhooks,w as uploadFiles,Oc as utilitySort,Fc as utilsExport,Jc as utilsImport,Ic as verifyHash,Yc as withOptions,Zc as withSearch,_c as withToken}; | ||
var I="/",W=(e,t)=>(e.endsWith(I)&&(e=e.slice(0,-1)),t.startsWith(I)||(t=I+t),e+t),j=(e,t,o)=>{let s=e.pathname===I?t:W(e.pathname,t),a=new globalThis.URL(s,e);if(o)for(let[p,c]of Object.entries(N(o)))if(c&&typeof c=="object"&&!Array.isArray(c))for(let[i,h]of Object.entries(c))a.searchParams.set(`${p}[${i}]`,String(h));else a.searchParams.set(p,c);return a};function v(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 U(e){if(!(typeof e!="object"||!e)){if(v(e)){let t=e.headers.get("Content-Type")?.toLowerCase();if(t?.startsWith("application/json")||t?.startsWith("application/health+json")){let o=await e.json();if(!e.ok)throw o;return"data"in o?o.data:o}if(t?.startsWith("text/html")||t?.startsWith("text/plain")){let o=await e.text();if(!e.ok)throw o;return o}return e}return"data"in e?e.data:e}}var R=async(e,t,o=globalThis.fetch)=>{t.headers=typeof t.headers=="object"&&!Array.isArray(t.headers)?t.headers:{};let s=await o(e,t);return U(s).catch(a=>{throw{errors:typeof a=="object"&&"errors"in a?a.errors:a,response:s}})};var J=()=>{let e=null;return{get:async()=>e,set:async t=>{e=t}}};var K={msRefreshBeforeExpires:3e4,autoRefresh:!0},re=(e="cookie",t={})=>o=>{let s={...K,...t},a=null,p=null,c=s.storage??J(),i=()=>{c.set({access_token:null,refresh_token:null,expires:null,expires_at:null})},h=async()=>{try{await a}finally{a=null}},f=async()=>{let y=await c.get();if(a||!y?.expires_at){await h();return}y.expires_at<new Date().getTime()+s.msRefreshBeforeExpires&&Q().catch(u=>{}),await h()},g=y=>{let u=y.expires??0;y.expires_at=new Date().getTime()+u,c.set(y),s.autoRefresh&&u>s.msRefreshBeforeExpires&&u<Number.MAX_SAFE_INTEGER&&(p&&clearTimeout(p),p=setTimeout(()=>{p=null,Q().catch(b=>{})},u-s.msRefreshBeforeExpires))},Q=async()=>(a=(async()=>{let u=await c.get();i();let b={method:"POST",headers:{"Content-Type":"application/json"}};"credentials"in s&&(b.credentials=s.credentials);let m={mode:e};e==="json"&&u?.refresh_token&&(m.refresh_token=u.refresh_token),b.body=JSON.stringify(m);let n=j(o.url,"/auth/refresh"),d=await R(n.toString(),b,o.globals.fetch);return g(d),d})().catch(u=>{throw u}),a);return{refresh:Q,async login(y,u,b={}){i();let m=j(o.url,"/auth/login"),n={email:y,password:u};"otp"in b&&(n.otp=b.otp),n.mode=b.mode??e;let d={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)};"credentials"in s&&(d.credentials=s.credentials);let l=await R(m.toString(),d,o.globals.fetch);return g(l),l},async logout(){let y=await c.get(),u={method:"POST",headers:{"Content-Type":"application/json"}};"credentials"in s&&(u.credentials=s.credentials),e==="json"&&y?.refresh_token&&(u.body=JSON.stringify({refresh_token:y.refresh_token}));let b=j(o.url,"/auth/logout");await R(b.toString(),u,o.globals.fetch),p&&clearTimeout(p),i()},async getToken(){return await f(),(await c.get())?.access_token??null},setToken(y){c.set({access_token:y,refresh_token:null,expires:null,expires_at:null})}}};var se=e=>t=>{let o=e??null;return{async getToken(){return o},setToken(s){o=s}}};var $={fetch:globalThis.fetch,WebSocket:globalThis.WebSocket,URL:globalThis.URL,logger:globalThis.console},pe=(e,t={})=>{let o=t.globals?{...$,...t.globals}:$;return{globals:o,url:new o.URL(e),with(s){return{...this,...s(this)}}}};var G={},ye=(e={})=>t=>{let o={...G,...e};return{async query(s,a,p="items"){let c={method:"POST",body:JSON.stringify({query:s,variables:a})};"credentials"in o&&(c.credentials=o.credentials);let i={};if("getToken"in this){let g=await this.getToken();g&&(i.Authorization=`Bearer ${g}`)}"Content-Type"in i||(i["Content-Type"]="application/json"),c.headers=i;let h=p==="items"?"/graphql":"/graphql/system",f=j(t.url,h);return await R(f.toString(),c,t.globals.fetch)}}};function E(e){return JSON.stringify({...e,type:"auth"})}var k=()=>JSON.stringify({type:"pong"});var F=(e,t=1e3)=>new Promise((o,s)=>{let a=h=>{try{let f=JSON.parse(h.data);typeof f=="object"&&!Array.isArray(f)&&f!==null?(c(),o(f)):(c(),p())}catch{c(),o(h)}},p=()=>s(),c=()=>{clearTimeout(i),e.removeEventListener("message",a),e.removeEventListener("error",p),e.removeEventListener("close",p)};e.addEventListener("message",a),e.addEventListener("error",p),e.addEventListener("close",p);let i=setTimeout(()=>{c(),o(void 0)},t)});function*A(){let e=1;for(;;)yield String(e),e++}var L={authMode:"handshake",heartbeat:!0,debug:!1,reconnect:{delay:1e3,retries:10}};function Ie(e={}){return t=>{e={...L,...e};let o=A(),s={code:"closed"},a={attempts:0,active:!1},p=new Set,c=m=>"getToken"in m,i=(m,...n)=>e.debug&&t.globals.logger[m]("[Directus SDK]",...n),h=async(m,n)=>{if(e.authMode==="strict"&&c(n)){let d=await n.getToken();d&&m.searchParams.set("access_token",d)}return m},f=async m=>{if("url"in e)return await h(new t.globals.URL(e.url),m);if(["ws:","wss:"].includes(t.url.protocol))return await h(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 h(n,m)},g=m=>{let n=new Promise((d,l)=>{if(!e.reconnect)return l();if(i("info",`reconnect #${a.attempts} `+(a.attempts>=e.reconnect.retries?"maximum retries reached":`trying again in ${Math.max(100,e.reconnect.delay)}ms`)),a.active)return a.active;if(a.attempts>=e.reconnect.retries)return l();setTimeout(()=>m.connect().then(D=>(p.forEach(S=>{m.sendMessage(S)}),D)).then(d).catch(l),Math.max(100,e.reconnect.delay))});a.attempts+=1,a.active=n.catch(()=>{}).finally(()=>{a.active=!1})},Q={open:new Set([]),error:new Set([]),close:new Set([]),message:new Set([])};function y(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 u(m,n){if(s.code==="open"){if(m.error.code==="TOKEN_EXPIRED"&&(i("warn","Authentication token expired!"),c(n))){let d=await n.getToken();if(!d)throw Error("No token for re-authenticating the websocket");s.connection.send(E({access_token:d}))}if(m.error.code==="AUTH_TIMEOUT")return s.firstMessage&&e.authMode==="public"?(i("warn",'Authentication failed! Currently the "authMode" is "public" try using "handshake" instead'),e.reconnect=!1):i("warn","Authentication timed out!"),s.connection.close();if(m.error.code==="AUTH_FAILED"){if(s.firstMessage&&e.authMode==="public")return i("warn",'Authentication failed! Currently the "authMode" is "public" try using "handshake" instead'),e.reconnect=!1,s.connection.close();i("warn","Authentication failed!")}}}let b=async m=>{for(;s.code==="open";){let n=await F(s.connection).catch(()=>{});if(n){if(y(n)){await u(n,m),s.firstMessage=!1;continue}if(e.heartbeat&&n.type==="ping"){s.connection.send(k()),s.firstMessage=!1;continue}Q.message.forEach(d=>{s.code==="open"&&d.call(s.connection,n)}),s.firstMessage=!1}}};return{async connect(){if(s.code==="connecting")return await s.connection;if(s.code!=="closed")throw new Error(`Cannot connect when state is "${s.code}"`);let m=this,n=await f(m);i("info",`Connecting to ${n}...`);let d=new Promise((l,D)=>{let S=!1,T=new t.globals.WebSocket(n);T.addEventListener("open",async O=>{if(i("info","Connection open."),e.authMode==="handshake"&&c(m)){let C=await m.getToken();if(!C)throw Error("No token for authenticating the websocket. Make sure to provide one or call the login() function beforehand.");T.send(E({access_token:C}));let P=await F(T);if(P&&"type"in P&&"status"in P&&P.type==="auth"&&P.status==="ok")i("info","Authentication successful!");else return D("Authentication failed while opening websocket connection")}s={code:"open",connection:T,firstMessage:!0},a.attempts=0,a.active=!1,Q.open.forEach(C=>C.call(T,O)),b(m),S=!0,l(T)}),T.addEventListener("error",O=>{i("warn","Connection errored."),Q.error.forEach(C=>C.call(T,O)),T.close(),s={code:"error"},S||D(O)}),T.addEventListener("close",O=>{i("info","Connection closed."),Q.close.forEach(C=>C.call(T,O)),o=A(),s={code:"closed"},g(this),S||D(O)})});return s={code:"connecting",connection:d},d},disconnect(){s.code==="open"&&s.connection.close()},onWebSocket(m,n){if(m==="message"){let d=function(l){if(typeof l.data!="string")return n.call(this,l);try{return n.call(this,JSON.parse(l.data))}catch{return n.call(this,l)}};return Q[m].add(d),()=>Q[m].delete(d)}return Q[m].add(n),()=>Q[m].delete(n)},sendMessage(m){if(s.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 s.connection.send(m);"uid"in m||(m.uid=o.next().value),s.connection.send(JSON.stringify(m))},async subscribe(m,n={}){"uid"in n||(n.uid=o.next().value),p.add({...n,collection:m,type:"subscribe"}),s.code!=="open"&&(i("info","No connection available for subscribing!"),await this.connect()),this.sendMessage({...n,collection:m,type:"subscribe"});let d=!0;async function*l(){for(;d&&s.code==="open";){let S=await F(s.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&&a.active&&(await a.active,s.code==="open"&&(s.connection.send(JSON.stringify({...n,collection:m,type:"subscribe"})),yield*l()))}let D=()=>{p.delete({...n,collection:m,type:"subscribe"}),this.sendMessage({uid:n.uid,type:"unsubscribe"}),d=!1};return{subscription:l(),unsubscribe:D}}}}}var Ee=e=>new Promise(t=>setTimeout(()=>t(),e));var Ge=(e,t,o={})=>()=>{let s={email:e,password:t};return"otp"in o&&(s.otp=o.otp),s.mode=o.mode??"cookie",{path:"/auth/login",method:"POST",body:JSON.stringify(s)}};var He=e=>()=>({path:"/auth/logout",method:"POST",body:JSON.stringify(e?{refresh_token:e}:{})});var Me=(e,t)=>()=>({path:"/auth/password/request",method:"POST",body:JSON.stringify({email:e,...t?{reset_url:t}:{}})});var Be=(e,t)=>()=>({path:"/auth/password/reset",method:"POST",body:JSON.stringify({token:e,password:t})});var ze=()=>()=>({path:"/auth",method:"GET"});var Ye=(e="cookie",t)=>()=>({path:"/auth/refresh",method:"POST",body:JSON.stringify(e==="json"?{refresh_token:t,mode:e}:{mode:e})});var nt=(e,t)=>()=>({path:"/activity/comment",params:t??{},body:JSON.stringify(e),method:"POST"});var it=(e,t)=>()=>({path:"/collections",params:t??{},body:JSON.stringify(e),method:"POST"});var dt=(e,t)=>()=>({path:"/dashboards",params:t??{},body:JSON.stringify(e),method:"POST"}),ht=(e,t)=>()=>({path:"/dashboards",params:t??{},body:JSON.stringify(e),method:"POST"});var yt=(e,t,o)=>()=>({path:`/fields/${e}`,params:o??{},body:JSON.stringify(t),method:"POST"});var lt=(e,t)=>()=>({path:"/files",method:"POST",body:e,params:t??{},headers:{"Content-Type":"multipart/form-data"}}),ft=(e,t={},o)=>()=>({path:"/files/import",method:"POST",body:JSON.stringify({url:e,data:t}),params:o??{}});var Qt=(e,t)=>()=>({path:"/flows",params:t??{},body:JSON.stringify(e),method:"POST"}),bt=(e,t)=>()=>({path:"/flows",params:t??{},body:JSON.stringify(e),method:"POST"});var Ct=(e,t)=>()=>({path:"/folders",params:t??{},body:JSON.stringify(e),method:"POST"}),jt=(e,t)=>()=>({path:"/folders",params:t??{},body:JSON.stringify(e),method:"POST"});var gt=(e,t,o)=>()=>{let s=String(e);if(s.startsWith("directus_"))throw new Error("Cannot use createItems for core collections");return{path:`/items/${s}`,params:o??{},body:JSON.stringify(t),method:"POST"}},Dt=(e,t,o)=>()=>{let s=String(e);if(s.startsWith("directus_"))throw new Error("Cannot use createItem for core collections");return{path:`/items/${s}`,params:o??{},body:JSON.stringify(t),method:"POST"}};var Pt=(e,t)=>()=>({path:"/notifications",params:t??{},body:JSON.stringify(e),method:"POST"}),It=(e,t)=>()=>({path:"/notifications",params:t??{},body:JSON.stringify(e),method:"POST"});var Et=(e,t)=>()=>({path:"/operations",params:t??{},body:JSON.stringify(e),method:"POST"}),At=(e,t)=>()=>({path:"/operations",params:t??{},body:JSON.stringify(e),method:"POST"});var Nt=(e,t)=>()=>({path:"/panels",params:t??{},body:JSON.stringify(e),method:"POST"}),vt=(e,t)=>()=>({path:"/panels",params:t??{},body:JSON.stringify(e),method:"POST"});var Jt=(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 Wt=(e,t)=>()=>({path:"/presets",params:t??{},body:JSON.stringify(e),method:"POST"}),Kt=(e,t)=>()=>({path:"/presets",params:t??{},body:JSON.stringify(e),method:"POST"});var Lt=e=>()=>({path:"/relations",body:JSON.stringify(e),method:"POST"});var Vt=(e,t)=>()=>({path:"/roles",params:t??{},body:JSON.stringify(e),method:"POST"}),Mt=(e,t)=>()=>({path:"/roles",params:t??{},body:JSON.stringify(e),method:"POST"});var Bt=(e,t)=>()=>({path:"/shares",params:t??{},body:JSON.stringify(e),method:"POST"}),qt=(e,t)=>()=>({path:"/shares",params:t??{},body:JSON.stringify(e),method:"POST"});var Xt=(e,t)=>()=>({path:"/translations",params:t??{},body:JSON.stringify(e),method:"POST"}),Yt=(e,t)=>()=>({path:"/translations",params:t??{},body:JSON.stringify(e),method:"POST"});var er=(e,t)=>()=>({path:"/users",params:t??{},body:JSON.stringify(e),method:"POST"}),tr=(e,t)=>()=>({path:"/users",params:t??{},body:JSON.stringify(e),method:"POST"});var or=(e,t)=>()=>({path:"/versions",params:t??{},body:JSON.stringify(e),method:"POST"}),sr=(e,t)=>()=>({path:"/versions",params:t??{},body:JSON.stringify(e),method:"POST"});var mr=(e,t)=>()=>({path:"/webhooks",params:t??{},body:JSON.stringify(e),method:"POST"}),nr=(e,t)=>()=>({path:"/webhooks",params:t??{},body:JSON.stringify(e),method:"POST"});var Fr=e=>()=>({path:`/activity/comment/${e}`,method:"DELETE"});var Ar=e=>()=>({path:`/collections/${e}`,method:"DELETE"});var w=e=>{let t=(o,s=[])=>{if(typeof o=="object"){let a=[];for(let p in o){let c=o[p]??[];if(Array.isArray(c))for(let i of c)a.push(t(i,[...s,p]));else if(typeof c=="object")for(let i of Object.keys(c)){let h=c[i];for(let f of h)a.push(t(f,[...s,`${p}:${i}`]))}}return a.flatMap(p=>p)}return[...s,String(o)].join(".")};return e.flatMap(o=>t(o))},N=e=>{let t={};Array.isArray(e.fields)&&e.fields.length>0&&(t.fields=w(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[o,s]of Object.entries(e))o in t||(typeof s=="string"||typeof s=="number"||typeof s=="boolean"?t[o]=String(s):t[o]=JSON.stringify(s));return t};var r=(e,t)=>{if(e.length===0)throw new Error(t)};var x=(e,t)=>{if(String(e).startsWith("directus_"))throw new Error(t)};var Gr=e=>()=>(r(e,"Keys cannot be empty"),{path:"/dashboards",body:JSON.stringify(e),method:"DELETE"}),Lr=e=>()=>(r(e,"Key cannot be empty"),{path:`/dashboards/${e}`,method:"DELETE"});var Mr=(e,t)=>()=>(r(e,"Collection cannot be empty"),r(t,"Field cannot be empty"),{path:`/fields/${e}/${t}`,method:"DELETE"});var qr=e=>()=>(r(e,"Keys cannot be empty"),{path:"/files",body:JSON.stringify(e),method:"DELETE"}),zr=e=>()=>(r(e,"Key cannot be empty"),{path:`/files/${e}`,method:"DELETE"});var Zr=e=>()=>(r(e,"Keys cannot be empty"),{path:"/flows",body:JSON.stringify(e),method:"DELETE"}),eo=e=>()=>(r(e,"Key cannot be empty"),{path:`/flows/${e}`,method:"DELETE"});var oo=e=>()=>(r(e,"Keys cannot be empty"),{path:"/folders",body:JSON.stringify(e),method:"DELETE"}),so=e=>()=>(r(e,"Key cannot be empty"),{path:`/folders/${e}`,method:"DELETE"});var no=(e,t)=>()=>{let o={};return r(String(e),"Collection cannot be empty"),x(e,"Cannot use deleteItems for core collections"),Array.isArray(t)?(r(t,"keysOrQuery cannot be empty"),o={keys:t}):(r(Object.keys(t),"keysOrQuery cannot be empty"),o={query:t}),{path:`/items/${e}`,body:JSON.stringify(o),method:"DELETE"}},co=(e,t)=>()=>(r(String(e),"Collection cannot be empty"),x(e,"Cannot use deleteItem for core collections"),r(String(t),"Key cannot be empty"),{path:`/items/${e}/${t}`,method:"DELETE"});var ho=e=>()=>(r(e,"Keys cannot be empty"),{path:"/notifications",body:JSON.stringify(e),method:"DELETE"}),uo=e=>()=>(r(e,"Key cannot be empty"),{path:`/notifications/${e}`,method:"DELETE"});var lo=e=>()=>(r(e,"Keys cannot be empty"),{path:"/operations",body:JSON.stringify(e),method:"DELETE"}),fo=e=>()=>(r(e,"Key cannot be empty"),{path:`/operations/${e}`,method:"DELETE"});var bo=e=>()=>(r(e,"Keys cannot be empty"),{path:"/panels",body:JSON.stringify(e),method:"DELETE"}),To=e=>()=>(r(e,"Key cannot be empty"),{path:`/panels/${e}`,method:"DELETE"});var Ro=e=>()=>(r(e,"Keys cannot be empty"),{path:"/permissions",body:JSON.stringify(e),method:"DELETE"}),go=e=>()=>(r(String(e),"Key cannot be empty"),{path:`/permissions/${e}`,method:"DELETE"});var Po=e=>()=>(r(e,"Keys cannot be empty"),{path:"/presets",body:JSON.stringify(e),method:"DELETE"}),Io=e=>()=>(r(String(e),"Key cannot be empty"),{path:`/presets/${e}`,method:"DELETE"});var Ao=(e,t)=>()=>(r(e,"Collection cannot be empty"),r(t,"Field cannot be empty"),{path:`/relations/${e}/${t}`,method:"DELETE"});var vo=e=>()=>(r(e,"Keys cannot be empty"),{path:"/roles",body:JSON.stringify(e),method:"DELETE"}),Uo=e=>()=>(r(String(e),"Key cannot be empty"),{path:`/roles/${e}`,method:"DELETE"});var ko=e=>()=>(r(e,"Keys cannot be empty"),{path:"/shares",body:JSON.stringify(e),method:"DELETE"}),Wo=e=>()=>(r(String(e),"Key cannot be empty"),{path:`/shares/${e}`,method:"DELETE"});var Lo=e=>()=>(r(e,"Keys cannot be empty"),{path:"/translations",body:JSON.stringify(e),method:"DELETE"}),Ho=e=>()=>(r(String(e),"Key cannot be empty"),{path:`/translations/${e}`,method:"DELETE"});var _o=e=>()=>(r(e,"Keys cannot be empty"),{path:"/users",body:JSON.stringify(e),method:"DELETE"}),Bo=e=>()=>(r(String(e),"Key cannot be empty"),{path:`/users/${e}`,method:"DELETE"});var Xo=e=>()=>(r(e,"Keys cannot be empty"),{path:"/versions",body:JSON.stringify(e),method:"DELETE"}),Yo=e=>()=>(r(e,"Key cannot be empty"),{path:`/versions/${e}`,method:"DELETE"});var ts=e=>()=>(r(e,"Keys cannot be empty"),{path:"/webhooks",body:JSON.stringify(e),method:"DELETE"}),rs=e=>()=>(r(String(e),"Key cannot be empty"),{path:`/webhooks/${e}`,method:"DELETE"});var Ds=e=>()=>({path:"/activity",params:e??{},method:"GET"}),Os=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/activity/${e}`,params:t??{},method:"GET"});var Fs=(e,t)=>()=>{let o=String(e);return r(o,"Collection cannot be empty"),{path:o.startsWith("directus_")?`/${o.substring(9)}`:`/items/${o}`,method:"GET",params:{...t.query??{},...t.groupBy?{groupBy:t.groupBy}:{},aggregate:t.aggregate}}};var ws=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/assets/${e}`,params:t??{},method:"GET",onResponse:o=>o.body}),Ns=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/assets/${e}`,params:t??{},method:"GET",onResponse:o=>o.blob()}),vs=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/assets/${e}`,params:t??{},method:"GET",onResponse:o=>o.arrayBuffer()});var $s=()=>()=>({path:"/collections",method:"GET"}),ks=e=>()=>(r(e,"Collection cannot be empty"),{path:`/collections/${e}`,method:"GET"});var Gs=e=>()=>({path:"/dashboards",params:e??{},method:"GET"}),Ls=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/dashboards/${e}`,params:t??{},method:"GET"});var Vs=()=>()=>({path:"/extensions/",method:"GET"});var Bs=()=>()=>({path:"/fields",method:"GET"}),qs=e=>()=>(r(e,"Collection cannot be empty"),{path:`/fields/${e}`,method:"GET"}),zs=(e,t)=>()=>(r(e,"Collection cannot be empty"),r(t,"Field cannot be empty"),{path:`/fields/${e}/${t}`,method:"GET"});var Zs=e=>()=>({path:"/files",params:e??{},method:"GET"}),ea=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/files/${e}`,params:t??{},method:"GET"});var oa=e=>()=>({path:"/flows",params:e??{},method:"GET"}),sa=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/flows/${e}`,params:t??{},method:"GET"});var na=e=>()=>({path:"/folders",params:e??{},method:"GET"}),ca=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/folders/${e}`,params:t??{},method:"GET"});var da=(e,t)=>()=>(r(String(e),"Collection cannot be empty"),x(e,"Cannot use readItems for core collections"),{path:`/items/${e}`,params:t??{},method:"GET"}),ha=(e,t,o)=>()=>(r(String(e),"Collection cannot be empty"),x(e,"Cannot use readItem for core collections"),r(String(t),"Key cannot be empty"),{path:`/items/${e}/${t}`,params:o??{},method:"GET"});var Sa=e=>()=>({path:"/notifications",params:e??{},method:"GET"}),la=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/notifications/${e}`,params:t??{},method:"GET"});var Qa=e=>()=>({path:"/operations",params:e??{},method:"GET"}),ba=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/operations/${e}`,params:t??{},method:"GET"});var ja=e=>()=>({path:"/panels",params:e??{},method:"GET"}),Ra=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/panels/${e}`,params:t??{},method:"GET"});var Oa=e=>()=>({path:"/permissions",params:e??{},method:"GET"}),Pa=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/permissions/${e}`,params:t??{},method:"GET"});var Ea=e=>()=>({path:"/presets",params:e??{},method:"GET"}),Aa=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/presets/${e}`,params:t??{},method:"GET"});var va=()=>()=>({path:"/relations",method:"GET"}),Ua=e=>()=>({path:`/relations/${e}`,method:"GET"}),Ja=(e,t)=>()=>(r(e,"Collection cannot be empty"),r(t,"Field cannot be empty"),{path:`/relations/${e}/${t}`,method:"GET"});var Wa=e=>()=>({path:"/revisions",params:e??{},method:"GET"}),Ka=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/revisions/${e}`,params:t??{},method:"GET"});var Ha=e=>()=>({path:"/roles",params:e??{},method:"GET"}),Va=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/roles/${e}`,params:t??{},method:"GET"});var _a=e=>()=>({path:"/settings",params:e??{},method:"GET"});var za=e=>()=>({path:"/shares",params:e??{},method:"GET"}),Xa=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/shares/${e}`,params:t??{},method:"GET"});var em=(e,t)=>()=>(r(String(e),"Collection cannot be empty"),x(e,"Cannot use readSingleton for core collections"),{path:`/items/${e}`,params:t??{},method:"GET"});var om=e=>()=>({path:"/translations",params:e??{},method:"GET"}),sm=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/translations/${e}`,params:t??{},method:"GET"});var nm=e=>()=>({path:"/users",params:e??{},method:"GET"}),cm=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/users/${e}`,params:t??{},method:"GET"}),im=e=>()=>({path:"/users/me",params:e??{},method:"GET"});var hm=e=>()=>({path:"/versions",params:e??{},method:"GET"}),um=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/versions/${e}`,params:t??{},method:"GET"});var lm=e=>()=>({path:"/webhooks",params:e??{},method:"GET"}),fm=(e,t)=>()=>(r(String(e),"Key cannot be empty"),{path:`/webhooks/${e}`,params:t??{},method:"GET"});var Mm=e=>()=>({method:"POST",path:"/schema/apply",body:JSON.stringify(e)});var Bm=(e,t=!1)=>()=>({method:"POST",path:"/schema/diff",params:t?{force:t}:{},body:JSON.stringify(e)});var zm=()=>()=>({method:"GET",path:"/schema/snapshot"});var rn=(e="item")=>()=>({method:"GET",path:e==="item"?"/server/specs/graphql":"/server/specs/graphql/system"});var sn=()=>()=>({method:"GET",path:"/server/health"});var mn=()=>()=>({method:"GET",path:"/server/info"});var cn=()=>()=>({method:"GET",path:"/server/specs/oas"});var dn=()=>()=>({method:"GET",path:"/server/ping"});var bn=(e,t,o)=>()=>(r(String(e),"Key cannot be empty"),{path:`/activity/comment/${e}`,params:o??{},body:JSON.stringify(t),method:"PATCH"});var jn=(e,t,o)=>()=>(r(e,"Collection cannot be empty"),{path:`/collections/${e}`,params:o??{},body:JSON.stringify(t),method:"PATCH"});var Dn=(e,t,o)=>()=>(r(e,"Keys cannot be empty"),{path:"/dashboards",params:o??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),On=(e,t,o)=>()=>(r(e,"Key cannot be empty"),{path:`/dashboards/${e}`,params:o??{},body:JSON.stringify(t),method:"PATCH"});var Fn=(e,t,o)=>()=>(e!==null&&r(e,"Bundle cannot be an empty string"),r(t,"Name cannot be empty"),{path:e?`/extensions/${e}/${t}`:`/extensions/${t}`,params:{},body:JSON.stringify(o),method:"PATCH"});var wn=(e,t,o,s)=>()=>(r(e,"Keys cannot be empty"),r(t,"Field cannot be empty"),{path:`/fields/${e}/${t}`,params:s??{},body:JSON.stringify(o),method:"PATCH"});var Un=(e,t,o)=>()=>(r(e,"Keys cannot be empty"),{path:"/files",params:o??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Jn=(e,t,o)=>()=>(r(e,"Key cannot be empty"),t instanceof FormData?{path:`/files/${e}`,params:o??{},body:t,method:"PATCH",headers:{"Content-Type":"multipart/form-data"}}:{path:`/files/${e}`,params:o??{},body:JSON.stringify(t),method:"PATCH"});var Wn=(e,t,o)=>()=>(r(e,"Keys cannot be empty"),{path:"/flows",params:o??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Kn=(e,t,o)=>()=>(r(e,"Key cannot be empty"),{path:`/flows/${e}`,params:o??{},body:JSON.stringify(t),method:"PATCH"});var Hn=(e,t,o)=>()=>(r(e,"Keys cannot be empty"),{path:"/folders",params:o??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Vn=(e,t,o)=>()=>(r(e,"Key cannot be empty"),{path:`/folders/${e}`,params:o??{},body:JSON.stringify(t),method:"PATCH"});var Bn=(e,t,o,s)=>()=>{let a={};return r(String(e),"Collection cannot be empty"),x(e,"Cannot use updateItems for core collections"),Array.isArray(t)?(r(t,"keysOrQuery cannot be empty"),a={keys:t}):(r(Object.keys(t),"keysOrQuery cannot be empty"),a={query:t}),a.data=o,{path:`/items/${e}`,params:s??{},body:JSON.stringify(a),method:"PATCH"}},qn=(e,t,o,s)=>()=>(r(String(t),"Key cannot be empty"),r(String(e),"Collection cannot be empty"),x(e,"Cannot use updateItem for core collections"),{path:`/items/${e}/${t}`,params:s??{},body:JSON.stringify(o),method:"PATCH"});var Yn=(e,t,o)=>()=>(r(e,"Keys cannot be empty"),{path:"/notifications",params:o??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Zn=(e,t,o)=>()=>(r(e,"Key cannot be empty"),{path:`/notifications/${e}`,params:o??{},body:JSON.stringify(t),method:"PATCH"});var rc=(e,t,o)=>()=>(r(e,"Keys cannot be empty"),{path:"/operations",params:o??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),oc=(e,t,o)=>()=>(r(e,"Key cannot be empty"),{path:`/operations/${e}`,params:o??{},body:JSON.stringify(t),method:"PATCH"});var mc=(e,t,o)=>()=>(r(e,"Keys cannot be empty"),{path:"/panels",params:o??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),nc=(e,t,o)=>()=>(r(e,"Key cannot be empty"),{path:`/panels/${e}`,params:o??{},body:JSON.stringify(t),method:"PATCH"});var pc=(e,t,o)=>()=>(r(e,"Keys cannot be empty"),{path:"/permissions",params:o??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),dc=(e,t,o)=>()=>(r(String(e),"Key cannot be empty"),{path:`/permissions/${e}`,params:o??{},body:JSON.stringify(t),method:"PATCH"});var yc=(e,t,o)=>()=>(r(e,"Keys cannot be empty"),{path:"/presets",params:o??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Sc=(e,t,o)=>()=>(r(String(e),"Key cannot be empty"),{path:`/presets/${e}`,params:o??{},body:JSON.stringify(t),method:"PATCH"});var xc=(e,t,o,s)=>()=>(r(e,"Collection cannot be empty"),r(t,"Field cannot be empty"),{path:`/relations/${e}/${t}`,params:s??{},body:JSON.stringify(o),method:"PATCH"});var Tc=(e,t,o)=>()=>(r(e,"Keys cannot be empty"),{path:"/roles",params:o??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Cc=(e,t,o)=>()=>(r(e,"Key cannot be empty"),{path:`/roles/${e}`,params:o??{},body:JSON.stringify(t),method:"PATCH"});var Rc=(e,t)=>()=>({path:"/settings",params:t??{},body:JSON.stringify(e),method:"PATCH"});var Oc=(e,t,o)=>()=>(r(e,"Keys cannot be empty"),{path:"/shares",params:o??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Pc=(e,t,o)=>()=>(r(e,"Key cannot be empty"),{path:`/shares/${e}`,params:o??{},body:JSON.stringify(t),method:"PATCH"});var Ec=(e,t,o)=>()=>(r(String(e),"Collection cannot be empty"),x(e,"Cannot use updateSingleton for core collections"),{path:`/items/${e}`,params:o??{},body:JSON.stringify(t),method:"PATCH"});var Nc=(e,t,o)=>()=>(r(e,"Keys cannot be empty"),{path:"/translations",params:o??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),vc=(e,t,o)=>()=>(r(String(e),"Key cannot be empty"),{path:`/translations/${e}`,params:o??{},body:JSON.stringify(t),method:"PATCH"});var $c=(e,t,o)=>()=>(r(e,"Keys cannot be empty"),{path:"/users",params:o??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),kc=(e,t,o)=>()=>(r(e,"Key cannot be empty"),{path:`/users/${e}`,params:o??{},body:JSON.stringify(t),method:"PATCH"}),Wc=(e,t)=>()=>({path:"/users/me",params:t??{},body:JSON.stringify(e),method:"PATCH"});var Lc=(e,t,o)=>()=>(r(e,"Keys cannot be empty"),{path:"/versions",params:o??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Hc=(e,t,o)=>()=>(r(e,"Key cannot be empty"),{path:`/versions/${e}`,params:o??{},body:JSON.stringify(t),method:"PATCH"});var _c=(e,t,o)=>()=>(r(e,"Keys cannot be empty"),{path:"/webhooks",params:o??{},body:JSON.stringify({keys:e,data:t}),method:"PATCH"}),Bc=(e,t,o)=>()=>(r(String(e),"Key cannot be empty"),{path:`/webhooks/${e}`,params:o??{},body:JSON.stringify(t),method:"PATCH"});var bi=()=>()=>({method:"POST",path:"/utils/cache/clear"});var Ci=(e,t,o,s)=>()=>({method:"POST",path:`/utils/export/${e}`,body:JSON.stringify({format:t,query:o,file:s})});var Ri=(e,t,o)=>()=>e==="GET"?{path:`/flows/trigger/${t}`,params:o??{},method:"GET"}:{path:`/flows/trigger/${t}`,body:JSON.stringify(o??{}),method:"POST"};var Di=e=>()=>({method:"POST",path:"/utils/hash/generate",body:JSON.stringify({string:e})}),Oi=(e,t)=>()=>({method:"POST",path:"/utils/hash/verify",body:JSON.stringify({string:e,hash:t})});var Ii=(e,t)=>()=>({path:`/utils/import/${e}`,method:"POST",body:t,headers:{"Content-Type":"multipart/form-data"}});var Ei=(e,t)=>()=>({path:`/operations/trigger/${e}`,body:JSON.stringify(t??{}),method:"POST"});var wi=(e,t)=>()=>({path:"/shares/auth",method:"POST",body:JSON.stringify({share:e,password:t})}),Ni=(e,t)=>()=>({path:"/shares/invite",method:"POST",body:JSON.stringify({share:e,emails:t})}),vi=e=>()=>({path:`/shares/info/${e}`,method:"GET"});var Ji=(e,t,o)=>()=>({method:"POST",path:`/utils/sort/${e}`,body:JSON.stringify({item:t,to:o})});var ki=(e,t,o)=>()=>({path:"/users/invite",method:"POST",body:JSON.stringify({email:e,role:t,...o?{invite_url:o}:{}})}),Wi=(e,t)=>()=>({path:"/users/invite/accept",method:"POST",body:JSON.stringify({token:e,password:t})}),Ki=e=>()=>({path:"/users/me/tfa/generate",method:"POST",body:JSON.stringify({password:e})}),Gi=(e,t)=>()=>({path:"/users/me/tfa/enable",method:"POST",body:JSON.stringify({secret:e,otp:t})}),Li=e=>()=>({path:"/users/me/tfa/disable",method:"POST",body:JSON.stringify({otp:e})});var Mi=(e,t)=>()=>(r(e,"ID cannot be empty"),{path:`/versions/${e}/save`,method:"POST",body:JSON.stringify(t)}),_i=e=>()=>(r(e,"ID cannot be empty"),{path:`/versions/${e}/compare`,method:"GET"}),Bi=(e,t,o)=>()=>(r(e,"ID cannot be empty"),{path:`/versions/${e}/promote`,method:"POST",body:JSON.stringify(o?{mainHash:t,fields:o}:{mainHash:t})});var H={},xp=(e={})=>t=>{let o={...H,...e};return{async request(s){let a=s();if(a.headers||(a.headers={}),"Content-Type"in a.headers?a.headers["Content-Type"]==="multipart/form-data"&&delete a.headers["Content-Type"]:a.headers["Content-Type"]="application/json","getToken"in this){let h=await this.getToken();h&&(a.headers||(a.headers={}),a.headers.Authorization=`Bearer ${h}`)}let p=j(t.url,a.path,a.params),c={method:a.method??"GET",headers:a.headers??{}};"credentials"in o&&(c.credentials=o.credentials),a.body&&(c.body=a.body),a.onRequest&&(c=await a.onRequest(c)),o.onRequest&&(c=await o.onRequest(c));let i=await R(p.toString(),c,t.globals.fetch);return"onResponse"in a&&(i=await a.onResponse(i,c)),"onResponse"in e&&(i=await e.onResponse(i,c)),i}}};function bp(e,t){return()=>{let o=e();return typeof t=="function"?o.onRequest=t:o.onRequest=s=>({...s,...t}),o}}function jp(e){return()=>{let t=e();return t.method==="GET"&&t.params&&(t.method="SEARCH",t.body=JSON.stringify({query:{...t.params,fields:w(t.params.fields??[])}}),delete t.params),t}}function gp(e,t){return()=>{let o=t();return e&&(o.headers||(o.headers={}),o.headers.Authorization=`Bearer ${e}`),o}}export{Wi as acceptUserInvite,Fs as aggregate,E as auth,wi as authenticateShare,re as authentication,bi as clearCache,_i as compareContentVersion,it as createCollection,nt as createComment,sr as createContentVersion,or as createContentVersions,ht as createDashboard,dt as createDashboards,pe as createDirectus,yt as createField,bt as createFlow,Qt as createFlows,jt as createFolder,Ct as createFolders,Dt as createItem,gt as createItems,It as createNotification,Pt as createNotifications,At as createOperation,Et as createOperations,vt as createPanel,Nt as createPanels,$t as createPermission,Jt as createPermissions,Kt as createPreset,Wt as createPresets,Lt as createRelation,Mt as createRole,Vt as createRoles,qt as createShare,Bt as createShares,Yt as createTranslation,Xt as createTranslations,tr as createUser,er as createUsers,nr as createWebhook,mr as createWebhooks,Ar as deleteCollection,Fr as deleteComment,Yo as deleteContentVersion,Xo as deleteContentVersions,Lr as deleteDashboard,Gr as deleteDashboards,Mr as deleteField,zr as deleteFile,qr as deleteFiles,eo as deleteFlow,Zr as deleteFlows,so as deleteFolder,oo as deleteFolders,co as deleteItem,no as deleteItems,uo as deleteNotification,ho as deleteNotifications,fo as deleteOperation,lo as deleteOperations,To as deletePanel,bo as deletePanels,go as deletePermission,Ro as deletePermissions,Io as deletePreset,Po as deletePresets,Ao as deleteRelation,Uo as deleteRole,vo as deleteRoles,Wo as deleteShare,ko as deleteShares,Ho as deleteTranslation,Lo as deleteTranslations,Bo as deleteUser,_o as deleteUsers,rs as deleteWebhook,ts as deleteWebhooks,Li as disableTwoFactor,Gi as enableTwoFactor,w as formatFields,Di as generateHash,Ki as generateTwoFactorSecret,A as generateUid,ye as graphql,ft as importFile,Ni as inviteShare,ki as inviteUser,Ge as login,He as logout,J as memoryStorage,F as messageCallback,Me as passwordRequest,Be as passwordReset,k as pong,Bi as promoteContentVersion,N as queryToParams,Ds as readActivities,Os as readActivity,vs as readAssetArrayBuffer,Ns as readAssetBlob,ws as readAssetRaw,ks as readCollection,$s as readCollections,um as readContentVersion,hm as readContentVersions,Ls as readDashboard,Gs as readDashboards,Vs as readExtensions,zs as readField,Bs as readFields,qs as readFieldsByCollection,ea as readFile,Zs as readFiles,sa as readFlow,oa as readFlows,ca as readFolder,na as readFolders,rn as readGraphqlSdl,ha as readItem,da as readItems,im as readMe,la as readNotification,Sa as readNotifications,cn as readOpenApiSpec,ba as readOperation,Qa as readOperations,Ra as readPanel,ja as readPanels,Pa as readPermission,Oa as readPermissions,Aa as readPreset,Ea as readPresets,ze as readProviders,Ja as readRelation,Ua as readRelationByCollection,va as readRelations,Ka as readRevision,Wa as readRevisions,Va as readRole,Ha as readRoles,_a as readSettings,Xa as readShare,vi as readShareInfo,za as readShares,em as readSingleton,sm as readTranslation,om as readTranslations,cm as readUser,nm as readUsers,fm as readWebhook,lm as readWebhooks,Ie as realtime,Ye as refresh,xp as rest,Mi as saveToContentVersion,Mm as schemaApply,Bm as schemaDiff,zm as schemaSnapshot,sn as serverHealth,mn as serverInfo,dn as serverPing,Ee as sleep,se as staticToken,x as throwIfCoreCollection,r as throwIfEmpty,Ri as triggerFlow,Ei as triggerOperation,jn as updateCollection,bn as updateComment,Hc as updateContentVersion,Lc as updateContentVersions,On as updateDashboard,Dn as updateDashboards,Fn as updateExtension,wn as updateField,Jn as updateFile,Un as updateFiles,Kn as updateFlow,Wn as updateFlows,Vn as updateFolder,Hn as updateFolders,qn as updateItem,Bn as updateItems,Wc as updateMe,Zn as updateNotification,Yn as updateNotifications,oc as updateOperation,rc as updateOperations,nc as updatePanel,mc as updatePanels,dc as updatePermission,pc as updatePermissions,Sc as updatePreset,yc as updatePresets,xc as updateRelation,Cc as updateRole,Tc as updateRoles,Rc as updateSettings,Pc as updateShare,Oc as updateShares,Ec as updateSingleton,vc as updateTranslation,Nc as updateTranslations,kc as updateUser,$c as updateUsers,Bc as updateWebhook,_c as updateWebhooks,lt as uploadFiles,Ji as utilitySort,Ci as utilsExport,Ii as utilsImport,Oi as verifyHash,bp as withOptions,jp as withSearch,gp as withToken}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@directus/sdk", | ||
"version": "14.0.0", | ||
"version": "15.0.0", | ||
"description": "Directus JavaScript SDK", | ||
@@ -20,31 +20,14 @@ "homepage": "https://directus.io", | ||
}, | ||
"./auth": { | ||
"import": "./dist/auth/index.js", | ||
"require": "./dist/auth/index.cjs", | ||
"types": "./dist/auth/index.d.ts" | ||
}, | ||
"./graphql": { | ||
"import": "./dist/graphql/index.js", | ||
"require": "./dist/graphql/index.cjs", | ||
"types": "./dist/graphql/index.d.ts" | ||
}, | ||
"./realtime": { | ||
"import": "./dist/realtime/index.js", | ||
"require": "./dist/realtime/index.cjs", | ||
"types": "./dist/realtime/index.d.ts" | ||
}, | ||
"./rest": { | ||
"import": "./dist/rest/index.js", | ||
"require": "./dist/rest/index.cjs", | ||
"types": "./dist/rest/index.d.ts" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"main": "./dist/index.js", | ||
"files": [ | ||
"dist" | ||
], | ||
"devDependencies": { | ||
"@types/node-fetch": "2.6.9", | ||
"@types/node-fetch": "2.6.11", | ||
"tsup": "8.0.1", | ||
"typescript": "5.3.3", | ||
"vitest": "1.1.0", | ||
"vitest": "1.2.2", | ||
"@directus/tsconfig": "1.0.1" | ||
@@ -51,0 +34,0 @@ }, |
# Directus JavaScript SDK | ||
The design goals for this rebuild: | ||
## Features | ||
- TypeScript first | ||
- Modular/Composable architecture | ||
- Lightweight and Dependency Free | ||
- **TypeScript first:** The SDK provides a robust and type-safe development experience. | ||
- **Modular architecture:** The SDK is split into separate modules, giving you granular control over which features to | ||
include and which can be pruned at build-time. | ||
- **Lightweight and dependency-free:** It does not require external libraries, ensuring a lighter bundle and streamlined | ||
experience. | ||
@@ -9,0 +11,0 @@ ## Composable Client |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
168
0
4883608
9
55957