firebase-tools-with-isolate 13.15.0-0 → 13.26.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 +3 -1
- package/lib/apiv2.js +10 -3
- package/lib/appdistribution/client.js +62 -8
- package/lib/appdistribution/distribution.js +1 -1
- package/lib/apphosting/backend.js +299 -0
- package/lib/apphosting/config.js +31 -8
- package/lib/apphosting/githubConnections.js +70 -22
- package/lib/apphosting/index.js +3 -312
- package/lib/apphosting/rollout.js +138 -0
- package/lib/apphosting/secrets/index.js +70 -5
- package/lib/apphosting/utils.js +41 -0
- package/lib/apphosting/yaml.js +82 -0
- package/lib/archiveDirectory.js +1 -1
- package/lib/auth.js +31 -5
- package/lib/bin/firebase.js +2 -2
- package/lib/command.js +18 -4
- package/lib/commands/appdistribution-distribute.js +4 -4
- package/lib/commands/{appdistribution-group-create.js → appdistribution-groups-create.js} +2 -1
- package/lib/commands/{appdistribution-group-delete.js → appdistribution-groups-delete.js} +3 -2
- package/lib/commands/appdistribution-groups-list.js +55 -0
- package/lib/commands/appdistribution-testers-list.js +52 -0
- package/lib/commands/appdistribution-testers-remove.js +1 -1
- package/lib/commands/apphosting-backends-create.js +4 -4
- package/lib/commands/apphosting-backends-delete.js +7 -15
- package/lib/commands/apphosting-backends-get.js +1 -1
- package/lib/commands/apphosting-config-export.js +51 -0
- package/lib/commands/apphosting-repos-create.js +23 -0
- package/lib/commands/apphosting-rollouts-create.js +14 -15
- package/lib/commands/apphosting-secrets-grantaccess.js +2 -2
- package/lib/commands/database-import.js +4 -2
- package/lib/commands/database-push.js +4 -2
- package/lib/commands/database-set.js +4 -2
- package/lib/commands/database-settings-get.js +1 -1
- package/lib/commands/database-settings-set.js +1 -1
- package/lib/commands/dataconnect-sdk-generate.js +4 -1
- package/lib/commands/dataconnect-services-list.js +4 -3
- package/lib/commands/dataconnect-sql-diff.js +1 -1
- package/lib/commands/dataconnect-sql-grant.js +37 -0
- package/lib/commands/dataconnect-sql-migrate.js +1 -1
- package/lib/commands/dataconnect-sql-shell.js +115 -0
- package/lib/commands/deploy.js +5 -1
- package/lib/commands/emulators-start.js +4 -1
- package/lib/commands/ext-dev-init.js +2 -2
- package/lib/commands/ext-dev-list.js +1 -1
- package/lib/commands/ext-dev-register.js +2 -2
- package/lib/commands/ext-dev-upload.js +2 -2
- package/lib/commands/ext-dev-usage.js +2 -2
- package/lib/commands/ext-info.js +3 -1
- package/lib/commands/ext-install.js +2 -2
- package/lib/commands/ext-sdk-install.js +88 -0
- package/lib/commands/ext.js +1 -0
- package/lib/commands/firestore-databases-restore.js +39 -1
- package/lib/commands/functions-secrets-access.js +2 -4
- package/lib/commands/index.js +15 -2
- package/lib/commands/init.js +25 -15
- package/lib/commands/setup-emulators-dataconnect.js +0 -13
- package/lib/commands/use.js +1 -1
- package/lib/config.js +14 -4
- package/lib/crashlytics/buildToolsJarHelper.js +2 -2
- package/lib/dataconnect/client.js +3 -2
- package/lib/dataconnect/dataplaneClient.js +12 -9
- package/lib/dataconnect/ensureApis.js +6 -1
- package/lib/dataconnect/fileUtils.js +29 -12
- package/lib/dataconnect/freeTrial.js +45 -9
- package/lib/dataconnect/load.js +3 -1
- package/lib/dataconnect/provisionCloudSql.js +41 -24
- package/lib/dataconnect/schemaMigration.js +215 -74
- package/lib/dataconnect/types.js +4 -1
- package/lib/dataconnect/webhook.js +32 -0
- package/lib/deploy/dataconnect/deploy.js +18 -15
- package/lib/deploy/dataconnect/prepare.js +41 -0
- package/lib/deploy/dataconnect/release.js +16 -7
- package/lib/deploy/extensions/deploy.js +3 -1
- package/lib/deploy/extensions/deploymentSummary.js +7 -3
- package/lib/deploy/extensions/planner.js +95 -5
- package/lib/deploy/extensions/prepare.js +89 -42
- package/lib/deploy/extensions/release.js +17 -10
- package/lib/deploy/extensions/tasks.js +32 -21
- package/lib/deploy/firestore/prepare.js +9 -0
- package/lib/deploy/firestore/release.js +3 -6
- package/lib/deploy/functions/build.js +5 -5
- package/lib/deploy/functions/checkIam.js +7 -2
- package/lib/deploy/functions/deploy.js +12 -12
- package/lib/deploy/functions/ensure.js +11 -3
- package/lib/deploy/functions/params.js +5 -3
- package/lib/deploy/functions/prepare.js +18 -3
- package/lib/deploy/functions/release/index.js +4 -0
- package/lib/deploy/functions/release/planner.js +2 -1
- package/lib/deploy/functions/runtimes/discovery/index.js +6 -2
- package/lib/deploy/functions/runtimes/discovery/parsing.js +1 -1
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +46 -0
- package/lib/deploy/functions/runtimes/node/index.js +5 -0
- package/lib/deploy/functions/services/auth.js +34 -3
- package/lib/deploy/functions/services/index.js +2 -0
- package/lib/deploy/index.js +8 -5
- package/lib/deploy/lifecycleHooks.js +2 -1
- package/lib/emulator/apphosting/config.js +27 -0
- package/lib/emulator/apphosting/index.js +38 -0
- package/lib/emulator/apphosting/serve.js +50 -0
- package/lib/emulator/apphosting/utils.js +18 -0
- package/lib/emulator/auth/handlers.js +27 -0
- package/lib/emulator/auth/operations.js +41 -2
- package/lib/emulator/auth/state.js +2 -1
- package/lib/emulator/commandUtils.js +8 -3
- package/lib/emulator/constants.js +11 -1
- package/lib/emulator/controller.js +59 -6
- package/lib/emulator/dataconnect/pg-gateway/auth/base-auth-flow.js +11 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/cert.js +58 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/index.js +22 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/md5.js +124 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/password.js +54 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/sasl/sasl-mechanism.js +34 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/sasl/scram-sha-256.js +270 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/trust.js +2 -0
- package/lib/emulator/dataconnect/pg-gateway/backend-error.js +75 -0
- package/lib/emulator/dataconnect/pg-gateway/buffer-reader.js +54 -0
- package/lib/emulator/dataconnect/pg-gateway/buffer-writer.js +79 -0
- package/lib/emulator/dataconnect/pg-gateway/connection.js +315 -0
- package/lib/emulator/dataconnect/pg-gateway/connection.types.js +8 -0
- package/lib/emulator/dataconnect/pg-gateway/crypto.js +40 -0
- package/lib/emulator/dataconnect/pg-gateway/duplex.js +53 -0
- package/lib/emulator/dataconnect/pg-gateway/index.js +27 -0
- package/lib/emulator/dataconnect/pg-gateway/message-buffer.js +82 -0
- package/lib/emulator/dataconnect/pg-gateway/message-codes.js +52 -0
- package/lib/emulator/dataconnect/pg-gateway/platforms/node/index.js +16 -0
- package/lib/emulator/dataconnect/pg-gateway/polyfills/readable-stream-async-iterator.js +35 -0
- package/lib/emulator/dataconnect/pg-gateway/utils.js +40 -0
- package/lib/emulator/dataconnect/pgliteServer.js +95 -0
- package/lib/emulator/dataconnectEmulator.js +58 -75
- package/lib/emulator/dataconnectToolkitController.js +44 -0
- package/lib/emulator/downloadableEmulators.js +30 -19
- package/lib/emulator/emulatorLogger.js +3 -0
- package/lib/emulator/env.js +3 -0
- package/lib/emulator/eventarcEmulator.js +1 -1
- package/lib/emulator/extensionsEmulator.js +38 -6
- package/lib/emulator/functionsEmulator.js +115 -42
- package/lib/emulator/functionsEmulatorShared.js +18 -1
- package/lib/emulator/functionsRuntimeWorker.js +2 -1
- package/lib/emulator/hub.js +13 -9
- package/lib/emulator/hubExport.js +10 -3
- package/lib/emulator/loggingEmulator.js +2 -2
- package/lib/emulator/portUtils.js +11 -11
- package/lib/emulator/registry.js +2 -0
- package/lib/emulator/storage/persistence.js +2 -2
- package/lib/emulator/storage/rules/runtime.js +1 -1
- package/lib/emulator/taskQueue.js +348 -0
- package/lib/emulator/tasksEmulator.js +240 -0
- package/lib/emulator/types.js +6 -0
- package/lib/emulator/ui.js +51 -25
- package/lib/error.js +31 -1
- package/lib/experiments.js +5 -0
- package/lib/extensions/askUserForEventsConfig.js +18 -8
- package/lib/extensions/askUserForParam.js +2 -1
- package/lib/extensions/displayExtensionInfo.js +5 -5
- package/lib/extensions/emulator/triggerHelper.js +1 -1
- package/lib/extensions/extensionsApi.js +15 -11
- package/lib/extensions/extensionsHelper.js +39 -8
- package/lib/extensions/localHelper.js +32 -1
- package/lib/extensions/refs.js +26 -11
- package/lib/extensions/runtimes/common.js +215 -0
- package/lib/extensions/runtimes/node.js +401 -0
- package/lib/extensions/types.js +67 -1
- package/lib/extensions/warnings.js +5 -2
- package/lib/firestore/api.js +2 -1
- package/lib/firestore/checkDatabaseType.js +10 -3
- package/lib/firestore/delete.js +11 -0
- package/lib/firestore/options.js +7 -0
- package/lib/frameworks/angular/index.js +15 -3
- package/lib/frameworks/constants.js +2 -2
- package/lib/frameworks/flutter/index.js +6 -6
- package/lib/frameworks/flutter/utils.js +34 -1
- package/lib/frameworks/next/constants.js +1 -1
- package/lib/frameworks/next/index.js +45 -17
- package/lib/frameworks/next/utils.js +57 -4
- package/lib/frameworks/vite/index.js +2 -2
- package/lib/fsutils.js +13 -1
- package/lib/functions/constants.js +4 -0
- package/lib/functions/events/v1.js +9 -2
- package/lib/gcp/apphosting.js +1 -1
- package/lib/gcp/cloudmonitoring.js +3 -3
- package/lib/gcp/cloudsql/cloudsqladmin.js +32 -20
- package/lib/gcp/cloudsql/connect.js +49 -37
- package/lib/gcp/cloudsql/interactive.js +49 -0
- package/lib/gcp/cloudsql/permissions.js +165 -0
- package/lib/gcp/devConnect.js +38 -1
- package/lib/gcp/firestore.js +5 -1
- package/lib/gcp/secretManager.js +12 -5
- package/lib/getProjectNumber.js +1 -1
- package/lib/init/features/apphosting.js +15 -0
- package/lib/init/features/dataconnect/index.js +166 -121
- package/lib/init/features/dataconnect/sdk.js +90 -81
- package/lib/init/features/emulators.js +2 -15
- package/lib/init/features/firestore/index.js +20 -1
- package/lib/init/features/firestore/indexes.js +4 -4
- package/lib/init/features/genkit/index.js +444 -0
- package/lib/init/features/hosting/index.js +2 -2
- package/lib/init/features/index.js +1 -1
- package/lib/init/features/project.js +6 -6
- package/lib/init/features/storage.js +0 -2
- package/lib/init/index.js +1 -0
- package/lib/init/spawn.js +23 -2
- package/lib/logger.js +2 -2
- package/lib/management/projects.js +24 -4
- package/lib/projectUtils.js +1 -1
- package/lib/prompt.js +22 -1
- package/lib/rc.js +1 -8
- package/lib/requireAuth.js +19 -5
- package/lib/requireDatabaseInstance.js +1 -1
- package/lib/requirePermissions.js +1 -1
- package/lib/responseToError.js +5 -2
- package/lib/rulesDeploy.js +1 -1
- package/lib/templates.js +2 -2
- package/lib/utils.js +16 -11
- package/lib/vsCodeUtils.js +8 -0
- package/package.json +8 -7
- package/schema/connector-yaml.json +57 -17
- package/schema/firebase-config.json +36 -0
- package/templates/extensions/javascript/package.lint.json +2 -2
- package/templates/extensions/javascript/package.nolint.json +2 -2
- package/templates/extensions/typescript/package.lint.json +2 -2
- package/templates/extensions/typescript/package.nolint.json +2 -2
- package/templates/genkit/firebase.0.9.0.template +57 -0
- package/templates/init/apphosting/apphosting.yaml +23 -0
- package/templates/init/dataconnect/connector.yaml +4 -3
- package/templates/init/dataconnect/dataconnect-fdccompatiblemode.yaml +12 -0
- package/templates/init/dataconnect/dataconnect.yaml +6 -6
- package/templates/init/dataconnect/mutations.gql +44 -29
- package/templates/init/dataconnect/queries.gql +65 -38
- package/templates/init/dataconnect/schema.gql +38 -21
- package/templates/init/functions/javascript/package.lint.json +2 -2
- package/templates/init/functions/javascript/package.nolint.json +2 -2
- package/templates/init/functions/typescript/package.lint.json +2 -2
- package/templates/init/functions/typescript/package.nolint.json +2 -2
- package/lib/ensureCloudResourceLocation.js +0 -12
- package/lib/init/features/genkit.js +0 -53
|
@@ -8,7 +8,7 @@ const prompt_1 = require("../prompt");
|
|
|
8
8
|
const utils = require("../utils");
|
|
9
9
|
const apphosting = require("../gcp/apphosting");
|
|
10
10
|
const apphosting_backends_list_1 = require("./apphosting-backends-list");
|
|
11
|
-
const
|
|
11
|
+
const backend_1 = require("../apphosting/backend");
|
|
12
12
|
const ora = require("ora");
|
|
13
13
|
exports.command = new command_1.Command("apphosting:backends:delete <backend>")
|
|
14
14
|
.description("delete a Firebase App Hosting backend")
|
|
@@ -20,11 +20,11 @@ exports.command = new command_1.Command("apphosting:backends:delete <backend>")
|
|
|
20
20
|
let location = options.location;
|
|
21
21
|
let backend;
|
|
22
22
|
if (location === "-" || location === "") {
|
|
23
|
-
backend = await (0,
|
|
23
|
+
backend = await (0, backend_1.getBackendForAmbiguousLocation)(projectId, backendId, "Please select the location of the backend you'd like to delete:");
|
|
24
24
|
location = apphosting.parseBackendName(backend.name).location;
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
backend = await getBackendForLocation(projectId, location, backendId);
|
|
27
|
+
backend = await (0, backend_1.getBackendForLocation)(projectId, location, backendId);
|
|
28
28
|
}
|
|
29
29
|
utils.logWarning("You are about to permanently delete this backend:");
|
|
30
30
|
(0, apphosting_backends_list_1.printBackendsTable)([backend]);
|
|
@@ -39,21 +39,13 @@ exports.command = new command_1.Command("apphosting:backends:delete <backend>")
|
|
|
39
39
|
}
|
|
40
40
|
const spinner = ora("Deleting backend...").start();
|
|
41
41
|
try {
|
|
42
|
-
await (0,
|
|
42
|
+
await (0, backend_1.deleteBackendAndPoll)(projectId, location, backendId);
|
|
43
43
|
spinner.succeed(`Successfully deleted the backend: ${backendId}`);
|
|
44
44
|
}
|
|
45
45
|
catch (err) {
|
|
46
46
|
spinner.stop();
|
|
47
|
-
throw new error_1.FirebaseError(`Failed to delete backend: ${backendId}.`, {
|
|
48
|
-
|
|
49
|
-
});
|
|
50
|
-
async function getBackendForLocation(projectId, location, backendId) {
|
|
51
|
-
try {
|
|
52
|
-
return await apphosting.getBackend(projectId, location, backendId);
|
|
53
|
-
}
|
|
54
|
-
catch (err) {
|
|
55
|
-
throw new error_1.FirebaseError(`No backend named "${backendId}" found in ${location}.`, {
|
|
56
|
-
original: err,
|
|
47
|
+
throw new error_1.FirebaseError(`Failed to delete backend: ${backendId}.`, {
|
|
48
|
+
original: (0, error_1.getError)(err),
|
|
57
49
|
});
|
|
58
50
|
}
|
|
59
|
-
}
|
|
51
|
+
});
|
|
@@ -27,7 +27,7 @@ exports.command = new command_1.Command("apphosting:backends:get <backend>")
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
catch (err) {
|
|
30
|
-
throw new error_1.FirebaseError(`Failed to get backend: ${backend}. Please check the parameters you have provided.`, { original: err });
|
|
30
|
+
throw new error_1.FirebaseError(`Failed to get backend: ${backend}. Please check the parameters you have provided.`, { original: (0, error_1.getError)(err) });
|
|
31
31
|
}
|
|
32
32
|
if (backendsList.length === 0) {
|
|
33
33
|
(0, utils_1.logWarning)(`Backend "${backend}" not found`);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const logger_1 = require("../logger");
|
|
6
|
+
const projectUtils_1 = require("../projectUtils");
|
|
7
|
+
const requireAuth_1 = require("../requireAuth");
|
|
8
|
+
const secretManager = require("../gcp/secretManager");
|
|
9
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
10
|
+
const config_1 = require("../apphosting/config");
|
|
11
|
+
const secrets_1 = require("../apphosting/secrets");
|
|
12
|
+
const path_1 = require("path");
|
|
13
|
+
const fs = require("../fsutils");
|
|
14
|
+
const yaml_1 = require("../apphosting/yaml");
|
|
15
|
+
const error_1 = require("../error");
|
|
16
|
+
exports.command = new command_1.Command("apphosting:config:export")
|
|
17
|
+
.description("Export App Hosting configurations such as secrets into an apphosting.local.yaml file")
|
|
18
|
+
.option("-s, --secrets <apphosting.yaml or apphosting.<environment>.yaml file to export secrets from>", "This command combines the base apphosting.yaml with the specified environment-specific file (e.g., apphosting.staging.yaml). If keys conflict, the environment-specific file takes precedence.")
|
|
19
|
+
.before(requireAuth_1.requireAuth)
|
|
20
|
+
.before(secretManager.ensureApi)
|
|
21
|
+
.before(requirePermissions_1.requirePermissions, ["secretmanager.versions.access"])
|
|
22
|
+
.action(async (options) => {
|
|
23
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
24
|
+
const environmentConfigFile = options.secrets;
|
|
25
|
+
const cwd = process.cwd();
|
|
26
|
+
let localAppHostingConfig = yaml_1.AppHostingYamlConfig.empty();
|
|
27
|
+
const backendRoot = (0, config_1.discoverBackendRoot)(cwd);
|
|
28
|
+
if (!backendRoot) {
|
|
29
|
+
throw new error_1.FirebaseError("Missing apphosting.yaml: This command requires an apphosting.yaml configuration file. Please run 'firebase init apphosting' and try again.");
|
|
30
|
+
}
|
|
31
|
+
const localAppHostingConfigPath = (0, path_1.resolve)(backendRoot, config_1.APPHOSTING_LOCAL_YAML_FILE);
|
|
32
|
+
if (fs.fileExistsSync(localAppHostingConfigPath)) {
|
|
33
|
+
localAppHostingConfig = await yaml_1.AppHostingYamlConfig.loadFromFile(localAppHostingConfigPath);
|
|
34
|
+
}
|
|
35
|
+
const configToExport = await (0, secrets_1.loadConfigToExport)(cwd, environmentConfigFile);
|
|
36
|
+
const secretsToExport = configToExport.secrets;
|
|
37
|
+
if (!secretsToExport) {
|
|
38
|
+
logger_1.logger.warn("No secrets found to export in the chosen App Hosting config files");
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const secretMaterial = await (0, secrets_1.fetchSecrets)(projectId, secretsToExport);
|
|
42
|
+
for (const [key, value] of secretMaterial) {
|
|
43
|
+
localAppHostingConfig.addEnvironmentVariable({
|
|
44
|
+
variable: key,
|
|
45
|
+
value: value,
|
|
46
|
+
availability: ["RUNTIME"],
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
localAppHostingConfig.upsertFile(localAppHostingConfigPath);
|
|
50
|
+
logger_1.logger.info(`Wrote secrets as environment variables to ${config_1.APPHOSTING_LOCAL_YAML_FILE}.`);
|
|
51
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const projectUtils_1 = require("../projectUtils");
|
|
6
|
+
const requireInteractive_1 = require("../requireInteractive");
|
|
7
|
+
const backend_1 = require("../apphosting/backend");
|
|
8
|
+
const apphosting_1 = require("../gcp/apphosting");
|
|
9
|
+
const firedata_1 = require("../gcp/firedata");
|
|
10
|
+
const requireTosAcceptance_1 = require("../requireTosAcceptance");
|
|
11
|
+
exports.command = new command_1.Command("apphosting:repos:create")
|
|
12
|
+
.description("create a Firebase App Hosting Developer Connect Git Repository Link")
|
|
13
|
+
.option("-l, --location <location>", "specify the location of the backend", "")
|
|
14
|
+
.option("-g, --gitconnection <connection>", "id of the connection", "")
|
|
15
|
+
.before(apphosting_1.ensureApiEnabled)
|
|
16
|
+
.before(requireInteractive_1.default)
|
|
17
|
+
.before((0, requireTosAcceptance_1.requireTosAcceptance)(firedata_1.APPHOSTING_TOS_ID))
|
|
18
|
+
.action(async (options) => {
|
|
19
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
20
|
+
const location = options.location;
|
|
21
|
+
const connection = options.gitconnection;
|
|
22
|
+
await (0, backend_1.createGitRepoLink)(projectId, location, connection);
|
|
23
|
+
});
|
|
@@ -2,25 +2,24 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.command = void 0;
|
|
4
4
|
const apphosting = require("../gcp/apphosting");
|
|
5
|
-
const logger_1 = require("../logger");
|
|
6
5
|
const command_1 = require("../command");
|
|
7
6
|
const projectUtils_1 = require("../projectUtils");
|
|
8
|
-
|
|
7
|
+
const error_1 = require("../error");
|
|
8
|
+
const rollout_1 = require("../apphosting/rollout");
|
|
9
|
+
exports.command = new command_1.Command("apphosting:rollouts:create <backendId>")
|
|
9
10
|
.description("create a rollout using a build for an App Hosting backend")
|
|
10
|
-
.option("-l, --location <location>", "specify the region of the backend", "
|
|
11
|
-
.option("-
|
|
11
|
+
.option("-l, --location <location>", "specify the region of the backend", "-")
|
|
12
|
+
.option("-b, --git-branch <gitBranch>", "repository branch to deploy (mutually exclusive with -g)")
|
|
13
|
+
.option("-g, --git-commit <gitCommit>", "git commit to deploy (mutually exclusive with -b)")
|
|
14
|
+
.withForce("Skip confirmation before creating rollout")
|
|
12
15
|
.before(apphosting.ensureApiEnabled)
|
|
13
|
-
.action(async (backendId,
|
|
16
|
+
.action(async (backendId, options) => {
|
|
14
17
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
15
18
|
const location = options.location;
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
logger_1.logger.info(`Started a rollout for backend ${backendId} with build ${buildId}.`);
|
|
23
|
-
logger_1.logger.info("Check status by running:");
|
|
24
|
-
logger_1.logger.info(`\tfirebase apphosting:rollouts:list --location ${location}`);
|
|
25
|
-
return op;
|
|
19
|
+
const branch = options.gitBranch;
|
|
20
|
+
const commit = options.gitCommit;
|
|
21
|
+
if (branch && commit) {
|
|
22
|
+
throw new error_1.FirebaseError("Cannot specify both a branch and commit to deploy. Please specify either --git-branch or --git-commit.");
|
|
23
|
+
}
|
|
24
|
+
await (0, rollout_1.createRollout)(backendId, projectId, location, branch, commit, options.force);
|
|
26
25
|
});
|
|
@@ -9,7 +9,7 @@ const secretManager = require("../gcp/secretManager");
|
|
|
9
9
|
const requirePermissions_1 = require("../requirePermissions");
|
|
10
10
|
const apphosting = require("../gcp/apphosting");
|
|
11
11
|
const secrets = require("../apphosting/secrets");
|
|
12
|
-
const
|
|
12
|
+
const backend_1 = require("../apphosting/backend");
|
|
13
13
|
exports.command = new command_1.Command("apphosting:secrets:grantaccess <secretName>")
|
|
14
14
|
.description("grant service accounts permissions to the provided secret")
|
|
15
15
|
.option("-l, --location <location>", "backend location", "-")
|
|
@@ -39,7 +39,7 @@ exports.command = new command_1.Command("apphosting:secrets:grantaccess <secretN
|
|
|
39
39
|
const location = options.location;
|
|
40
40
|
let backend;
|
|
41
41
|
if (location === "" || location === "-") {
|
|
42
|
-
backend = await (0,
|
|
42
|
+
backend = await (0, backend_1.getBackendForAmbiguousLocation)(projectId, backendId, "Please select the location of your backend:");
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
45
|
backend = await apphosting.getBackend(projectId, location, backendId);
|
|
@@ -71,8 +71,10 @@ exports.command = new command_1.Command("database:import <path> [infile]")
|
|
|
71
71
|
if (err instanceof error_1.FirebaseError) {
|
|
72
72
|
throw err;
|
|
73
73
|
}
|
|
74
|
-
logger_1.logger.debug(err);
|
|
75
|
-
throw new error_1.FirebaseError(`Unexpected error while importing data: ${err}`, {
|
|
74
|
+
logger_1.logger.debug((0, error_1.getErrMsg)(err));
|
|
75
|
+
throw new error_1.FirebaseError(`Unexpected error while importing data: ${(0, error_1.getErrMsg)(err)}`, {
|
|
76
|
+
exit: 2,
|
|
77
|
+
});
|
|
76
78
|
}
|
|
77
79
|
if (responses.length) {
|
|
78
80
|
utils.logSuccess("Data persisted successfully");
|
|
@@ -49,8 +49,10 @@ exports.command = new command_1.Command("database:push <path> [infile]")
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
catch (err) {
|
|
52
|
-
logger_1.logger.debug(err);
|
|
53
|
-
throw new error_1.FirebaseError(`Unexpected error while pushing data: ${err}`, {
|
|
52
|
+
logger_1.logger.debug((0, error_1.getErrMsg)(err));
|
|
53
|
+
throw new error_1.FirebaseError(`Unexpected error while pushing data: ${(0, error_1.getErrMsg)(err)}`, {
|
|
54
|
+
exit: 2,
|
|
55
|
+
});
|
|
54
56
|
}
|
|
55
57
|
if (!path.endsWith("/")) {
|
|
56
58
|
path += "/";
|
|
@@ -59,8 +59,10 @@ exports.command = new command_1.Command("database:set <path> [infile]")
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
catch (err) {
|
|
62
|
-
logger_1.logger.debug(err);
|
|
63
|
-
throw new error_1.FirebaseError(`Unexpected error while setting data: ${err}`, {
|
|
62
|
+
logger_1.logger.debug((0, error_1.getErrMsg)(err));
|
|
63
|
+
throw new error_1.FirebaseError(`Unexpected error while setting data: ${(0, error_1.getErrMsg)(err)}`, {
|
|
64
|
+
exit: 2,
|
|
65
|
+
});
|
|
64
66
|
}
|
|
65
67
|
utils.logSuccess("Data persisted successfully");
|
|
66
68
|
logger_1.logger.info();
|
|
@@ -34,7 +34,7 @@ exports.command = new command_1.Command("database:settings:get <path>")
|
|
|
34
34
|
catch (err) {
|
|
35
35
|
throw new error_1.FirebaseError(`Unexpected error fetching configs at ${path}`, {
|
|
36
36
|
exit: 2,
|
|
37
|
-
original: err,
|
|
37
|
+
original: (0, error_1.getError)(err),
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
if (typeof res.body === "object") {
|
|
@@ -38,7 +38,7 @@ exports.command = new command_1.Command("database:settings:set <path> <value>")
|
|
|
38
38
|
catch (err) {
|
|
39
39
|
throw new error_1.FirebaseError(`Unexpected error fetching configs at ${path}`, {
|
|
40
40
|
exit: 2,
|
|
41
|
-
original: err,
|
|
41
|
+
original: (0, error_1.getError)(err),
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
utils.logSuccess("Successfully set setting.");
|
|
@@ -10,6 +10,7 @@ const fileUtils_1 = require("../dataconnect/fileUtils");
|
|
|
10
10
|
const logger_1 = require("../logger");
|
|
11
11
|
exports.command = new command_1.Command("dataconnect:sdk:generate")
|
|
12
12
|
.description("generates typed SDKs for your Data Connect connectors")
|
|
13
|
+
.option("--watch", "watch for changes to your connector GQL files and regenerate your SDKs when updates occur")
|
|
13
14
|
.action(async (options) => {
|
|
14
15
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
15
16
|
const services = (0, fileUtils_1.readFirebaseJson)(options.config);
|
|
@@ -19,7 +20,8 @@ exports.command = new command_1.Command("dataconnect:sdk:generate")
|
|
|
19
20
|
const hasGeneratables = serviceInfo.connectorInfo.some((c) => {
|
|
20
21
|
return (c.connectorYaml.generate?.javascriptSdk ||
|
|
21
22
|
c.connectorYaml.generate?.kotlinSdk ||
|
|
22
|
-
c.connectorYaml.generate?.swiftSdk
|
|
23
|
+
c.connectorYaml.generate?.swiftSdk ||
|
|
24
|
+
c.connectorYaml.generate?.dartSdk);
|
|
23
25
|
});
|
|
24
26
|
if (!hasGeneratables) {
|
|
25
27
|
logger_1.logger.warn("No generated SDKs have been declared in connector.yaml files.");
|
|
@@ -31,6 +33,7 @@ exports.command = new command_1.Command("dataconnect:sdk:generate")
|
|
|
31
33
|
const output = await dataconnectEmulator_1.DataConnectEmulator.generate({
|
|
32
34
|
configDir,
|
|
33
35
|
connectorId: conn.connectorYaml.connectorId,
|
|
36
|
+
watch: options.watch,
|
|
34
37
|
});
|
|
35
38
|
logger_1.logger.info(output);
|
|
36
39
|
logger_1.logger.info(`Generated SDKs for ${conn.connectorYaml.connectorId}`);
|
|
@@ -35,14 +35,15 @@ exports.command = new command_1.Command("dataconnect:services:list")
|
|
|
35
35
|
for (const service of services) {
|
|
36
36
|
const schema = (await client.getSchema(service.name)) ?? {
|
|
37
37
|
name: "",
|
|
38
|
-
|
|
38
|
+
datasources: [{}],
|
|
39
39
|
source: { files: [] },
|
|
40
40
|
};
|
|
41
41
|
const connectors = await client.listConnectors(service.name);
|
|
42
42
|
const serviceName = names.parseServiceName(service.name);
|
|
43
|
-
const
|
|
43
|
+
const postgresDatasource = schema?.datasources.find((d) => d.postgresql);
|
|
44
|
+
const instanceName = postgresDatasource?.postgresql?.cloudSql.instance ?? "";
|
|
44
45
|
const instanceId = instanceName.split("/").pop();
|
|
45
|
-
const dbId =
|
|
46
|
+
const dbId = postgresDatasource?.postgresql?.database ?? "";
|
|
46
47
|
const dbName = `CloudSQL Instance: ${instanceId}\nDatabase: ${dbId}`;
|
|
47
48
|
table.push([
|
|
48
49
|
serviceName.serviceId,
|
|
@@ -20,6 +20,6 @@ exports.command = new command_1.Command("dataconnect:sql:diff [serviceId]")
|
|
|
20
20
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
21
21
|
await (0, ensureApis_1.ensureApis)(projectId);
|
|
22
22
|
const serviceInfo = await (0, fileUtils_1.pickService)(projectId, options.config, serviceId);
|
|
23
|
-
const diffs = await (0, schemaMigration_1.diffSchema)(serviceInfo.schema);
|
|
23
|
+
const diffs = await (0, schemaMigration_1.diffSchema)(serviceInfo.schema, serviceInfo.dataConnectYaml.schema.datasource.postgresql?.schemaValidation);
|
|
24
24
|
return { projectId, serviceId, diffs };
|
|
25
25
|
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const projectUtils_1 = require("../projectUtils");
|
|
6
|
+
const ensureApis_1 = require("../dataconnect/ensureApis");
|
|
7
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
8
|
+
const fileUtils_1 = require("../dataconnect/fileUtils");
|
|
9
|
+
const schemaMigration_1 = require("../dataconnect/schemaMigration");
|
|
10
|
+
const requireAuth_1 = require("../requireAuth");
|
|
11
|
+
const error_1 = require("../error");
|
|
12
|
+
const permissions_1 = require("../gcp/cloudsql/permissions");
|
|
13
|
+
const allowedRoles = Object.keys(permissions_1.fdcSqlRoleMap);
|
|
14
|
+
exports.command = new command_1.Command("dataconnect:sql:grant [serviceId]")
|
|
15
|
+
.description("Grants the SQL role <role> to the provided user or service account <email>.")
|
|
16
|
+
.option("-R, --role <role>", "The SQL role to grant. One of: owner, writer, or reader.")
|
|
17
|
+
.option("-E, --email <email>", "The email of the user or service account we would like to grant the role to.")
|
|
18
|
+
.before(requirePermissions_1.requirePermissions, ["firebasedataconnect.services.list"])
|
|
19
|
+
.before(requireAuth_1.requireAuth)
|
|
20
|
+
.action(async (serviceId, options) => {
|
|
21
|
+
const role = options.role;
|
|
22
|
+
const email = options.email;
|
|
23
|
+
if (!role) {
|
|
24
|
+
throw new error_1.FirebaseError("-R, --role <role> is required. Run the command with -h for more info.");
|
|
25
|
+
}
|
|
26
|
+
if (!email) {
|
|
27
|
+
throw new error_1.FirebaseError("-E, --email <email> is required. Run the command with -h for more info.");
|
|
28
|
+
}
|
|
29
|
+
if (!allowedRoles.includes(role.toLowerCase())) {
|
|
30
|
+
throw new error_1.FirebaseError(`Role should be one of ${allowedRoles.join(" | ")}.`);
|
|
31
|
+
}
|
|
32
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
33
|
+
await (0, ensureApis_1.ensureApis)(projectId);
|
|
34
|
+
const serviceInfo = await (0, fileUtils_1.pickService)(projectId, options.config, serviceId);
|
|
35
|
+
await (0, schemaMigration_1.grantRoleToUserInSchema)(options, serviceInfo.schema);
|
|
36
|
+
return { projectId, serviceId };
|
|
37
|
+
});
|
|
@@ -17,7 +17,6 @@ exports.command = new command_1.Command("dataconnect:sql:migrate [serviceId]")
|
|
|
17
17
|
"firebasedataconnect.schemas.list",
|
|
18
18
|
"firebasedataconnect.schemas.update",
|
|
19
19
|
"cloudsql.instances.connect",
|
|
20
|
-
"cloudsql.users.create",
|
|
21
20
|
])
|
|
22
21
|
.before(requireAuth_1.requireAuth)
|
|
23
22
|
.withForce("Execute any required database changes without prompting")
|
|
@@ -33,6 +32,7 @@ exports.command = new command_1.Command("dataconnect:sql:migrate [serviceId]")
|
|
|
33
32
|
options,
|
|
34
33
|
schema: serviceInfo.schema,
|
|
35
34
|
validateOnly: true,
|
|
35
|
+
schemaValidation: serviceInfo.dataConnectYaml.schema.datasource.postgresql?.schemaValidation,
|
|
36
36
|
});
|
|
37
37
|
if (diffs.length) {
|
|
38
38
|
(0, utils_1.logLabeledSuccess)("dataconnect", `Database schema sucessfully migrated! Run 'firebase deploy' to deploy your new schema to your Data Connect service.`);
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const pg = require("pg");
|
|
5
|
+
const clc = require("colorette");
|
|
6
|
+
const cloud_sql_connector_1 = require("@google-cloud/cloud-sql-connector");
|
|
7
|
+
const command_1 = require("../command");
|
|
8
|
+
const projectUtils_1 = require("../projectUtils");
|
|
9
|
+
const ensureApis_1 = require("../dataconnect/ensureApis");
|
|
10
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
11
|
+
const fileUtils_1 = require("../dataconnect/fileUtils");
|
|
12
|
+
const schemaMigration_1 = require("../dataconnect/schemaMigration");
|
|
13
|
+
const requireAuth_1 = require("../requireAuth");
|
|
14
|
+
const connect_1 = require("../gcp/cloudsql/connect");
|
|
15
|
+
const cloudSqlAdminClient = require("../gcp/cloudsql/cloudsqladmin");
|
|
16
|
+
const prompt_1 = require("../prompt");
|
|
17
|
+
const logger_1 = require("../logger");
|
|
18
|
+
const error_1 = require("../error");
|
|
19
|
+
const fbToolsAuthClient_1 = require("../gcp/cloudsql/fbToolsAuthClient");
|
|
20
|
+
const interactive_1 = require("../gcp/cloudsql/interactive");
|
|
21
|
+
const sqlKeywords = [
|
|
22
|
+
"SELECT",
|
|
23
|
+
"FROM",
|
|
24
|
+
"WHERE",
|
|
25
|
+
"INSERT",
|
|
26
|
+
"UPDATE",
|
|
27
|
+
"DELETE",
|
|
28
|
+
"JOIN",
|
|
29
|
+
"GROUP",
|
|
30
|
+
"ORDER",
|
|
31
|
+
"LIMIT",
|
|
32
|
+
"GRANT",
|
|
33
|
+
"CREATE",
|
|
34
|
+
"DROP",
|
|
35
|
+
];
|
|
36
|
+
async function promptForQuery() {
|
|
37
|
+
let query = "";
|
|
38
|
+
let line = "";
|
|
39
|
+
do {
|
|
40
|
+
const question = {
|
|
41
|
+
type: "input",
|
|
42
|
+
name: "line",
|
|
43
|
+
message: query ? "> " : "Enter your SQL query (or '.exit'):",
|
|
44
|
+
transformer: (input) => {
|
|
45
|
+
return input
|
|
46
|
+
.split(" ")
|
|
47
|
+
.map((word) => (sqlKeywords.includes(word.toUpperCase()) ? clc.cyan(word) : word))
|
|
48
|
+
.join(" ");
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
({ line } = await (0, prompt_1.prompt)({ nonInteractive: false }, [question]));
|
|
52
|
+
line = line.trimEnd();
|
|
53
|
+
if (line.toLowerCase() === ".exit") {
|
|
54
|
+
return ".exit";
|
|
55
|
+
}
|
|
56
|
+
query += (query ? "\n" : "") + line;
|
|
57
|
+
} while (line !== "" && !query.endsWith(";"));
|
|
58
|
+
return query;
|
|
59
|
+
}
|
|
60
|
+
async function mainShellLoop(conn) {
|
|
61
|
+
while (true) {
|
|
62
|
+
const query = await promptForQuery();
|
|
63
|
+
if (query.toLowerCase() === ".exit") {
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
if (query === "") {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (await (0, interactive_1.confirmDangerousQuery)(query)) {
|
|
70
|
+
await (0, interactive_1.interactiveExecuteQuery)(query, conn);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
logger_1.logger.info(clc.yellow("Query cancelled."));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.command = new command_1.Command("dataconnect:sql:shell [serviceId]")
|
|
78
|
+
.description("Starts a shell connected directly to your dataconnect cloudsql instance.")
|
|
79
|
+
.before(requirePermissions_1.requirePermissions, ["firebasedataconnect.services.list", "cloudsql.instances.connect"])
|
|
80
|
+
.before(requireAuth_1.requireAuth)
|
|
81
|
+
.action(async (serviceId, options) => {
|
|
82
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
83
|
+
await (0, ensureApis_1.ensureApis)(projectId);
|
|
84
|
+
const serviceInfo = await (0, fileUtils_1.pickService)(projectId, options.config, serviceId);
|
|
85
|
+
const { instanceId, databaseId } = (0, schemaMigration_1.getIdentifiers)(serviceInfo.schema);
|
|
86
|
+
const { user: username } = await (0, connect_1.getIAMUser)(options);
|
|
87
|
+
const instance = await cloudSqlAdminClient.getInstance(projectId, instanceId);
|
|
88
|
+
const connectionName = instance.connectionName;
|
|
89
|
+
if (!connectionName) {
|
|
90
|
+
throw new error_1.FirebaseError(`Could not get instance connection string for ${options.instanceId}:${options.databaseId}`);
|
|
91
|
+
}
|
|
92
|
+
const connector = new cloud_sql_connector_1.Connector({
|
|
93
|
+
auth: new fbToolsAuthClient_1.FBToolsAuthClient(),
|
|
94
|
+
});
|
|
95
|
+
const clientOpts = await connector.getOptions({
|
|
96
|
+
instanceConnectionName: connectionName,
|
|
97
|
+
ipType: cloud_sql_connector_1.IpAddressTypes.PUBLIC,
|
|
98
|
+
authType: cloud_sql_connector_1.AuthTypes.IAM,
|
|
99
|
+
});
|
|
100
|
+
const pool = new pg.Pool({
|
|
101
|
+
...clientOpts,
|
|
102
|
+
user: username,
|
|
103
|
+
database: databaseId,
|
|
104
|
+
});
|
|
105
|
+
const conn = await pool.connect();
|
|
106
|
+
logger_1.logger.info(`Logged in as ${username}`);
|
|
107
|
+
logger_1.logger.info(clc.cyan("Welcome to Data Connect Cloud SQL Shell"));
|
|
108
|
+
logger_1.logger.info(clc.gray("Type your your SQL query or '.exit' to quit, queries should end with ';' or add empty line to execute."));
|
|
109
|
+
await mainShellLoop(conn);
|
|
110
|
+
logger_1.logger.info(clc.yellow("Exiting shell..."));
|
|
111
|
+
conn.release();
|
|
112
|
+
await pool.end();
|
|
113
|
+
connector.close();
|
|
114
|
+
return { projectId, serviceId };
|
|
115
|
+
});
|
package/lib/commands/deploy.js
CHANGED
|
@@ -80,10 +80,14 @@ exports.command = new command_1.Command("deploy")
|
|
|
80
80
|
.option("--only <targets>", 'only deploy to specified, comma-separated targets (e.g. "hosting,storage"). For functions, ' +
|
|
81
81
|
'can specify filters with colons to scope function deploys to only those functions (e.g. "--only functions:func1,functions:func2"). ' +
|
|
82
82
|
"When filtering based on export groups (the exported module object keys), use dots to specify group names " +
|
|
83
|
-
'(e.g. "--only functions:group1.subgroup1,functions:group2)
|
|
83
|
+
'(e.g. "--only functions:group1.subgroup1,functions:group2"). ' +
|
|
84
|
+
"When filtering based on codebases, use colons to specify codebase names " +
|
|
85
|
+
'(e.g. "--only functions:codebase1:func1,functions:codebase2:group1.subgroup1"). ' +
|
|
84
86
|
"For data connect, can specify filters with colons to deploy only a service, connector, or schema" +
|
|
85
87
|
'(e.g. "--only dataconnect:serviceId,dataconnect:serviceId:connectorId,dataconnect:serviceId:schema"). ')
|
|
86
88
|
.option("--except <targets>", 'deploy to all targets except specified (e.g. "database")')
|
|
89
|
+
.option("--dry-run", "Perform a dry run of your deployment. Validates your changes and builds your code without deploying any changes to your project. " +
|
|
90
|
+
"In order to provide better validation, this may still enable APIs on the target project.")
|
|
87
91
|
.before(requireConfig_1.requireConfig)
|
|
88
92
|
.before((options) => {
|
|
89
93
|
options.filteredTargets = (0, filterTargets_1.filterTargets)(options, exports.VALID_DEPLOY_TARGETS);
|
|
@@ -10,6 +10,7 @@ const types_1 = require("../emulator/types");
|
|
|
10
10
|
const clc = require("colorette");
|
|
11
11
|
const constants_1 = require("../emulator/constants");
|
|
12
12
|
const utils_1 = require("../utils");
|
|
13
|
+
const webhook_1 = require("../dataconnect/webhook");
|
|
13
14
|
const Table = require("cli-table");
|
|
14
15
|
function stylizeLink(url) {
|
|
15
16
|
return clc.underline(clc.bold(url));
|
|
@@ -31,8 +32,10 @@ exports.command = new command_1.Command("emulators:start")
|
|
|
31
32
|
let deprecationNotices;
|
|
32
33
|
try {
|
|
33
34
|
({ deprecationNotices } = await controller.startAll(options));
|
|
35
|
+
await (0, webhook_1.sendVSCodeMessage)({ message: webhook_1.VSCODE_MESSAGE.EMULATORS_STARTED });
|
|
34
36
|
}
|
|
35
37
|
catch (e) {
|
|
38
|
+
await (0, webhook_1.sendVSCodeMessage)({ message: webhook_1.VSCODE_MESSAGE.EMULATORS_START_ERRORED });
|
|
36
39
|
await controller.cleanShutdown();
|
|
37
40
|
throw e;
|
|
38
41
|
}
|
|
@@ -99,7 +102,7 @@ function printEmulatorOverview(options) {
|
|
|
99
102
|
let extensionsTable = "";
|
|
100
103
|
if (registry_1.EmulatorRegistry.isRunning(types_1.Emulators.EXTENSIONS)) {
|
|
101
104
|
const extensionsEmulatorInstance = registry_1.EmulatorRegistry.get(types_1.Emulators.EXTENSIONS);
|
|
102
|
-
extensionsTable = extensionsEmulatorInstance.extensionsInfoTable(
|
|
105
|
+
extensionsTable = extensionsEmulatorInstance.extensionsInfoTable();
|
|
103
106
|
}
|
|
104
107
|
logger_1.logger.info(`\n${successMessageTable}
|
|
105
108
|
|
|
@@ -66,8 +66,8 @@ exports.command = new command_1.Command("ext:dev:init")
|
|
|
66
66
|
}
|
|
67
67
|
catch (err) {
|
|
68
68
|
if (!(err instanceof error_1.FirebaseError)) {
|
|
69
|
-
throw new error_1.FirebaseError(`Error occurred when initializing files for new extension: ${err
|
|
70
|
-
original: err,
|
|
69
|
+
throw new error_1.FirebaseError(`Error occurred when initializing files for new extension: ${(0, error_1.getErrMsg)(err)}`, {
|
|
70
|
+
original: (0, error_1.getError)(err),
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
throw err;
|
|
@@ -19,7 +19,7 @@ exports.command = new command_1.Command("ext:dev:list <publisherId>")
|
|
|
19
19
|
extensions = await (0, publisherApi_1.listExtensions)(publisherId);
|
|
20
20
|
}
|
|
21
21
|
catch (err) {
|
|
22
|
-
throw new error_1.FirebaseError(err);
|
|
22
|
+
throw new error_1.FirebaseError((0, error_1.getErrMsg)(err));
|
|
23
23
|
}
|
|
24
24
|
if (extensions.length < 1) {
|
|
25
25
|
throw new error_1.FirebaseError(`There are no extensions uploaded under publisher ID ${clc.bold(publisherId)}. This could happen for two reasons:\n` +
|
|
@@ -35,7 +35,7 @@ exports.command = new command_1.Command("ext:dev:register")
|
|
|
35
35
|
profile = await (0, publisherApi_1.registerPublisherProfile)(projectId, publisherId);
|
|
36
36
|
}
|
|
37
37
|
catch (err) {
|
|
38
|
-
if (err
|
|
38
|
+
if ((0, error_1.getErrStatus)(err) === 409) {
|
|
39
39
|
const error = `Couldn't register the publisher ID '${clc.bold(publisherId)}' to the project '${clc.bold(projectId)}'.` +
|
|
40
40
|
" This can happen for either of two reasons:\n\n" +
|
|
41
41
|
` - Publisher ID '${clc.bold(publisherId)}' is registered to another project\n` +
|
|
@@ -43,7 +43,7 @@ exports.command = new command_1.Command("ext:dev:register")
|
|
|
43
43
|
` Try again with a unique publisher ID or a new project. If your business’s name has been registered to another project, contact Firebase support ${(0, marked_1.marked)("(https://firebase.google.com/support/troubleshooter/contact).")}`;
|
|
44
44
|
throw new error_1.FirebaseError(error, { exit: 1 });
|
|
45
45
|
}
|
|
46
|
-
throw new error_1.FirebaseError(`Failed to register publisher ID ${clc.bold(publisherId)} for project ${clc.bold(projectId)}: ${err
|
|
46
|
+
throw new error_1.FirebaseError(`Failed to register publisher ID ${clc.bold(publisherId)} for project ${clc.bold(projectId)}: ${(0, error_1.getErrMsg)(err)}`);
|
|
47
47
|
}
|
|
48
48
|
utils.logLabeledSuccess(extensionsHelper_1.logPrefix, `Publisher ID '${clc.bold(publisherId)}' has been registered to project ${clc.bold(projectId)}. View and edit your profile at ${utils.consoleUrl(projectId, `/publisher`)}`);
|
|
49
49
|
return profile;
|
|
@@ -44,13 +44,13 @@ async function uploadExtensionAction(extensionRef, options) {
|
|
|
44
44
|
profile = await (0, publisherApi_1.getPublisherProfile)("-", publisherId);
|
|
45
45
|
}
|
|
46
46
|
catch (err) {
|
|
47
|
-
if (err
|
|
47
|
+
if ((0, error_1.getErrStatus)(err) === 404) {
|
|
48
48
|
throw (0, extensionsHelper_1.getMissingPublisherError)(publisherId);
|
|
49
49
|
}
|
|
50
50
|
throw err;
|
|
51
51
|
}
|
|
52
52
|
const projectNumber = `${(0, extensionsHelper_2.getPublisherProjectFromName)(profile.name)}`;
|
|
53
|
-
const { projectId } = await (0, projects_1.
|
|
53
|
+
const { projectId } = await (0, projects_1.getProject)(projectNumber);
|
|
54
54
|
await (0, tos_1.acceptLatestPublisherTOS)(options, projectNumber);
|
|
55
55
|
let res;
|
|
56
56
|
if (options.local) {
|
|
@@ -36,7 +36,7 @@ exports.command = new command_1.Command("ext:dev:usage <publisherId>")
|
|
|
36
36
|
extensions = await (0, publisherApi_1.listExtensions)(publisherId);
|
|
37
37
|
}
|
|
38
38
|
catch (err) {
|
|
39
|
-
throw new error_1.FirebaseError(err);
|
|
39
|
+
throw new error_1.FirebaseError((0, error_1.getErrMsg)(err));
|
|
40
40
|
}
|
|
41
41
|
if (extensions.length < 1) {
|
|
42
42
|
throw new error_1.FirebaseError(`There are no published extensions associated with publisher ID ${clc.bold(publisherId)}. This could happen for two reasons:\n` +
|
|
@@ -77,7 +77,7 @@ exports.command = new command_1.Command("ext:dev:usage <publisherId>")
|
|
|
77
77
|
}
|
|
78
78
|
catch (err) {
|
|
79
79
|
throw new error_1.FirebaseError(`Error occurred when fetching usage data for extension ${extensionName}`, {
|
|
80
|
-
original: err,
|
|
80
|
+
original: (0, error_1.getError)(err),
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
if (!response) {
|
package/lib/commands/ext-info.js
CHANGED
|
@@ -109,7 +109,9 @@ exports.command = new command_1.Command("ext:info <extensionName>")
|
|
|
109
109
|
else {
|
|
110
110
|
marked_1.marked.use((0, marked_terminal_1.markedTerminal)());
|
|
111
111
|
logger_1.logger.info(await (0, marked_1.marked)(lines.join("\n")));
|
|
112
|
-
utils.logLabeledBullet(extensionsHelper_1.logPrefix, `to install this extension,
|
|
112
|
+
utils.logLabeledBullet(extensionsHelper_1.logPrefix, `to install this extension, run ` +
|
|
113
113
|
clc.bold(`firebase ext:install ${extensionName} --project=YOUR_PROJECT`));
|
|
114
|
+
utils.logLabeledBullet(extensionsHelper_1.logPrefix, `to install an autogenerated SDK for this extension into your functions codebase, run ` +
|
|
115
|
+
clc.bold(`firebase ext:sdk:install ${extensionName} --project=YOUR_PROJECT`));
|
|
114
116
|
}
|
|
115
117
|
});
|
|
@@ -109,8 +109,8 @@ exports.command = new command_1.Command("ext:install [extensionRef]")
|
|
|
109
109
|
}
|
|
110
110
|
catch (err) {
|
|
111
111
|
if (!(err instanceof error_1.FirebaseError)) {
|
|
112
|
-
throw new error_1.FirebaseError(`Error occurred saving the extension to manifest: ${err
|
|
113
|
-
original: err,
|
|
112
|
+
throw new error_1.FirebaseError(`Error occurred saving the extension to manifest: ${(0, error_1.getErrMsg)(err)}`, {
|
|
113
|
+
original: (0, error_1.getError)(err),
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
throw err;
|