firebase-admin 12.7.0 → 13.0.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 (219) hide show
  1. package/README.md +1 -2
  2. package/lib/app/core.d.ts +1 -2
  3. package/lib/app/core.js +1 -1
  4. package/lib/app/credential-factory.d.ts +1 -2
  5. package/lib/app/credential-factory.js +5 -6
  6. package/lib/app/credential-internal.d.ts +37 -35
  7. package/lib/app/credential-internal.js +194 -294
  8. package/lib/app/credential.d.ts +1 -1
  9. package/lib/app/credential.js +1 -1
  10. package/lib/app/firebase-app.d.ts +1 -1
  11. package/lib/app/firebase-app.js +1 -1
  12. package/lib/app/firebase-namespace.d.ts +1 -1
  13. package/lib/app/firebase-namespace.js +1 -1
  14. package/lib/app/index.d.ts +1 -1
  15. package/lib/app/index.js +1 -1
  16. package/lib/app/lifecycle.d.ts +1 -1
  17. package/lib/app/lifecycle.js +6 -6
  18. package/lib/app-check/app-check-api-client-internal.d.ts +1 -1
  19. package/lib/app-check/app-check-api-client-internal.js +1 -1
  20. package/lib/app-check/app-check-api.d.ts +1 -1
  21. package/lib/app-check/app-check-api.js +1 -1
  22. package/lib/app-check/app-check-namespace.d.ts +1 -1
  23. package/lib/app-check/app-check-namespace.js +1 -1
  24. package/lib/app-check/app-check.d.ts +1 -1
  25. package/lib/app-check/app-check.js +1 -1
  26. package/lib/app-check/index.d.ts +1 -1
  27. package/lib/app-check/index.js +3 -3
  28. package/lib/app-check/token-generator.d.ts +1 -1
  29. package/lib/app-check/token-generator.js +3 -3
  30. package/lib/app-check/token-verifier.d.ts +1 -1
  31. package/lib/app-check/token-verifier.js +1 -1
  32. package/lib/auth/action-code-settings-builder.d.ts +1 -1
  33. package/lib/auth/action-code-settings-builder.js +1 -1
  34. package/lib/auth/auth-api-request.d.ts +1 -1
  35. package/lib/auth/auth-api-request.js +3 -4
  36. package/lib/auth/auth-config.d.ts +1 -1
  37. package/lib/auth/auth-config.js +3 -3
  38. package/lib/auth/auth-namespace.d.ts +1 -1
  39. package/lib/auth/auth-namespace.js +1 -1
  40. package/lib/auth/auth.d.ts +1 -1
  41. package/lib/auth/auth.js +1 -1
  42. package/lib/auth/base-auth.d.ts +1 -1
  43. package/lib/auth/base-auth.js +3 -3
  44. package/lib/auth/identifier.d.ts +1 -1
  45. package/lib/auth/identifier.js +5 -6
  46. package/lib/auth/index.d.ts +1 -1
  47. package/lib/auth/index.js +3 -3
  48. package/lib/auth/project-config-manager.d.ts +1 -1
  49. package/lib/auth/project-config-manager.js +1 -1
  50. package/lib/auth/project-config.d.ts +1 -1
  51. package/lib/auth/project-config.js +1 -1
  52. package/lib/auth/tenant-manager.d.ts +1 -1
  53. package/lib/auth/tenant-manager.js +1 -1
  54. package/lib/auth/tenant.d.ts +1 -1
  55. package/lib/auth/tenant.js +1 -1
  56. package/lib/auth/token-generator.d.ts +1 -2
  57. package/lib/auth/token-generator.js +3 -3
  58. package/lib/auth/token-verifier.d.ts +1 -1
  59. package/lib/auth/token-verifier.js +5 -5
  60. package/lib/auth/user-import-builder.d.ts +1 -2
  61. package/lib/auth/user-import-builder.js +3 -3
  62. package/lib/auth/user-record.d.ts +1 -1
  63. package/lib/auth/user-record.js +1 -1
  64. package/lib/credential/index.d.ts +1 -1
  65. package/lib/credential/index.js +1 -1
  66. package/lib/data-connect/data-connect-api-client-internal.d.ts +1 -1
  67. package/lib/data-connect/data-connect-api-client-internal.js +1 -1
  68. package/lib/data-connect/data-connect-api.d.ts +1 -1
  69. package/lib/data-connect/data-connect-api.js +1 -1
  70. package/lib/data-connect/data-connect.d.ts +1 -1
  71. package/lib/data-connect/data-connect.js +1 -1
  72. package/lib/data-connect/index.d.ts +1 -1
  73. package/lib/data-connect/index.js +3 -3
  74. package/lib/database/database-namespace.d.ts +1 -1
  75. package/lib/database/database-namespace.js +1 -1
  76. package/lib/database/database.d.ts +1 -2
  77. package/lib/database/database.js +1 -1
  78. package/lib/database/index.d.ts +1 -1
  79. package/lib/database/index.js +4 -4
  80. package/lib/default-namespace.d.ts +1 -1
  81. package/lib/default-namespace.js +1 -1
  82. package/lib/eventarc/cloudevent.d.ts +1 -1
  83. package/lib/eventarc/cloudevent.js +1 -1
  84. package/lib/eventarc/eventarc-client-internal.d.ts +1 -1
  85. package/lib/eventarc/eventarc-client-internal.js +1 -1
  86. package/lib/eventarc/eventarc-utils.d.ts +1 -1
  87. package/lib/eventarc/eventarc-utils.js +3 -3
  88. package/lib/eventarc/eventarc.d.ts +1 -1
  89. package/lib/eventarc/eventarc.js +1 -1
  90. package/lib/eventarc/index.d.ts +1 -1
  91. package/lib/eventarc/index.js +3 -3
  92. package/lib/extensions/extensions-api-client-internal.d.ts +1 -1
  93. package/lib/extensions/extensions-api-client-internal.js +1 -1
  94. package/lib/extensions/extensions-api.d.ts +1 -1
  95. package/lib/extensions/extensions-api.js +1 -1
  96. package/lib/extensions/extensions.d.ts +1 -1
  97. package/lib/extensions/extensions.js +1 -1
  98. package/lib/extensions/index.d.ts +1 -1
  99. package/lib/extensions/index.js +3 -3
  100. package/lib/firebase-namespace-api.d.ts +1 -1
  101. package/lib/firebase-namespace-api.js +1 -1
  102. package/lib/firestore/firestore-internal.d.ts +1 -1
  103. package/lib/firestore/firestore-internal.js +3 -3
  104. package/lib/firestore/firestore-namespace.d.ts +1 -1
  105. package/lib/firestore/firestore-namespace.js +1 -1
  106. package/lib/firestore/index.d.ts +1 -1
  107. package/lib/firestore/index.js +4 -4
  108. package/lib/functions/functions-api-client-internal.d.ts +1 -1
  109. package/lib/functions/functions-api-client-internal.js +3 -2
  110. package/lib/functions/functions-api.d.ts +1 -1
  111. package/lib/functions/functions-api.js +1 -1
  112. package/lib/functions/functions.d.ts +1 -1
  113. package/lib/functions/functions.js +1 -1
  114. package/lib/functions/index.d.ts +1 -1
  115. package/lib/functions/index.js +3 -3
  116. package/lib/index.d.ts +1 -1
  117. package/lib/index.js +1 -1
  118. package/lib/installations/index.d.ts +1 -1
  119. package/lib/installations/index.js +3 -3
  120. package/lib/installations/installations-namespace.d.ts +1 -1
  121. package/lib/installations/installations-namespace.js +1 -1
  122. package/lib/installations/installations-request-handler.d.ts +1 -1
  123. package/lib/installations/installations-request-handler.js +1 -1
  124. package/lib/installations/installations.d.ts +1 -1
  125. package/lib/installations/installations.js +1 -1
  126. package/lib/instance-id/index.d.ts +1 -1
  127. package/lib/instance-id/index.js +3 -3
  128. package/lib/instance-id/instance-id-namespace.d.ts +1 -1
  129. package/lib/instance-id/instance-id-namespace.js +1 -1
  130. package/lib/instance-id/instance-id.d.ts +1 -1
  131. package/lib/instance-id/instance-id.js +1 -1
  132. package/lib/machine-learning/index.d.ts +1 -1
  133. package/lib/machine-learning/index.js +3 -3
  134. package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
  135. package/lib/machine-learning/machine-learning-api-client.js +3 -3
  136. package/lib/machine-learning/machine-learning-namespace.d.ts +1 -1
  137. package/lib/machine-learning/machine-learning-namespace.js +1 -1
  138. package/lib/machine-learning/machine-learning-utils.d.ts +1 -1
  139. package/lib/machine-learning/machine-learning-utils.js +1 -1
  140. package/lib/machine-learning/machine-learning.d.ts +1 -1
  141. package/lib/machine-learning/machine-learning.js +1 -1
  142. package/lib/messaging/index.d.ts +2 -2
  143. package/lib/messaging/index.js +3 -3
  144. package/lib/messaging/messaging-api-request-internal.d.ts +2 -12
  145. package/lib/messaging/messaging-api-request-internal.js +4 -40
  146. package/lib/messaging/messaging-api.d.ts +8 -94
  147. package/lib/messaging/messaging-api.js +1 -1
  148. package/lib/messaging/messaging-errors-internal.d.ts +1 -1
  149. package/lib/messaging/messaging-errors-internal.js +3 -4
  150. package/lib/messaging/messaging-internal.d.ts +1 -1
  151. package/lib/messaging/messaging-internal.js +4 -3
  152. package/lib/messaging/messaging-namespace.d.ts +2 -22
  153. package/lib/messaging/messaging-namespace.js +1 -1
  154. package/lib/messaging/messaging.d.ts +3 -149
  155. package/lib/messaging/messaging.js +2 -539
  156. package/lib/project-management/android-app.d.ts +1 -1
  157. package/lib/project-management/android-app.js +1 -1
  158. package/lib/project-management/app-metadata.d.ts +1 -1
  159. package/lib/project-management/app-metadata.js +1 -1
  160. package/lib/project-management/index.d.ts +1 -1
  161. package/lib/project-management/index.js +3 -3
  162. package/lib/project-management/ios-app.d.ts +1 -1
  163. package/lib/project-management/ios-app.js +1 -1
  164. package/lib/project-management/project-management-api-request-internal.d.ts +1 -1
  165. package/lib/project-management/project-management-api-request-internal.js +3 -3
  166. package/lib/project-management/project-management-namespace.d.ts +1 -1
  167. package/lib/project-management/project-management-namespace.js +1 -1
  168. package/lib/project-management/project-management.d.ts +1 -1
  169. package/lib/project-management/project-management.js +1 -1
  170. package/lib/remote-config/condition-evaluator-internal.d.ts +1 -1
  171. package/lib/remote-config/condition-evaluator-internal.js +6 -14
  172. package/lib/remote-config/index.d.ts +1 -1
  173. package/lib/remote-config/index.js +3 -3
  174. package/lib/remote-config/internal/value-impl.d.ts +1 -1
  175. package/lib/remote-config/internal/value-impl.js +1 -1
  176. package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
  177. package/lib/remote-config/remote-config-api-client-internal.js +1 -1
  178. package/lib/remote-config/remote-config-api.d.ts +1 -1
  179. package/lib/remote-config/remote-config-api.js +1 -1
  180. package/lib/remote-config/remote-config-namespace.d.ts +1 -1
  181. package/lib/remote-config/remote-config-namespace.js +1 -1
  182. package/lib/remote-config/remote-config.d.ts +1 -1
  183. package/lib/remote-config/remote-config.js +1 -1
  184. package/lib/security-rules/index.d.ts +1 -1
  185. package/lib/security-rules/index.js +3 -3
  186. package/lib/security-rules/security-rules-api-client-internal.d.ts +1 -1
  187. package/lib/security-rules/security-rules-api-client-internal.js +1 -1
  188. package/lib/security-rules/security-rules-internal.d.ts +1 -1
  189. package/lib/security-rules/security-rules-internal.js +1 -1
  190. package/lib/security-rules/security-rules-namespace.d.ts +1 -1
  191. package/lib/security-rules/security-rules-namespace.js +1 -1
  192. package/lib/security-rules/security-rules.d.ts +1 -2
  193. package/lib/security-rules/security-rules.js +1 -1
  194. package/lib/storage/index.d.ts +1 -1
  195. package/lib/storage/index.js +4 -4
  196. package/lib/storage/storage-namespace.d.ts +1 -1
  197. package/lib/storage/storage-namespace.js +1 -1
  198. package/lib/storage/storage.d.ts +1 -1
  199. package/lib/storage/storage.js +1 -1
  200. package/lib/storage/utils.d.ts +1 -1
  201. package/lib/storage/utils.js +2 -3
  202. package/lib/utils/api-request.d.ts +1 -5
  203. package/lib/utils/api-request.js +23 -8
  204. package/lib/utils/crypto-signer.d.ts +1 -2
  205. package/lib/utils/crypto-signer.js +3 -3
  206. package/lib/utils/deep-copy.d.ts +1 -1
  207. package/lib/utils/deep-copy.js +3 -4
  208. package/lib/utils/error.d.ts +1 -1
  209. package/lib/utils/error.js +1 -1
  210. package/lib/utils/index.d.ts +2 -2
  211. package/lib/utils/index.js +19 -16
  212. package/lib/utils/jwt.d.ts +1 -2
  213. package/lib/utils/jwt.js +5 -5
  214. package/lib/utils/validator.d.ts +1 -2
  215. package/lib/utils/validator.js +20 -21
  216. package/package.json +14 -13
  217. package/CHANGELOG.md +0 -4
  218. package/lib/messaging/batch-request-internal.d.ts +0 -55
  219. package/lib/messaging/batch-request-internal.js +0 -127
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -16,7 +16,8 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.ProjectManagementRequestHandler = exports.assertServerResponse = void 0;
19
+ exports.ProjectManagementRequestHandler = void 0;
20
+ exports.assertServerResponse = assertServerResponse;
20
21
  const api_request_1 = require("../utils/api-request");
