import{S as Ct,i as St,s as Ot,C as U,N as Tt,e as r,w as y,b as m,c as Ae,f as T,g as a,h as i,m as Be,x as I,O as Pe,P as ut,k as Mt,Q as $t,n as Rt,t as fe,a as pe,o,d as Fe,R as qt,p as Dt,r as ce,u as Ht,y as G}from"./index-74083635.js";import{S as Lt}from"./SdkTabs-5f6cc76a.js";function bt(f,t,l){const s=f.slice();return s[7]=t[l],s}function mt(f,t,l){const s=f.slice();return s[7]=t[l],s}function _t(f,t,l){const s=f.slice();return s[12]=t[l],s}function yt(f){let t;return{c(){t=r("p"),t.innerHTML="Requires admin Authorization:TOKEN
header",T(t,"class","txt-hint txt-sm txt-right")},m(l,s){a(l,t,s)},d(l){l&&o(t)}}}function kt(f){let t,l,s,b,u,d,p,k,C,w,O,H,A,j,M,E,B;return{c(){t=r("tr"),t.innerHTML='
Auth fields | ',l=m(),s=r("tr"),s.innerHTML=`Optional
username |
String |
The username of the auth record. | `,b=m(),u=r("tr"),u.innerHTML=`Optional
email |
String |
The auth record email address.
This field can be updated only by admins or auth records with "Manage" access.
Regular accounts can update their email by calling "Request email change". | `,d=m(),p=r("tr"),p.innerHTML=`Optional
emailVisibility |
Boolean |
Whether to show/hide the auth record email when fetching the record data. | `,k=m(),C=r("tr"),C.innerHTML=`Optional
oldPassword |
String |
Old auth record password.
This field is required only when changing the record password. Admins and auth records with
"Manage" access can skip this field. | `,w=m(),O=r("tr"),O.innerHTML=`Optional
password |
String |
New auth record password. | `,H=m(),A=r("tr"),A.innerHTML=`Optional
passwordConfirm |
String |
New auth record password confirmation. | `,j=m(),M=r("tr"),M.innerHTML=`Optional
verified |
Boolean |
Indicates whether the auth record is verified or not.
This field can be set only by admins or auth records with "Manage" access. | `,E=m(),B=r("tr"),B.innerHTML='Schema fields | '},m(c,_){a(c,t,_),a(c,l,_),a(c,s,_),a(c,b,_),a(c,u,_),a(c,d,_),a(c,p,_),a(c,k,_),a(c,C,_),a(c,w,_),a(c,O,_),a(c,H,_),a(c,A,_),a(c,j,_),a(c,M,_),a(c,E,_),a(c,B,_)},d(c){c&&o(t),c&&o(l),c&&o(s),c&&o(b),c&&o(u),c&&o(d),c&&o(p),c&&o(k),c&&o(C),c&&o(w),c&&o(O),c&&o(H),c&&o(A),c&&o(j),c&&o(M),c&&o(E),c&&o(B)}}}function Pt(f){let t;return{c(){t=r("span"),t.textContent="Optional",T(t,"class","label label-warning")},m(l,s){a(l,t,s)},d(l){l&&o(t)}}}function At(f){let t;return{c(){t=r("span"),t.textContent="Required",T(t,"class","label label-success")},m(l,s){a(l,t,s)},d(l){l&&o(t)}}}function Bt(f){var u;let t,l=((u=f[12].options)==null?void 0:u.maxSelect)>1?"ids":"id",s,b;return{c(){t=y("User "),s=y(l),b=y(".")},m(d,p){a(d,t,p),a(d,s,p),a(d,b,p)},p(d,p){var k;p&1&&l!==(l=((k=d[12].options)==null?void 0:k.maxSelect)>1?"ids":"id")&&I(s,l)},d(d){d&&o(t),d&&o(s),d&&o(b)}}}function Ft(f){var u;let t,l=((u=f[12].options)==null?void 0:u.maxSelect)>1?"ids":"id",s,b;return{c(){t=y("Relation record "),s=y(l),b=y(".")},m(d,p){a(d,t,p),a(d,s,p),a(d,b,p)},p(d,p){var k;p&1&&l!==(l=((k=d[12].options)==null?void 0:k.maxSelect)>1?"ids":"id")&&I(s,l)},d(d){d&&o(t),d&&o(s),d&&o(b)}}}function Nt(f){let t,l,s,b,u;return{c(){t=y("File object."),l=r("br"),s=y(`
Set to `),b=r("code"),b.textContent="null",u=y(" to delete already uploaded file(s).")},m(d,p){a(d,t,p),a(d,l,p),a(d,s,p),a(d,b,p),a(d,u,p)},p:G,d(d){d&&o(t),d&&o(l),d&&o(s),d&&o(b),d&&o(u)}}}function jt(f){let t;return{c(){t=y("URL address.")},m(l,s){a(l,t,s)},p:G,d(l){l&&o(t)}}}function Et(f){let t;return{c(){t=y("Email address.")},m(l,s){a(l,t,s)},p:G,d(l){l&&o(t)}}}function Ut(f){let t;return{c(){t=y("JSON array or object.")},m(l,s){a(l,t,s)},p:G,d(l){l&&o(t)}}}function It(f){let t;return{c(){t=y("Number value.")},m(l,s){a(l,t,s)},p:G,d(l){l&&o(t)}}}function Jt(f){let t;return{c(){t=y("Plain text value.")},m(l,s){a(l,t,s)},p:G,d(l){l&&o(t)}}}function ht(f,t){let l,s,b,u,d,p=t[12].name+"",k,C,w,O,H=U.getFieldValueType(t[12])+"",A,j,M,E;function B(h,P){return h[12].required?At:Pt}let c=B(t),_=c(t);function K(h,P){if(h[12].type==="text")return Jt;if(h[12].type==="number")return It;if(h[12].type==="json")return Ut;if(h[12].type==="email")return Et;if(h[12].type==="url")return jt;if(h[12].type==="file")return Nt;if(h[12].type==="relation")return Ft;if(h[12].type==="user")return Bt}let L=K(t),S=L&&L(t);return{key:f,first:null,c(){l=r("tr"),s=r("td"),b=r("div"),_.c(),u=m(),d=r("span"),k=y(p),C=m(),w=r("td"),O=r("span"),A=y(H),j=m(),M=r("td"),S&&S.c(),E=m(),T(b,"class","inline-flex"),T(O,"class","label"),this.first=l},m(h,P){a(h,l,P),i(l,s),i(s,b),_.m(b,null),i(b,u),i(b,d),i(d,k),i(l,C),i(l,w),i(w,O),i(O,A),i(l,j),i(l,M),S&&S.m(M,null),i(l,E)},p(h,P){t=h,c!==(c=B(t))&&(_.d(1),_=c(t),_&&(_.c(),_.m(b,u))),P&1&&p!==(p=t[12].name+"")&&I(k,p),P&1&&H!==(H=U.getFieldValueType(t[12])+"")&&I(A,H),L===(L=K(t))&&S?S.p(t,P):(S&&S.d(1),S=L&&L(t),S&&(S.c(),S.m(M,null)))},d(h){h&&o(l),_.d(),S&&S.d()}}}function vt(f,t){let l,s=t[7].code+"",b,u,d,p;function k(){return t[6](t[7])}return{key:f,first:null,c(){l=r("button"),b=y(s),u=m(),T(l,"class","tab-item"),ce(l,"active",t[1]===t[7].code),this.first=l},m(C,w){a(C,l,w),i(l,b),i(l,u),d||(p=Ht(l,"click",k),d=!0)},p(C,w){t=C,w&4&&s!==(s=t[7].code+"")&&I(b,s),w&6&&ce(l,"active",t[1]===t[7].code)},d(C){C&&o(l),d=!1,p()}}}function wt(f,t){let l,s,b,u;return s=new Tt({props:{content:t[7].body}}),{key:f,first:null,c(){l=r("div"),Ae(s.$$.fragment),b=m(),T(l,"class","tab-item"),ce(l,"active",t[1]===t[7].code),this.first=l},m(d,p){a(d,l,p),Be(s,l,null),i(l,b),u=!0},p(d,p){t=d;const k={};p&4&&(k.content=t[7].body),s.$set(k),(!u||p&6)&&ce(l,"active",t[1]===t[7].code)},i(d){u||(fe(s.$$.fragment,d),u=!0)},o(d){pe(s.$$.fragment,d),u=!1},d(d){d&&o(l),Fe(s)}}}function gt(f){var it,at,ot,dt;let t,l,s=f[0].name+"",b,u,d,p,k,C,w,O=f[0].name+"",H,A,j,M,E,B,c,_,K,L,S,h,P,Ne,ae,W,je,ue,oe=f[0].name+"",be,Ee,me,Ue,_e,X,ye,Z,ke,ee,he,J,ve,Ie,g,we,F=[],Je=new Map,Te,te,Ce,V,Se,ge,Oe,x,Me,Ve,$e,xe,$,Qe,Y,ze,Ke,We,Re,Ye,qe,Ge,De,Xe,He,le,Le,Q,se,N=[],Ze=new Map,et,ne,R=[],tt=new Map,z;_=new Lt({props:{js:`
import PocketBase from 'pocketbase';
const pb = new PocketBase('${f[4]}');
...
// example update data
const data = ${JSON.stringify(Object.assign({},f[3],U.dummyCollectionSchemaData(f[0])),null,4)};
const record = await pb.collection('${(it=f[0])==null?void 0:it.name}').update('RECORD_ID', data);
`,dart:`
import 'package:pocketbase/pocketbase.dart';
final pb = PocketBase('${f[4]}');
...
// example update body
final body = ${JSON.stringify(Object.assign({},f[3],U.dummyCollectionSchemaData(f[0])),null,2)};
final record = await pb.collection('${(at=f[0])==null?void 0:at.name}').update('RECORD_ID', body: body);
`}});let q=f[5]&&yt(),D=((ot=f[0])==null?void 0:ot.isAuth)&&kt(),de=(dt=f[0])==null?void 0:dt.schema;const lt=e=>e[12].name;for(let e=0;ee[7].code;for(let e=0;ee[7].code;for(let e=0;eapplication/json or
multipart/form-data
.`,E=m(),B=r("p"),B.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
.`,c=m(),Ae(_.$$.fragment),K=m(),L=r("h6"),L.textContent="API details",S=m(),h=r("div"),P=r("strong"),P.textContent="PATCH",Ne=m(),ae=r("div"),W=r("p"),je=y("/api/collections/"),ue=r("strong"),be=y(oe),Ee=y("/records/"),me=r("strong"),me.textContent=":id",Ue=m(),q&&q.c(),_e=m(),X=r("div"),X.textContent="Path parameters",ye=m(),Z=r("table"),Z.innerHTML=`Param |
Type |
Description |
id |
String |
ID of the record to update. |
`,ke=m(),ee=r("div"),ee.textContent="Body Parameters",he=m(),J=r("table"),ve=r("thead"),ve.innerHTML=`Param |
Type |
Description |
`,Ie=m(),g=r("tbody"),D&&D.c(),we=m();for(let e=0;eParam |
Type |
Description | `,ge=m(),Oe=r("tbody"),x=r("tr"),Me=r("td"),Me.textContent="expand",Ve=m(),$e=r("td"),$e.innerHTML='String',xe=m(),$=r("td"),Qe=y(`Auto expand relations when returning the updated record. Ex.:
`),Ae(Y.$$.fragment),ze=y(`
Supports up to 6-levels depth nested relations expansion. `),Ke=r("br"),We=y(`
The expanded relations will be appended to the record under the
`),Re=r("code"),Re.textContent="expand",Ye=y(" property (eg. "),qe=r("code"),qe.textContent='"expand": {"relField1": {...}, ...}',Ge=y(`). Only
the relations that the user has permissions to `),De=r("strong"),De.textContent="view",Xe=y(" will be expanded."),He=m(),le=r("div"),le.textContent="Responses",Le=m(),Q=r("div"),se=r("div");for(let e=0;e${JSON.stringify(Object.assign({},e[3],U.dummyCollectionSchemaData(e[0])),null,2)};
final record = await pb.collection('${(ft=e[0])==null?void 0:ft.name}').update('RECORD_ID', body: body);
`),_.$set(v),(!z||n&1)&&oe!==(oe=e[0].name+"")&&I(be,oe),e[5]?q||(q=yt(),q.c(),q.m(h,null)):q&&(q.d(1),q=null),(pt=e[0])!=null&&pt.isAuth?D||(D=kt(),D.c(),D.m(g,we)):D&&(D.d(1),D=null),n&1&&(de=(ct=e[0])==null?void 0:ct.schema,F=Pe(F,n,lt,1,e,de,Je,g,ut,ht,null,_t)),n&6&&(re=e[2],N=Pe(N,n,st,1,e,re,Ze,se,ut,vt,null,mt)),n&6&&(ie=e[2],Mt(),R=Pe(R,n,nt,1,e,ie,tt,ne,$t,wt,null,bt),Rt())},i(e){if(!z){fe(_.$$.fragment,e),fe(Y.$$.fragment,e);for(let n=0;nl(1,d=w.code);return f.$$set=w=>{"collection"in w&&l(0,u=w.collection)},f.$$.update=()=>{var w,O;f.$$.dirty&1&&l(5,s=(u==null?void 0:u.updateRule)===null),f.$$.dirty&1&&l(2,p=[{code:200,body:JSON.stringify(U.dummyCollectionRecord(u),null,2)},{code:400,body:`
{
"code": 400,
"message": "Failed to update record.",
"data": {
"${(O=(w=u==null?void 0:u.schema)==null?void 0:w[0])==null?void 0:O.name}": {
"code": "validation_required",
"message": "Missing required value."
}
}
}
`},{code:403,body:`
{
"code": 403,
"message": "You are not allowed to perform this request.",
"data": {}
}
`},{code:404,body:`
{
"code": 404,
"message": "The requested resource wasn't found.",
"data": {}
}
`}]),f.$$.dirty&1&&(u.isAuth?l(3,k={username:"test_username_update",emailVisibility:!1,password:"87654321",passwordConfirm:"87654321",oldPassword:"12345678"}):l(3,k={}))},l(4,b=U.getApiExampleUrl(Dt.baseUrl)),[u,d,p,k,b,s,C]}class zt extends Ct{constructor(t){super(),St(this,t,Vt,gt,Ot,{collection:0})}}export{zt as default};