firebase-tools-with-isolate 13.2.1-0 → 13.4.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.
Files changed (59) hide show
  1. package/lib/api.js +2 -1
  2. package/lib/auth.js +11 -2
  3. package/lib/commands/apphosting-backends-create.js +6 -3
  4. package/lib/commands/apphosting-backends-delete.js +6 -43
  5. package/lib/commands/apphosting-backends-get.js +4 -34
  6. package/lib/commands/apphosting-backends-list.js +15 -8
  7. package/lib/commands/apphosting-builds-create.js +4 -4
  8. package/lib/commands/apphosting-builds-get.js +2 -2
  9. package/lib/commands/apphosting-rollouts-create.js +3 -3
  10. package/lib/commands/apphosting-rollouts-list.js +2 -2
  11. package/lib/commands/firestore-backups-delete.js +44 -0
  12. package/lib/commands/firestore-backups-get.js +25 -0
  13. package/lib/commands/firestore-backups-list.js +33 -0
  14. package/lib/commands/firestore-backups-schedules-create.js +67 -0
  15. package/lib/commands/firestore-backups-schedules-delete.js +46 -0
  16. package/lib/commands/firestore-backups-schedules-list.js +27 -0
  17. package/lib/commands/firestore-backups-schedules-update.js +33 -0
  18. package/lib/commands/firestore-databases-create.js +4 -2
  19. package/lib/commands/firestore-databases-delete.js +4 -2
  20. package/lib/commands/firestore-databases-get.js +3 -1
  21. package/lib/commands/firestore-databases-list.js +3 -1
  22. package/lib/commands/firestore-databases-restore.js +42 -0
  23. package/lib/commands/firestore-databases-update.js +4 -2
  24. package/lib/commands/firestore-indexes-list.js +5 -3
  25. package/lib/commands/firestore-locations.js +3 -1
  26. package/lib/commands/index.js +11 -1
  27. package/lib/commands/init.js +3 -3
  28. package/lib/deploy/extensions/v2FunctionHelper.js +2 -1
  29. package/lib/deploy/functions/ensure.js +2 -2
  30. package/lib/deploy/functions/prepare.js +5 -9
  31. package/lib/deploy/functions/runtimes/index.js +2 -0
  32. package/lib/deploy/functions/runtimes/python/index.js +4 -1
  33. package/lib/deploy/functions/services/firestore.js +1 -1
  34. package/lib/emulator/downloadableEmulators.js +3 -3
  35. package/lib/emulator/storage/rules/runtime.js +1 -1
  36. package/lib/ensureApiEnabled.js +8 -6
  37. package/lib/experiments.js +2 -2
  38. package/lib/extensions/extensionsHelper.js +2 -2
  39. package/lib/extensions/secretsUtils.js +2 -1
  40. package/lib/firestore/api-sort.js +23 -1
  41. package/lib/firestore/api-types.js +6 -1
  42. package/lib/firestore/api.js +18 -115
  43. package/lib/firestore/backupUtils.js +30 -0
  44. package/lib/firestore/delete.js +3 -3
  45. package/lib/firestore/pretty-print.js +184 -0
  46. package/lib/functions/secrets.js +1 -1
  47. package/lib/gcp/apphosting.js +4 -5
  48. package/lib/gcp/auth.js +5 -2
  49. package/lib/gcp/cloudbuild.js +7 -2
  50. package/lib/gcp/firestore.js +89 -6
  51. package/lib/gcp/storage.js +1 -1
  52. package/lib/init/features/apphosting/index.js +144 -83
  53. package/lib/init/features/apphosting/repo.js +80 -32
  54. package/lib/init/features/database.js +2 -1
  55. package/lib/init/features/extensions/index.js +2 -1
  56. package/lib/init/features/functions/index.js +3 -2
  57. package/lib/init/features/hosting/github.js +5 -0
  58. package/lib/prompt.js +1 -0
  59. package/package.json +10 -5
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const command_1 = require("../command");
5
4
  const clc = require("colorette");
5
+ const command_1 = require("../command");
6
6
  const fsi = require("../firestore/api");
7
7
  const types = require("../firestore/api-types");
8
8
  const logger_1 = require("../logger");
9
9
  const requirePermissions_1 = require("../requirePermissions");
10
10
  const types_1 = require("../emulator/types");
11
11
  const commandUtils_1 = require("../emulator/commandUtils");
12
+ const pretty_print_1 = require("../firestore/pretty-print");
12
13
  exports.command = new command_1.Command("firestore:databases:create <database>")
13
14
  .description("Create a database in your Firebase project.")
