firebase-admin 10.2.0 → 11.0.1

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 (192) hide show
  1. package/README.md +1 -1
  2. package/lib/app/core.d.ts +1 -1
  3. package/lib/app/core.js +1 -1
  4. package/lib/app/credential-factory.d.ts +1 -1
  5. package/lib/app/credential-factory.js +8 -8
  6. package/lib/app/credential-internal.d.ts +7 -1
  7. package/lib/app/credential-internal.js +120 -106
  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 +76 -91
  12. package/lib/app/firebase-namespace.d.ts +1 -1
  13. package/lib/app/firebase-namespace.js +209 -279
  14. package/lib/app/index.d.ts +1 -1
  15. package/lib/app/index.js +4 -4
  16. package/lib/app/lifecycle.d.ts +1 -1
  17. package/lib/app/lifecycle.js +37 -43
  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 +54 -73
  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 +17 -19
  26. package/lib/app-check/index.d.ts +1 -1
  27. package/lib/app-check/index.js +7 -7
  28. package/lib/app-check/token-generator.d.ts +1 -1
  29. package/lib/app-check/token-generator.js +47 -52
  30. package/lib/app-check/token-verifier.d.ts +1 -1
  31. package/lib/app-check/token-verifier.js +46 -50
  32. package/lib/auth/action-code-settings-builder.d.ts +1 -1
  33. package/lib/auth/action-code-settings-builder.js +10 -11
  34. package/lib/auth/auth-api-request.d.ts +1 -1
  35. package/lib/auth/auth-api-request.js +346 -393
  36. package/lib/auth/auth-config.d.ts +1 -1
  37. package/lib/auth/auth-config.js +95 -106
  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 +20 -40
  42. package/lib/auth/base-auth.d.ts +1 -1
  43. package/lib/auth/base-auth.js +137 -144
  44. package/lib/auth/identifier.d.ts +1 -1
  45. package/lib/auth/identifier.js +2 -2
  46. package/lib/auth/index.d.ts +1 -1
  47. package/lib/auth/index.js +7 -7
  48. package/lib/auth/tenant-manager.d.ts +1 -1
  49. package/lib/auth/tenant-manager.js +49 -71
  50. package/lib/auth/tenant.d.ts +1 -1
  51. package/lib/auth/tenant.js +44 -55
  52. package/lib/auth/token-generator.d.ts +1 -1
  53. package/lib/auth/token-generator.js +49 -53
  54. package/lib/auth/token-verifier.d.ts +1 -1
  55. package/lib/auth/token-verifier.js +83 -91
  56. package/lib/auth/user-import-builder.d.ts +1 -1
  57. package/lib/auth/user-import-builder.js +70 -73
  58. package/lib/auth/user-record.d.ts +1 -1
  59. package/lib/auth/user-record.js +62 -84
  60. package/lib/credential/index.d.ts +1 -1
  61. package/lib/credential/index.js +2 -2
  62. package/lib/database/database-namespace.d.ts +1 -1
  63. package/lib/database/database-namespace.js +1 -1
  64. package/lib/database/database.d.ts +1 -1
  65. package/lib/database/database.js +92 -108
  66. package/lib/database/index.d.ts +1 -1
  67. package/lib/database/index.js +10 -10
  68. package/lib/default-namespace.d.ts +1 -1
  69. package/lib/default-namespace.js +2 -2
  70. package/lib/eventarc/cloudevent.d.ts +1 -1
  71. package/lib/eventarc/cloudevent.js +1 -1
  72. package/lib/eventarc/eventarc-client-internal.d.ts +1 -1
  73. package/lib/eventarc/eventarc-client-internal.js +63 -129
  74. package/lib/eventarc/eventarc-utils.d.ts +1 -1
  75. package/lib/eventarc/eventarc-utils.js +16 -32
  76. package/lib/eventarc/eventarc.d.ts +1 -1
  77. package/lib/eventarc/eventarc.js +51 -65
  78. package/lib/eventarc/index.d.ts +1 -1
  79. package/lib/eventarc/index.js +7 -7
  80. package/lib/firebase-namespace-api.d.ts +1 -1
  81. package/lib/firebase-namespace-api.js +8 -3
  82. package/lib/firestore/firestore-internal.d.ts +1 -1
  83. package/lib/firestore/firestore-internal.js +28 -37
  84. package/lib/firestore/firestore-namespace.d.ts +9 -1
  85. package/lib/firestore/firestore-namespace.js +2 -2
  86. package/lib/firestore/index.d.ts +2 -2
  87. package/lib/firestore/index.js +7 -7
  88. package/lib/functions/functions-api-client-internal.d.ts +19 -1
  89. package/lib/functions/functions-api-client-internal.js +83 -103
  90. package/lib/functions/functions-api.d.ts +1 -1
  91. package/lib/functions/functions-api.js +1 -1
  92. package/lib/functions/functions.d.ts +1 -1
  93. package/lib/functions/functions.js +13 -15
  94. package/lib/functions/index.d.ts +1 -1
  95. package/lib/functions/index.js +7 -7
  96. package/lib/index.d.ts +1 -1
  97. package/lib/index.js +14 -4
  98. package/lib/installations/index.d.ts +1 -1
  99. package/lib/installations/index.js +6 -6
  100. package/lib/installations/installations-namespace.d.ts +1 -1
  101. package/lib/installations/installations-namespace.js +1 -1
  102. package/lib/installations/installations-request-handler.d.ts +1 -1
  103. package/lib/installations/installations-request-handler.js +33 -36
  104. package/lib/installations/installations.d.ts +1 -1
  105. package/lib/installations/installations.js +17 -22
  106. package/lib/instance-id/index.d.ts +1 -1
  107. package/lib/instance-id/index.js +6 -6
  108. package/lib/instance-id/instance-id-namespace.d.ts +1 -1
  109. package/lib/instance-id/instance-id-namespace.js +1 -1
  110. package/lib/instance-id/instance-id.d.ts +1 -1
  111. package/lib/instance-id/instance-id.js +21 -26
  112. package/lib/machine-learning/index.d.ts +1 -1
  113. package/lib/machine-learning/index.js +7 -7
  114. package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
  115. package/lib/machine-learning/machine-learning-api-client.js +110 -124
  116. package/lib/machine-learning/machine-learning-namespace.d.ts +1 -1
  117. package/lib/machine-learning/machine-learning-namespace.js +1 -1
  118. package/lib/machine-learning/machine-learning-utils.d.ts +1 -1
  119. package/lib/machine-learning/machine-learning-utils.js +9 -24
  120. package/lib/machine-learning/machine-learning.d.ts +1 -1
  121. package/lib/machine-learning/machine-learning.js +146 -207
  122. package/lib/messaging/batch-request-internal.d.ts +1 -1
  123. package/lib/messaging/batch-request-internal.js +33 -35
  124. package/lib/messaging/index.d.ts +1 -1
  125. package/lib/messaging/index.js +7 -7
  126. package/lib/messaging/messaging-api-request-internal.d.ts +1 -1
  127. package/lib/messaging/messaging-api-request-internal.js +38 -40
  128. package/lib/messaging/messaging-api.d.ts +1 -1
  129. package/lib/messaging/messaging-api.js +1 -1
  130. package/lib/messaging/messaging-errors-internal.d.ts +1 -1
  131. package/lib/messaging/messaging-errors-internal.js +12 -13
  132. package/lib/messaging/messaging-internal.d.ts +1 -1
  133. package/lib/messaging/messaging-internal.js +51 -51
  134. package/lib/messaging/messaging-namespace.d.ts +1 -1
  135. package/lib/messaging/messaging-namespace.js +1 -1
  136. package/lib/messaging/messaging.d.ts +1 -1
  137. package/lib/messaging/messaging.js +184 -208
  138. package/lib/project-management/android-app.d.ts +1 -1
  139. package/lib/project-management/android-app.js +41 -43
  140. package/lib/project-management/app-metadata.d.ts +1 -1
  141. package/lib/project-management/app-metadata.js +1 -1
  142. package/lib/project-management/index.d.ts +1 -1
  143. package/lib/project-management/index.js +7 -7
  144. package/lib/project-management/ios-app.d.ts +1 -1
  145. package/lib/project-management/ios-app.js +25 -26
  146. package/lib/project-management/project-management-api-request-internal.d.ts +1 -1
  147. package/lib/project-management/project-management-api-request-internal.js +84 -89
  148. package/lib/project-management/project-management-namespace.d.ts +1 -1
  149. package/lib/project-management/project-management-namespace.js +1 -1
  150. package/lib/project-management/project-management.d.ts +1 -1
  151. package/lib/project-management/project-management.js +80 -87
  152. package/lib/remote-config/index.d.ts +1 -1
  153. package/lib/remote-config/index.js +7 -7
  154. package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
  155. package/lib/remote-config/remote-config-api-client-internal.js +116 -154
  156. package/lib/remote-config/remote-config-api.d.ts +1 -1
  157. package/lib/remote-config/remote-config-api.js +1 -1
  158. package/lib/remote-config/remote-config-namespace.d.ts +1 -1
  159. package/lib/remote-config/remote-config-namespace.js +1 -1
  160. package/lib/remote-config/remote-config.d.ts +1 -1
  161. package/lib/remote-config/remote-config.js +51 -59
  162. package/lib/security-rules/index.d.ts +1 -1
  163. package/lib/security-rules/index.js +7 -7
  164. package/lib/security-rules/security-rules-api-client-internal.d.ts +3 -1
  165. package/lib/security-rules/security-rules-api-client-internal.js +118 -107
  166. package/lib/security-rules/security-rules-internal.d.ts +1 -1
  167. package/lib/security-rules/security-rules-internal.js +6 -21
  168. package/lib/security-rules/security-rules-namespace.d.ts +1 -1
  169. package/lib/security-rules/security-rules-namespace.js +1 -1
  170. package/lib/security-rules/security-rules.d.ts +1 -1
  171. package/lib/security-rules/security-rules.js +83 -92
  172. package/lib/storage/index.d.ts +1 -1
  173. package/lib/storage/index.js +7 -7
  174. package/lib/storage/storage-namespace.d.ts +1 -1
  175. package/lib/storage/storage-namespace.js +1 -1
  176. package/lib/storage/storage.d.ts +1 -1
  177. package/lib/storage/storage.js +25 -30
  178. package/lib/utils/api-request.d.ts +3 -1
  179. package/lib/utils/api-request.js +278 -356
  180. package/lib/utils/crypto-signer.d.ts +1 -1
  181. package/lib/utils/crypto-signer.js +58 -93
  182. package/lib/utils/deep-copy.d.ts +1 -1
  183. package/lib/utils/deep-copy.js +3 -3
  184. package/lib/utils/error.d.ts +1 -1
  185. package/lib/utils/error.js +611 -681
  186. package/lib/utils/index.d.ts +1 -1
  187. package/lib/utils/index.js +38 -43
  188. package/lib/utils/jwt.d.ts +1 -1
  189. package/lib/utils/jwt.js +97 -123
  190. package/lib/utils/validator.d.ts +1 -1
  191. package/lib/utils/validator.js +13 -13
  192. package/package.json +25 -10
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.2.0 */
1
+ /*! firebase-admin v11.0.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -17,38 +17,38 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.UserImportBuilder = exports.convertMultiFactorInfoToServerFormat = void 0;
20
- var deep_copy_1 = require("../utils/deep-copy");
21
- var utils = require("../utils");
22
- var validator = require("../utils/validator");
23
- var error_1 = require("../utils/error");
20
+ const deep_copy_1 = require("../utils/deep-copy");
21
+ const utils = require("../utils");
22
+ const validator = require("../utils/validator");
23
+ const error_1 = require("../utils/error");
24
24
  /**
25
25
  * Converts a client format second factor object to server format.
26
26
  * @param multiFactorInfo - The client format second factor.
27
27
  * @returns The corresponding AuthFactorInfo server request format.
28
28
  */
