firebase-tools-with-isolate 14.10.1 → 14.16.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/api.js +5 -1
- package/lib/apphosting/backend.js +40 -15
- package/lib/apptesting/ensureProjectConfigured.js +56 -0
- package/lib/apptesting/invokeTests.js +40 -0
- package/lib/apptesting/parseTestFiles.js +75 -0
- package/lib/apptesting/types.js +18 -0
- package/lib/auth.js +37 -2
- package/lib/command.js +24 -5
- package/lib/commands/apphosting-backends-create.js +8 -5
- package/lib/commands/apptesting-execute.js +101 -0
- package/lib/commands/dataconnect-sdk-generate.js +28 -26
- package/lib/commands/dataconnect-services-list.js +1 -1
- package/lib/commands/dataconnect-sql-diff.js +2 -2
- package/lib/commands/dataconnect-sql-grant.js +7 -2
- package/lib/commands/dataconnect-sql-migrate.js +2 -2
- package/lib/commands/dataconnect-sql-setup.js +3 -5
- package/lib/commands/dataconnect-sql-shell.js +2 -2
- package/lib/commands/ext-export.js +1 -1
- package/lib/commands/firestore-bulkdelete.js +73 -0
- package/lib/commands/firestore-databases-create.js +11 -0
- package/lib/commands/firestore-operations-cancel.js +44 -0
- package/lib/commands/firestore-operations-describe.js +29 -0
- package/lib/commands/firestore-operations-list.js +29 -0
- package/lib/commands/firestore-utils.js +15 -0
- package/lib/commands/functions-config-clone.js +2 -0
- package/lib/commands/functions-config-export.js +5 -2
- package/lib/commands/functions-config-get.js +2 -0
- package/lib/commands/functions-config-set.js +2 -0
- package/lib/commands/functions-config-unset.js +2 -0
- package/lib/commands/index.js +9 -0
- package/lib/commands/init.js +24 -4
- package/lib/commands/internaltesting-functions-discover.js +20 -5
- package/lib/commands/login.js +13 -9
- package/lib/commands/use.js +5 -0
- package/lib/config.js +16 -4
- package/lib/crashlytics/addNote.js +27 -0
- package/lib/crashlytics/buildToolsJarHelper.js +1 -2
- package/lib/crashlytics/deleteNote.js +23 -0
- package/lib/crashlytics/getIssueDetails.js +26 -0
- package/lib/crashlytics/getSampleCrash.js +34 -0
- package/lib/crashlytics/listNotes.js +29 -0
- package/lib/crashlytics/listTopDevices.js +33 -0
- package/lib/crashlytics/listTopIssues.js +8 -23
- package/lib/crashlytics/listTopOperatingSystems.js +32 -0
- package/lib/crashlytics/listTopVersions.js +32 -0
- package/lib/crashlytics/updateIssue.js +35 -0
- package/lib/crashlytics/utils.js +38 -0
- package/lib/dataconnect/appFinder.js +102 -0
- package/lib/dataconnect/client.js +23 -15
- package/lib/dataconnect/ensureApis.js +6 -9
- package/lib/dataconnect/errors.js +7 -1
- package/lib/dataconnect/freeTrial.js +16 -38
- package/lib/dataconnect/load.js +105 -6
- package/lib/dataconnect/provisionCloudSql.js +67 -70
- package/lib/dataconnect/schemaMigration.js +219 -169
- package/lib/deploy/dataconnect/deploy.js +7 -9
- package/lib/deploy/dataconnect/prepare.js +7 -12
- package/lib/deploy/dataconnect/release.js +43 -31
- package/lib/deploy/firestore/deploy.js +10 -0
- package/lib/deploy/functions/backend.js +7 -1
- package/lib/deploy/functions/build.js +28 -14
- package/lib/deploy/functions/deploy.js +3 -2
- package/lib/deploy/functions/ensure.js +1 -1
- package/lib/deploy/functions/functionsDeployHelper.js +8 -1
- package/lib/deploy/functions/params.js +4 -0
- package/lib/deploy/functions/prepare.js +25 -13
- package/lib/deploy/functions/pricing.js +12 -5
- package/lib/deploy/functions/release/fabricator.js +25 -3
- package/lib/deploy/functions/release/reporter.js +1 -0
- package/lib/deploy/functions/runtimes/discovery/index.js +52 -5
- package/lib/deploy/functions/runtimes/node/index.js +83 -51
- package/lib/emulator/auth/operations.js +10 -1
- package/lib/emulator/commandUtils.js +7 -1
- package/lib/emulator/controller.js +22 -34
- package/lib/emulator/dataconnectEmulator.js +27 -24
- package/lib/emulator/downloadableEmulatorInfo.json +18 -18
- package/lib/emulator/env.js +2 -1
- package/lib/emulator/functionsEmulator.js +12 -2
- package/lib/emulator/hub.js +11 -8
- package/lib/emulator/tasksEmulator.js +1 -1
- package/lib/emulator/ui.js +3 -1
- package/lib/env.js +18 -0
- package/lib/experiments.js +20 -0
- package/lib/extensions/extensionsHelper.js +4 -15
- package/lib/extensions/runtimes/common.js +3 -2
- package/lib/extensions/utils.js +1 -12
- package/lib/firestore/api-sort.js +96 -3
- package/lib/firestore/api-types.js +20 -1
- package/lib/firestore/api.js +144 -15
- package/lib/firestore/pretty-print.js +35 -1
- package/lib/firestore/validator.js +1 -1
- package/lib/functional.js +7 -1
- package/lib/functions/deprecationWarnings.js +21 -0
- package/lib/functions/env.js +31 -16
- package/lib/functions/projectConfig.js +87 -8
- package/lib/functions/secrets.js +3 -0
- package/lib/gcp/cloudfunctions.js +1 -6
- package/lib/gcp/cloudfunctionsv2.js +3 -39
- package/lib/gcp/cloudscheduler.js +1 -1
- package/lib/gcp/cloudsql/cloudsqladmin.js +4 -16
- package/lib/gcp/cloudsql/connect.js +4 -3
- package/lib/gcp/cloudsql/permissionsSetup.js +23 -16
- package/lib/gcp/k8s.js +32 -0
- package/lib/gcp/runv2.js +181 -0
- package/lib/gemini/fdcExperience.js +5 -3
- package/lib/init/features/aitools/claude.js +43 -0
- package/lib/init/features/aitools/cursor.js +61 -0
- package/lib/init/features/aitools/gemini.js +58 -0
- package/lib/init/features/aitools/index.js +28 -0
- package/lib/init/features/aitools/promptUpdater.js +111 -0
- package/lib/init/features/aitools/studio.js +17 -0
- package/lib/init/features/aitools/types.js +2 -0
- package/lib/init/features/aitools.js +83 -0
- package/lib/init/features/apptesting/index.js +34 -0
- package/lib/init/features/dataconnect/create_app.js +53 -0
- package/lib/init/features/dataconnect/index.js +280 -186
- package/lib/init/features/dataconnect/sdk.js +232 -144
- package/lib/init/features/index.js +8 -3
- package/lib/init/features/project.js +4 -0
- package/lib/init/index.js +18 -2
- package/lib/management/apps.js +3 -3
- package/lib/management/studio.js +120 -0
- package/lib/mcp/errors.js +5 -7
- package/lib/mcp/index.js +179 -61
- package/lib/mcp/logging-transport.js +23 -0
- package/lib/mcp/prompt.js +10 -0
- package/lib/mcp/prompts/core/deploy.js +101 -0
- package/lib/mcp/prompts/core/index.js +5 -0
- package/lib/mcp/prompts/crashlytics/connect.js +114 -0
- package/lib/mcp/prompts/crashlytics/index.js +5 -0
- package/lib/mcp/prompts/dataconnect/index.js +9 -0
- package/lib/mcp/prompts/dataconnect/schema.js +67 -0
- package/lib/mcp/prompts/index.js +47 -0
- package/lib/mcp/tools/apphosting/fetch_logs.js +22 -22
- package/lib/mcp/tools/apphosting/list_backends.js +10 -10
- package/lib/mcp/tools/auth/disable_user.js +7 -7
- package/lib/mcp/tools/auth/get_user.js +13 -6
- package/lib/mcp/tools/auth/index.js +10 -10
- package/lib/mcp/tools/auth/list_users.js +6 -6
- package/lib/mcp/tools/auth/set_claims.js +7 -7
- package/lib/mcp/tools/auth/set_sms_region_policy.js +6 -6
- package/lib/mcp/tools/core/consult_assistant.js +13 -8
- package/lib/mcp/tools/core/create_android_sha.js +9 -9
- package/lib/mcp/tools/core/create_app.js +7 -7
- package/lib/mcp/tools/core/create_project.js +13 -13
- package/lib/mcp/tools/core/get_admin_sdk_config.js +7 -7
- package/lib/mcp/tools/core/get_environment.js +8 -8
- package/lib/mcp/tools/core/get_project.js +5 -5
- package/lib/mcp/tools/core/get_sdk_config.js +19 -9
- package/lib/mcp/tools/core/index.js +28 -24
- package/lib/mcp/tools/core/init.js +39 -16
- package/lib/mcp/tools/core/list_apps.js +6 -6
- package/lib/mcp/tools/core/list_projects.js +6 -6
- package/lib/mcp/tools/core/login.js +46 -0
- package/lib/mcp/tools/core/logout.js +62 -0
- package/lib/mcp/tools/core/update_environment.js +10 -10
- package/lib/mcp/tools/crashlytics/add_note.js +32 -0
- package/lib/mcp/tools/crashlytics/constants.js +11 -0
- package/lib/mcp/tools/crashlytics/delete_note.js +35 -0
- package/lib/mcp/tools/crashlytics/get_issue_details.js +31 -0
- package/lib/mcp/tools/crashlytics/get_sample_crash.js +43 -0
- package/lib/mcp/tools/crashlytics/index.js +22 -2
- package/lib/mcp/tools/crashlytics/list_notes.js +37 -0
- package/lib/mcp/tools/crashlytics/list_top_devices.js +33 -0
- package/lib/mcp/tools/crashlytics/list_top_issues.js +12 -13
- package/lib/mcp/tools/crashlytics/list_top_operating_systems.js +33 -0
- package/lib/mcp/tools/crashlytics/list_top_versions.js +33 -0
- package/lib/mcp/tools/crashlytics/update_issue.js +37 -0
- package/lib/mcp/tools/database/get_data.js +49 -0
- package/lib/mcp/tools/database/get_rules.js +39 -0
- package/lib/mcp/tools/database/index.js +8 -0
- package/lib/mcp/tools/database/set_data.js +57 -0
- package/lib/mcp/tools/database/validate_rules.js +41 -0
- package/lib/mcp/tools/dataconnect/compile.js +43 -0
- package/lib/mcp/tools/dataconnect/execute.js +71 -0
- package/lib/mcp/tools/dataconnect/generate_operation.js +8 -8
- package/lib/mcp/tools/dataconnect/generate_schema.js +6 -6
- package/lib/mcp/tools/dataconnect/index.js +10 -18
- package/lib/mcp/tools/dataconnect/list_services.js +107 -11
- package/lib/mcp/tools/firestore/delete_document.js +13 -13
- package/lib/mcp/tools/firestore/get_documents.js +13 -13
- package/lib/mcp/tools/firestore/list_collections.js +7 -10
- package/lib/mcp/tools/firestore/query_collection.js +13 -13
- package/lib/mcp/tools/index.js +24 -18
- package/lib/mcp/tools/messaging/index.js +2 -2
- package/lib/mcp/tools/messaging/send_message.js +7 -7
- package/lib/mcp/tools/remoteconfig/get_template.js +5 -5
- package/lib/mcp/tools/remoteconfig/index.js +4 -4
- package/lib/mcp/tools/remoteconfig/publish_template.js +7 -7
- package/lib/mcp/tools/remoteconfig/rollback_template.js +6 -6
- package/lib/mcp/tools/rules/get_rules.js +8 -8
- package/lib/mcp/tools/rules/validate_rules.js +10 -10
- package/lib/mcp/tools/storage/get_download_url.js +8 -8
- package/lib/mcp/tools/storage/get_rules.js +8 -8
- package/lib/mcp/types.js +2 -0
- package/lib/mcp/util/dataconnect/compile.js +20 -0
- package/lib/mcp/util/dataconnect/content.js +655 -0
- package/lib/mcp/util/dataconnect/emulator.js +16 -0
- package/lib/mcp/util.js +5 -18
- package/lib/requireAuth.js +14 -4
- package/lib/rtdb.js +10 -6
- package/lib/scopes.js +2 -1
- package/lib/serve/functions.js +4 -3
- package/lib/timeout.js +21 -0
- package/lib/track.js +18 -1
- package/lib/unzip.js +13 -0
- package/lib/utils.js +76 -2
- package/package.json +5 -3
- package/prompts/FIREBASE.md +121 -0
- package/prompts/FIREBASE_FUNCTIONS.md +221 -0
- package/schema/apptesting-yaml.json +64 -0
- package/schema/firebase-config.json +163 -53
- package/templates/init/aitools/cursor-rules-header.txt +8 -0
- package/templates/init/aitools/gemini-extension.json +11 -0
- package/templates/init/apptesting/smoke_test.yaml +6 -0
- package/templates/init/dataconnect/connector.yaml +0 -16
- package/templates/init/dataconnect/dataconnect.yaml +2 -1
- package/templates/init/dataconnect/mutations.gql +29 -29
- package/templates/init/dataconnect/queries.gql +73 -73
- package/templates/init/dataconnect/schema.gql +48 -48
- package/templates/init/firestore/firestore.indexes.json +26 -1
- package/lib/dataconnect/fileUtils.js +0 -168
- package/lib/emulator/adminSdkConfig.test.js +0 -16
- package/lib/extensions/resolveSource.js +0 -23
- package/lib/firestore/api-sort.test.js +0 -74
- package/lib/firestore/backupUtils.test.js +0 -18
- package/lib/firestore/pretty-print.test.js +0 -61
- package/lib/firestore/util.test.js +0 -42
- package/lib/mcp/tools/dataconnect/emulator.js +0 -16
- package/lib/mcp/tools/dataconnect/execute_graphql.js +0 -48
- package/lib/mcp/tools/dataconnect/execute_graphql_read.js +0 -48
- package/lib/mcp/tools/dataconnect/execute_mutation.js +0 -62
- package/lib/mcp/tools/dataconnect/execute_query.js +0 -62
- package/lib/mcp/tools/dataconnect/get_connector.js +0 -31
- package/lib/mcp/tools/dataconnect/get_schema.js +0 -31
- /package/lib/mcp/{tools → util}/dataconnect/converter.js +0 -0
|
@@ -5,7 +5,7 @@ const command_1 = require("../command");
|
|
|
5
5
|
const projectUtils_1 = require("../projectUtils");
|
|
6
6
|
const ensureApis_1 = require("../dataconnect/ensureApis");
|
|
7
7
|
const requirePermissions_1 = require("../requirePermissions");
|
|
8
|
-
const
|
|
8
|
+
const load_1 = require("../dataconnect/load");
|
|
9
9
|
const schemaMigration_1 = require("../dataconnect/schemaMigration");
|
|
10
10
|
const requireAuth_1 = require("../requireAuth");
|
|
11
11
|
exports.command = new command_1.Command("dataconnect:sql:diff [serviceId]")
|
|
@@ -19,7 +19,7 @@ exports.command = new command_1.Command("dataconnect:sql:diff [serviceId]")
|
|
|
19
19
|
.action(async (serviceId, options) => {
|
|
20
20
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
21
21
|
await (0, ensureApis_1.ensureApis)(projectId);
|
|
22
|
-
const serviceInfo = await (0,
|
|
22
|
+
const serviceInfo = await (0, load_1.pickService)(projectId, options.config, serviceId);
|
|
23
23
|
const diffs = await (0, schemaMigration_1.diffSchema)(options, serviceInfo.schema, serviceInfo.dataConnectYaml.schema.datasource.postgresql?.schemaValidation);
|
|
24
24
|
return { projectId, serviceId, diffs };
|
|
25
25
|
});
|
|
@@ -5,11 +5,12 @@ const command_1 = require("../command");
|
|
|
5
5
|
const projectUtils_1 = require("../projectUtils");
|
|
6
6
|
const ensureApis_1 = require("../dataconnect/ensureApis");
|
|
7
7
|
const requirePermissions_1 = require("../requirePermissions");
|
|
8
|
-
const
|
|
8
|
+
const load_1 = require("../dataconnect/load");
|
|
9
9
|
const schemaMigration_1 = require("../dataconnect/schemaMigration");
|
|
10
10
|
const requireAuth_1 = require("../requireAuth");
|
|
11
11
|
const error_1 = require("../error");
|
|
12
12
|
const permissionsSetup_1 = require("../gcp/cloudsql/permissionsSetup");
|
|
13
|
+
const cloudsqladmin_1 = require("../gcp/cloudsql/cloudsqladmin");
|
|
13
14
|
const allowedRoles = Object.keys(permissionsSetup_1.fdcSqlRoleMap);
|
|
14
15
|
exports.command = new command_1.Command("dataconnect:sql:grant [serviceId]")
|
|
15
16
|
.description("grants the SQL role <role> to the provided user or service account <email>")
|
|
@@ -29,9 +30,13 @@ exports.command = new command_1.Command("dataconnect:sql:grant [serviceId]")
|
|
|
29
30
|
if (!allowedRoles.includes(role.toLowerCase())) {
|
|
30
31
|
throw new error_1.FirebaseError(`Role should be one of ${allowedRoles.join(" | ")}.`);
|
|
31
32
|
}
|
|
33
|
+
const userIsCSQLAdmin = await (0, cloudsqladmin_1.iamUserIsCSQLAdmin)(options);
|
|
34
|
+
if (!userIsCSQLAdmin) {
|
|
35
|
+
throw new error_1.FirebaseError(`Only users with 'roles/cloudsql.admin' can grant SQL roles. If you do not have this role, ask your database administrator to run this command or manually grant ${role} to ${email}`);
|
|
36
|
+
}
|
|
32
37
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
33
38
|
await (0, ensureApis_1.ensureApis)(projectId);
|
|
34
|
-
const serviceInfo = await (0,
|
|
39
|
+
const serviceInfo = await (0, load_1.pickService)(projectId, options.config, serviceId);
|
|
35
40
|
await (0, schemaMigration_1.grantRoleToUserInSchema)(options, serviceInfo.schema);
|
|
36
41
|
return { projectId, serviceId };
|
|
37
42
|
});
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.command = void 0;
|
|
4
4
|
const command_1 = require("../command");
|
|
5
5
|
const projectUtils_1 = require("../projectUtils");
|
|
6
|
-
const
|
|
6
|
+
const load_1 = require("../dataconnect/load");
|
|
7
7
|
const error_1 = require("../error");
|
|
8
8
|
const schemaMigration_1 = require("../dataconnect/schemaMigration");
|
|
9
9
|
const requireAuth_1 = require("../requireAuth");
|
|
@@ -23,7 +23,7 @@ exports.command = new command_1.Command("dataconnect:sql:migrate [serviceId]")
|
|
|
23
23
|
.action(async (serviceId, options) => {
|
|
24
24
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
25
25
|
await (0, ensureApis_1.ensureApis)(projectId);
|
|
26
|
-
const serviceInfo = await (0,
|
|
26
|
+
const serviceInfo = await (0, load_1.pickService)(projectId, options.config, serviceId);
|
|
27
27
|
const instanceId = serviceInfo.dataConnectYaml.schema.datasource.postgresql?.cloudSql.instanceId;
|
|
28
28
|
if (!instanceId) {
|
|
29
29
|
throw new error_1.FirebaseError("dataconnect.yaml is missing field schema.datasource.postgresql.cloudsql.instanceId");
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.command = void 0;
|
|
4
4
|
const command_1 = require("../command");
|
|
5
5
|
const projectUtils_1 = require("../projectUtils");
|
|
6
|
-
const
|
|
6
|
+
const load_1 = require("../dataconnect/load");
|
|
7
7
|
const error_1 = require("../error");
|
|
8
8
|
const requireAuth_1 = require("../requireAuth");
|
|
9
9
|
const requirePermissions_1 = require("../requirePermissions");
|
|
@@ -12,7 +12,6 @@ const permissionsSetup_1 = require("../gcp/cloudsql/permissionsSetup");
|
|
|
12
12
|
const permissions_1 = require("../gcp/cloudsql/permissions");
|
|
13
13
|
const schemaMigration_1 = require("../dataconnect/schemaMigration");
|
|
14
14
|
const connect_1 = require("../gcp/cloudsql/connect");
|
|
15
|
-
const cloudSqlAdminClient = require("../gcp/cloudsql/cloudsqladmin");
|
|
16
15
|
exports.command = new command_1.Command("dataconnect:sql:setup [serviceId]")
|
|
17
16
|
.description("set up your CloudSQL database")
|
|
18
17
|
.before(requirePermissions_1.requirePermissions, [
|
|
@@ -25,15 +24,14 @@ exports.command = new command_1.Command("dataconnect:sql:setup [serviceId]")
|
|
|
25
24
|
.action(async (serviceId, options) => {
|
|
26
25
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
27
26
|
await (0, ensureApis_1.ensureApis)(projectId);
|
|
28
|
-
const serviceInfo = await (0,
|
|
27
|
+
const serviceInfo = await (0, load_1.pickService)(projectId, options.config, serviceId);
|
|
29
28
|
const instanceId = serviceInfo.dataConnectYaml.schema.datasource.postgresql?.cloudSql.instanceId;
|
|
30
29
|
if (!instanceId) {
|
|
31
30
|
throw new error_1.FirebaseError("dataconnect.yaml is missing field schema.datasource.postgresql.cloudsql.instanceId");
|
|
32
31
|
}
|
|
33
32
|
const { serviceName, instanceName, databaseId } = (0, schemaMigration_1.getIdentifiers)(serviceInfo.schema);
|
|
34
33
|
await (0, schemaMigration_1.ensureServiceIsConnectedToCloudSql)(serviceName, instanceName, databaseId, true);
|
|
35
|
-
|
|
36
|
-
await cloudSqlAdminClient.createUser(projectId, instanceId, mode, user);
|
|
34
|
+
await (0, connect_1.setupIAMUsers)(instanceId, options);
|
|
37
35
|
const schemaInfo = await (0, permissionsSetup_1.getSchemaMetadata)(instanceId, databaseId, permissions_1.DEFAULT_SCHEMA, options);
|
|
38
36
|
await (0, permissionsSetup_1.setupSQLPermissions)(instanceId, databaseId, schemaInfo, options);
|
|
39
37
|
});
|
|
@@ -8,7 +8,7 @@ const command_1 = require("../command");
|
|
|
8
8
|
const projectUtils_1 = require("../projectUtils");
|
|
9
9
|
const ensureApis_1 = require("../dataconnect/ensureApis");
|
|
10
10
|
const requirePermissions_1 = require("../requirePermissions");
|
|
11
|
-
const
|
|
11
|
+
const load_1 = require("../dataconnect/load");
|
|
12
12
|
const schemaMigration_1 = require("../dataconnect/schemaMigration");
|
|
13
13
|
const requireAuth_1 = require("../requireAuth");
|
|
14
14
|
const connect_1 = require("../gcp/cloudsql/connect");
|
|
@@ -79,7 +79,7 @@ exports.command = new command_1.Command("dataconnect:sql:shell [serviceId]")
|
|
|
79
79
|
.action(async (serviceId, options) => {
|
|
80
80
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
81
81
|
await (0, ensureApis_1.ensureApis)(projectId);
|
|
82
|
-
const serviceInfo = await (0,
|
|
82
|
+
const serviceInfo = await (0, load_1.pickService)(projectId, options.config, serviceId);
|
|
83
83
|
const { instanceId, databaseId } = (0, schemaMigration_1.getIdentifiers)(serviceInfo.schema);
|
|
84
84
|
const { user: username } = await (0, connect_1.getIAMUser)(options);
|
|
85
85
|
const instance = await cloudSqlAdminClient.getInstance(projectId, instanceId);
|
|
@@ -45,7 +45,7 @@ exports.command = new command_1.Command("ext:export")
|
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
const manifestSpecs = withRefSubbed.map((spec) => {
|
|
48
|
-
const paramCopy = { ...spec.params };
|
|
48
|
+
const paramCopy = { ...spec.params, ...spec.systemParams };
|
|
49
49
|
if (spec.eventarcChannel) {
|
|
50
50
|
paramCopy.EVENTARC_CHANNEL = spec.eventarcChannel;
|
|
51
51
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const fsi = require("../firestore/api");
|
|
6
|
+
const logger_1 = require("../logger");
|
|
7
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
8
|
+
const types_1 = require("../emulator/types");
|
|
9
|
+
const commandUtils_1 = require("../emulator/commandUtils");
|
|
10
|
+
const prompt_1 = require("../prompt");
|
|
11
|
+
const utils = require("../utils");
|
|
12
|
+
const clc = require("colorette");
|
|
13
|
+
const utils_1 = require("../utils");
|
|
14
|
+
const error_1 = require("../error");
|
|
15
|
+
function confirmationMessage(options, databaseId, collectionIds) {
|
|
16
|
+
const root = `projects/${options.project}/databases/${databaseId}/documents`;
|
|
17
|
+
return ("You are about to delete all documents in the following collection groups: " +
|
|
18
|
+
clc.cyan(collectionIds.map((item) => `"${item}"`).join(", ")) +
|
|
19
|
+
" in " +
|
|
20
|
+
clc.cyan(`"${root}"`) +
|
|
21
|
+
". Are you sure?");
|
|
22
|
+
}
|
|
23
|
+
exports.command = new command_1.Command("firestore:bulkdelete")
|
|
24
|
+
.description("managed bulk delete service to delete data from one or more collection groups")
|
|
25
|
+
.option("--database <databaseName>", 'Database ID for database to delete from. "(default)" if none is provided.')
|
|
26
|
+
.option("--collection-ids <collectionIds>", "A comma-separated list of collection group IDs to delete. Deletes all documents in the specified collection groups.")
|
|
27
|
+
.before(requirePermissions_1.requirePermissions, ["datastore.databases.bulkDeleteDocuments"])
|
|
28
|
+
.before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
|
|
29
|
+
.action(async (options) => {
|
|
30
|
+
if (!options.collectionIds) {
|
|
31
|
+
throw new error_1.FirebaseError("Missing required flag --collection-ids=[comma separated list of collection groups]");
|
|
32
|
+
}
|
|
33
|
+
let collectionIds = [];
|
|
34
|
+
try {
|
|
35
|
+
collectionIds = options.collectionIds
|
|
36
|
+
.split(",")
|
|
37
|
+
.filter((id) => id.trim() !== "");
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
throw new error_1.FirebaseError("The value for --collection-ids must a list of comma separated collection group names");
|
|
41
|
+
}
|
|
42
|
+
if (collectionIds.length === 0) {
|
|
43
|
+
throw new error_1.FirebaseError("Must specify at least one collection ID in --collection-ids.");
|
|
44
|
+
}
|
|
45
|
+
const databaseId = options.database || "(default)";
|
|
46
|
+
const api = new fsi.FirestoreApi();
|
|
47
|
+
const confirmed = await (0, prompt_1.confirm)({
|
|
48
|
+
message: confirmationMessage(options, databaseId, collectionIds),
|
|
49
|
+
default: false,
|
|
50
|
+
force: options.force,
|
|
51
|
+
nonInteractive: options.nonInteractive,
|
|
52
|
+
});
|
|
53
|
+
if (!confirmed) {
|
|
54
|
+
return utils.reject("Command aborted.", { exit: 1 });
|
|
55
|
+
}
|
|
56
|
+
const op = await api.bulkDeleteDocuments(options.project, databaseId, collectionIds);
|
|
57
|
+
if (options.json) {
|
|
58
|
+
logger_1.logger.info(JSON.stringify(op, undefined, 2));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
if (op.name) {
|
|
62
|
+
(0, utils_1.logSuccess)(`Successfully started bulk delete operation.`);
|
|
63
|
+
(0, utils_1.logBullet)(`Operation name: ` + clc.cyan(op.name));
|
|
64
|
+
(0, utils_1.logBullet)("You can monitor the operation's progress using the " +
|
|
65
|
+
clc.cyan(`gcloud firestore operations describe`) +
|
|
66
|
+
` command.`);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
(0, utils_1.logLabeledError)(`Bulk Delete:`, `Failed to start a bulk delete operation.`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return op;
|
|
73
|
+
});
|
|
@@ -14,6 +14,7 @@ const error_1 = require("../error");
|
|
|
14
14
|
exports.command = new command_1.Command("firestore:databases:create <database>")
|
|
15
15
|
.description("create a database in your Firebase project")
|
|
16
16
|
.option("--location <locationId>", "region to create database, for example 'nam5'. Run 'firebase firestore:locations' to get a list of eligible locations (required)")
|
|
17
|
+
.option("--edition <edition>", "the edition of the database to create, for example 'standard' or 'enterprise'. If not provided, 'standard' is used as a default.")
|
|
17
18
|
.option("--delete-protection <deleteProtectionState>", "whether or not to prevent deletion of database, for example 'ENABLED' or 'DISABLED'. Default is 'DISABLED'")
|
|
18
19
|
.option("--point-in-time-recovery <enablement>", "whether to enable the PITR feature on this database, for example 'ENABLED' or 'DISABLED'. Default is 'DISABLED'")
|
|
19
20
|
.option("-k, --kms-key-name <kmsKeyName>", "the resource ID of a Cloud KMS key. If set, the database created will be a " +
|
|
@@ -29,6 +30,15 @@ exports.command = new command_1.Command("firestore:databases:create <database>")
|
|
|
29
30
|
throw new error_1.FirebaseError(`Missing required flag --location. ${helpCommandText}`);
|
|
30
31
|
}
|
|
31
32
|
const type = types.DatabaseType.FIRESTORE_NATIVE;
|
|
33
|
+
let databaseEdition = types.DatabaseEdition.STANDARD;
|
|
34
|
+
if (options.edition) {
|
|
35
|
+
const edition = options.edition.toUpperCase();
|
|
36
|
+
if (edition !== types.DatabaseEdition.STANDARD &&
|
|
37
|
+
edition !== types.DatabaseEdition.ENTERPRISE) {
|
|
38
|
+
throw new error_1.FirebaseError(`Invalid value for flag --edition. ${helpCommandText}`);
|
|
39
|
+
}
|
|
40
|
+
databaseEdition = edition;
|
|
41
|
+
}
|
|
32
42
|
if (options.deleteProtection &&
|
|
33
43
|
options.deleteProtection !== types.DatabaseDeleteProtectionStateOption.ENABLED &&
|
|
34
44
|
options.deleteProtection !== types.DatabaseDeleteProtectionStateOption.DISABLED) {
|
|
@@ -56,6 +66,7 @@ exports.command = new command_1.Command("firestore:databases:create <database>")
|
|
|
56
66
|
databaseId: database,
|
|
57
67
|
locationId: options.location,
|
|
58
68
|
type,
|
|
69
|
+
databaseEdition,
|
|
59
70
|
deleteProtectionState,
|
|
60
71
|
pointInTimeRecoveryEnablement,
|
|
61
72
|
cmekConfig,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const fsi = require("../firestore/api");
|
|
6
|
+
const types_1 = require("../emulator/types");
|
|
7
|
+
const commandUtils_1 = require("../emulator/commandUtils");
|
|
8
|
+
const firestore_utils_1 = require("./firestore-utils");
|
|
9
|
+
const prompt_1 = require("../prompt");
|
|
10
|
+
const clc = require("colorette");
|
|
11
|
+
const utils = require("../utils");
|
|
12
|
+
const logger_1 = require("../logger");
|
|
13
|
+
exports.command = new command_1.Command("firestore:operations:cancel <operationName>")
|
|
14
|
+
.description("cancels a long-running Cloud Firestore admin operation")
|
|
15
|
+
.option("--database <databaseName>", 'Database ID for which the operation is running. "(default)" if none is provided.')
|
|
16
|
+
.option("--force", "Forces the operation cancellation without asking for confirmation")
|
|
17
|
+
.before(commandUtils_1.errorMissingProject)
|
|
18
|
+
.before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
|
|
19
|
+
.action(async (operationName, options) => {
|
|
20
|
+
const databaseId = options.database || "(default)";
|
|
21
|
+
operationName = (0, firestore_utils_1.getShortOperationName)(operationName);
|
|
22
|
+
if (!options.force) {
|
|
23
|
+
const fullName = `/projects/${options.project}/databases/${databaseId}/operations/${operationName}`;
|
|
24
|
+
const confirmMessage = `You are about to cancel the operation: ${clc.bold(clc.yellow(clc.underline(fullName)))}. Do you wish to continue?`;
|
|
25
|
+
const consent = await (0, prompt_1.confirm)(confirmMessage);
|
|
26
|
+
if (!consent) {
|
|
27
|
+
return utils.reject("Command aborted.", { exit: 1 });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const api = new fsi.FirestoreApi();
|
|
31
|
+
const status = await api.cancelOperation(options.project, databaseId, operationName);
|
|
32
|
+
if (options.json) {
|
|
33
|
+
logger_1.logger.info(JSON.stringify(status, undefined, 2));
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
if (status.success) {
|
|
37
|
+
utils.logSuccess("Operation cancelled successfully.");
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
utils.logWarning("Canceling the operation failed.");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return status;
|
|
44
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const fsi = require("../firestore/api");
|
|
6
|
+
const logger_1 = require("../logger");
|
|
7
|
+
const types_1 = require("../emulator/types");
|
|
8
|
+
const commandUtils_1 = require("../emulator/commandUtils");
|
|
9
|
+
const pretty_print_1 = require("../firestore/pretty-print");
|
|
10
|
+
const firestore_utils_1 = require("./firestore-utils");
|
|
11
|
+
exports.command = new command_1.Command("firestore:operations:describe <operationName>")
|
|
12
|
+
.description("retrieves information about a Cloud Firestore admin operation")
|
|
13
|
+
.option("--database <databaseName>", 'Database ID for which the operation is running. "(default)" if none is provided.')
|
|
14
|
+
.before(commandUtils_1.errorMissingProject)
|
|
15
|
+
.before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
|
|
16
|
+
.action(async (operationName, options) => {
|
|
17
|
+
const databaseId = options.database || "(default)";
|
|
18
|
+
operationName = (0, firestore_utils_1.getShortOperationName)(operationName);
|
|
19
|
+
const api = new fsi.FirestoreApi();
|
|
20
|
+
const operation = await api.describeOperation(options.project, databaseId, operationName);
|
|
21
|
+
if (options.json) {
|
|
22
|
+
logger_1.logger.info(JSON.stringify(operation, undefined, 2));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
const printer = new pretty_print_1.PrettyPrint();
|
|
26
|
+
printer.prettyPrintOperation(operation);
|
|
27
|
+
}
|
|
28
|
+
return operation;
|
|
29
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const fsi = require("../firestore/api");
|
|
6
|
+
const logger_1 = require("../logger");
|
|
7
|
+
const types_1 = require("../emulator/types");
|
|
8
|
+
const commandUtils_1 = require("../emulator/commandUtils");
|
|
9
|
+
const pretty_print_1 = require("../firestore/pretty-print");
|
|
10
|
+
exports.command = new command_1.Command("firestore:operations:list")
|
|
11
|
+
.description("list pending Cloud Firestore admin operations and their status")
|
|
12
|
+
.option("--database <databaseName>", 'Database ID for database to list operations for. "(default)" if none is provided.')
|
|
13
|
+
.option("--limit <number>", "The maximum number of operations to list. Uses 100 by default.")
|
|
14
|
+
.before(commandUtils_1.errorMissingProject)
|
|
15
|
+
.before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
|
|
16
|
+
.action(async (options) => {
|
|
17
|
+
const databaseId = options.database || "(default)";
|
|
18
|
+
const limit = options.limit === undefined ? 100 : Number(options.limit);
|
|
19
|
+
const api = new fsi.FirestoreApi();
|
|
20
|
+
const { operations } = await api.listOperations(options.project, databaseId, limit);
|
|
21
|
+
if (options.json) {
|
|
22
|
+
logger_1.logger.info(JSON.stringify(operations, undefined, 2));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
const printer = new pretty_print_1.PrettyPrint();
|
|
26
|
+
printer.prettyPrintOperations(operations);
|
|
27
|
+
}
|
|
28
|
+
return operations;
|
|
29
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getShortOperationName = void 0;
|
|
4
|
+
const error_1 = require("../error");
|
|
5
|
+
function getShortOperationName(operationName) {
|
|
6
|
+
let opName = operationName;
|
|
7
|
+
if (operationName.includes("/operations/")) {
|
|
8
|
+
opName = operationName.split("/operations/")[1];
|
|
9
|
+
}
|
|
10
|
+
if (opName.length === 0 || opName.includes("/")) {
|
|
11
|
+
throw new error_1.FirebaseError(`"${operationName}" is not a valid operation name.`);
|
|
12
|
+
}
|
|
13
|
+
return opName;
|
|
14
|
+
}
|
|
15
|
+
exports.getShortOperationName = getShortOperationName;
|
|
@@ -10,6 +10,7 @@ const requirePermissions_1 = require("../requirePermissions");
|
|
|
10
10
|
const functionsConfig = require("../functionsConfig");
|
|
11
11
|
const functionsConfigClone_1 = require("../functionsConfigClone");
|
|
12
12
|
const utils = require("../utils");
|
|
13
|
+
const deprecationWarnings_1 = require("../functions/deprecationWarnings");
|
|
13
14
|
exports.command = new command_1.Command("functions:config:clone")
|
|
14
15
|
.description("clone environment config from another project")
|
|
15
16
|
.option("--from <projectId>", "the project from which to clone configuration")
|
|
@@ -50,4 +51,5 @@ exports.command = new command_1.Command("functions:config:clone")
|
|
|
50
51
|
await (0, functionsConfigClone_1.functionsConfigClone)(options.from, projectId, only, except);
|
|
51
52
|
utils.logSuccess(`Cloned functions config from ${clc.bold(options.from)} into ${clc.bold(projectId)}`);
|
|
52
53
|
logger_1.logger.info(`\nPlease deploy your functions for the change to take effect by running ${clc.bold("firebase deploy --only functions")}\n`);
|
|
54
|
+
(0, deprecationWarnings_1.logFunctionsConfigDeprecationWarning)();
|
|
53
55
|
});
|
|
@@ -78,7 +78,10 @@ exports.command = new command_1.Command("functions:config:export")
|
|
|
78
78
|
.before(requireInteractive_1.default)
|
|
79
79
|
.action(async (options) => {
|
|
80
80
|
const config = (0, projectConfig_1.normalizeAndValidate)(options.config.src.functions)[0];
|
|
81
|
-
const
|
|
81
|
+
const configDir = (0, projectConfig_1.resolveConfigDir)(config);
|
|
82
|
+
if (!configDir) {
|
|
83
|
+
throw new error_1.FirebaseError("functions:config:export requires a local env directory. Set functions[].configDir in firebase.json when using remoteSource.");
|
|
84
|
+
}
|
|
82
85
|
let pInfos = configExport.getProjectInfos(options);
|
|
83
86
|
checkReservedAliases(pInfos);
|
|
84
87
|
(0, utils_1.logBullet)("Importing functions configs from projects [" +
|
|
@@ -111,6 +114,6 @@ exports.command = new command_1.Command("functions:config:export")
|
|
|
111
114
|
filesToWrite[".env"] =
|
|
112
115
|
`${header}# .env file contains environment variables that applies to all projects.\n`;
|
|
113
116
|
for (const [filename, content] of Object.entries(filesToWrite)) {
|
|
114
|
-
await options.config.askWriteProjectFile(path.join(
|
|
117
|
+
await options.config.askWriteProjectFile(path.join(configDir, filename), content);
|
|
115
118
|
}
|
|
116
119
|
});
|
|
@@ -8,6 +8,7 @@ const logger_1 = require("../logger");
|
|
|
8
8
|
const projectUtils_1 = require("../projectUtils");
|
|
9
9
|
const requirePermissions_1 = require("../requirePermissions");
|
|
10
10
|
const functionsConfig = require("../functionsConfig");
|
|
11
|
+
const deprecationWarnings_1 = require("../functions/deprecationWarnings");
|
|
11
12
|
async function materialize(projectId, path) {
|
|
12
13
|
if (path === undefined) {
|
|
13
14
|
return functionsConfig.materializeAll(projectId);
|
|
@@ -31,5 +32,6 @@ exports.command = new command_1.Command("functions:config:get [path]")
|
|
|
31
32
|
.action(async (path, options) => {
|
|
32
33
|
const result = await materialize((0, projectUtils_1.needProjectId)(options), path);
|
|
33
34
|
logger_1.logger.info(JSON.stringify(result, null, 2));
|
|
35
|
+
(0, deprecationWarnings_1.logFunctionsConfigDeprecationWarning)();
|
|
34
36
|
return result;
|
|
35
37
|
});
|
|
@@ -9,6 +9,7 @@ const projectUtils_1 = require("../projectUtils");
|
|
|
9
9
|
const requirePermissions_1 = require("../requirePermissions");
|
|
10
10
|
const functionsConfig = require("../functionsConfig");
|
|
11
11
|
const utils = require("../utils");
|
|
12
|
+
const deprecationWarnings_1 = require("../functions/deprecationWarnings");
|
|
12
13
|
exports.command = new command_1.Command("functions:config:set [values...]")
|
|
13
14
|
.description("set environment config with key=value syntax")
|
|
14
15
|
.before(requirePermissions_1.requirePermissions, [
|
|
@@ -40,4 +41,5 @@ exports.command = new command_1.Command("functions:config:set [values...]")
|
|
|
40
41
|
await Promise.all(promises);
|
|
41
42
|
utils.logSuccess("Functions config updated.");
|
|
42
43
|
logger_1.logger.info(`\nPlease deploy your functions for the change to take effect by running ${clc.bold("firebase deploy --only functions")}\n`);
|
|
44
|
+
(0, deprecationWarnings_1.logFunctionsConfigDeprecationWarning)();
|
|
43
45
|
});
|
|
@@ -10,6 +10,7 @@ const functionsConfig = require("../functionsConfig");
|
|
|
10
10
|
const runtimeconfig = require("../gcp/runtimeconfig");
|
|
11
11
|
const utils = require("../utils");
|
|
12
12
|
const error_1 = require("../error");
|
|
13
|
+
const deprecationWarnings_1 = require("../functions/deprecationWarnings");
|
|
13
14
|
exports.command = new command_1.Command("functions:config:unset [keys...]")
|
|
14
15
|
.description("unset environment config at the specified path(s)")
|
|
15
16
|
.before(requirePermissions_1.requirePermissions, [
|
|
@@ -39,4 +40,5 @@ exports.command = new command_1.Command("functions:config:unset [keys...]")
|
|
|
39
40
|
}));
|
|
40
41
|
utils.logSuccess("Environment updated.");
|
|
41
42
|
logger_1.logger.info(`\nPlease deploy your functions for the change to take effect by running ${clc.bold("firebase deploy --only functions")}\n`);
|
|
43
|
+
(0, deprecationWarnings_1.logFunctionsConfigDeprecationWarning)();
|
|
42
44
|
});
|
package/lib/commands/index.js
CHANGED
|
@@ -96,8 +96,13 @@ function load(client) {
|
|
|
96
96
|
client.ext.dev.usage = loadCommand("ext-dev-usage");
|
|
97
97
|
client.firestore = {};
|
|
98
98
|
client.firestore.delete = loadCommand("firestore-delete");
|
|
99
|
+
client.firestore.bulkDelete = loadCommand("firestore-bulkdelete");
|
|
99
100
|
client.firestore.indexes = loadCommand("firestore-indexes-list");
|
|
100
101
|
client.firestore.locations = loadCommand("firestore-locations");
|
|
102
|
+
client.firestore.operations = {};
|
|
103
|
+
client.firestore.operations.cancel = loadCommand("firestore-operations-cancel");
|
|
104
|
+
client.firestore.operations.describe = loadCommand("firestore-operations-describe");
|
|
105
|
+
client.firestore.operations.list = loadCommand("firestore-operations-list");
|
|
101
106
|
client.firestore.databases = {};
|
|
102
107
|
client.firestore.databases.list = loadCommand("firestore-databases-list");
|
|
103
108
|
client.firestore.databases.get = loadCommand("firestore-databases-get");
|
|
@@ -228,6 +233,10 @@ function load(client) {
|
|
|
228
233
|
client.target.clear = loadCommand("target-clear");
|
|
229
234
|
client.target.remove = loadCommand("target-remove");
|
|
230
235
|
client.use = loadCommand("use");
|
|
236
|
+
if (experiments.isEnabled("apptesting")) {
|
|
237
|
+
client.apptesting = {};
|
|
238
|
+
client.apptesting.execute = loadCommand("apptesting-execute");
|
|
239
|
+
}
|
|
231
240
|
const t1 = process.hrtime.bigint();
|
|
232
241
|
const diffMS = (t1 - t0) / BigInt(1e6);
|
|
233
242
|
if (diffMS > 100) {
|
package/lib/commands/init.js
CHANGED
|
@@ -16,7 +16,7 @@ const utils = require("../utils");
|
|
|
16
16
|
const experiments_1 = require("../experiments");
|
|
17
17
|
const templates_1 = require("../templates");
|
|
18
18
|
const error_1 = require("../error");
|
|
19
|
-
const
|
|
19
|
+
const utils_1 = require("../utils");
|
|
20
20
|
const homeDir = os.homedir();
|
|
21
21
|
const BANNER_TEXT = (0, templates_1.readTemplateSync)("banner.txt");
|
|
22
22
|
const GITIGNORE_TEMPLATE = (0, templates_1.readTemplateSync)("_gitignore");
|
|
@@ -99,6 +99,19 @@ if ((0, experiments_1.isEnabled)("genkit")) {
|
|
|
99
99
|
...choices.slice(2),
|
|
100
100
|
];
|
|
101
101
|
}
|
|
102
|
+
if ((0, experiments_1.isEnabled)("apptesting")) {
|
|
103
|
+
choices.push({
|
|
104
|
+
value: "apptesting",
|
|
105
|
+
name: "App Testing: create a smoke test, enable Cloud APIs (storage, run, & artifactregistry), and add a service account.",
|
|
106
|
+
checked: false,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
choices.push({
|
|
110
|
+
value: "aitools",
|
|
111
|
+
name: "AI Tools: Configure AI coding assistants to work with your Firebase project",
|
|
112
|
+
checked: false,
|
|
113
|
+
hidden: true,
|
|
114
|
+
});
|
|
102
115
|
const featureNames = choices.map((choice) => choice.value);
|
|
103
116
|
const HELP = `Interactively configure the current directory as a Firebase project or initialize new features in an already configured Firebase project directory.
|
|
104
117
|
|
|
@@ -121,7 +134,6 @@ async function initAction(feature, options) {
|
|
|
121
134
|
featureNames.join(", ") +
|
|
122
135
|
".");
|
|
123
136
|
}
|
|
124
|
-
const start = process.uptime();
|
|
125
137
|
const cwd = options.cwd || process.cwd();
|
|
126
138
|
const warnings = [];
|
|
127
139
|
let warningText = "";
|
|
@@ -154,6 +166,7 @@ async function initAction(feature, options) {
|
|
|
154
166
|
json: true,
|
|
155
167
|
fallback: {},
|
|
156
168
|
}),
|
|
169
|
+
instructions: [],
|
|
157
170
|
};
|
|
158
171
|
if (process.platform === "win32") {
|
|
159
172
|
if (!(await (0, prompt_1.confirm)("Are you ready to proceed?"))) {
|
|
@@ -194,6 +207,9 @@ async function initAction(feature, options) {
|
|
|
194
207
|
if (setup.features.includes("hosting") && setup.features.includes("hosting:github")) {
|
|
195
208
|
setup.features = setup.features.filter((f) => f !== "hosting:github");
|
|
196
209
|
}
|
|
210
|
+
if (setup.features.includes("dataconnect") && setup.features.includes("dataconnect:sdk")) {
|
|
211
|
+
setup.features = setup.features.filter((f) => f !== "dataconnect:sdk");
|
|
212
|
+
}
|
|
197
213
|
await (0, init_1.init)(setup, config, options);
|
|
198
214
|
logger_1.logger.info();
|
|
199
215
|
config.writeProjectFile("firebase.json", setup.config);
|
|
@@ -201,9 +217,13 @@ async function initAction(feature, options) {
|
|
|
201
217
|
if (!fsutils.fileExistsSync(config.path(".gitignore"))) {
|
|
202
218
|
config.writeProjectFile(".gitignore", GITIGNORE_TEMPLATE);
|
|
203
219
|
}
|
|
204
|
-
const duration = Math.floor((process.uptime() - start) * 1000);
|
|
205
|
-
await (0, track_1.trackGA4)("product_init", { products_initialized: setup.features?.join(",") }, duration);
|
|
206
220
|
logger_1.logger.info();
|
|
207
221
|
utils.logSuccess("Firebase initialization complete!");
|
|
222
|
+
if (setup.instructions.length) {
|
|
223
|
+
logger_1.logger.info(`\n${clc.bold("To get started:")}\n`);
|
|
224
|
+
for (const i of setup.instructions) {
|
|
225
|
+
(0, utils_1.logBullet)(i + "\n");
|
|
226
|
+
}
|
|
227
|
+
}
|
|
208
228
|
}
|
|
209
229
|
exports.initAction = initAction;
|
|
@@ -8,6 +8,10 @@ const projectConfig_1 = require("../functions/projectConfig");
|
|
|
8
8
|
const adminSdkConfig_1 = require("../emulator/adminSdkConfig");
|
|
9
9
|
const projectUtils_1 = require("../projectUtils");
|
|
10
10
|
const error_1 = require("../error");
|
|
11
|
+
const ensureApiEnabled = require("../ensureApiEnabled");
|
|
12
|
+
const api_1 = require("../api");
|
|
13
|
+
const experiments = require("../experiments");
|
|
14
|
+
const prepareFunctionsUpload_1 = require("../deploy/functions/prepareFunctionsUpload");
|
|
11
15
|
exports.command = new command_1.Command("internaltesting:functions:discover")
|
|
12
16
|
.description("discover function triggers defined in the current project directory")
|
|
13
17
|
.action(async (options) => {
|
|
@@ -17,9 +21,20 @@ exports.command = new command_1.Command("internaltesting:functions:discover")
|
|
|
17
21
|
if (!firebaseConfig) {
|
|
18
22
|
throw new error_1.FirebaseError("Admin SDK config unexpectedly undefined - have you run firebase init?");
|
|
19
23
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
let runtimeConfig = { firebase: firebaseConfig };
|
|
25
|
+
const allowFunctionsConfig = experiments.isEnabled("dangerouslyAllowFunctionsConfig");
|
|
26
|
+
if (allowFunctionsConfig) {
|
|
27
|
+
try {
|
|
28
|
+
const runtimeConfigApiEnabled = await ensureApiEnabled.check(projectId, (0, api_1.runtimeconfigOrigin)(), "runtimeconfig", true);
|
|
29
|
+
if (runtimeConfigApiEnabled) {
|
|
30
|
+
runtimeConfig = { ...runtimeConfig, ...(await (0, prepareFunctionsUpload_1.getFunctionsConfig)(projectId)) };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
logger_1.logger.debug("Could not check Runtime Config API status, assuming disabled:", err);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const wantBuilds = await (0, prepare_1.loadCodebases)(fnConfig, options, firebaseConfig, runtimeConfig, undefined);
|
|
38
|
+
logger_1.logger.info(JSON.stringify(wantBuilds, null, 2));
|
|
39
|
+
return wantBuilds;
|
|
25
40
|
});
|
package/lib/commands/login.js
CHANGED
|
@@ -15,18 +15,22 @@ exports.command = new command_1.Command("login")
|
|
|
15
15
|
.option("--no-localhost", "login from a device without an accessible localhost")
|
|
16
16
|
.option("--reauth", "force reauthentication even if already logged in")
|
|
17
17
|
.action(async (options) => {
|
|
18
|
-
if (options.nonInteractive) {
|
|
18
|
+
if (options.nonInteractive && !options.prototyperLogin) {
|
|
19
19
|
throw new error_1.FirebaseError("Cannot run login in non-interactive mode. See " +
|
|
20
20
|
clc.bold("login:ci") +
|
|
21
21
|
" to generate a token for use in non-interactive environments.", { exit: 1 });
|
|
22
22
|
}
|
|
23
23
|
const user = options.user;
|
|
24
24
|
const tokens = options.tokens;
|
|
25
|
-
if (user && tokens && !options.reauth) {
|
|
25
|
+
if (user && tokens?.refresh_token && !options.reauth) {
|
|
26
26
|
logger_1.logger.info("Already logged in as", clc.bold(user.email));
|
|
27
27
|
return user;
|
|
28
28
|
}
|
|
29
|
-
if (
|
|
29
|
+
if (options.consent) {
|
|
30
|
+
options.consent?.metrics ?? configstore_1.configstore.set("usage", options.consent.metrics);
|
|
31
|
+
options.consent?.gemini ?? configstore_1.configstore.set("gemini", options.consent.gemini);
|
|
32
|
+
}
|
|
33
|
+
else if (!options.reauth && !options.prototyperLogin) {
|
|
30
34
|
utils.logBullet("The Firebase CLI’s MCP server feature can optionally make use of Gemini in Firebase. " +
|
|
31
35
|
"Learn more about Gemini in Firebase and how it uses your data: https://firebase.google.com/docs/gemini-in-firebase#how-gemini-in-firebase-uses-your-data");
|
|
32
36
|
const geminiUsage = await (0, prompt_1.confirm)("Enable Gemini in Firebase features?");
|
|
@@ -37,15 +41,15 @@ exports.command = new command_1.Command("login")
|
|
|
37
41
|
configstore_1.configstore.set("usage", collectUsage);
|
|
38
42
|
if (geminiUsage || collectUsage) {
|
|
39
43
|
logger_1.logger.info();
|
|
40
|
-
utils.logBullet("To change your
|
|
44
|
+
utils.logBullet("To change your preferences at any time, run `firebase logout` and `firebase login` again.");
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
|
-
|
|
47
|
+
if (options.prototyperLogin) {
|
|
48
|
+
return auth.loginPrototyper();
|
|
49
|
+
}
|
|
50
|
+
const useLocalhost = !(0, utils_1.isCloudEnvironment)() && !!options.localhost;
|
|
44
51
|
const result = await auth.loginGoogle(useLocalhost, user?.email);
|
|
45
|
-
|
|
46
|
-
configstore_1.configstore.set("tokens", result.tokens);
|
|
47
|
-
configstore_1.configstore.set("loginScopes", result.scopes);
|
|
48
|
-
configstore_1.configstore.delete("session");
|
|
52
|
+
auth.recordCredentials(result);
|
|
49
53
|
logger_1.logger.info();
|
|
50
54
|
if (typeof result.user !== "string") {
|
|
51
55
|
utils.logSuccess("Success! Logged in as " + clc.bold(result.user.email));
|