firebase-tools 11.14.3-canary.0 → 11.14.4

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.
@@ -352,7 +352,7 @@ async function promptText(prompt, input, resolvedDefault, converter) {
352
352
  return promptText(prompt, input, resolvedDefault, converter);
353
353
  }
354
354
  }
355
- const converted = converter(res);
355
+ const converted = converter(res.toString());
356
356
  if (typeof converted === "object") {
357
357
  logger_1.logger.error(converted.message);
358
358
  return promptText(prompt, input, resolvedDefault, converter);
@@ -619,7 +619,7 @@ function sendOobCode(state, reqBody, ctx) {
619
619
  (0, errors_1.assert)((_a = ctx.security) === null || _a === void 0 ? void 0 : _a.Oauth2, "INSUFFICIENT_PERMISSION");
620
620
  }
621
621
  if (reqBody.continueUrl) {
622
- (0, errors_1.assert)((0, utils_1.parseAbsoluteUri)(reqBody.continueUrl), "INVALID_CONTINUE_URI: ((expected an absolute URI with valid scheme and host))");
622
+ (0, errors_1.assert)((0, utils_1.parseAbsoluteUri)(reqBody.continueUrl), "INVALID_CONTINUE_URI : ((expected an absolute URI with valid scheme and host))");
623
623
  }
624
624
  let email;
625
625
  let mode;
@@ -1462,8 +1462,8 @@ function updateConfig(state, reqBody, ctx) {
1462
1462
  (0, errors_1.assert)(state instanceof state_1.AgentProjectState, "((Can only update top-level configurations on agent projects.))");
1463
1463
  for (const event in (_a = reqBody.blockingFunctions) === null || _a === void 0 ? void 0 : _a.triggers) {
1464
1464
  if (Object.prototype.hasOwnProperty.call(reqBody.blockingFunctions.triggers, event)) {
1465
- (0, errors_1.assert)(Object.values(state_1.BlockingFunctionEvents).includes(event), "INVALID_BLOCKING_FUNCTION: ((Event type is invalid.))");
1466
- (0, errors_1.assert)((0, utils_1.parseAbsoluteUri)(reqBody.blockingFunctions.triggers[event].functionUri), "INVALID_BLOCKING_FUNCTION: ((Expected an absolute URI with valid scheme and host.))");
1465
+ (0, errors_1.assert)(Object.values(state_1.BlockingFunctionEvents).includes(event), "INVALID_BLOCKING_FUNCTION : ((Event type is invalid.))");
1466
+ (0, errors_1.assert)((0, utils_1.parseAbsoluteUri)(reqBody.blockingFunctions.triggers[event].functionUri), "INVALID_BLOCKING_FUNCTION : ((Expected an absolute URI with valid scheme and host.))");
1467
1467
  }
1468
1468
  }
1469
1469
  return state.updateConfig(reqBody, ctx.params.query.updateMask);
@@ -1900,7 +1900,7 @@ function parsePendingCredential(state, pendingCredential) {
1900
1900
  function createTenant(state, reqBody) {
1901
1901
  var _a, _b, _c, _d, _e;
1902
1902
  if (!(state instanceof state_1.AgentProjectState)) {
1903
- throw new errors_1.InternalError("INTERNAL_ERROR: Can only create tenant in agent project", "INTERNAL");
1903
+ throw new errors_1.InternalError("INTERNAL_ERROR : Can only create tenant in agent project", "INTERNAL");
1904
1904
  }
1905
1905
  const mfaConfig = (_a = reqBody.mfaConfig) !== null && _a !== void 0 ? _a : {};
1906
1906
  if (!("state" in mfaConfig)) {
@@ -1968,6 +1968,9 @@ async function fetchBlockingFunction(state, event, user, options = {}, oauthToke
1968
1968
  controller.abort();
1969
1969
  }, timeoutMs);
1970
1970
  let response;
1971
+ let ok;
1972
+ let status;
1973
+ let text;
1971
1974
  try {
1972
1975
  const res = await (0, node_fetch_1.default)(url, {
1973
1976
  method: "POST",
@@ -1975,21 +1978,29 @@ async function fetchBlockingFunction(state, event, user, options = {}, oauthToke
1975
1978
  body: JSON.stringify(reqBody),
1976
1979
  signal: controller.signal,
1977
1980
  });
1978
- const text = await res.text();
1979
- (0, errors_1.assert)(res.ok, `BLOCKING_FUNCTION_ERROR_RESPONSE: ((HTTP request to ${url} returned HTTP error${res.status}: ${text}))`);
1980
- response = JSON.parse(text);
1981
+ ok = res.ok;
1982
+ status = res.status;
1983
+ text = await res.text();
1981
1984
  }
1982
1985
  catch (thrown) {
1983
1986
  const err = thrown instanceof Error ? thrown : new Error(thrown);
1984
1987
  const isAbortError = err.name.includes("AbortError");
1985
1988
  if (isAbortError) {
1986
- throw new errors_1.InternalError(`BLOCKING_FUNCTION_ERROR_RESPONSE: ((Deadline exceeded making request to ${url}.))`, err.message);
1989
+ throw new errors_1.InternalError(`BLOCKING_FUNCTION_ERROR_RESPONSE : ((Deadline exceeded making request to ${url}.))`, err.message);
1987
1990
  }
1988
- throw new errors_1.InternalError(`BLOCKING_FUNCTION_ERROR_RESPONSE: ((Failed to make request to ${url}.))`, err.message);
1991
+ throw new errors_1.InternalError(`BLOCKING_FUNCTION_ERROR_RESPONSE : ((Failed to make request to ${url}.))`, err.message);
1989
1992
  }
1990
1993
  finally {
1991
1994
  clearTimeout(timeout);
1992
1995
  }
1996
+ (0, errors_1.assert)(ok, `BLOCKING_FUNCTION_ERROR_RESPONSE : ((HTTP request to ${url} returned HTTP error ${status}: ${text}))`);
1997
+ try {
1998
+ response = JSON.parse(text);
1999
+ }
2000
+ catch (thrown) {
2001
+ const err = thrown instanceof Error ? thrown : new Error(thrown);
2002
+ throw new errors_1.InternalError(`BLOCKING_FUNCTION_ERROR_RESPONSE : ((Response body is not valid JSON.))`, err.message);
2003
+ }
1993
2004
  return processBlockingFunctionResponse(event, response);
1994
2005
  }
1995
2006
  function processBlockingFunctionResponse(event, response) {
@@ -1997,7 +2008,7 @@ function processBlockingFunctionResponse(event, response) {
1997
2008
  const updates = {};
1998
2009
  if (response.userRecord) {
1999
2010
  const userRecord = response.userRecord;
2000
- (0, errors_1.assert)(userRecord.updateMask, "BLOCKING_FUNCTION_ERROR_RESPONSE: ((Response UserRecord is missing updateMask.))");
2011
+ (0, errors_1.assert)(userRecord.updateMask, "BLOCKING_FUNCTION_ERROR_RESPONSE : ((Response UserRecord is missing updateMask.))");
2001
2012
  const mask = userRecord.updateMask;
2002
2013
  const fields = mask.split(",");
2003
2014
  for (const field of fields) {
@@ -2023,7 +2034,7 @@ function processBlockingFunctionResponse(event, response) {
2023
2034
  extraClaims = userRecord.sessionClaims;
2024
2035
  }
2025
2036
  catch (_a) {
2026
- throw new errors_1.BadRequestError("BLOCKING_FUNCTION_ERROR_RESPONSE: ((Response has malformed session claims.))");
2037
+ throw new errors_1.BadRequestError("BLOCKING_FUNCTION_ERROR_RESPONSE : ((Response has malformed session claims.))");
2027
2038
  }
2028
2039
  break;
2029
2040
  default:
@@ -190,7 +190,7 @@ class StorageRulesRuntime {
190
190
  },
191
191
  };
192
192
  const response = (await this._sendRequest(runtimeActionRequest));
193
- if (response.errors.length || response.warnings.length) {
193
+ if (response.errors.length) {
194
194
  return {
195
195
  issues: StorageRulesIssues.fromResponse(response),
196
196
  };
@@ -104,13 +104,15 @@ function scanDependencyTree(searchingFor, dependencies = {}) {
104
104
  }
105
105
  function findDependency(name, options = {}) {
106
106
  const { cwd, depth, omitDev } = Object.assign(Object.assign({}, DEFAULT_FIND_DEP_OPTIONS), options);
107
+ const env = Object.assign({}, process.env);
108
+ delete env.NODE_ENV;
107
109
  const result = (0, child_process_1.spawnSync)(NPM_COMMAND, [
108
110
  "list",
109
111
  name,
110
112
  "--json",
111
113
  ...(omitDev ? ["--omit", "dev"] : []),
112
114
  ...(depth === undefined ? [] : ["--depth", depth.toString(10)]),
113
- ], { cwd });
115
+ ], { cwd, env });
114
116
  if (!result.stdout)
115
117
  return;
116
118
  const json = JSON.parse(result.stdout.toString());
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "firebase-tools",
3
- "version": "11.14.3-canary.0",
3
+ "version": "11.14.4",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "firebase-tools",
9
- "version": "11.14.3-canary.0",
9
+ "version": "11.14.4",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@google-cloud/pubsub": "^3.0.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firebase-tools",
3
- "version": "11.14.3-canary.0",
3
+ "version": "11.14.4",
4
4
  "description": "Command-Line Interface for Firebase",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {