File tree Expand file tree Collapse file tree
src/routes/(console)/project-[region]-[project]/databases/database-[database]/(entity)/helpers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { sdk } from '$lib/stores/sdk' ;
2+ import { flags } from '$lib/flags' ;
3+ import { user } from '$lib/stores/user' ;
4+ import { organization } from '$lib/stores/organization' ;
5+ import { get } from 'svelte/store' ;
26import type { Page } from '@sveltejs/kit' ;
37import type { TerminologyResult } from './types' ;
48import {
@@ -173,11 +177,17 @@ export function useDatabaseSdk(
173177 } ,
174178
175179 async list ( params ) : Promise < Models . DatabaseList > {
176- const results = await Promise . all ( [
177- baseSdk . tablesDB . list ( params ) ,
178- baseSdk . documentsDB . list ( params ) ,
179- baseSdk . vectorsDB . list ( params )
180- ] ) ;
180+ const isMultiDb = flags . multiDb ( {
181+ account : get ( user ) ,
182+ organization : get ( organization )
183+ } ) ;
184+
185+ const calls : Array < Promise < Models . DatabaseList > > = [ baseSdk . tablesDB . list ( params ) ] ;
186+ if ( isMultiDb ) {
187+ calls . push ( baseSdk . documentsDB . list ( params ) , baseSdk . vectorsDB . list ( params ) ) ;
188+ }
189+
190+ const results = await Promise . all ( calls ) ;
181191
182192 return results . reduce (
183193 ( acc , curr ) => ( {
You can’t perform that action at this time.
0 commit comments