firebase-tools 11.22.0 → 11.23.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 (79) hide show
  1. package/lib/commands/ext-configure.js +3 -3
  2. package/lib/commands/ext-dev-init.js +16 -4
  3. package/lib/commands/ext-dev-publish.js +3 -3
  4. package/lib/commands/ext-dev-register.js +2 -2
  5. package/lib/commands/ext-info.js +3 -3
  6. package/lib/commands/ext-install.js +2 -2
  7. package/lib/commands/ext-uninstall.js +2 -2
  8. package/lib/commands/ext-update.js +2 -2
  9. package/lib/commands/hosting-channel-create.js +2 -2
  10. package/lib/commands/hosting-channel-delete.js +2 -2
  11. package/lib/commands/hosting-channel-deploy.js +2 -2
  12. package/lib/commands/hosting-clone.js +2 -2
  13. package/lib/deploy/functions/release/fabricator.js +3 -0
  14. package/lib/deploy/functions/runtimes/python/index.js +26 -13
  15. package/lib/deploy/hosting/convertConfig.js +2 -1
  16. package/lib/emulator/auth/apiSpec.js +17 -1
  17. package/lib/emulator/downloadableEmulators.js +6 -6
  18. package/lib/emulator/functionsEmulator.js +12 -15
  19. package/lib/emulator/functionsEmulatorRuntime.js +26 -42
  20. package/lib/emulator/functionsRuntimeWorker.js +48 -22
  21. package/lib/emulator/hub.js +6 -6
  22. package/lib/emulator/pubsubEmulator.js +12 -9
  23. package/lib/emulator/storage/apis/shared.js +2 -1
  24. package/lib/emulator/storage/cloudFunctions.js +1 -1
  25. package/lib/emulator/storage/files.js +18 -11
  26. package/lib/emulator/types.js +9 -9
  27. package/lib/extensions/askUserForConsent.js +4 -4
  28. package/lib/extensions/askUserForEventsConfig.js +2 -2
  29. package/lib/extensions/askUserForParam.js +2 -2
  30. package/lib/extensions/billingMigrationHelper.js +4 -4
  31. package/lib/extensions/change-log.js +4 -4
  32. package/lib/extensions/displayExtensionInfo.js +4 -4
  33. package/lib/extensions/extensionsApi.js +2 -2
  34. package/lib/extensions/extensionsHelper.js +6 -6
  35. package/lib/extensions/provisioningHelper.js +2 -2
  36. package/lib/extensions/updateHelper.js +2 -2
  37. package/lib/extensions/warnings.js +5 -5
  38. package/lib/frameworks/angular/index.js +6 -4
  39. package/lib/frameworks/index.js +38 -3
  40. package/lib/frameworks/lit/index.js +5 -1
  41. package/lib/frameworks/next/index.js +42 -16
  42. package/lib/frameworks/next/utils.js +1 -1
  43. package/lib/frameworks/preact/index.js +5 -1
  44. package/lib/frameworks/react/index.js +5 -1
  45. package/lib/frameworks/svelte/index.js +5 -1
  46. package/lib/frameworks/vite/index.js +6 -4
  47. package/lib/functions/python.js +2 -7
  48. package/lib/gcp/cloudfunctionsv2.js +8 -0
  49. package/lib/getDefaultHostingSite.js +3 -1
  50. package/lib/init/features/functions/index.js +10 -0
  51. package/lib/init/features/functions/python.js +48 -0
  52. package/lib/init/features/hosting/index.js +3 -2
  53. package/lib/projectUtils.js +2 -2
  54. package/lib/rc.js +4 -4
  55. package/npm-shrinkwrap.json +87 -79
  56. package/package.json +2 -2
  57. package/templates/extensions/extension.yaml +1 -1
  58. package/templates/extensions/integration-test.env +2 -0
  59. package/templates/extensions/integration-test.json +14 -0
  60. package/templates/extensions/javascript/WELCOME.md +14 -5
  61. package/templates/extensions/javascript/index.js +10 -10
  62. package/templates/extensions/javascript/integration-test.js +13 -0
  63. package/templates/extensions/javascript/package.lint.json +12 -4
  64. package/templates/extensions/javascript/package.nolint.json +11 -2
  65. package/templates/extensions/typescript/WELCOME.md +18 -5
  66. package/templates/extensions/typescript/_mocharc +10 -0
  67. package/templates/extensions/typescript/index.ts +16 -15
  68. package/templates/extensions/typescript/integration-test.ts +13 -0
  69. package/templates/extensions/typescript/package.lint.json +16 -4
  70. package/templates/extensions/typescript/package.nolint.json +12 -4
  71. package/templates/init/functions/javascript/_eslintrc +16 -2
  72. package/templates/init/functions/javascript/package.lint.json +4 -4
  73. package/templates/init/functions/javascript/package.nolint.json +3 -3
  74. package/templates/init/functions/python/_gitignore +0 -0
  75. package/templates/init/functions/python/main.py +13 -0
  76. package/templates/init/functions/python/requirements.txt +1 -0
  77. package/templates/init/functions/typescript/_eslintrc +1 -0
  78. package/templates/init/functions/typescript/package.lint.json +4 -4
  79. package/templates/init/functions/typescript/package.nolint.json +4 -3
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const { marked } = require("marked");
4
+ const marked_1 = require("marked");
5
5
  const TerminalRenderer = require("marked-terminal");
