firebase-tools 15.34.1 → 15.34.2
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/commands/apps-android-sha-create.js +1 -1
- package/lib/commands/apps-android-sha-delete.js +1 -1
- package/lib/commands/apps-android-sha-list.js +1 -1
- package/lib/commands/index.js +2 -4
- package/lib/crashlytics/onboarding.js +7 -16
- package/lib/deploy/functions/release/fabricator.js +6 -3
- package/lib/emulator/downloadableEmulatorInfo.json +22 -22
- package/lib/emulator/firestoreEmulator.js +5 -0
- package/lib/emulator/functionsEmulator.js +22 -7
- package/lib/emulator/pubsubEmulator.js +64 -11
- package/lib/emulator/storage/rules/manager.js +31 -15
- package/lib/emulator/taskQueue.js +5 -4
- package/lib/experiments.js +0 -5
- package/lib/extensions/emulator/specHelper.js +0 -4
- package/lib/extensions/extensionsHelper.js +0 -49
- package/lib/extensions/runtimes/common.js +0 -12
- package/lib/extensions/updateHelper.js +2 -88
- package/lib/frameworks/angular/utils.js +3 -2
- package/lib/gcp/cloudlogging.js +0 -54
- package/lib/init/features/aitools/promptUpdater.js +3 -2
- package/lib/mcp/errors.js +1 -1
- package/lib/mcp/util/dataconnect/converter.js +0 -29
- package/lib/tsconfig.compile.tsbuildinfo +1 -1
- package/lib/tsconfig.publish.tsbuildinfo +1 -1
- package/package.json +9 -5
- package/lib/apphosting/repo.js +0 -243
|
@@ -1,59 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getExistingSourceOrigin = getExistingSourceOrigin;
|
|
4
|
-
exports.warningUpdateToOtherSource = warningUpdateToOtherSource;
|
|
5
3
|
exports.update = update;
|
|
6
|
-
exports.updateFromLocalSource = updateFromLocalSource;
|
|
7
|
-
exports.updateFromUrlSource = updateFromUrlSource;
|
|
8
4
|
exports.inferUpdateSource = inferUpdateSource;
|
|
9
|
-
const clc = require("colorette");
|
|
10
5
|
const semver = require("semver");
|
|
11
6
|
const error_1 = require("../error");
|
|
12
|
-
const logger_1 = require("../logger");
|
|
13
7
|
const extensionsApi = require("./extensionsApi");
|
|
14
8
|
const extensionsHelper_1 = require("./extensionsHelper");
|
|
15
|
-
const utils = require("../utils");
|
|
16
|
-
const displayExtensionInfo_1 = require("./displayExtensionInfo");
|
|
17
|
-
function invalidSourceErrMsgTemplate(instanceId, source) {
|
|
18
|
-
return `Unable to update from the source \`${clc.bold(source)}\`. To update this instance, you can either:\n
|
|
19
|
-
- Run \`${clc.bold("firebase ext:update " + instanceId)}\` to update from the published source.\n
|
|
20
|
-
- Check your directory path or URL, then run \`${clc.bold("firebase ext:update " + instanceId + " <otherSource>")}\` to update from a local directory or URL source.`;
|
|
21
|
-
}
|
|
22
|
-
async function getExistingSourceOrigin(projectId, instanceId) {
|
|
23
|
-
const instance = await extensionsApi.getInstance(projectId, instanceId);
|
|
24
|
-
return instance && instance.config.extensionRef
|
|
25
|
-
? extensionsHelper_1.SourceOrigin.PUBLISHED_EXTENSION
|
|
26
|
-
: extensionsHelper_1.SourceOrigin.LOCAL;
|
|
27
|
-
}
|
|
28
|
-
function showUpdateVersionInfo(instanceId, from, to, source) {
|
|
29
|
-
if (source) {
|
|
30
|
-
source = clc.bold(source);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
source = "version";
|
|
34
|
-
}
|
|
35
|
-
utils.logLabeledBullet(extensionsHelper_1.logPrefix, `Updating ${clc.bold(instanceId)} from version ${clc.bold(from)} to ${source} (${clc.bold(to)})`);
|
|
36
|
-
if (semver.lt(to, from)) {
|
|
37
|
-
utils.logLabeledWarning(extensionsHelper_1.logPrefix, "The version you are updating to is less than the current version for this extension. This extension may not be backwards compatible.");
|
|
38
|
-
}
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
function warningUpdateToOtherSource(sourceOrigin) {
|
|
42
|
-
let targetText;
|
|
43
|
-
if ([extensionsHelper_1.SourceOrigin.PUBLISHED_EXTENSION, extensionsHelper_1.SourceOrigin.PUBLISHED_EXTENSION_VERSION].includes(sourceOrigin)) {
|
|
44
|
-
targetText = "published extension";
|
|
45
|
-
}
|
|
46
|
-
else if (sourceOrigin === extensionsHelper_1.SourceOrigin.LOCAL) {
|
|
47
|
-
targetText = "local directory";
|
|
48
|
-
}
|
|
49
|
-
else if (sourceOrigin === extensionsHelper_1.SourceOrigin.URL) {
|
|
50
|
-
targetText = "URL";
|
|
51
|
-
}
|
|
52
|
-
const warning = `All the instance's resources and logic will be overwritten to use the source code and files from the ${targetText}.\n`;
|
|
53
|
-
logger_1.logger.info(warning);
|
|
54
|
-
}
|
|
55
9
|
async function update(updateOptions) {
|
|
56
|
-
const { projectId, instanceId,
|
|
10
|
+
const { projectId, instanceId, extRef, params, systemParams, canEmitEvents, allowedEventTypes, eventarcChannel, } = updateOptions;
|
|
57
11
|
if (extRef) {
|
|
58
12
|
return await extensionsApi.updateInstanceFromRegistry({
|
|
59
13
|
projectId,
|
|
@@ -66,47 +20,7 @@ async function update(updateOptions) {
|
|
|
66
20
|
eventarcChannel,
|
|
67
21
|
});
|
|
68
22
|
}
|
|
69
|
-
|
|
70
|
-
return await extensionsApi.updateInstance({
|
|
71
|
-
projectId,
|
|
72
|
-
instanceId,
|
|
73
|
-
extensionSource: source,
|
|
74
|
-
params,
|
|
75
|
-
systemParams,
|
|
76
|
-
canEmitEvents,
|
|
77
|
-
allowedEventTypes,
|
|
78
|
-
eventarcChannel,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
throw new error_1.FirebaseError(`Neither a source nor a version of the extension was supplied for ${instanceId}. Please make sure this is a valid extension and try again.`);
|
|
82
|
-
}
|
|
83
|
-
async function updateFromLocalSource(projectId, instanceId, localSource, existingSpec) {
|
|
84
|
-
await (0, displayExtensionInfo_1.displayExtensionVersionInfo)({ spec: existingSpec });
|
|
85
|
-
let source;
|
|
86
|
-
try {
|
|
87
|
-
source = await (0, extensionsHelper_1.createSourceFromLocation)(projectId, localSource);
|
|
88
|
-
}
|
|
89
|
-
catch (err) {
|
|
90
|
-
throw new error_1.FirebaseError(invalidSourceErrMsgTemplate(instanceId, localSource));
|
|
91
|
-
}
|
|
92
|
-
utils.logLabeledBullet(extensionsHelper_1.logPrefix, `${clc.bold("You are updating this extension instance to a local source.")}`);
|
|
93
|
-
showUpdateVersionInfo(instanceId, existingSpec.version, source.spec.version, localSource);
|
|
94
|
-
warningUpdateToOtherSource(extensionsHelper_1.SourceOrigin.LOCAL);
|
|
95
|
-
return source.name;
|
|
96
|
-
}
|
|
97
|
-
async function updateFromUrlSource(projectId, instanceId, urlSource, existingSpec) {
|
|
98
|
-
await (0, displayExtensionInfo_1.displayExtensionVersionInfo)({ spec: existingSpec });
|
|
99
|
-
let source;
|
|
100
|
-
try {
|
|
101
|
-
source = await (0, extensionsHelper_1.createSourceFromLocation)(projectId, urlSource);
|
|
102
|
-
}
|
|
103
|
-
catch (err) {
|
|
104
|
-
throw new error_1.FirebaseError(invalidSourceErrMsgTemplate(instanceId, urlSource));
|
|
105
|
-
}
|
|
106
|
-
utils.logLabeledBullet(extensionsHelper_1.logPrefix, `${clc.bold("You are updating this extension instance to a URL source.")}`);
|
|
107
|
-
showUpdateVersionInfo(instanceId, existingSpec.version, source.spec.version, urlSource);
|
|
108
|
-
warningUpdateToOtherSource(extensionsHelper_1.SourceOrigin.URL);
|
|
109
|
-
return source.name;
|
|
23
|
+
throw new error_1.FirebaseError(`A version of the extension was not supplied for ${instanceId}. Please make sure this is a valid extension and try again.`);
|
|
110
24
|
}
|
|
111
25
|
function inferUpdateSource(updateSource, existingRef) {
|
|
112
26
|
if (!updateSource) {
|
|
@@ -207,9 +207,10 @@ async function getContext(dir, targetOrConfiguration) {
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
if (deployTarget) {
|
|
210
|
+
const target = deployTarget;
|
|
210
211
|
const options = await architectHost
|
|
211
|
-
.getOptionsForTarget(
|
|
212
|
-
.catch(() => workspaceProject.targets.get(
|
|
212
|
+
.getOptionsForTarget(target)
|
|
213
|
+
.catch(() => workspaceProject.targets.get(target.target)?.options);
|
|
213
214
|
if (!options)
|
|
214
215
|
throw new error_1.FirebaseError("Unable to get options for ng-deploy.");
|
|
215
216
|
if (options.buildTarget) {
|
package/lib/gcp/cloudlogging.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.listEntries = listEntries;
|
|
4
|
-
exports.createOrUpdateLogBucket = createOrUpdateLogBucket;
|
|
5
|
-
exports.createOrUpdateLogSink = createOrUpdateLogSink;
|
|
6
4
|
const api_1 = require("../api");
|
|
7
5
|
const apiv2_1 = require("../apiv2");
|
|
8
6
|
const error_1 = require("../error");
|
|
@@ -31,55 +29,3 @@ async function listEntries(projectId, filter, pageSize, order, pageToken) {
|
|
|
31
29
|
});
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
|
-
async function createOrUpdateLogBucket(projectId, bucketId, location = "global", analyticsEnabled = true) {
|
|
35
|
-
const client = new apiv2_1.Client({ urlPrefix: (0, api_1.cloudloggingOrigin)(), apiVersion: API_VERSION });
|
|
36
|
-
const path = `/projects/${projectId}/locations/${location}/buckets`;
|
|
37
|
-
try {
|
|
38
|
-
const res = await client.post(`${path}?bucketId=${bucketId}`, { analyticsEnabled });
|
|
39
|
-
return res.body;
|
|
40
|
-
}
|
|
41
|
-
catch (err) {
|
|
42
|
-
if (err.status === 409) {
|
|
43
|
-
try {
|
|
44
|
-
const patchRes = await client.patch(`${path}/${bucketId}?updateMask=analyticsEnabled`, { analyticsEnabled });
|
|
45
|
-
return patchRes.body;
|
|
46
|
-
}
|
|
47
|
-
catch (patchErr) {
|
|
48
|
-
const msg = patchErr.message || JSON.stringify(patchErr.body) || patchErr;
|
|
49
|
-
throw new error_1.FirebaseError(`Failed to patch log bucket ${bucketId} (status ${patchErr.status}): ${msg}`, { original: patchErr });
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const msg = err.message || JSON.stringify(err.body) || err;
|
|
53
|
-
if (typeof msg === "string" && msg.toLowerCase().includes("billing account")) {
|
|
54
|
-
throw new error_1.FirebaseError(`Creating a Cloud Logging bucket requires a valid linked billing account (Blaze plan). Please attach a billing account to project ${projectId} and try again.`, { original: err });
|
|
55
|
-
}
|
|
56
|
-
throw new error_1.FirebaseError(`Failed to create or update log bucket ${bucketId} (status ${err.status}): ${msg}`, { original: err });
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
async function createOrUpdateLogSink(projectId, sinkName, destination, filter) {
|
|
60
|
-
const client = new apiv2_1.Client({ urlPrefix: (0, api_1.cloudloggingOrigin)(), apiVersion: API_VERSION });
|
|
61
|
-
const path = `/projects/${projectId}/sinks`;
|
|
62
|
-
const body = {
|
|
63
|
-
name: sinkName,
|
|
64
|
-
destination,
|
|
65
|
-
filter,
|
|
66
|
-
};
|
|
67
|
-
try {
|
|
68
|
-
const res = await client.post(path, body);
|
|
69
|
-
return res.body;
|
|
70
|
-
}
|
|
71
|
-
catch (err) {
|
|
72
|
-
if (err.status === 409) {
|
|
73
|
-
try {
|
|
74
|
-
const putRes = await client.put(`${path}/${sinkName}`, body);
|
|
75
|
-
return putRes.body;
|
|
76
|
-
}
|
|
77
|
-
catch (putErr) {
|
|
78
|
-
const msg = putErr.message || JSON.stringify(putErr.body) || putErr;
|
|
79
|
-
throw new error_1.FirebaseError(`Failed to update log sink ${sinkName} (status ${putErr.status}): ${msg}`, { original: putErr });
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
const msg = err.message || JSON.stringify(err.body) || err;
|
|
83
|
-
throw new error_1.FirebaseError(`Failed to create or update log sink ${sinkName} (status ${err.status}): ${msg}`, { original: err });
|
|
84
|
-
}
|
|
85
|
-
}
|
|
@@ -66,10 +66,11 @@ async function updateFirebaseSection(config, filePath, enabledFeatures, options)
|
|
|
66
66
|
finalContent = options?.header ? `${options.header}\n\n${newSection}` : newSection;
|
|
67
67
|
}
|
|
68
68
|
else if (match) {
|
|
69
|
+
const start = match.index;
|
|
69
70
|
finalContent =
|
|
70
|
-
currentContent.substring(0,
|
|
71
|
+
currentContent.substring(0, start) +
|
|
71
72
|
newSection +
|
|
72
|
-
currentContent.substring(
|
|
73
|
+
currentContent.substring(start + match[0].length);
|
|
73
74
|
}
|
|
74
75
|
else {
|
|
75
76
|
const separator = currentContent.endsWith("\n") ? "\n" : "\n\n";
|
package/lib/mcp/errors.js
CHANGED
|
@@ -6,7 +6,7 @@ exports.mcpAuthError = mcpAuthError;
|
|
|
6
6
|
const util_1 = require("./util");
|
|
7
7
|
exports.NO_PROJECT_ERROR = (0, util_1.mcpError)("To proceed requires an active project. Use the `firebase_update_environment` tool to set a project ID", "PRECONDITION_FAILED");
|
|
8
8
|
function noProjectDirectory(projectRoot) {
|
|
9
|
-
return (0, util_1.mcpError)(`The current project directory '${projectRoot || "<NO PROJECT DIRECTORY FOUND>"}' does not exist. Please use the '
|
|
9
|
+
return (0, util_1.mcpError)(`The current project directory '${projectRoot || "<NO PROJECT DIRECTORY FOUND>"}' does not exist. Please use the 'firebase_update_environment' tool to target a different project directory.`);
|
|
10
10
|
}
|
|
11
11
|
function mcpAuthError(skipADC) {
|
|
12
12
|
if (skipADC) {
|
|
@@ -1,38 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.schemaToText = schemaToText;
|
|
4
|
-
exports.connectorToText = connectorToText;
|
|
5
|
-
exports.sourceToText = sourceToText;
|
|
6
3
|
exports.graphqlResponseToToolResponse = graphqlResponseToToolResponse;
|
|
7
4
|
exports.parseVariables = parseVariables;
|
|
8
|
-
const js_yaml_1 = require("js-yaml");
|
|
9
5
|
const types_1 = require("../../../dataconnect/types");
|
|
10
6
|
const util_1 = require("../../util");
|
|
11
|
-
function schemaToText(s) {
|
|
12
|
-
return ((0, js_yaml_1.dump)({
|
|
13
|
-
name: s.name,
|
|
14
|
-
datasources: s.datasources,
|
|
15
|
-
}) +
|
|
16
|
-
"\n\n" +
|
|
17
|
-
sourceToText(s.source));
|
|
18
|
-
}
|
|
19
|
-
function connectorToText(s) {
|
|
20
|
-
return ((0, js_yaml_1.dump)({
|
|
21
|
-
name: s.name,
|
|
22
|
-
}) +
|
|
23
|
-
"\n\n" +
|
|
24
|
-
sourceToText(s.source));
|
|
25
|
-
}
|
|
26
|
-
function sourceToText(s) {
|
|
27
|
-
let output = "";
|
|
28
|
-
s.files?.forEach((f) => {
|
|
29
|
-
output += `\n# ${f.path}`;
|
|
30
|
-
output += "\n```graphql\n";
|
|
31
|
-
output += `${f.content.trim()}\n`;
|
|
32
|
-
output += "```\n";
|
|
33
|
-
});
|
|
34
|
-
return output;
|
|
35
|
-
}
|
|
36
7
|
function graphqlResponseToToolResponse(g) {
|
|
37
8
|
if ((0, types_1.isGraphQLResponse)(g)) {
|
|
38
9
|
const isError = g.errors?.length > 0;
|