firebase-tools 15.32.0 → 15.33.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/accountImporter.js +6 -3
- package/lib/api.js +3 -3
- package/lib/apphosting/secrets/index.js +7 -2
- package/lib/command.js +1 -1
- package/lib/commands/apps-create.js +34 -3
- package/lib/commands/functions-kits-uninstall.js +43 -21
- package/lib/commands/functions-lifecycle-list.js +5 -6
- package/lib/commands/hosting-channel-deploy.js +3 -3
- package/lib/commands/hosting-clone.js +60 -29
- package/lib/commands/hosting-disable.js +5 -1
- package/lib/config.js +1 -0
- package/lib/crashlytics/alerts.js +122 -0
- package/lib/crashlytics/onboarding.js +71 -3
- package/lib/crashlytics/sourcemap.js +46 -11
- package/lib/crashlytics/types.js +6 -1
- package/lib/deploy/functions/build.js +3 -0
- package/lib/deploy/functions/cel.js +89 -58
- package/lib/deploy/functions/functionsDeployHelper.js +10 -0
- package/lib/deploy/functions/params.js +4 -2
- package/lib/deploy/functions/prepare.js +25 -8
- package/lib/deploy/functions/release/fabricator.js +1 -5
- package/lib/deploy/functions/release/planner.js +3 -2
- package/lib/deploy/functions/validate.js +16 -0
- package/lib/deploy/hosting/prepare.js +1 -1
- package/lib/deploy/hosting/release.js +2 -2
- package/lib/emulator/auth/operations.js +8 -4
- package/lib/emulator/databaseEmulator.js +7 -3
- package/lib/emulator/downloadableEmulatorInfo.json +24 -24
- package/lib/emulator/emulatorLogger.js +2 -1
- package/lib/emulator/functionsEmulatorRuntime.js +2 -1
- package/lib/experiments.js +17 -0
- package/lib/extensions/warnings.js +48 -7
- package/lib/frameworks/next/constants.js +20 -12
- package/lib/frameworks/next/index.js +4 -23
- package/lib/frameworks/next/utils.js +28 -0
- package/lib/functions/env.js +4 -2
- package/lib/gcp/artifactregistry.js +20 -0
- package/lib/gcp/cloudmonitoring.js +80 -3
- package/lib/gcp/cloudtasks.js +15 -1
- package/lib/gcp/cloudtrace.js +38 -0
- package/lib/gcp/run.js +5 -0
- package/lib/gcp/runv2.js +32 -11
- package/lib/hosting/api.js +15 -15
- package/lib/hosting/runTags.js +1 -1
- package/lib/init/features/auth.js +46 -8
- package/lib/init/features/hosting/index.js +4 -2
- package/lib/management/apps.js +4 -2
- package/lib/mcp/tools/firestore/converter.js +2 -2
- package/lib/mcp/util.js +11 -10
- package/lib/profileReport.js +4 -4
- package/lib/scopes.js +1 -3
- package/lib/streamJson.js +1 -0
- package/lib/tsconfig.compile.tsbuildinfo +1 -1
- package/lib/tsconfig.publish.tsbuildinfo +1 -1
- package/lib/utils.js +0 -15
- package/package.json +10 -9
- package/schema/firebase-config.json +41 -0
|
@@ -21,7 +21,7 @@ async function release(context, options, functionsPayload) {
|
|
|
21
21
|
config: await (0, convertConfig_1.convertConfig)(context, functionsPayload, deploy),
|
|
22
22
|
};
|
|
23
23
|
const versionId = utils.last(deploy.version.split("/"));
|
|
24
|
-
const finalizedVersion = await api.updateVersion(deploy.config.site, versionId, update);
|
|
24
|
+
const finalizedVersion = await api.updateVersion(context.projectId, deploy.config.site, versionId, update);
|
|
25
25
|
logger_1.logger.debug(`[hosting] finalized version for ${deploy.config.site}:${finalizedVersion}`);
|
|
26
26
|
utils.logLabeledSuccess(`hosting[${deploy.config.site}]`, "version finalized");
|
|
27
27
|
utils.logLabeledBullet(`hosting[${deploy.config.site}]`, "releasing new version...");
|
|
@@ -32,7 +32,7 @@ async function release(context, options, functionsPayload) {
|
|
|
32
32
|
if (options.message) {
|
|
33
33
|
otherReleaseOpts.message = options.message;
|
|
34
34
|
}
|
|
35
|
-
const release = await api.createRelease(deploy.config.site, context.hostingChannel || "live", deploy.version, otherReleaseOpts);
|
|
35
|
+
const release = await api.createRelease(context.projectId, deploy.config.site, context.hostingChannel || "live", deploy.version, otherReleaseOpts);
|
|
36
36
|
logger_1.logger.debug("[hosting] release:", release);
|
|
37
37
|
utils.logLabeledSuccess(`hosting[${deploy.config.site}]`, "release complete");
|
|
38
38
|
}));
|
|
@@ -660,7 +660,7 @@ function sendOobCode(state, reqBody, ctx) {
|
|
|
660
660
|
(0, errors_1.assert)(reqBody.email, "MISSING_EMAIL");
|
|
661
661
|
email = (0, utils_1.canonicalizeEmailAddress)(reqBody.email);
|
|
662
662
|
break;
|
|
663
|
-
case "PASSWORD_RESET":
|
|
663
|
+
case "PASSWORD_RESET": {
|
|
664
664
|
mode = "resetPassword";
|
|
665
665
|
(0, errors_1.assert)(reqBody.email, "MISSING_EMAIL");
|
|
666
666
|
email = (0, utils_1.canonicalizeEmailAddress)(reqBody.email);
|
|
@@ -673,6 +673,7 @@ function sendOobCode(state, reqBody, ctx) {
|
|
|
673
673
|
}
|
|
674
674
|
(0, errors_1.assert)(maybeUser, "EMAIL_NOT_FOUND");
|
|
675
675
|
break;
|
|
676
|
+
}
|
|
676
677
|
case "VERIFY_EMAIL":
|
|
677
678
|
mode = "verifyEmail";
|
|
678
679
|
if (reqBody.returnOobLink && !reqBody.idToken) {
|
|
@@ -798,7 +799,7 @@ function setAccountInfoImpl(state, reqBody, { privileged = false, emulatorUrl =
|
|
|
798
799
|
}
|
|
799
800
|
break;
|
|
800
801
|
}
|
|
801
|
-
case "VERIFY_AND_CHANGE_EMAIL":
|
|
802
|
+
case "VERIFY_AND_CHANGE_EMAIL": {
|
|
802
803
|
state.deleteOobCode(reqBody.oobCode);
|
|
803
804
|
const maybeUser = state.getUserByEmail(oob.email);
|
|
804
805
|
(0, errors_1.assert)(maybeUser, "INVALID_OOB_CODE");
|
|
@@ -811,6 +812,7 @@ function setAccountInfoImpl(state, reqBody, { privileged = false, emulatorUrl =
|
|
|
811
812
|
newEmail = oob.newEmail;
|
|
812
813
|
}
|
|
813
814
|
break;
|
|
815
|
+
}
|
|
814
816
|
case "RECOVER_EMAIL": {
|
|
815
817
|
state.deleteOobCode(reqBody.oobCode);
|
|
816
818
|
const maybeUser = state.getUserByInitialEmail(oob.email);
|
|
@@ -1954,12 +1956,13 @@ function fakeFetchUserInfoFromIdp(providerId, claims, samlResponse) {
|
|
|
1954
1956
|
});
|
|
1955
1957
|
break;
|
|
1956
1958
|
}
|
|
1957
|
-
case /^saml\./.exec(providerId)?.input:
|
|
1959
|
+
case /^saml\./.exec(providerId)?.input: {
|
|
1958
1960
|
const nameId = samlResponse?.assertion?.subject?.nameId;
|
|
1959
1961
|
response.email = nameId && (0, utils_1.isValidEmailAddress)(nameId) ? nameId : response.email;
|
|
1960
1962
|
response.emailVerified = true;
|
|
1961
1963
|
response.rawUserInfo = JSON.stringify(samlResponse?.assertion?.attributeStatements);
|
|
1962
1964
|
break;
|
|
1965
|
+
}
|
|
1963
1966
|
case /^oidc\./.exec(providerId)?.input:
|
|
1964
1967
|
default:
|
|
1965
1968
|
response.rawUserInfo = JSON.stringify(claims);
|
|
@@ -2256,11 +2259,12 @@ function processBlockingFunctionResponse(event, response) {
|
|
|
2256
2259
|
case "emailVerified":
|
|
2257
2260
|
updates[field] = !!userRecord[field];
|
|
2258
2261
|
break;
|
|
2259
|
-
case "customClaims":
|
|
2262
|
+
case "customClaims": {
|
|
2260
2263
|
const customClaims = JSON.stringify(userRecord.customClaims);
|
|
2261
2264
|
validateSerializedCustomClaims(customClaims);
|
|
2262
2265
|
updates.customAttributes = customClaims;
|
|
2263
2266
|
break;
|
|
2267
|
+
}
|
|
2264
2268
|
case "sessionClaims":
|
|
2265
2269
|
if (event !== state_1.BlockingFunctionEvents.BEFORE_SIGN_IN) {
|
|
2266
2270
|
break;
|
|
@@ -17,6 +17,7 @@ class DatabaseEmulator {
|
|
|
17
17
|
constructor(args) {
|
|
18
18
|
this.args = args;
|
|
19
19
|
this.importedNamespaces = [];
|
|
20
|
+
this.rulesWatchers = [];
|
|
20
21
|
this.logger = emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.DATABASE);
|
|
21
22
|
}
|
|
22
23
|
async start() {
|
|
@@ -32,8 +33,9 @@ class DatabaseEmulator {
|
|
|
32
33
|
this.logger.logLabeled("WARN_ONCE", "database", "Could not determine your Realtime Database instance name, so rules hot reloading is disabled.");
|
|
33
34
|
continue;
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
-
this.
|
|
36
|
+
const watcher = chokidar.watch(c.rules, { persistent: true, ignoreInitial: true });
|
|
37
|
+
this.rulesWatchers.push(watcher);
|
|
38
|
+
watcher.on("change", async () => {
|
|
37
39
|
await new Promise((res) => setTimeout(res, 5));
|
|
38
40
|
this.logger.logLabeled("BULLET", "database", `Change detected, updating rules for ${c.instance}...`);
|
|
39
41
|
try {
|
|
@@ -67,7 +69,9 @@ class DatabaseEmulator {
|
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
|
-
stop() {
|
|
72
|
+
async stop() {
|
|
73
|
+
await Promise.allSettled(this.rulesWatchers.map((w) => w.close()));
|
|
74
|
+
this.rulesWatchers = [];
|
|
71
75
|
return downloadableEmulators.stop(types_1.Emulators.DATABASE);
|
|
72
76
|
}
|
|
73
77
|
getInfo() {
|
|
@@ -54,36 +54,36 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dataconnect": {
|
|
56
56
|
"darwin": {
|
|
57
|
-
"version": "3.4.
|
|
58
|
-
"expectedSize":
|
|
59
|
-
"expectedChecksum": "
|
|
60
|
-
"expectedChecksumSHA256": "
|
|
61
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-amd64-v3.4.
|
|
62
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.
|
|
57
|
+
"version": "3.4.22",
|
|
58
|
+
"expectedSize": 33825952,
|
|
59
|
+
"expectedChecksum": "525d67a835615fae6dd2f0a2bfd4611c",
|
|
60
|
+
"expectedChecksumSHA256": "cb4e770c275e4b1202ecc5a05e5897636998ed7410f22c3fc594f4c17b0456b3",
|
|
61
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-amd64-v3.4.22",
|
|
62
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.22"
|
|
63
63
|
},
|
|
64
64
|
"darwin_arm64": {
|
|
65
|
-
"version": "3.4.
|
|
66
|
-
"expectedSize":
|
|
67
|
-
"expectedChecksum": "
|
|
68
|
-
"expectedChecksumSHA256": "
|
|
69
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-arm64-v3.4.
|
|
70
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.
|
|
65
|
+
"version": "3.4.22",
|
|
66
|
+
"expectedSize": 31935234,
|
|
67
|
+
"expectedChecksum": "f329037c0651536096e7233ead853857",
|
|
68
|
+
"expectedChecksumSHA256": "df4e0db2970d64e1176dda4875ca38ec4c20cc189bc80a758f462b638addda9c",
|
|
69
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-arm64-v3.4.22",
|
|
70
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.22"
|
|
71
71
|
},
|
|
72
72
|
"win32": {
|
|
73
|
-
"version": "3.4.
|
|
74
|
-
"expectedSize":
|
|
75
|
-
"expectedChecksum": "
|
|
76
|
-
"expectedChecksumSHA256": "
|
|
77
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-amd64-v3.4.
|
|
78
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.
|
|
73
|
+
"version": "3.4.22",
|
|
74
|
+
"expectedSize": 33855488,
|
|
75
|
+
"expectedChecksum": "7cdc7e6b54e22b61b2b6426df10bdd02",
|
|
76
|
+
"expectedChecksumSHA256": "05454f691c6b2259d2b838e715952105e89dd73184f5eac7dbfe131804f2dc26",
|
|
77
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-amd64-v3.4.22",
|
|
78
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.22.exe"
|
|
79
79
|
},
|
|
80
80
|
"linux": {
|
|
81
|
-
"version": "3.4.
|
|
82
|
-
"expectedSize":
|
|
83
|
-
"expectedChecksum": "
|
|
84
|
-
"expectedChecksumSHA256": "
|
|
85
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-amd64-v3.4.
|
|
86
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.
|
|
81
|
+
"version": "3.4.22",
|
|
82
|
+
"expectedSize": 32948408,
|
|
83
|
+
"expectedChecksum": "7ba899a01fc2819c3235b57c1badaf6e",
|
|
84
|
+
"expectedChecksumSHA256": "2a6eb1ccb8b5419cf22f3fdf87d94b6caf1c6c573115fdcd9baa7ea78274c024",
|
|
85
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-amd64-v3.4.22",
|
|
86
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.22"
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -181,7 +181,7 @@ You can probably fix this by running "npm install ${systemLog.data.name}@latest"
|
|
|
181
181
|
case "missing-package-json":
|
|
182
182
|
this.log("WARN", `The Cloud Functions directory you specified does not have a "package.json" file, so we can't load it.`);
|
|
183
183
|
break;
|
|
184
|
-
case "function-code-resolution-failed":
|
|
184
|
+
case "function-code-resolution-failed": {
|
|
185
185
|
this.log("WARN", systemLog.data.error);
|
|
186
186
|
const helper = ["We were unable to load your functions code. (see above)"];
|
|
187
187
|
if (systemLog.data.isPotentially.wrong_directory) {
|
|
@@ -195,6 +195,7 @@ You can probably fix this by running "npm install ${systemLog.data.name}@latest"
|
|
|
195
195
|
}
|
|
196
196
|
utils.logWarning(helper.join("\n"), "warn", this.data);
|
|
197
197
|
break;
|
|
198
|
+
}
|
|
198
199
|
case "function-runtimeconfig-json-invalid":
|
|
199
200
|
this.log("WARN", "Found .runtimeconfig.json but the JSON format is invalid.");
|
|
200
201
|
break;
|
|
@@ -575,7 +575,7 @@ async function main() {
|
|
|
575
575
|
}
|
|
576
576
|
switch (FUNCTION_SIGNATURE) {
|
|
577
577
|
case "event":
|
|
578
|
-
case "cloudevent":
|
|
578
|
+
case "cloudevent": {
|
|
579
579
|
let reqBody;
|
|
580
580
|
const rawBody = req.rawBody;
|
|
581
581
|
if (types_2.EventUtils.isBinaryCloudEvent(req)) {
|
|
@@ -588,6 +588,7 @@ async function main() {
|
|
|
588
588
|
await processBackground(trigger, reqBody, FUNCTION_SIGNATURE);
|
|
589
589
|
res.send({ status: "acknowledged" });
|
|
590
590
|
break;
|
|
591
|
+
}
|
|
591
592
|
case "http":
|
|
592
593
|
await runHTTPS(trigger, [req, res]);
|
|
593
594
|
}
|
package/lib/experiments.js
CHANGED
|
@@ -150,6 +150,13 @@ exports.ALL_EXPERIMENTS = experiments({
|
|
|
150
150
|
default: true,
|
|
151
151
|
public: true,
|
|
152
152
|
},
|
|
153
|
+
directcloudrun: {
|
|
154
|
+
shortDescription: "Build and deploy web apps directly to Cloud Run services",
|
|
155
|
+
fullDescription: "Enables `firebase init run`, `firebase deploy --only run`, and the " +
|
|
156
|
+
"`firebase run:services:update` command. " +
|
|
157
|
+
"These are in preview and may change.",
|
|
158
|
+
public: false,
|
|
159
|
+
},
|
|
153
160
|
dataconnect: {
|
|
154
161
|
shortDescription: "Deprecated. Previosuly, enabled SQL Connect related features.",
|
|
155
162
|
fullDescription: "Deprecated. Previously, enabled SQL Connect related features.",
|
|
@@ -206,6 +213,16 @@ exports.ALL_EXPERIMENTS = experiments({
|
|
|
206
213
|
default: false,
|
|
207
214
|
public: true,
|
|
208
215
|
},
|
|
216
|
+
crashlyticsWebAlerts: {
|
|
217
|
+
shortDescription: "Enable configuring Crashlytics email alerts during web app onboarding.",
|
|
218
|
+
default: false,
|
|
219
|
+
public: false,
|
|
220
|
+
},
|
|
221
|
+
crashlyticsWebTrace: {
|
|
222
|
+
shortDescription: "Enable provisioning Cloud Trace storage during web app onboarding.",
|
|
223
|
+
default: false,
|
|
224
|
+
public: false,
|
|
225
|
+
},
|
|
209
226
|
secretEnvParams: {
|
|
210
227
|
shortDescription: "Enable reading the backing resource binding for a Functions secret param from .env",
|
|
211
228
|
default: true,
|
|
@@ -12,6 +12,9 @@ const planner_1 = require("../deploy/extensions/planner");
|
|
|
12
12
|
const error_1 = require("../error");
|
|
13
13
|
const logger_1 = require("../logger");
|
|
14
14
|
const utils = require("../utils");
|
|
15
|
+
const replacementRegistry_1 = require("./replacementRegistry");
|
|
16
|
+
const manifest = require("./manifest");
|
|
17
|
+
const refs = require("./refs");
|
|
15
18
|
const toListEntry = (i) => {
|
|
16
19
|
const idAndRef = (0, deploymentSummary_1.humanReadable)(i);
|
|
17
20
|
const sourceCodeLink = `\n\t[Source Code](${i.extensionVersion?.buildSourceUri ?? i.extensionVersion?.sourceDownloadUri})`;
|
|
@@ -43,6 +46,7 @@ function outOfBandChangesWarning(instanceIds, isDynamic) {
|
|
|
43
46
|
`\nIf you proceed with this deployment, those changes will be overwritten.${extra}`);
|
|
44
47
|
}
|
|
45
48
|
const FAQ_URL = "https://firebase.google.com/docs/extensions/faq-and-troubleshooting";
|
|
49
|
+
const BANNER_BORDER = "=".repeat(80);
|
|
46
50
|
const WARN_BEFORE_COMMANDS = new Set([
|
|
47
51
|
"ext:install",
|
|
48
52
|
"ext:configure",
|
|
@@ -56,7 +60,7 @@ const WARN_STRONGLY_BEFORE_COMMANDS = new Set([
|
|
|
56
60
|
"ext:dev:usage",
|
|
57
61
|
"ext:dev:undeprecate",
|
|
58
62
|
]);
|
|
59
|
-
const WARN_AFTER_COMMANDS = new Set(["ext:list", "ext:info"]);
|
|
63
|
+
const WARN_AFTER_COMMANDS = new Set(["ext:list", "ext:info", "ext:export"]);
|
|
60
64
|
function isSilenced(options) {
|
|
61
65
|
const opts = options;
|
|
62
66
|
if (opts?.json ||
|
|
@@ -77,7 +81,23 @@ function isSilenced(options) {
|
|
|
77
81
|
}
|
|
78
82
|
return false;
|
|
79
83
|
}
|
|
80
|
-
function
|
|
84
|
+
function resolveExtensionRef(commandName, options, args = []) {
|
|
85
|
+
const firstArg = typeof args[0] === "string" ? args[0] : undefined;
|
|
86
|
+
if (!firstArg || (0, extensionsHelper_1.isLocalPath)(firstArg)) {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
const ref = commandName === "ext:configure" || commandName === "ext:update"
|
|
91
|
+
? manifest.getInstanceRef(firstArg, manifest.loadConfig(options))
|
|
92
|
+
: refs.parse(firstArg);
|
|
93
|
+
return refs.toExtensionRef(ref);
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
logger_1.logger.debug(`Could not resolve extension ref for deprecation warning: ${String(err)}`);
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
async function showDeprecationWarningBefore(commandName, options, args = []) {
|
|
81
101
|
if (commandName === "ext:dev:register") {
|
|
82
102
|
throw new error_1.FirebaseError(`ext:dev:register is disabled. Registering new publisher profile IDs is no longer supported.\n` +
|
|
83
103
|
`The Firebase Extensions service will shut down on March 31, 2027.\n` +
|
|
@@ -87,18 +107,39 @@ function showDeprecationWarningBefore(commandName, options) {
|
|
|
87
107
|
return;
|
|
88
108
|
}
|
|
89
109
|
if (WARN_BEFORE_COMMANDS.has(commandName)) {
|
|
90
|
-
|
|
110
|
+
let actionLine = "We recommend migrating active instances to function kits.";
|
|
111
|
+
const ref = resolveExtensionRef(commandName, options, args);
|
|
112
|
+
if (ref) {
|
|
113
|
+
try {
|
|
114
|
+
const registry = await (0, replacementRegistry_1.getReplacementsRegistry)();
|
|
115
|
+
const npmPackage = (0, replacementRegistry_1.getReplacementPackageName)(ref, registry);
|
|
116
|
+
if (npmPackage) {
|
|
117
|
+
actionLine = `Recommended replacement: ${npmPackage}`;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
logger_1.logger.debug(`Failed to resolve replacement info for warning: ${String(err)}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
logger_1.logger.warn(clc.yellow(`${BANNER_BORDER}\n` +
|
|
125
|
+
`⚠ Firebase Extensions will shut down on March 31, 2027.\n` +
|
|
126
|
+
`${actionLine}\n` +
|
|
127
|
+
`Learn more & view migration steps: ${FAQ_URL}\n` +
|
|
128
|
+
`${BANNER_BORDER}`));
|
|
91
129
|
}
|
|
92
130
|
else if (WARN_STRONGLY_BEFORE_COMMANDS.has(commandName)) {
|
|
93
|
-
logger_1.logger.warn(clc.yellow(
|
|
131
|
+
logger_1.logger.warn(clc.yellow(`${BANNER_BORDER}\n` +
|
|
94
132
|
`⚠ Notice for Publishers: Firebase Extensions will shut down on March 31, 2027.\n` +
|
|
95
|
-
`Learn more: ${FAQ_URL}\n` +
|
|
96
|
-
|
|
133
|
+
`Learn more & view migration steps: ${FAQ_URL}\n` +
|
|
134
|
+
`${BANNER_BORDER}`));
|
|
97
135
|
}
|
|
98
136
|
}
|
|
99
137
|
function showDeprecationWarningAfter(commandName, options) {
|
|
100
138
|
if (isSilenced(options) || !WARN_AFTER_COMMANDS.has(commandName)) {
|
|
101
139
|
return;
|
|
102
140
|
}
|
|
103
|
-
|
|
141
|
+
if (commandName === "ext:export" && options.mode === "functions") {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
logger_1.logger.warn(clc.yellow(`⚠ Notice: Firebase Extensions will shut down on March 31, 2027. Learn more & view migration steps: ${FAQ_URL}`));
|
|
104
145
|
}
|
|
@@ -23,34 +23,42 @@ const WEBPACK_LAYERS_NAMES = {
|
|
|
23
23
|
reactServerComponents: "rsc",
|
|
24
24
|
serverSideRendering: "ssr",
|
|
25
25
|
actionBrowser: "action-browser",
|
|
26
|
-
|
|
26
|
+
apiNode: "api-node",
|
|
27
|
+
apiEdge: "api-edge",
|
|
27
28
|
middleware: "middleware",
|
|
29
|
+
instrument: "instrument",
|
|
28
30
|
edgeAsset: "edge-asset",
|
|
29
31
|
appPagesBrowser: "app-pages-browser",
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
pagesDirBrowser: "pages-dir-browser",
|
|
33
|
+
pagesDirEdge: "pages-dir-edge",
|
|
34
|
+
pagesDirNode: "pages-dir-node",
|
|
32
35
|
};
|
|
33
36
|
exports.WEBPACK_LAYERS = {
|
|
34
37
|
...WEBPACK_LAYERS_NAMES,
|
|
35
38
|
GROUP: {
|
|
36
|
-
|
|
39
|
+
builtinReact: [WEBPACK_LAYERS_NAMES.reactServerComponents, WEBPACK_LAYERS_NAMES.actionBrowser],
|
|
40
|
+
serverOnly: [
|
|
37
41
|
WEBPACK_LAYERS_NAMES.reactServerComponents,
|
|
38
42
|
WEBPACK_LAYERS_NAMES.actionBrowser,
|
|
39
|
-
WEBPACK_LAYERS_NAMES.
|
|
40
|
-
WEBPACK_LAYERS_NAMES.appRouteHandler,
|
|
41
|
-
],
|
|
42
|
-
nonClientServerTarget: [
|
|
43
|
+
WEBPACK_LAYERS_NAMES.instrument,
|
|
43
44
|
WEBPACK_LAYERS_NAMES.middleware,
|
|
44
|
-
WEBPACK_LAYERS_NAMES.api,
|
|
45
45
|
],
|
|
46
|
-
|
|
46
|
+
neutralTarget: [WEBPACK_LAYERS_NAMES.apiNode, WEBPACK_LAYERS_NAMES.apiEdge],
|
|
47
|
+
clientOnly: [WEBPACK_LAYERS_NAMES.serverSideRendering, WEBPACK_LAYERS_NAMES.appPagesBrowser],
|
|
48
|
+
bundled: [
|
|
47
49
|
WEBPACK_LAYERS_NAMES.reactServerComponents,
|
|
48
50
|
WEBPACK_LAYERS_NAMES.actionBrowser,
|
|
49
|
-
WEBPACK_LAYERS_NAMES.appMetadataRoute,
|
|
50
|
-
WEBPACK_LAYERS_NAMES.appRouteHandler,
|
|
51
51
|
WEBPACK_LAYERS_NAMES.serverSideRendering,
|
|
52
52
|
WEBPACK_LAYERS_NAMES.appPagesBrowser,
|
|
53
53
|
WEBPACK_LAYERS_NAMES.shared,
|
|
54
|
+
WEBPACK_LAYERS_NAMES.instrument,
|
|
55
|
+
WEBPACK_LAYERS_NAMES.middleware,
|
|
56
|
+
],
|
|
57
|
+
appPages: [
|
|
58
|
+
WEBPACK_LAYERS_NAMES.reactServerComponents,
|
|
59
|
+
WEBPACK_LAYERS_NAMES.serverSideRendering,
|
|
60
|
+
WEBPACK_LAYERS_NAMES.appPagesBrowser,
|
|
61
|
+
WEBPACK_LAYERS_NAMES.actionBrowser,
|
|
54
62
|
],
|
|
55
63
|
},
|
|
56
64
|
};
|
|
@@ -16,7 +16,6 @@ const url_1 = require("url");
|
|
|
16
16
|
const semver_1 = require("semver");
|
|
17
17
|
const clc = require("colorette");
|
|
18
18
|
const fsutils_1 = require("../../fsutils");
|
|
19
|
-
const streamJson_1 = require("../../streamJson");
|
|
20
19
|
const prompt_1 = require("../../prompt");
|
|
21
20
|
const error_1 = require("../../error");
|
|
22
21
|
const utils_1 = require("../utils");
|
|
@@ -291,9 +290,12 @@ async function ɵcodegenPublicDirectory(sourceDir, destDir, _, context) {
|
|
|
291
290
|
{
|
|
292
291
|
srcRoute: null,
|
|
293
292
|
initialRevalidateSeconds: false,
|
|
293
|
+
initialExpireSeconds: undefined,
|
|
294
294
|
dataRoute: "",
|
|
295
295
|
experimentalPPR: false,
|
|
296
|
+
renderingMode: undefined,
|
|
296
297
|
prefetchDataRoute: "",
|
|
298
|
+
allowHeader: [],
|
|
297
299
|
},
|
|
298
300
|
];
|
|
299
301
|
}));
|
|
@@ -392,28 +394,7 @@ async function ɵcodegenFunctionsDirectory(sourceDir, destDir, target, context)
|
|
|
392
394
|
if (!esbuild) {
|
|
393
395
|
throw new error_1.FirebaseError(`Failed to load esbuild from path: ${esbuildPath}`);
|
|
394
396
|
}
|
|
395
|
-
const
|
|
396
|
-
const productionDeps = await new Promise((resolve) => {
|
|
397
|
-
const dependencies = [];
|
|
398
|
-
const npmLs = (0, cross_spawn_1.spawn)("npm", ["ls", "--omit=dev", "--all", "--json=true"], {
|
|
399
|
-
cwd: sourceDir,
|
|
400
|
-
timeout: constants_1.NPM_COMMAND_TIMEOUT_MILLIES,
|
|
401
|
-
});
|
|
402
|
-
const pipeline = chain([
|
|
403
|
-
npmLs.stdout,
|
|
404
|
-
parser({ packValues: false, packKeys: true, streamValues: false }),
|
|
405
|
-
pick({ filter: "dependencies" }),
|
|
406
|
-
streamObject(),
|
|
407
|
-
({ key, value }) => [
|
|
408
|
-
key,
|
|
409
|
-
...(0, utils_2.allDependencyNames)(value),
|
|
410
|
-
],
|
|
411
|
-
]);
|
|
412
|
-
pipeline.on("data", (it) => dependencies.push(it));
|
|
413
|
-
pipeline.on("end", () => {
|
|
414
|
-
resolve([...new Set(dependencies)]);
|
|
415
|
-
});
|
|
416
|
-
});
|
|
397
|
+
const productionDeps = await (0, utils_2.getProductionDependencyNames)(sourceDir);
|
|
417
398
|
const esbuildArgs = {
|
|
418
399
|
entryPoints: [(0, path_1.join)(sourceDir, configFile)],
|
|
419
400
|
outfile: (0, path_1.join)(destDir, configFile),
|
|
@@ -18,6 +18,7 @@ exports.isUsingNextImageInServerComponent = isUsingNextImageInServerComponent;
|
|
|
18
18
|
exports.isUsingNextImageInClientComponent = isUsingNextImageInClientComponent;
|
|
19
19
|
exports.isUsingAppDirectory = isUsingAppDirectory;
|
|
20
20
|
exports.allDependencyNames = allDependencyNames;
|
|
21
|
+
exports.getProductionDependencyNames = getProductionDependencyNames;
|
|
21
22
|
exports.getMiddlewareMatcherRegexes = getMiddlewareMatcherRegexes;
|
|
22
23
|
exports.getNonStaticRoutes = getNonStaticRoutes;
|
|
23
24
|
exports.getNonStaticServerComponents = getNonStaticServerComponents;
|
|
@@ -43,6 +44,9 @@ const utils_1 = require("../utils");
|
|
|
43
44
|
const constants_1 = require("./constants");
|
|
44
45
|
const fsutils_1 = require("../../fsutils");
|
|
45
46
|
const utils_2 = require("../../utils");
|
|
47
|
+
const cross_spawn_1 = require("cross-spawn");
|
|
48
|
+
const streamJson_1 = require("../../streamJson");
|
|
49
|
+
const constants_2 = require("../constants");
|
|
46
50
|
const child_process_1 = require("child_process");
|
|
47
51
|
const error_1 = require("../../error");
|
|
48
52
|
exports.I18N_SOURCE = /\/:nextInternalLocale(\([^\)]+\))?/;
|
|
@@ -175,6 +179,30 @@ function allDependencyNames(mod) {
|
|
|
175
179
|
const dependencyNames = Object.keys(mod.dependencies).reduce((acc, it) => [...acc, it, ...allDependencyNames(mod.dependencies[it])], []);
|
|
176
180
|
return dependencyNames;
|
|
177
181
|
}
|
|
182
|
+
async function getProductionDependencyNames(sourceDir) {
|
|
183
|
+
const { chain, many, parser, pick, streamObject } = await (0, streamJson_1.loadStreamJson)();
|
|
184
|
+
return new Promise((resolve, reject) => {
|
|
185
|
+
const dependencies = [];
|
|
186
|
+
const npmLs = (0, cross_spawn_1.spawn)("npm", ["ls", "--omit=dev", "--all", "--json=true"], {
|
|
187
|
+
cwd: sourceDir,
|
|
188
|
+
timeout: constants_2.NPM_COMMAND_TIMEOUT_MILLIES,
|
|
189
|
+
});
|
|
190
|
+
npmLs.on("error", reject);
|
|
191
|
+
if (!npmLs.stdout) {
|
|
192
|
+
return reject(new error_1.FirebaseError("Failed to capture npm ls output"));
|
|
193
|
+
}
|
|
194
|
+
const pipeline = chain([
|
|
195
|
+
npmLs.stdout,
|
|
196
|
+
parser({ packValues: false, packKeys: true, streamValues: false }),
|
|
197
|
+
pick({ filter: "dependencies" }),
|
|
198
|
+
streamObject(),
|
|
199
|
+
({ key, value }) => many([key, ...allDependencyNames(value)]),
|
|
200
|
+
]);
|
|
201
|
+
pipeline.on("data", (it) => dependencies.push(it));
|
|
202
|
+
pipeline.on("error", reject);
|
|
203
|
+
pipeline.on("end", () => resolve([...new Set(dependencies)]));
|
|
204
|
+
});
|
|
205
|
+
}
|
|
178
206
|
function getMiddlewareMatcherRegexes(middlewareManifest, functionsConfigManifest) {
|
|
179
207
|
const middlewareObjectValues = Object.values(middlewareManifest.middleware);
|
|
180
208
|
const middlewareMatchers = [];
|
package/lib/functions/env.js
CHANGED
|
@@ -240,9 +240,11 @@ function writeUserEnvs(toWrite, envOpts) {
|
|
|
240
240
|
}
|
|
241
241
|
function checkForDuplicateKeys(isEmulator, keys, fullEnv, envsWithoutLocal) {
|
|
242
242
|
for (const key of keys) {
|
|
243
|
-
const definedInEnv =
|
|
243
|
+
const definedInEnv = Object.prototype.hasOwnProperty.call(fullEnv, key);
|
|
244
244
|
if (definedInEnv) {
|
|
245
|
-
if (envsWithoutLocal &&
|
|
245
|
+
if (envsWithoutLocal &&
|
|
246
|
+
isEmulator &&
|
|
247
|
+
Object.prototype.hasOwnProperty.call(envsWithoutLocal, key)) {
|
|
246
248
|
(0, utils_1.logWarning)(clc.cyan(clc.yellow("functions: ")) +
|
|
247
249
|
`Writing parameter ${key} to emulator-specific config .env.local. This will overwrite your existing definition only when emulating.`);
|
|
248
250
|
continue;
|
|
@@ -5,11 +5,14 @@ exports.ensureApiEnabled = ensureApiEnabled;
|
|
|
5
5
|
exports.deletePackage = deletePackage;
|
|
6
6
|
exports.getRepository = getRepository;
|
|
7
7
|
exports.updateRepository = updateRepository;
|
|
8
|
+
exports.ensureDockerRepository = ensureDockerRepository;
|
|
8
9
|
const apiv2_1 = require("../apiv2");
|
|
9
10
|
const api_1 = require("../api");
|
|
10
11
|
const metaprogramming_1 = require("../metaprogramming");
|
|
11
12
|
const api = require("../ensureApiEnabled");
|
|
12
13
|
const proto = require("./proto");
|
|
14
|
+
const error_1 = require("../error");
|
|
15
|
+
const operation_poller_1 = require("../operation-poller");
|
|
13
16
|
exports.API_VERSION = "v1";
|
|
14
17
|
const client = new apiv2_1.Client({
|
|
15
18
|
urlPrefix: (0, api_1.artifactRegistryDomain)(),
|
|
@@ -39,3 +42,20 @@ async function updateRepository(repo) {
|
|
|
39
42
|
});
|
|
40
43
|
return res.body;
|
|
41
44
|
}
|
|
45
|
+
async function ensureDockerRepository(projectId, location, repositoryId) {
|
|
46
|
+
try {
|
|
47
|
+
await getRepository(`projects/${projectId}/locations/${location}/repositories/${repositoryId}`);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
if ((0, error_1.getErrStatus)(err) !== 404) {
|
|
52
|
+
throw err;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const res = await client.post(`/projects/${projectId}/locations/${location}/repositories`, { format: "DOCKER" }, { queryParams: { repositoryId } });
|
|
56
|
+
await (0, operation_poller_1.pollOperation)({
|
|
57
|
+
apiOrigin: (0, api_1.artifactRegistryDomain)(),
|
|
58
|
+
apiVersion: exports.API_VERSION,
|
|
59
|
+
operationResourceName: res.body.name,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ValueType = exports.Reducer = exports.MetricKind = exports.Aligner = exports.TimeSeriesView = exports.CLOUD_MONITORING_VERSION = void 0;
|
|
4
4
|
exports.queryTimeSeries = queryTimeSeries;
|
|
5
|
+
exports.listNotificationChannels = listNotificationChannels;
|
|
6
|
+
exports.createNotificationChannel = createNotificationChannel;
|
|
7
|
+
exports.getAlertPolicy = getAlertPolicy;
|
|
8
|
+
exports.updateAlertPolicy = updateAlertPolicy;
|
|
5
9
|
const api_1 = require("../api");
|
|
6
10
|
const apiv2_1 = require("../apiv2");
|
|
7
11
|
const error_1 = require("../error");
|
|
@@ -63,15 +67,88 @@ async function queryTimeSeries(query, project) {
|
|
|
63
67
|
urlPrefix: (0, api_1.cloudMonitoringOrigin)(),
|
|
64
68
|
apiVersion: exports.CLOUD_MONITORING_VERSION,
|
|
65
69
|
});
|
|
70
|
+
const queryParams = {};
|
|
71
|
+
for (const [key, value] of Object.entries(query)) {
|
|
72
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
73
|
+
queryParams[key] = value;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
66
76
|
try {
|
|
67
77
|
const res = await client.get(`/projects/${project}/timeSeries/`, {
|
|
68
|
-
queryParams
|
|
78
|
+
queryParams,
|
|
69
79
|
});
|
|
70
80
|
return res.body.timeSeries;
|
|
71
81
|
}
|
|
72
82
|
catch (err) {
|
|
73
|
-
throw new error_1.FirebaseError(`Failed to get Cloud Monitoring metric: ${err}`, {
|
|
74
|
-
status: err
|
|
83
|
+
throw new error_1.FirebaseError(`Failed to get Cloud Monitoring metric: ${(0, error_1.getErrMsg)(err)}`, {
|
|
84
|
+
status: (0, error_1.getErrStatus)(err),
|
|
85
|
+
original: (0, error_1.getError)(err),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async function listNotificationChannels(project, filter) {
|
|
90
|
+
const client = new apiv2_1.Client({
|
|
91
|
+
urlPrefix: (0, api_1.cloudMonitoringOrigin)(),
|
|
92
|
+
apiVersion: exports.CLOUD_MONITORING_VERSION,
|
|
93
|
+
});
|
|
94
|
+
try {
|
|
95
|
+
const res = await client.get(`/projects/${project}/notificationChannels`, filter ? { queryParams: { filter } } : {});
|
|
96
|
+
return res.body?.notificationChannels ?? [];
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
throw new error_1.FirebaseError(`Failed to list Cloud Monitoring notification channels: ${(0, error_1.getErrMsg)(err)}`, {
|
|
100
|
+
status: (0, error_1.getErrStatus)(err),
|
|
101
|
+
original: (0, error_1.getError)(err),
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async function createNotificationChannel(project, channel) {
|
|
106
|
+
const client = new apiv2_1.Client({
|
|
107
|
+
urlPrefix: (0, api_1.cloudMonitoringOrigin)(),
|
|
108
|
+
apiVersion: exports.CLOUD_MONITORING_VERSION,
|
|
109
|
+
});
|
|
110
|
+
try {
|
|
111
|
+
const res = await client.post(`/projects/${project}/notificationChannels`, channel);
|
|
112
|
+
return res.body;
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
throw new error_1.FirebaseError(`Failed to create Cloud Monitoring notification channel: ${(0, error_1.getErrMsg)(err)}`, {
|
|
116
|
+
status: (0, error_1.getErrStatus)(err),
|
|
117
|
+
original: (0, error_1.getError)(err),
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
async function getAlertPolicy(name) {
|
|
122
|
+
const client = new apiv2_1.Client({
|
|
123
|
+
urlPrefix: (0, api_1.cloudMonitoringOrigin)(),
|
|
124
|
+
apiVersion: exports.CLOUD_MONITORING_VERSION,
|
|
125
|
+
});
|
|
126
|
+
const path = name.startsWith("/") ? name : `/${name}`;
|
|
127
|
+
try {
|
|
128
|
+
const res = await client.get(path);
|
|
129
|
+
return res.body;
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
throw new error_1.FirebaseError(`Failed to get Cloud Monitoring alert policy ${name}: ${(0, error_1.getErrMsg)(err)}`, {
|
|
133
|
+
status: (0, error_1.getErrStatus)(err),
|
|
134
|
+
original: (0, error_1.getError)(err),
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async function updateAlertPolicy(policy, updateMask) {
|
|
139
|
+
const client = new apiv2_1.Client({
|
|
140
|
+
urlPrefix: (0, api_1.cloudMonitoringOrigin)(),
|
|
141
|
+
apiVersion: exports.CLOUD_MONITORING_VERSION,
|
|
142
|
+
});
|
|
143
|
+
const path = policy.name.startsWith("/") ? policy.name : `/${policy.name}`;
|
|
144
|
+
try {
|
|
145
|
+
const res = await client.patch(path, policy, updateMask ? { queryParams: { updateMask } } : {});
|
|
146
|
+
return res.body;
|
|
147
|
+
}
|
|
148
|
+
catch (err) {
|
|
149
|
+
throw new error_1.FirebaseError(`Failed to update Cloud Monitoring alert policy ${policy.name}: ${(0, error_1.getErrMsg)(err)}`, {
|
|
150
|
+
status: (0, error_1.getErrStatus)(err),
|
|
151
|
+
original: (0, error_1.getError)(err),
|
|
75
152
|
});
|
|
76
153
|
}
|
|
77
154
|
}
|