29
29
  function convertMultiFactorInfoToServerFormat(multiFactorInfo) {
30
- var enrolledAt;
30
+ let enrolledAt;
31
31
  if (typeof multiFactorInfo.enrollmentTime !== 'undefined') {
32
32
  if (validator.isUTCDateString(multiFactorInfo.enrollmentTime)) {
33
33
  // Convert from UTC date string (client side format) to ISO date string (server side format).
34
34
  enrolledAt = new Date(multiFactorInfo.enrollmentTime).toISOString();
35
35
  }
36
36
  else {
37
- throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ENROLLMENT_TIME, "The second factor \"enrollmentTime\" for \"" + multiFactorInfo.uid + "\" must be a valid " +
37
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ENROLLMENT_TIME, `The second factor "enrollmentTime" for "${multiFactorInfo.uid}" must be a valid ` +
38
38
  'UTC date string.');
39
39
  }
40
40
  }
41
41
  // Currently only phone second factors are supported.
42
42
  if (isPhoneFactor(multiFactorInfo)) {
43
43
  // If any required field is missing or invalid, validation will still fail later.
44
- var authFactorInfo = {
44
+ const authFactorInfo = {
45
45
  mfaEnrollmentId: multiFactorInfo.uid,
46
46
  displayName: multiFactorInfo.displayName,
47
47
  // Required for all phone second factors.
48
48
  phoneInfo: multiFactorInfo.phoneNumber,
49
- enrolledAt: enrolledAt,
49
+ enrolledAt,
50
50
  };
51
- for (var objKey in authFactorInfo) {
51
+ for (const objKey in authFactorInfo) {
52
52
  if (typeof authFactorInfo[objKey] === 'undefined') {
53
53
  delete authFactorInfo[objKey];
54
54
  }
@@ -57,7 +57,7 @@ function convertMultiFactorInfoToServerFormat(multiFactorInfo) {
57
57
  }
58
58
  else {
59
59
  // Unsupported second factor.
60
- throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.UNSUPPORTED_SECOND_FACTOR, "Unsupported second factor \"" + JSON.stringify(multiFactorInfo) + "\" provided.");
60
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.UNSUPPORTED_SECOND_FACTOR, `Unsupported second factor "${JSON.stringify(multiFactorInfo)}" provided.`);
61
61
  }
62
62
  }
63
63
  exports.convertMultiFactorInfoToServerFormat = convertMultiFactorInfoToServerFormat;
@@ -83,7 +83,7 @@ function getNumberField(obj, key) {
83
83
  * @returns {UploadAccountUser} The corresponding UploadAccountUser to return.
84
84
  */
85
85
  function populateUploadAccountUser(user, userValidator) {
86
- var result = {
86
+ const result = {
87
87
  localId: user.uid,
88
88
  email: user.email,
89
89
  emailVerified: user.emailVerified,
@@ -117,7 +117,7 @@ function populateUploadAccountUser(user, userValidator) {
117
117
  }
118
118
  }
119
119
  if (validator.isArray(user.providerData)) {
120
- user.providerData.forEach(function (providerData) {
120
+ user.providerData.forEach((providerData) => {
121
121
  result.providerUserInfo.push({
122
122
  providerId: providerData.providerId,
123
123
  rawId: providerData.uid,
@@ -130,12 +130,12 @@ function populateUploadAccountUser(user, userValidator) {
130
130
  // Convert user.multiFactor.enrolledFactors to server format.
131
131
  if (validator.isNonNullObject(user.multiFactor) &&
132
132
  validator.isNonEmptyArray(user.multiFactor.enrolledFactors)) {
133
- user.multiFactor.enrolledFactors.forEach(function (multiFactorInfo) {
133
+ user.multiFactor.enrolledFactors.forEach((multiFactorInfo) => {
134
134
  result.mfaInfo.push(convertMultiFactorInfoToServerFormat(multiFactorInfo));
135
135
  });
136
136
  }
137
137
  // Remove blank fields.
138
- var key;
138
+ let key;
139
139
  for (key in result) {
140
140
  if (typeof result[key] === 'undefined') {
141
141
  delete result[key];
@@ -158,7 +158,7 @@ function populateUploadAccountUser(user, userValidator) {
158
158
  * Class that provides a helper for building/validating uploadAccount requests and
159
159
  * UserImportResult responses.
160
160
  */
161
- var UserImportBuilder = /** @class */ (function () {
161
+ class UserImportBuilder {
162
162
  /**
163
163
  * @param {UserImportRecord[]} users The list of user records to import.
164
164
  * @param {UserImportOptions=} options The import options which includes hashing
@@ -166,7 +166,7 @@ var UserImportBuilder = /** @class */ (function () {
166
166
  * @param {ValidatorFunction=} userRequestValidator The user request validator function.
167
167
  * @constructor
168
168
  */
169
- function UserImportBuilder(users, options, userRequestValidator) {
169
+ constructor(users, options, userRequestValidator) {
170
170
  this.requiresHashOptions = false;
171
171
  this.validatedUsers = [];
172
172
  this.userImportResultErrors = [];
@@ -178,42 +178,41 @@ var UserImportBuilder = /** @class */ (function () {
178
178
  * Returns the corresponding constructed uploadAccount request.
179
179
  * @returns {UploadAccountRequest} The constructed uploadAccount request.
180
180
  */
181
- UserImportBuilder.prototype.buildRequest = function () {
182
- var users = this.validatedUsers.map(function (user) {
183
- return deep_copy_1.deepCopy(user);
181
+ buildRequest() {
182
+ const users = this.validatedUsers.map((user) => {
183
+ return (0, deep_copy_1.deepCopy)(user);
184
184
  });
185
- return deep_copy_1.deepExtend({ users: users }, deep_copy_1.deepCopy(this.validatedOptions));
186
- };
185
+ return (0, deep_copy_1.deepExtend)({ users }, (0, deep_copy_1.deepCopy)(this.validatedOptions));
186
+ }
187
187
  /**
188
188
  * Populates the UserImportResult using the client side detected errors and the server
189
189
  * side returned errors.
190
190
  * @returns {UserImportResult} The user import result based on the returned failed
191
191
  * uploadAccount response.
192
192
  */
193
- UserImportBuilder.prototype.buildResponse = function (failedUploads) {
194
- var _this = this;
193
+ buildResponse(failedUploads) {
195
194
  // Initialize user import result.
196
- var importResult = {
195
+ const importResult = {
197
196
  successCount: this.validatedUsers.length,
198
197
  failureCount: this.userImportResultErrors.length,
199
- errors: deep_copy_1.deepCopy(this.userImportResultErrors),
198
+ errors: (0, deep_copy_1.deepCopy)(this.userImportResultErrors),
200
199
  };
201
200
  importResult.failureCount += failedUploads.length;
202
201
  importResult.successCount -= failedUploads.length;
203
- failedUploads.forEach(function (failedUpload) {
202
+ failedUploads.forEach((failedUpload) => {
204
203
  importResult.errors.push({
205
204
  // Map backend request index to original developer provided array index.
206
- index: _this.indexMap[failedUpload.index],
205
+ index: this.indexMap[failedUpload.index],
207
206
  error: new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_USER_IMPORT, failedUpload.message),
208
207
  });
209
208
  });
210
209
  // Sort errors by index.
211
- importResult.errors.sort(function (a, b) {
210
+ importResult.errors.sort((a, b) => {
212
211
  return a.index - b.index;
213
212
  });
214
213
  // Return sorted result.
215
214
  return importResult;
216
- };
215
+ }
217
216
  /**
218
217
  * Validates and returns the hashing options of the uploadAccount request.
219
218
  * Throws an error whenever an invalid or missing options is detected.
@@ -221,8 +220,8 @@ var UserImportBuilder = /** @class */ (function () {
221
220
  * @param {boolean} requiresHashOptions Whether to require hash options.
222
221
  * @returns {UploadAccountOptions} The populated UploadAccount options.
223
222
  */
224
- UserImportBuilder.prototype.populateOptions = function (options, requiresHashOptions) {
225
- var populatedOptions;
223
+ populateOptions(options, requiresHashOptions) {
224
+ let populatedOptions;
226
225
  if (!requiresHashOptions) {
227
226
  return {};
228
227
  }
@@ -236,7 +235,7 @@ var UserImportBuilder = /** @class */ (function () {
236
235
  !validator.isNonEmptyString(options.hash.algorithm)) {
237
236
  throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_HASH_ALGORITHM, '"hash.algorithm" must be a string matching the list of supported algorithms.');
238
237
  }
239
- var rounds;
238
+ let rounds;
240
239
  switch (options.hash.algorithm) {
241
240
  case 'HMAC_SHA512':
242
241
  case 'HMAC_SHA256':
@@ -244,7 +243,7 @@ var UserImportBuilder = /** @class */ (function () {
244
243
  case 'HMAC_MD5':
245
244
  if (!validator.isBuffer(options.hash.key)) {
246
245
  throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_HASH_KEY, 'A non-empty "hash.key" byte buffer must be provided for ' +
247
- ("hash algorithm " + options.hash.algorithm + "."));
246
+ `hash algorithm ${options.hash.algorithm}.`);
248
247
  }
249
248
  populatedOptions = {
250
249
  hashAlgorithm: options.hash.algorithm,
@@ -257,14 +256,14 @@ var UserImportBuilder = /** @class */ (function () {
257
256
  case 'SHA512': {
258
257
  // MD5 is [0,8192] but SHA1, SHA256, and SHA512 are [1,8192]
259
258
  rounds = getNumberField(options.hash, 'rounds');
260
- var minRounds = options.hash.algorithm === 'MD5' ? 0 : 1;
259
+ const minRounds = options.hash.algorithm === 'MD5' ? 0 : 1;
261
260
  if (isNaN(rounds) || rounds < minRounds || rounds > 8192) {
262
- throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_HASH_ROUNDS, "A valid \"hash.rounds\" number between " + minRounds + " and 8192 must be provided for " +
263
- ("hash algorithm " + options.hash.algorithm + "."));
261
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_HASH_ROUNDS, `A valid "hash.rounds" number between ${minRounds} and 8192 must be provided for ` +
262
+ `hash algorithm ${options.hash.algorithm}.`);
264
263
  }
265
264
  populatedOptions = {
266
265
  hashAlgorithm: options.hash.algorithm,
267
- rounds: rounds,
266
+ rounds,
268
267
  };
269
268
  break;
270
269
  }
@@ -273,27 +272,27 @@ var UserImportBuilder = /** @class */ (function () {
273
272
  rounds = getNumberField(options.hash, 'rounds');
274
273
  if (isNaN(rounds) || rounds < 0 || rounds > 120000) {
275
274
  throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_HASH_ROUNDS, 'A valid "hash.rounds" number between 0 and 120000 must be provided for ' +
276
- ("hash algorithm " + options.hash.algorithm + "."));
275
+ `hash algorithm ${options.hash.algorithm}.`);
277
276
  }
278
277
  populatedOptions = {
279
278
  hashAlgorithm: options.hash.algorithm,
280
- rounds: rounds,
279
+ rounds,
281
280
  };
282
281
  break;
283
282
  case 'SCRYPT': {
284
283
  if (!validator.isBuffer(options.hash.key)) {
285
284
  throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_HASH_KEY, 'A "hash.key" byte buffer must be provided for ' +
286
- ("hash algorithm " + options.hash.algorithm + "."));
285
+ `hash algorithm ${options.hash.algorithm}.`);
287
286
  }
288
287
  rounds = getNumberField(options.hash, 'rounds');
289
288
  if (isNaN(rounds) || rounds <= 0 || rounds > 8) {
290
289
  throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_HASH_ROUNDS, 'A valid "hash.rounds" number between 1 and 8 must be provided for ' +
291
- ("hash algorithm " + options.hash.algorithm + "."));
290
+ `hash algorithm ${options.hash.algorithm}.`);
292
291
  }
293
- var memoryCost = getNumberField(options.hash, 'memoryCost');
292
+ const memoryCost = getNumberField(options.hash, 'memoryCost');
294
293
  if (isNaN(memoryCost) || memoryCost <= 0 || memoryCost > 14) {
295
294
  throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_HASH_MEMORY_COST, 'A valid "hash.memoryCost" number between 1 and 14 must be provided for ' +
296
- ("hash algorithm " + options.hash.algorithm + "."));
295
+ `hash algorithm ${options.hash.algorithm}.`);
297
296
  }
298
297
  if (typeof options.hash.saltSeparator !== 'undefined' &&
299
298
  !validator.isBuffer(options.hash.saltSeparator)) {
@@ -302,8 +301,8 @@ var UserImportBuilder = /** @class */ (function () {
302
301
  populatedOptions = {
303
302
  hashAlgorithm: options.hash.algorithm,
304
303
  signerKey: utils.toWebSafeBase64(options.hash.key),
305
- rounds: rounds,
306
- memoryCost: memoryCost,
304
+ rounds,
305
+ memoryCost,
307
306
  saltSeparator: utils.toWebSafeBase64(options.hash.saltSeparator || Buffer.from('')),
308
307
  };
309
308
  break;
@@ -314,40 +313,40 @@ var UserImportBuilder = /** @class */ (function () {
314
313
  };
315
314
  break;
316
315
  case 'STANDARD_SCRYPT': {
317
- var cpuMemCost = getNumberField(options.hash, 'memoryCost');
316
+ const cpuMemCost = getNumberField(options.hash, 'memoryCost');
318
317
  if (isNaN(cpuMemCost)) {
319
318
  throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_HASH_MEMORY_COST, 'A valid "hash.memoryCost" number must be provided for ' +
320
- ("hash algorithm " + options.hash.algorithm + "."));
319
+ `hash algorithm ${options.hash.algorithm}.`);
321
320
  }
322
- var parallelization = getNumberField(options.hash, 'parallelization');
321
+ const parallelization = getNumberField(options.hash, 'parallelization');
323
322
  if (isNaN(parallelization)) {
324
323
  throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_HASH_PARALLELIZATION, 'A valid "hash.parallelization" number must be provided for ' +
325
- ("hash algorithm " + options.hash.algorithm + "."));
324
+ `hash algorithm ${options.hash.algorithm}.`);
326
325
  }
327
- var blockSize = getNumberField(options.hash, 'blockSize');
326
+ const blockSize = getNumberField(options.hash, 'blockSize');
328
327
  if (isNaN(blockSize)) {
329
328
  throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_HASH_BLOCK_SIZE, 'A valid "hash.blockSize" number must be provided for ' +
330
- ("hash algorithm " + options.hash.algorithm + "."));
329
+ `hash algorithm ${options.hash.algorithm}.`);
331
330
  }
332
- var dkLen = getNumberField(options.hash, 'derivedKeyLength');
331
+ const dkLen = getNumberField(options.hash, 'derivedKeyLength');
333
332
  if (isNaN(dkLen)) {
334
333
  throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_HASH_DERIVED_KEY_LENGTH, 'A valid "hash.derivedKeyLength" number must be provided for ' +
335
- ("hash algorithm " + options.hash.algorithm + "."));
334
+ `hash algorithm ${options.hash.algorithm}.`);
336
335
  }
337
336
  populatedOptions = {
338
337
  hashAlgorithm: options.hash.algorithm,
339
- cpuMemCost: cpuMemCost,
340
- parallelization: parallelization,
341
- blockSize: blockSize,
342
- dkLen: dkLen,
338
+ cpuMemCost,
339
+ parallelization,
340
+ blockSize,
341
+ dkLen,
343
342
  };
344
343
  break;
345
344
  }
346
345
  default:
347
- throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_HASH_ALGORITHM, "Unsupported hash algorithm provider \"" + options.hash.algorithm + "\".");
346
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_HASH_ALGORITHM, `Unsupported hash algorithm provider "${options.hash.algorithm}".`);
348
347
  }
349
348
  return populatedOptions;
350
- };
349
+ }
351
350
  /**
352
351
  * Validates and returns the users list of the uploadAccount request.
353
352
  * Whenever a user with an error is detected, the error is cached and will later be
@@ -358,30 +357,28 @@ var UserImportBuilder = /** @class */ (function () {
358
357
  * @param {ValidatorFunction=} userValidator The user validator function.
359
358
  * @returns {UploadAccountUser[]} The populated uploadAccount users.
360
359
  */
361
- UserImportBuilder.prototype.populateUsers = function (users, userValidator) {
362
- var _this = this;
363
- var populatedUsers = [];
364
- users.forEach(function (user, index) {
360
+ populateUsers(users, userValidator) {
361
+ const populatedUsers = [];
362
+ users.forEach((user, index) => {
365
363
  try {
366
- var result = populateUploadAccountUser(user, userValidator);
364
+ const result = populateUploadAccountUser(user, userValidator);
367
365
  if (typeof result.passwordHash !== 'undefined') {
368
- _this.requiresHashOptions = true;
366
+ this.requiresHashOptions = true;
369
367
  }
370
368
  // Only users that pass client screening will be passed to backend for processing.
371
369
  populatedUsers.push(result);
372
370
  // Map user's index (the one to be sent to backend) to original developer provided array.
373
- _this.indexMap[populatedUsers.length - 1] = index;
371
+ this.indexMap[populatedUsers.length - 1] = index;
374
372
  }
375
373
  catch (error) {
376
374
  // Save the client side error with respect to the developer provided array.
377
- _this.userImportResultErrors.push({
378
- index: index,
379
- error: error,
375
+ this.userImportResultErrors.push({
376
+ index,
377
+ error,
380
378
  });
381
379
  }
382
380
  });
383
381
  return populatedUsers;
384
- };
385
- return UserImportBuilder;
386
- }());
382
+ }
383
+ }
387
384
  exports.UserImportBuilder = UserImportBuilder;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.2.0 */
1
+ /*! firebase-admin v11.0.1 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.