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
package/lib/mcp/index.js
CHANGED
|
@@ -254,7 +254,8 @@ class FirebaseMcpServer {
|
|
|
254
254
|
return this.cliCommand;
|
|
255
255
|
}
|
|
256
256
|
async mcpListTools() {
|
|
257
|
-
await
|
|
257
|
+
await this.detectProjectRoot();
|
|
258
|
+
await this.detectActiveFeatures();
|
|
258
259
|
const hasActiveProject = !!(await this.getProjectId());
|
|
259
260
|
await this.trackGA4("mcp_list_tools");
|
|
260
261
|
const skipAutoAuthForStudio = (0, env_1.isFirebaseStudio)();
|
|
@@ -325,7 +326,8 @@ class FirebaseMcpServer {
|
|
|
325
326
|
}
|
|
326
327
|
}
|
|
327
328
|
async mcpListPrompts() {
|
|
328
|
-
await
|
|
329
|
+
await this.detectProjectRoot();
|
|
330
|
+
await this.detectActiveFeatures();
|
|
329
331
|
const hasActiveProject = !!(await this.getProjectId());
|
|
330
332
|
await this.trackGA4("mcp_list_prompts");
|
|
331
333
|
const skipAutoAuthForStudio = (0, env_1.isFirebaseStudio)();
|
|
@@ -493,12 +495,16 @@ class FirebaseMcpServer {
|
|
|
493
495
|
const message = this._pendingMessages.shift();
|
|
494
496
|
if (!message)
|
|
495
497
|
continue;
|
|
496
|
-
this.server
|
|
498
|
+
this.server
|
|
499
|
+
.sendLoggingMessage({
|
|
497
500
|
level: message.level,
|
|
498
501
|
data: message.data,
|
|
502
|
+
})
|
|
503
|
+
.catch(() => {
|
|
499
504
|
});
|
|
500
505
|
}
|
|
501
|
-
|
|
506
|
+
this.server.sendLoggingMessage({ level, data }).catch(() => {
|
|
507
|
+
});
|
|
502
508
|
}
|
|
503
509
|
else {
|
|
504
510
|
this._pendingMessages.push({ level, data });
|
|
@@ -70,7 +70,7 @@ exports.get_environment = (0, tool_1.tool)("core", {
|
|
|
70
70
|
const aliases = projectId ? (0, projectUtils_1.getAliases)({ rc }, projectId) : [];
|
|
71
71
|
const geminiTosAccepted = !!configstore_1.configstore.get("gemini");
|
|
72
72
|
const projectFileExists = config.projectFileExists("firebase.json");
|
|
73
|
-
const detectedApps = await (0, appUtils_1.detectApps)(process.cwd());
|
|
73
|
+
const detectedApps = await (0, appUtils_1.detectApps)(host.cachedProjectDir || process.cwd());
|
|
74
74
|
const allAccounts = (0, auth_1.getAllAccounts)().map((account) => account.user.email);
|
|
75
75
|
const detectedAppsMap = {};
|
|
76
76
|
detectedApps
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.batch_get_events = exports.list_events = void 0;
|
|
4
|
-
const js_yaml_1 = require("js-yaml");
|
|
5
4
|
const zod_1 = require("zod");
|
|
6
5
|
const events_1 = require("../../../crashlytics/events");
|
|
7
6
|
const filters_1 = require("../../../crashlytics/filters");
|
|
@@ -54,9 +53,8 @@ exports.list_events = (0, tool_1.tool)("crashlytics", {
|
|
|
54
53
|
return result;
|
|
55
54
|
}
|
|
56
55
|
const response = await (0, events_1.listEvents)(appId, filter, pageSize, filterExpression);
|
|
57
|
-
const eventsContent = response.events?.map((e) => (0, events_1.toText)(e)) || [];
|
|
58
56
|
return {
|
|
59
|
-
content: [{ type: "text", text: (0,
|
|
57
|
+
content: [{ type: "text", text: (0, events_1.toText)(response.events || []) }],
|
|
60
58
|
};
|
|
61
59
|
});
|
|
62
60
|
exports.batch_get_events = (0, tool_1.tool)("crashlytics", {
|
|
@@ -96,8 +94,7 @@ exports.batch_get_events = (0, tool_1.tool)("crashlytics", {
|
|
|
96
94
|
return result;
|
|
97
95
|
}
|
|
98
96
|
const response = await (0, events_1.batchGetEvents)(appId, names);
|
|
99
|
-
const eventsContent = response.events?.map((e) => (0, events_1.toText)(e)) || [];
|
|
100
97
|
return {
|
|
101
|
-
content: [{ type: "text", text: (0,
|
|
98
|
+
content: [{ type: "text", text: (0, events_1.toText)(response.events || []) }],
|
|
102
99
|
};
|
|
103
100
|
});
|
|
@@ -8,17 +8,8 @@ const tool_1 = require("../../tool");
|
|
|
8
8
|
const app_id_1 = require("../../resources/guides/app_id");
|
|
9
9
|
const DUMP_OPTIONS = { lineWidth: 200 };
|
|
10
10
|
function toText(response, filters) {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
filters: (0, js_yaml_1.dump)(filters, DUMP_OPTIONS),
|
|
14
|
-
};
|
|
15
|
-
for (const [key, value] of Object.entries(response)) {
|
|
16
|
-
if (key === "name") {
|
|
17
|
-
continue;
|
|
18
|
-
}
|
|
19
|
-
result[key] = (0, js_yaml_1.dump)(value, DUMP_OPTIONS);
|
|
20
|
-
}
|
|
21
|
-
return result;
|
|
11
|
+
const { name, ...rest } = response;
|
|
12
|
+
return (0, js_yaml_1.dump)({ name: name || "", filters, ...rest }, DUMP_OPTIONS);
|
|
22
13
|
}
|
|
23
14
|
exports.get_report = (0, tool_1.tool)("crashlytics", {
|
|
24
15
|
name: "get_report",
|
|
@@ -33,7 +24,7 @@ exports.get_report = (0, tool_1.tool)("crashlytics", {
|
|
|
33
24
|
_meta: {
|
|
34
25
|
requiresAuth: true,
|
|
35
26
|
},
|
|
36
|
-
}, async ({ appId, report, pageSize, filter, granularity }) => {
|
|
27
|
+
}, async ({ appId, report, pageSize, filter, filterExpression, granularity }) => {
|
|
37
28
|
const result = { content: [] };
|
|
38
29
|
if (!appId) {
|
|
39
30
|
result.isError = true;
|
|
@@ -52,7 +43,7 @@ exports.get_report = (0, tool_1.tool)("crashlytics", {
|
|
|
52
43
|
return result;
|
|
53
44
|
}
|
|
54
45
|
try {
|
|
55
|
-
const reportResponse = (0, reports_1.simplifyReport)(await (0, reports_1.getReport)(report, appId, filter, pageSize, granularity));
|
|
46
|
+
const reportResponse = (0, reports_1.simplifyReport)(await (0, reports_1.getReport)(report, appId, filter, pageSize, granularity, filterExpression));
|
|
56
47
|
reportResponse.usage =
|
|
57
48
|
reportResponse.groups && reportResponse.groups.length
|
|
58
49
|
? reportResponse.usage || ""
|
|
@@ -61,7 +52,7 @@ exports.get_report = (0, tool_1.tool)("crashlytics", {
|
|
|
61
52
|
content: [
|
|
62
53
|
{
|
|
63
54
|
type: "text",
|
|
64
|
-
text:
|
|
55
|
+
text: toText(reportResponse, filter),
|
|
65
56
|
},
|
|
66
57
|
],
|
|
67
58
|
};
|
|
@@ -5,11 +5,12 @@ const api_1 = require("../../../api");
|
|
|
5
5
|
const appUtils_1 = require("../../../appUtils");
|
|
6
6
|
const ensureApiEnabled_1 = require("../../../ensureApiEnabled");
|
|
7
7
|
const timeout_1 = require("../../../timeout");
|
|
8
|
+
const util_1 = require("../../util");
|
|
8
9
|
async function isAppTestingAvailable(ctx) {
|
|
9
10
|
const host = ctx.host;
|
|
10
|
-
const projectDir = ctx
|
|
11
|
+
const projectDir = (0, util_1.getProjectDir)(ctx);
|
|
11
12
|
const platforms = await (0, appUtils_1.getPlatformsFromFolder)(projectDir);
|
|
12
|
-
const supportedPlatforms = [appUtils_1.Platform.FLUTTER, appUtils_1.Platform.ANDROID, appUtils_1.Platform.IOS];
|
|
13
|
+
const supportedPlatforms = [appUtils_1.Platform.FLUTTER, appUtils_1.Platform.ANDROID, appUtils_1.Platform.IOS, appUtils_1.Platform.UNITY];
|
|
13
14
|
if (!platforms.some((p) => supportedPlatforms.includes(p))) {
|
|
14
15
|
host.logger.debug("Found no supported App Testing platforms.");
|
|
15
16
|
return false;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isCrashlyticsAvailable = isCrashlyticsAvailable;
|
|
4
|
+
const util_1 = require("../../util");
|
|
4
5
|
const appUtils_1 = require("../../../appUtils");
|
|
5
6
|
const fs = require("fs-extra");
|
|
6
7
|
const path = require("path");
|
|
@@ -9,13 +10,15 @@ async function isCrashlyticsAvailable(ctx) {
|
|
|
9
10
|
ctx.host.logger.debug("Looking for whether crashlytics is installed...");
|
|
10
11
|
return await isCrashlyticsInstalled(ctx);
|
|
11
12
|
}
|
|
13
|
+
const CRASHLYTICS_GRADLE_PATTERN = /(firebase-crashlytics|firebase\.crashlytics|com\.google\.firebase\.crashlytics)/;
|
|
12
14
|
async function isCrashlyticsInstalled(ctx) {
|
|
13
15
|
const host = ctx.host;
|
|
14
|
-
const projectDir = ctx
|
|
16
|
+
const projectDir = (0, util_1.getProjectDir)(ctx);
|
|
15
17
|
const platforms = await (0, appUtils_1.getPlatformsFromFolder)(projectDir);
|
|
16
18
|
if (!platforms.includes(appUtils_1.Platform.FLUTTER) &&
|
|
17
19
|
!platforms.includes(appUtils_1.Platform.ANDROID) &&
|
|
18
20
|
!platforms.includes(appUtils_1.Platform.IOS) &&
|
|
21
|
+
!platforms.includes(appUtils_1.Platform.UNITY) &&
|
|
19
22
|
!platforms.includes(appUtils_1.Platform.WEB)) {
|
|
20
23
|
host.logger.debug("Found no supported Crashlytics platforms.");
|
|
21
24
|
return false;
|
|
@@ -24,6 +27,10 @@ async function isCrashlyticsInstalled(ctx) {
|
|
|
24
27
|
host.logger.debug("Found Flutter app using Crashlytics");
|
|
25
28
|
return true;
|
|
26
29
|
}
|
|
30
|
+
if (platforms.includes(appUtils_1.Platform.UNITY) && (await unityAppUsesCrashlytics(projectDir))) {
|
|
31
|
+
host.logger.debug("Found Unity app using Crashlytics");
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
27
34
|
if (platforms.includes(appUtils_1.Platform.ANDROID) && (await androidAppUsesCrashlytics(projectDir))) {
|
|
28
35
|
host.logger.debug("Found Android app using Crashlytics");
|
|
29
36
|
return true;
|
|
@@ -42,11 +49,14 @@ async function isCrashlyticsInstalled(ctx) {
|
|
|
42
49
|
}
|
|
43
50
|
async function androidAppUsesCrashlytics(appPath) {
|
|
44
51
|
const buildGradleFiles = await (0, appUtils_1.detectFiles)(appPath, "build.gradle*");
|
|
45
|
-
const crashlyticsPattern = /(firebase-crashlytics|firebase\.crashlytics|com\.google\.firebase\.crashlytics)/;
|
|
46
52
|
for (const file of buildGradleFiles) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
try {
|
|
54
|
+
const content = await fs.readFile(path.join(appPath, file), "utf8");
|
|
55
|
+
if (CRASHLYTICS_GRADLE_PATTERN.test(content)) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
50
60
|
}
|
|
51
61
|
}
|
|
52
62
|
return false;
|
|
@@ -56,19 +66,56 @@ async function iosAppUsesCrashlytics(appPath) {
|
|
|
56
66
|
const fileArrays = await Promise.all(filePatternsToDetect.map((term) => (0, appUtils_1.detectFiles)(appPath, term)));
|
|
57
67
|
const files = fileArrays.flat();
|
|
58
68
|
for (const file of files) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
69
|
+
try {
|
|
70
|
+
const content = await fs.readFile(path.join(appPath, file), "utf8");
|
|
71
|
+
if (content.includes("Crashlytics")) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
62
76
|
}
|
|
63
77
|
}
|
|
64
78
|
return false;
|
|
65
79
|
}
|
|
66
80
|
async function flutterAppUsesCrashlytics(appPath) {
|
|
67
|
-
const pubspecFiles = await (0, appUtils_1.detectFiles)(appPath, "pubspec.yaml");
|
|
81
|
+
const pubspecFiles = await (0, appUtils_1.detectFiles)(appPath, "pubspec.{yaml,lock}");
|
|
68
82
|
for (const file of pubspecFiles) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
83
|
+
try {
|
|
84
|
+
const content = await fs.readFile(path.join(appPath, file), "utf8");
|
|
85
|
+
if (content.includes("firebase_crashlytics")) {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
async function unityAppUsesCrashlytics(appPath) {
|
|
95
|
+
const upmFiles = await (0, appUtils_1.detectFiles)(appPath, "Packages/{manifest.json,packages-lock.json}");
|
|
96
|
+
for (const file of upmFiles) {
|
|
97
|
+
try {
|
|
98
|
+
const content = await fs.readFile(path.join(appPath, file), "utf8");
|
|
99
|
+
if (content.includes("com.google.firebase.crashlytics")) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const sdkFiles = await (0, appUtils_1.detectFiles)(appPath, "{*CrashlyticsDependencies.xml,GoogleDependency*Crashlytics*.xml,Firebase.Crashlytics.dll,com.google.firebase.crashlytics*.tgz}");
|
|
107
|
+
if (sdkFiles.length > 0) {
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
const gradleFiles = await (0, appUtils_1.detectFiles)(appPath, "*.gradle*");
|
|
111
|
+
for (const file of gradleFiles) {
|
|
112
|
+
try {
|
|
113
|
+
const content = await fs.readFile(path.join(appPath, file), "utf8");
|
|
114
|
+
if (CRASHLYTICS_GRADLE_PATTERN.test(content)) {
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
72
119
|
}
|
|
73
120
|
}
|
|
74
121
|
return false;
|
|
@@ -23,7 +23,7 @@ function parseVariables(unparsedVariables) {
|
|
|
23
23
|
obj = JSON.parse(unparsedVariables || "{}");
|
|
24
24
|
}
|
|
25
25
|
catch (e) {
|
|
26
|
-
throw new Error(
|
|
26
|
+
throw new Error(`Provided variables string \`${String(unparsedVariables)}\` is not valid JSON.`);
|
|
27
27
|
}
|
|
28
28
|
if (typeof obj !== "object" || obj == null)
|
|
29
29
|
throw new Error("not an object");
|
package/lib/mcp/util.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProjectDir = getProjectDir;
|
|
3
4
|
exports.toContent = toContent;
|
|
4
5
|
exports.applyAppMeta = applyAppMeta;
|
|
5
6
|
exports.mcpError = mcpError;
|
|
@@ -10,6 +11,9 @@ const experiments = require("../experiments");
|
|
|
10
11
|
const api_1 = require("../api");
|
|
11
12
|
const ensureApiEnabled_1 = require("../ensureApiEnabled");
|
|
12
13
|
const timeout_1 = require("../timeout");
|
|
14
|
+
function getProjectDir(ctx) {
|
|
15
|
+
return (ctx.config.projectDir || ctx.host.cachedProjectDir || ctx.host.startupRoot || process.cwd());
|
|
16
|
+
}
|
|
13
17
|
function toContent(data, options) {
|
|
14
18
|
if (typeof data === "string")
|
|
15
19
|
return { content: [{ type: "text", text: data }] };
|
package/lib/profileReport.js
CHANGED
|
@@ -50,7 +50,7 @@ function formatNumber(num) {
|
|
|
50
50
|
function formatBytes(bytes) {
|
|
51
51
|
const threshold = 1000;
|
|
52
52
|
if (Math.round(bytes) < threshold) {
|
|
53
|
-
return bytes
|
|
53
|
+
return `${bytes} B`;
|
|
54
54
|
}
|
|
55
55
|
const units = ["kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
|
56
56
|
let u = -1;
|
package/lib/profiler.js
CHANGED
package/lib/requireAuth.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.authClientOptions = authClientOptions;
|
|
3
4
|
exports.refreshAuth = refreshAuth;
|
|
4
5
|
exports.requireAuth = requireAuth;
|
|
5
6
|
const google_auth_library_1 = require("google-auth-library");
|
|
@@ -16,21 +17,24 @@ const timeout_1 = require("./timeout");
|
|
|
16
17
|
const AUTH_ERROR_MESSAGE = `Command requires authentication, please run ${clc.bold("firebase login")}`;
|
|
17
18
|
let authClient;
|
|
18
19
|
let lastOptions;
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
const authConfig = {
|
|
20
|
+
function authClientOptions(config) {
|
|
21
|
+
const agent = apiv2.authTransporterAgent();
|
|
22
|
+
return {
|
|
24
23
|
...config,
|
|
25
24
|
clientOptions: {
|
|
26
25
|
...config.clientOptions,
|
|
27
26
|
transporterOptions: {
|
|
28
27
|
...config.clientOptions?.transporterOptions,
|
|
29
|
-
agent:
|
|
28
|
+
...(agent !== undefined ? { agent } : {}),
|
|
30
29
|
},
|
|
31
30
|
},
|
|
32
31
|
};
|
|
33
|
-
|
|
32
|
+
}
|
|
33
|
+
function getAuthClient(config) {
|
|
34
|
+
if (authClient) {
|
|
35
|
+
return authClient;
|
|
36
|
+
}
|
|
37
|
+
authClient = new google_auth_library_1.GoogleAuth(authClientOptions(config));
|
|
34
38
|
return authClient;
|
|
35
39
|
}
|
|
36
40
|
async function autoAuth(options, authScopes) {
|
package/lib/rulesDeploy.js
CHANGED