2 lines
1.0 KiB
JavaScript
2 lines
1.0 KiB
JavaScript
import{Y as d,_ as l,Z as i}from"./index-413b1e47.js";const f=async e=>{let t=d.from("collections").select("*");return e!=null&&e.length&&t.like("title",`%${e}%`),(await t.select("*").order("created_at",{ascending:!1})).data},y=async e=>{await i.fetch("collections","insert",{data:e})},_=async(e,t)=>i.fetch("collections","update",{data:t,field:"id",value:e}),m=async e=>i.fetch("collections","delete",{field:"id",value:e});async function S(e){const{TableEngineShopRequest:t}=await l(()=>import("./buildSupabaseQuery-89acf0e5.js"),["assets/buildSupabaseQuery-89acf0e5.js","assets/index-413b1e47.js","assets/index-338b63e2.css","assets/supabaseTableQuery-9069679c.js"]),a={...e};!a.sort&&!a.order&&(a.order="-id");const o=await t(a,"collections");try{if(Array.isArray(o==null?void 0:o.rows)){const r=a.page||1,c=a.limit||200,u=(r-1)*c,n=o.rows.map((s,g)=>({id:s.id,created_at:s.created_at??"",updated_at:s.updated_at??"",...s}));return{...o,rows:n}}}catch(r){console.log("[getProductsTable] normalize error:",r)}return o}export{S as a,y as c,m as d,f as g,_ as u};
|