firebase-tools-with-isolate 15.36.0 → 15.38.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.
- package/lib/accountExporter.js +1 -1
- package/lib/accountImporter.js +15 -10
- package/lib/apiv2.js +66 -12
- package/lib/appUtils.js +103 -40
- package/lib/appdistribution/client.js +5 -1
- package/lib/apptesting/parseTestFiles.js +1 -1
- package/lib/auth.js +1 -1
- package/lib/bin/progressiveHelp.js +1 -1
- package/lib/command.js +1 -2
- package/lib/commands/appdistribution-distribute.js +5 -3
- package/lib/commands/crashlytics-events-get.js +46 -0
- package/lib/commands/crashlytics-events-list.js +68 -0
- package/lib/commands/crashlytics-heapdumps-enable.js +3 -4
- package/lib/commands/crashlytics-heapdumps-status.js +5 -3
- package/lib/commands/crashlytics-issues-get.js +65 -0
- package/lib/commands/crashlytics-reports-get.js +267 -0
- package/lib/commands/crashlytics-reports-list.js +42 -0
- package/lib/commands/dataconnect-services-list.js +8 -2
- package/lib/commands/ext-dev-init.js +1 -1
- package/lib/commands/hosting-channel-open.js +4 -1
- package/lib/commands/index.js +10 -0
- package/lib/commands/open.js +3 -1
- package/lib/commands/serve.js +1 -1
- package/lib/commands/use.js +1 -1
- package/lib/config.js +1 -1
- package/lib/crashlytics/commandUtils.js +227 -0
- package/lib/crashlytics/events.js +71 -73
- package/lib/crashlytics/filters.js +1 -1
- package/lib/crashlytics/profilingManager.js +63 -16
- package/lib/crashlytics/reports.js +5 -1
- package/lib/dataconnect/client.js +14 -8
- package/lib/deploy/dataconnect/release.js +2 -2
- package/lib/deploy/firestore/prepare.js +23 -17
- package/lib/deploy/functions/cel.js +1 -1
- package/lib/deploy/functions/deploy.js +2 -1
- package/lib/deploy/functions/prepare.js +28 -0
- package/lib/deploy/functions/release/fabricator.js +27 -3
- package/lib/deploy/functions/release/planner.js +3 -0
- package/lib/deploy/functions/runtimes/discovery/parsing.js +1 -1
- package/lib/deploy/functions/runtimes/python/index.js +3 -0
- package/lib/deploy/functions/runtimes/supported/index.js +10 -4
- package/lib/deploy/functions/runtimes/supported/types.js +13 -1
- package/lib/deploy/run/deploy.js +40 -35
- package/lib/deploy/run/prereqs.js +0 -3
- package/lib/downloadUtils.js +2 -1
- package/lib/emulator/download.js +1 -0
- package/lib/emulator/downloadableEmulatorInfo.json +31 -31
- package/lib/emulator/downloadableEmulators.js +14 -2
- package/lib/emulator/events/types.js +0 -6
- package/lib/emulator/functionsEmulator.js +73 -1
- package/lib/emulator/functionsEmulatorRuntime.js +2 -2
- package/lib/emulator/storage/cloudFunctions.js +0 -1
- package/lib/emulator/storage/rules/runtime.js +0 -3
- package/lib/emulator/taskQueue.js +0 -12
- package/lib/experiments.js +10 -0
- package/lib/extensions/extensionsHelper.js +1 -4
- package/lib/extensions/listExtensions.js +1 -1
- package/lib/extensions/replacements.json +2 -1
- package/lib/firestore/delete.js +2 -3
- package/lib/firestore/fsConfig.js +100 -41
- package/lib/frameworks/next/constants.js +17 -14
- package/lib/frameworks/next/index.js +2 -2
- package/lib/frameworks/next/utils.js +6 -8
- package/lib/gcp/cloudbilling.js +2 -2
- package/lib/gcp/cloudbuild.js +0 -77
- package/lib/gcp/cloudscheduler.js +12 -0
- package/lib/gcp/cloudtasks.js +0 -4
- package/lib/gcp/devConnect.js +0 -6
- package/lib/gcp/iam.js +15 -1
- package/lib/gcp/resourceManager.js +1 -14
- package/lib/gcp/runv2.js +0 -27
- package/lib/gcp/secretManager.js +2 -2
- package/lib/gcp/storage.js +87 -4
- package/lib/hosting/api.js +29 -23
- package/lib/hosting/implicitInit.js +1 -1
- package/lib/hosting/proxy.js +1 -1
- package/lib/init/features/dataconnect/sdk.js +15 -5
- package/lib/init/features/firestore/rules.js +1 -1
- package/lib/init/features/functions/index.js +2 -2
- package/lib/init/features/functions/npm-dependencies.js +1 -1
- package/lib/init/features/storage/rules.js +1 -1
- package/lib/localFunction.js +3 -3
- package/lib/management/apps.js +7 -0
- package/lib/management/database.js +1 -1
- package/lib/mcp/apps/init/mcp-app.js +1 -1
- package/lib/mcp/apps/update_environment/mcp-app.js +1 -1
- package/lib/mcp/index.js +10 -4
- package/lib/mcp/tools/core/get_environment.js +1 -1
- package/lib/mcp/tools/crashlytics/events.js +2 -5
- package/lib/mcp/tools/crashlytics/reports.js +5 -14
- package/lib/mcp/util/apptesting/availability.js +3 -2
- package/lib/mcp/util/crashlytics/availability.js +59 -12
- package/lib/mcp/util/dataconnect/converter.js +1 -1
- package/lib/mcp/util.js +4 -0
- package/lib/profileReport.js +1 -1
- package/lib/profiler.js +1 -1
- package/lib/requireAuth.js +11 -7
- package/lib/rulesDeploy.js +0 -1
- package/lib/throttler/throttler.js +1 -1
- package/lib/tsconfig.publish.tsbuildinfo +1 -1
- package/lib/utils.js +1 -1
- package/package.json +15 -12
- package/schema/firebase-config.json +9 -3
- package/standalone/package.json +6 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const commandUtils_1 = require("../crashlytics/commandUtils");
|
|
6
|
+
const events_1 = require("../crashlytics/events");
|
|
7
|
+
const error_1 = require("../error");
|
|
8
|
+
const logger_1 = require("../logger");
|
|
9
|
+
const requireAuth_1 = require("../requireAuth");
|
|
10
|
+
const DEFAULT_LIMIT = 10;
|
|
11
|
+
const MAX_LIMIT = 100;
|
|
12
|
+
exports.command = (0, commandUtils_1.withEventFilterOptions)(new command_1.Command("crashlytics:events:list"))
|
|
13
|
+
.description("list the most recent Crashlytics events matching the given filters")
|
|
14
|
+
.option("--app <appId>", "the Firebase App ID")
|
|
15
|
+
.option("--filter <expression>", "AIP-160 filter expression for custom keys (e.g. 'custom_keys.env = \"prod\"')")
|
|
16
|
+
.option("-n, --limit <number>", `maximum number of events to return (1-${MAX_LIMIT}, default: ${DEFAULT_LIMIT})`)
|
|
17
|
+
.option("--max-frames <number>", `maximum stack frames per thread or exception (default: ${events_1.DEFAULT_MAX_FRAMES}, ignored when --full is set)`)
|
|
18
|
+
.option("--full", "include all threads, stack frames, logs, and breadcrumbs without truncation")
|
|
19
|
+
.option("-o, --output <path>", "write raw JSON output to a file")
|
|
20
|
+
.withForce("overwrite output file without prompting")
|
|
21
|
+
.help(`Lists the most recent Crashlytics events matching the specified filters.
|
|
22
|
+
Requires --issue-id. For Android/Apple apps, add --variant-id to narrow results to one issue variant.
|
|
23
|
+
|
|
24
|
+
Custom Key Filtering (--filter):
|
|
25
|
+
Filter events by Crashlytics custom keys using AIP-160 syntax:
|
|
26
|
+
- Exact match: --filter 'custom_keys.env = "prod"'
|
|
27
|
+
- Key presence: --filter 'custom_keys.experiment_id:*'
|
|
28
|
+
- Multiple keys: --filter 'custom_keys.env = "prod" AND custom_keys.role = "admin"'
|
|
29
|
+
- Multiple vals: --filter 'custom_keys.env = "prod" OR custom_keys.env = "staging"'
|
|
30
|
+
OR is only supported between values of the same key.`)
|
|
31
|
+
.before(requireAuth_1.requireAuth)
|
|
32
|
+
.action(async (options) => {
|
|
33
|
+
const appId = (0, commandUtils_1.requireAppId)(options);
|
|
34
|
+
const filter = (0, commandUtils_1.parseEventFilters)(options, appId);
|
|
35
|
+
if (!filter?.issueId) {
|
|
36
|
+
throw new error_1.FirebaseError(`Must specify '--issue-id <id>' to list events. Run 'firebase crashlytics:reports:get --app ${appId} topIssues' to find issue IDs.`, { exit: 1 });
|
|
37
|
+
}
|
|
38
|
+
const limit = (0, commandUtils_1.parsePositiveIntOption)(options.limit, "--limit", {
|
|
39
|
+
defaultValue: DEFAULT_LIMIT,
|
|
40
|
+
max: MAX_LIMIT,
|
|
41
|
+
});
|
|
42
|
+
const maxFrames = (0, commandUtils_1.parsePositiveIntOption)(options.maxFrames, "--max-frames", {
|
|
43
|
+
defaultValue: events_1.DEFAULT_MAX_FRAMES,
|
|
44
|
+
});
|
|
45
|
+
const filterExpression = typeof options.filter === "string" ? options.filter.trim() || undefined : undefined;
|
|
46
|
+
let response;
|
|
47
|
+
try {
|
|
48
|
+
response = await (0, events_1.listEvents)(appId, filter, limit, filterExpression);
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
const status = (0, error_1.getErrStatus)(err);
|
|
52
|
+
const message = (0, error_1.getErrMsg)(err);
|
|
53
|
+
if (filterExpression && (status === 400 || message.includes("INVALID_ARGUMENT"))) {
|
|
54
|
+
throw new error_1.FirebaseError(`${message}\nSee 'firebase crashlytics:events:list --help' for --filter syntax and examples.`, { exit: 1, status, original: (0, error_1.getError)(err) });
|
|
55
|
+
}
|
|
56
|
+
throw err;
|
|
57
|
+
}
|
|
58
|
+
if (!(await (0, commandUtils_1.writeOutputFileIfRequested)(response, options))) {
|
|
59
|
+
const events = response.events || [];
|
|
60
|
+
if (events.length === 0) {
|
|
61
|
+
logger_1.logger.info("No matching events found.");
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
logger_1.logger.info((0, events_1.toText)(events, { maxFrames, full: Boolean(options.full) }));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return response;
|
|
68
|
+
});
|
|
@@ -14,12 +14,12 @@ const profilingManager_1 = require("../crashlytics/profilingManager");
|
|
|
14
14
|
exports.command = new command_1.Command("crashlytics:heapdumps:enable")
|
|
15
15
|
.description("enable Crashlytics heap dump collection for an Android app")
|
|
16
16
|
.option("--app <appID>", "the app id of your Firebase Android app")
|
|
17
|
-
.option("--location <location>",
|
|
17
|
+
.option("--location <location>", "the location for the Cloud Storage bucket", profilingManager_1.DEFAULT_BUCKET_LOCATION)
|
|
18
18
|
.withForce("automatically configure without prompting for confirmation")
|
|
19
19
|
.before(requireAuth_1.requireAuth)
|
|
20
20
|
.action(async (options) => {
|
|
21
21
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
22
|
-
const appId = await (0, profilingManager_1.
|
|
22
|
+
const { appId, packageName } = await (0, profilingManager_1.resolveAndroidApp)(projectId, options);
|
|
23
23
|
const location = options.location || profilingManager_1.DEFAULT_BUCKET_LOCATION;
|
|
24
24
|
const isBillingEnabled = await cloudbilling.checkBillingEnabled(projectId);
|
|
25
25
|
if (!isBillingEnabled) {
|
|
@@ -29,7 +29,6 @@ exports.command = new command_1.Command("crashlytics:heapdumps:enable")
|
|
|
29
29
|
const bucketName = (0, profilingManager_1.createBucketName)(appId);
|
|
30
30
|
const confirmed = await (0, prompt_1.confirm)({
|
|
31
31
|
message: `Enable Crashlytics heap dump collection for ${appId} using Cloud Storage bucket '${bucketName}' in ${location} (with ${profilingManager_1.DEFAULT_FILE_TTL_DAYS}-day file TTL)?`,
|
|
32
|
-
default: true,
|
|
33
32
|
force: options.force,
|
|
34
33
|
nonInteractive: options.nonInteractive,
|
|
35
34
|
});
|
|
@@ -45,7 +44,7 @@ exports.command = new command_1.Command("crashlytics:heapdumps:enable")
|
|
|
45
44
|
logger_1.logger.info(` File TTL: ${clc.cyan(`${profilingManager_1.DEFAULT_FILE_TTL_DAYS} days`)}`);
|
|
46
45
|
logger_1.logger.info(` Status: ${clc.green("Enabled")}`);
|
|
47
46
|
logger_1.logger.info("");
|
|
48
|
-
logger_1.logger.info(`View collected heap dumps in the Firebase Console: ${(0,
|
|
47
|
+
logger_1.logger.info(`View collected heap dumps in the Firebase Console: ${(0, profilingManager_1.getCrashlyticsConsoleUrl)(projectId, packageName)}`);
|
|
49
48
|
return {
|
|
50
49
|
appId,
|
|
51
50
|
bucketName,
|
|
@@ -16,17 +16,19 @@ exports.command = new command_1.Command("crashlytics:heapdumps:status")
|
|
|
16
16
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
17
17
|
const appId = await (0, profilingManager_1.resolveAndroidAppId)(projectId, options);
|
|
18
18
|
const config = await (0, profilingManager_1.getProfilingManagerConfig)(appId);
|
|
19
|
+
const heapDumpCollectionEnabled = Boolean(config?.heapDumpCollectionEnabled);
|
|
19
20
|
const tableHead = ["App ID", "Collection Status", "Cloud Storage Bucket"];
|
|
20
21
|
const table = new Table({ head: tableHead, style: { head: ["green"] } });
|
|
21
22
|
table.push([
|
|
22
23
|
appId,
|
|
23
|
-
|
|
24
|
-
config
|
|
24
|
+
heapDumpCollectionEnabled ? clc.green("Enabled") : clc.red("Disabled"),
|
|
25
|
+
config?.bucket || clc.yellow("(none)"),
|
|
25
26
|
]);
|
|
26
27
|
logger_1.logger.info("");
|
|
27
28
|
logger_1.logger.info(table.toString());
|
|
28
29
|
return {
|
|
29
30
|
appId,
|
|
30
|
-
...config,
|
|
31
|
+
...(config ?? {}),
|
|
32
|
+
heapDumpCollectionEnabled,
|
|
31
33
|
};
|
|
32
34
|
});
|
|
@@ -0,0 +1,65 @@
|
|
|
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 issues_1 = require("../crashlytics/issues");
|
|
8
|
+
const error_1 = require("../error");
|
|
9
|
+
const logger_1 = require("../logger");
|
|
10
|
+
const requireAuth_1 = require("../requireAuth");
|
|
11
|
+
function logIssue(appId, issue) {
|
|
12
|
+
const sampleEventId = (0, commandUtils_1.shortEventId)(issue.sampleEvent);
|
|
13
|
+
const table = new Table({
|
|
14
|
+
head: ["Field", "Value"],
|
|
15
|
+
style: { head: ["green"] },
|
|
16
|
+
});
|
|
17
|
+
const rows = [
|
|
18
|
+
["Issue ID", issue.id],
|
|
19
|
+
["Title", issue.title],
|
|
20
|
+
["Subtitle", issue.subtitle],
|
|
21
|
+
["State", issue.state],
|
|
22
|
+
["Error Type", issue.errorType],
|
|
23
|
+
["First Seen Version", issue.firstSeenVersion],
|
|
24
|
+
["Last Seen Version", issue.lastSeenVersion],
|
|
25
|
+
["First Seen Time", issue.firstSeenTime],
|
|
26
|
+
["Last Seen Time", issue.lastSeenTime],
|
|
27
|
+
[
|
|
28
|
+
"Signals",
|
|
29
|
+
issue.signals
|
|
30
|
+
?.map((s) => s.signal)
|
|
31
|
+
.filter(Boolean)
|
|
32
|
+
.join(", "),
|
|
33
|
+
],
|
|
34
|
+
["Notes Count", issue.notesCount !== undefined ? String(issue.notesCount) : undefined],
|
|
35
|
+
["Sample Event", sampleEventId],
|
|
36
|
+
["Console URI", issue.uri],
|
|
37
|
+
];
|
|
38
|
+
for (const [label, value] of rows) {
|
|
39
|
+
if (value !== undefined && value !== "") {
|
|
40
|
+
table.push([label, value]);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
logger_1.logger.info(table.toString());
|
|
44
|
+
if (sampleEventId) {
|
|
45
|
+
logger_1.logger.info(`Run 'firebase crashlytics:events:get --app ${appId} ${sampleEventId}' to inspect the sample event.`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.command = new command_1.Command("crashlytics:issues:get <issueId>")
|
|
49
|
+
.description("get details for a Crashlytics issue")
|
|
50
|
+
.option("--app <appId>", "the Firebase App ID")
|
|
51
|
+
.option("-o, --output <path>", "write raw JSON output to a file")
|
|
52
|
+
.withForce("overwrite output file without prompting")
|
|
53
|
+
.before(requireAuth_1.requireAuth)
|
|
54
|
+
.action(async (issueId, options) => {
|
|
55
|
+
const appId = (0, commandUtils_1.requireAppId)(options);
|
|
56
|
+
const trimmedIssueId = typeof issueId === "string" ? issueId.trim() : "";
|
|
57
|
+
if (!trimmedIssueId) {
|
|
58
|
+
throw new error_1.FirebaseError("Must specify '<issueId>'.", { exit: 1 });
|
|
59
|
+
}
|
|
60
|
+
const issue = await (0, issues_1.getIssue)(appId, trimmedIssueId);
|
|
61
|
+
if (!(await (0, commandUtils_1.writeOutputFileIfRequested)(issue, options))) {
|
|
62
|
+
logIssue(appId, issue);
|
|
63
|
+
}
|
|
64
|
+
return issue;
|
|
65
|
+
});
|
|
@@ -0,0 +1,267 @@
|
|
|
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
|
+
const MAX_SUBGROUPS_PER_GROUP = 100;
|
|
15
|
+
exports.REPORTS_REQUIRING_ISSUE_ID = [
|
|
16
|
+
"topVariants",
|
|
17
|
+
"topBrowsers",
|
|
18
|
+
"topCustomKeys",
|
|
19
|
+
];
|
|
20
|
+
const METRIC_COLUMNS = [
|
|
21
|
+
{ header: "Events", value: (m) => m.eventsCount, always: true },
|
|
22
|
+
{ header: "Impacted Users", value: (m) => m.impactedUsersCount, always: true },
|
|
23
|
+
{ header: "Impacted Sessions", value: (m) => m.impactedSessionsCount },
|
|
24
|
+
{ header: "Total Users", value: (m) => m.totalUsersCount },
|
|
25
|
+
{ header: "Total Sessions", value: (m) => m.totalSessionsCount },
|
|
26
|
+
{ header: "Crash-Free Users", value: (m) => m.crashFreeUsersPercentage, percent: true },
|
|
27
|
+
{ header: "Crash-Free Sessions", value: (m) => m.crashFreeSessionsPercentage, percent: true },
|
|
28
|
+
];
|
|
29
|
+
const DEVICE_CATEGORY_LABELS = {
|
|
30
|
+
CATEGORY_MOBILE: "Mobile",
|
|
31
|
+
CATEGORY_TABLET: "Tablet",
|
|
32
|
+
CATEGORY_DESKTOP: "Desktop",
|
|
33
|
+
CATEGORY_TV: "TV",
|
|
34
|
+
CATEGORY_WEARABLE: "Wearable",
|
|
35
|
+
CATEGORY_UNKNOWN: "Unknown",
|
|
36
|
+
CATEGORY_UNSPECIFIED: "Unspecified",
|
|
37
|
+
};
|
|
38
|
+
function truncate(value, max = MAX_CELL_LENGTH) {
|
|
39
|
+
if (!value) {
|
|
40
|
+
return "";
|
|
41
|
+
}
|
|
42
|
+
return value.length > max ? `${value.slice(0, max - 1)}…` : value;
|
|
43
|
+
}
|
|
44
|
+
function formatDeviceCategory(deviceType) {
|
|
45
|
+
if (!deviceType) {
|
|
46
|
+
return "";
|
|
47
|
+
}
|
|
48
|
+
const mapped = DEVICE_CATEGORY_LABELS[deviceType];
|
|
49
|
+
if (mapped) {
|
|
50
|
+
return mapped;
|
|
51
|
+
}
|
|
52
|
+
const normalized = deviceType.replace(/^CATEGORY_/i, "").toLowerCase();
|
|
53
|
+
return normalized ? `${normalized[0].toUpperCase()}${normalized.slice(1)}` : deviceType;
|
|
54
|
+
}
|
|
55
|
+
function isDeviceCategoryDimension(sampleGroups) {
|
|
56
|
+
return (sampleGroups.some((g) => g.operatingSystem?.deviceType) &&
|
|
57
|
+
!sampleGroups.some((g) => g.operatingSystem?.displayName || g.operatingSystem?.os));
|
|
58
|
+
}
|
|
59
|
+
function dimensionFor(sampleGroups) {
|
|
60
|
+
const group = sampleGroups[0];
|
|
61
|
+
if (group?.issue) {
|
|
62
|
+
const showErrorType = sampleGroups.some((g) => !!g.issue?.errorType);
|
|
63
|
+
return {
|
|
64
|
+
headers: ["Issue ID", "Title", ...(showErrorType ? ["Error Type"] : []), "Sample Event"],
|
|
65
|
+
cells: (g) => [
|
|
66
|
+
g.issue?.id || "",
|
|
67
|
+
truncate(g.issue?.title),
|
|
68
|
+
...(showErrorType ? [g.issue?.errorType || ""] : []),
|
|
69
|
+
(0, commandUtils_1.shortEventId)(g.issue?.sampleEvent),
|
|
70
|
+
],
|
|
71
|
+
hasSampleEvents: true,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (group?.variant) {
|
|
75
|
+
return {
|
|
76
|
+
headers: ["Variant ID", "Sample Event"],
|
|
77
|
+
cells: (g) => [g.variant?.id || "", (0, commandUtils_1.shortEventId)(g.variant?.sampleEvent)],
|
|
78
|
+
hasSampleEvents: true,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (group?.version) {
|
|
82
|
+
return {
|
|
83
|
+
headers: ["Version"],
|
|
84
|
+
cells: (g) => {
|
|
85
|
+
const label = g.version?.displayName || g.version?.displayVersion || "";
|
|
86
|
+
const tracks = (g.version?.tracks || []).map((t) => t.title).filter(Boolean);
|
|
87
|
+
return [tracks.length ? `${label} [${tracks.join(", ")}]` : label];
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (group?.operatingSystem) {
|
|
92
|
+
if (isDeviceCategoryDimension(sampleGroups)) {
|
|
93
|
+
return {
|
|
94
|
+
headers: ["Device Category"],
|
|
95
|
+
cells: (g) => [formatDeviceCategory(g.operatingSystem?.deviceType)],
|
|
96
|
+
noun: "category",
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
headers: ["Operating System"],
|
|
101
|
+
cells: (g) => [
|
|
102
|
+
g.operatingSystem?.displayName ||
|
|
103
|
+
g.operatingSystem?.os ||
|
|
104
|
+
g.operatingSystem?.type ||
|
|
105
|
+
formatDeviceCategory(g.operatingSystem?.deviceType),
|
|
106
|
+
],
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
if (group?.device) {
|
|
110
|
+
const hasMarketingName = sampleGroups.some((g) => g.device?.marketingName);
|
|
111
|
+
if (hasMarketingName) {
|
|
112
|
+
return {
|
|
113
|
+
headers: ["Device", "Marketing Name"],
|
|
114
|
+
cells: (g) => [
|
|
115
|
+
g.device?.displayName || g.device?.model || "-",
|
|
116
|
+
truncate(g.device?.marketingName) || "-",
|
|
117
|
+
],
|
|
118
|
+
noun: "devices",
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
headers: ["Device"],
|
|
123
|
+
cells: (g) => [g.device?.displayName || g.device?.model || ""],
|
|
124
|
+
noun: "devices",
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
if (group?.browser) {
|
|
128
|
+
return { headers: ["Browser"], cells: (g) => [g.browser?.displayName || ""] };
|
|
129
|
+
}
|
|
130
|
+
if (group?.customAttribute) {
|
|
131
|
+
return {
|
|
132
|
+
headers: ["Key", "Value"],
|
|
133
|
+
cells: (g) => [g.customAttribute?.key || "", truncate(g.customAttribute?.value)],
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
if (group?.webMetricsGroup) {
|
|
137
|
+
return { headers: ["Group"], cells: (g) => [g.webMetricsGroup?.id || ""] };
|
|
138
|
+
}
|
|
139
|
+
return { headers: [], cells: () => [] };
|
|
140
|
+
}
|
|
141
|
+
function formatMetric(column, metrics) {
|
|
142
|
+
const raw = metrics ? column.value(metrics) : undefined;
|
|
143
|
+
if (raw === undefined) {
|
|
144
|
+
return column.always ? "0" : "-";
|
|
145
|
+
}
|
|
146
|
+
return column.percent ? `${Number(raw).toFixed(2)}%` : String(raw);
|
|
147
|
+
}
|
|
148
|
+
function logReport(report, appId, limit) {
|
|
149
|
+
const groups = report.groups || [];
|
|
150
|
+
const parentDimension = dimensionFor(groups);
|
|
151
|
+
const allSubgroups = groups.flatMap((g) => g.subgroups || []);
|
|
152
|
+
const subgroupDimension = allSubgroups.length > 0 ? dimensionFor(allSubgroups) : undefined;
|
|
153
|
+
const shownSubgroups = groups.map((g) => (g.subgroups || []).slice(0, limit));
|
|
154
|
+
const renderedMetricGroups = subgroupDimension
|
|
155
|
+
? groups.flatMap((g, i) => (shownSubgroups[i].length ? shownSubgroups[i] : [g]))
|
|
156
|
+
: groups;
|
|
157
|
+
const metricColumns = METRIC_COLUMNS.filter((col) => col.always ||
|
|
158
|
+
renderedMetricGroups.some((g) => g.metrics?.[0] !== undefined && col.value(g.metrics[0]) !== undefined));
|
|
159
|
+
const table = new Table({
|
|
160
|
+
head: [
|
|
161
|
+
...parentDimension.headers,
|
|
162
|
+
...(subgroupDimension?.headers || []),
|
|
163
|
+
...metricColumns.map((c) => c.header),
|
|
164
|
+
],
|
|
165
|
+
style: { head: ["green"] },
|
|
166
|
+
});
|
|
167
|
+
const truncatedGroups = [];
|
|
168
|
+
for (const [i, group] of groups.entries()) {
|
|
169
|
+
const subgroups = shownSubgroups[i];
|
|
170
|
+
if (subgroupDimension && subgroups.length > 0) {
|
|
171
|
+
const parentCells = parentDimension.cells(group);
|
|
172
|
+
for (const subgroup of subgroups) {
|
|
173
|
+
table.push([
|
|
174
|
+
...parentCells,
|
|
175
|
+
...subgroupDimension.cells(subgroup),
|
|
176
|
+
...metricColumns.map((c) => formatMetric(c, subgroup.metrics?.[0])),
|
|
177
|
+
]);
|
|
178
|
+
}
|
|
179
|
+
const total = group.subgroups.length;
|
|
180
|
+
if (total > subgroups.length) {
|
|
181
|
+
const totalLabel = total >= MAX_SUBGROUPS_PER_GROUP ? `${total}+` : `${total}`;
|
|
182
|
+
truncatedGroups.push(`${parentCells[0]}: ${subgroups.length} of ${totalLabel}`);
|
|
183
|
+
}
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
const emptySubgroupCells = subgroupDimension ? subgroupDimension.headers.map(() => "-") : [];
|
|
187
|
+
table.push([
|
|
188
|
+
...parentDimension.cells(group),
|
|
189
|
+
...emptySubgroupCells,
|
|
190
|
+
...metricColumns.map((c) => formatMetric(c, group.metrics?.[0])),
|
|
191
|
+
]);
|
|
192
|
+
}
|
|
193
|
+
if (report.displayName) {
|
|
194
|
+
logger_1.logger.info(report.displayName);
|
|
195
|
+
}
|
|
196
|
+
logger_1.logger.info(table.toString());
|
|
197
|
+
const totalSize = Number(report.totalSize || 0);
|
|
198
|
+
if (totalSize > groups.length && limit < MAX_LIMIT) {
|
|
199
|
+
logger_1.logger.info(`Showing ${groups.length} of ${totalSize} groups. Use '--limit <number>' to show more (up to ${MAX_LIMIT}).`);
|
|
200
|
+
}
|
|
201
|
+
if (truncatedGroups.length > 0) {
|
|
202
|
+
const what = `${subgroupDimension?.noun || "rows"} per ${parentDimension.noun || "group"}`;
|
|
203
|
+
logger_1.logger.info(`Showing the top ${limit} ${what} (${truncatedGroups.join(", ")}). Use '--limit <number>' to show more (up to ${MAX_LIMIT}).`);
|
|
204
|
+
}
|
|
205
|
+
if (parentDimension.hasSampleEvents || subgroupDimension?.hasSampleEvents) {
|
|
206
|
+
logger_1.logger.info(`Run 'firebase crashlytics:events:get --app ${appId} <sampleEvent>' to inspect a sample event.`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
exports.command = (0, commandUtils_1.withEventFilterOptions)(new command_1.Command("crashlytics:reports:get <report>"))
|
|
210
|
+
.description("get a Crashlytics report, such as top issues or top versions")
|
|
211
|
+
.option("--app <appId>", "the Firebase App ID")
|
|
212
|
+
.option("-n, --limit <number>", `maximum number of groups to return (1-${MAX_LIMIT}, default: ${DEFAULT_LIMIT})`)
|
|
213
|
+
.option("-o, --output <path>", "write raw JSON output to a file")
|
|
214
|
+
.withForce("overwrite output file without prompting")
|
|
215
|
+
.help(`Gets a Crashlytics report: event, user, and session counts grouped by a dimension such as
|
|
216
|
+
issue, version, operating system, device, browser, or custom key.
|
|
217
|
+
|
|
218
|
+
Available reports differ between Android/Apple and web apps. Run
|
|
219
|
+
'firebase crashlytics:reports:list --app <appId>' to see the reports for your app.
|
|
220
|
+
|
|
221
|
+
--issue-id is required for the topVariants, topBrowsers, and topCustomKeys reports,
|
|
222
|
+
not supported for topIssues (use 'crashlytics:issues:get' instead), and optional for all other reports.
|
|
223
|
+
|
|
224
|
+
Examples:
|
|
225
|
+
firebase crashlytics:reports:get --app <appId> topIssues
|
|
226
|
+
firebase crashlytics:reports:get --app <appId> --limit 5 --error-types FATAL topIssues
|
|
227
|
+
firebase crashlytics:reports:get --app <appId> --issue-id <issueId> topVariants
|
|
228
|
+
firebase crashlytics:reports:get --app <appId> --start-time 2026-11-01T00:00:00Z appSummary`)
|
|
229
|
+
.before(requireAuth_1.requireAuth)
|
|
230
|
+
.action(async (reportName, options) => {
|
|
231
|
+
const appId = (0, commandUtils_1.requireAppId)(options);
|
|
232
|
+
const report = typeof reportName === "string" ? reportName.trim() : "";
|
|
233
|
+
if (!report) {
|
|
234
|
+
throw new error_1.FirebaseError(`Must specify '<report>'. Run 'firebase crashlytics:reports:list --app ${appId}' to see available reports.`, { exit: 1 });
|
|
235
|
+
}
|
|
236
|
+
const limit = (0, commandUtils_1.parsePositiveIntOption)(options.limit, "--limit", {
|
|
237
|
+
defaultValue: DEFAULT_LIMIT,
|
|
238
|
+
max: MAX_LIMIT,
|
|
239
|
+
});
|
|
240
|
+
const filter = (0, commandUtils_1.parseEventFilters)(options, appId);
|
|
241
|
+
if (exports.REPORTS_REQUIRING_ISSUE_ID.includes(report) && !filter?.issueId) {
|
|
242
|
+
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 });
|
|
243
|
+
}
|
|
244
|
+
if (report === "topIssues" && filter?.issueId) {
|
|
245
|
+
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 });
|
|
246
|
+
}
|
|
247
|
+
let response;
|
|
248
|
+
try {
|
|
249
|
+
response = await (0, reports_1.getReport)(report, appId, filter, limit);
|
|
250
|
+
}
|
|
251
|
+
catch (err) {
|
|
252
|
+
const message = (0, error_1.getErrMsg)(err);
|
|
253
|
+
if (message.startsWith("Invalid Crashlytics report")) {
|
|
254
|
+
throw new error_1.FirebaseError(`${message}\nRun 'firebase crashlytics:reports:list --app ${appId}' for report descriptions.`, { exit: 1, original: (0, error_1.getError)(err) });
|
|
255
|
+
}
|
|
256
|
+
throw err;
|
|
257
|
+
}
|
|
258
|
+
if (await (0, commandUtils_1.writeOutputFileIfRequested)(response, options)) {
|
|
259
|
+
return response;
|
|
260
|
+
}
|
|
261
|
+
if (!response.groups?.length) {
|
|
262
|
+
logger_1.logger.info(`No results for the '${report}' report with the given filters.`);
|
|
263
|
+
return response;
|
|
264
|
+
}
|
|
265
|
+
logReport(response, appId, limit);
|
|
266
|
+
return response;
|
|
267
|
+
});
|
|
@@ -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
|
+
});
|
|
@@ -5,6 +5,7 @@ const command_1 = require("../command");
|
|
|
5
5
|
const projectUtils_1 = require("../projectUtils");
|
|
6
6
|
const names = require("../dataconnect/names");
|
|
7
7
|
const client = require("../dataconnect/client");
|
|
8
|
+
const types_1 = require("../dataconnect/types");
|
|
8
9
|
const logger_1 = require("../logger");
|
|
9
10
|
const requirePermissions_1 = require("../requirePermissions");
|
|
10
11
|
const ensureApis_1 = require("../dataconnect/ensureApis");
|
|
@@ -33,12 +34,17 @@ exports.command = new command_1.Command("dataconnect:services:list")
|
|
|
33
34
|
});
|
|
34
35
|
const jsonOutput = { services: [] };
|
|
35
36
|
for (const service of services) {
|
|
36
|
-
const
|
|
37
|
+
const getSchemaFields = ["datasources", "updateTime"];
|
|
38
|
+
const schema = (await client.getSchema(service.name, types_1.MAIN_SCHEMA_ID, getSchemaFields)) ?? {
|
|
37
39
|
name: "",
|
|
38
40
|
datasources: [{}],
|
|
39
41
|
source: { files: [] },
|
|
40
42
|
};
|
|
41
|
-
const connectors = await client.listConnectors(service.name
|
|
43
|
+
const connectors = await client.listConnectors(service.name, [
|
|
44
|
+
"connectors.name",
|
|
45
|
+
"connectors.updateTime",
|
|
46
|
+
"nextPageToken",
|
|
47
|
+
]);
|
|
42
48
|
const serviceName = names.parseServiceName(service.name);
|
|
43
49
|
const postgresDatasource = schema?.datasources.find((d) => d.postgresql);
|
|
44
50
|
const instanceName = postgresDatasource?.postgresql?.cloudSql?.instance ?? "";
|
|
@@ -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(
|
|
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)) {
|
|
@@ -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");
|
|
@@ -42,7 +43,9 @@ exports.command = new command_1.Command("hosting:channel:open [channelId]")
|
|
|
42
43
|
}
|
|
43
44
|
(0, utils_1.logLabeledBullet)("hosting:channel", channel.url);
|
|
44
45
|
if (!options.nonInteractive) {
|
|
45
|
-
open(channel.url)
|
|
46
|
+
open(channel.url).catch((err) => {
|
|
47
|
+
logger_1.logger.debug(`Unable to open URL: ${(0, error_1.getErrMsg)(err)}`);
|
|
48
|
+
});
|
|
46
49
|
}
|
|
47
50
|
return { url: channel.url };
|
|
48
51
|
});
|
package/lib/commands/index.js
CHANGED
|
@@ -82,6 +82,16 @@ function load(client) {
|
|
|
82
82
|
client.crashlytics.heapdumps.enable = loadCommand("crashlytics-heapdumps-enable");
|
|
83
83
|
client.crashlytics.heapdumps.disable = loadCommand("crashlytics-heapdumps-disable");
|
|
84
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
|
+
}
|
|
85
95
|
client.database = {};
|
|
86
96
|
client.database.get = loadCommand("database-get");
|
|
87
97
|
client.database.import = loadCommand("database-import");
|
package/lib/commands/open.js
CHANGED
|
@@ -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
|
});
|
package/lib/commands/serve.js
CHANGED
|
@@ -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("===")
|
|
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 {
|
package/lib/commands/use.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
}
|