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