6
6
  const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion");
7
7
  const command_1 = require("../command");
@@ -18,7 +18,7 @@ const manifest = require("../extensions/manifest");
18
18
  const functional_1 = require("../functional");
19
19
  const paramHelper_1 = require("../extensions/paramHelper");
20
20
  const askUserForEventsConfig = require("../extensions/askUserForEventsConfig");
21
- marked.setOptions({
21
+ marked_1.marked.setOptions({
22
22
  renderer: new TerminalRenderer(),
23
23
  });
24
24
  exports.command = new command_1.Command("ext:configure <extensionInstanceId>")
@@ -98,7 +98,7 @@ function infoImmutableParams(immutableParams, paramValues) {
98
98
  return;
99
99
  }
100
100
  const plural = immutableParams.length > 1;
101
- utils.logLabeledWarning(extensionsHelper_1.logPrefix, marked(`The following param${plural ? "s are" : " is"} immutable and won't be changed:`));
101
+ utils.logLabeledWarning(extensionsHelper_1.logPrefix, (0, marked_1.marked)(`The following param${plural ? "s are" : " is"} immutable and won't be changed:`));
102
102
  for (const { param } of immutableParams) {
103
103
  logger_1.logger.info(`param: ${param}, value: ${paramValues[param]}`);
104
104
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
4
  const fs = require("fs");
5
5
  const path = require("path");
6
- const { marked } = require("marked");
6
+ const marked_1 = require("marked");
7
7
  const TerminalRenderer = require("marked-terminal");
8
8
  const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion");
9
9
  const command_1 = require("../command");
@@ -12,13 +12,15 @@ const error_1 = require("../error");
12
12
  const prompt_1 = require("../prompt");
13
13
  const logger_1 = require("../logger");
14
14
  const npmDependencies = require("../init/features/functions/npm-dependencies");
15
- marked.setOptions({
15
+ marked_1.marked.setOptions({
16
16
  renderer: new TerminalRenderer(),
17
17
  });
18
18
  const TEMPLATE_ROOT = path.resolve(__dirname, "../../templates/extensions/");
19
19
  const FUNCTIONS_ROOT = path.resolve(__dirname, "../../templates/init/functions/");
20
20
  function readCommonTemplates() {
21
21
  return {
22
+ integrationTestFirebaseJsonTemplate: fs.readFileSync(path.join(TEMPLATE_ROOT, "integration-test.json"), "utf8"),
23
+ integrationTestEnvTemplate: fs.readFileSync(path.join(TEMPLATE_ROOT, "integration-test.env"), "utf8"),
22
24
  extSpecTemplate: fs.readFileSync(path.join(TEMPLATE_ROOT, "extension.yaml"), "utf8"),
23
25
  preinstallTemplate: fs.readFileSync(path.join(TEMPLATE_ROOT, "PREINSTALL.md"), "utf8"),
24
26
  postinstallTemplate: fs.readFileSync(path.join(TEMPLATE_ROOT, "POSTINSTALL.md"), "utf8"),
@@ -61,9 +63,9 @@ exports.command = new command_1.Command("ext:dev:init")
61
63
  throw new error_1.FirebaseError(`${lang} is not supported.`);
62
64
  }
63
65
  }
64
- await npmDependencies.askInstallDependencies({}, config);
66
+ await npmDependencies.askInstallDependencies({ source: "functions" }, config);
65
67
  const welcome = fs.readFileSync(path.join(TEMPLATE_ROOT, lang, "WELCOME.md"), "utf8");
66
- return logger_1.logger.info("\n" + marked(welcome));
68
+ return logger_1.logger.info("\n" + (0, marked_1.marked)(welcome));
67
69
  }
68
70
  catch (err) {
69
71
  if (!(err instanceof error_1.FirebaseError)) {
@@ -80,7 +82,9 @@ async function typescriptSelected(config) {
80
82
  const tsconfigTemplate = fs.readFileSync(path.join(TEMPLATE_ROOT, "typescript", "tsconfig.json"), "utf8");
81
83
  const tsconfigDevTemplate = fs.readFileSync(path.join(TEMPLATE_ROOT, "typescript", "tsconfig.dev.json"), "utf8");
82
84
  const indexTemplate = fs.readFileSync(path.join(TEMPLATE_ROOT, "typescript", "index.ts"), "utf8");
85
+ const integrationTestTemplate = fs.readFileSync(path.join(TEMPLATE_ROOT, "typescript", "integration-test.ts"), "utf8");
83
86
  const gitignoreTemplate = fs.readFileSync(path.join(TEMPLATE_ROOT, "typescript", "_gitignore"), "utf8");
87
+ const mocharcTemplate = fs.readFileSync(path.join(TEMPLATE_ROOT, "typescript", "_mocharc"), "utf8");
84
88
  const eslintTemplate = fs.readFileSync(path.join(FUNCTIONS_ROOT, "typescript", "_eslintrc"), "utf8");
85
89
  const lint = await (0, prompt_1.promptOnce)({
86
90
  name: "lint",
@@ -93,7 +97,11 @@ async function typescriptSelected(config) {
93
97
  await config.askWriteProjectFile("PREINSTALL.md", templates.preinstallTemplate);
94
98
  await config.askWriteProjectFile("POSTINSTALL.md", templates.postinstallTemplate);
95
99
  await config.askWriteProjectFile("CHANGELOG.md", templates.changelogTemplate);
100
+ await config.askWriteProjectFile("functions/.mocharc.json", mocharcTemplate);
96
101
  await config.askWriteProjectFile("functions/src/index.ts", indexTemplate);
102
+ await config.askWriteProjectFile("functions/integration-tests/integration-test.spec.ts", integrationTestTemplate);
103
+ await config.askWriteProjectFile("functions/integration-tests/firebase.json", templates.integrationTestFirebaseJsonTemplate);
104
+ await config.askWriteProjectFile("functions/integration-tests/extensions/greet-the-world.env", templates.integrationTestEnvTemplate);
97
105
  if (lint) {
98
106
  await config.askWriteProjectFile("functions/package.json", packageLintingTemplate);
99
107
  await config.askWriteProjectFile("functions/.eslintrc.js", eslintTemplate);
@@ -109,6 +117,7 @@ async function typescriptSelected(config) {
109
117
  }
110
118
  async function javascriptSelected(config) {
111
119
  const indexTemplate = fs.readFileSync(path.join(TEMPLATE_ROOT, "javascript", "index.js"), "utf8");
120
+ const integrationTestTemplate = fs.readFileSync(path.join(TEMPLATE_ROOT, "javascript", "integration-test.js"), "utf8");
112
121
  const packageLintingTemplate = fs.readFileSync(path.join(TEMPLATE_ROOT, "javascript", "package.lint.json"), "utf8");
113
122
  const packageNoLintingTemplate = fs.readFileSync(path.join(TEMPLATE_ROOT, "javascript", "package.nolint.json"), "utf8");
114
123
  const gitignoreTemplate = fs.readFileSync(path.join(TEMPLATE_ROOT, "javascript", "_gitignore"), "utf8");
@@ -125,6 +134,9 @@ async function javascriptSelected(config) {
125
134
  await config.askWriteProjectFile("POSTINSTALL.md", templates.postinstallTemplate);
126
135
  await config.askWriteProjectFile("CHANGELOG.md", templates.changelogTemplate);
127
136
  await config.askWriteProjectFile("functions/index.js", indexTemplate);
137
+ await config.askWriteProjectFile("functions/integration-tests/integration-test.spec.js", integrationTestTemplate);
138
+ await config.askWriteProjectFile("functions/integration-tests/firebase.json", templates.integrationTestFirebaseJsonTemplate);
139
+ await config.askWriteProjectFile("functions/integration-tests/extensions/greet-the-world.env", templates.integrationTestEnvTemplate);
128
140
  if (lint) {
129
141
  await config.askWriteProjectFile("functions/package.json", packageLintingTemplate);
130
142
  await config.askWriteProjectFile("functions/.eslintrc.js", eslintTemplate);
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
4
  const clc = require("colorette");
5
- const { marked } = require("marked");
5
+ const marked_1 = require("marked");
6
6
  const TerminalRenderer = require("marked-terminal");
7
7
  const command_1 = require("../command");
8
8
  const extensionsHelper_1 = require("../extensions/extensionsHelper");
@@ -12,7 +12,7 @@ const publishHelpers_1 = require("../extensions/publishHelpers");
12
12
  const requireAuth_1 = require("../requireAuth");
13
13
  const error_1 = require("../error");
14
14
  const utils = require("../utils");
15
- marked.setOptions({
15
+ marked_1.marked.setOptions({
16
16
  renderer: new TerminalRenderer(),
17
17
  });
18
18
  exports.command = new command_1.Command("ext:dev:publish <extensionRef>")
@@ -42,7 +42,7 @@ exports.command = new command_1.Command("ext:dev:publish <extensionRef>")
42
42
  stage: (_a = options.stage) !== null && _a !== void 0 ? _a : "stable",
43
43
  });
44
44
  if (res) {
45
- utils.logLabeledBullet(extensionsHelper_1.logPrefix, marked(`[Install Link](${(0, publishHelpers_1.consoleInstallLink)(res.ref)})`));
45
+ utils.logLabeledBullet(extensionsHelper_1.logPrefix, (0, marked_1.marked)(`[Install Link](${(0, publishHelpers_1.consoleInstallLink)(res.ref)})`));
46
46
  }
47
47
  return res;
48
48
  });
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
4
  const clc = require("colorette");
5
- const { marked } = require("marked");
5
+ const marked_1 = require("marked");
6
6
  const command_1 = require("../command");
7
7
  const extensionsApi_1 = require("../extensions/extensionsApi");
8
8
  const projectUtils_1 = require("../projectUtils");
@@ -38,7 +38,7 @@ exports.command = new command_1.Command("ext:dev:register")
38
38
  " This can happen for either of two reasons:\n\n" +
39
39
  ` - Publisher ID '${clc.bold(publisherId)}' is registered to another project\n` +
40
40
  ` - Project '${clc.bold(projectId)}' already has a publisher ID\n\n` +
41
- ` 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 ${marked("(https://firebase.google.com/support/troubleshooter/contact).")}`;
41
+ ` 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).")}`;
42
42
  throw new error_1.FirebaseError(error, { exit: 1 });
43
43
  }
44
44
  throw new error_1.FirebaseError(`Failed to register publisher ID ${clc.bold(publisherId)} for project ${clc.bold(projectId)}: ${err.message}`);
@@ -10,7 +10,7 @@ const localHelper_1 = require("../extensions/localHelper");
10
10
  const logger_1 = require("../logger");
11
11
  const requirePermissions_1 = require("../requirePermissions");
12
12
  const utils = require("../utils");
13
- const { marked } = require("marked");
13
+ const marked_1 = require("marked");
14
14
  const TerminalRenderer = require("marked-terminal");
15
15
  const FUNCTION_TYPE_REGEX = /\..+\.function/;
16
16
  exports.command = new command_1.Command("ext:info <extensionName>")
@@ -108,10 +108,10 @@ exports.command = new command_1.Command("ext:info <extensionName>")
108
108
  logger_1.logger.info(lines.join("\n\n"));
109
109
  }
110
110
  else {
111
- marked.setOptions({
111
+ marked_1.marked.setOptions({
112
112
  renderer: new TerminalRenderer(),
113
113
  });
114
- logger_1.logger.info(marked(lines.join("\n")));
114
+ logger_1.logger.info((0, marked_1.marked)(lines.join("\n")));
115
115
  utils.logLabeledBullet(extensionsHelper_1.logPrefix, `to install this extension, type ` +
116
116
  clc.bold(`firebase ext:install ${extensionName} --project=YOUR_PROJECT`));
117
117
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
4
  const clc = require("colorette");
5
- const { marked } = require("marked");
5
+ const marked_1 = require("marked");
6
6
  const TerminalRenderer = require("marked-terminal");
7
7
  const displayExtensionInfo_1 = require("../extensions/displayExtensionInfo");
8
8
  const askUserForEventsConfig = require("../extensions/askUserForEventsConfig");
@@ -21,7 +21,7 @@ const utils = require("../utils");
21
21
  const track_1 = require("../track");
22
22
  const experiments = require("../experiments");
23
23
  const manifest = require("../extensions/manifest");
24
- marked.setOptions({
24
+ marked_1.marked.setOptions({
25
25
  renderer: new TerminalRenderer(),
26
26
  });
27
27
  exports.command = new command_1.Command("ext:install [extensionName]")
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const { marked } = require("marked");
4
+ const marked_1 = require("marked");
5
5
  const TerminalRenderer = require("marked-terminal");
6
6
  const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion");
7
7
  const command_1 = require("../command");
@@ -9,7 +9,7 @@ const extensionsHelper_1 = require("../extensions/extensionsHelper");
9
9
  const requirePermissions_1 = require("../requirePermissions");
10
10
  const utils_1 = require("../utils");
11
11
  const manifest = require("../extensions/manifest");
12
- marked.setOptions({
12
+ marked_1.marked.setOptions({
13
13
  renderer: new TerminalRenderer(),
14
14
  });
15
15
  exports.command = new command_1.Command("ext:uninstall <extensionInstanceId>")
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
4
  const clc = require("colorette");
5
- const { marked } = require("marked");
5
+ const marked_1 = require("marked");
6
6
  const TerminalRenderer = require("marked-terminal");
7
7
  const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion");
8
8
  const command_1 = require("../command");
@@ -18,7 +18,7 @@ const utils = require("../utils");
18
18
  const experiments = require("../experiments");
19
19
  const manifest = require("../extensions/manifest");
20
20
  const askUserForEventsConfig = require("../extensions/askUserForEventsConfig");
21
- marked.setOptions({
21
+ marked_1.marked.setOptions({
22
22
  renderer: new TerminalRenderer(),
23
23
  });
24
24
  exports.command = new command_1.Command("ext:update <extensionInstanceId> [updateSource]")
@@ -12,7 +12,7 @@ const requirePermissions_1 = require("../requirePermissions");
12
12
  const projectUtils_1 = require("../projectUtils");
13
13
  const logger_1 = require("../logger");
14
14
  const requireConfig_1 = require("../requireConfig");
15
- const { marked } = require("marked");
15
+ const marked_1 = require("marked");
16
16
  const requireHostingSite_1 = require("../requireHostingSite");
17
17
  const LOG_TAG = "hosting:channel";
18
18
  exports.command = new command_1.Command("hosting:channel:create [channelId]")
@@ -54,7 +54,7 @@ exports.command = new command_1.Command("hosting:channel:create [channelId]")
54
54
  await (0, api_1.addAuthDomains)(projectId, [channel.url]);
55
55
  }
56
56
  catch (e) {
57
- (0, utils_1.logLabeledWarning)(LOG_TAG, marked(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
57
+ (0, utils_1.logLabeledWarning)(LOG_TAG, (0, marked_1.marked)(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
58
58
  logger_1.logger.debug("[hosting] unable to add auth domain", e);
59
59
  }
60
60
  logger_1.logger.info();
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
4
  const colorette_1 = require("colorette");
5
- const { marked } = require("marked");
5
+ const marked_1 = require("marked");
6
6
  const command_1 = require("../command");
7
7
  const utils_1 = require("../utils");
8
8
  const api_1 = require("../hosting/api");
@@ -39,7 +39,7 @@ exports.command = new command_1.Command("hosting:channel:delete <channelId>")
39
39
  await (0, api_1.removeAuthDomain)(projectId, channel.url);
40
40
  }
41
41
  catch (e) {
42
- (0, utils_1.logLabeledWarning)("hosting:channel", marked(`Unable to remove channel domain from Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
42
+ (0, utils_1.logLabeledWarning)("hosting:channel", (0, marked_1.marked)(`Unable to remove channel domain from Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
43
43
  logger_1.logger.debug("[hosting] unable to remove auth domain", e);
44
44
  }
45
45
  }
@@ -13,7 +13,7 @@ const requireConfig_1 = require("../requireConfig");
13
13
  const expireUtils_1 = require("../hosting/expireUtils");
14
14
  const utils_1 = require("../utils");
15
15
  const config_1 = require("../hosting/config");
16
- const { marked } = require("marked");
16
+ const marked_1 = require("marked");
17
17
  const requireHostingSite_1 = require("../requireHostingSite");
18
18
  const LOG_TAG = "hosting:channel";
19
19
  exports.command = new command_1.Command("hosting:channel:deploy [channelId]")
@@ -128,7 +128,7 @@ async function syncAuthState(projectId, sites) {
128
128
  logger_1.logger.debug("[hosting] added auth domain for urls", urlNames);
129
129
  }
130
130
  catch (e) {
131
- (0, utils_1.logLabeledWarning)(LOG_TAG, marked(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
131
+ (0, utils_1.logLabeledWarning)(LOG_TAG, (0, marked_1.marked)(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
132
132
  logger_1.logger.debug("[hosting] unable to add auth domain", e);
133
133
  }
134
134
  try {
@@ -8,7 +8,7 @@ const error_1 = require("../error");
8
8
  const api_1 = require("../hosting/api");
9
9
  const utils = require("../utils");
10
10
  const requireAuth_1 = require("../requireAuth");
11
- const { marked } = require("marked");
11
+ const marked_1 = require("marked");
12
12
  const logger_1 = require("../logger");
13
13
  exports.command = new command_1.Command("hosting:clone <source> <targetChannel>")
14
14
  .description("clone a version from one site to another")
@@ -68,7 +68,7 @@ For example, to copy the content for a site \`my-site\` from a preview channel \
68
68
  await (0, api_1.addAuthDomains)(tProjectId, [tChannel.url]);
69
69
  }
70
70
  catch (e) {
71
- utils.logLabeledWarning("hosting:clone", marked(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${utils.consoleUrl(targetSiteId, "/authentication/providers")}`));
71
+ utils.logLabeledWarning("hosting:clone", (0, marked_1.marked)(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${utils.consoleUrl(targetSiteId, "/authentication/providers")}`));
72
72
  logger_1.logger.debug("[hosting] unable to add auth domain", e);
73
73
  }
74
74
  }
@@ -249,6 +249,9 @@ class Fabricator {
249
249
  await this.executor
250
250
  .run(async () => {
251
251
  try {
252
+ if ((await eventarc.getChannel(channel)) !== undefined) {
253
+ return;
254
+ }
252
255
  const op = await eventarc.createChannel({ name: channel });
253
256
  return await poller.pollOperation(Object.assign(Object.assign({}, eventarcPollerOptions), { pollerName: `create-${channel}-${endpoint.region}-${endpoint.id}`, operationResourceName: op.name }));
254
257
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Delegate = exports.tryCreateDelegate = void 0;
3
+ exports.Delegate = exports.getPythonBinary = exports.tryCreateDelegate = exports.LATEST_VERSION = void 0;
4
4
  const fs = require("fs");
5
5
  const path = require("path");
6
6
  const node_fetch_1 = require("node-fetch");
@@ -11,20 +11,33 @@ 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
- const LATEST_VERSION = "python310";
14
+ exports.LATEST_VERSION = "python310";
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))) {
18
18
  logger_1.logger.debug("Customer code is not Python code.");
19
19
  return;
20
20
  }
21
- const runtime = context.runtime ? context.runtime : LATEST_VERSION;
21
+ const runtime = context.runtime ? context.runtime : exports.LATEST_VERSION;
22
22
  if (!runtimes.isValidRuntime(runtime)) {
23
23
  throw new error_1.FirebaseError(`Runtime ${runtime} is not a valid Python runtime`);
24
24
  }
25
25
  return Promise.resolve(new Delegate(context.projectId, context.sourceDir, runtime));
26
26
  }
27
27
  exports.tryCreateDelegate = tryCreateDelegate;
28
+ function getPythonBinary(runtime) {
29
+ if (process.platform === "win32") {
30
+ return "python.exe";
31
+ }
32
+ if (runtime === "python310") {
33
+ return "python3.10";
34
+ }
35
+ else if (runtime === "python311") {
36
+ return "python3.11";
37
+ }
38
+ return "python";
39
+ }
40
+ exports.getPythonBinary = getPythonBinary;
28
41
  class Delegate {
29
42
  constructor(projectId, sourceDir, runtime) {
30
43
  this.projectId = projectId;
@@ -63,16 +76,7 @@ class Delegate {
63
76
  return this._modulesDir;
64
77
  }
65
78
  getPythonBinary() {
66
- if (process.platform === "win32") {
67
- return "python.exe";
68
- }
69
- if (this.runtime === "python310") {
70
- return "python3.10";
71
- }
72
- else if (this.runtime === "python311") {
73
- return "python3.11";
74
- }
75
- return "python";
79
+ return getPythonBinary(this.runtime);
76
80
  }
77
81
  validate() {
78
82
  return Promise.resolve();
@@ -84,11 +88,20 @@ class Delegate {
84
88
  return Promise.resolve();
85
89
  }
86
90
  async serveAdmin(port, envs) {
91
+ var _a, _b;
87
92
  const modulesDir = await this.modulesDir();
88
93
  const envWithAdminPort = Object.assign(Object.assign({}, envs), { ADMIN_PORT: port.toString() });
89
94
  const args = [this.bin, path.join(modulesDir, "private", "serving.py")];
90
95
  logger_1.logger.debug(`Running admin server with args: ${JSON.stringify(args)} and env: ${JSON.stringify(envWithAdminPort)} in ${this.sourceDir}`);
91
96
  const childProcess = (0, python_1.runWithVirtualEnv)(args, this.sourceDir, envWithAdminPort);
97
+ (_a = childProcess.stdout) === null || _a === void 0 ? void 0 : _a.on("data", (chunk) => {
98
+ const chunkString = chunk.toString();
99
+ logger_1.logger.debug(`stdout: ${chunkString}`);
100
+ });
101
+ (_b = childProcess.stderr) === null || _b === void 0 ? void 0 : _b.on("data", (chunk) => {
102
+ const chunkString = chunk.toString();
103
+ logger_1.logger.debug(`stderr: ${chunkString}`);
104
+ });
92
105
  return Promise.resolve(async () => {
93
106
  await (0, node_fetch_1.default)(`http://127.0.0.1:${port}/__/quitquitquit`);
94
107
  const quitTimeout = setTimeout(() => {
@@ -81,6 +81,7 @@ async function convertConfig(context, functionsPayload, deploy) {
81
81
  }
82
82
  }
83
83
  config.rewrites = (_b = deploy.config.rewrites) === null || _b === void 0 ? void 0 : _b.map((rewrite) => {
84
+ var _a;
84
85
  const target = extractPattern("rewrite", rewrite);
85
86
  if ("destination" in rewrite) {
86
87
  return Object.assign(Object.assign({}, target), { path: rewrite.destination });
@@ -120,7 +121,7 @@ async function convertConfig(context, functionsPayload, deploy) {
120
121
  return Object.assign(Object.assign({}, target), { function: endpoint.id, functionRegion: endpoint.region });
121
122
  }
122
123
  const apiRewrite = Object.assign(Object.assign({}, target), { run: {
123
- serviceId: endpoint.id,
124
+ serviceId: (_a = endpoint.runServiceId) !== null && _a !== void 0 ? _a : endpoint.id,
124
125
  region: endpoint.region,
125
126
  } });
126
127
  if (rewrite.function.pinTag) {
@@ -5192,6 +5192,10 @@ exports.default = {
5192
5192
  description: "Request message for SignInWithGameCenter",
5193
5193
  properties: {
5194
5194
  displayName: { description: "The user's Game Center display name.", type: "string" },
5195
+ gamePlayerId: {
5196
+ description: "The user's Game Center game player ID. A unique identifier for a player of the game. https://developer.apple.com/documentation/gamekit/gkplayer/3113960-gameplayerid",
5197
+ type: "string",
5198
+ },
5195
5199
  idToken: {
5196
5200
  description: "A valid ID token for an Identity Platform account. If present, this request will link the Game Center player ID to the account represented by this ID token.",
5197
5201
  type: "string",
@@ -5209,6 +5213,10 @@ exports.default = {
5209
5213
  description: "Required. The verification signature data generated by Apple.",
5210
5214
  type: "string",
5211
5215
  },
5216
+ teamPlayerId: {
5217
+ description: "The user's Game Center team player ID. A unique identifier for a player of all the games that you distribute using your developer account. https://developer.apple.com/documentation/gamekit/gkplayer/3174857-teamplayerid",
5218
+ type: "string",
5219
+ },
5212
5220
  tenantId: {
5213
5221
  description: "The ID of the Identity Platform tenant the user is signing in to.",
5214
5222
  type: "string",
@@ -5230,6 +5238,10 @@ exports.default = {
5230
5238
  format: "int64",
5231
5239
  type: "string",
5232
5240
  },
5241
+ gamePlayerId: {
5242
+ description: "The user's Game Center game player ID. A unique identifier for a player of the game. https://developer.apple.com/documentation/gamekit/gkplayer/3113960-gameplayerid",
5243
+ type: "string",
5244
+ },
5233
5245
  idToken: {
5234
5246
  description: "An Identity Platform ID token for the authenticated user.",
5235
5247
  type: "string",
@@ -5247,6 +5259,10 @@ exports.default = {
5247
5259
  description: "An Identity Platform refresh token for the authenticated user.",
5248
5260
  type: "string",
5249
5261
  },
5262
+ teamPlayerId: {
5263
+ description: "The user's Game Center team player ID. A unique identifier for a player of all the games that you distribute using your developer account. https://developer.apple.com/documentation/gamekit/gkplayer/3174857-teamplayerid",
5264
+ type: "string",
5265
+ },
5250
5266
  },
5251
5267
  type: "object",
5252
5268
  },
@@ -7058,7 +7074,7 @@ exports.default = {
7058
7074
  properties: {
7059
7075
  condition: { $ref: "#/components/schemas/GoogleTypeExpr" },
7060
7076
  members: {
7061
- description: "Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. ",
7077
+ description: "Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding.",
7062
7078
  items: { type: "string" },
7063
7079
  type: "array",
7064
7080
  },
@@ -23,9 +23,9 @@ const EMULATOR_UPDATE_DETAILS = {
23
23
  expectedChecksum: "311609538bd65666eb724ef47c2e6466",
24
24
  },
25
25
  firestore: {
26
- version: "1.15.1",
27
- expectedSize: 61475851,
28
- expectedChecksum: "4f41d24a3c0f3b55ea22804a424cc0ee",
26
+ version: "1.16.0",
27
+ expectedSize: 63422812,
28
+ expectedChecksum: "6c1a43c1b327d534f83f7386c595d7ff",
29
29
  },
30
30
  storage: {
31
31
  version: "1.1.3",
@@ -35,9 +35,9 @@ const EMULATOR_UPDATE_DETAILS = {
35
35
  ui: experiments.isEnabled("emulatoruisnapshot")
36
36
  ? { version: "SNAPSHOT", expectedSize: -1, expectedChecksum: "" }
37
37
  : {
38
- version: "1.11.2",
39
- expectedSize: 3062873,
40
- expectedChecksum: "fe7f668437d0e3c3b92677aaaade78bf",
38
+ version: "1.11.4",
39
+ expectedSize: 3062916,
40
+ expectedChecksum: "1773926323b07fdb9602d882a7682882",
41
41
  },
42
42
  pubsub: {
43
43
  version: "0.7.1",
@@ -64,6 +64,17 @@ class TCPConn {
64
64
  }
65
65
  exports.TCPConn = TCPConn;
66
66
  class FunctionsEmulator {
67
+ static getHttpFunctionUrl(projectId, name, region, info) {
68
+ let url;
69
+ if (info) {
70
+ url = new url_1.URL("http://" + (0, functionsEmulatorShared_1.formatHost)(info));
71
+ }
72
+ else {
73
+ url = registry_1.EmulatorRegistry.url(types_1.Emulators.FUNCTIONS);
74
+ }
75
+ url.pathname = `/${projectId}/${region}/${name}`;
76
+ return url.toString();
77
+ }
67
78
  constructor(args) {
68
79
  this.args = args;
69
80
  this.triggers = {};
@@ -87,17 +98,6 @@ class FunctionsEmulator {
87
98
  }
88
99
  this.workQueue = new workQueue_1.WorkQueue(mode);
89
100
  }
90
- static getHttpFunctionUrl(projectId, name, region, info) {
91
- let url;
92
- if (info) {
93
- url = new url_1.URL("http://" + (0, functionsEmulatorShared_1.formatHost)(info));
94
- }
95
- else {
96
- url = registry_1.EmulatorRegistry.url(types_1.Emulators.FUNCTIONS);
97
- }
98
- url.pathname = `/${projectId}/${region}/${name}`;
99
- return url.toString();
100
- }
101
101
  async getCredentialsEnvironment() {
102
102
  const credentialEnv = {};
103
103
  if (process.env.GOOGLE_APPLICATION_CREDENTIALS) {
@@ -700,9 +700,6 @@ class FunctionsEmulator {
700
700
  envs.GCLOUD_PROJECT = this.args.projectId;
701
701
  envs.K_REVISION = "1";
702
702
  envs.PORT = "80";
703
- if (trigger === null || trigger === void 0 ? void 0 : trigger.timeoutSeconds) {
704
- envs.FUNCTIONS_EMULATOR_TIMEOUT_SECONDS = trigger.timeoutSeconds.toString();
705
- }
706
703
  if (trigger) {
707
704
  const target = trigger.entryPoint;
708
705
  envs.FUNCTION_TARGET = target;
@@ -857,7 +854,7 @@ class FunctionsEmulator {
857
854
  ref: (_a = backend.extensionVersion) === null || _a === void 0 ? void 0 : _a.ref,
858
855
  };
859
856
  const pool = this.workerPools[backend.codebase];
860
- const worker = pool.addWorker(trigger === null || trigger === void 0 ? void 0 : trigger.id, runtime, extensionLogInfo);
857
+ const worker = pool.addWorker(trigger, runtime, extensionLogInfo);
861
858
  await worker.waitForSocketReady();
862
859
  return worker;
863
860
  }