firebase-tools 15.35.0 → 15.36.1-main.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 (136) hide show
  1. package/lib/accountExporter.js +1 -1
  2. package/lib/accountImporter.js +7 -6
  3. package/lib/apiv2.js +0 -1
  4. package/lib/appcheck/debugTokens.js +293 -0
  5. package/lib/appcheck/localConfig.js +191 -0
  6. package/lib/appdistribution/options-parser-util.js +1 -1
  7. package/lib/apphosting/githubConnections.js +1 -1
  8. package/lib/apptesting/parseTestFiles.js +1 -1
  9. package/lib/auth.js +9 -3
  10. package/lib/bin/progressiveHelp.js +1 -1
  11. package/lib/command.js +1 -2
  12. package/lib/commands/appcheck-debugtokens-create.js +60 -35
  13. package/lib/commands/appcheck-debugtokens-delete.js +21 -7
  14. package/lib/commands/appcheck-debugtokens-list.js +37 -8
  15. package/lib/commands/appcheck-debugtokens-prune.js +59 -0
  16. package/lib/commands/crashlytics-events-get.js +48 -0
  17. package/lib/commands/crashlytics-events-list.js +70 -0
  18. package/lib/commands/crashlytics-heapdumps-enable.js +3 -4
  19. package/lib/commands/crashlytics-heapdumps-status.js +5 -3
  20. package/lib/commands/crashlytics-issues-get.js +61 -0
  21. package/lib/commands/crashlytics-reports-get.js +179 -0
  22. package/lib/commands/crashlytics-reports-list.js +42 -0
  23. package/lib/commands/deploy.js +1 -3
  24. package/lib/commands/ext-dev-init.js +1 -1
  25. package/lib/commands/hosting-channel-create.js +1 -3
  26. package/lib/commands/hosting-channel-delete.js +1 -3
  27. package/lib/commands/hosting-channel-deploy.js +1 -3
  28. package/lib/commands/hosting-channel-list.js +1 -3
  29. package/lib/commands/hosting-channel-open.js +5 -4
  30. package/lib/commands/hosting-clone.js +3 -5
  31. package/lib/commands/hosting-disable.js +2 -2
  32. package/lib/commands/hosting-sites-create.js +1 -3
  33. package/lib/commands/hosting-sites-delete.js +1 -3
  34. package/lib/commands/hosting-sites-get.js +1 -3
  35. package/lib/commands/hosting-sites-list.js +1 -3
  36. package/lib/commands/index.js +11 -0
  37. package/lib/commands/open.js +3 -1
  38. package/lib/commands/serve.js +1 -1
  39. package/lib/commands/use.js +1 -1
  40. package/lib/config.js +1 -1
  41. package/lib/crashlytics/commandUtils.js +194 -0
  42. package/lib/crashlytics/events.js +122 -1
  43. package/lib/crashlytics/filters.js +12 -6
  44. package/lib/crashlytics/profilingManager.js +77 -50
  45. package/lib/crashlytics/reports.js +5 -1
  46. package/lib/crashlytics/utils.js +14 -0
  47. package/lib/database/import.js +5 -4
  48. package/lib/dataconnect/names.js +3 -3
  49. package/lib/dataconnect/schemaMigration.js +1 -1
  50. package/lib/deploy/firestore/prepare.js +21 -3
  51. package/lib/deploy/functions/backend.js +0 -10
  52. package/lib/deploy/functions/cel.js +2 -2
  53. package/lib/deploy/functions/deploy.js +2 -1
  54. package/lib/deploy/functions/release/fabricator.js +9 -2
  55. package/lib/deploy/functions/release/planner.js +3 -0
  56. package/lib/deploy/functions/release/reporter.js +0 -26
  57. package/lib/deploy/functions/runtimes/discovery/index.js +4 -1
  58. package/lib/deploy/functions/runtimes/discovery/parsing.js +1 -1
  59. package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +1 -1
  60. package/lib/deploy/functions/services/index.js +13 -11
  61. package/lib/deploy/hosting/prepare.js +1 -3
  62. package/lib/deploy/lifecycleHooks.js +1 -1
  63. package/lib/emulator/auth/operations.js +2 -2
  64. package/lib/emulator/auth/server.js +4 -2
  65. package/lib/emulator/auth/widget_ui.js +1 -1
  66. package/lib/emulator/commandUtils.js +4 -1
  67. package/lib/emulator/databaseEmulator.js +16 -11
  68. package/lib/emulator/dataconnect/pgliteServer.js +30 -24
  69. package/lib/emulator/downloadableEmulatorInfo.json +31 -31
  70. package/lib/emulator/downloadableEmulators.js +2 -2
  71. package/lib/emulator/extensions/postinstall.js +6 -6
  72. package/lib/emulator/firestoreEmulator.js +21 -15
  73. package/lib/emulator/functionsEmulator.js +11 -7
  74. package/lib/emulator/functionsEmulatorRuntime.js +9 -4
  75. package/lib/emulator/hub.js +12 -8
  76. package/lib/emulator/shared/express.js +30 -0
  77. package/lib/emulator/storage/apis/firebase.js +11 -10
  78. package/lib/emulator/storage/apis/gcloud.js +21 -20
  79. package/lib/emulator/storage/files.js +1 -1
  80. package/lib/emulator/storage/rules/manager.js +15 -12
  81. package/lib/emulator/storage/server.js +10 -5
  82. package/lib/experiments.js +5 -0
  83. package/lib/extensions/extensionsHelper.js +2 -2
  84. package/lib/extensions/listExtensions.js +1 -1
  85. package/lib/extensions/paramHelper.js +1 -1
  86. package/lib/extensions/provisioningHelper.js +1 -6
  87. package/lib/firestore/delete.js +2 -3
  88. package/lib/firestore/util.js +3 -3
  89. package/lib/frameworks/angular/utils.js +1 -1
  90. package/lib/frameworks/next/constants.js +17 -14
  91. package/lib/frameworks/next/index.js +25 -3
  92. package/lib/frameworks/next/utils.js +7 -9
  93. package/lib/functions/kits/install.js +221 -316
  94. package/lib/functions/kits/sources/directory.js +32 -0
  95. package/lib/functions/kits/sources/npm.js +55 -5
  96. package/lib/functionsConfig.js +0 -4
  97. package/lib/functionsShellCommandAction.js +1 -1
  98. package/lib/gcp/cloudbilling.js +2 -2
  99. package/lib/gcp/cloudbuild.js +0 -77
  100. package/lib/gcp/cloudfunctionsv2.js +0 -6
  101. package/lib/gcp/cloudtasks.js +0 -4
  102. package/lib/gcp/devConnect.js +2 -8
  103. package/lib/gcp/iam.js +15 -1
  104. package/lib/gcp/resourceManager.js +1 -14
  105. package/lib/gcp/storage.js +87 -4
  106. package/lib/hosting/api.js +79 -7
  107. package/lib/hosting/implicitInit.js +1 -1
  108. package/lib/hosting/proxy.js +5 -2
  109. package/lib/init/features/firestore/rules.js +1 -1
  110. package/lib/init/features/functions/index.js +2 -2
  111. package/lib/init/features/functions/npm-dependencies.js +1 -1
  112. package/lib/init/features/hosting/github.js +6 -4
  113. package/lib/init/features/hosting/index.js +4 -0
  114. package/lib/init/features/storage/rules.js +1 -1
  115. package/lib/localFunction.js +3 -3
  116. package/lib/management/database.js +1 -1
  117. package/lib/mcp/apps/init/mcp-app.js +5 -2
  118. package/lib/mcp/apps/update_environment/mcp-app.js +1 -1
  119. package/lib/mcp/index.js +14 -4
  120. package/lib/mcp/prompts/apptesting/run_test.js +3 -3
  121. package/lib/mcp/prompts/core/deploy.js +3 -3
  122. package/lib/mcp/resources/guides/init_ai.js +10 -10
  123. package/lib/mcp/tools/crashlytics/events.js +18 -93
  124. package/lib/mcp/tools/crashlytics/index.js +2 -0
  125. package/lib/mcp/tools/crashlytics/reports.js +3 -3
  126. package/lib/mcp/tools/crashlytics/setup.js +392 -0
  127. package/lib/mcp/util/dataconnect/converter.js +1 -1
  128. package/lib/profileReport.js +1 -1
  129. package/lib/profiler.js +1 -1
  130. package/lib/rulesDeploy.js +0 -1
  131. package/lib/throttler/throttler.js +1 -1
  132. package/lib/tsconfig.compile.tsbuildinfo +1 -1
  133. package/lib/tsconfig.publish.tsbuildinfo +1 -1
  134. package/lib/utils.js +5 -11
  135. package/package.json +4 -4
  136. package/lib/functions/kits/sources/index.js +0 -19
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = exports.REPORTS_REQUIRING_ISSUE_ID = void 0;
4
+ const Table = require("cli-table3");
5
+ const command_1 = require("../command");
6
+ const commandUtils_1 = require("../crashlytics/commandUtils");
7
+ const reports_1 = require("../crashlytics/reports");
8
+ const error_1 = require("../error");
9
+ const logger_1 = require("../logger");
10
+ const requireAuth_1 = require("../requireAuth");
11
+ const DEFAULT_LIMIT = 10;
12
+ const MAX_LIMIT = 100;
13
+ const MAX_CELL_LENGTH = 60;
14
+ exports.REPORTS_REQUIRING_ISSUE_ID = [
15
+ "topVariants",
16
+ "topBrowsers",
17
+ "topCustomKeys",
18
+ ];
19
+ const METRIC_COLUMNS = [
20
+ { header: "Events", value: (m) => m.eventsCount, always: true },
21
+ { header: "Impacted Users", value: (m) => m.impactedUsersCount, always: true },
22
+ { header: "Impacted Sessions", value: (m) => m.impactedSessionsCount },
23
+ { header: "Total Users", value: (m) => m.totalUsersCount },
24
+ { header: "Total Sessions", value: (m) => m.totalSessionsCount },
25
+ { header: "Crash-Free Users", value: (m) => m.crashFreeUsersPercentage, percent: true },
26
+ { header: "Crash-Free Sessions", value: (m) => m.crashFreeSessionsPercentage, percent: true },
27
+ ];
28
+ function truncate(value, max = MAX_CELL_LENGTH) {
29
+ if (!value) {
30
+ return "";
31
+ }
32
+ return value.length > max ? `${value.slice(0, max - 1)}…` : value;
33
+ }
34
+ function shortEventId(sampleEvent) {
35
+ return sampleEvent?.split("/").pop()?.split("?")[0] || "";
36
+ }
37
+ function dimensionFor(group) {
38
+ if (group?.issue) {
39
+ return {
40
+ headers: ["Issue ID", "Title", "Error Type", "Sample Event"],
41
+ cells: (g) => [
42
+ g.issue?.id || "",
43
+ truncate(g.issue?.title),
44
+ g.issue?.errorType || "",
45
+ shortEventId(g.issue?.sampleEvent),
46
+ ],
47
+ hasSampleEvents: true,
48
+ };
49
+ }
50
+ if (group?.variant) {
51
+ return {
52
+ headers: ["Variant ID", "Sample Event"],
53
+ cells: (g) => [g.variant?.id || "", shortEventId(g.variant?.sampleEvent)],
54
+ hasSampleEvents: true,
55
+ };
56
+ }
57
+ if (group?.version) {
58
+ return {
59
+ headers: ["Version"],
60
+ cells: (g) => {
61
+ const label = g.version?.displayName || g.version?.displayVersion || "";
62
+ const tracks = (g.version?.tracks || []).map((t) => t.title).filter(Boolean);
63
+ return [tracks.length ? `${label} [${tracks.join(", ")}]` : label];
64
+ },
65
+ };
66
+ }
67
+ if (group?.operatingSystem) {
68
+ return { headers: ["Operating System"], cells: (g) => [g.operatingSystem?.displayName || ""] };
69
+ }
70
+ if (group?.device) {
71
+ return { headers: ["Device"], cells: (g) => [g.device?.displayName || ""] };
72
+ }
73
+ if (group?.browser) {
74
+ return { headers: ["Browser"], cells: (g) => [g.browser?.displayName || ""] };
75
+ }
76
+ if (group?.customAttribute) {
77
+ return {
78
+ headers: ["Key", "Value"],
79
+ cells: (g) => [g.customAttribute?.key || "", truncate(g.customAttribute?.value)],
80
+ };
81
+ }
82
+ if (group?.webMetricsGroup) {
83
+ return { headers: ["Group"], cells: (g) => [g.webMetricsGroup?.id || ""] };
84
+ }
85
+ return { headers: [], cells: () => [] };
86
+ }
87
+ function formatMetric(column, metrics) {
88
+ const raw = metrics ? column.value(metrics) : undefined;
89
+ if (raw === undefined) {
90
+ return column.always ? "0" : "-";
91
+ }
92
+ return column.percent ? `${Number(raw).toFixed(2)}%` : String(raw);
93
+ }
94
+ function logReport(report, appId, limit) {
95
+ const groups = report.groups || [];
96
+ const dimension = dimensionFor(groups[0]);
97
+ const metricColumns = METRIC_COLUMNS.filter((col) => col.always ||
98
+ groups.some((g) => g.metrics?.[0] !== undefined && col.value(g.metrics[0]) !== undefined));
99
+ const table = new Table({
100
+ head: [...dimension.headers, ...metricColumns.map((c) => c.header)],
101
+ style: { head: ["green"] },
102
+ });
103
+ for (const group of groups) {
104
+ table.push([
105
+ ...dimension.cells(group),
106
+ ...metricColumns.map((c) => formatMetric(c, group.metrics?.[0])),
107
+ ]);
108
+ }
109
+ if (report.displayName) {
110
+ logger_1.logger.info(report.displayName);
111
+ }
112
+ logger_1.logger.info(table.toString());
113
+ const totalSize = Number(report.totalSize || 0);
114
+ if (totalSize > groups.length && limit < MAX_LIMIT) {
115
+ logger_1.logger.info(`Showing ${groups.length} of ${totalSize} groups. Use '--limit <number>' to show more (up to ${MAX_LIMIT}).`);
116
+ }
117
+ if (dimension.hasSampleEvents) {
118
+ logger_1.logger.info(`Run 'firebase crashlytics:events:get --app ${appId} <sampleEvent>' to inspect a sample event.`);
119
+ }
120
+ }
121
+ exports.command = (0, commandUtils_1.withEventFilterOptions)(new command_1.Command("crashlytics:reports:get <report>"))
122
+ .description("get a Crashlytics report, such as top issues or top versions")
123
+ .option("--app <appId>", "the Firebase App ID")
124
+ .option("-n, --limit <number>", `maximum number of groups to return (1-${MAX_LIMIT}, default: ${DEFAULT_LIMIT})`)
125
+ .option("-o, --output <path>", "write raw JSON output to a file")
126
+ .withForce("overwrite output file without prompting")
127
+ .help(`Gets a Crashlytics report: event, user, and session counts grouped by a dimension such as
128
+ issue, version, operating system, device, browser, or custom key.
129
+
130
+ Available reports differ between Android/Apple and web apps. Run
131
+ 'firebase crashlytics:reports:list --app <appId>' to see the reports for your app.
132
+
133
+ --issue-id is required for the topVariants, topBrowsers, and topCustomKeys reports,
134
+ not supported for topIssues (use 'crashlytics:issues:get' instead), and optional for all other reports.
135
+
136
+ Examples:
137
+ firebase crashlytics:reports:get --app <appId> topIssues
138
+ firebase crashlytics:reports:get --app <appId> --limit 5 --error-types FATAL topIssues
139
+ firebase crashlytics:reports:get --app <appId> --issue-id <issueId> topVariants
140
+ firebase crashlytics:reports:get --app <appId> --start-time 2026-11-01T00:00:00Z appSummary`)
141
+ .before(requireAuth_1.requireAuth)
142
+ .action(async (reportName, options) => {
143
+ const appId = (0, commandUtils_1.requireAppId)(options);
144
+ const report = typeof reportName === "string" ? reportName.trim() : "";
145
+ if (!report) {
146
+ throw new error_1.FirebaseError(`Must specify '<report>'. Run 'firebase crashlytics:reports:list --app ${appId}' to see available reports.`, { exit: 1 });
147
+ }
148
+ const limit = (0, commandUtils_1.parsePositiveIntOption)(options.limit, "--limit", {
149
+ defaultValue: DEFAULT_LIMIT,
150
+ max: MAX_LIMIT,
151
+ });
152
+ const filter = (0, commandUtils_1.parseEventFilters)(options, appId);
153
+ if (exports.REPORTS_REQUIRING_ISSUE_ID.includes(report) && !filter?.issueId) {
154
+ throw new error_1.FirebaseError(`The '${report}' report requires '--issue-id <id>'. Run 'firebase crashlytics:reports:get --app ${appId} topIssues' to find issue IDs.`, { exit: 1 });
155
+ }
156
+ if (report === "topIssues" && filter?.issueId) {
157
+ throw new error_1.FirebaseError(`The 'topIssues' report does not support '--issue-id'. Run 'firebase crashlytics:issues:get --app ${appId} ${filter.issueId}' to inspect a single issue.`, { exit: 1 });
158
+ }
159
+ let response;
160
+ try {
161
+ response = await (0, reports_1.getReport)(report, appId, filter, limit);
162
+ }
163
+ catch (err) {
164
+ const message = (0, error_1.getErrMsg)(err);
165
+ if (message.startsWith("Invalid Crashlytics report")) {
166
+ throw new error_1.FirebaseError(`${message}\nRun 'firebase crashlytics:reports:list --app ${appId}' for report descriptions.`, { exit: 1, original: (0, error_1.getError)(err) });
167
+ }
168
+ throw err;
169
+ }
170
+ if (await (0, commandUtils_1.writeOutputFileIfRequested)(response, options)) {
171
+ return response;
172
+ }
173
+ if (!response.groups?.length) {
174
+ logger_1.logger.info(`No results for the '${report}' report with the given filters.`);
175
+ return response;
176
+ }
177
+ logReport(response, appId, limit);
178
+ return response;
179
+ });
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
4
+ const Table = require("cli-table3");
5
+ const command_1 = require("../command");
6
+ const commandUtils_1 = require("../crashlytics/commandUtils");
7
+ const reports_1 = require("../crashlytics/reports");
8
+ const logger_1 = require("../logger");
9
+ const requireAuth_1 = require("../requireAuth");
10
+ function shortReportId(report) {
11
+ return report.name?.split("/").pop() || "";
12
+ }
13
+ exports.command = new command_1.Command("crashlytics:reports:list")
14
+ .description("list the Crashlytics reports available for an app")
15
+ .option("--app <appId>", "the Firebase App ID")
16
+ .option("-o, --output <path>", "write raw JSON output to a file")
17
+ .withForce("overwrite output file without prompting")
18
+ .before(requireAuth_1.requireAuth)
19
+ .action(async (options) => {
20
+ const appId = (0, commandUtils_1.requireAppId)(options);
21
+ const response = await (0, reports_1.listReports)(appId);
22
+ if (await (0, commandUtils_1.writeOutputFileIfRequested)(response, options)) {
23
+ return response;
24
+ }
25
+ const reports = response.reports || [];
26
+ if (reports.length === 0) {
27
+ logger_1.logger.info(`No Crashlytics reports are available for app ${appId}.`);
28
+ return response;
29
+ }
30
+ const table = new Table({
31
+ head: ["Report", "Display Name", "Usage"],
32
+ style: { head: ["green"] },
33
+ colWidths: [22, 24, 60],
34
+ wordWrap: true,
35
+ });
36
+ for (const report of reports) {
37
+ table.push([shortReportId(report), report.displayName || "", report.usage || ""]);
38
+ }
39
+ logger_1.logger.info(table.toString());
40
+ logger_1.logger.info(`Run 'firebase crashlytics:reports:get --app ${appId} <report>' to get a report.`);
41
+ return response;
42
+ });
@@ -16,8 +16,6 @@ const colorette_1 = require("colorette");
16
16
  const interactive_1 = require("../hosting/interactive");
