firebase-tools 10.9.2 → 11.1.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 (181) hide show
  1. package/README.md +15 -9
  2. package/lib/accountImporter.js +92 -93
  3. package/lib/api.js +77 -218
  4. package/lib/apiv2.js +5 -4
  5. package/lib/appdistribution/client.js +16 -25
  6. package/lib/auth.js +69 -47
  7. package/lib/bin/firebase.js +42 -47
  8. package/lib/checkValidTargetFilters.js +13 -12
  9. package/lib/commands/appdistribution-distribute.js +2 -1
  10. package/lib/commands/appdistribution-testers-add.js +2 -1
  11. package/lib/commands/appdistribution-testers-remove.js +2 -1
  12. package/lib/commands/apps-android-sha-create.js +2 -1
  13. package/lib/commands/apps-android-sha-delete.js +2 -1
  14. package/lib/commands/apps-android-sha-list.js +2 -1
  15. package/lib/commands/apps-create.js +2 -1
  16. package/lib/commands/apps-list.js +2 -1
  17. package/lib/commands/apps-sdkconfig.js +8 -3
  18. package/lib/commands/auth-export.js +2 -1
  19. package/lib/commands/auth-import.js +7 -10
  20. package/lib/commands/crashlytics-symbols-upload.js +2 -1
  21. package/lib/commands/database-get.js +4 -3
  22. package/lib/commands/database-instances-create.js +2 -1
  23. package/lib/commands/database-instances-list.js +3 -3
  24. package/lib/commands/database-profile.js +2 -1
  25. package/lib/commands/database-push.js +2 -1
  26. package/lib/commands/database-remove.js +2 -1
  27. package/lib/commands/database-rules-canary.js +2 -1
  28. package/lib/commands/database-rules-get.js +2 -1
  29. package/lib/commands/database-rules-list.js +2 -1
  30. package/lib/commands/database-rules-release.js +2 -1
  31. package/lib/commands/database-rules-stage.js +2 -1
  32. package/lib/commands/database-set.js +2 -1
  33. package/lib/commands/database-settings-get.js +2 -1
  34. package/lib/commands/database-settings-set.js +2 -1
  35. package/lib/commands/database-update.js +2 -1
  36. package/lib/commands/deploy.js +23 -21
  37. package/lib/commands/emulators-exec.js +2 -1
  38. package/lib/commands/emulators-export.js +2 -1
  39. package/lib/commands/emulators-start.js +2 -1
  40. package/lib/commands/experimental-functions-shell.js +10 -8
  41. package/lib/commands/ext-configure.js +56 -120
  42. package/lib/commands/ext-dev-deprecate.js +2 -1
  43. package/lib/commands/ext-dev-emulators-exec.js +13 -7
  44. package/lib/commands/ext-dev-emulators-start.js +12 -27
  45. package/lib/commands/ext-dev-extension-delete.js +2 -1
  46. package/lib/commands/ext-dev-init.js +2 -1
  47. package/lib/commands/ext-dev-list.js +2 -1
  48. package/lib/commands/ext-dev-publish.js +2 -1
  49. package/lib/commands/ext-dev-register.js +2 -1
  50. package/lib/commands/ext-dev-undeprecate.js +2 -1
  51. package/lib/commands/ext-dev-unpublish.js +2 -1
  52. package/lib/commands/ext-dev-usage.js +2 -1
  53. package/lib/commands/ext-export.js +2 -1
  54. package/lib/commands/ext-info.js +2 -1
  55. package/lib/commands/ext-install.js +14 -198
  56. package/lib/commands/ext-list.js +2 -1
  57. package/lib/commands/ext-sources-create.js +2 -1
  58. package/lib/commands/ext-uninstall.js +9 -92
  59. package/lib/commands/ext-update.js +67 -225
  60. package/lib/commands/ext.js +2 -1
  61. package/lib/commands/firestore-delete.js +2 -1
  62. package/lib/commands/firestore-indexes-list.js +2 -1
  63. package/lib/commands/functions-config-clone.js +4 -3
  64. package/lib/commands/functions-config-export.js +2 -1
  65. package/lib/commands/functions-config-get.js +2 -1
  66. package/lib/commands/functions-config-set.js +2 -1
  67. package/lib/commands/functions-config-unset.js +2 -1
  68. package/lib/commands/functions-delete.js +2 -1
  69. package/lib/commands/functions-deletegcfartifacts.js +2 -1
  70. package/lib/commands/functions-list.js +2 -1
  71. package/lib/commands/functions-log.js +2 -1
  72. package/lib/commands/functions-secrets-access.js +2 -1
  73. package/lib/commands/functions-secrets-destroy.js +2 -1
  74. package/lib/commands/functions-secrets-get.js +2 -1
  75. package/lib/commands/functions-secrets-prune.js +2 -1
  76. package/lib/commands/functions-secrets-set.js +2 -1
  77. package/lib/commands/functions-shell.js +12 -10
  78. package/lib/commands/help.js +2 -1
  79. package/lib/commands/hosting-channel-create.js +2 -1
  80. package/lib/commands/hosting-channel-delete.js +2 -1
  81. package/lib/commands/hosting-channel-deploy.js +2 -1
  82. package/lib/commands/hosting-channel-list.js +2 -1
  83. package/lib/commands/hosting-channel-open.js +2 -1
  84. package/lib/commands/hosting-clone.js +2 -1
  85. package/lib/commands/hosting-disable.js +2 -1
  86. package/lib/commands/hosting-sites-create.js +2 -1
  87. package/lib/commands/hosting-sites-delete.js +2 -1
  88. package/lib/commands/hosting-sites-get.js +2 -1
  89. package/lib/commands/hosting-sites-list.js +2 -1
  90. package/lib/commands/index.js +23 -13
  91. package/lib/commands/init.js +47 -43
  92. package/lib/commands/login-add.js +2 -1
  93. package/lib/commands/login-ci.js +2 -1
  94. package/lib/commands/login-list.js +2 -1
  95. package/lib/commands/login-use.js +2 -1
  96. package/lib/commands/login.js +2 -1
  97. package/lib/commands/logout.js +2 -1
  98. package/lib/commands/open.js +2 -1
  99. package/lib/commands/projects-addfirebase.js +2 -1
  100. package/lib/commands/projects-create.js +2 -1
  101. package/lib/commands/projects-list.js +2 -1
  102. package/lib/commands/remoteconfig-get.js +2 -1
  103. package/lib/commands/remoteconfig-rollback.js +2 -1
  104. package/lib/commands/remoteconfig-versions-list.js +2 -1
  105. package/lib/commands/serve.js +29 -27
  106. package/lib/commands/setup-emulators-database.js +2 -1
  107. package/lib/commands/setup-emulators-firestore.js +2 -1
  108. package/lib/commands/setup-emulators-pubsub.js +2 -1
  109. package/lib/commands/setup-emulators-storage.js +2 -1
  110. package/lib/commands/setup-emulators-ui.js +2 -1
  111. package/lib/commands/target-apply.js +2 -1
  112. package/lib/commands/target-clear.js +2 -1
  113. package/lib/commands/target-remove.js +2 -1
  114. package/lib/commands/target.js +2 -1
  115. package/lib/commands/use.js +54 -52
  116. package/lib/config.js +3 -3
  117. package/lib/deploy/database/deploy.js +3 -2
  118. package/lib/deploy/database/index.js +8 -5
  119. package/lib/deploy/database/prepare.js +22 -19
  120. package/lib/deploy/database/release.js +12 -9
  121. package/lib/deploy/firestore/prepare.js +2 -2
  122. package/lib/deploy/functions/build.js +32 -20
  123. package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +187 -54
  124. package/lib/deploy/functions/runtimes/node/parseTriggers.js +14 -2
  125. package/lib/deploy/functions/services/database.js +14 -0
  126. package/lib/deploy/functions/services/index.js +14 -0
  127. package/lib/deploy/index.js +3 -3
  128. package/lib/deploy/lifecycleHooks.js +23 -20
  129. package/lib/deploy/remoteconfig/functions.js +18 -14
  130. package/lib/deploy/remoteconfig/prepare.js +2 -2
  131. package/lib/emulator/auth/apiSpec.js +14 -46
  132. package/lib/emulator/auth/operations.js +6 -29
  133. package/lib/emulator/auth/state.js +2 -25
  134. package/lib/emulator/commandUtils.js +1 -1
  135. package/lib/emulator/controller.js +3 -3
  136. package/lib/emulator/databaseEmulator.js +9 -7
  137. package/lib/emulator/downloadableEmulators.js +6 -6
  138. package/lib/emulator/extensionsEmulator.js +7 -3
  139. package/lib/emulator/firestoreEmulator.js +10 -12
  140. package/lib/emulator/functionsEmulator.js +39 -42
  141. package/lib/emulator/hubClient.js +11 -22
  142. package/lib/emulator/hubExport.js +26 -16
  143. package/lib/emulator/portUtils.js +2 -0
  144. package/lib/emulator/storage/crc.js +3 -0
  145. package/lib/emulator/storage/rules/runtime.js +1 -1
  146. package/lib/errorOut.js +2 -2
  147. package/lib/extensions/extensionsHelper.js +4 -5
  148. package/lib/extensions/manifest.js +5 -11
  149. package/lib/firebaseConfigValidate.js +1 -1
  150. package/lib/firestore/checkDatabaseType.js +4 -5
  151. package/lib/firestore/indexes.js +17 -34
  152. package/lib/functions/events/v2.js +7 -1
  153. package/lib/functionsConfigClone.js +43 -41
  154. package/lib/gcp/cloudfunctionsv2.js +17 -2
  155. package/lib/gcp/iam.js +1 -1
  156. package/lib/gcp/index.js +10 -10
  157. package/lib/gcp/runtimeconfig.js +45 -47
  158. package/lib/gcp/storage.js +2 -4
  159. package/lib/hosting/cloudRunProxy.js +19 -15
  160. package/lib/index.js +29 -28
  161. package/lib/init/features/database.js +11 -5
  162. package/lib/init/features/functions/index.js +1 -1
  163. package/lib/init/features/functions/javascript.js +23 -20
  164. package/lib/init/features/functions/npm-dependencies.js +17 -14
  165. package/lib/init/features/functions/typescript.js +27 -24
  166. package/lib/init/features/hosting/github.js +5 -4
  167. package/lib/loadCJSON.js +9 -6
  168. package/lib/logError.js +15 -12
  169. package/lib/management/apps.js +47 -43
  170. package/lib/management/database.js +33 -31
  171. package/lib/management/projects.js +13 -7
  172. package/lib/parseBoltRules.js +15 -14
  173. package/lib/profileReport.js +503 -511
  174. package/lib/profiler.js +4 -4
  175. package/lib/requireAuth.js +0 -1
  176. package/lib/responseToError.js +8 -5
  177. package/lib/rtdb.js +31 -29
  178. package/lib/scopes.js +9 -9
  179. package/npm-shrinkwrap.json +1485 -670
  180. package/package.json +21 -22
  181. package/standalone/package.json +1 -1
