import{S as It,i as Lt,s as jt,Q as At,R as Ht,T as Y,e as o,w as _,b as i,c as Re,f as b,g as d,h as t,m as Te,j as Mt,l as Nt,x as Ut,U as Pt,V as zt,k as Jt,W as Wt,n as Kt,t as Z,a as x,o as u,d as Pe,C as Ft,p as Gt,r as ee,u as Qt}from"./index-yjdtWzFj.js";function Bt(a,s,n){const c=a.slice();return c[6]=s[n],c}function Ot(a,s,n){const c=a.slice();return c[6]=s[n],c}function Et(a,s){let n,c,y;function h(){return s[5](s[6])}return{key:a,first:null,c(){n=o("button"),n.textContent=`${s[6].code} `,b(n,"class","tab-item"),ee(n,"active",s[1]===s[6].code),this.first=n},m(r,f){d(r,n,f),c||(y=Qt(n,"click",h),c=!0)},p(r,f){s=r,f&10&&ee(n,"active",s[1]===s[6].code)},d(r){r&&u(n),c=!1,y()}}}function St(a,s){let n,c,y,h;return c=new Ht({props:{content:s[6].body}}),{key:a,first:null,c(){n=o("div"),Re(c.$$.fragment),y=i(),b(n,"class","tab-item"),ee(n,"active",s[1]===s[6].code),this.first=n},m(r,f){d(r,n,f),Te(c,n,null),t(n,y),h=!0},p(r,f){s=r,(!h||f&10)&&ee(n,"active",s[1]===s[6].code)},i(r){h||(Z(c.$$.fragment,r),h=!0)},o(r){x(c.$$.fragment,r),h=!1},d(r){r&&u(n),Pe(c)}}}function Vt(a){var pt,mt,bt,ft,ht,_t,yt,kt;let s,n,c=a[0].name+"",y,h,r,f,F,g,U,Fe,P,B,Be,O,Oe,Ee,te,le,w,oe,E,ae,S,se,H,ne,z,ie,q,ce,Se,re,I,J,He,k,W,Ie,de,Le,D,K,je,ue,Ae,G,Me,pe,Ne,v,Ue,me,ze,Je,We,Q,Ke,V,Ge,be,Qe,fe,Ve,he,Xe,p,_e,Ye,ye,Ze,ke,xe,$e,et,ge,tt,Ce,lt,ot,at,De,st,R,ve,L,we,T,j,C=[],nt=new Map,it,A,$=[],ct=new Map,M,qe,rt;w=new At({props:{js:`
import PocketBase from 'pocketbase';
const pb = new PocketBase('${a[2]}');
...
const batch = pb.createBatch();
batch.collection('${(pt=a[0])==null?void 0:pt.name}').create({ ... });
batch.collection('${(mt=a[0])==null?void 0:mt.name}').update("RECORD_ID", { ... });
batch.collection('${(bt=a[0])==null?void 0:bt.name}').delete("RECORD_ID");
batch.collection('${(ft=a[0])==null?void 0:ft.name}').upsert({ ... });
const result = await batch.send();
`,dart:`
import 'package:pocketbase/pocketbase.dart';
final pb = PocketBase('${a[2]}');
...
final batch = pb.createBatch();
batch.collection('${(ht=a[0])==null?void 0:ht.name}').create(body: { ... });
batch.collection('${(_t=a[0])==null?void 0:_t.name}').update('RECORD_ID', body: { ... });
batch.collection('${(yt=a[0])==null?void 0:yt.name}').delete('RECORD_ID');
batch.collection('${(kt=a[0])==null?void 0:kt.name}').upsert(body: { ... });
final result = await batch.send();
`}}),R=new Ht({props:{language:"javascript",content:`
const formData = new FormData();
formData.append("@jsonPayload", JSON.stringify({
requests: [
{
method: "POST",
url: "/api/collections/${a[0].name}/records?fields=id",
body: { someField: "test1" }
},
{
method: "PATCH",
url: "/api/collections/${a[0].name}/records/RECORD_ID",
body: { someField: "test2" }
}
]
}))
// file for the first request
formData.append("requests.0.someFileField", new File(...))
// file for the second request
formData.append("requests.1.someFileField", new File(...))
`}});let X=Y(a[3]);const dt=e=>e[6].code;for(let e=0;e
id
field)',Ke=i(),V=o("li"),Ge=_(`record delete -
`),be=o("code"),be.textContent="DELETE /api/collections/{collection}/records/{id}",Qe=i(),fe=o("p"),fe.textContent="Each batch Request element have the following properties:",Ve=i(),he=o("ul"),he.innerHTML=`url path
(could include query parameters)method
(GET, POST, PUT, PATCH, DELETE)headers
POST /api/batch
call has Authorization
header it
is forwarded to all batch requests automatically)body