17
17
  const utils_1 = require("../utils");
18
18
  const api_1 = require("../hosting/api");
19
- const ensureApiEnabled_1 = require("../ensureApiEnabled");
20
- const api_2 = require("../api");
21
19
  const projectUtils_1 = require("../projectUtils");
22
20
  const experiments = require("../experiments");
23
21
  const clc = require("colorette");
@@ -88,7 +86,7 @@ exports.command
88
86
  await (0, requireDatabaseInstance_1.requireDatabaseInstance)(options);
89
87
  }
90
88
  if (options.filteredTargets.includes("hosting")) {
91
- await (0, ensureApiEnabled_1.ensure)((0, projectUtils_1.needProjectId)(options), (0, api_2.hostingApiOrigin)(), "hosting", true);
89
+ await (0, api_1.ensureApiEnabled)((0, projectUtils_1.needProjectId)(options));
92
90
  let shouldCreateSite = false;
93
91
  try {
94
92
  await (0, requireHostingSite_1.requireHostingSite)(options);
@@ -60,7 +60,7 @@ exports.command = new command_1.Command("ext:dev:init")
60
60
  }
61
61
  }
62
62
  await npmDependencies.askInstallDependencies({ source: "functions" }, config);
63
- return logger_1.logger.info("\n" + (0, marked_1.marked)(welcome));
63
+ return logger_1.logger.info(`\n${(0, marked_1.marked)(welcome)}`);
64
64
  }
