firebase-tools 13.29.2 → 13.29.3

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.
@@ -33,6 +33,7 @@ async function provisionCloudSql(args) {
33
33
  if (err.status !== 404) {
34
34
  throw err;
35
35
  }
36
+ cmekWarning();
36
37
  const cta = dryRun ? "It will be created on your next deploy" : "Creating it now.";
37
38
  silent ||
38
39
  utils.logLabeledBullet("dataconnect", `CloudSQL instance '${instanceId}' not found.` +
@@ -112,3 +113,9 @@ function getUpdateReason(instance, requireGoogleMlIntegration) {
112
113
  return reason;
113
114
  }
114
115
  exports.getUpdateReason = getUpdateReason;
116
+ function cmekWarning() {
117
+ const message = "The no-cost Cloud SQL trial instance does not support customer managed encryption keys.\n" +
118
+ "If you'd like to use a CMEK to encrypt your data, first create a CMEK encrypted instance (https://cloud.google.com/sql/docs/postgres/configure-cmek#createcmekinstance).\n" +
119
+ "Then, edit your `dataconnect.yaml` file to use the encrypted instance and redeploy.";
120
+ utils.logLabeledWarning("dataconnect", message);
121
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadCodebases = exports.resolveCpuAndConcurrency = exports.inferBlockingDetails = exports.updateEndpointTargetedStatus = exports.inferDetailsFromExisting = exports.prepare = exports.EVENTARC_SOURCE_ENV = void 0;
3
+ exports.warnIfNewGenkitFunctionIsMissingSecrets = exports.loadCodebases = exports.resolveCpuAndConcurrency = exports.inferBlockingDetails = exports.updateEndpointTargetedStatus = exports.inferDetailsFromExisting = exports.prepare = exports.EVENTARC_SOURCE_ENV = void 0;
4
4
  const clc = require("colorette");
5
5
  const backend = require("./backend");
6
6
  const build = require("./build");
@@ -28,6 +28,7 @@ const applyHash_1 = require("./cache/applyHash");
28
28
  const backend_1 = require("./backend");
29
29
  const functional_1 = require("../../functional");
30
30
  const prepare_1 = require("../extensions/prepare");
31
+ const prompt = require("../../prompt");
31
32
  exports.EVENTARC_SOURCE_ENV = "EVENTARC_CLOUD_EVENT_SOURCE";
32
33
  async function prepare(context, options, payload) {
33
34
  var _a, _b;
@@ -170,6 +171,7 @@ async function prepare(context, options, payload) {
170
171
  }
171
172
  const wantBackend = backend.merge(...Object.values(wantBackends));
172
173
  const haveBackend = backend.merge(...Object.values(haveBackends));
174
+ await warnIfNewGenkitFunctionIsMissingSecrets(wantBackend, haveBackend, options);
173
175
  await Promise.all(Object.values(wantBackend.requiredAPIs).map(({ api }) => {
174
176
  return ensureApiEnabled.ensure(projectId, api, "functions", false);
175
177
  }));
@@ -324,3 +326,27 @@ async function loadCodebases(config, options, firebaseConfig, runtimeConfig, fil
324
326
  return wantBuilds;
325
327
  }
326
328
  exports.loadCodebases = loadCodebases;
329
+ async function warnIfNewGenkitFunctionIsMissingSecrets(have, want, options) {
330
+ if (options.force) {
331
+ return;
332
+ }
333
+ const newAndMissingSecrets = backend.allEndpoints(backend.matchingBackend(want, (e) => {
334
+ var _a;
335
+ if (!backend.isCallableTriggered(e) || !e.callableTrigger.genkitAction) {
336
+ return false;
337
+ }
338
+ if ((_a = e.secretEnvironmentVariables) === null || _a === void 0 ? void 0 : _a.length) {
339
+ return false;
340
+ }
341
+ return !backend.hasEndpoint(have)(e);
342
+ }));
343
+ if (newAndMissingSecrets.length) {
344
+ const message = `The function(s) ${newAndMissingSecrets.map((e) => e.id).join(", ")} use Genkit but do not have access to a secret. ` +
345
+ "This may cause the function to fail if it depends on an API key. To learn more about granting a function access to " +
346
+ "secrets, see https://firebase.google.com/docs/functions/config-env?gen=2nd#secret_parameters. Continue?";
347
+ if (!(await prompt.confirm({ message, nonInteractive: options.nonInteractive }))) {
348
+ throw new error_1.FirebaseError("Aborted");
349
+ }
350
+ }
351
+ }
352
+ exports.warnIfNewGenkitFunctionIsMissingSecrets = warnIfNewGenkitFunctionIsMissingSecrets;
@@ -28,6 +28,7 @@ const index_1 = require("./pg-gateway/index");
28
28
  const node_1 = require("./pg-gateway/platforms/node");
29
29
  const logger_1 = require("../../logger");
30
30
  const error_1 = require("../../error");
31
+ const node_string_decoder_1 = require("node:string_decoder");
31
32
  exports.TRUNCATE_TABLES_SQL = `
32
33
  DO $do$
33
34
  DECLARE _clear text;
@@ -52,6 +53,9 @@ class PostgresServer {
52
53
  return;
53
54
  }
54
55
  const db = await getDb();
56
+ if (data[0] === index_1.FrontendMessageCode.Terminate) {
57
+ await db.query("DEALLOCATE ALL");
58
+ }
55
59
  const result = await db.execProtocolRaw(data);
56
60
  return extendedQueryPatch.filterResponse(data, result);
57
61
  },
@@ -151,6 +155,9 @@ class PGliteExtendedQueryPatch {
151
155
  index_1.FrontendMessageCode.Bind,
152
156
  index_1.FrontendMessageCode.Close,
153
157
  ];
158
+ const decoder = new node_string_decoder_1.StringDecoder();
159
+ const decoded = decoder.write(message);
160
+ logger_1.logger.debug(decoded);
154
161
  if (pipelineStartMessages.includes(message[0])) {
155
162
  this.isExtendedQuery = true;
156
163
  }
@@ -48,20 +48,20 @@ const EMULATOR_UPDATE_DETAILS = {
48
48
  },
49
49
  dataconnect: process.platform === "darwin"
50
50
  ? {
51
- version: "1.7.6",
52
- expectedSize: 25322240,
53
- expectedChecksum: "2dda7394330fd1aba37605466941eef0",
51
+ version: "1.7.7",
52
+ expectedSize: 25359104,
53
+ expectedChecksum: "c5481addc04e14d10538add7aabda183",
54
54
  }
55
55
  : process.platform === "win32"
56
56
  ? {
57
- version: "1.7.6",
58
- expectedSize: 25752064,
59
- expectedChecksum: "283c11e28a0072b596531b79462a8e94",
57
+ version: "1.7.7",
58
+ expectedSize: 25788416,
59
+ expectedChecksum: "9f7e5b9bcbca47de509fbc26cc1e0fa8",
60
60
  }
61
61
  : {
62
- version: "1.7.6",
63
- expectedSize: 25235608,
64
- expectedChecksum: "f66e24b3726df57cd1f1685a64a87904",
62
+ version: "1.7.7",
63
+ expectedSize: 25268376,
64
+ expectedChecksum: "fb239ecf5dcbf87b762d12a3e9dee012",
65
65
  },
66
66
  };
67
67
  exports.DownloadDetails = {
@@ -366,7 +366,7 @@ async function prepareFrameworks(purpose, targetNames, context, options, emulato
366
366
  await (0, promises_1.writeFile)((0, path_1.join)(functionsDist, ".env"), `${dotEnvContents}
367
367
  __FIREBASE_FRAMEWORKS_ENTRY__=${frameworksEntry}
368
368
  ${firebaseDefaults ? `__FIREBASE_DEFAULTS__=${JSON.stringify(firebaseDefaults)}\n` : ""}`.trimStart());
369
- const envs = await (0, glob_1.glob)(getProjectPath(".env.*"));
369
+ const envs = await (0, glob_1.glob)(getProjectPath(".env.*"), { windowsPathsNoEscape: utils_2.IS_WINDOWS });
370
370
  await Promise.all(envs.map((path) => (0, promises_1.copyFile)(path, (0, path_1.join)(functionsDist, (0, path_1.basename)(path)))));
371
371
  (0, child_process_1.execSync)(`npm i --omit dev --no-audit`, {
372
372
  cwd: functionsDist,
@@ -102,7 +102,8 @@ async function askQuestions(setup, isBillingEnabled) {
102
102
  else {
103
103
  const defaultServiceId = toDNSCompatibleId((0, path_1.basename)(process.cwd()));
104
104
  info.serviceId = info.serviceId || defaultServiceId;
105
- info.cloudSqlInstanceId = info.cloudSqlInstanceId || `${info.serviceId || "app"}-fdc`;
105
+ info.cloudSqlInstanceId =
106
+ info.cloudSqlInstanceId || `${info.serviceId.toLowerCase() || "app"}-fdc`;
106
107
  info.locationId = info.locationId || `us-central1`;
107
108
  info.cloudSqlDatabase = info.cloudSqlDatabase || `fdcdb`;
108
109
  }
@@ -270,7 +271,7 @@ async function promptForCloudSQL(setup, info) {
270
271
  info.cloudSqlInstanceId = await (0, prompt_1.promptOnce)({
271
272
  message: `What ID would you like to use for your new CloudSQL instance?`,
272
273
  type: "input",
273
- default: `${info.serviceId || "app"}-fdc`,
274
+ default: `${info.serviceId.toLowerCase() || "app"}-fdc`,
274
275
  });
275
276
  }
276
277
  if (info.locationId === "") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firebase-tools",
3
- "version": "13.29.2",
3
+ "version": "13.29.3",
4
4
  "description": "Command-Line Interface for Firebase",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -60,7 +60,7 @@
60
60
  ]
61
61
  },
62
62
  "dependencies": {
63
- "@electric-sql/pglite": "^0.2.0",
63
+ "@electric-sql/pglite": "^0.2.16",
64
64
  "@google-cloud/cloud-sql-connector": "^1.3.3",
65
65
  "@google-cloud/pubsub": "^4.5.0",
66
66
  "abort-controller": "^3.0.0",
@@ -17,6 +17,11 @@
17
17
  "instanceId": {
18
18
  "type": "string",
19
19
  "description": "The ID of the CloudSQL instance for this database"
20
+ },
21
+ "schemaValidation": {
22
+ "type": "string",
23
+ "enum": ["COMPATIBLE", "STRICT"],
24
+ "description": "Schema validation mode for schema migrations"
20
25
  }
21
26
  }
22
27
  }