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