import{S as $t,i as qt,s as St,V as Tt,J as ee,X as ue,W as Ct,h as a,z as _,j as p,c as $e,k as w,n as r,o as i,m as qe,H as oe,Y as Ve,Z as pt,E as Ot,_ as Mt,G as Lt,t as ye,a as ve,v as d,d as Se,p as Pt,l as Te,q as Ft,I as we,L as Ht}from"./index-CUlXN_4f.js";import{F as Rt}from"./FieldsQueryParam-CluSqIw-.js";function mt(s,e,t){const l=s.slice();return l[10]=e[t],l}function bt(s,e,t){const l=s.slice();return l[10]=e[t],l}function _t(s,e,t){const l=s.slice();return l[15]=e[t],l}function kt(s){let e;return{c(){e=a("p"),e.innerHTML="Requires superuser Authorization:TOKEN header",w(e,"class","txt-hint txt-sm txt-right")},m(t,l){r(t,e,l)},d(t){t&&d(e)}}}function ht(s){let e,t,l,u,c,f,b,m,$,h,g,A,T,O,R,M,I,J,S,Q,L,q,k,P,te,Y,U,re,G,K,X;function fe(y,C){var V,W,H;return C&1&&(f=null),f==null&&(f=!!((H=(W=(V=y[0])==null?void 0:V.fields)==null?void 0:W.find(Kt))!=null&&H.required)),f?At:jt}let le=fe(s,-1),E=le(s);function Z(y,C){var V,W,H;return C&1&&(I=null),I==null&&(I=!!((H=(W=(V=y[0])==null?void 0:V.fields)==null?void 0:W.find(Gt))!=null&&H.required)),I?Vt:Bt}let x=Z(s,-1),F=x(s);return{c(){e=a("tr"),e.innerHTML='Auth specific fields',t=p(),l=a("tr"),u=a("td"),c=a("div"),E.c(),b=p(),m=a("span"),m.textContent="email",$=p(),h=a("td"),h.innerHTML='String',g=p(),A=a("td"),A.textContent="Auth record email address.",T=p(),O=a("tr"),R=a("td"),M=a("div"),F.c(),J=p(),S=a("span"),S.textContent="emailVisibility",Q=p(),L=a("td"),L.innerHTML='Boolean',q=p(),k=a("td"),k.textContent="Whether to show/hide the auth record email when fetching the record data.",P=p(),te=a("tr"),te.innerHTML='
Required password
String Auth record password.',Y=p(),U=a("tr"),U.innerHTML='
Required passwordConfirm
String Auth record password confirmation.',re=p(),G=a("tr"),G.innerHTML=`
Optional verified
Boolean Indicates whether the auth record is verified or not.
This field can be set only by superusers or auth records with "Manage" access.`,K=p(),X=a("tr"),X.innerHTML='Other fields',w(c,"class","inline-flex"),w(M,"class","inline-flex")},m(y,C){r(y,e,C),r(y,t,C),r(y,l,C),i(l,u),i(u,c),E.m(c,null),i(c,b),i(c,m),i(l,$),i(l,h),i(l,g),i(l,A),r(y,T,C),r(y,O,C),i(O,R),i(R,M),F.m(M,null),i(M,J),i(M,S),i(O,Q),i(O,L),i(O,q),i(O,k),r(y,P,C),r(y,te,C),r(y,Y,C),r(y,U,C),r(y,re,C),r(y,G,C),r(y,K,C),r(y,X,C)},p(y,C){le!==(le=fe(y,C))&&(E.d(1),E=le(y),E&&(E.c(),E.m(c,b))),x!==(x=Z(y,C))&&(F.d(1),F=x(y),F&&(F.c(),F.m(M,J)))},d(y){y&&(d(e),d(t),d(l),d(T),d(O),d(P),d(te),d(Y),d(U),d(re),d(G),d(K),d(X)),E.d(),F.d()}}}function jt(s){let e;return{c(){e=a("span"),e.textContent="Optional",w(e,"class","label label-warning")},m(t,l){r(t,e,l)},d(t){t&&d(e)}}}function At(s){let e;return{c(){e=a("span"),e.textContent="Required",w(e,"class","label label-success")},m(t,l){r(t,e,l)},d(t){t&&d(e)}}}function Bt(s){let e;return{c(){e=a("span"),e.textContent="Optional",w(e,"class","label label-warning")},m(t,l){r(t,e,l)},d(t){t&&d(e)}}}function Vt(s){let e;return{c(){e=a("span"),e.textContent="Required",w(e,"class","label label-success")},m(t,l){r(t,e,l)},d(t){t&&d(e)}}}function Nt(s){let e;return{c(){e=a("span"),e.textContent="Required",w(e,"class","label label-success")},m(t,l){r(t,e,l)},d(t){t&&d(e)}}}function Dt(s){let e;return{c(){e=a("span"),e.textContent="Optional",w(e,"class","label label-warning")},m(t,l){r(t,e,l)},d(t){t&&d(e)}}}function Jt(s){let e,t=s[15].maxSelect===1?"id":"ids",l,u;return{c(){e=_("Relation record "),l=_(t),u=_(".")},m(c,f){r(c,e,f),r(c,l,f),r(c,u,f)},p(c,f){f&64&&t!==(t=c[15].maxSelect===1?"id":"ids")&&oe(l,t)},d(c){c&&(d(e),d(l),d(u))}}}function Et(s){let e,t,l,u,c,f,b,m,$;return{c(){e=_("File object."),t=a("br"),l=_(` Set to empty value (`),u=a("code"),u.textContent="null",c=_(", "),f=a("code"),f.textContent='""',b=_(" or "),m=a("code"),m.textContent="[]",$=_(`) to delete already uploaded file(s).`)},m(h,g){r(h,e,g),r(h,t,g),r(h,l,g),r(h,u,g),r(h,c,g),r(h,f,g),r(h,b,g),r(h,m,g),r(h,$,g)},p:we,d(h){h&&(d(e),d(t),d(l),d(u),d(c),d(f),d(b),d(m),d($))}}}function It(s){let e;return{c(){e=_("URL address.")},m(t,l){r(t,e,l)},p:we,d(t){t&&d(e)}}}function Ut(s){let e;return{c(){e=_("Email address.")},m(t,l){r(t,e,l)},p:we,d(t){t&&d(e)}}}function zt(s){let e;return{c(){e=_("JSON array or object.")},m(t,l){r(t,e,l)},p:we,d(t){t&&d(e)}}}function Qt(s){let e;return{c(){e=_("Number value.")},m(t,l){r(t,e,l)},p:we,d(t){t&&d(e)}}}function Wt(s){let e,t,l=s[15].autogeneratePattern&&yt();return{c(){e=_(`Plain text value. `),l&&l.c(),t=Ht()},m(u,c){r(u,e,c),l&&l.m(u,c),r(u,t,c)},p(u,c){u[15].autogeneratePattern?l||(l=yt(),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null)},d(u){u&&(d(e),d(t)),l&&l.d(u)}}}function yt(s){let e;return{c(){e=_("It is autogenerated if not set.")},m(t,l){r(t,e,l)},d(t){t&&d(e)}}}function vt(s,e){let t,l,u,c,f,b=e[15].name+"",m,$,h,g,A=ee.getFieldValueType(e[15])+"",T,O,R,M;function I(k,P){return!k[15].required||k[15].type=="text"&&k[15].autogeneratePattern?Dt:Nt}let J=I(e),S=J(e);function Q(k,P){if(k[15].type==="text")return Wt;if(k[15].type==="number")return Qt;if(k[15].type==="json")return zt;if(k[15].type==="email")return Ut;if(k[15].type==="url")return It;if(k[15].type==="file")return Et;if(k[15].type==="relation")return Jt}let L=Q(e),q=L&&L(e);return{key:s,first:null,c(){t=a("tr"),l=a("td"),u=a("div"),S.c(),c=p(),f=a("span"),m=_(b),$=p(),h=a("td"),g=a("span"),T=_(A),O=p(),R=a("td"),q&&q.c(),M=p(),w(u,"class","inline-flex"),w(g,"class","label"),this.first=t},m(k,P){r(k,t,P),i(t,l),i(l,u),S.m(u,null),i(u,c),i(u,f),i(f,m),i(t,$),i(t,h),i(h,g),i(g,T),i(t,O),i(t,R),q&&q.m(R,null),i(t,M)},p(k,P){e=k,J!==(J=I(e))&&(S.d(1),S=J(e),S&&(S.c(),S.m(u,c))),P&64&&b!==(b=e[15].name+"")&&oe(m,b),P&64&&A!==(A=ee.getFieldValueType(e[15])+"")&&oe(T,A),L===(L=Q(e))&&q?q.p(e,P):(q&&q.d(1),q=L&&L(e),q&&(q.c(),q.m(R,null)))},d(k){k&&d(t),S.d(),q&&q.d()}}}function wt(s,e){let t,l=e[10].code+"",u,c,f,b;function m(){return e[9](e[10])}return{key:s,first:null,c(){t=a("button"),u=_(l),c=p(),w(t,"class","tab-item"),Te(t,"active",e[2]===e[10].code),this.first=t},m($,h){r($,t,h),i(t,u),i(t,c),f||(b=Ft(t,"click",m),f=!0)},p($,h){e=$,h&8&&l!==(l=e[10].code+"")&&oe(u,l),h&12&&Te(t,"active",e[2]===e[10].code)},d($){$&&d(t),f=!1,b()}}}function gt(s,e){let t,l,u,c;return l=new Ct({props:{content:e[10].body}}),{key:s,first:null,c(){t=a("div"),$e(l.$$.fragment),u=p(),w(t,"class","tab-item"),Te(t,"active",e[2]===e[10].code),this.first=t},m(f,b){r(f,t,b),qe(l,t,null),i(t,u),c=!0},p(f,b){e=f;const m={};b&8&&(m.content=e[10].body),l.$set(m),(!c||b&12)&&Te(t,"active",e[2]===e[10].code)},i(f){c||(ye(l.$$.fragment,f),c=!0)},o(f){ve(l.$$.fragment,f),c=!1},d(f){f&&d(t),Se(l)}}}function Yt(s){var st,at,ot,rt;let e,t,l=s[0].name+"",u,c,f,b,m,$,h,g=s[0].name+"",A,T,O,R,M,I,J,S,Q,L,q,k,P,te,Y,U,re,G,K=s[0].name+"",X,fe,le,E,Z,x,F,y,C,V,W,H=[],Ne=new Map,Oe,pe,Me,ne,Le,De,me,ie,Pe,Je,Fe,Ee,j,Ie,de,Ue,ze,Qe,He,We,Re,Ye,Ge,Ke,je,Xe,Ze,ce,Ae,be,Be,se,_e,z=[],xe=new Map,et,ke,N=[],tt=new Map,ae;S=new Tt({props:{js:` import PocketBase from 'pocketbase'; const pb = new PocketBase('${s[5]}'); ... // example create data const data = ${JSON.stringify(Object.assign({},s[4],ee.dummyCollectionSchemaData(s[0],!0)),null,4)}; const record = await pb.collection('${(st=s[0])==null?void 0:st.name}').create(data); `+(s[1]?` // (optional) send an email verification request await pb.collection('${(at=s[0])==null?void 0:at.name}').requestVerification('test@example.com'); `:""),dart:` import 'package:pocketbase/pocketbase.dart'; final pb = PocketBase('${s[5]}'); ... // example create body final body = ${JSON.stringify(Object.assign({},s[4],ee.dummyCollectionSchemaData(s[0],!0)),null,2)}; final record = await pb.collection('${(ot=s[0])==null?void 0:ot.name}').create(body: body); `+(s[1]?` // (optional) send an email verification request await pb.collection('${(rt=s[0])==null?void 0:rt.name}').requestVerification('test@example.com'); `:"")}});let D=s[7]&&kt(),B=s[1]&&ht(s),ge=ue(s[6]);const lt=n=>n[15].name;for(let n=0;nn[10].code;for(let n=0;nn[10].code;for(let n=0;napplication/json or multipart/form-data.`,M=p(),I=a("p"),I.innerHTML=`File upload is supported only via multipart/form-data.
For more info and examples you could check the detailed Files upload and handling docs .`,J=p(),$e(S.$$.fragment),Q=p(),L=a("h6"),L.textContent="API details",q=p(),k=a("div"),P=a("strong"),P.textContent="POST",te=p(),Y=a("div"),U=a("p"),re=_("/api/collections/"),G=a("strong"),X=_(K),fe=_("/records"),le=p(),D&&D.c(),E=p(),Z=a("div"),Z.textContent="Body Parameters",x=p(),F=a("table"),y=a("thead"),y.innerHTML='Param Type Description',C=p(),V=a("tbody"),B&&B.c(),W=p();for(let n=0;nParam Type Description',De=p(),me=a("tbody"),ie=a("tr"),Pe=a("td"),Pe.textContent="expand",Je=p(),Fe=a("td"),Fe.innerHTML='String',Ee=p(),j=a("td"),Ie=_(`Auto expand relations when returning the created record. Ex.: `),$e(de.$$.fragment),Ue=_(` Supports up to 6-levels depth nested relations expansion. `),ze=a("br"),Qe=_(` The expanded relations will be appended to the record under the `),He=a("code"),He.textContent="expand",We=_(" property (eg. "),Re=a("code"),Re.textContent='"expand": {"relField1": {...}, ...}',Ye=_(`). `),Ge=a("br"),Ke=_(` Only the relations to which the request user has permissions to `),je=a("strong"),je.textContent="view",Xe=_(" will be expanded."),Ze=p(),$e(ce.$$.fragment),Ae=p(),be=a("div"),be.textContent="Responses",Be=p(),se=a("div"),_e=a("div");for(let n=0;n${JSON.stringify(Object.assign({},n[4],ee.dummyCollectionSchemaData(n[0],!0)),null,2)}; final record = await pb.collection('${(ut=n[0])==null?void 0:ut.name}').create(body: body); `+(n[1]?` // (optional) send an email verification request await pb.collection('${(ft=n[0])==null?void 0:ft.name}').requestVerification('test@example.com'); `:"")),S.$set(v),(!ae||o&1)&&K!==(K=n[0].name+"")&&oe(X,K),n[7]?D||(D=kt(),D.c(),D.m(k,null)):D&&(D.d(1),D=null),n[1]?B?B.p(n,o):(B=ht(n),B.c(),B.m(V,W)):B&&(B.d(1),B=null),o&64&&(ge=ue(n[6]),H=Ve(H,o,lt,1,n,ge,Ne,V,pt,vt,null,_t)),o&12&&(Ce=ue(n[3]),z=Ve(z,o,nt,1,n,Ce,xe,_e,pt,wt,null,bt)),o&12&&(he=ue(n[3]),Ot(),N=Ve(N,o,it,1,n,he,tt,ke,Mt,gt,null,mt),Lt())},i(n){if(!ae){ye(S.$$.fragment,n),ye(de.$$.fragment,n),ye(ce.$$.fragment,n);for(let o=0;os.name=="emailVisibility",Kt=s=>s.name=="email";function Xt(s,e,t){let l,u,c,f,b,{collection:m}=e,$=200,h=[],g={};const A=T=>t(2,$=T.code);return s.$$set=T=>{"collection"in T&&t(0,m=T.collection)},s.$$.update=()=>{var T,O,R;s.$$.dirty&1&&t(1,l=m.type==="auth"),s.$$.dirty&1&&t(7,u=(m==null?void 0:m.createRule)===null),s.$$.dirty&2&&t(8,c=l?["password","verified","email","emailVisibility"]:[]),s.$$.dirty&257&&t(6,f=((T=m==null?void 0:m.fields)==null?void 0:T.filter(M=>!M.hidden&&M.type!="autodate"&&!c.includes(M.name)))||[]),s.$$.dirty&1&&t(3,h=[{code:200,body:JSON.stringify(ee.dummyCollectionRecord(m),null,2)},{code:400,body:` { "status": 400, "message": "Failed to create record.", "data": { "${(R=(O=m==null?void 0:m.fields)==null?void 0:O[0])==null?void 0:R.name}": { "code": "validation_required", "message": "Missing required value." } } } `},{code:403,body:` { "status": 403, "message": "You are not allowed to perform this request.", "data": {} } `}]),s.$$.dirty&2&&(l?t(4,g={password:"12345678",passwordConfirm:"12345678"}):t(4,g={}))},t(5,b=ee.getApiExampleUrl(Pt.baseURL)),[m,l,$,h,g,b,f,u,c,A]}class el extends $t{constructor(e){super(),qt(this,e,Xt,Yt,St,{collection:0})}}export{el as default};