firebase-tools-with-isolate 15.25.1 → 15.27.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/ailogic/templates.js +124 -0
- package/lib/api.js +6 -2
- package/lib/appcheck/api.js +52 -0
- package/lib/appcheck/providers.js +240 -0
- package/lib/appcheck/services.js +135 -0
- package/lib/auth.js +33 -15
- package/lib/checkValidTargetFilters.js +1 -0
- package/lib/command.js +4 -1
- package/lib/commands/ailogic-templates-delete.js +53 -0
- package/lib/commands/ailogic-templates-get.js +33 -0
- package/lib/commands/ailogic-templates-list.js +49 -0
- package/lib/commands/ailogic-templates-lock.js +30 -0
- package/lib/commands/ailogic-templates-unlock.js +30 -0
- package/lib/commands/appcheck-apps-list.js +78 -0
- package/lib/commands/appcheck-debugtokens-create.js +2 -2
- package/lib/commands/appcheck-debugtokens-delete.js +2 -2
- package/lib/commands/appcheck-debugtokens-list.js +2 -2
- package/lib/commands/appcheck-prompts.js +55 -0
- package/lib/commands/appcheck-providers-get.js +73 -0
- package/lib/commands/appcheck-providers-list.js +67 -0
- package/lib/commands/appcheck-providers-set.js +96 -0
- package/lib/commands/appcheck-services-get.js +40 -0
- package/lib/commands/appcheck-services-list.js +52 -0
- package/lib/commands/appcheck-services-set.js +90 -0
- package/lib/commands/crashlytics-onboard-web.js +56 -0
- package/lib/commands/deploy.js +3 -0
- package/lib/commands/ext-export.js +75 -3
- package/lib/commands/firestore-locations.js +3 -1
- package/lib/commands/functions-kits-install.js +294 -0
- package/lib/commands/index.js +24 -0
- package/lib/commands/login.js +53 -6
- package/lib/config.js +1 -0
- package/lib/crashlytics/filters.js +12 -4
- package/lib/crashlytics/firebasetelemetry.js +36 -0
- package/lib/crashlytics/onboarding.js +41 -0
- package/lib/crashlytics/reports.js +2 -0
- package/lib/crashlytics/sourcemap.js +102 -12
- package/lib/crashlytics/types.js +8 -1
- package/lib/deploy/ailogic/index.js +19 -0
- package/lib/deploy/ailogic/prepare.js +78 -0
- package/lib/deploy/ailogic/release.js +60 -0
- package/lib/deploy/functions/backend.js +11 -1
- package/lib/deploy/functions/build.js +1 -1
- package/lib/deploy/functions/params.js +5 -1
- package/lib/deploy/functions/prepare.js +26 -13
- package/lib/deploy/functions/prompts.js +1 -1
- package/lib/deploy/functions/release/lifecycle.js +11 -0
- package/lib/deploy/functions/release/planner.js +5 -2
- package/lib/deploy/index.js +9 -0
- package/lib/emulator/controller.js +1 -0
- package/lib/emulator/downloadableEmulatorInfo.json +24 -24
- package/lib/emulator/functionsEmulator.js +3 -1
- package/lib/experiments.js +13 -0
- package/lib/extensions/checkProjectBilling.js +3 -73
- package/lib/extensions/export.js +47 -0
- package/lib/functions/env.js +20 -7
- package/lib/functions/projectConfig.js +19 -11
- package/lib/functions/python.js +1 -1
- package/lib/gcp/ailogic.js +70 -1
- package/lib/gcp/cloudbilling.js +74 -0
- package/lib/gcp/cloudlogging.js +54 -0
- package/lib/gcp/runv2.js +1 -0
- package/lib/management/apps.js +1 -2
- package/lib/mcp/onemcp/index.js +2 -1
- package/lib/mcp/onemcp/onemcp_server.js +38 -11
- package/lib/mcp/prompts/crashlytics/connect.js +1 -1
- package/lib/mcp/resources/guides/crashlytics_issues.js +3 -3
- package/lib/mcp/resources/guides/crashlytics_reports.js +32 -11
- package/lib/mcp/tool.js +5 -0
- package/lib/mcp/tools/crashlytics/notes.js +3 -3
- package/lib/mcp/tools/crashlytics/reports.js +2 -0
- package/lib/mcp/util/crashlytics/availability.js +54 -1
- package/lib/prompt.js +10 -1
- package/lib/requirePermissions.js +1 -1
- package/lib/serve/functions.js +1 -1
- package/lib/tsconfig.publish.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/schema/firebase-config.json +42 -3
- package/templates/init/functions/typescript/index-kit-migration.ts +49 -0
- package/templates/init/functions/typescript/index-kit.ts +35 -0
- package/lib/appcheck/prompts.js +0 -41
package/lib/management/apps.js
CHANGED
|
@@ -547,8 +547,7 @@ async function findIntelligentPathForIOS(appDir, options) {
|
|
|
547
547
|
return outputPath;
|
|
548
548
|
}
|
|
549
549
|
async function findIntelligentPathForAndroid(appDir, options) {
|
|
550
|
-
|
|
551
|
-
if (paths[0] === "app") {
|
|
550
|
+
if (path.basename(appDir) === "app") {
|
|
552
551
|
return appDir;
|
|
553
552
|
}
|
|
554
553
|
else {
|
package/lib/mcp/onemcp/index.js
CHANGED
|
@@ -6,9 +6,10 @@ const onemcp_server_1 = require("./onemcp_server");
|
|
|
6
6
|
exports.ONEMCP_SERVERS = {
|
|
7
7
|
developerknowledge: new onemcp_server_1.OneMcpServer("developerknowledge", (0, api_1.developerKnowledgeOrigin)(), {
|
|
8
8
|
requiresAuth: true,
|
|
9
|
+
}, {
|
|
10
|
+
toolsToOptOutProjectRequirement: ["search_documents", "get_documents"],
|
|
9
11
|
}),
|
|
10
12
|
firestore: new onemcp_server_1.OneMcpServer("firestore", (0, api_1.firestoreOrigin)(), {
|
|
11
13
|
requiresAuth: true,
|
|
12
|
-
requiresProject: true,
|
|
13
14
|
}),
|
|
14
15
|
};
|
|
@@ -40,27 +40,53 @@ class OneMcpServer {
|
|
|
40
40
|
return (this.options.allowedTools.includes(mcpTool.name) ||
|
|
41
41
|
this.options.allowedTools.includes(`${this.feature}_${mcpTool.name}`));
|
|
42
42
|
});
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
const optOutSet = new Set(this.options.toolsToOptOutProjectRequirement || []);
|
|
44
|
+
return tools.map((mcpTool) => {
|
|
45
|
+
const isOptedOut = this.meta.requiresProject === false ||
|
|
46
|
+
optOutSet.has(mcpTool.name) ||
|
|
47
|
+
optOutSet.has(`${this.feature}_${mcpTool.name}`);
|
|
48
|
+
const toolRequiresProject = !isOptedOut;
|
|
49
|
+
return {
|
|
50
|
+
mcp: {
|
|
51
|
+
...mcpTool,
|
|
52
|
+
name: `${this.feature}_${mcpTool.name}`,
|
|
53
|
+
_meta: {
|
|
54
|
+
...this.meta,
|
|
55
|
+
requiresProject: toolRequiresProject,
|
|
56
|
+
feature: this.feature,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
fn: (args, ctx) => this.callTool(mcpTool.name, mcpTool.inputSchema, args, ctx),
|
|
60
|
+
isAvailable: () => Promise.resolve(true),
|
|
61
|
+
};
|
|
62
|
+
});
|
|
52
63
|
}
|
|
53
64
|
catch (error) {
|
|
54
65
|
throw new error_1.FirebaseError("Failed to fetch remote tools for " + this.serverUrl + ": " + JSON.stringify(error));
|
|
55
66
|
}
|
|
56
67
|
}
|
|
57
|
-
async callTool(toolName, args, ctx) {
|
|
68
|
+
async callTool(toolName, inputSchema, args, ctx) {
|
|
58
69
|
if (this.options.allowedTools?.length &&
|
|
59
70
|
!this.options.allowedTools.includes(toolName) &&
|
|
60
71
|
!this.options.allowedTools.includes(`${this.feature}_${toolName}`)) {
|
|
61
72
|
throw new error_1.FirebaseError(`Tool '${toolName}' is not allowed on remote server for feature '${this.feature}'.`);
|
|
62
73
|
}
|
|
63
|
-
|
|
74
|
+
const paramHeaders = {};
|
|
75
|
+
const props = inputSchema?.properties;
|
|
76
|
+
if (props && typeof props === "object" && args) {
|
|
77
|
+
for (const [paramName, propSchema] of Object.entries(props)) {
|
|
78
|
+
if (propSchema && typeof propSchema === "object" && "x-mcp-header" in propSchema) {
|
|
79
|
+
const headerName = propSchema["x-mcp-header"];
|
|
80
|
+
const argValue = args[paramName];
|
|
81
|
+
if (argValue !== undefined && argValue !== null) {
|
|
82
|
+
paramHeaders[`Mcp-Param-${headerName}`] = String(argValue);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (ctx.projectId) {
|
|
88
|
+
await (0, ensureApiEnabled_1.ensure)(ctx.projectId, this.serverUrl, this.feature, true);
|
|
89
|
+
}
|
|
64
90
|
try {
|
|
65
91
|
const res = await this.callClient.post("/mcp", {
|
|
66
92
|
method: "tools/call",
|
|
@@ -76,6 +102,7 @@ class OneMcpServer {
|
|
|
76
102
|
"Mcp-Method": "tools/call",
|
|
77
103
|
"Mcp-Name": toolName,
|
|
78
104
|
...(ctx.projectId ? { "x-goog-user-project": ctx.projectId } : {}),
|
|
105
|
+
...paramHeaders,
|
|
79
106
|
},
|
|
80
107
|
});
|
|
81
108
|
return types_js_1.CallToolResultSchema.parse(res.body.result);
|
|
@@ -24,7 +24,7 @@ exports.connect = (0, prompt_1.prompt)("crashlytics", {
|
|
|
24
24
|
content: {
|
|
25
25
|
type: "text",
|
|
26
26
|
text: `
|
|
27
|
-
You will assist developers in investigating and resolving mobile application issues by leveraging Firebase Crashlytics data.
|
|
27
|
+
You will assist developers in investigating and resolving mobile and web application issues by leveraging Firebase Crashlytics data.
|
|
28
28
|
|
|
29
29
|
### Required First Steps
|
|
30
30
|
|
|
@@ -18,14 +18,14 @@ Follow these steps to fetch issues and prioritize them.
|
|
|
18
18
|
|
|
19
19
|
1. Use the 'crashlytics_get_report' tool to fetch the 'topIssues' report.
|
|
20
20
|
1a. Analyze the user's query and apply the appropriate filters. Use the information in the [Firebase Crashlytics Reports Guide](firebase://guides/crashlytics/reports) to further construct appropriate report requests.
|
|
21
|
-
1b. If the user asks for crashes, then set the *issueErrorType* filter to *FATAL*.
|
|
21
|
+
1b. If the user asks for crashes and it is a mobile app, then set the *issueErrorType* filter to *FATAL*.
|
|
22
22
|
1c. If the user asks about a particular time range, then set both the *intervalStartTime* and *intervalEndTime*.
|
|
23
23
|
2. Use the 'crashlytics_get_report' tool to fetch the 'topVersions' for this app.
|
|
24
24
|
3. If the user instructions include statements about prioritization, use those instructions.
|
|
25
25
|
4. If the user instructions do not include statements about prioritization, then prioritize the returned issues using the following criteria:
|
|
26
26
|
4a. The app versions for the issue include the most recent version of the app.
|
|
27
27
|
4b. The number of users experiencing the issue across variants
|
|
28
|
-
4c. The volume of
|
|
28
|
+
4c. The volume of issues
|
|
29
29
|
5. Return the top 5 issues, with a brief description each in a numerical list with the recommended format.
|
|
30
30
|
5a. Describe the rationale for the prioritization order.
|
|
31
31
|
6. Ask the user if they would like to diagnose and fix any of the issues presented before taking any action.
|
|
@@ -34,7 +34,7 @@ exports.crashlytics_issues = (0, resource_1.resource)({
|
|
|
34
34
|
uri: "firebase://guides/crashlytics/issues",
|
|
35
35
|
name: "crashlytics_issues_guide",
|
|
36
36
|
title: "Firebase Crashlytics Issues Guide",
|
|
37
|
-
description: "Guides the coding agent when working with Crashlytics issues, including prioritization rules and procedures for diagnosing and fixing
|
|
37
|
+
description: "Guides the coding agent when working with Crashlytics issues, including prioritization rules and procedures for diagnosing and fixing issues. ",
|
|
38
38
|
}, async (uri) => {
|
|
39
39
|
return {
|
|
40
40
|
contents: [{ uri, type: "text", text: RESOURCE_CONTENT }],
|
|
@@ -14,14 +14,6 @@ The following reports are available for all Crashlytics applications.
|
|
|
14
14
|
Counts events and distinct impacted users, grouped by issue.
|
|
15
15
|
Issue groups are sorted by event count, in descending order.
|
|
16
16
|
|
|
17
|
-
- name: "topVariants"
|
|
18
|
-
display_name: "Top Variants"
|
|
19
|
-
usage: |
|
|
20
|
-
Counts events and distinct impacted users, grouped by issue variant.
|
|
21
|
-
Issue variant groups are sorted by event count, in descending order.
|
|
22
|
-
required: |
|
|
23
|
-
An issue filter including an issue id is required.
|
|
24
|
-
|
|
25
17
|
- name: "topVersions"
|
|
26
18
|
display_name: "Top Versions"
|
|
27
19
|
usage: |
|
|
@@ -34,7 +26,17 @@ The following reports are available for all Crashlytics applications.
|
|
|
34
26
|
Counts events, grouped by device operating systems and their versions.
|
|
35
27
|
Operating systems are sorted by event count, in descending order.
|
|
36
28
|
|
|
37
|
-
Mobile apps have
|
|
29
|
+
Mobile apps have the following report available:
|
|
30
|
+
|
|
31
|
+
- name: "topVariants"
|
|
32
|
+
display_name: "Top Variants"
|
|
33
|
+
usage: |
|
|
34
|
+
Counts events and distinct impacted users, grouped by issue variant.
|
|
35
|
+
Issue variant groups are sorted by event count, in descending order.
|
|
36
|
+
required: |
|
|
37
|
+
An issue filter including an issue id is required.
|
|
38
|
+
|
|
39
|
+
Mobile apps also have one of the following reports available, depending on the platform.
|
|
38
40
|
|
|
39
41
|
- name: "topAndroidDevices"
|
|
40
42
|
display_name: "Top Android Devices"
|
|
@@ -48,10 +50,27 @@ Mobile apps have one of the following reports available, depending on the platfo
|
|
|
48
50
|
Counts events, grouped by operating system and Apple device.
|
|
49
51
|
Devices are sorted by event count, in descending order.
|
|
50
52
|
|
|
53
|
+
Web apps have the following additional reports available.
|
|
54
|
+
|
|
55
|
+
- name: "topBrowsers"
|
|
56
|
+
display_name: "Top Browsers"
|
|
57
|
+
usage: |
|
|
58
|
+
Counts events, grouped by browser.
|
|
59
|
+
Browsers are sorted by event count, in descending order.
|
|
60
|
+
required: |
|
|
61
|
+
An issue filter including an issue id is required.
|
|
62
|
+
|
|
63
|
+
- name: "webMetrics"
|
|
64
|
+
display_name: "Web Metrics"
|
|
65
|
+
usage: |
|
|
66
|
+
Counts events and distinct impacted users, grouped by error type.
|
|
67
|
+
Error types are sorted by event count, in descending order.
|
|
68
|
+
|
|
51
69
|
Report responses contain the following metrics:
|
|
52
70
|
|
|
53
71
|
- eventsCount: the number of events matching
|
|
54
72
|
- impactedUsers: the number of distinct end users in all the matching events
|
|
73
|
+
- sessionsCount: the number of distinct sessions in all the matching events. Only available for web apps.
|
|
55
74
|
|
|
56
75
|
Report responses are always grouped by one of the following dimensions:
|
|
57
76
|
|
|
@@ -59,14 +78,16 @@ Report responses are always grouped by one of the following dimensions:
|
|
|
59
78
|
- issue
|
|
60
79
|
- variant
|
|
61
80
|
- operating system
|
|
62
|
-
- mobile device type
|
|
81
|
+
- mobile device type (mobile only)
|
|
82
|
+
- browser (web only)
|
|
83
|
+
- error type (web only)
|
|
63
84
|
|
|
64
85
|
### Filters
|
|
65
86
|
|
|
66
87
|
When setting report filters adhere to the following instructions.
|
|
67
88
|
|
|
68
89
|
* Issue Filtering:
|
|
69
|
-
*
|
|
90
|
+
* For mobile apps, use the \`issueErrorTypes\` field to focus on events of different fatalities:
|
|
70
91
|
* FATAL: native crashes, which caused the app to exit.
|
|
71
92
|
* NON_FATAL: uncaught or manually reported exceptions, which did not crash the app.
|
|
72
93
|
* ANR: "app not responding" events, only relevant on Android platforms.
|
package/lib/mcp/tool.js
CHANGED
|
@@ -10,6 +10,11 @@ function tool(feature, options, fn) {
|
|
|
10
10
|
mcp: {
|
|
11
11
|
...mcpOptions,
|
|
12
12
|
inputSchema: (0, util_1.cleanSchema)(zod_1.z.toJSONSchema(options.inputSchema, { target: "draft-7", io: "input" })),
|
|
13
|
+
...(options.outputSchema
|
|
14
|
+
? {
|
|
15
|
+
outputSchema: (0, util_1.cleanSchema)(zod_1.z.toJSONSchema(options.outputSchema, { target: "draft-7", io: "output" })),
|
|
16
|
+
}
|
|
17
|
+
: {}),
|
|
13
18
|
},
|
|
14
19
|
fn,
|
|
15
20
|
isAvailable: (ctx) => {
|
|
@@ -8,7 +8,7 @@ const filters_1 = require("../../../crashlytics/filters");
|
|
|
8
8
|
const util_1 = require("../../util");
|
|
9
9
|
exports.create_note = (0, tool_1.tool)("crashlytics", {
|
|
10
10
|
name: "create_note",
|
|
11
|
-
description: "Add a note to an issue from crashlytics.",
|
|
11
|
+
description: "Add a note to an issue from crashlytics. Only supported for mobile (Android and iOS) apps.",
|
|
12
12
|
inputSchema: zod_1.z.object({
|
|
13
13
|
appId: filters_1.ApplicationIdSchema,
|
|
14
14
|
issueId: filters_1.IssueIdSchema,
|
|
@@ -32,7 +32,7 @@ exports.create_note = (0, tool_1.tool)("crashlytics", {
|
|
|
32
32
|
});
|
|
33
33
|
exports.list_notes = (0, tool_1.tool)("crashlytics", {
|
|
34
34
|
name: "list_notes",
|
|
35
|
-
description: "Use this to list all notes for an issue in Crashlytics.",
|
|
35
|
+
description: "Use this to list all notes for an issue in Crashlytics. Only supported for mobile (Android and iOS) apps.",
|
|
36
36
|
inputSchema: zod_1.z.object({
|
|
37
37
|
appId: filters_1.ApplicationIdSchema,
|
|
38
38
|
issueId: filters_1.IssueIdSchema,
|
|
@@ -54,7 +54,7 @@ exports.list_notes = (0, tool_1.tool)("crashlytics", {
|
|
|
54
54
|
});
|
|
55
55
|
exports.delete_note = (0, tool_1.tool)("crashlytics", {
|
|
56
56
|
name: "delete_note",
|
|
57
|
-
description: "Delete a note from a Crashlytics issue.",
|
|
57
|
+
description: "Delete a note from a Crashlytics issue. Only supported for mobile (Android and iOS) apps.",
|
|
58
58
|
inputSchema: zod_1.z.object({
|
|
59
59
|
appId: filters_1.ApplicationIdSchema,
|
|
60
60
|
issueId: filters_1.IssueIdSchema,
|
|
@@ -15,6 +15,8 @@ Must specify the desired report:
|
|
|
15
15
|
* TOP_OPERATING_SYSTEMS - metrics grouped by *operating system*
|
|
16
16
|
* TOP_ANDROID_DEVICES - metrics grouped by *device*
|
|
17
17
|
* TOP_APPLE_DEVICES - metrics grouped by *device*
|
|
18
|
+
* TOP_BROWSERS - metrics grouped by *browser*
|
|
19
|
+
* WEB_METRICS - metrics by *error type*
|
|
18
20
|
`.trim();
|
|
19
21
|
function toText(response, filters) {
|
|
20
22
|
const result = {
|
|
@@ -4,6 +4,7 @@ exports.isCrashlyticsAvailable = isCrashlyticsAvailable;
|
|
|
4
4
|
const appUtils_1 = require("../../../appUtils");
|
|
5
5
|
const fs = require("fs-extra");
|
|
6
6
|
const path = require("path");
|
|
7
|
+
const apiv2_1 = require("../../../apiv2");
|
|
7
8
|
async function isCrashlyticsAvailable(ctx) {
|
|
8
9
|
ctx.host.logger.debug("Looking for whether crashlytics is installed...");
|
|
9
10
|
return await isCrashlyticsInstalled(ctx);
|
|
@@ -14,7 +15,8 @@ async function isCrashlyticsInstalled(ctx) {
|
|
|
14
15
|
const platforms = await (0, appUtils_1.getPlatformsFromFolder)(projectDir);
|
|
15
16
|
if (!platforms.includes(appUtils_1.Platform.FLUTTER) &&
|
|
16
17
|
!platforms.includes(appUtils_1.Platform.ANDROID) &&
|
|
17
|
-
!platforms.includes(appUtils_1.Platform.IOS)
|
|
18
|
+
!platforms.includes(appUtils_1.Platform.IOS) &&
|
|
19
|
+
!platforms.includes(appUtils_1.Platform.WEB)) {
|
|
18
20
|
host.logger.debug("Found no supported Crashlytics platforms.");
|
|
19
21
|
return false;
|
|
20
22
|
}
|
|
@@ -30,6 +32,11 @@ async function isCrashlyticsInstalled(ctx) {
|
|
|
30
32
|
host.logger.debug("Found iOS app using Crashlytics");
|
|
31
33
|
return true;
|
|
32
34
|
}
|
|
35
|
+
if (platforms.includes(appUtils_1.Platform.WEB) &&
|
|
36
|
+
(await webAppUsesCrashlytics(projectDir, ctx.projectId))) {
|
|
37
|
+
host.logger.debug("Found Web app using Crashlytics");
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
33
40
|
host.logger.debug(`Found supported platforms ${JSON.stringify(platforms)}, but did not find a Crashlytics dependency.`);
|
|
34
41
|
return false;
|
|
35
42
|
}
|
|
@@ -66,3 +73,49 @@ async function flutterAppUsesCrashlytics(appPath) {
|
|
|
66
73
|
}
|
|
67
74
|
return false;
|
|
68
75
|
}
|
|
76
|
+
async function webAppUsesCrashlytics(appPath, projectId) {
|
|
77
|
+
if (!projectId) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
const client = new apiv2_1.Client({
|
|
81
|
+
urlPrefix: "https://firebasetelemetryadmin.googleapis.com",
|
|
82
|
+
auth: true,
|
|
83
|
+
apiVersion: "v1alpha",
|
|
84
|
+
});
|
|
85
|
+
try {
|
|
86
|
+
const res = await client.get(`projects/${projectId}/locations/global/configs`);
|
|
87
|
+
const configs = res.body?.configs || [];
|
|
88
|
+
const appIdsInPath = await getAppIdsFromAppPath(appPath);
|
|
89
|
+
for (const config of configs) {
|
|
90
|
+
if (config.appId && appIdsInPath.has(config.appId)) {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
async function getAppIdsFromAppPath(appPath) {
|
|
100
|
+
const appIds = new Set();
|
|
101
|
+
try {
|
|
102
|
+
const files = await (0, appUtils_1.detectFiles)(appPath, "*");
|
|
103
|
+
const appIdRegex = /1:\d+:[a-z0-9_-]+:[a-z0-9_-]+/gi;
|
|
104
|
+
for (const file of files) {
|
|
105
|
+
try {
|
|
106
|
+
const content = await fs.readFile(path.join(appPath, file), "utf8");
|
|
107
|
+
const matches = content.match(appIdRegex);
|
|
108
|
+
if (matches) {
|
|
109
|
+
for (const match of matches) {
|
|
110
|
+
appIds.add(match);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
}
|
|
120
|
+
return appIds;
|
|
121
|
+
}
|
package/lib/prompt.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Separator = void 0;
|
|
4
|
+
exports.setNonInteractive = setNonInteractive;
|
|
5
|
+
exports.isNonInteractive = isNonInteractive;
|
|
4
6
|
exports.guard = guard;
|
|
5
7
|
exports.input = input;
|
|
6
8
|
exports.confirm = confirm;
|
|
@@ -13,8 +15,15 @@ const inquirer = require("@inquirer/prompts");
|
|
|
13
15
|
const error_1 = require("./error");
|
|
14
16
|
var prompts_1 = require("@inquirer/prompts");
|
|
15
17
|
Object.defineProperty(exports, "Separator", { enumerable: true, get: function () { return prompts_1.Separator; } });
|
|
18
|
+
let globalNonInteractive = false;
|
|
19
|
+
function setNonInteractive(value) {
|
|
20
|
+
globalNonInteractive = value;
|
|
21
|
+
}
|
|
22
|
+
function isNonInteractive() {
|
|
23
|
+
return globalNonInteractive;
|
|
24
|
+
}
|
|
16
25
|
function guard(opts) {
|
|
17
|
-
if (!opts.nonInteractive) {
|
|
26
|
+
if (!opts.nonInteractive && !isNonInteractive()) {
|
|
18
27
|
return { shouldReturn: false, value: undefined };
|
|
19
28
|
}
|
|
20
29
|
if (typeof opts.default !== "undefined") {
|
|
@@ -9,12 +9,12 @@ const error_1 = require("./error");
|
|
|
9
9
|
const iam_1 = require("./gcp/iam");
|
|
10
10
|
const BASE_PERMISSIONS = ["firebase.projects.get"];
|
|
11
11
|
async function requirePermissions(options, permissions = []) {
|
|
12
|
+
await (0, requireAuth_1.requireAuth)(options);
|
|
12
13
|
const projectId = (0, projectUtils_1.getProjectId)(options);
|
|
13
14
|
if (!projectId) {
|
|
14
15
|
return;
|
|
15
16
|
}
|
|
16
17
|
const requiredPermissions = BASE_PERMISSIONS.concat(permissions).sort();
|
|
17
|
-
await (0, requireAuth_1.requireAuth)(options);
|
|
18
18
|
logger_1.logger.debug(`[iam] checking project ${projectId} for permissions ${JSON.stringify(requiredPermissions)}`);
|
|
19
19
|
try {
|
|
20
20
|
const iamResult = await (0, iam_1.testIamPermissions)(projectId, requiredPermissions);
|
package/lib/serve/functions.js
CHANGED