21
22
  const error_1 = require("../utils/error");
22
23
  const index_1 = require("../utils/index");
@@ -43,7 +44,6 @@ function assertServerResponse(condition, responseData, message) {
43
44
  throw new error_1.FirebaseProjectManagementError('invalid-server-response', `${message} Response data: ${JSON.stringify(responseData, null, 2)}`);
44
45
  }
45
46
  }
46
- exports.assertServerResponse = assertServerResponse;
47
47
  /**
48
48
  * Class that provides mechanism to send requests to the Firebase project management backend
49
49
  * endpoints.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * Copyright 2018 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * Copyright 2024 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * Copyright 2024 Google Inc.
4
4
  *
@@ -18,7 +18,7 @@
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.ConditionEvaluator = void 0;
20
20
  const remote_config_api_1 = require("./remote-config-api");
21
- const farmhash = require("farmhash-modern");
21
+ const crypto_1 = require("crypto");
22
22
  /**
23
23
  * Encapsulates condition evaluation logic to simplify organization and
24
24
  * facilitate testing.
@@ -104,8 +104,8 @@ class ConditionEvaluator {
104
104
  const normalizedMicroPercentLowerBound = microPercentRange?.microPercentLowerBound || 0;
105
105
  const seedPrefix = seed && seed.length > 0 ? `${seed}.` : '';
106
106
  const stringToHash = `${seedPrefix}${context.randomizationId}`;
107
- const hash64 = ConditionEvaluator.hashSeededRandomizationId(stringToHash);
108
- const instanceMicroPercentile = hash64 % BigInt(100 * 1000000);
107
+ const hash = ConditionEvaluator.hashSeededRandomizationId(stringToHash);
108
+ const instanceMicroPercentile = hash % BigInt(100 * 1000000);
109
109
  switch (percentOperator) {
110
110
  case remote_config_api_1.PercentConditionOperator.LESS_OR_EQUAL:
111
111
  return instanceMicroPercentile <= normalizedMicroPercent;
@@ -122,16 +122,8 @@ class ConditionEvaluator {
122
122
  return false;
123
123
  }
124
124
  static hashSeededRandomizationId(seededRandomizationId) {
125
- // For consistency with the Remote Config fetch endpoint's percent condition behavior
126
- // we use Farmhash's fingerprint64 algorithm and interpret the resulting unsigned value
127
- // as a signed value.
128
- let hash64 = BigInt.asIntN(64, farmhash.fingerprint64(seededRandomizationId));
129
- // Manually negate the hash if its value is less than 0, since Math.abs doesn't
130
- // support BigInt.
131
- if (hash64 < 0) {
132
- hash64 = -hash64;
133
- }
134
- return hash64;
125
+ const hex = (0, crypto_1.createHash)('sha256').update(seededRandomizationId).digest('hex');
126
+ return BigInt(`0x${hex}`);
135
127
  }
136
128
  evaluateCustomSignalCondition(customSignalCondition, context) {
137
129
  const { customSignalOperator, customSignalKey, targetCustomSignalValues, } = customSignalCondition;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -16,7 +16,8 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.getRemoteConfig = exports.RemoteConfig = exports.PercentConditionOperator = exports.CustomSignalOperator = void 0;
19
+ exports.RemoteConfig = exports.PercentConditionOperator = exports.CustomSignalOperator = void 0;
20
+ exports.getRemoteConfig = getRemoteConfig;
20
21
  /**
21
22
  * Firebase Remote Config.
22
23
  *
@@ -62,4 +63,3 @@ function getRemoteConfig(app) {
62
63
  const firebaseApp = app;
63
64
  return firebaseApp.getOrInitService('remoteConfig', (app) => new remote_config_1.RemoteConfig(app));
64
65
  }
65
- exports.getRemoteConfig = getRemoteConfig;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * Copyright 2024 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * Copyright 2024 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -16,7 +16,8 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.getSecurityRules = exports.SecurityRules = exports.RulesetMetadataList = exports.Ruleset = void 0;
19
+ exports.SecurityRules = exports.RulesetMetadataList = exports.Ruleset = void 0;
20
+ exports.getSecurityRules = getSecurityRules;
20
21
  /**
21
22
  * Security Rules for Cloud Firestore and Cloud Storage.
22
23
  *
@@ -60,4 +61,3 @@ function getSecurityRules(app) {
60
61
  const firebaseApp = app;
61
62
  return firebaseApp.getOrInitService('securityRules', (app) => new security_rules_1.SecurityRules(app));
62
63
  }
63
- exports.getSecurityRules = getSecurityRules;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * Copyright 2019 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2019 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * Copyright 2019 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2019 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * Copyright 2019 Google Inc.
4
4
  *
@@ -14,7 +14,6 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- /// <reference types="node" />
18
17
  import { App } from '../app';
19
18
  /**
20
19
  * A source file containing some Firebase security rules. The content includes raw
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2019 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -16,7 +16,9 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.getDownloadURL = exports.getStorage = exports.Storage = void 0;
19
+ exports.Storage = void 0;
20
+ exports.getStorage = getStorage;
21
+ exports.getDownloadURL = getDownloadURL;
20
22
  const app_1 = require("../app");
21
23
  const storage_1 = require("./storage");
22
24
  const error_1 = require("../utils/error");
@@ -49,7 +51,6 @@ function getStorage(app) {
49
51
  const firebaseApp = app;
50
52
  return firebaseApp.getOrInitService('storage', (app) => new storage_1.Storage(app));
51
53
  }
52
- exports.getStorage = getStorage;
53
54
  /**
54
55
  * Gets the download URL for the given {@link https://cloud.google.com/nodejs/docs/reference/storage/latest/storage/file | File}.
55
56
  *
@@ -74,4 +75,3 @@ async function getDownloadURL(file) {
74
75
  const [token] = downloadTokens.split(',');
75
76
  return `${endpoint}/b/${file.bucket.name}/o/${encodeURIComponent(file.name)}?alt=media&token=${token}`;
76
77
  }
77
- exports.getDownloadURL = getDownloadURL;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  import { File } from '@google-cloud/storage';
3
3
  export interface FirebaseMetadata {
4
4
  name: string;
@@ -1,7 +1,7 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getFirebaseMetadata = void 0;
4
+ exports.getFirebaseMetadata = getFirebaseMetadata;
5
5
  function getFirebaseMetadata(endpoint, file) {
6
6
  const uri = `${endpoint}/b/${file.bucket.name}/o/${encodeURIComponent(file.name)}`;
7
7
  return new Promise((resolve, reject) => {
@@ -18,4 +18,3 @@ function getFirebaseMetadata(endpoint, file) {
18
18
  });
19
19
  });
20
20
  }
21
- exports.getFirebaseMetadata = getFirebaseMetadata;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -15,10 +15,6 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- /// <reference types="node" />
19
- /// <reference types="node" />
20
- /// <reference types="node" />
21
- /// <reference types="node" />
22
18
  import { FirebaseApp } from '../app/firebase-app';
23
19
  import http = require('http');
24
20
  import http2 = require('http2');
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -17,7 +17,9 @@
17
17
  * limitations under the License.
18
18
  */
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.Http2SessionHandler = exports.ExponentialBackoffPoller = exports.ApiSettings = exports.AuthorizedHttp2Client = exports.AuthorizedHttpClient = exports.parseHttpResponse = exports.Http2Client = exports.HttpClient = exports.RequestClient = exports.defaultRetryConfig = exports.RequestResponseError = void 0;
20
+ exports.Http2SessionHandler = exports.ExponentialBackoffPoller = exports.ApiSettings = exports.AuthorizedHttp2Client = exports.AuthorizedHttpClient = exports.Http2Client = exports.HttpClient = exports.RequestClient = exports.RequestResponseError = void 0;
21
+ exports.defaultRetryConfig = defaultRetryConfig;
22
+ exports.parseHttpResponse = parseHttpResponse;
21
23
  const error_1 = require("./error");