14
15
  .option("--location <locationId>", "Region to create database, for example 'nam5'. Run 'firebase firestore:locations' to get a list of eligible locations. (required)")
@@ -18,6 +19,7 @@ exports.command = new command_1.Command("firestore:databases:create <database>")
18
19
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
19
20
  .action(async (database, options) => {
20
21
  const api = new fsi.FirestoreApi();
22
+ const printer = new pretty_print_1.PrettyPrint();
21
23
  if (!options.location) {
22
24
  logger_1.logger.error("Missing required flag --location. See firebase firestore:databases:create --help for more info.");
23
25
  return;
@@ -46,7 +48,7 @@ exports.command = new command_1.Command("firestore:databases:create <database>")
46
48
  logger_1.logger.info(JSON.stringify(databaseResp, undefined, 2));
47
49
  }
48
50
  else {
49
- logger_1.logger.info(clc.bold(`Successfully created ${api.prettyDatabaseString(databaseResp)}`));
51
+ logger_1.logger.info(clc.bold(`Successfully created ${printer.prettyDatabaseString(databaseResp)}`));
50
52
  logger_1.logger.info("Please be sure to configure Firebase rules in your Firebase config file for\n" +
51
53
  "the new database. By default, created databases will have closed rules that\n" +
52
54
  "block any incoming third-party traffic.");
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const command_1 = require("../command");
5
4
  const clc = require("colorette");
5
+ const command_1 = require("../command");
6
6
  const fsi = require("../firestore/api");
7
7
  const prompt_1 = require("../prompt");
8
8
  const logger_1 = require("../logger");
@@ -10,6 +10,7 @@ const requirePermissions_1 = require("../requirePermissions");
10
10
  const types_1 = require("../emulator/types");
11
11
  const commandUtils_1 = require("../emulator/commandUtils");
12
12
  const error_1 = require("../error");
13
+ const pretty_print_1 = require("../firestore/pretty-print");
13
14
  exports.command = new command_1.Command("firestore:databases:delete <database>")
14
15
  .description("Delete a database in your Cloud Firestore project. Database delete protection state must be disabled. To do so, use the update command: firebase firestore:databases:update <database> --delete-protection DISABLED")
15
16
  .option("--force", "Attempt to delete database without prompting for confirmation.")
@@ -17,6 +18,7 @@ exports.command = new command_1.Command("firestore:databases:delete <database>")
17
18
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
18
19
  .action(async (database, options) => {
19
20
  const api = new fsi.FirestoreApi();
21
+ const printer = new pretty_print_1.PrettyPrint();
20
22
  if (!options.force) {
21
23
  const confirmMessage = `You are about to delete projects/${options.project}/databases/${database}. Do you wish to continue?`;
22
24
  const consent = await (0, prompt_1.promptOnce)({
@@ -33,7 +35,7 @@ exports.command = new command_1.Command("firestore:databases:delete <database>")
33
35
  logger_1.logger.info(JSON.stringify(databaseResp, undefined, 2));
34
36
  }
35
37
  else {
36
- logger_1.logger.info(clc.bold(`Successfully deleted ${api.prettyDatabaseString(databaseResp)}`));
38
+ logger_1.logger.info(clc.bold(`Successfully deleted ${printer.prettyDatabaseString(databaseResp)}`));
37
39
  }
38
40
  return databaseResp;
39
41
  });
@@ -7,19 +7,21 @@ const logger_1 = require("../logger");
7
7
  const requirePermissions_1 = require("../requirePermissions");
8
8
  const types_1 = require("../emulator/types");
9
9
  const commandUtils_1 = require("../emulator/commandUtils");
10
+ const pretty_print_1 = require("../firestore/pretty-print");
10
11
  exports.command = new command_1.Command("firestore:databases:get [database]")
11
12
  .description("Get database in your Cloud Firestore project.")
12
13
  .before(requirePermissions_1.requirePermissions, ["datastore.databases.get"])
13
14
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
14
15
  .action(async (database, options) => {
15
16
  const api = new fsi.FirestoreApi();
17
+ const printer = new pretty_print_1.PrettyPrint();
16
18
  const databaseId = database || "(default)";
17
19
  const databaseResp = await api.getDatabase(options.project, databaseId);
18
20
  if (options.json) {
19
21
  logger_1.logger.info(JSON.stringify(databaseResp, undefined, 2));
20
22
  }
21
23
  else {
22
- api.prettyPrintDatabase(databaseResp);
24
+ printer.prettyPrintDatabase(databaseResp);
23
25
  }
24
26
  return databaseResp;
25
27
  });
@@ -7,18 +7,20 @@ const logger_1 = require("../logger");
7
7
  const requirePermissions_1 = require("../requirePermissions");
8
8
  const types_1 = require("../emulator/types");
9
9
  const commandUtils_1 = require("../emulator/commandUtils");
10
+ const pretty_print_1 = require("../firestore/pretty-print");
10
11
  exports.command = new command_1.Command("firestore:databases:list")
11
12
  .description("List databases in your Cloud Firestore project.")
12
13
  .before(requirePermissions_1.requirePermissions, ["datastore.databases.list"])
13
14
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
14
15
  .action(async (options) => {
15
16
  const api = new fsi.FirestoreApi();
17
+ const printer = new pretty_print_1.PrettyPrint();
16
18
  const databases = await api.listDatabases(options.project);
17
19
  if (options.json) {
18
20
  logger_1.logger.info(JSON.stringify(databases, undefined, 2));
19
21
  }
20
22
  else {
21
- api.prettyPrintDatabases(databases);
23
+ printer.prettyPrintDatabases(databases);
22
24
  }
23
25
  return databases;
24
26
  });
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
4
+ const clc = require("colorette");
5
+ const command_1 = require("../command");
6
+ const fsi = require("../firestore/api");
7
+ const logger_1 = require("../logger");
8
+ const requirePermissions_1 = require("../requirePermissions");
9
+ const types_1 = require("../emulator/types");
10
+ const commandUtils_1 = require("../emulator/commandUtils");
11
+ const pretty_print_1 = require("../firestore/pretty-print");
12
+ exports.command = new command_1.Command("firestore:databases:restore")
13
+ .description("Restore a Firestore database in your Firebase project.")
14
+ .option("-d, --database <databaseID>", "ID of the database to restore into")
15
+ .option("-b, --backup <backup>", "Backup from which to restore")
16
+ .before(requirePermissions_1.requirePermissions, ["datastore.backups.restoreDatabase"])
17
+ .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
18
+ .action(async (options) => {
19
+ const api = new fsi.FirestoreApi();
20
+ const printer = new pretty_print_1.PrettyPrint();
21
+ if (!options.database) {
22
+ logger_1.logger.error("Missing required flag --database. See firebase firestore:databases:restore --help for more info");
23
+ return;
24
+ }
25
+ const databaseId = options.database;
26
+ if (!options.backup) {
27
+ logger_1.logger.error("Missing required flag --backup. See firebase firestore:databases:restore --help for more info");
28
+ return;
29
+ }
30
+ const backupName = options.backup;
31
+ const databaseResp = await api.restoreDatabase(options.project, databaseId, backupName);
32
+ if (options.json) {
33
+ logger_1.logger.info(JSON.stringify(databaseResp, undefined, 2));
34
+ }
35
+ else {
36
+ logger_1.logger.info(clc.bold(`Successfully initiated restore of ${printer.prettyDatabaseString(databaseResp)}`));
37
+ logger_1.logger.info("Please be sure to configure Firebase rules in your Firebase config file for\n" +
38
+ "the new database. By default, created databases will have closed rules that\n" +
39
+ "block any incoming third-party traffic.");
40
+ }
41
+ return databaseResp;
42
+ });
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const command_1 = require("../command");
5
4
  const clc = require("colorette");
5
+ const command_1 = require("../command");
6
6
  const fsi = require("../firestore/api");
7
7
  const types = require("../firestore/api-types");
8
8
  const logger_1 = require("../logger");
9
9
  const requirePermissions_1 = require("../requirePermissions");
10
10
  const types_1 = require("../emulator/types");
11
11
  const commandUtils_1 = require("../emulator/commandUtils");
12
+ const pretty_print_1 = require("../firestore/pretty-print");
12
13
  exports.command = new command_1.Command("firestore:databases:update <database>")
13
14
  .description("Update a database in your Firebase project. Must specify at least one property to update.")
14
15
  .option("--json", "Prints raw json response of the create API call if specified")
@@ -18,6 +19,7 @@ exports.command = new command_1.Command("firestore:databases:update <database>")
18
19
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
19
20
  .action(async (database, options) => {
20
21
  const api = new fsi.FirestoreApi();
22
+ const printer = new pretty_print_1.PrettyPrint();
21
23
  if (!options.deleteProtection && !options.pointInTimeRecovery) {
22
24
  logger_1.logger.error("Missing properties to update. See firebase firestore:databases:update --help for more info.");
23
25
  return;
@@ -53,7 +55,7 @@ exports.command = new command_1.Command("firestore:databases:update <database>")
53
55
  logger_1.logger.info(JSON.stringify(databaseResp, undefined, 2));
54
56
  }
55
57
  else {
56
- logger_1.logger.info(clc.bold(`Successfully updated ${api.prettyDatabaseString(databaseResp)}`));
58
+ logger_1.logger.info(clc.bold(`Successfully updated ${printer.prettyDatabaseString(databaseResp)}`));
57
59
  }
58
60
  return databaseResp;
59
61
  });
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const command_1 = require("../command");
5
4
  const clc = require("colorette");
5
+ const command_1 = require("../command");
6
6
  const fsi = require("../firestore/api");
7
7
  const logger_1 = require("../logger");
8
8
  const requirePermissions_1 = require("../requirePermissions");
9
9
  const types_1 = require("../emulator/types");
10
10
  const commandUtils_1 = require("../emulator/commandUtils");
11
+ const pretty_print_1 = require("../firestore/pretty-print");
11
12
  exports.command = new command_1.Command("firestore:indexes")
12
13
  .description("List indexes in your project's Cloud Firestore database.")
13
14
  .option("--pretty", "Pretty print. When not specified the indexes are printed in the " +
@@ -17,17 +18,18 @@ exports.command = new command_1.Command("firestore:indexes")
17
18
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
18
19
  .action(async (options) => {
19
20
  const indexApi = new fsi.FirestoreApi();
21
+ const printer = new pretty_print_1.PrettyPrint();
20
22
  const databaseId = options.database ?? "(default)";
21
23
  const indexes = await indexApi.listIndexes(options.project, databaseId);
22
24
  const fieldOverrides = await indexApi.listFieldOverrides(options.project, databaseId);
23
25
  const indexSpec = indexApi.makeIndexSpec(indexes, fieldOverrides);
24
26
  if (options.pretty) {
25
27
  logger_1.logger.info(clc.bold(clc.white("Compound Indexes")));
26
- indexApi.prettyPrintIndexes(indexes);
28
+ printer.prettyPrintIndexes(indexes);
27
29
  if (fieldOverrides) {
28
30
  logger_1.logger.info();
29
31
  logger_1.logger.info(clc.bold(clc.white("Field Overrides")));
30
- indexApi.printFieldOverrides(fieldOverrides);
32
+ printer.printFieldOverrides(fieldOverrides);
31
33
  }
32
34
  }
33
35
  else {
@@ -7,18 +7,20 @@ const logger_1 = require("../logger");
7
7
  const requirePermissions_1 = require("../requirePermissions");
8
8
  const types_1 = require("../emulator/types");
9
9
  const commandUtils_1 = require("../emulator/commandUtils");
10
+ const pretty_print_1 = require("../firestore/pretty-print");
10
11
  exports.command = new command_1.Command("firestore:locations")
11
12
  .description("List possible locations for your Cloud Firestore project.")
12
13
  .before(requirePermissions_1.requirePermissions, ["datastore.locations.list"])
13
14
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
14
15
  .action(async (options) => {
15
16
  const api = new fsi.FirestoreApi();
17
+ const printer = new pretty_print_1.PrettyPrint();
16
18
  const locations = await api.locations(options.project);
17
19
  if (options.json) {
18
20
  logger_1.logger.info(JSON.stringify(locations, undefined, 2));
19
21
  }
20
22
  else {
21
- api.prettyPrintLocations(locations);
23
+ printer.prettyPrintLocations(locations);
22
24
  }
23
25
  return locations;
24
26
  });
@@ -101,6 +101,16 @@ function load(client) {
101
101
  client.firestore.databases.create = loadCommand("firestore-databases-create");
102
102
  client.firestore.databases.update = loadCommand("firestore-databases-update");
103
103
  client.firestore.databases.delete = loadCommand("firestore-databases-delete");
104
+ client.firestore.databases.restore = loadCommand("firestore-databases-restore");
105
+ client.firestore.backups = {};
106
+ client.firestore.backups.schedules = {};
107
+ client.firestore.backups.list = loadCommand("firestore-backups-list");
108
+ client.firestore.backups.get = loadCommand("firestore-backups-get");
109
+ client.firestore.backups.delete = loadCommand("firestore-backups-delete");
110
+ client.firestore.backups.schedules.list = loadCommand("firestore-backups-schedules-list");
111
+ client.firestore.backups.schedules.create = loadCommand("firestore-backups-schedules-create");
112
+ client.firestore.backups.schedules.update = loadCommand("firestore-backups-schedules-update");
113
+ client.firestore.backups.schedules.delete = loadCommand("firestore-backups-schedules-delete");
104
114
  client.functions = {};
105
115
  client.functions.config = {};
106
116
  client.functions.config.clone = loadCommand("functions-config-clone");
@@ -144,7 +154,7 @@ function load(client) {
144
154
  client.internaltesting.functions = {};
145
155
  client.internaltesting.functions.discover = loadCommand("internaltesting-functions-discover");
146
156
  }
147
- if (experiments.isEnabled("internalframeworks")) {
157
+ if (experiments.isEnabled("apphosting")) {
148
158
  client.apphosting = {};
149
159
  client.apphosting.backends = {};
150
160
  client.apphosting.backends.list = loadCommand("apphosting-backends-list");
@@ -69,10 +69,10 @@ const choices = [
69
69
  checked: false,
70
70
  },
71
71
  ];
72
- if ((0, experiments_1.isEnabled)("internalframeworks")) {
72
+ if ((0, experiments_1.isEnabled)("apphosting")) {
73
73
  choices.push({
74
- value: "internalframeworks",
75
- name: "Frameworks: Get started with Frameworks projects.",
74
+ value: "apphosting",
75
+ name: "App Hosting: Get started with App Hosting projects.",
76
76
  checked: false,
77
77
  });
78
78
  }
@@ -8,6 +8,7 @@ const error_1 = require("../../error");
8
8
  const ensureApiEnabled_1 = require("../../ensureApiEnabled");
9
9
  const planner = require("./planner");
10
10
  const projectUtils_1 = require("../../projectUtils");
11
+ const api_1 = require("../../api");
11
12
  const SERVICE_AGENT_ROLE = "roles/eventarc.eventReceiver";
12
13
  async function checkSpecForV2Functions(i) {
13
14
  const extensionSpec = await planner.getExtensionSpec(i);
@@ -16,7 +17,7 @@ async function checkSpecForV2Functions(i) {
16
17
  exports.checkSpecForV2Functions = checkSpecForV2Functions;
17
18
  async function ensureNecessaryV2ApisAndRoles(options) {
18
19
  const projectId = (0, projectUtils_1.needProjectId)(options);
19
- await (0, ensureApiEnabled_1.ensure)(projectId, "compute.googleapis.com", "extensions", options.markdown);
20
+ await (0, ensureApiEnabled_1.ensure)(projectId, api_1.computeOrigin, "extensions", options.markdown);
20
21
  await ensureComputeP4SARole(projectId);
21
22
  }
22
23
  exports.ensureNecessaryV2ApisAndRoles = ensureNecessaryV2ApisAndRoles;
@@ -8,9 +8,9 @@ const utils_1 = require("../../utils");
8
8
  const secretManager_1 = require("../../gcp/secretManager");
9
9
  const projects_1 = require("../../management/projects");
10
10
  const functional_1 = require("../../functional");
11
+ const api_1 = require("../../api");
11
12
  const backend = require("./backend");
12
13
  const FAQ_URL = "https://firebase.google.com/support/faq#functions-runtime";
13
- const CLOUD_BUILD_API = "cloudbuild.googleapis.com";
14
14
  const metadataCallCache = new Map();
15
15
  async function defaultServiceAccount(e) {
16
16
  let metadataCall = metadataCallCache.get(e.project);
@@ -53,7 +53,7 @@ function isPermissionError(e) {
53
53
  }
54
54
  async function cloudBuildEnabled(projectId) {
55
55
  try {
56
- await (0, ensureApiEnabled_1.ensure)(projectId, CLOUD_BUILD_API, "functions");
56
+ await (0, ensureApiEnabled_1.ensure)(projectId, api_1.cloudbuildOrigin, "functions");
57
57
  }
58
58
  catch (e) {
59
59
  if ((0, error_1.isBillingError)(e)) {
@@ -10,6 +10,7 @@ const functionsEnv = require("../../functions/env");
10
10
  const runtimes = require("./runtimes");
11
11
  const validate = require("./validate");
12
12
  const ensure = require("./ensure");
13
+ const api_1 = require("../../api");
13
14
  const functionsDeployHelper_1 = require("./functionsDeployHelper");
14
15
  const utils_1 = require("../../utils");
15
16
  const prepareFunctionsUpload_1 = require("./prepareFunctionsUpload");
@@ -39,10 +40,10 @@ async function prepare(context, options, payload) {
39
40
  (0, utils_1.logLabeledBullet)("functions", `preparing codebase ${clc.bold(codebase)} for deployment`);
40
41
  }
41
42
  const checkAPIsEnabled = await Promise.all([
42
- ensureApiEnabled.ensure(projectId, "cloudfunctions.googleapis.com", "functions"),
43
- ensureApiEnabled.check(projectId, "runtimeconfig.googleapis.com", "runtimeconfig", true),
43
+ ensureApiEnabled.ensure(projectId, api_1.functionsOrigin, "functions"),
44
+ ensureApiEnabled.check(projectId, api_1.runtimeconfigOrigin, "runtimeconfig", true),
44
45
  ensure.cloudBuildEnabled(projectId),
45
- ensureApiEnabled.ensure(projectId, "artifactregistry.googleapis.com", "artifactregistry"),
46
+ ensureApiEnabled.ensure(projectId, api_1.artifactRegistryDomain, "artifactregistry"),
46
47
  ]);
47
48
  const firebaseConfig = await functionsConfig.getFirebaseConfig(options);
48
49
  context.firebaseConfig = firebaseConfig;
@@ -156,12 +157,7 @@ async function prepare(context, options, payload) {
156
157
  return ensureApiEnabled.ensure(projectId, api, "functions", false);
157
158
  }));
158
159
  if (backend.someEndpoint(wantBackend, (e) => e.platform === "gcfv2")) {
159
- const V2_APIS = [
160
- "run.googleapis.com",
161
- "eventarc.googleapis.com",
162
- "pubsub.googleapis.com",
163
- "storage.googleapis.com",
164
- ];
160
+ const V2_APIS = [api_1.cloudRunApiOrigin, api_1.eventarcOrigin, api_1.pubsubOrigin, api_1.storageOrigin];
165
161
  const enablements = V2_APIS.map((api) => {
166
162
  return ensureApiEnabled.ensure(context.projectId, api, "functions");
167
163
  });
@@ -14,6 +14,7 @@ const RUNTIMES = [
14
14
  "nodejs20",
15
15
  "python310",
16
16
  "python311",
17
+ "python312",
17
18
  ];
18
19
  const EXPERIMENTAL_RUNTIMES = [];
19
20
  const DEPRECATED_RUNTIMES = ["nodejs6", "nodejs8"];
@@ -36,6 +37,7 @@ const MESSAGE_FRIENDLY_RUNTIMES = {
36
37
  nodejs20: "Node.js 20",
37
38
  python310: "Python 3.10",
38
39
  python311: "Python 3.11",
40
+ python312: "Python 3.12",
39
41
  };
40
42
  function getHumanFriendlyRuntimeName(runtime) {
41
43
  return MESSAGE_FRIENDLY_RUNTIMES[runtime] || runtime;
@@ -11,7 +11,7 @@ const discovery = require("../discovery");
11
11
  const logger_1 = require("../../../../logger");
12
12
  const python_1 = require("../../../../functions/python");
13
13
  const error_1 = require("../../../../error");
14
- exports.LATEST_VERSION = "python311";
14
+ exports.LATEST_VERSION = "python312";
15
15
  async function tryCreateDelegate(context) {
16
16
  const requirementsTextPath = path.join(context.sourceDir, "requirements.txt");
17
17
  if (!(await (0, util_1.promisify)(fs.exists)(requirementsTextPath))) {
@@ -35,6 +35,9 @@ function getPythonBinary(runtime) {
35
35
  else if (runtime === "python311") {
36
36
  return "python3.11";
37
37
  }
38
+ else if (runtime === "python312") {
39
+ return "python3.12";
40
+ }
38
41
  return "python";
39
42
  }
40
43
  exports.getPythonBinary = getPythonBinary;
@@ -9,7 +9,7 @@ async function getDatabase(project, databaseId) {
9
9
  if (dbCache.has(key)) {
10
10
  return dbCache.get(key);
11
11
  }
12
- const db = await firestore.getDatabase(project, databaseId);
12
+ const db = await firestore.getDatabase(project, databaseId, false);
13
13
  dbCache.set(key, db);
14
14
  return db;
15
15
  }
@@ -23,9 +23,9 @@ const EMULATOR_UPDATE_DETAILS = {
23
23
  expectedChecksum: "2fd771101c0e1f7898c04c9204f2ce63",
24
24
  },
25
25
  firestore: {
26
- version: "1.18.2",
27
- expectedSize: 63929486,
28
- expectedChecksum: "7b066cd684baf9bcd4a56a258be344a5",
26
+ version: "1.19.1",
27
+ expectedSize: 67187672,
28
+ expectedChecksum: "859b1ac2a6040cccddd993c43586347c",
29
29
  },
30
30
  storage: {
31
31
  version: "1.1.3",
@@ -333,7 +333,7 @@ function createAuthExpressionValue(opts) {
333
333
  return toExpressionValue(null);
334
334
  }
335
335
  else {
336
- const tokenPayload = jwt.decode(opts.token);
336
+ const tokenPayload = jwt.decode(opts.token, { json: true });
337
337
  const jsonValue = {
338
338
  uid: tokenPayload.user_id,
339
339
  token: tokenPayload,
@@ -15,7 +15,8 @@ const apiClient = new apiv2_1.Client({
15
15
  urlPrefix: api_1.serviceUsageOrigin,
16
16
  apiVersion: "v1",
17
17
  });
18
- async function check(projectId, apiName, prefix, silent = false) {
18
+ async function check(projectId, apiUri, prefix, silent = false) {
19
+ const apiName = apiUri.startsWith("http") ? new URL(apiUri).hostname : apiUri;
19
20
  const res = await apiClient.get(`/projects/${projectId}/services/${apiName}`, {
20
21
  headers: { "x-goog-quota-user": `projects/${projectId}` },
21
22
  skipLog: { resBody: true },
@@ -89,18 +90,19 @@ async function enableApiWithRetries(projectId, apiName, prefix, silent, enableme
89
90
  await enable(projectId, apiName);
90
91
  return pollCheckEnabled(projectId, apiName, prefix, silent, enablementRetries);
91
92
  }
92
- async function ensure(projectId, apiName, prefix, silent = false) {
93
+ async function ensure(projectId, apiUri, prefix, silent = false) {
94
+ const hostname = apiUri.startsWith("http") ? new URL(apiUri).hostname : apiUri;
93
95
  if (!silent) {
94
- utils.logLabeledBullet(prefix, `ensuring required API ${(0, colorette_1.bold)(apiName)} is enabled...`);
96
+ utils.logLabeledBullet(prefix, `ensuring required API ${(0, colorette_1.bold)(hostname)} is enabled...`);
95
97
  }
96
- const isEnabled = await check(projectId, apiName, prefix, silent);
98
+ const isEnabled = await check(projectId, hostname, prefix, silent);
97
99
  if (isEnabled) {
98
100
  return;
99
101
  }
100
102
  if (!silent) {
101
- utils.logLabeledWarning(prefix, `missing required API ${(0, colorette_1.bold)(apiName)}. Enabling now...`);
103
+ utils.logLabeledWarning(prefix, `missing required API ${(0, colorette_1.bold)(hostname)}. Enabling now...`);
102
104
  }
103
- return enableApiWithRetries(projectId, apiName, prefix, silent);
105
+ return enableApiWithRetries(projectId, hostname, prefix, silent);
104
106
  }
105
107
  exports.ensure = ensure;
106
108
  function enableApiURI(projectId, apiName) {
@@ -72,9 +72,9 @@ exports.ALL_EXPERIMENTS = experiments({
72
72
  "These commands are not meant for public consumption and may break or disappear " +
73
73
  "without a notice.",
74
74
  },
75
- internalframeworks: {
75
+ apphosting: {
76
76
  shortDescription: "Allow CLI option for Frameworks",
77
- default: true,
77
+ default: false,
78
78
  public: false,
79
79
  },
80
80
  });
@@ -352,7 +352,7 @@ async function ensureExtensionsApiEnabled(options) {
352
352
  if (!projectId) {
353
353
  return;
354
354
  }
355
- return await (0, ensureApiEnabled_1.ensure)(projectId, "firebaseextensions.googleapis.com", "extensions", options.markdown);
355
+ return await (0, ensureApiEnabled_1.ensure)(projectId, api_1.extensionsOrigin, "extensions", options.markdown);
356
356
  }
357
357
  exports.ensureExtensionsApiEnabled = ensureExtensionsApiEnabled;
358
358
  async function ensureExtensionsPublisherApiEnabled(options) {
@@ -360,7 +360,7 @@ async function ensureExtensionsPublisherApiEnabled(options) {
360
360
  if (!projectId) {
361
361
  return;
362
362
  }
363
- return await (0, ensureApiEnabled_1.ensure)(projectId, "firebaseextensionspublisher.googleapis.com", "extensions", options.markdown);
363
+ return await (0, ensureApiEnabled_1.ensure)(projectId, api_1.extensionsPublisherOrigin, "extensions", options.markdown);
364
364
  }
365
365
  exports.ensureExtensionsPublisherApiEnabled = ensureExtensionsPublisherApiEnabled;
366
366
  async function archiveAndUploadSource(extPath, bucketName) {
@@ -8,11 +8,12 @@ const projectUtils_1 = require("../projectUtils");
8
8
  const types_1 = require("./types");
9
9
  const secretManagerApi = require("../gcp/secretManager");
10
10
  const logger_1 = require("../logger");
11
+ const api_1 = require("../api");
11
12
  exports.SECRET_LABEL = "firebase-extensions-managed";
12
13
  exports.SECRET_ROLE = "secretmanager.secretAccessor";
13
14
  async function ensureSecretManagerApiEnabled(options) {
14
15
  const projectId = (0, projectUtils_1.needProjectId)(options);
15
- return await (0, ensureApiEnabled_1.ensure)(projectId, "secretmanager.googleapis.com", "extensions", options.markdown);
16
+ return await (0, ensureApiEnabled_1.ensure)(projectId, api_1.secretManagerOrigin, "extensions", options.markdown);
16
17
  }
17
18
  exports.ensureSecretManagerApiEnabled = ensureSecretManagerApiEnabled;
18
19
  function usesSecrets(spec) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.compareFieldOverride = exports.compareApiField = exports.compareLocation = exports.compareApiDatabase = exports.compareApiIndex = exports.compareSpecIndex = void 0;
3
+ exports.compareFieldOverride = exports.compareApiField = exports.compareApiBackupSchedule = exports.compareApiBackup = exports.compareLocation = exports.compareApiDatabase = exports.compareApiIndex = exports.compareSpecIndex = void 0;
4
4
  const API = require("./api-types");
5
5
  const util = require("./util");
6
6
  const QUERY_SCOPE_SEQUENCE = [
@@ -42,6 +42,28 @@ function compareLocation(a, b) {
42
42
  return a.locationId > b.locationId ? 1 : -1;
43
43
  }
44
44
  exports.compareLocation = compareLocation;
45
+ function compareApiBackup(a, b) {
46
+ const aLocation = a.name.split("/")[3];
47
+ const bLocation = b.name.split("/")[3];
48
+ if (aLocation && bLocation && aLocation !== bLocation) {
49
+ return aLocation > bLocation ? 1 : -1;
50
+ }
51
+ if (a.snapshotTime && b.snapshotTime && a.snapshotTime !== b.snapshotTime) {
52
+ return a.snapshotTime > b.snapshotTime ? -1 : 1;
53
+ }
54
+ return a.name > b.name ? 1 : -1;
55
+ }
56
+ exports.compareApiBackup = compareApiBackup;
57
+ function compareApiBackupSchedule(a, b) {
58
+ if (a.dailyRecurrence && !b.dailyRecurrence) {
59
+ return -1;
60
+ }
61
+ else if (a.weeklyRecurrence && b.dailyRecurrence) {
62
+ return 1;
63
+ }
64
+ return a.name > b.name ? 1 : -1;
65
+ }
66
+ exports.compareApiBackupSchedule = compareApiBackupSchedule;
45
67
  function compareApiField(a, b) {
46
68
  const aName = util.parseFieldName(a.name);
47
69
  const bName = util.parseFieldName(b.name);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PointInTimeRecoveryEnablement = exports.PointInTimeRecoveryEnablementOption = exports.DatabaseDeleteProtectionState = exports.DatabaseDeleteProtectionStateOption = exports.DatabaseType = exports.StateTtl = exports.State = exports.ArrayConfig = exports.Order = exports.QueryScope = exports.Mode = void 0;
3
+ exports.RecurrenceType = exports.PointInTimeRecoveryEnablement = exports.PointInTimeRecoveryEnablementOption = exports.DatabaseDeleteProtectionState = exports.DatabaseDeleteProtectionStateOption = exports.DatabaseType = exports.StateTtl = exports.State = exports.ArrayConfig = exports.Order = exports.QueryScope = exports.Mode = void 0;
4
4
  var Mode;
5
5
  (function (Mode) {
6
6
  Mode["ASCENDING"] = "ASCENDING";
@@ -58,3 +58,8 @@ var PointInTimeRecoveryEnablement;
58
58
  PointInTimeRecoveryEnablement["ENABLED"] = "POINT_IN_TIME_RECOVERY_ENABLED";
59
59
  PointInTimeRecoveryEnablement["DISABLED"] = "POINT_IN_TIME_RECOVERY_DISABLED";
60
60
  })(PointInTimeRecoveryEnablement = exports.PointInTimeRecoveryEnablement || (exports.PointInTimeRecoveryEnablement = {}));
61
+ var RecurrenceType;
62
+ (function (RecurrenceType) {
63
+ RecurrenceType["DAILY"] = "DAILY";
64
+ RecurrenceType["WEEKLY"] = "WEEKLY";
65
+ })(RecurrenceType = exports.RecurrenceType || (exports.RecurrenceType = {}));