firebase-tools-with-isolate 15.13.0 → 15.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +17 -17
  2. package/lib/api.js +2 -6
  3. package/lib/apphosting/constants.js +1 -1
  4. package/lib/command.js +7 -0
  5. package/lib/commands/dataconnect-compile.js +6 -6
  6. package/lib/commands/dataconnect-execute.js +1 -1
  7. package/lib/commands/dataconnect-sdk-generate.js +3 -3
  8. package/lib/commands/dataconnect-services-list.js +1 -1
  9. package/lib/commands/dataconnect-sql-diff.js +3 -3
  10. package/lib/commands/dataconnect-sql-grant.js +2 -2
  11. package/lib/commands/dataconnect-sql-migrate.js +4 -4
  12. package/lib/commands/dataconnect-sql-setup.js +2 -2
  13. package/lib/commands/dataconnect-sql-shell.js +4 -4
  14. package/lib/commands/ext-dev-usage.js +0 -2
  15. package/lib/commands/init.js +3 -3
  16. package/lib/commands/open.js +1 -1
  17. package/lib/commands/setup-emulators-dataconnect.js +1 -1
  18. package/lib/dataconnect/freeTrial.js +2 -2
  19. package/lib/dataconnect/load.js +2 -2
  20. package/lib/dataconnect/provisionCloudSql.js +3 -3
  21. package/lib/dataconnect/schemaMigration.js +11 -11
  22. package/lib/dataconnect/webhook.js +1 -1
  23. package/lib/deploy/functions/backend.js +1 -1
  24. package/lib/deploy/functions/build.js +3 -3
  25. package/lib/deploy/functions/deploy.js +5 -2
  26. package/lib/deploy/functions/prepare.js +59 -1
  27. package/lib/deploy/functions/prepareFunctionsUpload.js +25 -9
  28. package/lib/deploy/functions/release/fabricator.js +59 -46
  29. package/lib/deploy/functions/release/index.js +5 -0
  30. package/lib/deploy/functions/release/planner.js +1 -1
  31. package/lib/deploy/functions/runtimes/dart/index.js +3 -1
  32. package/lib/deploy/functions/runtimes/dart/triggerSupport.js +123 -0
  33. package/lib/deploy/functions/runtimes/index.js +1 -4
  34. package/lib/deploy/functions/runtimes/supported/index.js +0 -4
  35. package/lib/deploy/functions/services/ailogic.js +17 -5
  36. package/lib/deploy/functions/services/dataconnect.js +1 -1
  37. package/lib/deploy/functions/services/index.js +2 -2
  38. package/lib/deploy/functions/validate.js +7 -1
  39. package/lib/emulator/constants.js +1 -1
  40. package/lib/emulator/controller.js +13 -2
  41. package/lib/emulator/dataconnectEmulator.js +14 -14
  42. package/lib/emulator/dataconnectToolkitController.js +2 -2
  43. package/lib/emulator/downloadableEmulatorInfo.json +31 -31
  44. package/lib/emulator/downloadableEmulators.js +1 -0
  45. package/lib/emulator/extensionsEmulator.js +1 -2
  46. package/lib/emulator/functionsEmulator.js +20 -6
  47. package/lib/emulator/functionsRuntimeWorker.js +1 -1
  48. package/lib/emulator/hub.js +3 -3
  49. package/lib/emulator/hubExport.js +2 -2
  50. package/lib/emulator/initEmulators.js +1 -1
  51. package/lib/experiments.js +11 -6
  52. package/lib/frameworks/next/constants.js +2 -1
  53. package/lib/frameworks/next/index.js +3 -2
  54. package/lib/frameworks/next/utils.js +50 -12
  55. package/lib/functions/events/v2.js +10 -1
  56. package/lib/gcp/ailogic.js +13 -9
  57. package/lib/gcp/runv2.js +9 -2
  58. package/lib/init/features/dataconnect/index.js +7 -7
  59. package/lib/init/features/dataconnect/resolver.js +2 -2
  60. package/lib/init/features/dataconnect/sdk.js +8 -8
  61. package/lib/init/features/functions/index.js +1 -1
  62. package/lib/mcp/prompts/dataconnect/schema.js +6 -6
  63. package/lib/mcp/resources/guides/init_data_connect.js +2 -2
  64. package/lib/mcp/resources/guides/init_firestore.js +1 -1
  65. package/lib/mcp/tools/core/init.js +9 -9
  66. package/lib/mcp/tools/dataconnect/compile.js +5 -5
  67. package/lib/mcp/tools/dataconnect/execute.js +6 -6
  68. package/lib/mcp/tools/dataconnect/list_services.js +7 -7
  69. package/lib/mcp/util/dataconnect/content.js +19 -19
  70. package/lib/tsconfig.publish.tsbuildinfo +1 -1
  71. package/package.json +19 -6
  72. package/schema/firebase-config.json +3 -0
  73. package/templates/init/functions/dart/pubspec.yaml +6 -7
  74. package/templates/init/functions/dart/server.dart +3 -1
  75. package/lib/shortenUrl.js +0 -28
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.client = exports.AI_LOGIC_TRIGGERS_TO_EVENTS = exports.AI_LOGIC_EVENTS_TO_TRIGGER = exports.API_VERSION = void 0;
3
+ exports.client = exports.AI_LOGIC_TRIGGERS_TO_EVENTS = exports.AI_LOGIC_EVENTS_TO_TRIGGER = exports.AI_LOGIC_AFTER_GENERATE_CONTENT = exports.AI_LOGIC_BEFORE_GENERATE_CONTENT = exports.API_VERSION = void 0;
4
4
  exports.createTrigger = createTrigger;
5
5
  exports.getTrigger = getTrigger;
6
6
  exports.updateTrigger = updateTrigger;
@@ -10,15 +10,17 @@ exports.upsertBlockingFunction = upsertBlockingFunction;
10
10
  exports.deleteBlockingFunction = deleteBlockingFunction;
11
11
  const apiv2_1 = require("../apiv2");
12
12
  const api_1 = require("../api");