65
65
  catch (err) {
66
66
  if (!(err instanceof error_1.FirebaseError)) {
@@ -15,8 +15,6 @@ const requireConfig_1 = require("../requireConfig");
15
15
  const marked_1 = require("marked");
16
16
  const requireHostingSite_1 = require("../requireHostingSite");
17
17
  const getDefaultHostingSite_1 = require("../getDefaultHostingSite");
18
- const ensureApiEnabled_1 = require("../ensureApiEnabled");
19
- const api_2 = require("../api");
20
18
  const LOG_TAG = "hosting:channel";
21
19
  exports.command = new command_1.Command("hosting:channel:create [channelId]")
22
20
  .description("create a Firebase Hosting channel")
@@ -24,7 +22,7 @@ exports.command = new command_1.Command("hosting:channel:create [channelId]")
24
22
  .option("--site <siteId>", "site for which to create the channel")
25
23
  .before(requireConfig_1.requireConfig)
26
24
  .before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.update"])
27
- .before((options) => (0, ensureApiEnabled_1.ensure)((0, projectUtils_1.needProjectId)(options), (0, api_2.hostingApiOrigin)(), "hosting", true))
25
+ .before((options) => (0, api_1.ensureApiEnabled)((0, projectUtils_1.needProjectId)(options)))
28
26
  .before(async (options) => {
29
27
  try {
30
28
  await (0, requireHostingSite_1.requireHostingSite)(options);
@@ -12,15 +12,13 @@ const requirePermissions_1 = require("../requirePermissions");
12
12
  const projectUtils_1 = require("../projectUtils");
13
13
  const requireConfig_1 = require("../requireConfig");
14
14
  const logger_1 = require("../logger");
15
- const ensureApiEnabled_1 = require("../ensureApiEnabled");
16
- const api_2 = require("../api");
17
15
  exports.command = new command_1.Command("hosting:channel:delete <channelId>")
18
16
  .description("delete a Firebase Hosting channel")
19
17
  .withForce()
20
18
  .option("--site <siteId>", "site in which the channel exists")
21
19
  .before(requireConfig_1.requireConfig)
22
20
  .before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.update"])
23
- .before((options) => (0, ensureApiEnabled_1.ensure)((0, projectUtils_1.needProjectId)(options), (0, api_2.hostingApiOrigin)(), "hosting", true))
21
+ .before((options) => (0, api_1.ensureApiEnabled)((0, projectUtils_1.needProjectId)(options)))
24
22
  .before(requireHostingSite_1.requireHostingSite)
25
23
  .action(async (channelId, options) => {
26
24
  const projectId = (0, projectUtils_1.needProjectId)(options);
@@ -16,8 +16,6 @@ const utils_1 = require("../utils");
16
16
  const config_1 = require("../hosting/config");
17
17
  const marked_1 = require("marked");
18
18
  const requireHostingSite_1 = require("../requireHostingSite");
19
- const ensureApiEnabled_1 = require("../ensureApiEnabled");
20
- const api_2 = require("../api");
21
19
  const LOG_TAG = "hosting:channel";
22
20
  exports.command = new command_1.Command("hosting:channel:deploy [channelId]")
23
21
  .description("deploy to a specific Firebase Hosting channel")
@@ -27,7 +25,7 @@ exports.command = new command_1.Command("hosting:channel:deploy [channelId]")
27
25
  .option("--no-authorized-domains", "do not sync channel domains with Firebase Auth")
28
26
  .before(requireConfig_1.requireConfig)
29
27
  .before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.update"])
30
- .before((options) => (0, ensureApiEnabled_1.ensure)((0, projectUtils_1.needProjectId)(options), (0, api_2.hostingApiOrigin)(), "hosting", true))
28
+ .before((options) => (0, api_1.ensureApiEnabled)((0, projectUtils_1.needProjectId)(options)))
31
29
  .before(requireHostingSite_1.requireHostingSite)
32
30
  .action(hostingChannelDeployAction);
33
31
  async function hostingChannelDeployAction(channelId, options) {
@@ -11,15 +11,13 @@ const logger_1 = require("../logger");
11
11
  const requireConfig_1 = require("../requireConfig");
12
12
  const utils_1 = require("../utils");
13
13
  const requireHostingSite_1 = require("../requireHostingSite");
14
- const ensureApiEnabled_1 = require("../ensureApiEnabled");
15
- const api_2 = require("../api");
16
14
  const TABLE_HEAD = ["Channel ID", "Last Release Time", "URL", "Expire Time"];
17
15
  exports.command = new command_1.Command("hosting:channel:list")
18
16
  .description("list all Firebase Hosting channels for your project")
19
17
  .option("--site <siteName>", "list channels for the specified site")
20
18
  .before(requireConfig_1.requireConfig)
21
19
  .before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.update"])
22
- .before((options) => (0, ensureApiEnabled_1.ensure)((0, projectUtils_1.needProjectId)(options), (0, api_2.hostingApiOrigin)(), "hosting", true))
20
+ .before((options) => (0, api_1.ensureApiEnabled)((0, projectUtils_1.needProjectId)(options)))
23
21
  .before(requireHostingSite_1.requireHostingSite)
24
22
  .action(async (options) => {
25
23
  const projectId = (0, projectUtils_1.needProjectId)(options);
@@ -6,6 +6,7 @@ const colorette_1 = require("colorette");
6
6
  const open = require("open");
7
7
  const command_1 = require("../command");
8
8
  const error_1 = require("../error");
9
+ const logger_1 = require("../logger");
9
10
  const api_1 = require("../hosting/api");
10
11
  const requirePermissions_1 = require("../requirePermissions");
11
12
  const projectUtils_1 = require("../projectUtils");
@@ -13,15 +14,13 @@ const requireConfig_1 = require("../requireConfig");
13
14
  const utils_1 = require("../utils");
14
15
  const requireHostingSite_1 = require("../requireHostingSite");
15
16
  const prompt_1 = require("../prompt");
16
- const ensureApiEnabled_1 = require("../ensureApiEnabled");
17
- const api_2 = require("../api");
18
17
  exports.command = new command_1.Command("hosting:channel:open [channelId]")
19
18
  .description("opens the URL for a Firebase Hosting channel")
20
19
  .help("if unable to open the URL in a browser, it will be displayed in the output")
21
20
  .option("--site <siteId>", "the site to which the channel belongs")
22
21
  .before(requireConfig_1.requireConfig)
23
22
  .before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.get"])
24
- .before((options) => (0, ensureApiEnabled_1.ensure)((0, projectUtils_1.needProjectId)(options), (0, api_2.hostingApiOrigin)(), "hosting", true))
23
+ .before((options) => (0, api_1.ensureApiEnabled)((0, projectUtils_1.needProjectId)(options)))
25
24
  .before(requireHostingSite_1.requireHostingSite)
26
25
  .action(async (channelId, options) => {
27
26
  const projectId = (0, projectUtils_1.needProjectId)(options);
@@ -44,7 +43,9 @@ exports.command = new command_1.Command("hosting:channel:open [channelId]")
44
43
  }
45
44
  (0, utils_1.logLabeledBullet)("hosting:channel", channel.url);
46
45
  if (!options.nonInteractive) {
47
- open(channel.url);
46
+ open(channel.url).catch((err) => {
47
+ logger_1.logger.debug(`Unable to open URL: ${(0, error_1.getErrMsg)(err)}`);
48
+ });
48
49
  }
49
50
  return { url: channel.url };
50
51
  });
@@ -10,8 +10,6 @@ const utils = require("../utils");
10
10
  const requireAuth_1 = require("../requireAuth");
11
11
  const logger_1 = require("../logger");
12
12
  const projectUtils_1 = require("../projectUtils");
13
- const ensureApiEnabled_1 = require("../ensureApiEnabled");
14
- const api_2 = require("../api");
15
13
  exports.command = new command_1.Command("hosting:clone <source> <targetChannel>")
16
14
  .description("clone a version from one site to another")
17
15
  .help(`<source> and <targetChannel> accept the following formats:
@@ -74,7 +72,7 @@ To clone across different Firebase projects:
74
72
  }
75
73
  const defaultProjectId = !sourceProjectId || !targetProjectId ? (0, projectUtils_1.getProjectId)(options) : undefined;
76
74
  if (defaultProjectId) {
77
- await (0, ensureApiEnabled_1.ensure)(defaultProjectId, (0, api_2.hostingApiOrigin)(), "hosting", true);
75
+ await (0, api_1.ensureApiEnabled)(defaultProjectId);
78
76
  }
79
77
  [sourceProjectId, targetProjectId] = await Promise.all([
80
78
  resolveProjectId(sourceSiteId, sourceProjectId, options),
@@ -82,10 +80,10 @@ To clone across different Firebase projects:
82
80
  ]);
83
81
  const ensurePromises = [];
84
82
  if (sourceProjectId !== defaultProjectId) {
85
- ensurePromises.push((0, ensureApiEnabled_1.ensure)(sourceProjectId, (0, api_2.hostingApiOrigin)(), "hosting", true));
83
+ ensurePromises.push((0, api_1.ensureApiEnabled)(sourceProjectId));
86
84
  }
87
85
  if (targetProjectId !== defaultProjectId && targetProjectId !== sourceProjectId) {
88
- ensurePromises.push((0, ensureApiEnabled_1.ensure)(targetProjectId, (0, api_2.hostingApiOrigin)(), "hosting", true));
86
+ ensurePromises.push((0, api_1.ensureApiEnabled)(targetProjectId));
89
87
  }
90
88
  await Promise.all(ensurePromises);
91
89
  targetChannelId = (0, api_1.normalizeName)(targetChannelId);
@@ -5,18 +5,18 @@ const clc = require("colorette");
5
5
  const apiv2_1 = require("../apiv2");
6
6
  const command_1 = require("../command");
7
7
  const api_1 = require("../api");
8
+ const api_2 = require("../hosting/api");
8
9
  const prompt_1 = require("../prompt");
9
10
  const requireHostingSite_1 = require("../requireHostingSite");
10
11
  const requirePermissions_1 = require("../requirePermissions");
11
12
  const projectUtils_1 = require("../projectUtils");
12
13
  const utils = require("../utils");
13
- const ensureApiEnabled_1 = require("../ensureApiEnabled");
14
14
  exports.command = new command_1.Command("hosting:disable")
15
15
  .description("stop serving web traffic to your Firebase Hosting site")
16
16
  .option("-f, --force", "skip confirmation")
17
17
  .option("-s, --site <siteName>", "the site to disable")
18
18
  .before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.update"])
19
- .before((options) => (0, ensureApiEnabled_1.ensure)((0, projectUtils_1.needProjectId)(options), (0, api_1.hostingApiOrigin)(), "hosting", true))
19
+ .before((options) => (0, api_2.ensureApiEnabled)((0, projectUtils_1.needProjectId)(options)))
20
20
  .before(requireHostingSite_1.requireHostingSite)
21
21
  .action(async (options) => {
22
22
  const projectId = (0, projectUtils_1.needProjectId)(options);
@@ -10,14 +10,12 @@ const projectUtils_1 = require("../projectUtils");
10
10
  const requirePermissions_1 = require("../requirePermissions");
11
11
  const api_1 = require("../hosting/api");
12
12
  const error_1 = require("../error");
13
- const ensureApiEnabled_1 = require("../ensureApiEnabled");
14
- const api_2 = require("../api");
15
13
  const LOG_TAG = "hosting:sites";
16
14
  exports.command = new command_1.Command("hosting:sites:create [siteId]")
17
15
  .description("create a Firebase Hosting site")
18
16
  .option("--app <appId>", "specify an existing Firebase Web App ID")
19
17
  .before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.update"])
20
- .before((options) => (0, ensureApiEnabled_1.ensure)((0, projectUtils_1.needProjectId)(options), (0, api_2.hostingApiOrigin)(), "hosting", true))
18
+ .before((options) => (0, api_1.ensureApiEnabled)((0, projectUtils_1.needProjectId)(options)))
21
19
  .action(async (siteId, options) => {
22
20
  const projectId = (0, projectUtils_1.needProjectId)(options);
23
21
  const appId = options.app;
@@ -11,15 +11,13 @@ const requirePermissions_1 = require("../requirePermissions");
11
11
  const projectUtils_1 = require("../projectUtils");
12
12
  const requireConfig_1 = require("../requireConfig");
13
13
  const logger_1 = require("../logger");
14
- const ensureApiEnabled_1 = require("../ensureApiEnabled");
15
- const api_2 = require("../api");
16
14
  const LOG_TAG = "hosting:sites";
17
15
  exports.command = new command_1.Command("hosting:sites:delete <siteId>")
18
16
  .description("delete a Firebase Hosting site")
19
17
  .withForce()
20
18
  .before(requireConfig_1.requireConfig)
21
19
  .before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.delete"])
22
- .before((options) => (0, ensureApiEnabled_1.ensure)((0, projectUtils_1.needProjectId)(options), (0, api_2.hostingApiOrigin)(), "hosting", true))
20
+ .before((options) => (0, api_1.ensureApiEnabled)((0, projectUtils_1.needProjectId)(options)))
23
21
  .action(async (siteId, options) => {
24
22
  const projectId = (0, projectUtils_1.needProjectId)(options);
25
23
  if (!siteId) {
@@ -8,12 +8,10 @@ const requirePermissions_1 = require("../requirePermissions");
8
8
  const projectUtils_1 = require("../projectUtils");
9
9
  const logger_1 = require("../logger");
10
10
  const error_1 = require("../error");
11
- const ensureApiEnabled_1 = require("../ensureApiEnabled");
12
- const api_2 = require("../api");
13
11
  exports.command = new command_1.Command("hosting:sites:get <siteId>")
14
12
  .description("print info about a Firebase Hosting site")
15
13
  .before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.get"])
16
- .before((options) => (0, ensureApiEnabled_1.ensure)((0, projectUtils_1.needProjectId)(options), (0, api_2.hostingApiOrigin)(), "hosting", true))
14
+ .before((options) => (0, api_1.ensureApiEnabled)((0, projectUtils_1.needProjectId)(options)))
17
15
  .action(async (siteId, options) => {
18
16
  const projectId = (0, projectUtils_1.needProjectId)(options);
19
17
  if (!siteId) {
@@ -8,13 +8,11 @@ const api_1 = require("../hosting/api");
8
8
  const requirePermissions_1 = require("../requirePermissions");
9
9
  const projectUtils_1 = require("../projectUtils");
10
10
  const logger_1 = require("../logger");
11
- const ensureApiEnabled_1 = require("../ensureApiEnabled");
12
- const api_2 = require("../api");
13
11
  const TABLE_HEAD = ["Site ID", "Default URL", "App ID (if set)"];
14
12
  exports.command = new command_1.Command("hosting:sites:list")
15
13
  .description("list Firebase Hosting sites")
16
14
  .before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.get"])
17
- .before((options) => (0, ensureApiEnabled_1.ensure)((0, projectUtils_1.needProjectId)(options), (0, api_2.hostingApiOrigin)(), "hosting", true))
15
+ .before((options) => (0, api_1.ensureApiEnabled)((0, projectUtils_1.needProjectId)(options)))
18
16
  .action(async (options) => {
19
17
  const projectId = (0, projectUtils_1.needProjectId)(options);
20
18
  const sites = await (0, api_1.listSites)(projectId);
@@ -23,6 +23,7 @@ function load(client) {
23
23
  client.appcheck.debugtokens = {};
24
24
  client.appcheck.debugtokens.create = loadCommand("appcheck-debugtokens-create");
25
25
  client.appcheck.debugtokens.list = loadCommand("appcheck-debugtokens-list");
26
+ client.appcheck.debugtokens.prune = loadCommand("appcheck-debugtokens-prune");
26
27
  client.appcheck.debugtokens.delete = loadCommand("appcheck-debugtokens-delete");
27
28
  if (experiments.isEnabled("appcheckadmin")) {
28
29
  client.appcheck.services = {};
@@ -81,6 +82,16 @@ function load(client) {
81
82
  client.crashlytics.heapdumps.enable = loadCommand("crashlytics-heapdumps-enable");
82
83
  client.crashlytics.heapdumps.disable = loadCommand("crashlytics-heapdumps-disable");
83
84
  client.crashlytics.heapdumps.status = loadCommand("crashlytics-heapdumps-status");
85
+ if (experiments.isEnabled("crashlyticscli")) {
86
+ client.crashlytics.issues = {};
87
+ client.crashlytics.issues.get = loadCommand("crashlytics-issues-get");
88
+ client.crashlytics.events = {};
89
+ client.crashlytics.events.list = loadCommand("crashlytics-events-list");
90
+ client.crashlytics.events.get = loadCommand("crashlytics-events-get");
91
+ client.crashlytics.reports = {};
92
+ client.crashlytics.reports.list = loadCommand("crashlytics-reports-list");
93
+ client.crashlytics.reports.get = loadCommand("crashlytics-reports-get");
94
+ }
84
95
  client.database = {};
85
96
  client.database.get = loadCommand("database-get");
86
97
  client.database.import = loadCommand("database-import");
@@ -98,5 +98,7 @@ exports.command = new command_1.Command("open [link]")
98
98
  }
99
99
  logger_1.logger.info(`Opening ${clc.bold(link.name)} link in your default browser:`);
100
100
  logger_1.logger.info(clc.bold(clc.underline(url)));
101
- open(url);
101
+ open(url).catch((err) => {
102
+ logger_1.logger.debug(`Unable to open URL: ${(0, error_1.getErrMsg)(err)}`);
103
+ });
102
104
  });
@@ -48,7 +48,7 @@ exports.command = new command_1.Command("serve")
48
48
  }
49
49
  if (options.config) {
50
50
  logger_1.logger.info();
51
- logger_1.logger.info(clc.bold(clc.white("===") + " Serving from '" + options.config.projectDir + "'..."));
51
+ logger_1.logger.info(clc.bold(`${clc.white("===")} Serving from '${String(options.config.projectDir)}'...`));
52
52
  logger_1.logger.info();
53
53
  }
54
54
  else {
@@ -123,7 +123,7 @@ async function genericUse(options) {
123
123
  return utils.reject("No active project");
124
124
  }
125
125
  if (options.projectAlias) {
126
- logger_1.logger.info("Active Project:", clc.bold(clc.cyan(options.projectAlias + " (" + options.project + ")")));
126
+ logger_1.logger.info("Active Project:", clc.bold(clc.cyan(`${String(options.projectAlias)} (${String(options.project)})`)));
127
127
  }
128
128
  else if (options.project) {
129
129
  logger_1.logger.info("Active Project:", clc.bold(clc.cyan(options.project)));
package/lib/config.js CHANGED
@@ -268,7 +268,7 @@ class Config {
268
268
  return new Config(data, options);
269
269
  }
270
270
  catch (e) {
271
- throw new error_1.FirebaseError(`There was an error loading ${filename}:\n\n` + e.message, {
271
+ throw new error_1.FirebaseError(`There was an error loading ${filename}:\n\n${(0, error_1.getErrMsg)(e)}`, {
272
272
  exit: 1,
273
273
  });
274
274
  }