firebase-tools 15.36.0 → 15.37.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 +7 -6
- package/lib/apiv2.js +0 -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/crashlytics-events-get.js +48 -0
- package/lib/commands/crashlytics-events-list.js +70 -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 +61 -0
- package/lib/commands/crashlytics-reports-get.js +179 -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 +194 -0
- package/lib/crashlytics/events.js +8 -8
- 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 +21 -3
- 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/supported/index.js +10 -4
- package/lib/deploy/functions/runtimes/supported/types.js +7 -1
- package/lib/emulator/downloadableEmulatorInfo.json +31 -31
- package/lib/emulator/functionsEmulator.js +73 -1
- package/lib/emulator/functionsEmulatorRuntime.js +2 -2
- package/lib/experiments.js +5 -0
- package/lib/extensions/listExtensions.js +1 -1
- package/lib/firestore/delete.js +2 -3
- package/lib/frameworks/next/constants.js +17 -14
- package/lib/frameworks/next/index.js +25 -3
- 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/storage.js +87 -4
- package/lib/hosting/api.js +0 -7
- package/lib/hosting/implicitInit.js +1 -1
- package/lib/hosting/proxy.js +1 -1
- 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/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 +6 -2
- package/lib/mcp/tools/crashlytics/reports.js +2 -2
- package/lib/mcp/util/dataconnect/converter.js +1 -1
- package/lib/profileReport.js +1 -1
- package/lib/profiler.js +1 -1
- package/lib/rulesDeploy.js +0 -1
- package/lib/throttler/throttler.js +1 -1
- package/lib/tsconfig.compile.tsbuildinfo +1 -1
- package/lib/tsconfig.publish.tsbuildinfo +1 -1
- package/lib/utils.js +1 -1
- package/package.json +8 -7
- package/schema/firebase-config.json +3 -0
package/lib/accountExporter.js
CHANGED
|
@@ -187,7 +187,7 @@ async function serialExportUsers(projectId, options) {
|
|
|
187
187
|
const userList = ret.body.users;
|
|
188
188
|
if (userList && userList.length > 0) {
|
|
189
189
|
options.writeUsersToFile(userList, options.format, options.writeStream);
|
|
190
|
-
utils.logSuccess(
|
|
190
|
+
utils.logSuccess(`Exported ${String(userList.length)} account(s) successfully.`);
|
|
191
191
|
if (!ret.body.nextPageToken) {
|
|
192
192
|
return;
|
|
193
193
|
}
|
package/lib/accountImporter.js
CHANGED
|
@@ -178,6 +178,7 @@ function validateRequiredParameters(options) {
|
|
|
178
178
|
return { valid: true };
|
|
179
179
|
}
|
|
180
180
|
const hashAlgo = options.hashAlgo.toUpperCase();
|
|
181
|
+
const hashAlgoName = String(options.hashAlgo);
|
|
181
182
|
let roundsNum;
|
|
182
183
|
switch (hashAlgo) {
|
|
183
184
|
case "HMAC_SHA512":
|
|
@@ -185,7 +186,7 @@ function validateRequiredParameters(options) {
|
|
|
185
186
|
case "HMAC_SHA1":
|
|
186
187
|
case "HMAC_MD5":
|
|
187
188
|
if (!options.hashKey || options.hashKey === "") {
|
|
188
|
-
throw new error_1.FirebaseError("Must provide hash key(base64 encoded) for hash algorithm " +
|
|
189
|
+
throw new error_1.FirebaseError("Must provide hash key(base64 encoded) for hash algorithm " + hashAlgoName);
|
|
189
190
|
}
|
|
190
191
|
return { hashAlgo: hashAlgo, hashKey: options.hashKey, valid: true };
|
|
191
192
|
case "MD5":
|
|
@@ -203,20 +204,20 @@ function validateRequiredParameters(options) {
|
|
|
203
204
|
case "PBKDF2_SHA256":
|
|
204
205
|
roundsNum = parseInt(options.rounds, 10);
|
|
205
206
|
if (isNaN(roundsNum) || roundsNum < 0 || roundsNum > 120000) {
|
|
206
|
-
throw new error_1.FirebaseError("Must provide valid rounds(0..120000) for hash algorithm " +
|
|
207
|
+
throw new error_1.FirebaseError("Must provide valid rounds(0..120000) for hash algorithm " + hashAlgoName);
|
|
207
208
|
}
|
|
208
209
|
return { hashAlgo: hashAlgo, rounds: options.rounds, valid: true };
|
|
209
210
|
case "SCRYPT": {
|
|
210
211
|
if (!options.hashKey || options.hashKey === "") {
|
|
211
|
-
throw new error_1.FirebaseError("Must provide hash key(base64 encoded) for hash algorithm " +
|
|
212
|
+
throw new error_1.FirebaseError("Must provide hash key(base64 encoded) for hash algorithm " + hashAlgoName);
|
|
212
213
|
}
|
|
213
214
|
roundsNum = parseInt(options.rounds, 10);
|
|
214
215
|
if (isNaN(roundsNum) || roundsNum <= 0 || roundsNum > 8) {
|
|
215
|
-
throw new error_1.FirebaseError("Must provide valid rounds(1..8) for hash algorithm " +
|
|
216
|
+
throw new error_1.FirebaseError("Must provide valid rounds(1..8) for hash algorithm " + hashAlgoName);
|
|
216
217
|
}
|
|
217
218
|
const memCost = parseInt(options.memCost, 10);
|
|
218
219
|
if (isNaN(memCost) || memCost <= 0 || memCost > 14) {
|
|
219
|
-
throw new error_1.FirebaseError("Must provide valid memory cost(1..14) for hash algorithm " +
|
|
220
|
+
throw new error_1.FirebaseError("Must provide valid memory cost(1..14) for hash algorithm " + hashAlgoName);
|
|
220
221
|
}
|
|
221
222
|
let saltSeparator = "";
|
|
222
223
|
if (options.saltSeparator) {
|
|
@@ -294,7 +295,7 @@ function validateUserJson(userJson) {
|
|
|
294
295
|
return {};
|
|
295
296
|
}
|
|
296
297
|
async function sendRequest(projectId, userList, hashOptions) {
|
|
297
|
-
logger_1.logger.info(
|
|
298
|
+
logger_1.logger.info(`Starting importing ${userList.length} account(s).`);
|
|
298
299
|
const postData = genUploadAccountPostBody(projectId, userList, hashOptions);
|
|
299
300
|
return apiClient
|
|
300
301
|
.post("/identitytoolkit/v3/relyingparty/uploadAccount", postData, {
|
package/lib/apiv2.js
CHANGED
|
@@ -471,7 +471,6 @@ function isLocalInsecureRequest(urlPrefix) {
|
|
|
471
471
|
}
|
|
472
472
|
class UndiciResponseCompat {
|
|
473
473
|
constructor(undiciRes) {
|
|
474
|
-
this.undiciRes = undiciRes;
|
|
475
474
|
this.status = undiciRes.statusCode;
|
|
476
475
|
this.ok = undiciRes.statusCode >= 200 && undiciRes.statusCode < 300;
|
|
477
476
|
this.headers = new Headers();
|
|
@@ -126,7 +126,7 @@ function toTestCaseInvocation(testDef, targetUri, defaultConfig) {
|
|
|
126
126
|
testCase: {
|
|
127
127
|
id: testDef.id,
|
|
128
128
|
prerequisiteTestCaseId: testDef.prerequisiteTestCaseId,
|
|
129
|
-
startUri: targetUri
|
|
129
|
+
startUri: `${String(targetUri)}${String(route)}`,
|
|
130
130
|
displayName: testDef.displayName,
|
|
131
131
|
steps: steps.map((step) => (0, yaml_helper_1.fromYamlStep)(step)),
|
|
132
132
|
},
|
package/lib/auth.js
CHANGED
|
@@ -164,7 +164,7 @@ function setGlobalDefaultAccount(accountOrEmail) {
|
|
|
164
164
|
}
|
|
165
165
|
function open(url) {
|
|
166
166
|
opn(url).catch((err) => {
|
|
167
|
-
logger_1.logger.debug(
|
|
167
|
+
logger_1.logger.debug(`Unable to open URL: ${(0, error_1.getErrStack)(err)}`);
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
170
|
function invalidCredentialError() {
|
|
@@ -82,7 +82,7 @@ function setupProgressiveHelp(client) {
|
|
|
82
82
|
nsCmd.action(() => {
|
|
83
83
|
nsCmd.outputHelp();
|
|
84
84
|
logger_1.logger.info();
|
|
85
|
-
logger_1.logger.info(`To deploy ${targetName}, run: ${clc.bold(
|
|
85
|
+
logger_1.logger.info(`To deploy ${targetName}, run: ${clc.bold(`firebase deploy --only ${String(targetName)}`)}`);
|
|
86
86
|
logger_1.logger.info();
|
|
87
87
|
});
|
|
88
88
|
nsCmd.on("--help", () => {
|
package/lib/command.js
CHANGED
|
@@ -68,7 +68,6 @@ class Command {
|
|
|
68
68
|
return this;
|
|
69
69
|
}
|
|
70
70
|
register(client) {
|
|
71
|
-
this.client = client;
|
|
72
71
|
const program = client.cli;
|
|
73
72
|
const cmd = program.command(this.cmd);
|
|
74
73
|
if (this.descriptionText) {
|
|
@@ -298,7 +297,7 @@ function validateProjectId(project) {
|
|
|
298
297
|
if (PROJECT_ID_REGEX.test(project)) {
|
|
299
298
|
return;
|
|
300
299
|
}
|
|
301
|
-
(0, track_1.trackGA4)("error", {
|
|
300
|
+
void (0, track_1.trackGA4)("error", {
|
|
302
301
|
error_type: "Error (User)",
|
|
303
302
|
details: "Invalid project ID",
|
|
304
303
|
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const js_yaml_1 = require("js-yaml");
|
|
5
|
+
const command_1 = require("../command");
|
|
6
|
+
const commandUtils_1 = require("../crashlytics/commandUtils");
|
|
7
|
+
const events_1 = require("../crashlytics/events");
|
|
8
|
+
const error_1 = require("../error");
|
|
9
|
+
const logger_1 = require("../logger");
|
|
10
|
+
const requireAuth_1 = require("../requireAuth");
|
|
11
|
+
exports.command = new command_1.Command("crashlytics:events:get <eventIds...>")
|
|
12
|
+
.description("get one or more Crashlytics events by event ID or resource name")
|
|
13
|
+
.option("--app <appId>", "the Firebase App ID")
|
|
14
|
+
.option("--max-frames <number>", `maximum stack frames per thread or exception (default: ${events_1.DEFAULT_MAX_FRAMES}, ignored when --full is set)`)
|
|
15
|
+
.option("--full", "include all threads, stack frames, logs, and breadcrumbs without truncation")
|
|
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 (eventIds, options) => {
|
|
20
|
+
const appId = (0, commandUtils_1.requireAppId)(options);
|
|
21
|
+
const rawIds = Array.isArray(eventIds)
|
|
22
|
+
? eventIds.map((id) => String(id).trim()).filter(Boolean)
|
|
23
|
+
: [];
|
|
24
|
+
if (rawIds.length === 0) {
|
|
25
|
+
throw new error_1.FirebaseError("Must specify at least one '<eventId>'.", { exit: 1 });
|
|
26
|
+
}
|
|
27
|
+
if (rawIds.length > 100) {
|
|
28
|
+
throw new error_1.FirebaseError("Cannot request more than 100 events in a single call.", {
|
|
29
|
+
exit: 1,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const maxFrames = (0, commandUtils_1.parsePositiveIntOption)(options.maxFrames, "--max-frames", {
|
|
33
|
+
defaultValue: events_1.DEFAULT_MAX_FRAMES,
|
|
34
|
+
});
|
|
35
|
+
const resourceNames = rawIds.map((id) => (0, events_1.normalizeEventResourceName)(appId, id));
|
|
36
|
+
const response = await (0, events_1.batchGetEvents)(appId, resourceNames);
|
|
37
|
+
if (!(await (0, commandUtils_1.writeOutputFileIfRequested)(response, options))) {
|
|
38
|
+
const events = response.events || [];
|
|
39
|
+
if (events.length === 0) {
|
|
40
|
+
logger_1.logger.info("No matching events found.");
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
const formatted = events.map((e) => (0, events_1.toText)(e, { maxFrames, full: Boolean(options.full) }));
|
|
44
|
+
logger_1.logger.info((0, js_yaml_1.dump)(formatted, events_1.EVENT_DUMP_OPTIONS));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return response;
|
|
48
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const js_yaml_1 = require("js-yaml");
|
|
5
|
+
const command_1 = require("../command");
|
|
6
|
+
const commandUtils_1 = require("../crashlytics/commandUtils");
|
|
7
|
+
const events_1 = require("../crashlytics/events");
|
|
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
|
+
exports.command = (0, commandUtils_1.withEventFilterOptions)(new command_1.Command("crashlytics:events:list"))
|
|
14
|
+
.description("list the most recent Crashlytics events matching the given filters")
|
|
15
|
+
.option("--app <appId>", "the Firebase App ID")
|
|
16
|
+
.option("--filter <expression>", "AIP-160 filter expression for custom keys (e.g. 'custom_keys.env = \"prod\"')")
|
|
17
|
+
.option("-n, --limit <number>", `maximum number of events to return (1-${MAX_LIMIT}, default: ${DEFAULT_LIMIT})`)
|
|
18
|
+
.option("--max-frames <number>", `maximum stack frames per thread or exception (default: ${events_1.DEFAULT_MAX_FRAMES}, ignored when --full is set)`)
|
|
19
|
+
.option("--full", "include all threads, stack frames, logs, and breadcrumbs without truncation")
|
|
20
|
+
.option("-o, --output <path>", "write raw JSON output to a file")
|
|
21
|
+
.withForce("overwrite output file without prompting")
|
|
22
|
+
.help(`Lists the most recent Crashlytics events matching the specified filters.
|
|
23
|
+
Requires --issue-id. For Android/Apple apps, add --variant-id to narrow results to one issue variant.
|
|
24
|
+
|
|
25
|
+
Custom Key Filtering (--filter):
|
|
26
|
+
Filter events by Crashlytics custom keys using AIP-160 syntax:
|
|
27
|
+
- Exact match: --filter 'custom_keys.env = "prod"'
|
|
28
|
+
- Key presence: --filter 'custom_keys.experiment_id:*'
|
|
29
|
+
- Multiple keys: --filter 'custom_keys.env = "prod" AND custom_keys.role = "admin"'
|
|
30
|
+
- Multiple vals: --filter 'custom_keys.env = "prod" OR custom_keys.env = "staging"'
|
|
31
|
+
OR is only supported between values of the same key.`)
|
|
32
|
+
.before(requireAuth_1.requireAuth)
|
|
33
|
+
.action(async (options) => {
|
|
34
|
+
const appId = (0, commandUtils_1.requireAppId)(options);
|
|
35
|
+
const filter = (0, commandUtils_1.parseEventFilters)(options, appId);
|
|
36
|
+
if (!filter?.issueId) {
|
|
37
|
+
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 });
|
|
38
|
+
}
|
|
39
|
+
const limit = (0, commandUtils_1.parsePositiveIntOption)(options.limit, "--limit", {
|
|
40
|
+
defaultValue: DEFAULT_LIMIT,
|
|
41
|
+
max: MAX_LIMIT,
|
|
42
|
+
});
|
|
43
|
+
const maxFrames = (0, commandUtils_1.parsePositiveIntOption)(options.maxFrames, "--max-frames", {
|
|
44
|
+
defaultValue: events_1.DEFAULT_MAX_FRAMES,
|
|
45
|
+
});
|
|
46
|
+
const filterExpression = typeof options.filter === "string" ? options.filter.trim() || undefined : undefined;
|
|
47
|
+
let response;
|
|
48
|
+
try {
|
|
49
|
+
response = await (0, events_1.listEvents)(appId, filter, limit, filterExpression);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
const status = (0, error_1.getErrStatus)(err);
|
|
53
|
+
const message = (0, error_1.getErrMsg)(err);
|
|
54
|
+
if (filterExpression && (status === 400 || message.includes("INVALID_ARGUMENT"))) {
|
|
55
|
+
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) });
|
|
56
|
+
}
|
|
57
|
+
throw err;
|
|
58
|
+
}
|
|
59
|
+
if (!(await (0, commandUtils_1.writeOutputFileIfRequested)(response, options))) {
|
|
60
|
+
const events = response.events || [];
|
|
61
|
+
if (events.length === 0) {
|
|
62
|
+
logger_1.logger.info("No matching events found.");
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
const formatted = events.map((e) => (0, events_1.toText)(e, { maxFrames, full: Boolean(options.full) }));
|
|
66
|
+
logger_1.logger.info((0, js_yaml_1.dump)(formatted, events_1.EVENT_DUMP_OPTIONS));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return response;
|
|
70
|
+
});
|
|
@@ -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,61 @@
|
|
|
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(issue) {
|
|
12
|
+
const table = new Table({
|
|
13
|
+
head: ["Field", "Value"],
|
|
14
|
+
style: { head: ["green"] },
|
|
15
|
+
});
|
|
16
|
+
const rows = [
|
|
17
|
+
["Issue ID", issue.id],
|
|
18
|
+
["Title", issue.title],
|
|
19
|
+
["Subtitle", issue.subtitle],
|
|
20
|
+
["State", issue.state],
|
|
21
|
+
["Error Type", issue.errorType],
|
|
22
|
+
["First Seen Version", issue.firstSeenVersion],
|
|
23
|
+
["Last Seen Version", issue.lastSeenVersion],
|
|
24
|
+
["First Seen Time", issue.firstSeenTime],
|
|
25
|
+
["Last Seen Time", issue.lastSeenTime],
|
|
26
|
+
[
|
|
27
|
+
"Signals",
|
|
28
|
+
issue.signals
|
|
29
|
+
?.map((s) => s.signal)
|
|
30
|
+
.filter(Boolean)
|
|
31
|
+
.join(", "),
|
|
32
|
+
],
|
|
33
|
+
["Notes Count", issue.notesCount !== undefined ? String(issue.notesCount) : undefined],
|
|
34
|
+
["Sample Event", issue.sampleEvent],
|
|
35
|
+
["Console URI", issue.uri],
|
|
36
|
+
];
|
|
37
|
+
for (const [label, value] of rows) {
|
|
38
|
+
if (value !== undefined && value !== "") {
|
|
39
|
+
table.push([label, value]);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
logger_1.logger.info(table.toString());
|
|
43
|
+
}
|
|
44
|
+
exports.command = new command_1.Command("crashlytics:issues:get <issueId>")
|
|
45
|
+
.description("get details for a Crashlytics issue")
|
|
46
|
+
.option("--app <appId>", "the Firebase App ID")
|
|
47
|
+
.option("-o, --output <path>", "write raw JSON output to a file")
|
|
48
|
+
.withForce("overwrite output file without prompting")
|
|
49
|
+
.before(requireAuth_1.requireAuth)
|
|
50
|
+
.action(async (issueId, options) => {
|
|
51
|
+
const appId = (0, commandUtils_1.requireAppId)(options);
|
|
52
|
+
const trimmedIssueId = typeof issueId === "string" ? issueId.trim() : "";
|
|
53
|
+
if (!trimmedIssueId) {
|
|
54
|
+
throw new error_1.FirebaseError("Must specify '<issueId>'.", { exit: 1 });
|
|
55
|
+
}
|
|
56
|
+
const issue = await (0, issues_1.getIssue)(appId, trimmedIssueId);
|
|
57
|
+
if (!(await (0, commandUtils_1.writeOutputFileIfRequested)(issue, options))) {
|
|
58
|
+
logIssue(issue);
|
|
59
|
+
}
|
|
60
|
+
return issue;
|
|
61
|
+
});
|
|
@@ -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
|
+
});
|
|
@@ -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
|
});
|