22
24
  const validator = require("./validator");
23
25
  const http = require("http");
@@ -25,6 +27,8 @@ const https = require("https");
25
27
  const http2 = require("http2");
26
28
  const url = require("url");
27
29
  const events_1 = require("events");
30
+ const credential_internal_1 = require("../app/credential-internal");
31
+ const index_1 = require("../utils/index");
28
32
  class DefaultRequestResponse {
29
33
  /**
30
34
  * Constructs a new `RequestResponse` from the given `LowLevelResponse`.
@@ -101,7 +105,6 @@ function defaultRetryConfig() {
101
105
  maxDelayInMillis: 60 * 1000,
102
106
  };
103
107
  }
104
- exports.defaultRetryConfig = defaultRetryConfig;
105
108
  /**
106
109
  * Ensures that the given `RetryConfig` object is valid.
107
110
  *
@@ -360,7 +363,6 @@ function parseHttpResponse(response, config) {
360
363
  }
361
364
  return new DefaultRequestResponse(lowLevelResponse);
362
365
  }
363
- exports.parseHttpResponse = parseHttpResponse;
364
366
  /**
365
367
  * A helper class for common functionality needed to send requests over the wire.
366
368
  * It also wraps the callback API of the Node.js standard library in a more flexible Promise API.
@@ -792,14 +794,18 @@ class AuthorizedHttpClient extends HttpClient {
792
794
  requestCopy.headers = Object.assign({}, request.headers);
793
795
  const authHeader = 'Authorization';
794
796
  requestCopy.headers[authHeader] = `Bearer ${token}`;
795
- // Fix issue where firebase-admin does not specify quota project that is
796
- // necessary for use when utilizing human account with ADC (RSDF)
797
- if (!requestCopy.headers['x-goog-user-project'] && this.app.options.projectId) {
798
- requestCopy.headers['x-goog-user-project'] = this.app.options.projectId;
797
+ let quotaProjectId;
798
+ if (this.app.options.credential instanceof credential_internal_1.ApplicationDefaultCredential) {
799
+ quotaProjectId = this.app.options.credential.getQuotaProjectId();
800
+ }
801
+ quotaProjectId = process.env.GOOGLE_CLOUD_QUOTA_PROJECT || quotaProjectId;
802
+ if (!requestCopy.headers['x-goog-user-project'] && validator.isNonEmptyString(quotaProjectId)) {
803
+ requestCopy.headers['x-goog-user-project'] = quotaProjectId;
799
804
  }
800
805
  if (!requestCopy.httpAgent && this.app.options.httpAgent) {
801
806
  requestCopy.httpAgent = this.app.options.httpAgent;
802
807
  }
808
+ requestCopy.headers['X-Goog-Api-Client'] = (0, index_1.getMetricsHeader)();
803
809
  return super.send(requestCopy);
804
810
  });
805
811
  }
@@ -820,6 +826,15 @@ class AuthorizedHttp2Client extends Http2Client {
820
826
  requestCopy.headers = Object.assign({}, request.headers);
821
827
  const authHeader = 'Authorization';
822
828
  requestCopy.headers[authHeader] = `Bearer ${token}`;
829
+ let quotaProjectId;
830
+ if (this.app.options.credential instanceof credential_internal_1.ApplicationDefaultCredential) {
831
+ quotaProjectId = this.app.options.credential.getQuotaProjectId();
832
+ }
833
+ quotaProjectId = process.env.GOOGLE_CLOUD_QUOTA_PROJECT || quotaProjectId;
834
+ if (!requestCopy.headers['x-goog-user-project'] && validator.isNonEmptyString(quotaProjectId)) {
835
+ requestCopy.headers['x-goog-user-project'] = quotaProjectId;
836
+ }
837
+ requestCopy.headers['X-Goog-Api-Client'] = (0, index_1.getMetricsHeader)();
823
838
  return super.send(requestCopy);
824
839
  });
825
840
  }
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -15,7 +15,6 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- /// <reference types="node" />
19
18
  import { App } from '../app';
20
19
  import { ServiceAccountCredential } from '../app/credential-internal';
21
20
  import { AuthorizedHttpClient } from './api-request';
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -17,7 +17,8 @@
17
17
  * limitations under the License.
18
18
  */
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.CryptoSignerErrorCode = exports.CryptoSignerError = exports.cryptoSignerFromApp = exports.IAMSigner = exports.ServiceAccountSigner = void 0;
20
+ exports.CryptoSignerErrorCode = exports.CryptoSignerError = exports.IAMSigner = exports.ServiceAccountSigner = void 0;
21
+ exports.cryptoSignerFromApp = cryptoSignerFromApp;
21
22
  const credential_internal_1 = require("../app/credential-internal");
22
23
  const api_request_1 = require("./api-request");
23
24
  const validator = require("../utils/validator");
@@ -159,7 +160,6 @@ function cryptoSignerFromApp(app) {
159
160
  }
160
161
  return new IAMSigner(new api_request_1.AuthorizedHttpClient(app), app.options.serviceAccountId);
161
162
  }
