firebase-tools 13.7.1 → 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 (34) hide show
  1. package/lib/apphosting/app.js +92 -0
  2. package/lib/apphosting/config.js +76 -10
  3. package/lib/apphosting/githubConnections.js +4 -4
  4. package/lib/apphosting/index.js +29 -11
  5. package/lib/apphosting/repo.js +1 -1
  6. package/lib/apphosting/secrets/dialogs.js +15 -14
  7. package/lib/commands/apphosting-backends-create.js +4 -2
  8. package/lib/commands/apphosting-backends-delete.js +4 -3
  9. package/lib/commands/apphosting-backends-get.js +8 -8
  10. package/lib/commands/apphosting-backends-list.js +2 -2
  11. package/lib/commands/apphosting-secrets-grantaccess.js +2 -2
  12. package/lib/commands/apphosting-secrets-set.js +9 -58
  13. package/lib/commands/firestore-databases-create.js +1 -0
  14. package/lib/commands/firestore-databases-restore.js +1 -0
  15. package/lib/commands/functions-secrets-set.js +1 -17
  16. package/lib/commands/index.js +8 -6
  17. package/lib/deploy/firestore/prepare.js +4 -2
  18. package/lib/deploy/functions/deploy.js +2 -2
  19. package/lib/deploy/functions/prepare.js +1 -0
  20. package/lib/deploy/functions/pricing.js +2 -2
  21. package/lib/deploy/functions/runtimes/discovery/index.js +3 -3
  22. package/lib/deploy/functions/runtimes/{supported.js → supported/index.js} +26 -81
  23. package/lib/deploy/functions/runtimes/supported/types.js +74 -0
  24. package/lib/downloadUtils.js +1 -0
  25. package/lib/extensions/emulator/specHelper.js +3 -3
  26. package/lib/extensions/extensionsApi.js +2 -2
  27. package/lib/extensions/localHelper.js +3 -3
  28. package/lib/firestore/pretty-print.js +5 -0
  29. package/lib/frameworks/astro/index.js +1 -1
  30. package/lib/frameworks/flutter/index.js +2 -2
  31. package/lib/init/features/hosting/github.js +4 -5
  32. package/lib/utils.js +17 -0
  33. package/package.json +3 -3
  34. package/templates/init/functions/typescript/_eslintrc +1 -0
@@ -52,6 +52,7 @@ exports.command = new command_1.Command("firestore:databases:create <database>")
52
52
  logger_1.logger.info("Please be sure to configure Firebase rules in your Firebase config file for\n" +
53
53
  "the new database. By default, created databases will have closed rules that\n" +
54
54
  "block any incoming third-party traffic.");
55
+ logger_1.logger.info(`Your database may be viewed at ${printer.firebaseConsoleDatabaseUrl(options.project, database)}`);
55
56
  }
56
57
  return databaseResp;
57
58
  });
@@ -37,6 +37,7 @@ exports.command = new command_1.Command("firestore:databases:restore")
37
37
  logger_1.logger.info("Please be sure to configure Firebase rules in your Firebase config file for\n" +
38
38
  "the new database. By default, created databases will have closed rules that\n" +
39
39
  "block any incoming third-party traffic.");
40
+ logger_1.logger.info(`Once the restore is complete, your database may be viewed at ${printer.firebaseConsoleDatabaseUrl(options.project, databaseId)}`);
40
41
  }
41
42
  return databaseResp;
42
43
  });
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const tty = require("tty");
5
- const fs = require("fs");
6
4
  const clc = require("colorette");
7
5
  const logger_1 = require("../logger");
8
6
  const secrets_1 = require("../functions/secrets");
@@ -33,21 +31,7 @@ exports.command = new command_1.Command("functions:secrets:set <KEY>")
33
31
  const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
34
32
  const key = await (0, secrets_1.ensureValidKey)(unvalidatedKey, options);
35
33
  const secret = await (0, secrets_1.ensureSecret)(projectId, key, options);
