2025-03-16 16:43:21 +08:00
import { S as je , i as xe , s as Ie , V as Ke , W as Ue , X as I , h as d , d as K , t as E , a as z , I as de , Z as Oe , _ as Qe , C as We , $ as Xe , D as Ze , l as u , n as o , m as Q , u as s , A as k , v as p , c as W , w as b , J as Ve , p as Ge , k as X , o as Ye } from "./index-CVqXRFk8.js" ; import { F as et } from "./FieldsQueryParam-B6maRWKB.js" ; function Ee ( r , a , l ) { const n = r . slice ( ) ; return n [ 5 ] = a [ l ] , n } function ze ( r , a , l ) { const n = r . slice ( ) ; return n [ 5 ] = a [ l ] , n } function Je ( r , a ) { let l , n = a [ 5 ] . code + "" , m , _ , i , h ; function g ( ) { return a [ 4 ] ( a [ 5 ] ) } return { key : r , first : null , c ( ) { l = s ( "button" ) , m = k ( n ) , _ = p ( ) , b ( l , "class" , "tab-item" ) , X ( l , "active" , a [ 1 ] === a [ 5 ] . code ) , this . first = l } , m ( v , w ) { u ( v , l , w ) , o ( l , m ) , o ( l , _ ) , i || ( h = Ye ( l , "click" , g ) , i = ! 0 ) } , p ( v , w ) { a = v , w & 4 && n !== ( n = a [ 5 ] . code + "" ) && de ( m , n ) , w & 6 && X ( l , "active" , a [ 1 ] === a [ 5 ] . code ) } , d ( v ) { v && d ( l ) , i = ! 1 , h ( ) } } } function Ne ( r , a ) { let l , n , m , _ ; return n = new Ue ( { props : { content : a [ 5 ] . body } } ) , { key : r , first : null , c ( ) { l = s ( "div" ) , W ( n . $$ . fragment ) , m = p ( ) , b ( l , "class" , "tab-item" ) , X ( l , "active" , a [ 1 ] === a [ 5 ] . code ) , this . first = l } , m ( i , h ) { u ( i , l , h ) , Q ( n , l , null ) , o ( l , m ) , _ = ! 0 } , p ( i , h ) { a = i ; const g = { } ; h & 4 && ( g . content = a [ 5 ] . body ) , n . $set ( g ) , ( ! _ || h & 6 ) && X ( l , "active" , a [ 1 ] === a [ 5 ] . code ) } , i ( i ) { _ || ( z ( n . $$ . fragment , i ) , _ = ! 0 ) } , o ( i ) { E ( n . $$ . fragment , i ) , _ = ! 1 } , d ( i ) { i && d ( l ) , K ( n ) } } } function tt ( r ) { var qe , Fe ; let a , l , n = r [ 0 ] . name + "" , m , _ , i , h , g , v , w , D , Z , S , J , ue , N , M , pe , G , U = r [ 0 ] . name + "" , Y , he , fe , j , ee , q , te , T , oe , be , F , C , ae , me , le , _e , f , ke , P , ge , ve , $e , se , ye , ne , Se , we , Te , re , Ce , Re , A , ie , H , ce , R , L , y = [ ] , Pe = new Map , Ae , O , $ = [ ] , Be = new Map , B ; v = new Ke ( { props : { js : `
2025-02-08 14:47:01 +08:00
import PocketBase from 'pocketbase' ;
const pb = new PocketBase ( '${r[3]}' ) ;
...
const authData = await pb . collection ( '${(qe=r[0])==null?void 0:qe.name}' ) . authRefresh ( ) ;
// after the above you can also access the refreshed auth data from the authStore
console . log ( pb . authStore . isValid ) ;
console . log ( pb . authStore . token ) ;
console . log ( pb . authStore . record . id ) ;
` ,dart: `
import 'package:pocketbase/pocketbase.dart' ;
final pb = PocketBase ( '${r[3]}' ) ;
...
final authData = await pb . collection ( '${(Fe=r[0])==null?void 0:Fe.name}' ) . authRefresh ( ) ;
// after the above you can also access the refreshed auth data from the authStore
print ( pb . authStore . isValid ) ;
print ( pb . authStore . token ) ;
print ( pb . authStore . record . id ) ;
` }}),P=new Ue({props:{content:"?expand=relField1,relField2.subRelField"}}),A=new et({props:{prefix:"record."}});let x=I(r[2]);const De=e=>e[5].code;for(let e=0;e<x.length;e+=1){let t=ze(r,x,e),c=De(t);Pe.set(c,y[e]=Je(c,t))}let V=I(r[2]);const Me=e=>e[5].code;for(let e=0;e<V.length;e+=1){let t=Ee(r,V,e),c=Me(t);Be.set(c, $ [e]=Ne(c,t))}return{c(){a=s("h3"),l=k("Auth refresh ("),m=k(n),_=k(")"),i=p(),h=s("div"),h.innerHTML= ` < p > Returns a new auth response ( token and record data ) for an
< strong > already authenticated record < / s t r o n g > . < / p > < p > T h i s m e t h o d i s u s u a l l y c a l l e d b y u s e r s o n p a g e / s c r e e n r e l o a d t o e n s u r e t h a t t h e p r e v i o u s l y s t o r e d d a t a
in < code > pb . authStore < / c o d e > i s s t i l l v a l i d a n d u p - t o - d a t e . < / p > ` , g = p ( ) , W ( v . $ $ . f r a g m e n t ) , w = p ( ) , D = s ( " h 6 " ) , D . t e x t C o n t e n t = " A P I d e t a i l s " , Z = p ( ) , S = s ( " d i v " ) , J = s ( " s t r o n g " ) , J . t e x t C o n t e n t = " P O S T " , u e = p ( ) , N = s ( " d i v " ) , M = s ( " p " ) , p e = k ( " / a p i / c o l l e c t i o n s / " ) , G = s ( " s t r o n g " ) , Y = k ( U ) , h e = k ( " / a u t h - r e f r e s h " ) , f e = p ( ) , j = s ( " p " ) , j . i n n e r H T M L = " R e q u i r e s < c o d e > A u t h o r i z a t i o n : T O K E N < / c o d e > h e a d e r " , e e = p ( ) , q = s ( " d i v " ) , q . t e x t C o n t e n t = " Q u e r y p a r a m e t e r s " , t e = p ( ) , T = s ( " t a b l e " ) , o e = s ( " t h e a d " ) , o e . i n n e r H T M L = ' < t r > < t h > P a r a m < / t h > < t h > T y p e < / t h > < t h w i d t h = " 6 0 % " > D e s c r i p t i o n < / t h > < / t r > ' , b e = p ( ) , F = s ( " t b o d y " ) , C = s ( " t r " ) , a e = s ( " t d " ) , a e . t e x t C o n t e n t = " e x p a n d " , m e = p ( ) , l e = s ( " t d " ) , l e . i n n e r H T M L = ' < s p a n c l a s s = " l a b e l " > S t r i n g < / s p a n > ' , _ e = p ( ) , f = s ( " t d " ) , k e = k ( ` A u t o e x p a n d r e c o r d r e l a t i o n s . E x . :
` ),W(P. $ $ .fragment),ge=k( `
Supports up to 6 - levels depth nested relations expansion . ` ),ve=s("br"), $ e=k( `
The expanded relations will be appended to the record under the
` ),se=s("code"),se.textContent="expand",ye=k(" property (eg. "),ne=s("code"),ne.textContent='"expand": {"relField1": {...}, ...}',Se=k( ` ) .
` ),we=s("br"),Te=k( `
Only the relations to which the request user has permissions to ` ),re=s("strong"),re.textContent="view",Ce=k(" will be expanded."),Re=p(),W(A. $ $ .fragment),ie=p(),H=s("div"),H.textContent="Responses",ce=p(),R=s("div"),L=s("div");for(let e=0;e<y.length;e+=1)y[e].c();Ae=p(),O=s("div");for(let e=0;e< $ .length;e+=1) $ [e].c();b(a,"class","m-b-sm"),b(h,"class","content txt-lg m-b-sm"),b(D,"class","m-b-xs"),b(J,"class","label label-primary"),b(N,"class","content"),b(j,"class","txt-hint txt-sm txt-right"),b(S,"class","alert alert-success"),b(q,"class","section-title"),b(T,"class","table-compact table-border m-b-base"),b(H,"class","section-title"),b(L,"class","tabs-header compact combined left"),b(O,"class","tabs-content"),b(R,"class","tabs")},m(e,t){u(e,a,t),o(a,l),o(a,m),o(a,_),u(e,i,t),u(e,h,t),u(e,g,t),Q(v,e,t),u(e,w,t),u(e,D,t),u(e,Z,t),u(e,S,t),o(S,J),o(S,ue),o(S,N),o(N,M),o(M,pe),o(M,G),o(G,Y),o(M,he),o(S,fe),o(S,j),u(e,ee,t),u(e,q,t),u(e,te,t),u(e,T,t),o(T,oe),o(T,be),o(T,F),o(F,C),o(C,ae),o(C,me),o(C,le),o(C,_e),o(C,f),o(f,ke),Q(P,f,null),o(f,ge),o(f,ve),o(f, $ e),o(f,se),o(f,ye),o(f,ne),o(f,Se),o(f,we),o(f,Te),o(f,re),o(f,Ce),o(F,Re),Q(A,F,null),u(e,ie,t),u(e,H,t),u(e,ce,t),u(e,R,t),o(R,L);for(let c=0;c<y.length;c+=1)y[c]&&y[c].m(L,null);o(R,Ae),o(R,O);for(let c=0;c< $ .length;c+=1) $ [c]&& $ [c].m(O,null);B=!0},p(e,[t]){var He,Le;(!B||t&1)&&n!==(n=e[0].name+"")&&de(m,n);const c={};t&9&&(c.js= `
import PocketBase from 'pocketbase' ;
const pb = new PocketBase ( '${e[3]}' ) ;
...
const authData = await pb . collection ( '${(He=e[0])==null?void 0:He.name}' ) . authRefresh ( ) ;
// after the above you can also access the refreshed auth data from the authStore
console . log ( pb . authStore . isValid ) ;
console . log ( pb . authStore . token ) ;
console . log ( pb . authStore . record . id ) ;
` ),t&9&&(c.dart= `
import 'package:pocketbase/pocketbase.dart' ;
final pb = PocketBase ( '${e[3]}' ) ;
...
final authData = await pb . collection ( '${(Le=e[0])==null?void 0:Le.name}' ) . authRefresh ( ) ;
// after the above you can also access the refreshed auth data from the authStore
print ( pb . authStore . isValid ) ;
print ( pb . authStore . token ) ;
print ( pb . authStore . record . id ) ;
` ),v. $ set(c),(!B||t&1)&&U!==(U=e[0].name+"")&&de(Y,U),t&6&&(x=I(e[2]),y=Oe(y,t,De,1,e,x,Pe,L,Qe,Je,null,ze)),t&6&&(V=I(e[2]),We(), $ =Oe( $ ,t,Me,1,e,V,Be,O,Xe,Ne,null,Ee),Ze())},i(e){if(!B){z(v. $ $ .fragment,e),z(P. $ $ .fragment,e),z(A. $ $ .fragment,e);for(let t=0;t<V.length;t+=1)z( $ [t]);B=!0}},o(e){E(v. $ $ .fragment,e),E(P. $ $ .fragment,e),E(A. $ $ .fragment,e);for(let t=0;t< $ .length;t+=1)E( $ [t]);B=!1},d(e){e&&(d(a),d(i),d(h),d(g),d(w),d(D),d(Z),d(S),d(ee),d(q),d(te),d(T),d(ie),d(H),d(ce),d(R)),K(v,e),K(P),K(A);for(let t=0;t<y.length;t+=1)y[t].d();for(let t=0;t< $ .length;t+=1) $ [t].d()}}}function ot(r,a,l){let n,{collection:m}=a,_=200,i=[];const h=g=>l(1,_=g.code);return r. $ $ set=g=>{"collection"in g&&l(0,m=g.collection)},r. $ $ .update=()=>{r. $ $ .dirty&1&&l(2,i=[{code:200,body:JSON.stringify({token:"JWT_TOKEN",record:Ve.dummyCollectionRecord(m)},null,2)},{code:401,body: `
{
"status" : 401 ,
"message" : "The request requires valid record authorization token to be set." ,
"data" : { }
}
` },{code:403,body: `
{
"status" : 403 ,
"message" : "The authorized record model is not allowed to perform this action." ,
"data" : { }
}
` },{code:404,body: `
{
"status" : 404 ,
"message" : "Missing auth record context." ,
"data" : { }
}
` }])},l(3,n=Ve.getApiExampleUrl(Ge.baseURL)),[m,_,i,n,h]}class st extends je{constructor(a){super(),xe(this,a,ot,tt,Ie,{collection:0})}}export{st as default};