162
- exports.cryptoSignerFromApp = cryptoSignerFromApp;
163
163
  /**
164
164
  * CryptoSigner error code structure.
165
165
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -17,7 +17,8 @@
17
17
  * limitations under the License.
18
18
  */
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.deepExtend = exports.deepCopy = void 0;
20
+ exports.deepCopy = deepCopy;
21
+ exports.deepExtend = deepExtend;
21
22
  /**
22
23
  * Returns a deep copy of an object or array.
23
24
  *
@@ -27,7 +28,6 @@ exports.deepExtend = exports.deepCopy = void 0;
27
28
  function deepCopy(value) {
28
29
  return deepExtend(undefined, value);
29
30
  }
30
- exports.deepCopy = deepCopy;
31
31
  /**
32
32
  * Copies properties from source to target (recursively allows extension of objects and arrays).
33
33
  * Scalar values in the target are over-written. If target is undefined, an object of the
@@ -75,4 +75,3 @@ function deepExtend(target, source) {
75
75
  }
76
76
  return target;
77
77
  }
78
- exports.deepExtend = deepExtend;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -15,9 +15,9 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- /// <reference types="node" />
19
18
  import { App } from '../app/index';
20
19
  export declare function getSdkVersion(): string;
20
+ export declare function getMetricsHeader(): string;
21
21
  /**
22
22
  * Renames properties on an object given a mapping from old to new property names.
23
23
  *