@@ -54,8 +54,9 @@ export async function loadPocketbaseCollections(connection: Connection | undefin
5454 if ( ! connection ) throw new Error ( 'Missing connection parameters' ) ;
5555 const { url, email, password } = connection ;
5656 const pb = new PocketBase ( url ) ;
57- await pb . admins . authWithPassword ( email , password ) ;
58- return pb . collections . getFullList ( ) ;
57+ pb . collection ( '_superusers' ) . authWithPassword ( email , password ) ;
58+
59+ return await pb . collections . getFullList ( ) ;
5960}
6061
6162const genericMarkupDirectives = Object . entries ( {
@@ -75,26 +76,36 @@ export function generateMarkup(
7576 { direction, algorithm, showSystemAttributes, markRequiredAttributes, showSelectValues } : Settings
7677) {
7778 const entities : Record < string , Entity > = Object . fromEntries (
78- collections . map ( ( { id, name, schema, $isView } ) => {
79- let attributes : Attribute [ ] = [
80- ...( showSystemAttributes
81- ? $isView
82- ? viewSystemAttributes
83- : collectionSystemAttributes
84- : [ ] )
85- ] ;
86- attributes = attributes . concat (
87- schema . map ( ( { name, type, options, required } ) => ( {
88- name,
89- type,
90- options : options as AttributeOptions ,
91- required,
92- isRelation : type === 'relation'
93- } ) )
94- ) ;
95-
96- return [ id , { id : sanitizeId ( id ) , name, attributes, isView : $isView } ] ;
97- } )
79+ collections
80+ . filter ( ( { system } ) => ! system ) // Filter out system collections
81+ . map ( ( { id, name, fields, $isView } ) => {
82+ let attributes : Attribute [ ] = [
83+ ...( showSystemAttributes
84+ ? $isView
85+ ? viewSystemAttributes
86+ : collectionSystemAttributes
87+ : [ ] )
88+ ] ;
89+ attributes = attributes . concat (
90+ fields . map ( ( field ) => ( {
91+ name : field . name ,
92+ type : field . type ,
93+ options : {
94+ min : field . min ,
95+ max : field . max ,
96+ minSelect : field . minSelect ,
97+ maxSelect : field . maxSelect ,
98+ cascadeDelete : field . cascadeDelete ,
99+ collectionId : field . collectionId ,
100+ values : field . values
101+ } as AttributeOptions ,
102+ required : field . required ,
103+ isRelation : field . type === 'relation'
104+ } ) )
105+ ) ;
106+
107+ return [ id , { id : sanitizeId ( id ) , name, attributes, isView : $isView } ] ;
108+ } )
98109 ) ;
99110
100111 const entityValues = Object . values ( entities ) ;
0 commit comments