firebase-tools-with-isolate 13.6.4 → 13.7.3

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.
Files changed (80) hide show
  1. package/README.md +4 -6
  2. package/lib/api.js +1 -1
  3. package/lib/apphosting/app.js +88 -0
  4. package/lib/apphosting/config.js +97 -0
  5. package/lib/apphosting/githubConnections.js +265 -0
  6. package/lib/{init/features/apphosting → apphosting}/index.js +52 -26
  7. package/lib/{init/features/apphosting → apphosting}/repo.js +10 -10
  8. package/lib/apphosting/secrets/dialogs.js +170 -0
  9. package/lib/apphosting/secrets/index.js +97 -0
  10. package/lib/commands/apphosting-backends-create.js +7 -3
  11. package/lib/commands/apphosting-backends-delete.js +5 -4
  12. package/lib/commands/apphosting-backends-get.js +8 -8
  13. package/lib/commands/apphosting-backends-list.js +2 -2
  14. package/lib/commands/apphosting-secrets-access.js +24 -0
  15. package/lib/commands/apphosting-secrets-describe.js +29 -0
  16. package/lib/commands/apphosting-secrets-grantaccess.js +45 -0
  17. package/lib/commands/apphosting-secrets-set.js +56 -0
  18. package/lib/commands/firestore-databases-create.js +1 -0
  19. package/lib/commands/firestore-databases-restore.js +1 -0
  20. package/lib/commands/functions-secrets-access.js +2 -2
  21. package/lib/commands/functions-secrets-describe.js +14 -0
  22. package/lib/commands/functions-secrets-destroy.js +2 -2
  23. package/lib/commands/functions-secrets-get.js +3 -17
  24. package/lib/commands/functions-secrets-prune.js +2 -1
  25. package/lib/commands/functions-secrets-set.js +3 -19
  26. package/lib/commands/index.js +14 -6
  27. package/lib/deploy/firestore/prepare.js +4 -2
  28. package/lib/deploy/functions/checkIam.js +3 -6
  29. package/lib/deploy/functions/containerCleaner.js +1 -15
  30. package/lib/deploy/functions/deploy.js +2 -2
  31. package/lib/deploy/functions/params.js +2 -2
  32. package/lib/deploy/functions/prepare.js +13 -3
  33. package/lib/deploy/functions/pricing.js +2 -2
  34. package/lib/deploy/functions/prompts.js +39 -7
  35. package/lib/deploy/functions/release/fabricator.js +5 -5
  36. package/lib/deploy/functions/release/index.js +17 -2
  37. package/lib/deploy/functions/release/planner.js +11 -3
  38. package/lib/deploy/functions/runtimes/discovery/index.js +3 -3
  39. package/lib/deploy/functions/runtimes/index.js +6 -43
  40. package/lib/deploy/functions/runtimes/node/index.js +3 -2
  41. package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +15 -34
  42. package/lib/deploy/functions/runtimes/python/index.js +10 -7
  43. package/lib/deploy/functions/runtimes/supported/index.js +80 -0
  44. package/lib/deploy/functions/runtimes/supported/types.js +74 -0
  45. package/lib/deploy/functions/services/index.js +4 -0
  46. package/lib/downloadUtils.js +1 -0
  47. package/lib/emulator/controller.js +5 -1
  48. package/lib/emulator/functionsEmulator.js +2 -2
  49. package/lib/emulator/hub.js +5 -0
  50. package/lib/experiments.js +12 -0
  51. package/lib/extensions/emulator/specHelper.js +7 -6
  52. package/lib/extensions/extensionsApi.js +2 -2
  53. package/lib/extensions/localHelper.js +3 -3
  54. package/lib/firestore/pretty-print.js +5 -0
  55. package/lib/frameworks/astro/index.js +1 -1
  56. package/lib/frameworks/flutter/index.js +2 -2
  57. package/lib/frameworks/next/constants.js +2 -1
  58. package/lib/frameworks/next/index.js +22 -12
  59. package/lib/frameworks/next/utils.js +32 -3
  60. package/lib/functional.js +2 -2
  61. package/lib/functions/events/v2.js +7 -1
  62. package/lib/functions/secrets.js +40 -22
  63. package/lib/gcp/apphosting.js +14 -2
  64. package/lib/gcp/cloudbuild.js +7 -3
  65. package/lib/gcp/cloudfunctions.js +5 -5
  66. package/lib/gcp/cloudfunctionsv2.js +3 -3
  67. package/lib/gcp/cloudscheduler.js +2 -2
  68. package/lib/gcp/computeEngine.js +7 -0
  69. package/lib/gcp/devConnect.js +24 -11
  70. package/lib/gcp/iam.js +9 -1
  71. package/lib/gcp/secretManager.js +54 -6
  72. package/lib/gcp/serviceusage.js +24 -5
  73. package/lib/init/features/functions/python.js +4 -3
  74. package/lib/init/features/hosting/github.js +4 -5
  75. package/lib/init/features/index.js +1 -1
  76. package/lib/utils.js +23 -6
  77. package/package.json +4 -4
  78. package/schema/firebase-config.json +12 -2
  79. package/templates/init/functions/typescript/_eslintrc +1 -0
  80. /package/lib/{init/features/apphosting → apphosting}/constants.js +0 -0
