@@ -37,36 +37,46 @@ if (EXPORT_DOCS) {
3737 ...DEFAULT_POOL_CONFIG ,
3838 connectionString : PG_CONNECTION ,
3939 } )
40- const { data : schemas , error : schemasError } = await pgMeta . schemas . list ( )
41- const { data : tables , error : tablesError } = await pgMeta . tables . list ( {
42- includedSchemas :
43- GENERATE_TYPES_INCLUDED_SCHEMAS . length > 0 ? GENERATE_TYPES_INCLUDED_SCHEMAS : undefined ,
44- includeColumns : false ,
45- } )
46- const { data : views , error : viewsError } = await pgMeta . views . list ( {
47- includedSchemas :
48- GENERATE_TYPES_INCLUDED_SCHEMAS . length > 0 ? GENERATE_TYPES_INCLUDED_SCHEMAS : undefined ,
49- includeColumns : false ,
50- } )
51- const { data : materializedViews , error : materializedViewsError } =
52- await pgMeta . materializedViews . list ( {
40+ const [
41+ { data : schemas , error : schemasError } ,
42+ { data : tables , error : tablesError } ,
43+ { data : views , error : viewsError } ,
44+ { data : materializedViews , error : materializedViewsError } ,
45+ { data : columns , error : columnsError } ,
46+ { data : relationships , error : relationshipsError } ,
47+ { data : functions , error : functionsError } ,
48+ { data : types , error : typesError } ,
49+ ] = await Promise . all ( [
50+ pgMeta . schemas . list ( ) ,
51+ pgMeta . tables . list ( {
5352 includedSchemas :
5453 GENERATE_TYPES_INCLUDED_SCHEMAS . length > 0 ? GENERATE_TYPES_INCLUDED_SCHEMAS : undefined ,
5554 includeColumns : false ,
56- } )
57- const { data : columns , error : columnsError } = await pgMeta . columns . list ( {
58- includedSchemas :
59- GENERATE_TYPES_INCLUDED_SCHEMAS . length > 0 ? GENERATE_TYPES_INCLUDED_SCHEMAS : undefined ,
60- } )
61- const { data : relationships , error : relationshipsError } = await pgMeta . relationships . list ( )
62- const { data : functions , error : functionsError } = await pgMeta . functions . list ( {
63- includedSchemas :
64- GENERATE_TYPES_INCLUDED_SCHEMAS . length > 0 ? GENERATE_TYPES_INCLUDED_SCHEMAS : undefined ,
65- } )
66- const { data : types , error : typesError } = await pgMeta . types . list ( {
67- includeArrayTypes : true ,
68- includeSystemSchemas : true ,
69- } )
55+ } ) ,
56+ pgMeta . views . list ( {
57+ includedSchemas :
58+ GENERATE_TYPES_INCLUDED_SCHEMAS . length > 0 ? GENERATE_TYPES_INCLUDED_SCHEMAS : undefined ,
59+ includeColumns : false ,
60+ } ) ,
61+ pgMeta . materializedViews . list ( {
62+ includedSchemas :
63+ GENERATE_TYPES_INCLUDED_SCHEMAS . length > 0 ? GENERATE_TYPES_INCLUDED_SCHEMAS : undefined ,
64+ includeColumns : false ,
65+ } ) ,
66+ pgMeta . columns . list ( {
67+ includedSchemas :
68+ GENERATE_TYPES_INCLUDED_SCHEMAS . length > 0 ? GENERATE_TYPES_INCLUDED_SCHEMAS : undefined ,
69+ } ) ,
70+ pgMeta . relationships . list ( ) ,
71+ pgMeta . functions . list ( {
72+ includedSchemas :
73+ GENERATE_TYPES_INCLUDED_SCHEMAS . length > 0 ? GENERATE_TYPES_INCLUDED_SCHEMAS : undefined ,
74+ } ) ,
75+ pgMeta . types . list ( {
76+ includeArrayTypes : true ,
77+ includeSystemSchemas : true ,
78+ } ) ,
79+ ] )
7080 await pgMeta . end ( )
7181
7282 if ( schemasError ) {
@@ -96,21 +106,21 @@ if (EXPORT_DOCS) {
96106
97107 console . log (
98108 applyTypescriptTemplate ( {
99- schemas : schemas . filter (
109+ schemas : schemas ! . filter (
100110 ( { name } ) =>
101111 GENERATE_TYPES_INCLUDED_SCHEMAS . length === 0 ||
102112 GENERATE_TYPES_INCLUDED_SCHEMAS . includes ( name )
103113 ) ,
104- tables,
105- views,
106- materializedViews,
107- columns,
108- relationships,
109- functions : functions . filter (
114+ tables : tables ! ,
115+ views : views ! ,
116+ materializedViews : materializedViews ! ,
117+ columns : columns ! ,
118+ relationships : relationships ! ,
119+ functions : functions ! . filter (
110120 ( { return_type } ) => ! [ 'trigger' , 'event_trigger' ] . includes ( return_type )
111121 ) ,
112- types : types . filter ( ( { name } ) => name [ 0 ] !== '_' ) ,
113- arrayTypes : types . filter ( ( { name } ) => name [ 0 ] === '_' ) ,
122+ types : types ! . filter ( ( { name } ) => name [ 0 ] !== '_' ) ,
123+ arrayTypes : types ! . filter ( ( { name } ) => name [ 0 ] === '_' ) ,
114124 detectOneToOneRelationships : GENERATE_TYPES_DETECT_ONE_TO_ONE_RELATIONSHIPS ,
115125 } )
116126 )
0 commit comments