2024-12-09 10:33:44 +08:00
import { S as Ue , i as xe , s as Ke , V as Qe , W as Ne , X as K , h as s , z as k , j as p , c as Q , k as b , n as d , o , m as W , H as de , Y as Le , Z as We , E as Ge , _ as Ie , G as Xe , t as V , a as z , v as u , d as G , J as Oe , p as Ye , l as I , q as Ze } from "./index-BqD65rZb.js" ; import { F as et } from "./FieldsQueryParam-BESg3pfe.js" ; function Ve ( 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" ) , I ( l , "active" , a [ 1 ] === a [ 5 ] . code ) , this . first = l } , m ( v , w ) { d ( v , l , w ) , o ( l , m ) , o ( l , _ ) , i || ( h = Ze ( l , "click" , g ) , i = ! 0 ) } , p ( v , w ) { a = v , w & 4 && n !== ( n = a [ 5 ] . code + "" ) && de ( m , n ) , w & 6 && I ( l , "active" , a [ 1 ] === a [ 5 ] . code ) } , d ( v ) { v && u ( l ) , i = ! 1 , h ( ) } } } function Je ( r , a ) { let l , n , m , _ ; return n = new Ne ( { props : { content : a [ 5 ] . body } } ) , { key : r , first : null , c ( ) { l = s ( "div" ) , Q ( n . $$ . fragment ) , m = p ( ) , b ( l , "class" , "tab-item" ) , I ( l , "active" , a [ 1 ] === a [ 5 ] . code ) , this . first = l } , m ( i , h ) { d ( i , l , h ) , W ( 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 ) && I ( l , "active" , a [ 1 ] === a [ 5 ] . code ) } , i ( i ) { _ || ( V ( n . $$ . fragment , i ) , _ = ! 0 ) } , o ( i ) { z ( n . $$ . fragment , i ) , _ = ! 1 } , d ( i ) { i && u ( l ) , G ( n ) } } } function tt ( r ) { var De , Fe ; let a , l , n = r [ 0 ] . name + "" , m , _ , i , h , g , v , w , B , X , S , j , ue , J , M , pe , Y , N = r [ 0 ] . name + "" , Z , he , fe , U , ee , D , 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 , q , ie , H , ce , R , E , y = [ ] , Pe = new Map , qe , L , $ = [ ] , Ae = new Map , A ; v = new Qe ( { props : { js : `
2024-11-24 21:02:48 +08:00
import PocketBase from 'pocketbase' ;
const pb = new PocketBase ( '${r[3]}' ) ;
...
const authData = await pb . collection ( '${(De=r[0])==null?void 0:De.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 Ne({props:{content:"?expand=relField1,relField2.subRelField"}}),q=new et({props:{prefix:"record."}});let x=K(r[2]);const Be=e=>e[5].code;for(let e=0;e<x.length;e+=1){let t=ze(r,x,e),c=Be(t);Pe.set(c,y[e]=je(c,t))}let O=K(r[2]);const Me=e=>e[5].code;for(let e=0;e<O.length;e+=1){let t=Ve(r,O,e),c=Me(t);Ae.set(c, $ [e]=Je(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 ( ) , Q ( v . $ $ . f r a g m e n t ) , w = p ( ) , B = s ( " h 6 " ) , B . t e x t C o n t e n t = " A P I d e t a i l s " , X = 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 ( ) , J = s ( " d i v " ) , M = s ( " p " ) , p e = k ( " / a p i / c o l l e c t i o n s / " ) , Y = s ( " s t r o n g " ) , Z = k ( N ) , h e = k ( " / a u t h - r e f r e s h " ) , f e = p ( ) , U = s ( " p " ) , U . 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 ( ) , D = s ( " d i v " ) , D . 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 . :
` ),Q(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(),Q(q. $ $ .fragment),ie=p(),H=s("div"),H.textContent="Responses",ce=p(),R=s("div"),E=s("div");for(let e=0;e<y.length;e+=1)y[e].c();qe=p(),L=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(B,"class","m-b-xs"),b(j,"class","label label-primary"),b(J,"class","content"),b(U,"class","txt-hint txt-sm txt-right"),b(S,"class","alert alert-success"),b(D,"class","section-title"),b(T,"class","table-compact table-border m-b-base"),b(H,"class","section-title"),b(E,"class","tabs-header compact combined left"),b(L,"class","tabs-content"),b(R,"class","tabs")},m(e,t){d(e,a,t),o(a,l),o(a,m),o(a,_),d(e,i,t),d(e,h,t),d(e,g,t),W(v,e,t),d(e,w,t),d(e,B,t),d(e,X,t),d(e,S,t),o(S,j),o(S,ue),o(S,J),o(J,M),o(M,pe),o(M,Y),o(Y,Z),o(M,he),o(S,fe),o(S,U),d(e,ee,t),d(e,D,t),d(e,te,t),d(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),W(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),W(q,F,null),d(e,ie,t),d(e,H,t),d(e,ce,t),d(e,R,t),o(R,E);for(let c=0;c<y.length;c+=1)y[c]&&y[c].m(E,null);o(R,qe),o(R,L);for(let c=0;c< $ .length;c+=1) $ [c]&& $ [c].m(L,null);A=!0},p(e,[t]){var He,Ee;(!A||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 ( '${(Ee=e[0])==null?void 0:Ee.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),(!A||t&1)&&N!==(N=e[0].name+"")&&de(Z,N),t&6&&(x=K(e[2]),y=Le(y,t,Be,1,e,x,Pe,E,We,je,null,ze)),t&6&&(O=K(e[2]),Ge(), $ =Le( $ ,t,Me,1,e,O,Ae,L,Ie,Je,null,Ve),Xe())},i(e){if(!A){V(v. $ $ .fragment,e),V(P. $ $ .fragment,e),V(q. $ $ .fragment,e);for(let t=0;t<O.length;t+=1)V( $ [t]);A=!0}},o(e){z(v. $ $ .fragment,e),z(P. $ $ .fragment,e),z(q. $ $ .fragment,e);for(let t=0;t< $ .length;t+=1)z( $ [t]);A=!1},d(e){e&&(u(a),u(i),u(h),u(g),u(w),u(B),u(X),u(S),u(ee),u(D),u(te),u(T),u(ie),u(H),u(ce),u(R)),G(v,e),G(P),G(q);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:Oe.dummyCollectionRecord(m)},null,2)},{code:401,body: `
{
"code" : 401 ,
"message" : "The request requires valid record authorization token to be set." ,
"data" : { }
}
` },{code:403,body: `
{
"code" : 403 ,
"message" : "The authorized record model is not allowed to perform this action." ,
"data" : { }
}
` },{code:404,body: `
{
"code" : 404 ,
"message" : "Missing auth record context." ,
"data" : { }
}
` }])},l(3,n=Oe.getApiExampleUrl(Ye.baseURL)),[m,_,i,n,h]}class st extends Ue{constructor(a){super(),xe(this,a,ot,tt,Ke,{collection:0})}}export{st as default};