firebase-tools-with-isolate 15.31.0 → 15.33.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 (62) hide show
  1. package/lib/accountImporter.js +6 -3
  2. package/lib/api.js +3 -3
  3. package/lib/apphosting/secrets/index.js +7 -2
  4. package/lib/command.js +1 -1
  5. package/lib/commands/apps-create.js +34 -3
  6. package/lib/commands/auth-import.js +5 -6
  7. package/lib/commands/functions-kits-uninstall.js +43 -21
  8. package/lib/commands/functions-lifecycle-list.js +5 -6
  9. package/lib/commands/hosting-channel-deploy.js +3 -3
  10. package/lib/commands/hosting-clone.js +60 -29
  11. package/lib/commands/hosting-disable.js +5 -1
  12. package/lib/config.js +1 -0
  13. package/lib/crashlytics/alerts.js +122 -0
  14. package/lib/crashlytics/onboarding.js +71 -3
  15. package/lib/crashlytics/sourcemap.js +46 -11
  16. package/lib/crashlytics/types.js +6 -1
  17. package/lib/database/import.js +6 -7
  18. package/lib/deploy/functions/build.js +3 -0
  19. package/lib/deploy/functions/cel.js +89 -58
  20. package/lib/deploy/functions/functionsDeployHelper.js +10 -0
  21. package/lib/deploy/functions/params.js +7 -4
  22. package/lib/deploy/functions/prepare.js +25 -8
  23. package/lib/deploy/functions/release/fabricator.js +1 -5
  24. package/lib/deploy/functions/release/planner.js +3 -2
  25. package/lib/deploy/functions/validate.js +16 -0
  26. package/lib/deploy/hosting/prepare.js +1 -1
  27. package/lib/deploy/hosting/release.js +2 -2
  28. package/lib/emulator/auth/operations.js +8 -4
  29. package/lib/emulator/databaseEmulator.js +7 -3
  30. package/lib/emulator/downloadableEmulatorInfo.json +24 -24
  31. package/lib/emulator/emulatorLogger.js +2 -1
  32. package/lib/emulator/functionsEmulatorRuntime.js +2 -1
  33. package/lib/experiments.js +23 -6
  34. package/lib/extensions/warnings.js +48 -7
  35. package/lib/frameworks/next/constants.js +20 -12
  36. package/lib/frameworks/next/index.js +4 -25
  37. package/lib/frameworks/next/utils.js +28 -0
  38. package/lib/functions/env.js +4 -2
  39. package/lib/functions/kits/install.js +17 -1
  40. package/lib/gcp/artifactregistry.js +20 -0
  41. package/lib/gcp/cloudmonitoring.js +80 -3
  42. package/lib/gcp/cloudtasks.js +15 -1
  43. package/lib/gcp/cloudtrace.js +38 -0
  44. package/lib/gcp/resourceManager.js +1 -1
  45. package/lib/gcp/run.js +5 -0
  46. package/lib/gcp/runv2.js +32 -11
  47. package/lib/hosting/api.js +15 -15
  48. package/lib/hosting/runTags.js +1 -1
  49. package/lib/init/features/auth.js +46 -8
  50. package/lib/init/features/hosting/index.js +4 -2
  51. package/lib/management/apps.js +4 -2
  52. package/lib/management/projects.js +1 -1
  53. package/lib/mcp/tools/firestore/converter.js +2 -2
  54. package/lib/mcp/util.js +11 -10
  55. package/lib/profileReport.js +4 -4
  56. package/lib/scopes.js +1 -3
  57. package/lib/streamJson.js +37 -0
  58. package/lib/tsconfig.publish.tsbuildinfo +1 -1
  59. package/lib/utils.js +0 -15
  60. package/package.json +11 -10
  61. package/schema/firebase-config.json +41 -0
  62. package/lib/firestore/checkDatabaseType.js +0 -24
@@ -5,7 +5,11 @@ exports.actuate = actuate;
5
5
  const clc = require("colorette");
6
6
  const prompt_1 = require("../../prompt");
7
7
  const logger_1 = require("../../logger");