@@ -1,19 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateServiceIdentity = void 0;
3
+ exports.generateServiceIdentityAndPoll = exports.generateServiceIdentity = exports.apiClient = void 0;
4
4
  const colorette_1 = require("colorette");
5
5
  const api_1 = require("../api");
6
6
  const apiv2_1 = require("../apiv2");
7
7
  const error_1 = require("../error");
8
8
  const utils = require("../utils");
9
- const apiClient = new apiv2_1.Client({
10
- urlPrefix: (0, api_1.serviceUsageOrigin)(),
11
- apiVersion: "v1beta1",
9
+ const poller = require("../operation-poller");
10
+ const API_VERSION = "v1beta1";
11
+ const SERVICE_USAGE_ORIGIN = (0, api_1.serviceUsageOrigin)();
12
+ exports.apiClient = new apiv2_1.Client({
13
+ urlPrefix: SERVICE_USAGE_ORIGIN,
14
+ apiVersion: API_VERSION,
12
15
  });
16
+ const serviceUsagePollerOptions = {
17
+ apiOrigin: SERVICE_USAGE_ORIGIN,
18
+ apiVersion: API_VERSION,
19
+ };
13
20
  async function generateServiceIdentity(projectNumber, service, prefix) {
14
21
  utils.logLabeledBullet(prefix, `generating the service identity for ${(0, colorette_1.bold)(service)}...`);
15
22
  try {
16
- return await apiClient.post(`projects/${projectNumber}/services/${service}:generateServiceIdentity`);
23
+ const res = await exports.apiClient.post(`projects/${projectNumber}/services/${service}:generateServiceIdentity`);
24
+ return res.body;
17
25
  }
18
26
  catch (err) {
19
27
  throw new error_1.FirebaseError(`Error generating the service identity for ${service}.`, {
@@ -22,3 +30,14 @@ async function generateServiceIdentity(projectNumber, service, prefix) {
22
30
  }
23
31
  }
24
32
  exports.generateServiceIdentity = generateServiceIdentity;
33
+ async function generateServiceIdentityAndPoll(projectNumber, service, prefix) {
34
+ const op = await generateServiceIdentity(projectNumber, service, prefix);
35
+ if (op.done) {
36
+ return;
37
+ }
38
+ await poller.pollOperation({
39
+ ...serviceUsagePollerOptions,
40
+ operationResourceName: op.name,
41
+ });
42
+ }
43
+ exports.generateServiceIdentityAndPoll = generateServiceIdentityAndPoll;
@@ -7,6 +7,7 @@ const path = require("path");
7
7
  const python_1 = require("../../../deploy/functions/runtimes/python");
8
8
  const python_2 = require("../../../functions/python");
9
9
  const prompt_1 = require("../../../prompt");
10
+ const supported_1 = require("../../../deploy/functions/runtimes/supported");
10
11
  const TEMPLATE_ROOT = path.resolve(__dirname, "../../../../templates/init/functions/python");
11
12
  const MAIN_TEMPLATE = fs.readFileSync(path.join(TEMPLATE_ROOT, "main.py"), "utf8");
12
13
  const REQUIREMENTS_TEMPLATE = fs.readFileSync(path.join(TEMPLATE_ROOT, "requirements.txt"), "utf8");
@@ -15,9 +16,9 @@ async function setup(setup, config) {
15
16
  await config.askWriteProjectFile(`${setup.functions.source}/requirements.txt`, REQUIREMENTS_TEMPLATE);
16
17
  await config.askWriteProjectFile(`${setup.functions.source}/.gitignore`, GITIGNORE_TEMPLATE);
17
18
  await config.askWriteProjectFile(`${setup.functions.source}/main.py`, MAIN_TEMPLATE);
18
- config.set("functions.runtime", python_1.LATEST_VERSION);
19
+ config.set("functions.runtime", (0, supported_1.latest)("python"));
19
20
  config.set("functions.ignore", ["venv", "__pycache__"]);
20
- const venvProcess = spawn((0, python_1.getPythonBinary)(python_1.LATEST_VERSION), ["-m", "venv", "venv"], {
21
+ const venvProcess = spawn((0, python_1.getPythonBinary)((0, supported_1.latest)("python")), ["-m", "venv", "venv"], {
21
22
  shell: true,
22
23
  cwd: config.path(setup.functions.source),
23
24
  stdio: ["pipe", "pipe", "pipe", "pipe"],
@@ -38,7 +39,7 @@ async function setup(setup, config) {
38
39
  upgradeProcess.on("exit", resolve);
39
40
  upgradeProcess.on("error", reject);
40
41
  });
41
- const installProcess = (0, python_2.runWithVirtualEnv)([(0, python_1.getPythonBinary)(python_1.LATEST_VERSION), "-m", "pip", "install", "-r", "requirements.txt"], config.path(setup.functions.source), {}, { stdio: ["inherit", "inherit", "inherit"] });
42
+ const installProcess = (0, python_2.runWithVirtualEnv)([(0, python_1.getPythonBinary)((0, supported_1.latest)("python")), "-m", "pip", "install", "-r", "requirements.txt"], config.path(setup.functions.source), {}, { stdio: ["inherit", "inherit", "inherit"] });
42
43
  await new Promise((resolve, reject) => {
43
44
  installProcess.on("exit", resolve);
44
45
  installProcess.on("error", reject);
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isRunningInGithubAction = exports.initGitHub = void 0;
4
4
  const colorette_1 = require("colorette");
5
5
  const fs = require("fs");
6
- const yaml = require("js-yaml");
7
- const js_yaml_1 = require("js-yaml");
6
+ const yaml = require("yaml");
8
7
  const ora = require("ora");
9
8
  const path = require("path");
10
9
  const libsodium = require("libsodium-wrappers");
@@ -149,7 +148,7 @@ function loadYMLDeploy() {
149
148
  }
150
149
  }
151
150
  function loadYML(ymlPath) {
152
- return (0, js_yaml_1.safeLoad)(fs.readFileSync(ymlPath, "utf8"));
151
+ return yaml.parse(fs.readFileSync(ymlPath, "utf8"));
153
152
  }
154
153
  function mkdirNotExists(dir) {
155
154
  if (!(0, fsutils_1.dirExistsSync)(dir)) {
@@ -189,7 +188,7 @@ function writeChannelActionYMLFile(ymlPath, secretName, projectId, script) {
189
188
  const ymlContents = `# This file was auto-generated by the Firebase CLI
190
189
  # https://github.com/firebase/firebase-tools
191
190
 
192
- ${yaml.safeDump(workflowConfig)}`;
191
+ ${yaml.stringify(workflowConfig)}`;
193
192
  mkdirNotExists(GITHUB_DIR);
194
193
  mkdirNotExists(WORKFLOW_DIR);
195
194
  fs.writeFileSync(ymlPath, ymlContents, "utf8");
@@ -222,7 +221,7 @@ function writeDeployToProdActionYMLFile(ymlPath, branch, secretName, projectId,
222
221
  const ymlContents = `# This file was auto-generated by the Firebase CLI
223
222
  # https://github.com/firebase/firebase-tools
224
223
 
225
- ${yaml.safeDump(workflowConfig)}`;
224
+ ${yaml.stringify(workflowConfig)}`;
226
225
  mkdirNotExists(GITHUB_DIR);
227
226
  mkdirNotExists(WORKFLOW_DIR);
228
227
  fs.writeFileSync(ymlPath, ymlContents, "utf8");
@@ -23,5 +23,5 @@ var remoteconfig_1 = require("./remoteconfig");
23
23
  Object.defineProperty(exports, "remoteconfig", { enumerable: true, get: function () { return remoteconfig_1.doSetup; } });
24
24
  var github_1 = require("./hosting/github");
25
25
  Object.defineProperty(exports, "hostingGithub", { enumerable: true, get: function () { return github_1.initGitHub; } });
26
- var apphosting_1 = require("./apphosting");
26
+ var apphosting_1 = require("../../apphosting");
27
27
  Object.defineProperty(exports, "apphosting", { enumerable: true, get: function () { return apphosting_1.doSetup; } });
package/lib/utils.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getHostnameFromUrl = exports.openInBrowserPopup = exports.openInBrowser = exports.connectableHostname = exports.randomInt = exports.debounce = exports.last = exports.cloneDeep = exports.groupBy = exports.assertIsStringOrUndefined = exports.assertIsNumber = exports.assertIsString = exports.thirtyDaysFromNow = exports.isRunningInWSL = exports.isVSCodeExtension = exports.isCloudEnvironment = exports.datetimeString = exports.createDestroyer = exports.promiseWithSpinner = exports.setupLoggers = exports.tryParse = exports.tryStringify = exports.promiseProps = exports.withTimeout = exports.promiseWhile = exports.promiseAllSettled = exports.getFunctionsEventProvider = exports.endpoint = exports.makeActiveProject = exports.streamToString = exports.stringToStream = exports.explainStdin = exports.allSettled = exports.reject = exports.logLabeledError = exports.logLabeledWarning = exports.logWarning = exports.logLabeledBullet = exports.logBullet = exports.logLabeledSuccess = exports.logSuccess = exports.addSubdomain = exports.addDatabaseNamespace = exports.getDatabaseViewDataUrl = exports.getDatabaseUrl = exports.envOverride = exports.getInheritedOption = exports.consoleUrl = exports.envOverrides = void 0;
3
+ exports.getHostnameFromUrl = exports.openInBrowserPopup = exports.openInBrowser = exports.connectableHostname = exports.randomInt = exports.debounce = exports.last = exports.cloneDeep = exports.groupBy = exports.assertIsStringOrUndefined = exports.assertIsNumber = exports.assertIsString = exports.thirtyDaysFromNow = exports.isRunningInWSL = exports.isVSCodeExtension = exports.isCloudEnvironment = exports.datetimeString = exports.createDestroyer = exports.promiseWithSpinner = exports.setupLoggers = exports.tryParse = exports.tryStringify = exports.promiseProps = exports.withTimeout = exports.promiseWhile = exports.promiseAllSettled = exports.getFunctionsEventProvider = exports.endpoint = exports.makeActiveProject = exports.streamToString = exports.stringToStream = exports.explainStdin = exports.allSettled = exports.reject = exports.logLabeledError = exports.logLabeledWarning = exports.logWarning = exports.logLabeledBullet = exports.logBullet = exports.logLabeledSuccess = exports.logSuccess = exports.addSubdomain = exports.addDatabaseNamespace = exports.getDatabaseViewDataUrl = exports.getDatabaseUrl = exports.envOverride = exports.getInheritedOption = exports.consoleUrl = exports.envOverrides = exports.IS_WINDOWS = void 0;
4
+ exports.readSecretValue = void 0;
4
5
  const fs = require("node:fs");
6
+ const tty = require("tty");
5
7
  const path = require("node:path");
6
8
  const _ = require("lodash");
7
9
  const url = require("url");
@@ -19,10 +21,11 @@ const portfinder_1 = require("portfinder");
19
21
  const configstore_1 = require("./configstore");
20
22
  const error_1 = require("./error");
21
23
  const logger_1 = require("./logger");
22
- const IS_WINDOWS = process.platform === "win32";
23
- const SUCCESS_CHAR = IS_WINDOWS ? "+" : "✔";
24
- const WARNING_CHAR = IS_WINDOWS ? "!" : "⚠";
25
- const ERROR_CHAR = IS_WINDOWS ? "!!" : "⬢";
24
+ const prompt_1 = require("./prompt");
25
+ exports.IS_WINDOWS = process.platform === "win32";
26
+ const SUCCESS_CHAR = exports.IS_WINDOWS ? "+" : "✔";
27
+ const WARNING_CHAR = exports.IS_WINDOWS ? "!" : "⚠";
28
+ const ERROR_CHAR = exports.IS_WINDOWS ? "!!" : "⬢";
26
29
  const THIRTY_DAYS_IN_MILLISECONDS = 30 * 24 * 60 * 60 * 1000;
27
30
  exports.envOverrides = [];
28
31
  function consoleUrl(project, path) {
@@ -148,7 +151,7 @@ function allSettled(promises) {
148
151
  }
149
152
  exports.allSettled = allSettled;
150
153
  function explainStdin() {
151
- if (IS_WINDOWS) {
154
+ if (exports.IS_WINDOWS) {
152
155
  throw new error_1.FirebaseError("STDIN input is not available on Windows.", {
153
156
  exit: 1,
154
157
  });
@@ -524,3 +527,17 @@ function getHostnameFromUrl(url) {
524
527
  }
525
528
  }
526
529
  exports.getHostnameFromUrl = getHostnameFromUrl;
530
+ function readSecretValue(prompt, dataFile) {
531
+ if ((!dataFile || dataFile === "-") && tty.isatty(0)) {
532
+ return (0, prompt_1.promptOnce)({
533
+ type: "password",
534
+ message: prompt,
535
+ });
536
+ }
537
+ let input = 0;
538
+ if (dataFile && dataFile !== "-") {
539
+ input = dataFile;
540
+ }
541
+ return Promise.resolve(fs.readFileSync(input, "utf-8"));
542
+ }
543
+ exports.readSecretValue = readSecretValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firebase-tools-with-isolate",
3
- "version": "13.6.4",
3
+ "version": "13.7.3",
4
4
  "description": "Command-Line Interface for Firebase with monorepo support",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -121,8 +121,7 @@
121
121
  "google-auth-library": "^7.11.0",
122
122
  "inquirer": "^8.2.6",
123
123
  "inquirer-autocomplete-prompt": "^2.0.1",
124
- "isolate-package": "^1.13.2",
125
- "js-yaml": "^3.13.1",
124
+ "isolate-package": "^1.14.0",
126
125
  "jsonwebtoken": "^9.0.0",
127
126
  "leven": "^3.1.0",
128
127
  "libsodium-wrappers": "^0.7.10",
@@ -155,7 +154,8 @@
155
154
  "uuid": "^8.3.2",
156
155
  "winston": "^3.0.0",
157
156
  "winston-transport": "^4.4.0",
158
- "ws": "^7.2.3"
157
+ "ws": "^7.2.3",
158
+ "yaml": "^2.4.1"
159
159
  },
160
160
  "devDependencies": {
161
161
  "@angular-devkit/architect": "^0.1402.2",
@@ -622,7 +622,12 @@
622
622
  "nodejs14",
623
623
  "nodejs16",
624
624
  "nodejs18",
625
- "nodejs20"
625
+ "nodejs20",
626
+ "nodejs6",
627
+ "nodejs8",
628
+ "python310",
629
+ "python311",
630
+ "python312"
626
631
  ],
627
632
  "type": "string"
628
633
  },
@@ -678,7 +683,12 @@
678
683
  "nodejs14",
679
684
  "nodejs16",
680
685
  "nodejs18",
681
- "nodejs20"
686
+ "nodejs20",
687
+ "nodejs6",
688
+ "nodejs8",
689
+ "python310",
690
+ "python311",
691
+ "python312"
682
692
  ],
683
693
  "type": "string"
684
694
  },
@@ -19,6 +19,7 @@ module.exports = {
19
19
  },
20
20
  ignorePatterns: [
21
21
  "/lib/**/*", // Ignore built files.
22
+ "/generated/**/*", // Ignore generated files.
22
23
  ],
23
24
  plugins: [
24
25
  "@typescript-eslint",