36
- let secretValue;
37
- if ((!options.dataFile || options.dataFile === "-") && tty.isatty(0)) {
38
- secretValue = await (0, prompt_1.promptOnce)({
39
- name: key,
40
- type: "password",
41
- message: `Enter a value for ${key}`,
42
- });
43
- }
44
- else {
45
- let dataFile = 0;
46
- if (options.dataFile && options.dataFile !== "-") {
47
- dataFile = options.dataFile;
48
- }
49
- secretValue = fs.readFileSync(dataFile, "utf-8");
50
- }
34
+ const secretValue = await (0, utils_1.readSecretValue)(`Enter a value for ${key}`, options.dataFile);
51
35
  const secretVersion = await (0, secretManager_1.addVersion)(projectId, key, secretValue);
52
36
  (0, utils_1.logSuccess)(`Created a new secret version ${(0, secretManager_1.toSecretVersionResourceName)(secretVersion)}`);
53
37
  if (!(0, secretManager_1.isFunctionsManaged)(secret)) {
@@ -162,17 +162,19 @@ function load(client) {
162
162
  client.apphosting.backends.create = loadCommand("apphosting-backends-create");
163
163
  client.apphosting.backends.get = loadCommand("apphosting-backends-get");
164
164
  client.apphosting.backends.delete = loadCommand("apphosting-backends-delete");
165
- client.apphosting.builds = {};
166
- client.apphosting.builds.get = loadCommand("apphosting-builds-get");
167
- client.apphosting.builds.create = loadCommand("apphosting-builds-create");
168
165
  client.apphosting.secrets = {};
169
166
  client.apphosting.secrets.set = loadCommand("apphosting-secrets-set");
170
167
  client.apphosting.secrets.grantaccess = loadCommand("apphosting-secrets-grantaccess");
171
168
  client.apphosting.secrets.describe = loadCommand("apphosting-secrets-describe");
172
169
  client.apphosting.secrets.access = loadCommand("apphosting-secrets-access");
173
- client.apphosting.rollouts = {};
174
- client.apphosting.rollouts.create = loadCommand("apphosting-rollouts-create");
175
- client.apphosting.rollouts.list = loadCommand("apphosting-rollouts-list");
170
+ if (experiments.isEnabled("internaltesting")) {
171
+ client.apphosting.builds = {};
172
+ client.apphosting.builds.get = loadCommand("apphosting-builds-get");
173
+ client.apphosting.builds.create = loadCommand("apphosting-builds-create");
174
+ client.apphosting.rollouts = {};
175
+ client.apphosting.rollouts.create = loadCommand("apphosting-rollouts-create");
176
+ client.apphosting.rollouts.list = loadCommand("apphosting-rollouts-list");
177
+ }
176
178
  }
177
179
  client.login = loadCommand("login");
178
180
  client.login.add = loadCommand("login-add");
@@ -27,9 +27,11 @@ async function default_1(context, options) {
27
27
  const targets = options.only.split(",");
28
28
  const excludeRules = targets.indexOf("firestore:indexes") >= 0;
29
29
  const excludeIndexes = targets.indexOf("firestore:rules") >= 0;
30
+ const includeRules = targets.indexOf("firestore:rules") >= 0;
31
+ const includeIndexes = targets.indexOf("firestore:indexes") >= 0;
30
32
  const onlyFirestore = targets.indexOf("firestore") >= 0;
31
- context.firestoreIndexes = !excludeIndexes || onlyFirestore;
32
- context.firestoreRules = !excludeRules || onlyFirestore;
33
+ context.firestoreIndexes = !excludeIndexes || includeIndexes || onlyFirestore;
34
+ context.firestoreRules = !excludeRules || includeRules || onlyFirestore;
33
35
  }
34
36
  else {
35
37
  context.firestoreIndexes = true;
@@ -25,7 +25,7 @@ async function uploadSourceV1(projectId, source, wantBackend) {
25
25
  stream: fs.createReadStream(source.functionsSourceV1),
26
26
  };
27
27
  if (process.env.GOOGLE_CLOUD_QUOTA_PROJECT) {
28
- (0, utils_1.logLabeledWarning)("functions", "GOOGLE_CLOUD_QUTOA_PROJECT is not usable when uploading source for Cloud Functions.");
28
+ (0, utils_1.logLabeledWarning)("functions", "GOOGLE_CLOUD_QUOTA_PROJECT is not usable when uploading source for Cloud Functions.");
29
29
  }
30
30
  await gcs.upload(uploadOpts, uploadUrl, {
31
31
  "x-goog-content-length-range": "0,104857600",
@@ -44,7 +44,7 @@ async function uploadSourceV2(projectId, source, wantBackend) {
44
44
  stream: fs.createReadStream(source.functionsSourceV2),
45
45
  };
46
46
  if (process.env.GOOGLE_CLOUD_QUOTA_PROJECT) {
47
- (0, utils_1.logLabeledWarning)("functions", "GOOGLE_CLOUD_QUTOA_PROJECT is not usable when uploading source for Cloud Functions.");
47
+ (0, utils_1.logLabeledWarning)("functions", "GOOGLE_CLOUD_QUOTA_PROJECT is not usable when uploading source for Cloud Functions.");
48
48
  }
49
49
  await gcs.upload(uploadOpts, res.uploadUrl, undefined, true);
50
50
  return res.storageSource;
@@ -285,6 +285,7 @@ async function loadCodebases(config, options, firebaseConfig, runtimeConfig, fil
285
285
  projectId,
286
286
  sourceDir,
287
287
  projectDir: options.config.projectDir,
288
+ runtime: codebaseConfig.runtime,
288
289
  };
289
290
  const firebaseJsonRuntime = codebaseConfig.runtime;
290
291
  if (firebaseJsonRuntime && !supported.isRuntime(firebaseJsonRuntime)) {
@@ -107,7 +107,7 @@ const MB_TO_GHZ = {
107
107
  32768: 8 * VCPU_TO_GHZ,
108
108
  };
109
109
  function canCalculateMinInstanceCost(endpoint) {
110
- if (!endpoint.minInstances) {
110
+ if (endpoint.minInstances === undefined || endpoint.minInstances === null) {
111
111
  return true;
112
112
  }
113
113
  if (endpoint.platform === "gcfv1") {
@@ -132,7 +132,7 @@ function monthlyMinInstanceCost(endpoints) {
132
132
  gcfv2: { 1: { ram: 0, cpu: 0 }, 2: { ram: 0, cpu: 0 } },
133
133
  };
134
134
  for (const endpoint of endpoints) {
135
- if (!endpoint.minInstances) {
135
+ if (endpoint.minInstances === undefined || endpoint.minInstances === null) {
136
136
  continue;
137
137
  }
138
138
  const ramMb = endpoint.availableMemoryMb || backend.DEFAULT_MEMORY;
@@ -4,7 +4,7 @@ exports.detectFromPort = exports.detectFromYaml = exports.yamlToBuild = exports.
4
4
  const node_fetch_1 = require("node-fetch");
5
5
  const fs = require("fs");
6
6
  const path = require("path");
7
- const yaml = require("js-yaml");
7
+ const yaml = require("yaml");
8
8
  const util_1 = require("util");
9
9
  const logger_1 = require("../../../../logger");
10
10
  const api = require("../../.../../../../api");
@@ -41,7 +41,7 @@ async function detectFromYaml(directory, project, runtime) {
41
41
  return;
42
42
  }
43
43
  logger_1.logger.debug("Found functions.yaml. Got spec:", text);
44
- const parsed = yaml.load(text);
44
+ const parsed = yaml.parse(text);
45
45
  return yamlToBuild(parsed, project, api.functionsDefaultRegion(), runtime);
46
46
  }
47
47
  exports.detectFromYaml = detectFromYaml;
@@ -74,7 +74,7 @@ async function detectFromPort(port, project, runtime, timeout = 10000) {
74
74
  logger_1.logger.debug("Got response from /__/functions.yaml", text);
75
75
  let parsed;
76
76
  try {
77
- parsed = yaml.load(text);
77
+ parsed = yaml.parse(text);
78
78
  }
79
79
  catch (err) {
80
80
  logger_1.logger.debug("Failed to parse functions.yaml", err);
@@ -1,88 +1,33 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.guardVersionSupport = exports.isDecommissioned = exports.latest = exports.runtimeIsLanguage = exports.isRuntime = exports.RUNTIMES = void 0;
4
- const error_1 = require("../../../error");
5
- const utils = require("../../../utils");
6
- function runtimes(r) {
7
- return r;
8
- }
9
- exports.RUNTIMES = runtimes({
10
- nodejs6: {
11
- friendly: "Node.js 6",
12
- status: "decommissioned",
13
- deprecationDate: "2019-04-17",
14
- decommissionDate: "2020-08-01",
15
- },
16
- nodejs8: {
17
- friendly: "Node.js 8",
18
- status: "decommissioned",
19
- deprecationDate: "2020-06-05",
20
- decommissionDate: "2021-02-01",
21
- },
22
- nodejs10: {
23
- friendly: "Node.js 10",
24
- status: "GA",
25
- deprecationDate: "2024-01-30",
26
- decommissionDate: "2025-01-30",
27
- },
28
- nodejs12: {
29
- friendly: "Node.js 12",
30
- status: "GA",
31
- deprecationDate: "2024-01-30",
32
- decommissionDate: "2025-01-30",
33
- },
34
- nodejs14: {
35
- friendly: "Node.js 14",
36
- status: "GA",
37
- deprecationDate: "2024-01-30",
38
- decommissionDate: "2025-01-30",
39
- },
40
- nodejs16: {
41
- friendly: "Node.js 16",
42
- status: "GA",
43
- deprecationDate: "2024-01-30",
44
- decommissionDate: "2025-01-30",
45
- },
46
- nodejs18: {
47
- friendly: "Node.js 18",
48
- status: "GA",
49
- deprecationDate: "2025-04-30",
50
- decommissionDate: "2025-10-31",
51
- },
52
- nodejs20: {
53
- friendly: "Node.js 20",
54
- status: "GA",
55
- deprecationDate: "2026-04-30",
56
- decommissionDate: "2026-10-31",
57
- },
58
- python310: {
59
- friendly: "Python 3.10",
60
- status: "GA",
61
- deprecationDate: "2026-10-04",
62
- decommissionDate: "2027-04-30",
63
- },
64
- python311: {
65
- friendly: "Python 3.11",
66
- status: "GA",
67
- deprecationDate: "2027-10-24",
68
- decommissionDate: "2028-04-30",
69
- },
70
- python312: {
71
- friendly: "Python 3.12",
72
- status: "GA",
73
- deprecationDate: "2028-10-02",
74
- decommissionDate: "2029-04-30",
75
- },
76
- });
17
+ exports.guardVersionSupport = exports.isDecommissioned = exports.latest = exports.runtimeIsLanguage = exports.isRuntime = void 0;
18
+ const error_1 = require("../../../../error");
19
+ const utils = require("../../../../utils");
20
+ const types_1 = require("./types");
21
+ __exportStar(require("./types"), exports);
77
22
  function isRuntime(maybe) {
78
- return maybe in exports.RUNTIMES;
23
+ return maybe in types_1.RUNTIMES;
79
24
  }
80
25
  exports.isRuntime = isRuntime;
81
26
  function runtimeIsLanguage(runtime, language) {
82
27
  return runtime.startsWith(language);
83
28
  }
84
29
  exports.runtimeIsLanguage = runtimeIsLanguage;
85
- function latest(language, runtimes = Object.keys(exports.RUNTIMES)) {
30
+ function latest(language, runtimes = Object.keys(types_1.RUNTIMES)) {
86
31
  const sorted = runtimes
87
32
  .filter((s) => runtimeIsLanguage(s, language))
88
33
  .sort((left, right) => {
@@ -103,20 +48,20 @@ function latest(language, runtimes = Object.keys(exports.RUNTIMES)) {
103
48
  }
104
49
  exports.latest = latest;
105
50
  function isDecommissioned(runtime, now = new Date()) {
106
- const cutoff = new Date(exports.RUNTIMES[runtime].decommissionDate);
51
+ const cutoff = new Date(types_1.RUNTIMES[runtime].decommissionDate);
107
52
  return cutoff < now;
108
53
  }
109
54
  exports.isDecommissioned = isDecommissioned;
110
55
  function guardVersionSupport(runtime, now = new Date()) {
111
- const { deprecationDate, decommissionDate } = exports.RUNTIMES[runtime];
56
+ const { deprecationDate, decommissionDate } = types_1.RUNTIMES[runtime];
112
57
  const decommission = new Date(decommissionDate);
113
58
  if (now >= decommission) {
114
- throw new error_1.FirebaseError(`Runtime ${exports.RUNTIMES[runtime].friendly} was decommissioned on ${decommissionDate}. To deploy ` +
59
+ throw new error_1.FirebaseError(`Runtime ${types_1.RUNTIMES[runtime].friendly} was decommissioned on ${decommissionDate}. To deploy ` +
115
60
  "you must first upgrade your runtime version.", { exit: 1 });
116
61
  }
117
62
  const deprecation = new Date(deprecationDate);
118
63
  if (now >= deprecation) {
119
- utils.logLabeledWarning("functions", `Runtime ${exports.RUNTIMES[runtime].friendly} was deprecated on ${deprecationDate} and will be ` +
64
+ utils.logLabeledWarning("functions", `Runtime ${types_1.RUNTIMES[runtime].friendly} was deprecated on ${deprecationDate} and will be ` +
120
65
  `decommissioned on ${decommissionDate}, after which you will not be able ` +
121
66
  "to deploy without upgrading. Consider upgrading now to avoid disruption. See " +
122
67
  "https://cloud.google.com/functions/docs/runtime-support for full " +
@@ -125,7 +70,7 @@ function guardVersionSupport(runtime, now = new Date()) {
125
70
  }
126
71
  const warning = new Date(deprecation.getTime() - 90 * 24 * 60 * 60 * 1000);
127
72
  if (now >= warning) {
128
- utils.logLabeledWarning("functions", `Runtime ${exports.RUNTIMES[runtime].friendly} will be deprecated on ${deprecationDate} and will be ` +
73
+ utils.logLabeledWarning("functions", `Runtime ${types_1.RUNTIMES[runtime].friendly} will be deprecated on ${deprecationDate} and will be ` +
129
74
  `decommissioned on ${decommissionDate}, after which you will not be able ` +
130
75
  "to deploy without upgrading. Consider upgrading now to avoid disruption. See " +
131
76
  "https://cloud.google.com/functions/docs/runtime-support for full " +
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RUNTIMES = void 0;
4
+ function runtimes(r) {
5
+ return r;
6
+ }
7
+ exports.RUNTIMES = runtimes({
8
+ nodejs6: {
9
+ friendly: "Node.js 6",
10
+ status: "decommissioned",
11
+ deprecationDate: "2019-04-17",
12
+ decommissionDate: "2020-08-01",
13
+ },
14
+ nodejs8: {
15
+ friendly: "Node.js 8",
16
+ status: "decommissioned",
17
+ deprecationDate: "2020-06-05",
18
+ decommissionDate: "2021-02-01",
19
+ },
20
+ nodejs10: {
21
+ friendly: "Node.js 10",
22
+ status: "GA",
23
+ deprecationDate: "2024-01-30",
24
+ decommissionDate: "2025-01-30",
25
+ },
26
+ nodejs12: {
27
+ friendly: "Node.js 12",
28
+ status: "GA",
29
+ deprecationDate: "2024-01-30",
30
+ decommissionDate: "2025-01-30",
31
+ },
32
+ nodejs14: {
33
+ friendly: "Node.js 14",
34
+ status: "GA",
35
+ deprecationDate: "2024-01-30",
36
+ decommissionDate: "2025-01-30",
37
+ },
38
+ nodejs16: {
39
+ friendly: "Node.js 16",
40
+ status: "GA",
41
+ deprecationDate: "2024-01-30",
42
+ decommissionDate: "2025-01-30",
43
+ },
44
+ nodejs18: {
45
+ friendly: "Node.js 18",
46
+ status: "GA",
47
+ deprecationDate: "2025-04-30",
48
+ decommissionDate: "2025-10-31",
49
+ },
50
+ nodejs20: {
51
+ friendly: "Node.js 20",
52
+ status: "GA",
53
+ deprecationDate: "2026-04-30",
54
+ decommissionDate: "2026-10-31",
55
+ },
56
+ python310: {
57
+ friendly: "Python 3.10",
58
+ status: "GA",
59
+ deprecationDate: "2026-10-04",
60
+ decommissionDate: "2027-04-30",
61
+ },
62
+ python311: {
63
+ friendly: "Python 3.11",
64
+ status: "GA",
65
+ deprecationDate: "2027-10-24",
66
+ decommissionDate: "2028-04-30",
67
+ },
68
+ python312: {
69
+ friendly: "Python 3.12",
70
+ status: "GA",
71
+ deprecationDate: "2028-10-02",
72
+ decommissionDate: "2029-04-30",
73
+ },
74
+ });
@@ -13,6 +13,7 @@ async function downloadToTmp(remoteUrl) {
13
13
  const tmpfile = tmp.fileSync();
14
14
  const writeStream = fs.createWriteStream(tmpfile.name);
15
15
  const res = await c.request({
16
+ ignoreQuotaProject: true,
16
17
  method: "GET",
17
18
  path: u.pathname,
18
19
  queryParams: u.searchParams,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRuntime = exports.DEFAULT_RUNTIME = exports.getFunctionProperties = exports.getFunctionResourcesWithParamSubstitution = exports.readFileFromDirectory = exports.readPostinstall = exports.readExtensionYaml = void 0;
4
- const yaml = require("js-yaml");
4
+ const yaml = require("yaml");
5
5
  const path = require("path");
6
6
  const fs = require("fs-extra");
7
7
  const supported = require("../../deploy/functions/runtimes/supported");
@@ -17,10 +17,10 @@ const validFunctionTypes = [
17
17
  ];
18
18
  function wrappedSafeLoad(source) {
19
19
  try {
20
- return yaml.safeLoad(source);
20
+ return yaml.parse(source);
21
21
  }
22
22
  catch (err) {
23
- if (err instanceof yaml.YAMLException) {
23
+ if (err instanceof yaml.YAMLParseError) {
24
24
  throw new error_1.FirebaseError(`YAML Error: ${err.message}`, { original: err });
25
25
  }
26
26
  throw err;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.refNotFoundError = exports.getExtension = exports.listExtensionVersions = exports.listExtensions = exports.getExtensionVersion = exports.getSource = exports.createSource = exports.populateSpec = exports.updateInstanceFromRegistry = exports.updateInstance = exports.configureInstance = exports.listInstances = exports.getInstance = exports.deleteInstance = exports.createInstance = void 0;
4
- const yaml = require("js-yaml");
4
+ const yaml = require("yaml");
5
5
  const clc = require("colorette");
6
6
  const apiv2_1 = require("../apiv2");
7
7
  const api_1 = require("../api");
@@ -230,7 +230,7 @@ function populateSpec(spec) {
230
230
  for (const r of spec.resources) {
231
231
  try {
232
232
  if (r.propertiesYaml) {
233
- r.properties = yaml.safeLoad(r.propertiesYaml);
233
+ r.properties = yaml.parse(r.propertiesYaml);
234
234
  }
235
235
  }
236
236
  catch (err) {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isLocalExtension = exports.readFile = exports.findExtensionYaml = exports.getLocalExtensionSpec = exports.EXTENSIONS_SPEC_FILE = void 0;
4
4
  const fs = require("fs-extra");
5
5
  const path = require("path");
6
- const yaml = require("js-yaml");
6
+ const yaml = require("yaml");
7
7
  const fsutils_1 = require("../fsutils");
8
8
  const error_1 = require("../error");
9
9
  const logger_1 = require("../logger");
@@ -56,10 +56,10 @@ function isLocalExtension(extensionName) {
56
56
  exports.isLocalExtension = isLocalExtension;
57
57
  function parseYAML(source) {
58
58
  try {
59
- return yaml.safeLoad(source);
59
+ return yaml.parse(source);
60
60
  }
61
61
  catch (err) {
62
- if (err instanceof yaml.YAMLException) {
62
+ if (err instanceof yaml.YAMLParseError) {
63
63
  throw new error_1.FirebaseError(`YAML Error: ${err.message}`, { original: err });
64
64
  }
65
65
  throw new error_1.FirebaseError(err.message);
@@ -7,6 +7,7 @@ const sort = require("./api-sort");
7
7
  const types = require("./api-types");
8
8
  const logger_1 = require("../logger");
9
9
  const util = require("./util");
10
+ const utils_1 = require("../utils");
10
11
  class PrettyPrint {
11
12
  prettyPrintIndexes(indexes) {
12
13
  if (indexes.length === 0) {
@@ -163,6 +164,10 @@ class PrettyPrint {
163
164
  prettyDatabaseString(database) {
164
165
  return clc.yellow(typeof database === "string" ? database : database.name);
165
166
  }
167
+ firebaseConsoleDatabaseUrl(project, databaseId) {
168
+ const urlFriendlyDatabaseId = databaseId === "(default)" ? "-default-" : databaseId;
169
+ return (0, utils_1.consoleUrl)(project, `/firestore/databases/${urlFriendlyDatabaseId}/data`);
170
+ }
166
171
  prettyFieldString(field) {
167
172
  let result = "";
168
173
  const parsedName = util.parseFieldName(field.name);
@@ -10,7 +10,7 @@ const utils_2 = require("./utils");
10
10
  exports.name = "Astro";
11
11
  exports.support = "experimental";
12
12
  exports.type = 2;
13
- exports.supportedRange = "2 - 3";
13
+ exports.supportedRange = "2 - 4";
14
14
  async function discover(dir) {
15
15
  if (!(0, fs_extra_1.existsSync)((0, path_1.join)(dir, "package.json")))
16
16
  return;
@@ -4,7 +4,7 @@ exports.ɵcodegenPublicDirectory = exports.build = exports.init = exports.discov
4
4
  const cross_spawn_1 = require("cross-spawn");
5
5
  const fs_extra_1 = require("fs-extra");
6
6
  const path_1 = require("path");
7
- const js_yaml_1 = require("js-yaml");
7
+ const yaml = require("yaml");
8
8
  const promises_1 = require("fs/promises");
9
9
  const error_1 = require("../../error");
10
10
  const utils_1 = require("./utils");
@@ -19,7 +19,7 @@ async function discover(dir) {
19
19
  if (!(await (0, fs_extra_1.pathExists)((0, path_1.join)(dir, "web"))))
20
20
  return;
21
21
  const pubSpecBuffer = await (0, promises_1.readFile)((0, path_1.join)(dir, "pubspec.yaml"));
22
- const pubSpec = (0, js_yaml_1.load)(pubSpecBuffer.toString());
22
+ const pubSpec = yaml.parse(pubSpecBuffer.toString());
23
23
  const usingFlutter = (_a = pubSpec.dependencies) === null || _a === void 0 ? void 0 : _a.flutter;
24
24
  if (!usingFlutter)
25
25
  return;
@@ -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");
package/lib/utils.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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,6 +21,7 @@ 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");
24
+ const prompt_1 = require("./prompt");
22
25
  exports.IS_WINDOWS = process.platform === "win32";
23
26
  const SUCCESS_CHAR = exports.IS_WINDOWS ? "+" : "✔";
24
27
  const WARNING_CHAR = exports.IS_WINDOWS ? "!" : "⚠";
@@ -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",
3
- "version": "13.7.1",
3
+ "version": "13.7.3",
4
4
  "description": "Command-Line Interface for Firebase",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -86,7 +86,6 @@
86
86
  "google-auth-library": "^7.11.0",
87
87
  "inquirer": "^8.2.6",
88
88
  "inquirer-autocomplete-prompt": "^2.0.1",
89
- "js-yaml": "^3.13.1",
90
89
  "jsonwebtoken": "^9.0.0",
91
90
  "leven": "^3.1.0",
92
91
  "libsodium-wrappers": "^0.7.10",
@@ -119,6 +118,7 @@
119
118
  "uuid": "^8.3.2",
120
119
  "winston": "^3.0.0",
121
120
  "winston-transport": "^4.4.0",
122
- "ws": "^7.2.3"
121
+ "ws": "^7.2.3",
122
+ "yaml": "^2.4.1"
123
123
  }
124
124
  }
@@ -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",