8
- async function askQuestions(setup) {
8
+ const getDefaultHostingSite_1 = require("../../getDefaultHostingSite");
9
+ const interactive_1 = require("../../hosting/interactive");
10
+ const api_1 = require("../../hosting/api");
11
+ const utils_1 = require("../../utils");
12
+ async function askQuestions(setup, config, options) {
9
13
  const authConfig = setup.config.auth;
10
14
  const choices = [
11
15
  {
@@ -38,33 +42,67 @@ async function askQuestions(setup) {
38
42
  if (providers.includes("google")) {
39
43
  logger_1.logger.info("");
40
44
  logger_1.logger.info("Configuring Google Sign-In...");
45
+ const projectId = setup.projectId;
46
+ const defaultDisplayName = authConfig?.providers?.googleSignIn?.oAuthBrandDisplayName || projectId || "My App";
41
47
  const oAuthBrandDisplayName = await (0, prompt_1.input)({
42
48
  message: "What display name would you like to use for your OAuth brand?",
43
- default: authConfig?.providers?.googleSignIn?.oAuthBrandDisplayName ||
44
- setup.project?.projectId ||
45
- "My App",
49
+ default: defaultDisplayName,
46
50
  });
51
+ const defaultEmail = authConfig?.providers?.googleSignIn?.supportEmail ||
52
+ (projectId ? `support@${projectId}.firebaseapp.com` : undefined);
47
53
  const supportEmail = await (0, prompt_1.input)({
48
54
  message: "What support email would you like to register for your OAuth brand?",
49
- default: authConfig?.providers?.googleSignIn?.supportEmail ||
50
- (setup.project ? `support@${setup.project.projectId}.firebaseapp.com` : undefined),
55
+ default: defaultEmail,
51
56
  });
52
57
  providersConfig.googleSignIn = {
53
58
  oAuthBrandDisplayName,
54
59
  supportEmail,
55
60
  };
56
61
  }
62
+ let newSiteId;
63
+ if (setup.projectId) {
64
+ let existingSite = setup.featureInfo?.hosting?.newSiteId;
65
+ if (!existingSite) {
66
+ try {
67
+ existingSite = await (0, getDefaultHostingSite_1.getDefaultHostingSite)({ projectId: setup.projectId });
68
+ }
69
+ catch (err) {
70
+ if (err !== getDefaultHostingSite_1.errNoDefaultSite) {
71
+ throw err;
72
+ }
73
+ }
74
+ }
75
+ if (existingSite) {
76
+ logger_1.logger.info(`Firebase Hosting site is present: ${clc.bold(existingSite)}.`);
77
+ }
78
+ else if (await (0, prompt_1.confirm)({
79
+ message: "A Firebase Hosting site is required for Firebase Authentication. Would you like to create a default site now?",
80
+ default: true,
81
+ nonInteractive: options?.nonInteractive,
82
+ })) {
83
+ newSiteId = await (0, interactive_1.pickHostingSiteName)("", {
84
+ projectId: setup.projectId,
85
+ nonInteractive: options?.nonInteractive,
86
+ });
87
+ }
88
+ }
57
89
  if (!setup.featureInfo) {
58
90
  setup.featureInfo = {};
59
91
  }
60
- setup.featureInfo.auth = { providers: providersConfig };
92
+ setup.featureInfo.auth = { providers: providersConfig, newSiteId };
61
93
  }
62
94
  async function actuate(setup, config) {
63
95
  const authConfig = setup.featureInfo?.auth;
64
96
  if (!authConfig) {
65
97
  return;
66
98
  }
67
- config.set("auth", authConfig);
99
+ if (authConfig.newSiteId && setup.projectId) {
100
+ await (0, api_1.createSite)(setup.projectId, authConfig.newSiteId);
101
+ logger_1.logger.info("");
102
+ (0, utils_1.logSuccess)(`Firebase Hosting site ${authConfig.newSiteId} created!`);
103
+ logger_1.logger.info("");
104
+ }
105
+ config.set("auth", { providers: authConfig.providers });
68
106
  config.writeProjectFile("firebase.json", config.src);
69
107
  logger_1.logger.info("");
70
108
  logger_1.logger.info("Generated firebase.json with auth configuration.");
@@ -30,7 +30,7 @@ async function askQuestions(setup, config, options) {
30
30
  case "nuxt2":
31
31
  case "express":
32
32
  case "svelekit":
33
- case "sveltekit":
33
+ case "sveltekit": {
34
34
  logger_1.logger.info();
35
35
  const useAppHosting = await (0, prompt_1.confirm)({
36
36
  message: `Detected a ${frameworkName} codebase with SSR features. We can't guarantee that ` +
@@ -47,7 +47,8 @@ async function askQuestions(setup, config, options) {
47
47
  return;
48
48
  }
49
49
  break;
50
- default:
50
+ }
51
+ default: {
51
52
  logger_1.logger.info();
52
53
  logger_1.logger.info(`Detected a ${frameworkName} codebase with SSR features. We can't guarantee that ` +
53
54
  `this site will work on Firebase Hosting, which is optimized for static sites. Another ` +
@@ -62,6 +63,7 @@ async function askQuestions(setup, config, options) {
62
63
  throw new error_1.FirebaseError("Hosting initialization cancelled.", { exit: 1 });
63
64
  }
64
65
  break;
66
+ }
65
67
  }
66
68
  }
67
69
  setup.featureInfo = setup.featureInfo || {};
@@ -169,14 +169,16 @@ async function sdkInit(appPlatform, options) {
169
169
  }
170
170
  async function getSdkOutputPath(appDir, platform, config) {
171
171
  switch (platform) {
172
- case AppPlatform.ANDROID:
172
+ case AppPlatform.ANDROID: {
173
173
  const androidPath = await findIntelligentPathForAndroid(appDir, config);
174
174
  return path.join(androidPath, "google-services.json");
175
+ }
175
176
  case AppPlatform.WEB:
176
177
  return path.join(appDir, "firebase-js-config.json");
177
- case AppPlatform.IOS:
178
+ case AppPlatform.IOS: {
178
179
  const iosPath = await findIntelligentPathForIOS(appDir, config);
179
180
  return path.join(iosPath, "GoogleService-Info.plist");
181
+ }
180
182
  }
181
183
  throw new error_1.FirebaseError("Platform " + platform.toString() + " is not supported yet.");
182
184
  }
@@ -286,7 +286,7 @@ async function addFirebaseToCloudProject(projectId) {
286
286
  catch (err) {
287
287
  logger_1.logger.debug(err.message);
288
288
  if (isTosNotAcceptedError(err)) {
289
- throw new error_1.FirebaseError(`Failed to add Firebase to Google Cloud Platform project ${clc.bold(projectId)} because your account has not accepted the Firebase Terms of Service. Please accept the Terms of Service in the Firebase console at ${api.consoleOrigin()} and try again.`, { exit: 2, original: err });
289
+ throw new error_1.FirebaseError(`Failed to add Firebase to Google Cloud Platform project ${clc.bold(projectId)} because your account has not accepted the Firebase Terms of Service. Please accept the Terms of Service in the Firebase console at ${api.consoleOrigin()}/?forceCheckTos=true and try again.`, { exit: 2, original: err });
290
290
  }
291
291
  throw new error_1.FirebaseError("Failed to add Firebase to Google Cloud Platform project. See firebase-debug.log for more info.", { exit: 2, original: err });
292
292
  }
@@ -28,9 +28,9 @@ function convertInputToValue(inputValue) {
28
28
  return { arrayValue: arrayValue };
29
29
  }
30
30
  else if (typeof inputValue === "object") {
31
- if (inputValue.hasOwnProperty("latitude") &&
31
+ if (Object.prototype.hasOwnProperty.call(inputValue, "latitude") &&
32
32
  typeof inputValue.latitude === "number" &&
33
- inputValue.hasOwnProperty("longitude") &&
33
+ Object.prototype.hasOwnProperty.call(inputValue, "longitude") &&
34
34
  typeof inputValue.longitude === "number") {
35
35
  return { geoPointValue: inputValue };
36
36
  }
package/lib/mcp/util.js CHANGED
@@ -114,13 +114,13 @@ function deepClean(obj, isRootLevel = false) {
114
114
  return obj;
115
115
  }
116
116
  const cleanedObj = { ...obj };
117
- if (cleanedObj.hasOwnProperty("$schema")) {
117
+ if (Object.prototype.hasOwnProperty.call(cleanedObj, "$schema")) {
118
118
  delete cleanedObj.$schema;
119
119
  }
120
- if (cleanedObj.hasOwnProperty("additionalProperties")) {
120
+ if (Object.prototype.hasOwnProperty.call(cleanedObj, "additionalProperties")) {
121
121
  delete cleanedObj.additionalProperties;
122
122
  }
123
- if (cleanedObj.hasOwnProperty("type")) {
123
+ if (Object.prototype.hasOwnProperty.call(cleanedObj, "type")) {
124
124
  const currentType = cleanedObj.type;
125
125
  if (Array.isArray(currentType)) {
126
126
  let filteredTypes = currentType.filter((t) => t !== "null");
@@ -159,12 +159,12 @@ function deepClean(obj, isRootLevel = false) {
159
159
  }
160
160
  }
161
161
  }
162
- if (cleanedObj.hasOwnProperty("properties") &&
162
+ if (Object.prototype.hasOwnProperty.call(cleanedObj, "properties") &&
163
163
  typeof cleanedObj.properties === "object" &&
164
164
  cleanedObj.properties !== null) {
165
165
  const newProperties = {};
166
166
  for (const key in cleanedObj.properties) {
167
- if (cleanedObj.properties.hasOwnProperty(key)) {
167
+ if (Object.prototype.hasOwnProperty.call(cleanedObj.properties, key)) {
168
168
  const cleanedPropertySchema = deepClean(cleanedObj.properties[key], false);
169
169
  if (cleanedPropertySchema !== null) {
170
170
  newProperties[key] = cleanedPropertySchema;
@@ -178,7 +178,7 @@ function deepClean(obj, isRootLevel = false) {
178
178
  cleanedObj.properties = newProperties;
179
179
  }
180
180
  }
181
- if (cleanedObj.hasOwnProperty("items") &&
181
+ if (Object.prototype.hasOwnProperty.call(cleanedObj, "items") &&
182
182
  typeof cleanedObj.items === "object" &&
183
183
  cleanedObj.items !== null) {
184
184
  const cleanedItemsSchema = deepClean(cleanedObj.items, false);
@@ -191,12 +191,12 @@ function deepClean(obj, isRootLevel = false) {
191
191
  }
192
192
  const defKeywords = ["$defs", "definitions"];
193
193
  for (const keyword of defKeywords) {
194
- if (cleanedObj.hasOwnProperty(keyword) &&
194
+ if (Object.prototype.hasOwnProperty.call(cleanedObj, keyword) &&
195
195
  typeof cleanedObj[keyword] === "object" &&
196
196
  cleanedObj[keyword] !== null) {
197
197
  const newDefs = {};
198
198
  for (const defKey in cleanedObj[keyword]) {
199
- if (cleanedObj[keyword].hasOwnProperty(defKey)) {
199
+ if (Object.prototype.hasOwnProperty.call(cleanedObj[keyword], defKey)) {
200
200
  const cleanedDef = deepClean(cleanedObj[keyword][defKey], false);
201
201
  if (cleanedDef !== null) {
202
202
  newDefs[defKey] = cleanedDef;
@@ -213,7 +213,8 @@ function deepClean(obj, isRootLevel = false) {
213
213
  }
214
214
  const schemaArrayKeywords = ["anyOf", "allOf", "oneOf"];
215
215
  for (const keyword of schemaArrayKeywords) {
216
- if (cleanedObj.hasOwnProperty(keyword) && Array.isArray(cleanedObj[keyword])) {
216
+ if (Object.prototype.hasOwnProperty.call(cleanedObj, keyword) &&
217
+ Array.isArray(cleanedObj[keyword])) {
217
218
  const newSchemaArray = cleanedObj[keyword]
218
219
  .map((subSchema) => deepClean(subSchema, false))
219
220
  .filter((subSchema) => subSchema !== null);
@@ -228,7 +229,7 @@ function deepClean(obj, isRootLevel = false) {
228
229
  return cleanedObj;
229
230
  }
230
231
  function cleanSchema(schema) {
231
- if (schema && schema.hasOwnProperty("type")) {
232
+ if (schema && Object.prototype.hasOwnProperty.call(schema, "type")) {
232
233
  const topLevelType = schema.type;
233
234
  if (topLevelType === "array") {
234
235
  return {};
@@ -120,10 +120,10 @@ class ProfileReport {
120
120
  opStats.rejected = 0;
121
121
  }
122
122
  opStats.times += 1;
123
- if (data.hasOwnProperty("millis")) {
123
+ if (Object.prototype.hasOwnProperty.call(data, "millis")) {
124
124
  opStats.millis += data.millis;
125
125
  }
126
- if (data.hasOwnProperty("pendingTime")) {
126
+ if (Object.prototype.hasOwnProperty.call(data, "pendingTime")) {
127
127
  opStats.pendingCount++;
128
128
  opStats.pendingTime += data.pendingTime;
129
129
  }
@@ -143,10 +143,10 @@ class ProfileReport {
143
143
  }
144
144
  const node = opType[path];
145
145
  node.times += 1;
146
- if (data.hasOwnProperty("millis")) {
146
+ if (Object.prototype.hasOwnProperty.call(data, "millis")) {
147
147
  node.millis += data.millis;
148
148
  }
149
- if (data.hasOwnProperty("pendingTime")) {
149
+ if (Object.prototype.hasOwnProperty.call(data, "pendingTime")) {
150
150
  node.pendingCount++;
151
151
  node.pendingTime += data.pendingTime;
152
152
  }
package/lib/scopes.js CHANGED
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CLOUD_PUBSUB = exports.CLOUD_STORAGE = exports.CLOUD_PLATFORM = exports.FIREBASE_PLATFORM = exports.CLOUD_PROJECTS_READONLY = exports.USERINFO_EMAIL = exports.EMAIL = exports.OPENID = void 0;
3
+ exports.CLOUD_PLATFORM = exports.FIREBASE_PLATFORM = exports.CLOUD_PROJECTS_READONLY = exports.USERINFO_EMAIL = exports.EMAIL = exports.OPENID = void 0;
4
4
  exports.OPENID = "openid";
5
5
  exports.EMAIL = "email";
6
6
  exports.USERINFO_EMAIL = "https://www.googleapis.com/auth/userinfo.email";
7
7
  exports.CLOUD_PROJECTS_READONLY = "https://www.googleapis.com/auth/cloudplatformprojects.readonly";
8
8
  exports.FIREBASE_PLATFORM = "https://www.googleapis.com/auth/firebase";
9
9
  exports.CLOUD_PLATFORM = "https://www.googleapis.com/auth/cloud-platform";
10
- exports.CLOUD_STORAGE = "https://www.googleapis.com/auth/devstorage.read_write";
11
- exports.CLOUD_PUBSUB = "https://www.googleapis.com/auth/pubsub";
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadStreamJson = loadStreamJson;
4
+ const url_1 = require("url");
5
+ const importModule = new Function("url", "return import(url)");
6
+ const nodeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require;
7
+ async function load(specifier) {
8
+ return importModule((0, url_1.pathToFileURL)(nodeRequire.resolve(specifier)).href);
9
+ }
10
+ let loaded;
11
+ function loadStreamJson() {
12
+ if (!loaded) {
13
+ loaded = (async () => {
14
+ const [streamChain, streamJson, pick, filter, streamArray, streamObject] = await Promise.all([
15
+ load("stream-chain"),
16
+ load("stream-json"),
17
+ load("stream-json/filters/pick.js"),
18
+ load("stream-json/filters/filter.js"),
19
+ load("stream-json/streamers/stream-array.js"),
20
+ load("stream-json/streamers/stream-object.js"),
21
+ ]);
22
+ return {
23
+ chain: streamChain.chain,
24
+ many: streamChain.many,
25
+ parser: streamJson.parser,
26
+ pick: pick.pick,
27
+ filter: filter.filter,
28
+ streamArray: streamArray.streamArray,
29
+ streamObject: streamObject.streamObject,
30
+ };
31
+ })();
32
+ loaded.catch(() => {
33
+ loaded = undefined;
34
+ });
35
+ }
36
+ return loaded;
37
+ }