@@ -4799,8 +4799,8 @@ exports.default = {
4799
4799
  GoogleCloudIdentitytoolkitV1SetAccountInfoResponse: {
4800
4800
  description: "Response message for SetAccountInfo",
4801
4801
  properties: {
4802
- displayName: { type: "string" },
4803
- email: { type: "string" },
4802
+ displayName: { description: "The account's display name.", type: "string" },
4803
+ email: { description: "The account's email address.", type: "string" },
4804
4804
  emailVerified: {
4805
4805
  description: "Whether the account's email has been verified.",
4806
4806
  type: "boolean",
@@ -4820,8 +4820,14 @@ exports.default = {
4820
4820
  description: "The new email that has been set on the user's account attributes.",
4821
4821
  type: "string",
4822
4822
  },
4823
- passwordHash: { type: "string" },
4824
- photoUrl: { type: "string" },
4823
+ passwordHash: {
4824
+ description: "Deprecated. No actual password hash is currently returned.",
4825
+ type: "string",
4826
+ },
4827
+ photoUrl: {
4828
+ description: "The user's photo URL for the account's profile photo.",
4829
+ type: "string",
4830
+ },
4825
4831
  providerUserInfo: {
4826
4832
  description: "The linked Identity Providers on the account.",
4827
4833
  items: { $ref: "#/components/schemas/GoogleCloudIdentitytoolkitV1ProviderUserInfo" },
@@ -5705,28 +5711,6 @@ exports.default = {
5705
5711
  },
5706
5712
  type: "object",
5707
5713
  },
5708
- GoogleCloudIdentitytoolkitAdminV2AllowByDefault: {
5709
- description: "Defines a policy of allowing every region by default and adding disallowed regions to a disallow list.",
5710
- properties: {
5711
- disallowedRegions: {
5712
- description: "Two letter unicode region codes to disallow as defined by https://cldr.unicode.org/ The full list of these region codes is here: https://github.com/unicode-cldr/cldr-localenames-full/blob/master/main/en/territories.json",
5713
- items: { type: "string" },
5714
- type: "array",
5715
- },
5716
- },
5717
- type: "object",
5718
- },
5719
- GoogleCloudIdentitytoolkitAdminV2AllowlistOnly: {
5720
- description: "Defines a policy of only allowing regions by explicitly adding them to an allowlist.",
5721
- properties: {
5722
- allowedRegions: {
5723
- description: "Two letter unicode region codes to allow as defined by https://cldr.unicode.org/ The full list of these region codes is here: https://github.com/unicode-cldr/cldr-localenames-full/blob/master/main/en/territories.json",
5724
- items: { type: "string" },
5725
- type: "array",
5726
- },
5727
- },
5728
- type: "object",
5729
- },
5730
5714
  GoogleCloudIdentitytoolkitAdminV2Anonymous: {
5731
5715
  description: "Configuration options related to authenticating an anonymous user.",
5732
5716
  properties: {
@@ -6337,18 +6321,6 @@ exports.default = {
6337
6321
  },
6338
6322
  type: "object",
6339
6323
  },
6340
- GoogleCloudIdentitytoolkitAdminV2SmsRegionConfig: {
6341
- description: "Configures the regions where users are allowed to send verification SMS for the project or tenant. This is based on the calling code of the destination phone number.",
6342
- properties: {
6343
- allowByDefault: {
6344
- $ref: "#/components/schemas/GoogleCloudIdentitytoolkitAdminV2AllowByDefault",
6345
- },
6346
- allowlistOnly: {
6347
- $ref: "#/components/schemas/GoogleCloudIdentitytoolkitAdminV2AllowlistOnly",
6348
- },
6349
- },
6350
- type: "object",
6351
- },
6352
6324
  GoogleCloudIdentitytoolkitAdminV2SmsTemplate: {
6353
6325
  description: "The template to use when sending an SMS.",
6354
6326
  properties: {
@@ -6458,9 +6430,6 @@ exports.default = {
6458
6430
  readOnly: true,
6459
6431
  type: "string",
6460
6432
  },
6461
- smsRegionConfig: {
6462
- $ref: "#/components/schemas/GoogleCloudIdentitytoolkitAdminV2SmsRegionConfig",
6463
- },
6464
6433
  testPhoneNumbers: {
6465
6434
  additionalProperties: { type: "string" },
6466
6435
  description: "A map of pairs that can be used for MFA. The phone number should be in E.164 format (https://www.itu.int/rec/T-REC-E.164/) and a maximum of 10 pairs can be added (error will be thrown once exceeded).",
@@ -6708,7 +6677,7 @@ exports.default = {
6708
6677
  type: "object",
6709
6678
  },
6710
6679
  GoogleIamV1AuditConfig: {
6711
- description: 'Specifies the audit configuration for a service. The configuration determines which permission types are logged, and what identities, if any, are exempted from logging. An AuditConfig must have one or more AuditLogConfigs. If there are AuditConfigs for both `allServices` and a specific service, the union of the two AuditConfigs is used for that service: the log_types specified in each AuditConfig are enabled, and the exempted_members in each AuditLogConfig are exempted. Example Policy with multiple AuditConfigs: { "audit_configs": [ { "service": "allServices", "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" }, { "log_type": "ADMIN_READ" } ] }, { "service": "sampleservice.googleapis.com", "audit_log_configs": [ { "log_type": "DATA_READ" }, { "log_type": "DATA_WRITE", "exempted_members": [ "user:aliya@example.com" ] } ] } ] } For sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ logging. It also exempts jose@example.com from DATA_READ logging, and aliya@example.com from DATA_WRITE logging.',
6680
+ description: 'Specifies the audit configuration for a service. The configuration determines which permission types are logged, and what identities, if any, are exempted from logging. An AuditConfig must have one or more AuditLogConfigs. If there are AuditConfigs for both `allServices` and a specific service, the union of the two AuditConfigs is used for that service: the log_types specified in each AuditConfig are enabled, and the exempted_members in each AuditLogConfig are exempted. Example Policy with multiple AuditConfigs: { "audit_configs": [ { "service": "allServices", "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" }, { "log_type": "ADMIN_READ" } ] }, { "service": "sampleservice.googleapis.com", "audit_log_configs": [ { "log_type": "DATA_READ" }, { "log_type": "DATA_WRITE", "exempted_members": [ "user:aliya@example.com" ] } ] } ] } For sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ logging. It also exempts `jose@example.com` from DATA_READ logging, and `aliya@example.com` from DATA_WRITE logging.',
6712
6681
  properties: {
6713
6682
  auditLogConfigs: {
6714
6683
  description: "The configuration for logging of each type of permission.",
@@ -6743,7 +6712,7 @@ exports.default = {
6743
6712
  properties: {
6744
6713
  condition: { $ref: "#/components/schemas/GoogleTypeExpr" },
6745
6714
  members: {
6746
- description: "Specifies the principals requesting access for a Cloud Platform 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. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `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`. ",
6715
+ 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. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `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`. ",
6747
6716
  items: { type: "string" },
6748
6717
  type: "array",
6749
6718
  },
@@ -6812,7 +6781,7 @@ exports.default = {
6812
6781
  description: "Request message for `TestIamPermissions` method.",
6813
6782
  properties: {
6814
6783
  permissions: {
6815
- description: "The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).",
6784
+ description: "The set of permissions to check for the `resource`. Permissions with wildcards (such as `*` or `storage.*`) are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).",
6816
6785
  items: { type: "string" },
6817
6786
  type: "array",
6818
6787
  },
@@ -6831,7 +6800,7 @@ exports.default = {
6831
6800
  type: "object",
6832
6801
  },
6833
6802
  GoogleProtobufEmpty: {
6834
- description: "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`.",
6803
+ description: "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }",
6835
6804
  properties: {},
6836
6805
  type: "object",
6837
6806
  },
@@ -6905,7 +6874,6 @@ exports.default = {
6905
6874
  description: "Emulator-specific configuration.",
6906
6875
  properties: {
6907
6876
  signIn: { properties: { allowDuplicateEmails: { type: "boolean" } }, type: "object" },
6908
- usageMode: { enum: ["USAGE_MODE_UNSPECIFIED", "DEFAULT", "PASSTHROUGH"], type: "string" },
6909
6877
  },
6910
6878
  },
6911
6879
  EmulatorV1ProjectsOobCodes: {
@@ -105,7 +105,6 @@ const MFA_INELIGIBLE_PROVIDER = new Set([
105
105
  function signUp(state, reqBody, ctx) {
106
106
  var _a;
107
107
  (0, errors_1.assert)(!state.disableAuth, "PROJECT_DISABLED");
108
- (0, errors_1.assert)(state.usageMode !== state_1.UsageMode.PASSTHROUGH, "UNSUPPORTED_PASSTHROUGH_OPERATION");
109
108
  let provider;
110
109
  const updates = {
111
110
  lastLoginAt: Date.now().toString(),
@@ -227,7 +226,6 @@ function lookup(state, reqBody, ctx) {
227
226
  function batchCreate(state, reqBody) {
228
227
  var _a, _b;
229
228
  (0, errors_1.assert)(!state.disableAuth, "PROJECT_DISABLED");
230
- (0, errors_1.assert)(state.usageMode !== state_1.UsageMode.PASSTHROUGH, "UNSUPPORTED_PASSTHROUGH_OPERATION");
231
229
  (0, errors_1.assert)((_a = reqBody.users) === null || _a === void 0 ? void 0 : _a.length, "MISSING_USER_ACCOUNT");
232
230
  if (reqBody.sanityCheck) {
233
231
  if (state.oneAccountPerEmail) {
@@ -423,7 +421,6 @@ function batchGet(state, reqBody, ctx) {
423
421
  function createAuthUri(state, reqBody) {
424
422
  var _a;
425
423
  (0, errors_1.assert)(!state.disableAuth, "PROJECT_DISABLED");
426
- (0, errors_1.assert)(state.usageMode !== state_1.UsageMode.PASSTHROUGH, "UNSUPPORTED_PASSTHROUGH_OPERATION");
427
424
  const sessionId = reqBody.sessionId || (0, utils_1.randomId)(27);
428
425
  if (reqBody.providerId) {
429
426
  throw new errors_1.NotImplementedError("Sign-in with IDP is not yet supported.");
@@ -483,7 +480,6 @@ function createAuthUri(state, reqBody) {
483
480
  const SESSION_COOKIE_MIN_VALID_DURATION = 5 * 60;
484
481
  exports.SESSION_COOKIE_MAX_VALID_DURATION = 14 * 24 * 60 * 60;
485
482
  function createSessionCookie(state, reqBody, ctx) {
486
- (0, errors_1.assert)(state.usageMode !== state_1.UsageMode.PASSTHROUGH, "UNSUPPORTED_PASSTHROUGH_OPERATION");
487
483
  (0, errors_1.assert)(reqBody.idToken, "MISSING_ID_TOKEN");
488
484
  const validDuration = Number(reqBody.validDuration) || exports.SESSION_COOKIE_MAX_VALID_DURATION;
489
485
  (0, errors_1.assert)(validDuration >= SESSION_COOKIE_MIN_VALID_DURATION &&
@@ -573,7 +569,6 @@ function queryAccounts(state, reqBody) {
573
569
  function resetPassword(state, reqBody) {
574
570
  var _a;
575
571
  (0, errors_1.assert)(!state.disableAuth, "PROJECT_DISABLED");
576
- (0, errors_1.assert)(state.usageMode !== state_1.UsageMode.PASSTHROUGH, "UNSUPPORTED_PASSTHROUGH_OPERATION");
577
572
  (0, errors_1.assert)(state.allowPasswordSignup, "PASSWORD_LOGIN_DISABLED");
578
573
  (0, errors_1.assert)(reqBody.oobCode, "MISSING_OOB_CODE");
579
574
  const oob = state.validateOobCode(reqBody.oobCode);
@@ -604,7 +599,6 @@ exports.resetPassword = resetPassword;
604
599
  function sendOobCode(state, reqBody, ctx) {
605
600
  var _a;
606
601
  (0, errors_1.assert)(!state.disableAuth, "PROJECT_DISABLED");
607
- (0, errors_1.assert)(state.usageMode !== state_1.UsageMode.PASSTHROUGH, "UNSUPPORTED_PASSTHROUGH_OPERATION");
608
602
  (0, errors_1.assert)(reqBody.requestType && reqBody.requestType !== "OOB_REQ_TYPE_UNSPECIFIED", "MISSING_REQ_TYPE");
609
603
  if (reqBody.returnOobLink) {
610
604
  (0, errors_1.assert)((_a = ctx.security) === null || _a === void 0 ? void 0 : _a.Oauth2, "INSUFFICIENT_PERMISSION");
@@ -673,7 +667,6 @@ function sendVerificationCode(state, reqBody) {
673
667
  var _a;
674
668
  (0, errors_1.assert)(!state.disableAuth, "PROJECT_DISABLED");
675
669
  (0, errors_1.assert)(state instanceof state_1.AgentProjectState, "UNSUPPORTED_TENANT_OPERATION");
676
- (0, errors_1.assert)(state.usageMode !== state_1.UsageMode.PASSTHROUGH, "UNSUPPORTED_PASSTHROUGH_OPERATION");
677
670
  (0, errors_1.assert)(reqBody.phoneNumber && (0, utils_1.isValidPhoneNumber)(reqBody.phoneNumber), "INVALID_PHONE_NUMBER : Invalid format.");
678
671
  const user = state.getUserByPhoneNumber(reqBody.phoneNumber);
679
672
  (0, errors_1.assert)(!((_a = user === null || user === void 0 ? void 0 : user.mfaInfo) === null || _a === void 0 ? void 0 : _a.length), "UNSUPPORTED_FIRST_FACTOR : A phone number cannot be set as a first factor on an SMS based MFA user.");
@@ -686,7 +679,6 @@ function sendVerificationCode(state, reqBody) {
686
679
  function setAccountInfo(state, reqBody, ctx) {
687
680
  var _a;
688
681
  (0, errors_1.assert)(!state.disableAuth, "PROJECT_DISABLED");
689
- (0, errors_1.assert)(state.usageMode !== state_1.UsageMode.PASSTHROUGH, "UNSUPPORTED_PASSTHROUGH_OPERATION");
690
682
  const url = (0, utils_1.authEmulatorUrl)(ctx.req);
691
683
  return setAccountInfoImpl(state, reqBody, {
692
684
  privileged: !!((_a = ctx.security) === null || _a === void 0 ? void 0 : _a.Oauth2),
@@ -943,7 +935,7 @@ function signInWithCustomToken(state, reqBody) {
943
935
  extraClaims = payload.claims;
944
936
  }
945
937
  let user = state.getUserByLocalId(localId);
946
- const isNewUser = state.usageMode === state_1.UsageMode.PASSTHROUGH ? false : !user;
938
+ const isNewUser = !user;
947
939
  const updates = {
948
940
  customAuth: true,
949
941
  lastLoginAt: Date.now().toString(),
@@ -965,7 +957,6 @@ function signInWithEmailLink(state, reqBody) {
965
957
  var _a;
966
958
  (0, errors_1.assert)(!state.disableAuth, "PROJECT_DISABLED");
967
959
  (0, errors_1.assert)(state.enableEmailLinkSignin, "OPERATION_NOT_ALLOWED");
968
- (0, errors_1.assert)(state.usageMode !== state_1.UsageMode.PASSTHROUGH, "UNSUPPORTED_PASSTHROUGH_OPERATION");
969
960
  const userFromIdToken = reqBody.idToken ? parseIdToken(state, reqBody.idToken).user : undefined;
970
961
  (0, errors_1.assert)(reqBody.email, "MISSING_EMAIL");
971
962
  const email = (0, utils_1.canonicalizeEmailAddress)(reqBody.email);
@@ -1015,7 +1006,6 @@ function signInWithEmailLink(state, reqBody) {
1015
1006
  function signInWithIdp(state, reqBody) {
1016
1007
  var _a, _b, _c;
1017
1008
  (0, errors_1.assert)(!state.disableAuth, "PROJECT_DISABLED");
1018
- (0, errors_1.assert)(state.usageMode !== state_1.UsageMode.PASSTHROUGH, "UNSUPPORTED_PASSTHROUGH_OPERATION");
1019
1009
  if (reqBody.returnRefreshToken) {
1020
1010
  throw new errors_1.NotImplementedError("returnRefreshToken is not implemented yet.");
1021
1011
  }
@@ -1126,7 +1116,6 @@ function signInWithPassword(state, reqBody) {
1126
1116
  var _a;
1127
1117
  (0, errors_1.assert)(!state.disableAuth, "PROJECT_DISABLED");
1128
1118
  (0, errors_1.assert)(state.allowPasswordSignup, "PASSWORD_LOGIN_DISABLED");
1129
- (0, errors_1.assert)(state.usageMode !== state_1.UsageMode.PASSTHROUGH, "UNSUPPORTED_PASSTHROUGH_OPERATION");
1130
1119
  (0, errors_1.assert)(reqBody.email, "MISSING_EMAIL");
1131
1120
  (0, errors_1.assert)(reqBody.password, "MISSING_PASSWORD");
1132
1121
  if (reqBody.captchaResponse || reqBody.captchaChallenge) {
@@ -1160,7 +1149,6 @@ function signInWithPhoneNumber(state, reqBody) {
1160
1149
  var _a;
1161
1150
  (0, errors_1.assert)(!state.disableAuth, "PROJECT_DISABLED");
1162
1151
  (0, errors_1.assert)(state instanceof state_1.AgentProjectState, "UNSUPPORTED_TENANT_OPERATION");
1163
- (0, errors_1.assert)(state.usageMode !== state_1.UsageMode.PASSTHROUGH, "UNSUPPORTED_PASSTHROUGH_OPERATION");
1164
1152
  let phoneNumber;
1165
1153
  if (reqBody.temporaryProof) {
1166
1154
  (0, errors_1.assert)(reqBody.phoneNumber, "MISSING_PHONE_NUMBER");
@@ -1205,7 +1193,6 @@ function signInWithPhoneNumber(state, reqBody) {
1205
1193
  phoneNumber, localId: user.localId }, tokens);
1206
1194
  }
1207
1195
  function grantToken(state, reqBody) {
1208
- (0, errors_1.assert)(state.usageMode !== state_1.UsageMode.PASSTHROUGH, "UNSUPPORTED_PASSTHROUGH_OPERATION");
1209
1196
  (0, errors_1.assert)(reqBody.grantType, "MISSING_GRANT_TYPE");
1210
1197
  (0, errors_1.assert)(reqBody.grantType === "refresh_token", "INVALID_GRANT_TYPE");
1211
1198
  (0, errors_1.assert)(reqBody.refreshToken, "MISSING_REFRESH_TOKEN");
@@ -1234,7 +1221,6 @@ function getEmulatorProjectConfig(state) {
1234
1221
  signIn: {
1235
1222
  allowDuplicateEmails: !state.oneAccountPerEmail,
1236
1223
  },
1237
- usageMode: state.usageMode,
1238
1224
  };
1239
1225
  }
1240
1226
  function updateEmulatorProjectConfig(state, reqBody, ctx) {
@@ -1243,9 +1229,6 @@ function updateEmulatorProjectConfig(state, reqBody, ctx) {
1243
1229
  if (((_a = reqBody.signIn) === null || _a === void 0 ? void 0 : _a.allowDuplicateEmails) != null) {
1244
1230
  updateMask.push("signIn.allowDuplicateEmails");
1245
1231
  }
1246
- if (reqBody.usageMode) {
1247
- updateMask.push("usageMode");
1248
- }
1249
1232
  ctx.params.query.updateMask = updateMask.join();
1250
1233
  updateConfig(state, reqBody, ctx);
1251
1234
  return getEmulatorProjectConfig(state);
@@ -1414,7 +1397,6 @@ function hashPassword(password, salt) {
1414
1397
  }
1415
1398
  function issueTokens(state, user, signInProvider, { extraClaims, secondFactor, signInAttributes, } = {}) {
1416
1399
  user = state.updateUserByLocalId(user.localId, { lastRefreshAt: new Date().toISOString() });
1417
- const usageMode = state.usageMode === state_1.UsageMode.PASSTHROUGH ? "passthrough" : undefined;
1418
1400
  const tenantId = state instanceof state_1.TenantProjectState ? state.tenantId : undefined;
1419
1401
  const expiresInSeconds = 60 * 60;
1420
1402
  const idToken = generateJwt(user, {
@@ -1423,16 +1405,13 @@ function issueTokens(state, user, signInProvider, { extraClaims, secondFactor, s
1423
1405
  expiresInSeconds,
1424
1406
  extraClaims,
1425
1407
  secondFactor,
1426
- usageMode,
1427
1408
  tenantId,
1428
1409
  signInAttributes,
1429
1410
  });
1430
- const refreshToken = state.usageMode === state_1.UsageMode.DEFAULT
1431
- ? state.createRefreshTokenFor(user, signInProvider, {
1432
- extraClaims,
1433
- secondFactor,
1434
- })
1435
- : undefined;
1411
+ const refreshToken = state.createRefreshTokenFor(user, signInProvider, {
1412
+ extraClaims,
1413
+ secondFactor,
1414
+ });
1436
1415
  return {
1437
1416
  idToken,
1438
1417
  refreshToken,
@@ -1440,7 +1419,6 @@ function issueTokens(state, user, signInProvider, { extraClaims, secondFactor, s
1440
1419
  };
1441
1420
  }
1442
1421
  function parseIdToken(state, idToken) {
1443
- (0, errors_1.assert)(state.usageMode !== state_1.UsageMode.PASSTHROUGH, "UNSUPPORTED_PASSTHROUGH_OPERATION");
1444
1422
  const decoded = (0, jsonwebtoken_1.decode)(idToken, { complete: true });
1445
1423
  (0, errors_1.assert)(decoded, "INVALID_ID_TOKEN");
1446
1424
  if (decoded.header.alg !== "none") {
@@ -1457,7 +1435,7 @@ function parseIdToken(state, idToken) {
1457
1435
  const signInProvider = decoded.payload.firebase.sign_in_provider;
1458
1436
  return { user, signInProvider, payload: decoded.payload };
1459
1437
  }
1460
- function generateJwt(user, { projectId, signInProvider, expiresInSeconds, extraClaims = {}, secondFactor, usageMode, tenantId, signInAttributes, }) {
1438
+ function generateJwt(user, { projectId, signInProvider, expiresInSeconds, extraClaims = {}, secondFactor, tenantId, signInAttributes, }) {
1461
1439
  const identities = {};
1462
1440
  if (user.email) {
1463
1441
  identities["email"] = [user.email];
@@ -1479,7 +1457,6 @@ function generateJwt(user, { projectId, signInProvider, expiresInSeconds, extraC
1479
1457
  sign_in_provider: signInProvider,
1480
1458
  second_factor_identifier: secondFactor === null || secondFactor === void 0 ? void 0 : secondFactor.identifier,
1481
1459
  sign_in_second_factor: secondFactor === null || secondFactor === void 0 ? void 0 : secondFactor.provider,
1482
- usage_mode: usageMode,
1483
1460
  tenant: tenantId,
1484
1461
  sign_in_attributes: signInAttributes,
1485
1462
  } });
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decodeRefreshToken = exports.encodeRefreshToken = exports.BlockingFunctionEvents = exports.UsageMode = exports.TenantProjectState = exports.AgentProjectState = exports.ProjectState = exports.SIGNIN_METHOD_EMAIL_LINK = exports.PROVIDER_GAME_CENTER = exports.PROVIDER_CUSTOM = exports.PROVIDER_ANONYMOUS = exports.PROVIDER_PHONE = exports.PROVIDER_PASSWORD = void 0;
3
+ exports.decodeRefreshToken = exports.encodeRefreshToken = exports.BlockingFunctionEvents = exports.TenantProjectState = exports.AgentProjectState = exports.ProjectState = exports.SIGNIN_METHOD_EMAIL_LINK = exports.PROVIDER_GAME_CENTER = exports.PROVIDER_CUSTOM = exports.PROVIDER_ANONYMOUS = exports.PROVIDER_PHONE = exports.PROVIDER_PASSWORD = void 0;
4
4
  const utils_1 = require("./utils");
5
5
  const cloudFunctions_1 = require("./cloudFunctions");
6
6
  const errors_1 = require("./errors");
@@ -412,7 +412,6 @@ class AgentProjectState extends ProjectState {
412
412
  this._authCloudFunction = new cloudFunctions_1.AuthCloudFunction(this.projectId);
413
413
  this._config = {
414
414
  signIn: { allowDuplicateEmails: false },
415
- usageMode: UsageMode.DEFAULT,
416
415
  blockingFunctions: {},
417
416
  };
418
417
  }
@@ -425,12 +424,6 @@ class AgentProjectState extends ProjectState {
425
424
  set oneAccountPerEmail(oneAccountPerEmail) {
426
425
  this._config.signIn.allowDuplicateEmails = !oneAccountPerEmail;
427
426
  }
428
- get usageMode() {
429
- return this._config.usageMode;
430
- }
431
- set usageMode(usageMode) {
432
- this._config.usageMode = usageMode;
433
- }
434
427
  get allowPasswordSignup() {
435
428
  return true;
436
429
  }
@@ -456,17 +449,10 @@ class AgentProjectState extends ProjectState {
456
449
  this._config.blockingFunctions = blockingFunctions;
457
450
  }
458
451
  updateConfig(update, updateMask) {
459
- var _a, _b, _c, _d;
460
- if (update.usageMode) {
461
- (0, errors_1.assert)(update.usageMode !== UsageMode.USAGE_MODE_UNSPECIFIED, "INVALID_USAGE_MODE: ((Invalid usage mode provided.))");
462
- if (update.usageMode === UsageMode.PASSTHROUGH) {
463
- (0, errors_1.assert)(this.getUserCount() === 0, "USERS_STILL_EXIST: ((Users are present, unable to set passthrough mode.))");
464
- }
465
- }
452
+ var _a, _b, _c;
466
453
  if (!updateMask) {
467
454
  this.oneAccountPerEmail = (_b = !((_a = update.signIn) === null || _a === void 0 ? void 0 : _a.allowDuplicateEmails)) !== null && _b !== void 0 ? _b : true;
468
455
  this.blockingFunctionsConfig = (_c = update.blockingFunctions) !== null && _c !== void 0 ? _c : {};
469
- this.usageMode = (_d = update.usageMode) !== null && _d !== void 0 ? _d : UsageMode.DEFAULT;
470
456
  return this.config;
471
457
  }
472
458
  return applyMask(updateMask, this.config, update);
@@ -542,9 +528,6 @@ class TenantProjectState extends ProjectState {
542
528
  get authCloudFunction() {
543
529
  return this.parentProject.authCloudFunction;
544
530
  }
545
- get usageMode() {
546
- return this.parentProject.usageMode;
547
- }
548
531
  get tenantConfig() {
549
532
  return this._tenantConfig;
550
533
  }
@@ -592,12 +575,6 @@ class TenantProjectState extends ProjectState {
592
575
  }
593
576
  }
594
577
  exports.TenantProjectState = TenantProjectState;
595
- var UsageMode;
596
- (function (UsageMode) {
597
- UsageMode["USAGE_MODE_UNSPECIFIED"] = "USAGE_MODE_UNSPECIFIED";
598
- UsageMode["DEFAULT"] = "DEFAULT";
599
- UsageMode["PASSTHROUGH"] = "PASSTHROUGH";
600
- })(UsageMode = exports.UsageMode || (exports.UsageMode = {}));
601
578
  var BlockingFunctionEvents;
602
579
  (function (BlockingFunctionEvents) {
603
580
  BlockingFunctionEvents["BEFORE_CREATE"] = "beforeCreate";
@@ -371,5 +371,5 @@ async function checkJavaSupported() {
371
371
  });
372
372
  }
373
373
  exports.checkJavaSupported = checkJavaSupported;
374
- exports.JAVA_DEPRECATION_WARNING = "Support for Java version <= 10 will be dropped soon in firebase-tools@11. " +
374
+ exports.JAVA_DEPRECATION_WARNING = "firebase-tools no longer supports Java version before 11. " +
375
375
  "Please upgrade to Java version 11 or above to continue using the emulators.";
@@ -219,8 +219,8 @@ async function startAll(options, showUI = true) {
219
219
  const deprecationNotices = [];
220
220
  if (targets.some(downloadableEmulators_1.requiresJava)) {
221
221
  if (!(await commandUtils.checkJavaSupported())) {
222
- utils.logLabeledWarning("emulators", commandUtils_1.JAVA_DEPRECATION_WARNING, "warn");
223
- deprecationNotices.push(commandUtils_1.JAVA_DEPRECATION_WARNING);
222
+ utils.logLabeledError("emulators", commandUtils_1.JAVA_DEPRECATION_WARNING, "warn");
223
+ throw new error_1.FirebaseError(commandUtils_1.JAVA_DEPRECATION_WARNING);
224
224
  }
225
225
  }
226
226
  const hubLogger = emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.HUB);
@@ -246,7 +246,7 @@ async function startAll(options, showUI = true) {
246
246
  }
247
247
  if (previews_1.previews.frameworkawareness) {
248
248
  const config = options.config.get("hosting");
249
- if (Array.isArray(config) ? config.some((it) => it.source) : config.source) {
249
+ if (Array.isArray(config) ? config.some((it) => it.source) : config === null || config === void 0 ? void 0 : config.source) {
250
250
  await (0, frameworks_1.prepareFrameworks)(targets, options, options);
251
251
  }
252
252
  }
@@ -6,14 +6,14 @@ const clc = require("cli-color");
6
6
  const fs = require("fs");
7
7
  const path = require("path");
8
8
  const http = require("http");
9
- const api = require("../api");
10
9
  const downloadableEmulators = require("./downloadableEmulators");
11
10
  const types_1 = require("../emulator/types");
12
11
  const constants_1 = require("./constants");
13
12
  const registry_1 = require("./registry");
14
13
  const emulatorLogger_1 = require("./emulatorLogger");
15
14
  const error_1 = require("../error");
16
- const parseBoltRules = require("../parseBoltRules");
15
+ const parseBoltRules_1 = require("../parseBoltRules");
16
+ const apiv2_1 = require("../apiv2");
17
17
  class DatabaseEmulator {
18
18
  constructor(args) {
19
19
  this.args = args;
@@ -125,15 +125,17 @@ class DatabaseEmulator {
125
125
  var _a;
126
126
  const rulesExt = path.extname(rulesPath);
127
127
  const content = rulesExt === ".bolt"
128
- ? parseBoltRules(rulesPath).toString()
128
+ ? (0, parseBoltRules_1.parseBoltRules)(rulesPath).toString()
129
129
  : fs.readFileSync(rulesPath, "utf8");
130
130
  const info = this.getInfo();
131
131
  try {
132
- await api.request("PUT", `/.settings/rules.json?ns=${instance}`, {
133
- origin: `http://${registry_1.EmulatorRegistry.getInfoHostString(info)}`,
132
+ const client = new apiv2_1.Client({
133
+ urlPrefix: `http://${registry_1.EmulatorRegistry.getInfoHostString(info)}`,
134
+ auth: false,
135
+ });
136
+ await client.put(`/.settings/rules.json`, content, {
134
137
  headers: { Authorization: "Bearer owner" },
135
- data: content,
136
- json: false,
138
+ queryParams: { ns: instance },
137
139
  });
138
140
  }
139
141
  catch (e) {
@@ -18,13 +18,13 @@ const EMULATOR_INSTANCE_KILL_TIMEOUT = 4000;
18
18
  const CACHE_DIR = process.env.FIREBASE_EMULATORS_PATH || path.join(os.homedir(), ".cache", "firebase", "emulators");
19
19
  exports.DownloadDetails = {
20
20
  database: {
21
- downloadPath: path.join(CACHE_DIR, "firebase-database-emulator-v4.7.3.jar"),
22
- version: "4.7.3",
21
+ downloadPath: path.join(CACHE_DIR, "firebase-database-emulator-v4.8.0.jar"),
22
+ version: "4.8.0",
23
23
  opts: {
24
24
  cacheDir: CACHE_DIR,
25
- remoteUrl: "https://storage.googleapis.com/firebase-preview-drop/emulator/firebase-database-emulator-v4.7.3.jar",
26
- expectedSize: 28862098,
27
- expectedChecksum: "8f696f24ee89c937a789498a0c0e4899",
25
+ remoteUrl: "https://storage.googleapis.com/firebase-preview-drop/emulator/firebase-database-emulator-v4.8.0.jar",
26
+ expectedSize: 33676395,
27
+ expectedChecksum: "e5ae0085d9c88ed14b0bd9c25fe62916",
28
28
  namePrefix: "firebase-database-emulator",
29
29
  },
30
30
  },
@@ -164,7 +164,7 @@ const Commands = {
164
164
  },
165
165
  ui: {
166
166
  binary: "node",
167
- args: [getExecPath(types_1.Emulators.UI)],
167
+ args: ["--dns-result-order=ipv4first", getExecPath(types_1.Emulators.UI)],
168
168
  optionalArgs: [],
169
169
  joinArgs: false,
170
170
  },
@@ -6,7 +6,7 @@ const os = require("os");
6
6
  const path = require("path");
7
7
  const clc = require("cli-color");
8
8
  const Table = require("cli-table");
9
- const child_process_1 = require("child_process");
9
+ const spawn = require("cross-spawn");
10
10
  const planner = require("../deploy/extensions/planner");
11
11
  const error_1 = require("../error");
12
12
  const refs_1 = require("../extensions/refs");
@@ -110,16 +110,20 @@ class ExtensionsEmulator {
110
110
  return true;
111
111
  }
112
112
  installAndBuildSourceCode(sourceCodePath) {
113
- const npmInstall = (0, child_process_1.spawnSync)("npm", ["--prefix", `/${sourceCodePath}/functions/`, "install"], {
113
+ this.logger.logLabeled("DEBUG", "Extensions", `Running "npm install" for ${sourceCodePath}`);
114
+ const npmInstall = spawn.sync("npm", ["--prefix", `/${sourceCodePath}/functions/`, "install"], {
114
115
  encoding: "utf8",
115
116
  });
116
117
  if (npmInstall.error) {
117
118
  throw npmInstall.error;
118
119
  }
119
- const npmRunGCPBuild = (0, child_process_1.spawnSync)("npm", ["--prefix", `/${sourceCodePath}/functions/`, "run", "gcp-build"], { encoding: "utf8" });
120
+ this.logger.logLabeled("DEBUG", "Extensions", `Finished "npm install" for ${sourceCodePath}`);
121
+ this.logger.logLabeled("DEBUG", "Extensions", `Running "npm run gcp-build" for ${sourceCodePath}`);
122
+ const npmRunGCPBuild = spawn.sync("npm", ["--prefix", `/${sourceCodePath}/functions/`, "run", "gcp-build"], { encoding: "utf8" });
120
123
  if (npmRunGCPBuild.error) {
121
124
  throw npmRunGCPBuild.error;
122
125
  }
126
+ this.logger.logLabeled("DEBUG", "Extensions", `Finished "npm run gcp-build" for ${sourceCodePath}`);
123
127
  }
124
128
  async getExtensionBackends() {
125
129
  await this.readManifest();
@@ -5,12 +5,12 @@ const chokidar = require("chokidar");
5
5
  const fs = require("fs");
6
6
  const clc = require("cli-color");
7
7
  const path = require("path");
8
- const api = require("../api");
9
8
  const utils = require("../utils");
10
9
  const downloadableEmulators = require("./downloadableEmulators");
11
10
  const types_1 = require("../emulator/types");
12
11
  const registry_1 = require("./registry");
13
12
  const constants_1 = require("./constants");
13
+ const apiv2_1 = require("../apiv2");
14
14
  class FirestoreEmulator {
15
15
  constructor(args) {
16
16
  this.args = args;
@@ -65,7 +65,7 @@ class FirestoreEmulator {
65
65
  getName() {
66
66
  return types_1.Emulators.FIRESTORE;
67
67
  }
68
- updateRules(content) {
68
+ async updateRules(content) {
69
69
  const projectId = this.args.projectId;
70
70
  const info = this.getInfo();
71
71
  const body = {
@@ -79,17 +79,15 @@ class FirestoreEmulator {
79
79
  ],
80
80
  },
81
81
  };
82
- return api
83
- .request("PUT", `/emulator/v1/projects/${projectId}:securityRules`, {
84
- origin: `http://${registry_1.EmulatorRegistry.getInfoHostString(info)}`,
85
- data: body,
86
- })
87
- .then((res) => {
88
- if (res.body && res.body.issues) {
89
- return res.body.issues;
90
- }
91
- return [];
82
+ const client = new apiv2_1.Client({
83
+ urlPrefix: `http://${registry_1.EmulatorRegistry.getInfoHostString(info)}`,
84
+ auth: false,
92
85
  });
86
+ const res = await client.put(`/emulator/v1/projects/${projectId}:securityRules`, body);
87
+ if (res.body && Array.isArray(res.body.issues)) {
88
+ return res.body.issues;
89
+ }
90
+ return [];
93
91
  }
94
92
  prettyPrintRulesIssue(filePath, issue) {
95
93
  const relativePath = path.relative(process.cwd(), filePath);