13
- const ailogic_1 = require("../deploy/functions/services/ailogic");
13
+ const error_1 = require("../error");
14
14
  exports.API_VERSION = "v1beta";
15
+ exports.AI_LOGIC_BEFORE_GENERATE_CONTENT = "google.firebase.ailogic.v1.beforeGenerate";
16
+ exports.AI_LOGIC_AFTER_GENERATE_CONTENT = "google.firebase.ailogic.v1.afterGenerate";
15
17
  exports.AI_LOGIC_EVENTS_TO_TRIGGER = {
16
- [ailogic_1.AI_LOGIC_BEFORE_GENERATE_CONTENT]: "before-generate-content",
17
- [ailogic_1.AI_LOGIC_AFTER_GENERATE_CONTENT]: "after-generate-content",
18
+ [exports.AI_LOGIC_BEFORE_GENERATE_CONTENT]: "before-generate-content",
19
+ [exports.AI_LOGIC_AFTER_GENERATE_CONTENT]: "after-generate-content",
18
20
  };
19
21
  exports.AI_LOGIC_TRIGGERS_TO_EVENTS = {
20
- "before-generate-content": ailogic_1.AI_LOGIC_BEFORE_GENERATE_CONTENT,
21
- "after-generate-content": ailogic_1.AI_LOGIC_AFTER_GENERATE_CONTENT,
22
+ "before-generate-content": exports.AI_LOGIC_BEFORE_GENERATE_CONTENT,
23
+ "after-generate-content": exports.AI_LOGIC_AFTER_GENERATE_CONTENT,
22
24
  };
