MCPcopy Create free account
hub / github.com/firebase/firebase-tools / pickServices

Function pickServices

src/dataconnect/load.ts:43–71  ·  view source on GitHub ↗
(
  projectId: string,
  config: Config,
  serviceId?: string,
  location?: string,
)

Source from the content-addressed store, hash-verified

41
42/** Picks SQL Connect services based on flags. */
43export async function pickServices(
44 projectId: string,
45 config: Config,
46 serviceId?: string,
47 location?: string,
48): Promise<ServiceInfo[]> {
49 const serviceInfos = await loadAll(projectId, config);
50 if (serviceInfos.length === 0) {
51 throw new FirebaseError(
52 "No SQL Connect services found in firebase.json. " +
53 `\nYou can run ${clc.bold("firebase init dataconnect")} to add a SQL Connect service.`,
54 );
55 }
56
57 const matchingServices = serviceInfos.filter(
58 (i) =>
59 (!serviceId || i.dataConnectYaml.serviceId === serviceId) &&
60 (!location || i.dataConnectYaml.location === location),
61 );
62 if (matchingServices.length === 0) {
63 const serviceIds = serviceInfos.map(
64 (i) => `${i.dataConnectYaml.location}:${i.dataConnectYaml.serviceId}`,
65 );
66 throw new FirebaseError(
67 `No service matched service in firebase.json. Available services: ${serviceIds.join(", ")}`,
68 );
69 }
70 return matchingServices;
71}
72
73/**
74 * Loads all SQL Connect service configurations from the firebase.json file.

Callers 4

loadAllWithSDKsFunction · 0.90
compile.tsFile · 0.90
pickOneServiceFunction · 0.70

Calls 1

loadAllFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…