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
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const clc = require("colorette");
|
|
5
|
+
const command_1 = require("../command");
|
|
6
|
+
const projectUtils_1 = require("../projectUtils");
|
|
7
|
+
const requireAuth_1 = require("../requireAuth");
|
|
8
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
9
|
+
const logger_1 = require("../logger");
|
|
10
|
+
const utils_1 = require("../utils");
|
|
11
|
+
const api_1 = require("../appcheck/api");
|
|
12
|
+
const providers_1 = require("../appcheck/providers");
|
|
13
|
+
const appcheck_prompts_1 = require("./appcheck-prompts");
|
|
14
|
+
exports.command = new command_1.Command("appcheck:providers:set <provider>")
|
|
15
|
+
.description("configure an App Check attestation provider for an app")
|
|
16
|
+
.help(`configures one attestation provider for one app.
|
|
17
|
+
|
|
18
|
+
<provider> is one of:
|
|
19
|
+
|
|
20
|
+
${(0, providers_1.providerHelp)()}
|
|
21
|
+
|
|
22
|
+
Flags per provider:
|
|
23
|
+
|
|
24
|
+
all --token-ttl <30m|1h|1d, between 30m and 7d>
|
|
25
|
+
device-check --key-id <id> --private-key <value or @file>
|
|
26
|
+
recaptcha-enterprise --site-key <key> --min-score <0.0-1.0>
|
|
27
|
+
recaptcha-v3 --site-secret <value or @file> --min-score <0.0-1.0>
|
|
28
|
+
play-integrity --min-device-integrity <${Object.keys(providers_1.DEVICE_INTEGRITY_LEVELS).join("|")}>
|
|
29
|
+
--[no-]require-licensed --[no-]allow-unrecognized-version
|
|
30
|
+
app-attest only --token-ttl
|
|
31
|
+
|
|
32
|
+
Secrets accept @path to read a file, so a private key does not end up in your shell history.
|
|
33
|
+
|
|
34
|
+
On iOS and Android, use \`recaptcha-enterprise\` for the reCAPTCHA attestation provider that the mobile SDKs added in June 2026 (Apple 12.15.0, Android firebase-appcheck-recaptcha 19.0.0). It is in public preview there and uses the same site key settings as the web provider.
|
|
35
|
+
|
|
36
|
+
This command changes how a token is checked, it does not turn enforcement on. Use \`appcheck:services:set\` for that.
|
|
37
|
+
|
|
38
|
+
For example:
|
|
39
|
+
|
|
40
|
+
\`firebase appcheck:providers:set device-check --app 1:123:ios:abc --key-id ABCD1234EF --private-key @AuthKey.p8\``)
|
|
41
|
+
.option("--app <appId>", "the app id of your Firebase app")
|
|
42
|
+
.option("--token-ttl <duration>", "how long App Check tokens stay valid, e.g. 30m, 1h, 1d")
|
|
43
|
+
.option("--key-id <keyId>", "device-check: the Apple key identifier")
|
|
44
|
+
.option("--private-key <value>", "device-check: the .p8 contents, or @path to the file")
|
|
45
|
+
.option("--site-key <siteKey>", "recaptcha-enterprise: the reCAPTCHA Enterprise site key")
|
|
46
|
+
.option("--site-secret <value>", "recaptcha-v3: the site secret, or @path to a file")
|
|
47
|
+
.option("--min-score <score>", "recaptcha: minimum score to accept, 0.0 to 1.0")
|
|
48
|
+
.option("--min-device-integrity <level>", `play-integrity: minimum device level (${Object.keys(providers_1.DEVICE_INTEGRITY_LEVELS).join(", ")})`)
|
|
49
|
+
.option("--require-licensed", "play-integrity: require the LICENSED account verdict")
|
|
50
|
+
.option("--no-require-licensed", "play-integrity: stop requiring the LICENSED verdict")
|
|
51
|
+
.option("--allow-unrecognized-version", "play-integrity: allow unrecognized app versions")
|
|
52
|
+
.option("--no-allow-unrecognized-version", "play-integrity: reject unrecognized app versions")
|
|
53
|
+
.before(requireAuth_1.requireAuth)
|
|
54
|
+
.before(requirePermissions_1.requirePermissions, [
|
|
55
|
+
"firebaseappcheck.appAttestConfig.update",
|
|
56
|
+
"firebaseappcheck.deviceCheckConfig.update",
|
|
57
|
+
"firebaseappcheck.playIntegrityConfig.update",
|
|
58
|
+
"firebaseappcheck.recaptchaEnterpriseConfig.update",
|
|
59
|
+
"firebaseappcheck.recaptchaV3Config.update",
|
|
60
|
+
])
|
|
61
|
+
.action(async (provider, options) => {
|
|
62
|
+
const providerType = (0, providers_1.parseProviderType)(provider);
|
|
63
|
+
const { update, updateMask } = (0, providers_1.buildProviderUpdate)(providerType, options);
|
|
64
|
+
const { appId, platform } = await (0, appcheck_prompts_1.getOrPromptApp)(options, `Select the app to configure ${providerType} for:`);
|
|
65
|
+
const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
|
|
66
|
+
(0, providers_1.assertProviderSupportsPlatform)(providerType, platform, appId);
|
|
67
|
+
const result = await (0, api_1.updateProviderConfig)(projectNumber, appId, providerType, update, updateMask);
|
|
68
|
+
(0, utils_1.logSuccess)(`Updated ${clc.bold(providerType)} for app ${clc.bold(appId)}.`);
|
|
69
|
+
if (result.keyId) {
|
|
70
|
+
logger_1.logger.info(` Key id: ${result.keyId}`);
|
|
71
|
+
}
|
|
72
|
+
if (result.privateKeySet) {
|
|
73
|
+
logger_1.logger.info(` Private key: set`);
|
|
74
|
+
}
|
|
75
|
+
if (result.siteKey) {
|
|
76
|
+
logger_1.logger.info(` Site key: ${result.siteKey}`);
|
|
77
|
+
}
|
|
78
|
+
if (result.siteSecretSet) {
|
|
79
|
+
logger_1.logger.info(` Site secret: set`);
|
|
80
|
+
}
|
|
81
|
+
const minScore = result.riskAnalysis?.minValidScore ?? result.minValidScore;
|
|
82
|
+
if (minScore !== undefined) {
|
|
83
|
+
logger_1.logger.info(` Min score: ${minScore}`);
|
|
84
|
+
}
|
|
85
|
+
if (result.deviceIntegrity?.minDeviceRecognitionLevel) {
|
|
86
|
+
logger_1.logger.info(` Min device: ${result.deviceIntegrity.minDeviceRecognitionLevel}`);
|
|
87
|
+
}
|
|
88
|
+
if (providerType === "play-integrity") {
|
|
89
|
+
const licensed = result.accountDetails?.requireLicensed ?? false;
|
|
90
|
+
const unrecognized = result.appIntegrity?.allowUnrecognizedVersion ?? false;
|
|
91
|
+
logger_1.logger.info(` Licensed: ${licensed ? "required" : "not required"}`);
|
|
92
|
+
logger_1.logger.info(` Unrecognized versions: ${unrecognized ? "allowed" : "not allowed"}`);
|
|
93
|
+
}
|
|
94
|
+
logger_1.logger.info(` Token TTL: ${(0, providers_1.formatTokenTtl)(result.tokenTtl)}`);
|
|
95
|
+
return result;
|
|
96
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const clc = require("colorette");
|
|
5
|
+
const command_1 = require("../command");
|
|
6
|
+
const projectUtils_1 = require("../projectUtils");
|
|
7
|
+
const requireAuth_1 = require("../requireAuth");
|
|
8
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
9
|
+
const logger_1 = require("../logger");
|
|
10
|
+
const utils_1 = require("../utils");
|
|
11
|
+
const api_1 = require("../appcheck/api");
|
|
12
|
+
const services_1 = require("../appcheck/services");
|
|
13
|
+
exports.command = new command_1.Command("appcheck:services:get <service>")
|
|
14
|
+
.description("show App Check enforcement for one service")
|
|
15
|
+
.help(`shows the App Check enforcement settings for one service.
|
|
16
|
+
|
|
17
|
+
<service> is one of:
|
|
18
|
+
|
|
19
|
+
${(0, services_1.serviceAliasHelp)()}
|
|
20
|
+
|
|
21
|
+
App Check also protects some Google services that are not Firebase products, such as the Maps JavaScript API and Google Identity for iOS. Those have no short name; pass their App Check service id if you need them.
|
|
22
|
+
|
|
23
|
+
For example:
|
|
24
|
+
|
|
25
|
+
\`firebase appcheck:services:get firestore\``)
|
|
26
|
+
.before(requireAuth_1.requireAuth)
|
|
27
|
+
.before(requirePermissions_1.requirePermissions, ["firebaseappcheck.services.get"])
|
|
28
|
+
.action(async (service, options) => {
|
|
29
|
+
const serviceId = (0, services_1.resolveServiceId)(service);
|
|
30
|
+
const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
|
|
31
|
+
const result = await (0, api_1.getService)(projectNumber, serviceId);
|
|
32
|
+
logger_1.logger.info(`Service: ${clc.bold((0, services_1.aliasForServiceId)(serviceId))} (${(0, services_1.displayNameForServiceId)(serviceId)})`);
|
|
33
|
+
logger_1.logger.info(`Enforcement: ${(0, services_1.formatEnforcementMode)(result.enforcementMode)}`);
|
|
34
|
+
logger_1.logger.info(`Replay protection: ${(0, services_1.formatEnforcementMode)(result.replayProtection)}`);
|
|
35
|
+
logger_1.logger.info(`Last updated: ${(0, services_1.formatUpdateTime)(result.updateTime)}`);
|
|
36
|
+
if ((0, services_1.isMandatoryFrom)(serviceId) && result.enforcementMode !== "ENFORCED") {
|
|
37
|
+
(0, utils_1.logWarning)(`Starting ${services_1.AI_LOGIC_ENFORCEMENT_DATE}, Firebase will automatically enforce App Check for all Gemini API requests via Firebase AI Logic, and App Check cannot be un-enforced for AI Logic. Implement App Check before this date to avoid service interruptions: ${services_1.AI_LOGIC_APP_CHECK_DOCS}`);
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const clc = require("colorette");
|
|
5
|
+
const Table = require("cli-table3");
|
|
6
|
+
const command_1 = require("../command");
|
|
7
|
+
const projectUtils_1 = require("../projectUtils");
|
|
8
|
+
const requireAuth_1 = require("../requireAuth");
|
|
9
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
10
|
+
const logger_1 = require("../logger");
|
|
11
|
+
const utils_1 = require("../utils");
|
|
12
|
+
const api_1 = require("../appcheck/api");
|
|
13
|
+
const services_1 = require("../appcheck/services");
|
|
14
|
+
exports.command = new command_1.Command("appcheck:services:list")
|
|
15
|
+
.description("list App Check enforcement for each service")
|
|
16
|
+
.help(`shows whether App Check is enforced for each service in the active project.
|
|
17
|
+
|
|
18
|
+
Enforcement can be:
|
|
19
|
+
|
|
20
|
+
Enforced requests without a valid App Check token are rejected
|
|
21
|
+
Unenforced requests are allowed, but counted in the App Check metrics
|
|
22
|
+
Off App Check is not applied
|
|
23
|
+
|
|
24
|
+
A service that was never configured also reads as off, with "never" in the Updated column.
|
|
25
|
+
|
|
26
|
+
Use \`appcheck:services:set <service> <mode>\` to change one.`)
|
|
27
|
+
.before(requireAuth_1.requireAuth)
|
|
28
|
+
.before(requirePermissions_1.requirePermissions, ["firebaseappcheck.services.get"])
|
|
29
|
+
.action(async (options) => {
|
|
30
|
+
const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
|
|
31
|
+
const services = await (0, utils_1.promiseWithSpinner)(() => (0, api_1.listServices)(projectNumber), "Reading App Check services");
|
|
32
|
+
const rows = (0, services_1.buildServiceRows)(services);
|
|
33
|
+
const table = new Table({
|
|
34
|
+
head: ["Service", "Service API", "Enforcement", "Replay Protection", "Updated"],
|
|
35
|
+
style: { head: ["green"] },
|
|
36
|
+
});
|
|
37
|
+
for (const row of rows) {
|
|
38
|
+
table.push([
|
|
39
|
+
clc.bold(row.alias),
|
|
40
|
+
(0, services_1.displayNameForServiceId)(row.serviceId),
|
|
41
|
+
(0, services_1.formatEnforcementMode)(row.enforcementMode ?? undefined),
|
|
42
|
+
(0, services_1.formatEnforcementMode)(row.replayProtection ?? undefined),
|
|
43
|
+
(0, services_1.formatUpdateTime)(row.updateTime ?? undefined),
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
logger_1.logger.info(table.toString());
|
|
47
|
+
const aiLogic = rows.find((row) => (0, services_1.isMandatoryFrom)(row.serviceId));
|
|
48
|
+
if (aiLogic && aiLogic.enforcementMode !== "ENFORCED") {
|
|
49
|
+
(0, utils_1.logWarning)(`App Check is not enforced for ${aiLogic.alias}. Starting ${services_1.AI_LOGIC_ENFORCEMENT_DATE}, Firebase will automatically enforce App Check for all Gemini API requests via Firebase AI Logic. Requests without a valid App Check token will be rejected. Implement App Check before this date to avoid service interruptions: ${services_1.AI_LOGIC_APP_CHECK_DOCS}`);
|
|
50
|
+
}
|
|
51
|
+
return rows;
|
|
52
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const clc = require("colorette");
|
|
5
|
+
const command_1 = require("../command");
|
|
6
|
+
const projectUtils_1 = require("../projectUtils");
|
|
7
|
+
const requireAuth_1 = require("../requireAuth");
|
|
8
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
9
|
+
const prompt_1 = require("../prompt");
|
|
10
|
+
const error_1 = require("../error");
|
|
11
|
+
const logger_1 = require("../logger");
|
|
12
|
+
const utils_1 = require("../utils");
|
|
13
|
+
const api_1 = require("../appcheck/api");
|
|
14
|
+
const services_1 = require("../appcheck/services");
|
|
15
|
+
exports.command = new command_1.Command("appcheck:services:set <service> <mode>")
|
|
16
|
+
.description("set App Check enforcement for one service")
|
|
17
|
+
.help(`sets the App Check enforcement mode for one service.
|
|
18
|
+
|
|
19
|
+
<service> is one of:
|
|
20
|
+
|
|
21
|
+
${(0, services_1.serviceAliasHelp)()}
|
|
22
|
+
|
|
23
|
+
<mode> is one of:
|
|
24
|
+
|
|
25
|
+
off App Check is not applied
|
|
26
|
+
unenforced requests are allowed, but counted in the App Check metrics
|
|
27
|
+
enforced requests without a valid App Check token are rejected
|
|
28
|
+
|
|
29
|
+
For most services the usual rollout is unenforced first, then check the metrics in the console, then enforced.
|
|
30
|
+
|
|
31
|
+
Firebase AI Logic works differently. It is enforced by default and enforcement becomes mandatory, so there is no monitoring phase: keep it enforced, use a debug token while you develop (\`appcheck:debugtokens:create\`), and register a real attestation provider before you ship (\`appcheck:providers:set\`).
|
|
32
|
+
|
|
33
|
+
--replay-protection sets the replay protection level, which cannot be stronger than <mode>. Not every service supports it.
|
|
34
|
+
|
|
35
|
+
For example:
|
|
36
|
+
|
|
37
|
+
\`firebase appcheck:services:set firestore unenforced\`
|
|
38
|
+
\`firebase appcheck:services:set firestore enforced\``)
|
|
39
|
+
.option("--replay-protection <mode>", "replay protection level: off, unenforced, or enforced. Cannot be stronger than <mode>, and not every service supports it")
|
|
40
|
+
.option("-f, --force", "bypass confirmation prompt")
|
|
41
|
+
.before(requireAuth_1.requireAuth)
|
|
42
|
+
.before(requirePermissions_1.requirePermissions, ["firebaseappcheck.services.get", "firebaseappcheck.services.update"])
|
|
43
|
+
.action(async (service, mode, options) => {
|
|
44
|
+
const serviceId = (0, services_1.resolveServiceId)(service);
|
|
45
|
+
const alias = (0, services_1.aliasForServiceId)(serviceId);
|
|
46
|
+
const enforcementMode = (0, services_1.parseEnforcementMode)(mode);
|
|
47
|
+
const replayProtection = options.replayProtection
|
|
48
|
+
? (0, services_1.parseEnforcementMode)(options.replayProtection)
|
|
49
|
+
: undefined;
|
|
50
|
+
if (replayProtection) {
|
|
51
|
+
(0, services_1.assertReplayProtectionAllowed)(enforcementMode, replayProtection);
|
|
52
|
+
}
|
|
53
|
+
const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
|
|
54
|
+
const current = await (0, api_1.getService)(projectNumber, serviceId);
|
|
55
|
+
const question = (0, services_1.confirmationForModeChange)(serviceId, alias, current.enforcementMode, enforcementMode);
|
|
56
|
+
if (question) {
|
|
57
|
+
const confirmed = await (0, prompt_1.confirm)({
|
|
58
|
+
message: question,
|
|
59
|
+
force: options.force,
|
|
60
|
+
nonInteractive: options.nonInteractive,
|
|
61
|
+
});
|
|
62
|
+
if (!confirmed) {
|
|
63
|
+
throw new error_1.FirebaseError("Command aborted.", { exit: 1 });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
let result;
|
|
67
|
+
try {
|
|
68
|
+
result = await (0, api_1.updateService)(projectNumber, serviceId, {
|
|
69
|
+
enforcementMode,
|
|
70
|
+
replayProtection,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
if (replayProtection && (0, error_1.getErrStatus)(err) === 400) {
|
|
75
|
+
throw new error_1.FirebaseError(`The API rejected replay protection for ${clc.bold(alias)}. Not every service supports it.\n\nRun the command again without --replay-protection to set enforcement on its own.`, { original: err instanceof Error ? err : undefined });
|
|
76
|
+
}
|
|
77
|
+
throw err;
|
|
78
|
+
}
|
|
79
|
+
const replayText = replayProtection
|
|
80
|
+
? `, replay protection ${replayProtection.toLowerCase()}`
|
|
81
|
+
: "";
|
|
82
|
+
(0, utils_1.logSuccess)(`App Check for ${clc.bold(alias)} is now ${enforcementMode.toLowerCase()}${replayText}.`);
|
|
83
|
+
if (enforcementMode === "UNENFORCED") {
|
|
84
|
+
logger_1.logger.info(`Requests without a valid token are allowed and counted in the metrics.`);
|
|
85
|
+
}
|
|
86
|
+
if ((0, services_1.isMandatoryFrom)(serviceId) && enforcementMode !== "ENFORCED") {
|
|
87
|
+
(0, utils_1.logWarning)(`Starting ${services_1.AI_LOGIC_ENFORCEMENT_DATE}, Firebase will automatically enforce App Check for all Gemini API requests via Firebase AI Logic, and App Check cannot be un-enforced for AI Logic. Implement App Check before this date to avoid service interruptions: ${services_1.AI_LOGIC_APP_CHECK_DOCS}`);
|
|
88
|
+
}
|
|
89
|
+
return result;
|
|
90
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const error_1 = require("../error");
|
|
6
|
+
const logger_1 = require("../logger");
|
|
7
|
+
const apps_1 = require("../management/apps");
|
|
8
|
+
const projectUtils_1 = require("../projectUtils");
|
|
9
|
+
const requireAuth_1 = require("../requireAuth");
|
|
10
|
+
const onboarding_1 = require("../crashlytics/onboarding");
|
|
11
|
+
exports.command = new command_1.Command("crashlytics:onboard:web [appId]")
|
|
12
|
+
.description("onboard a Firebase web app to Crashlytics")
|
|
13
|
+
.option("--app <appID>", "the app id of your Firebase app")
|
|
14
|
+
.before(requireAuth_1.requireAuth)
|
|
15
|
+
.action(async (appIdInput = "", options) => {
|
|
16
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
17
|
+
let appId = appIdInput ?? options.app ?? "";
|
|
18
|
+
let appPlatform = apps_1.AppPlatform.ANY;
|
|
19
|
+
if (!appId) {
|
|
20
|
+
const apps = await (0, apps_1.listFirebaseApps)(projectId, apps_1.AppPlatform.ANY);
|
|
21
|
+
(0, apps_1.checkForApps)(apps, apps_1.AppPlatform.ANY);
|
|
22
|
+
if (apps.length === 1) {
|
|
23
|
+
appId = apps[0].appId;
|
|
24
|
+
appPlatform = apps[0].platform;
|
|
25
|
+
}
|
|
26
|
+
else if (options.nonInteractive) {
|
|
27
|
+
throw new error_1.FirebaseError(`Project ${projectId} has multiple apps, must specify an app id.`);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const appMetadata = await (0, apps_1.selectAppInteractively)(apps, apps_1.AppPlatform.ANY);
|
|
31
|
+
appId = appMetadata.appId;
|
|
32
|
+
appPlatform = appMetadata.platform;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
const apps = await (0, apps_1.listFirebaseApps)(projectId, apps_1.AppPlatform.ANY);
|
|
37
|
+
const matchedApp = apps.find((a) => a.appId === appId);
|
|
38
|
+
if (matchedApp) {
|
|
39
|
+
appPlatform = matchedApp.platform;
|
|
40
|
+
}
|
|
41
|
+
else if (appId.includes(":web:")) {
|
|
42
|
+
appPlatform = apps_1.AppPlatform.WEB;
|
|
43
|
+
}
|
|
44
|
+
else if (appId.includes(":android:")) {
|
|
45
|
+
appPlatform = apps_1.AppPlatform.ANDROID;
|
|
46
|
+
}
|
|
47
|
+
else if (appId.includes(":ios:")) {
|
|
48
|
+
appPlatform = apps_1.AppPlatform.IOS;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (appPlatform !== apps_1.AppPlatform.WEB && !appId.includes(":web:")) {
|
|
52
|
+
logger_1.logger.info(`Crashlytics onboarding via the CLI is currently only supported for Web apps. No onboarding steps needed for non-Web app: ${appId}`);
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
return await (0, onboarding_1.onboardCrashlyticsWeb)(projectId, appId, options);
|
|
56
|
+
});
|
package/lib/commands/deploy.js
CHANGED
|
@@ -64,6 +64,9 @@ exports.command
|
|
|
64
64
|
.before(requireConfig_1.requireConfig)
|
|
65
65
|
.before((options) => {
|
|
66
66
|
options.filteredTargets = (0, filterTargets_1.filterTargets)(options, [...deploy_1.VALID_DEPLOY_TARGETS]);
|
|
67
|
+
if (options.filteredTargets.includes("ailogic")) {
|
|
68
|
+
experiments.assertEnabled("ailogic", "deploy AI Logic resources");
|
|
69
|
+
}
|
|
67
70
|
const permissions = options.filteredTargets.reduce((perms, target) => {
|
|
68
71
|
return perms.concat(deploy_1.TARGET_PERMISSIONS[target]);
|
|
69
72
|
}, []);
|
|
@@ -15,20 +15,45 @@ const logger_1 = require("../logger");
|
|
|
15
15
|
const projectUtils_1 = require("../projectUtils");
|
|
16
16
|
const prompt_1 = require("../prompt");
|
|
17
17
|
const requirePermissions_1 = require("../requirePermissions");
|
|
18
|
+
const extensionsApi_1 = require("../extensions/extensionsApi");
|
|
19
|
+
const utils_1 = require("../utils");
|
|
20
|
+
const env_1 = require("../functions/env");
|
|
21
|
+
const fs_1 = require("fs");
|
|
22
|
+
const path_1 = require("path");
|
|
23
|
+
const utils_2 = require("../utils");
|
|
24
|
+
const clc = require("colorette");
|
|
25
|
+
const experiments = require("../experiments");
|
|
18
26
|
exports.command = new command_1.Command("ext:export")
|
|
19
|
-
.description("export
|
|
27
|
+
.description("export Extension instances installed on a project to a local Firebase directory")
|
|
28
|
+
.option(`--mode <target>`, `experimental: controls the target system of the export (supports "extensions", "functions")`)
|
|
29
|
+
.option(`--instance <instanceId>`, `scope the export to the single instance with the specified instance id`)
|
|
20
30
|
.before(requirePermissions_1.requirePermissions, ["firebaseextensions.instances.list"])
|
|
21
31
|
.before(extensionsHelper_1.ensureExtensionsApiEnabled)
|
|
22
32
|
.before(checkMinRequiredVersion_1.checkMinRequiredVersion, "extMinVersion")
|
|
23
33
|
.withForce()
|
|
24
34
|
.action(async (options) => {
|
|
35
|
+
if (experiments.isEnabled("extMigrationFeatures") && options.mode === "functions") {
|
|
36
|
+
await fnHandler(options);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
await extHandler(options);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
async function extHandler(options) {
|
|
25
43
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
26
44
|
const projectNumber = await (0, getProjectNumber_1.getProjectNumber)(options);
|
|
27
|
-
|
|
45
|
+
let have = await Promise.all(await planner.have(projectId));
|
|
28
46
|
if (have.length === 0) {
|
|
29
47
|
logger_1.logger.info(`No extension instances installed on ${projectId}, so there is nothing to export.`);
|
|
30
48
|
return;
|
|
31
49
|
}
|
|
50
|
+
if (options.instance) {
|
|
51
|
+
have = have.filter((s) => s.instanceId === options.instance);
|
|
52
|
+
if (have.length === 0) {
|
|
53
|
+
logger_1.logger.info(`No extension instances installed on ${projectId} match specified instance ID ${options.instance}.`);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
32
57
|
const [withRef, withoutRef] = (0, functional_1.partition)(have, (s) => !!s.ref);
|
|
33
58
|
const withRefSubbed = await Promise.all(withRef.map(async (i) => {
|
|
34
59
|
const subbed = await (0, export_1.setSecretParamsToLatest)(i);
|
|
@@ -64,4 +89,51 @@ exports.command = new command_1.Command("ext:export")
|
|
|
64
89
|
force: options.force,
|
|
65
90
|
}, true);
|
|
66
91
|
(0, etags_1.saveEtags)(options.rc, projectId, have);
|
|
67
|
-
}
|
|
92
|
+
}
|
|
93
|
+
async function fnHandler(options) {
|
|
94
|
+
if (!options.instance) {
|
|
95
|
+
logger_1.logger.info(`ext:export must specify an --instance <instanceId> option when exporting to Functions. Use ext:list to find your instance IDs.`);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
99
|
+
const instance = await (0, extensionsApi_1.getInstance)(projectId, options.instance);
|
|
100
|
+
if (typeof instance === "undefined") {
|
|
101
|
+
logger_1.logger.info(`No extension matching instance ID ${options.instance} found`);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const instanceId = (0, utils_1.last)(instance.name.split("/")) ?? "";
|
|
105
|
+
if (instanceId !== options.instance) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const convertedEnv = (0, export_1.functionsEnvFromInstance)(instance);
|
|
109
|
+
for (const key of Object.keys(convertedEnv)) {
|
|
110
|
+
console.log(`${key}=${convertedEnv[key]}`);
|
|
111
|
+
}
|
|
112
|
+
let writeLocationOpts;
|
|
113
|
+
if (typeof options.projectRoot !== "undefined") {
|
|
114
|
+
writeLocationOpts = {
|
|
115
|
+
functionsSource: instanceId,
|
|
116
|
+
configDir: (0, path_1.join)(options.projectRoot, instanceId),
|
|
117
|
+
projectId: projectId,
|
|
118
|
+
isEmulator: false,
|
|
119
|
+
projectDir: options.projectRoot,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
writeLocationOpts = {
|
|
124
|
+
functionsSource: instanceId,
|
|
125
|
+
configDir: instanceId,
|
|
126
|
+
projectId: projectId,
|
|
127
|
+
isEmulator: false,
|
|
128
|
+
projectDir: options.cwd ?? process.cwd(),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
if ((0, env_1.hasUserEnvs)(writeLocationOpts)) {
|
|
132
|
+
logger_1.logger.info(`Exported extensions config appears to already exist in /${instanceId}, aborting write.`);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
(0, utils_2.logBullet)(clc.cyan(clc.bold("functions: ")) +
|
|
136
|
+
`Saving exported extensions config as a Function Kits .env file`);
|
|
137
|
+
(0, fs_1.mkdirSync)(instanceId, { recursive: true });
|
|
138
|
+
(0, env_1.writeUserEnvs)(convertedEnv, writeLocationOpts);
|
|
139
|
+
}
|
|
@@ -7,14 +7,16 @@ const requirePermissions_1 = require("../requirePermissions");
|
|
|
7
7
|
const types_1 = require("../emulator/types");
|
|
8
8
|
const commandUtils_1 = require("../emulator/commandUtils");
|
|
9
9
|
const pretty_print_1 = require("../firestore/pretty-print");
|
|
10
|
+
const projectUtils_1 = require("../projectUtils");
|
|
10
11
|
exports.command = new command_1.Command("firestore:locations")
|
|
11
12
|
.description("list possible locations for your Cloud Firestore database")
|
|
12
13
|
.before(requirePermissions_1.requirePermissions, ["datastore.locations.list"])
|
|
13
14
|
.before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
|
|
14
15
|
.action(async (options) => {
|
|
16
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
15
17
|
const api = new fsi.FirestoreApi();
|
|
16
18
|
const printer = new pretty_print_1.PrettyPrint();
|
|
17
|
-
const locations = await api.locations(
|
|
19
|
+
const locations = await api.locations(projectId);
|
|
18
20
|
printer.prettyPrintLocations(locations);
|
|
19
21
|
return locations;
|
|
20
22
|
});
|