23
25
  exports.client = new apiv2_1.Client({
24
26
  urlPrefix: (0, api_1.aiLogicProxyOrigin)(),
@@ -52,7 +54,7 @@ async function updateTrigger(projectId, location, triggerId, trigger, updateMask
52
54
  const res = await exports.client.patch(name, trigger, { queryParams });
53
55
  return res.body;
54
56
  }
55
- async function deleteTrigger(projectId, location, triggerId, allowMissing = false, validateOnly = false, etag) {
57
+ async function deleteTrigger(projectId, location, triggerId, allowMissing = true, validateOnly = false, etag) {
56
58
  const name = `projects/${projectId}/locations/${location}/triggers/${triggerId}`;
57
59
  const queryParams = {
58
60
  allowMissing: allowMissing ? "true" : "false",
@@ -94,8 +96,10 @@ async function upsertBlockingFunction(endpoint) {
94
96
  return await createTrigger(endpoint.project, location, triggerId, triggerBody);
95
97
  }
96
98
  catch (err) {
97
- if (err && typeof err === "object" && "status" in err && err.status === 409) {
98
- return await updateTrigger(endpoint.project, location, triggerId, triggerBody);
99
+ if ((0, error_1.getErrStatus)(err) === 409) {
100
+ return await updateTrigger(endpoint.project, location, triggerId, triggerBody, [
101
+ "cloudFunction",
102
+ ]);
99
103
  }
100
104
  throw err;
101
105
  }
package/lib/gcp/runv2.js CHANGED
@@ -99,6 +99,7 @@ async function listServices(projectId) {
99
99
  if (res.body.services) {
100
100
  for (const service of res.body.services) {
101
101
  if (service.labels?.[exports.CLIENT_NAME_LABEL] === "cloud-functions" ||
102
+ service.labels?.[exports.CLIENT_NAME_LABEL] === "cloudfunctions" ||
102
103
  service.labels?.[exports.CLIENT_NAME_LABEL] === "firebase-functions") {
103
104
  allServices.push(service);
104
105
  }
@@ -134,10 +135,13 @@ function endpointFromService(service) {
134
135
  }
135
136
  const cpu = Number(service.template.containers[0].resources.limits.cpu);
136
137
  const endpoint = {
137
- platform: service.labels?.[exports.CLIENT_NAME_LABEL] === "cloud-functions" ? "gcfv2" : "run",
138
+ platform: service.labels?.[exports.CLIENT_NAME_LABEL] === "cloud-functions" ||
139
+ service.labels?.[exports.CLIENT_NAME_LABEL] === "cloudfunctions"
140
+ ? "gcfv2"
141
+ : "run",
138
142
  id,
139
143
  project,
140
- labels: service.labels || {},
144
+ labels: { ...service.labels, "deployment-tool": "cli-firebase" },
141
145
  region: location,
142
146
  runtime: service.labels?.[exports.RUNTIME_LABEL] || (0, supported_1.latest)("nodejs"),
143
147
  availableMemoryMb: memory,
@@ -206,6 +210,9 @@ function serviceFromEndpoint(endpoint, image) {
206
210
  }),
207
211
  };
208
212
  const template = {
213
+ annotations: {
214
+ "run.googleapis.com/client-name": "cli-firebase",
215
+ },
209
216
  containers: [
210
217
  {
211
218
  name: "worker",
@@ -102,7 +102,7 @@ async function actuate(setup, config, options) {
102
102
  config.set("emulators.dataconnect.dataDir", dataDir);
103
103
  const info = setup.featureInfo?.dataconnect;
104
104
  if (!info) {
105
- throw new Error("Data Connect feature RequiredInfo is not provided");
105
+ throw new Error("SQL Connect feature RequiredInfo is not provided");
106
106
  }
107
107
  info.serviceId = info.serviceId || defaultServiceId();
108
108
  info.cloudSqlInstanceId = info.cloudSqlInstanceId || `${info.serviceId.toLowerCase()}-fdc`;
@@ -130,11 +130,11 @@ async function actuate(setup, config, options) {
130
130
  }, Date.now() - startTime);
131
131
  }
132
132
  if (info.appDescription) {
133
- setup.instructions.push(`You can visualize the Data Connect Schema in Firebase Console:
133
+ setup.instructions.push(`You can visualize the SQL Connect Schema in Firebase Console:
134
134
 
135
135
  https://console.firebase.google.com/project/${setup.projectId}/dataconnect/locations/${info.locationId}/services/${info.serviceId}/schema`);
136
136
  }
137
- setup.instructions.push(`Install the Data Connect VS Code Extensions. You can explore Data Connect Query on local pgLite and Cloud SQL Postgres Instance.`);
137
+ setup.instructions.push(`Install the SQL Connect VS Code Extensions. You can explore SQL Connect Query on local pgLite and Cloud SQL Postgres Instance.`);
138
138
  }
139
139
  async function actuateWithInfo(setup, config, info, options) {
140
140
  const projectId = setup.projectId;
@@ -166,10 +166,10 @@ async function actuateWithInfo(setup, config, info, options) {
166
166
  return await writeFiles(config, info, templateServiceInfo, options);
167
167
  }
168
168
  const serviceAlreadyExists = !(await (0, client_1.createService)(projectId, info.locationId, info.serviceId));
169
- const schemaGql = await (0, utils_1.promiseWithSpinner)(() => (0, fdcExperience_1.generateSchema)(info.appDescription, projectId), "Generating the Data Connect Schema...");
169
+ const schemaGql = await (0, utils_1.promiseWithSpinner)(() => (0, fdcExperience_1.generateSchema)(info.appDescription, projectId), "Generating the SQL Connect Schema...");
170
170
  const schemaFiles = [{ path: "schema.gql", content: schemaGql }];
171
171
  if (serviceAlreadyExists) {
172
- (0, utils_1.logLabeledError)("dataconnect", `Data Connect Service ${serviceName} already exists. Skip saving them...`);
172
+ (0, utils_1.logLabeledError)("dataconnect", `SQL Connect Service ${serviceName} already exists. Skip saving them...`);
173
173
  info.flow += "_save_gemini_service_already_exists";
174
174
  return await writeFiles(config, info, { schemaGql: schemaFiles, connectors: [] }, options);
175
175
  }
@@ -179,12 +179,12 @@ async function actuateWithInfo(setup, config, info, options) {
179
179
  if (waitForCloudSQLProvision) {
180
180
  void (0, client_1.upsertSchema)(waitForCloudSQLProvision);
181
181
  }
182
- }, "Saving the Data Connect Schema...");
182
+ }, "Saving the SQL Connect Schema...");
183
183
  try {
184
184
  const [operationGql, seedDataGql] = await (0, utils_1.promiseWithSpinner)(() => Promise.all([
185
185
  (0, fdcExperience_1.generateOperation)(fdcExperience_1.PROMPT_GENERATE_CONNECTOR, serviceName, projectId),
186
186
  (0, fdcExperience_1.generateOperation)(fdcExperience_1.PROMPT_GENERATE_SEED_DATA, serviceName, projectId),
187
- ]), "Generating the Data Connect Operations...");
187
+ ]), "Generating the SQL Connect Operations...");
188
188
  const connectors = [
189
189
  {
190
190
  id: "example",
@@ -25,7 +25,7 @@ async function askQuestions(setup, config, options) {
25
25
  };
26
26
  const serviceInfos = await (0, load_1.loadAll)(setup.projectId || "", config);
27
27
  if (!serviceInfos.length) {
28
- throw new Error(`No Firebase Data Connect workspace found. Run ${clc.bold("firebase init dataconnect")} to set up a service and main schema.`);
28
+ throw new Error(`No Firebase SQL Connect workspace found. Run ${clc.bold("firebase init dataconnect")} to set up a service and main schema.`);
29
29
  }
30
30
  else if (serviceInfos.length === 1) {
31
31
  resolverInfo.serviceInfo = serviceInfos[0];
@@ -69,7 +69,7 @@ async function actuate(setup, config) {
69
69
  }
70
70
  const resolverInfo = setup.featureInfo?.dataconnectResolver;
71
71
  if (!resolverInfo) {
72
- throw new Error("Data Connect resolver feature ResolverRequiredInfo not provided");
72
+ throw new Error("SQL Connect resolver feature ResolverRequiredInfo not provided");
73
73
  }
74
74
  const startTime = Date.now();
75
75
  try {
@@ -109,7 +109,7 @@ async function chooseApp() {
109
109
  };
110
110
  });
111
111
  const pickedApps = await (0, prompt_1.checkbox)({
112
- message: "Which apps do you want to set up Data Connect SDKs in?",
112
+ message: "Which apps do you want to set up SQL Connect SDKs in?",
113
113
  choices,
114
114
  validate: (choices) => {
115
115
  if (choices.length === 0) {
@@ -128,7 +128,7 @@ async function chooseApp() {
128
128
  async function actuate(setup, config) {
129
129
  const sdkInfo = setup.featureInfo?.dataconnectSdk;
130
130
  if (!sdkInfo) {
131
- throw new Error("Data Connect SDK feature RequiredInfo is not provided");
131
+ throw new Error("SQL Connect SDK feature RequiredInfo is not provided");
132
132
  }
133
133
  const startTime = Date.now();
134
134
  try {
@@ -183,7 +183,7 @@ async function actuateWithInfo(setup, config, info) {
183
183
  if (!info.apps.length) {
184
184
  info.apps = await (0, appUtils_1.detectApps)(cwd);
185
185
  if (!info.apps.length) {
186
- (0, utils_1.logLabeledBullet)("dataconnect", "No apps to setup Data Connect Generated SDKs");
186
+ (0, utils_1.logLabeledBullet)("dataconnect", "No apps to setup SQL Connect Generated SDKs");
187
187
  return;
188
188
  }
189
189
  }
@@ -209,17 +209,17 @@ async function actuateWithInfo(setup, config, info) {
209
209
  });
210
210
  }
211
211
  catch (e) {
212
- (0, utils_1.logLabeledError)("dataconnect", `Failed to generate Data Connect SDKs\n${e?.message}`);
212
+ (0, utils_1.logLabeledError)("dataconnect", `Failed to generate SQL Connect SDKs\n${e?.message}`);
213
213
  }
214
214
  (0, utils_1.logLabeledSuccess)("dataconnect", `Installed generated SDKs for ${clc.bold(apps.map((a) => (0, appUtils_1.appDescription)(a)).join(", "))}`);
215
215
  if (apps.some((a) => a.platform === appUtils_1.Platform.IOS)) {
216
216
  (0, utils_1.logBullet)(clc.bold("Please follow the instructions here to add your generated sdk to your XCode project:\n\thttps://firebase.google.com/docs/data-connect/ios-sdk#set-client"));
217
217
  }
218
218
  if (apps.some((a) => a.frameworks?.includes(appUtils_1.Framework.REACT))) {
219
- (0, utils_1.logBullet)("Visit https://firebase.google.com/docs/data-connect/web-sdk#react for more information on how to set up React Generated SDKs for Firebase Data Connect");
219
+ (0, utils_1.logBullet)("Visit https://firebase.google.com/docs/data-connect/web-sdk#react for more information on how to set up React Generated SDKs for Firebase SQL Connect");
220
220
  }
221
221
  if (apps.some((a) => a.frameworks?.includes(appUtils_1.Framework.ANGULAR))) {
222
- (0, utils_1.logBullet)("Run `ng add @angular/fire` to install angular sdk dependencies.\nVisit https://github.com/invertase/tanstack-query-firebase/tree/main/packages/angular for more information on how to set up Angular Generated SDKs for Firebase Data Connect");
222
+ (0, utils_1.logBullet)("Run `ng add @angular/fire` to install angular sdk dependencies.\nVisit https://github.com/invertase/tanstack-query-firebase/tree/main/packages/angular for more information on how to set up Angular Generated SDKs for Firebase SQL Connect");
223
223
  }
224
224
  }
225
225
  async function chooseExistingConnector(setup, config) {
@@ -235,7 +235,7 @@ async function chooseExistingConnector(setup, config) {
235
235
  })
236
236
  .flat();
237
237
  if (!choices.length) {
238
- throw new error_1.FirebaseError(`No Firebase Data Connect workspace found. Run ${clc.bold("firebase init dataconnect")} to set up a service and connector.`);
238
+ throw new error_1.FirebaseError(`No Firebase SQL Connect workspace found. Run ${clc.bold("firebase init dataconnect")} to set up a service and connector.`);
239
239
  }
240
240
  if (choices.length === 1) {
241
241
  return choices[0].value;
@@ -346,7 +346,7 @@ function addSdkGenerateToConnectorYaml(connectorInfo, connectorYaml, app) {
346
346
  break;
347
347
  }
348
348
  default:
349
- throw new error_1.FirebaseError(`Unsupported platform ${app.platform} for Data Connect SDK generation. Supported platforms are: ${Object.values(appUtils_1.Platform).join(", ")}\n${JSON.stringify(app)}`);
349
+ throw new error_1.FirebaseError(`Unsupported platform ${app.platform} for SQL Connect SDK generation. Supported platforms are: ${Object.values(appUtils_1.Platform).join(", ")}\n${JSON.stringify(app)}`);
350
350
  }
351
351
  }
352
352
  function dedupeAppsByPlatformAndDirectory(apps) {
@@ -145,7 +145,7 @@ async function languageSetup(setup) {
145
145
  value: "python",
146
146
  });
147
147
  }
148
- if (experiments.isEnabled("functionsrunapionly")) {
148
+ if (experiments.isEnabled("dartfunctions")) {
149
149
  choices.push({
150
150
  name: "Dart",
151
151
  value: "dart",
@@ -8,10 +8,10 @@ const content_1 = require("../../util/dataconnect/content");
8
8
  const compile_1 = require("../../util/dataconnect/compile");
9
9
  function renderServices(fdcServices) {
10
10
  if (!fdcServices.length)
11
- return "Data Connect Status: <UNCONFIGURED>";
12
- return `\n\n## Data Connect Schema
11
+ return "SQL Connect Status: <UNCONFIGURED>";
12
+ return `\n\n## SQL Connect Schema
13
13
 
14
- The following is the up-to-date content of existing schema files (their paths are relative to the Data Connect source directory).
14
+ The following is the up-to-date content of existing schema files (their paths are relative to the SQL Connect source directory).
15
15
 
16
16
  ${(0, types_1.mainSchema)(fdcServices[0].schemas)
17
17
  .source.files?.map((f) => `\`\`\`graphql ${f.path}\n${f.content}\n\`\`\``)
@@ -22,7 +22,7 @@ function renderErrors(errors) {
22
22
  }
23
23
  exports.schema = (0, prompt_1.prompt)("core", {
24
24
  name: "schema",
25
- description: "Generate or update your Firebase Data Connect schema.",
25
+ description: "Generate or update your Firebase SQL Connect schema.",
26
26
  arguments: [
27
27
  {
28
28
  name: "prompt",
@@ -31,7 +31,7 @@ exports.schema = (0, prompt_1.prompt)("core", {
31
31
  },
32
32
  ],
33
33
  annotations: {
34
- title: "Generate Data Connect Schema",
34
+ title: "Generate SQL Connect Schema",
35
35
  },
36
36
  }, async ({ prompt }, { config, projectId, accountEmail }) => {
37
37
  const fdcServices = await (0, load_1.loadAll)(projectId, config);
@@ -58,7 +58,7 @@ ${prompt}
58
58
 
59
59
  ==== TASK INSTRUCTIONS ====
60
60
 
61
- 1. If Data Connect is marked as \`<UNCONFIGURED>\`, first run the \`firebase_init\` tool with \`{dataconnect: {}}\` arguments to initialize it.
61
+ 1. If SQL Connect is marked as \`<UNCONFIGURED>\`, first run the \`firebase_init\` tool with \`{dataconnect: {}}\` arguments to initialize it.
62
62
  2. If there is not an existing schema to work with (or the existing schema is the commented-out default schema about a movie app), follow the user's prompt to generate a robust schema meeting the specified requirements.
63
63
  3. If there is already a schema, perform edits to the existing schema file(s) based on the user's instructions. If schema build errors are present and seem relevant to your changes, attempt to fix them.
64
64
  4. After you have performed edits on the schema, run the \`dataconnect_compile\` tool to build the schema and see if there are any errors. Fix errors that are related to the user's prompt or your changes.
@@ -5,8 +5,8 @@ const resource_1 = require("../../resource");
5
5
  exports.init_data_connect = (0, resource_1.resource)({
6
6
  uri: "firebase://guides/init/data_connect",
7
7
  name: "data_connect_init_guide",
8
- title: "Firebase Data Connect Init Guide",
9
- description: "guides the coding agent through configuring Data Connect for PostgreSQL access in the current project",
8
+ title: "Firebase SQL Connect Init Guide",
9
+ description: "guides the coding agent through configuring SQL Connect for PostgreSQL access in the current project",
10
10
  }, async (uri) => {
11
11
  return {
12
12
  contents: [
@@ -19,7 +19,7 @@ exports.init_firestore = (0, resource_1.resource)({
19
19
  **Database Setup:**
20
20
  - Configure Firestore as the application's primary database.
21
21
  - Implement client-side CRUD using the Firebase SDK.
22
- - Present the app's Firestore data model to the user. Do not confuse Firestore's document model (NoSQL) with Firebase Data Connect's schema.
22
+ - Present the app's Firestore data model to the user. Do not confuse Firestore's document model (NoSQL) with Firebase SQL Connect's schema.
23
23
  - Write the default \`firestore.rules\` file (see below) explain what they do, and obtain the user's confirmation before deploying.
24
24
  - Run \`firebase deploy --only firestore\` to create the database automatically Do not ask the user to create it in the console.
25
25
  - Use production environment directly (avoid emulator for initial setup)
@@ -13,7 +13,7 @@ const projects_1 = require("../../../management/projects");
13
13
  const dataconnect_1 = require("../../../init/features/dataconnect");
14
14
  exports.init = (0, tool_1.tool)("core", {
15
15
  name: "init",
16
- description: "Use this to initialize selected Firebase services in the workspace (Cloud Firestore database, Firebase Data Connect, Firebase Realtime Database, Firebase AI Logic). All services are optional; specify only the products you want to set up. " +
16
+ description: "Use this to initialize selected Firebase services in the workspace (Cloud Firestore database, Firebase SQL Connect, Firebase Realtime Database, Firebase AI Logic). All services are optional; specify only the products you want to set up. " +
17
17
  "You can initialize new features into an existing project directory, but re-initializing an existing feature may overwrite configuration. " +
18
18
  "To deploy the initialized features, run the `firebase deploy` command after `firebase_init` tool.",
19
19
  inputSchema: zod_1.z.object({
@@ -62,32 +62,32 @@ exports.init = (0, tool_1.tool)("core", {
62
62
  service_id: zod_1.z
63
63
  .string()
64
64
  .optional()
65
- .describe("The Firebase Data Connect service ID to initialize. Default to match the current folder name."),
65
+ .describe("The Firebase SQL Connect service ID to initialize. Default to match the current folder name."),
66
66
  location_id: zod_1.z
67
67
  .string()
68
68
  .optional()
69
69
  .default(dataconnect_1.FDC_DEFAULT_REGION)
70
- .describe("The GCP region ID to set up the Firebase Data Connect service."),
70
+ .describe("The GCP region ID to set up the Firebase SQL Connect service."),
71
71
  cloudsql_instance_id: zod_1.z
72
72
  .string()
73
73
  .optional()
74
- .describe("The GCP Cloud SQL instance ID to use in the Firebase Data Connect service. By default, use <serviceId>-fdc. " +
74
+ .describe("The GCP Cloud SQL instance ID to use in the Firebase SQL Connect service. By default, use <serviceId>-fdc. " +
75
75
  "\nSet `provision_cloudsql` to true to start Cloud SQL provisioning."),
76
76
  cloudsql_database: zod_1.z
77
77
  .string()
78
78
  .optional()
79
79
  .default("fdcdb")
80
- .describe("The Postgres database ID to use in the Firebase Data Connect service."),
80
+ .describe("The Postgres database ID to use in the Firebase SQL Connect service."),
81
81
  provision_cloudsql: zod_1.z
82
82
  .boolean()
83
83
  .optional()
84
84
  .default(false)
85
85
  .describe("If true, provision the Cloud SQL instance if `cloudsql_instance_id` does not exist already. " +
86
- `\nThe first Cloud SQL instance in the project will use the Data Connect no-cost trial. See its terms of service: ${(0, freeTrial_1.freeTrialTermsLink)()}.`),
86
+ `\nThe first Cloud SQL instance in the project will use the SQL Connect no-cost trial. See its terms of service: ${(0, freeTrial_1.freeTrialTermsLink)()}.`),
87
87
  })
88
88
  .optional()
89
- .describe("Provide this object to initialize Firebase Data Connect with Cloud SQL Postgres in this project directory.\n" +
90
- "It installs Data Connect Generated SDKs in all detected apps in the folder."),
89
+ .describe("Provide this object to initialize Firebase SQL Connect with Cloud SQL Postgres in this project directory.\n" +
90
+ "It installs SQL Connect Generated SDKs in all detected apps in the folder."),
91
91
  storage: zod_1.z
92
92
  .object({
93
93
  rules_filename: zod_1.z
@@ -245,7 +245,7 @@ exports.init = (0, tool_1.tool)("core", {
245
245
  config.writeProjectFile("firebase.json", setup.config);
246
246
  config.writeProjectFile(".firebaserc", setup.rcfile);
247
247
  if (featureInfo.dataconnectSdk && !featureInfo.dataconnectSdk.apps.length) {
248
- setup.instructions.push(`No app is found in the current folder. We recommend you create an app (web, ios, android) first, then re-run the 'firebase_init' MCP tool with the same input without app_description to add Data Connect SDKs to your apps.
248
+ setup.instructions.push(`No app is found in the current folder. We recommend you create an app (web, ios, android) first, then re-run the 'firebase_init' MCP tool with the same input without app_description to add SQL Connect SDKs to your apps.
249
249
  Consider popular commands like 'npx create-react-app my-app', 'npx create-next-app my-app', 'flutter create my-app', etc`);
250
250
  }
251
251
  return (0, util_1.toContent)(`Successfully setup those features: ${featuresList.join(", ")}
@@ -7,7 +7,7 @@ const compile_1 = require("../../util/dataconnect/compile");
7
7
  const load_1 = require("../../../dataconnect/load");
8
8
  exports.compile = (0, tool_1.tool)("dataconnect", {
9
9
  name: "build",
10
- description: "Use this to compile Firebase Data Connect schema, operations, and/or connectors and check for build errors.",
10
+ description: "Use this to compile Firebase SQL Connect schema, operations, and/or connectors and check for build errors.",
11
11
  inputSchema: zod_1.z.object({
12
12
  error_filter: zod_1.z
13
13
  .enum(["all", "schema", "operations"])
@@ -16,14 +16,14 @@ exports.compile = (0, tool_1.tool)("dataconnect", {
16
16
  service_id: zod_1.z
17
17
  .string()
18
18
  .optional()
19
- .describe(`Service ID of the Data Connect service to compile. Used to disambiguate when there are multiple Data Connect services in firebase.json.`),
19
+ .describe(`Service ID of the SQL Connect service to compile. Used to disambiguate when there are multiple SQL Connect services in firebase.json.`),
20
20
  location_id: zod_1.z
21
21
  .string()
22
22
  .optional()
23
- .describe(`Data Connect Service location ID to disambiguate among multiple Data Connect services.`),
23
+ .describe(`SQL Connect Service location ID to disambiguate among multiple SQL Connect services.`),
24
24
  }),
25
25
  annotations: {
26
- title: "Compile Data Connect",
26
+ title: "Compile SQL Connect",
27
27
  readOnlyHint: true,
28
28
  },
29
29
  _meta: {
@@ -40,7 +40,7 @@ exports.compile = (0, tool_1.tool)("dataconnect", {
40
40
  content: [
41
41
  {
42
42
  type: "text",
43
- text: `The following errors were encountered while compiling Data Connect:\n\n${errors.join("\n")}`,
43
+ text: `The following errors were encountered while compiling SQL Connect:\n\n${errors.join("\n")}`,
44
44
  },
45
45
  ],
46
46
  isError: true,
@@ -9,20 +9,20 @@ const converter_1 = require("../../util/dataconnect/converter");
9
9
  const emulator_1 = require("../../util/dataconnect/emulator");
10
10
  exports.execute = (0, tool_1.tool)("dataconnect", {
11
11
  name: "execute",
12
- description: "Use this to execute a GraphQL operation against a Data Connect service or its emulator.",
12
+ description: "Use this to execute a GraphQL operation against a SQL Connect service or its emulator.",
13
13
  inputSchema: zod_1.z.object({
14
- query: zod_1.z.string().describe(`A Firebase Data Connect GraphQL query or mutation to execute.
14
+ query: zod_1.z.string().describe(`A Firebase SQL Connect GraphQL query or mutation to execute.
15
15
  You can use the \`dataconnect_generate_operation\` tool to generate a query.
16
- Example Data Connect schema and example queries can be found in files ending in \`.graphql\` or \`.gql\`.
16
+ Example SQL Connect schema and example queries can be found in files ending in \`.graphql\` or \`.gql\`.
17
17
  `),
18
18
  service_id: zod_1.z
19
19
  .string()
20
20
  .optional()
21
- .describe(`Service ID of the Data Connect service to compile. Used to disambiguate when there are multiple Data Connect services in firebase.json.`),
21
+ .describe(`Service ID of the SQL Connect service to compile. Used to disambiguate when there are multiple SQL Connect services in firebase.json.`),
22
22
  location_id: zod_1.z
23
23
  .string()
24
24
  .optional()
25
- .describe(`Data Connect Service location ID to disambiguate among multiple Data Connect services.`),
25
+ .describe(`SQL Connect Service location ID to disambiguate among multiple SQL Connect services.`),
26
26
  variables_json: zod_1.z
27
27
  .string()
28
28
  .optional()
@@ -39,7 +39,7 @@ Example Data Connect schema and example queries can be found in files ending in
39
39
  .describe("If true, target the DataConnect emulator. Run `firebase emulators:start` to start it"),
40
40
  }),
41
41
  annotations: {
42
- title: "Execute Firebase Data Connect Query",
42
+ title: "Execute Firebase SQL Connect Query",
43
43
  },
44
44
  _meta: {
45
45
  requiresProject: true,
@@ -12,10 +12,10 @@ const js_yaml_1 = require("js-yaml");
12
12
  const logger_1 = require("../../../logger");
13
13
  exports.list_services = (0, tool_1.tool)("dataconnect", {
14
14
  name: "list_services",
15
- description: "Use this to list existing local and backend Firebase Data Connect services",
15
+ description: "Use this to list existing local and backend Firebase SQL Connect services",
16
16
  inputSchema: zod_1.z.object({}),
17
17
  annotations: {
18
- title: "List existing Firebase Data Connect services",
18
+ title: "List existing Firebase SQL Connect services",
19
19
  readOnlyHint: true,
20
20
  },
21
21
  _meta: {
@@ -84,7 +84,7 @@ exports.list_services = (0, tool_1.tool)("dataconnect", {
84
84
  }
85
85
  }
86
86
  if (localServices.length) {
87
- output.push(`# Local Data Connect Sources`);
87
+ output.push(`# Local SQL Connect Sources`);
88
88
  for (const s of localServices) {
89
89
  const local = s.local;
90
90
  output.push((0, js_yaml_1.dump)(local.dataConnectYaml));
@@ -97,7 +97,7 @@ exports.list_services = (0, tool_1.tool)("dataconnect", {
97
97
  }
98
98
  }
99
99
  if (remoteOnlyServices.length) {
100
- output.push(`# Data Connect Services in project ${projectId}`);
100
+ output.push(`# SQL Connect Services in project ${projectId}`);
101
101
  for (const s of remoteOnlyServices) {
102
102
  if (s.deployed) {
103
103
  includeDeployedServiceInfo(s.deployed);
@@ -106,10 +106,10 @@ exports.list_services = (0, tool_1.tool)("dataconnect", {
106
106
  }
107
107
  output.push(`\n# What's next?`);
108
108
  if (!localServices.length) {
109
- output.push(`- There is no local Data Connect service in the local workspace. Consider use the \`firebase_init\` MCP tool to setup one.`);
109
+ output.push(`- There is no local SQL Connect service in the local workspace. Consider use the \`firebase_init\` MCP tool to setup one.`);
110
110
  }
111
- output.push(`- You can use the \`dataconnect_compile\` tool to compile all local Data Connect schemas and query sources.`);
112
- output.push(`- You run \`firebase deploy\` in command line to deploy the Data Connect schemas, connector and perform SQL migrations.`);
111
+ output.push(`- You can use the \`dataconnect_compile\` tool to compile all local SQL Connect schemas and query sources.`);
112
+ output.push(`- You run \`firebase deploy\` in command line to deploy the SQL Connect schemas, connector and perform SQL migrations.`);
113
113
  return (0, util_1.toContent)(output.join("\n"));
114
114
  });
115
115
  function clearCCFEFields(r) {
@@ -4,7 +4,7 @@ exports.BUILTIN_SDL = exports.MAIN_INSTRUCTIONS = void 0;
4
4
  exports.MAIN_INSTRUCTIONS = `
5
5
  Closely follow the following instructions:
6
6
 
7
- You are Firebase Data Connect expert that is responsible for creating data connect schemas code in GraphQL for users.You will be given a description of the desired schema using Firebase Data Connect and your task is to write the schema code in GraphQL that fulfills the requirements and correct any mistakes in your generation.
7
+ You are Firebase SQL Connect expert that is responsible for creating data connect schemas code in GraphQL for users.You will be given a description of the desired schema using Firebase SQL Connect and your task is to write the schema code in GraphQL that fulfills the requirements and correct any mistakes in your generation.
8
8
 
9
9
  For example, if I were to ask for a schema for a GraphQL database that contains a table called "users" with a field called "name" and another table called "posts" with a field called "body", I would get the following schema:
10
10
  \`\`\`
@@ -18,7 +18,7 @@ type Post @table {
18
18
  }
19
19
  \`\`\`
20
20
 
21
- Simple Firebase Data Connect schema often takes the following form:
21
+ Simple Firebase SQL Connect schema often takes the following form:
22
22
  \`\`\`graphql
23
23
  type TableName @table {
24
24
  uuidField: UUID
@@ -43,7 +43,7 @@ type TableName @table {
43
43
 
44
44
  Leave out objects named after \`Query\` and \`Mutation\`
45
45
 
46
- Firebase Data Connect implicitly adds \`id: UUID!\` to every table and implicitly makes it primary key. Therefore, leave out the \`id\` field.
46
+ Firebase SQL Connect implicitly adds \`id: UUID!\` to every table and implicitly makes it primary key. Therefore, leave out the \`id\` field.
47
47
 
48
48
  Use \`UUID\` type instead of \`ID\` type or \`String\` type for id-like fields.
49
49
 
@@ -87,19 +87,19 @@ Leave out \`directive\`, \`enum\` and \`scalar\`.
87
87
 
88
88
  Leave out \`@view\`.
89
89
 
90
- Be sure that your response contains a valid Firebase Data Connect schema in a single GraphQL code block inside of triple backticks and closely follows my instructions and description.
90
+ Be sure that your response contains a valid Firebase SQL Connect schema in a single GraphQL code block inside of triple backticks and closely follows my instructions and description.
91
91
  `.trim();
92
92
  exports.BUILTIN_SDL = `
93
93
  # Directives
94
94
 
95
95
  Directives define specific behaviors that can be applied to fields or types within a GraphQL schema.
96
96
 
97
- ## Data Connect Defined
97
+ ## SQL Connect Defined
98
98
 
99
99
  ### @col on \`FIELD_DEFINITION\` {:#col}
100
100
  Customizes a field that represents a SQL database table column.
101
101
 
102
- Data Connect maps scalar Fields on [\`@table\`](directive.md#table) type to a SQL column of
102
+ SQL Connect maps scalar Fields on [\`@table\`](directive.md#table) type to a SQL column of
103
103
  corresponding data type.
104
104
 
105
105
  - scalar [\`UUID\`](scalar.md#UUID) maps to [\`uuid\`](https://www.postgresql.org/docs/current/datatype-uuid.html).
@@ -125,7 +125,7 @@ type Post @table {
125
125
  }
126
126
  \`\`\`
127
127
 
128
- Data Connect converts it to the following SQL table schema.
128
+ SQL Connect converts it to the following SQL table schema.
129
129
 
130
130
  \`\`\`sql
131
131
  CREATE TABLE "public"."post" (
@@ -199,7 +199,7 @@ filter and order requirement.
199
199
 
200
200
  | Argument | Type | Description |
201
201
  |---|---|---|
202
- | \`name\` | [\`String\`](scalar.md#String) | Configure the SQL database index id. If not overridden, Data Connect generates the index name: - \`{table_name}_{first_field}_{second_field}_aa_idx\` - \`{table_name}_{field_name}_idx\` |
202
+ | \`name\` | [\`String\`](scalar.md#String) | Configure the SQL database index id. If not overridden, SQL Connect generates the index name: - \`{table_name}_{first_field}_{second_field}_aa_idx\` - \`{table_name}_{field_name}_idx\` |
203
203
  | \`fields\` | [\`[String!]\`](scalar.md#String) | Only allowed and required when used on a [\`@table\`](directive.md#table) type. Specifies the fields to create the index on. |
204
204
  | \`order\` | [\`[IndexFieldOrder!]\`](enum.md#IndexFieldOrder) | Only allowed for \`BTREE\` [\`@index\`](directive.md#index) on [\`@table\`](directive.md#table) type. Specifies the order for each indexed column. Defaults to all \`ASC\`. |
205
205
  | \`type\` | [\`IndexType\`](enum.md#IndexType) | Customize the index type. For most index, it defaults to \`BTREE\`. For array fields, only allowed [\`IndexType\`](enum.md#IndexType) is \`GIN\`. For [\`Vector\`](scalar.md#Vector) fields, defaults to \`HNSW\`, may configure to \`IVFFLAT\`. |
@@ -218,7 +218,7 @@ type OneTable @table {
218
218
  someField: String!
219
219
  }
220
220
  \`\`\`
221
- Data Connect adds implicit foreign key column and relation query field. So the
221
+ SQL Connect adds implicit foreign key column and relation query field. So the
222
222
  above schema is equivalent to the following schema.
223
223
 
224
224
  \`\`\`graphql
@@ -234,7 +234,7 @@ type OneTable @table {
234
234
  # manyTables_on_refField: [ManyTable!]!
235
235
  }
236
236
  \`\`\`
237
- Data Connect generates the necessary foreign key constraint.
237
+ SQL Connect generates the necessary foreign key constraint.
238
238
 
239
239
  \`\`\`sql
240
240
  CREATE TABLE "public"."many_table" (
@@ -314,7 +314,7 @@ type Group @table { name: String! }
314
314
  type User @table { name: String! }
315
315
  \`\`\`
316
316
 
317
- When Data Connect sees a table with two reference field as its primary key, it
317
+ When SQL Connect sees a table with two reference field as its primary key, it
318
318
  knows this is a join table, so expands the many-to-many query field.
319
319
 
320
320
  \`\`\`graphql
@@ -418,7 +418,7 @@ type TableName @table {
418
418
  myField: String
419
419
  }
420
420
  \`\`\`
421
- Data Connect adds an implicit \`id\` primary key column. So the above schema is equivalent to:
421
+ SQL Connect adds an implicit \`id\` primary key column. So the above schema is equivalent to:
422
422
 
423
423
  \`\`\`graphql
424
424
  type TableName @table(key: "id") {
@@ -427,7 +427,7 @@ type TableName @table(key: "id") {
427
427
  }
428
428
  \`\`\`
429
429
 
430
- Data Connect generates the following SQL table and CRUD operations to use it.
430
+ SQL Connect generates the following SQL table and CRUD operations to use it.
431
431
 
432
432
  \`\`\`sql
433
433
  CREATE TABLE "public"."table_name" (
@@ -475,7 +475,7 @@ type User @table(key: "uid") {
475
475
  | \`name\` | [\`String\`](scalar.md#String) | Configures the SQL database table name. Defaults to snake_case like \`table_name\`. |
476
476
  | \`singular\` | [\`String\`](scalar.md#String) | Configures the singular name. Defaults to the camelCase like \`tableName\`. |
477
477
  | \`plural\` | [\`String\`](scalar.md#String) | Configures the plural name. Defaults to infer based on English plural pattern like \`tableNames\`. |
478
- | \`key\` | [\`[String!]\`](scalar.md#String) | Defines the primary key of the table. Defaults to a single field named \`id\`. If not present already, Data Connect adds an implicit field \`id: UUID! @default(expr: "uuidV4()")\`. |
478
+ | \`key\` | [\`[String!]\`](scalar.md#String) | Defines the primary key of the table. Defaults to a single field named \`id\`. If not present already, SQL Connect adds an implicit field \`id: UUID! @default(expr: "uuidV4()")\`. |
479
479
 
480
480
  ### @unique on \`FIELD_DEFINITION\` | \`OBJECT\` {:#unique}
481
481
  Defines unique constraints on [\`@table\`](directive.md#table).
@@ -502,16 +502,16 @@ type may define \`@ref(references)\` to refer to fields that has a unique constr
502
502
 
503
503
  | Argument | Type | Description |
504
504
  |---|---|---|
505
- | \`indexName\` | [\`String\`](scalar.md#String) | Configures the SQL database unique constraint name. If not overridden, Data Connect generates the unique constraint name: - \`table_name_first_field_second_field_uidx\` - \`table_name_only_field_name_uidx\` |
505
+ | \`indexName\` | [\`String\`](scalar.md#String) | Configures the SQL database unique constraint name. If not overridden, SQL Connect generates the unique constraint name: - \`table_name_first_field_second_field_uidx\` - \`table_name_only_field_name_uidx\` |
506
506
  | \`fields\` | [\`[String!]\`](scalar.md#String) | Only allowed and required when used on OBJECT, this specifies the fields to create a unique constraint on. |
507
507
 
508
508
  ### @view on \`OBJECT\` {:#view}
509
509
  Defines a relational database Raw SQLview.
510
510
 
511
- Data Connect generates GraphQL queries with WHERE and ORDER BY clauses.
511
+ SQL Connect generates GraphQL queries with WHERE and ORDER BY clauses.
512
512
  However, not all SQL features has native GraphQL equivalent.
513
513
 
514
- You can write **an arbitrary SQL SELECT statement**. Data Connect
514
+ You can write **an arbitrary SQL SELECT statement**. SQL Connect
515
515
  would map Graphql fields on [\`@view\`](directive.md#view) type to columns in your SELECT statement.
516
516
 
517
517
  * Scalar GQL fields (camelCase) should match a SQL column (snake_case)
@@ -633,10 +633,10 @@ Raw SQL view doesn't have a primary key, so it doesn't support lookup. Other
633
633
  View cannot be mutated. You can perform CRUD operations on the underlying
634
634
  table to alter its content.
635
635
 
636
- **Important: Data Connect doesn't parse and validate SQL**
636
+ **Important: SQL Connect doesn't parse and validate SQL**
637
637
 
638
638
  - If the SQL view is invalid or undefined, related requests may fail.
639
- - If the SQL view return incompatible types. Firebase Data Connect may surface
639
+ - If the SQL view return incompatible types. Firebase SQL Connect may surface
640
640
  errors.
641
641
  - If a field doesn't have a corresponding column in the SQL SELECT statement,
642
642
  it will always be \`null\`.