No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

constants.js 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.Constants = exports.DEFAULT_HOST = exports.EMULATOR_DESCRIPTION = exports.FIND_AVAILBLE_PORT_BY_DEFAULT = exports.DEFAULT_PORTS = void 0;
  4. exports.DEFAULT_PORTS = {
  5. ui: 4000,
  6. hub: 4400,
  7. logging: 4500,
  8. hosting: 5000,
  9. functions: 5001,
  10. extensions: 5001,
  11. firestore: 8080,
  12. pubsub: 8085,
  13. database: 9000,
  14. auth: 9099,
  15. storage: 9199,
  16. eventarc: 9299,
  17. };
  18. exports.FIND_AVAILBLE_PORT_BY_DEFAULT = {
  19. ui: true,
  20. hub: true,
  21. logging: true,
  22. hosting: true,
  23. functions: false,
  24. firestore: false,
  25. database: false,
  26. pubsub: false,
  27. auth: false,
  28. storage: false,
  29. extensions: false,
  30. eventarc: true,
  31. };
  32. exports.EMULATOR_DESCRIPTION = {
  33. ui: "Emulator UI",
  34. hub: "emulator hub",
  35. logging: "Logging Emulator",
  36. hosting: "Hosting Emulator",
  37. functions: "Functions Emulator",
  38. firestore: "Firestore Emulator",
  39. database: "Database Emulator",
  40. pubsub: "Pub/Sub Emulator",
  41. auth: "Authentication Emulator",
  42. storage: "Storage Emulator",
  43. extensions: "Extensions Emulator",
  44. eventarc: "Eventarc Emulator",
  45. };
  46. exports.DEFAULT_HOST = "localhost";
  47. class Constants {
  48. static getServiceName(service) {
  49. switch (service) {
  50. case this.SERVICE_FIRESTORE:
  51. return "firestore";
  52. case this.SERVICE_REALTIME_DATABASE:
  53. return "database";
  54. case this.SERVICE_PUBSUB:
  55. return "pubsub";
  56. case this.SERVICE_ANALYTICS:
  57. return "analytics";
  58. case this.SERVICE_AUTH:
  59. return "auth";
  60. case this.SERVICE_CRASHLYTICS:
  61. return "crashlytics";
  62. case this.SERVICE_REMOTE_CONFIG:
  63. return "remote config";
  64. case this.SERVICE_STORAGE:
  65. return "storage";
  66. case this.SERVICE_TEST_LAB:
  67. return "test lab";
  68. case this.SERVICE_EVENTARC:
  69. return "eventarc";
  70. default:
  71. return service;
  72. }
  73. }
  74. static getDefaultHost() {
  75. return exports.DEFAULT_HOST;
  76. }
  77. static getDefaultPort(emulator) {
  78. return exports.DEFAULT_PORTS[emulator];
  79. }
  80. static description(name) {
  81. return exports.EMULATOR_DESCRIPTION[name];
  82. }
  83. static isDemoProject(projectId) {
  84. return !!projectId && projectId.startsWith(this.FAKE_PROJECT_ID_PREFIX);
  85. }
  86. }
  87. exports.Constants = Constants;
  88. Constants.FAKE_PROJECT_ID_PREFIX = "demo-";
  89. Constants.FAKE_PROJECT_NUMBER = "0";
  90. Constants.DEFAULT_DATABASE_EMULATOR_NAMESPACE = "fake-server";
  91. Constants.FIRESTORE_EMULATOR_HOST = "FIRESTORE_EMULATOR_HOST";
  92. Constants.FIRESTORE_EMULATOR_ENV_ALT = "FIREBASE_FIRESTORE_EMULATOR_ADDRESS";
  93. Constants.FIREBASE_DATABASE_EMULATOR_HOST = "FIREBASE_DATABASE_EMULATOR_HOST";
  94. Constants.FIREBASE_AUTH_EMULATOR_HOST = "FIREBASE_AUTH_EMULATOR_HOST";
  95. Constants.FIREBASE_STORAGE_EMULATOR_HOST = "FIREBASE_STORAGE_EMULATOR_HOST";
  96. Constants.CLOUD_STORAGE_EMULATOR_HOST = "STORAGE_EMULATOR_HOST";
  97. Constants.PUBSUB_EMULATOR_HOST = "PUBSUB_EMULATOR_HOST";
  98. Constants.CLOUD_EVENTARC_EMULATOR_HOST = "CLOUD_EVENTARC_EMULATOR_HOST";
  99. Constants.FIREBASE_EMULATOR_HUB = "FIREBASE_EMULATOR_HUB";
  100. Constants.FIREBASE_GA_SESSION = "FIREBASE_GA_SESSION";
  101. Constants.SERVICE_FIRESTORE = "firestore.googleapis.com";
  102. Constants.SERVICE_REALTIME_DATABASE = "firebaseio.com";
  103. Constants.SERVICE_PUBSUB = "pubsub.googleapis.com";
  104. Constants.SERVICE_EVENTARC = "eventarc.googleapis.com";
  105. Constants.SERVICE_ANALYTICS = "app-measurement.com";
  106. Constants.SERVICE_AUTH = "firebaseauth.googleapis.com";
  107. Constants.SERVICE_CRASHLYTICS = "fabric.io";
  108. Constants.SERVICE_REMOTE_CONFIG = "firebaseremoteconfig.googleapis.com";
  109. Constants.SERVICE_STORAGE = "storage.googleapis.com";
  110. Constants.SERVICE_TEST_LAB = "testing.googleapis.com";