firebase-admin 11.1.0 → 11.2.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 (196) hide show
  1. package/lib/app/core.d.ts +1 -1
  2. package/lib/app/core.js +1 -1
  3. package/lib/app/credential-factory.d.ts +1 -1
  4. package/lib/app/credential-factory.js +1 -1
  5. package/lib/app/credential-internal.d.ts +1 -1
  6. package/lib/app/credential-internal.js +1 -1
  7. package/lib/app/credential.d.ts +1 -1
  8. package/lib/app/credential.js +1 -1
  9. package/lib/app/firebase-app.d.ts +1 -1
  10. package/lib/app/firebase-app.js +1 -1
  11. package/lib/app/firebase-namespace.d.ts +1 -1
  12. package/lib/app/firebase-namespace.js +1 -1
  13. package/lib/app/index.d.ts +1 -1
  14. package/lib/app/index.js +1 -1
  15. package/lib/app/lifecycle.d.ts +1 -1
  16. package/lib/app/lifecycle.js +1 -1
  17. package/lib/app-check/app-check-api-client-internal.d.ts +1 -1
  18. package/lib/app-check/app-check-api-client-internal.js +1 -1
  19. package/lib/app-check/app-check-api.d.ts +1 -1
  20. package/lib/app-check/app-check-api.js +1 -1
  21. package/lib/app-check/app-check-namespace.d.ts +1 -1
  22. package/lib/app-check/app-check-namespace.js +1 -1
  23. package/lib/app-check/app-check.d.ts +1 -1
  24. package/lib/app-check/app-check.js +1 -1
  25. package/lib/app-check/index.d.ts +1 -1
  26. package/lib/app-check/index.js +1 -1
  27. package/lib/app-check/token-generator.d.ts +1 -1
  28. package/lib/app-check/token-generator.js +1 -1
  29. package/lib/app-check/token-verifier.d.ts +1 -1
  30. package/lib/app-check/token-verifier.js +1 -1
  31. package/lib/auth/action-code-settings-builder.d.ts +1 -1
  32. package/lib/auth/action-code-settings-builder.js +1 -1
  33. package/lib/auth/auth-api-request.d.ts +15 -4
  34. package/lib/auth/auth-api-request.js +53 -9
  35. package/lib/auth/auth-config.d.ts +56 -1
  36. package/lib/auth/auth-config.js +59 -2
  37. package/lib/auth/auth-namespace.d.ts +1 -1
  38. package/lib/auth/auth-namespace.js +1 -1
  39. package/lib/auth/auth.d.ts +9 -1
  40. package/lib/auth/auth.js +11 -1
  41. package/lib/auth/base-auth.d.ts +1 -1
  42. package/lib/auth/base-auth.js +1 -1
  43. package/lib/auth/identifier.d.ts +1 -1
  44. package/lib/auth/identifier.js +1 -1
  45. package/lib/auth/index.d.ts +4 -2
  46. package/lib/auth/index.js +6 -2
  47. package/lib/auth/project-config-manager.d.ts +25 -0
  48. package/lib/auth/project-config-manager.js +50 -0
  49. package/lib/auth/project-config.d.ts +48 -0
  50. package/lib/auth/project-config.js +90 -0
  51. package/lib/auth/tenant-manager.d.ts +1 -1
  52. package/lib/auth/tenant-manager.js +1 -1
  53. package/lib/auth/tenant.d.ts +14 -2
  54. package/lib/auth/tenant.js +16 -1
  55. package/lib/auth/token-generator.d.ts +1 -1
  56. package/lib/auth/token-generator.js +1 -1
  57. package/lib/auth/token-verifier.d.ts +1 -1
  58. package/lib/auth/token-verifier.js +1 -1
  59. package/lib/auth/user-import-builder.d.ts +1 -1
  60. package/lib/auth/user-import-builder.js +1 -1
  61. package/lib/auth/user-record.d.ts +1 -1
  62. package/lib/auth/user-record.js +1 -1
  63. package/lib/credential/index.d.ts +1 -1
  64. package/lib/credential/index.js +1 -1
  65. package/lib/database/database-namespace.d.ts +1 -1
  66. package/lib/database/database-namespace.js +1 -1
  67. package/lib/database/database.d.ts +1 -1
  68. package/lib/database/database.js +1 -1
  69. package/lib/database/index.d.ts +1 -1
  70. package/lib/database/index.js +1 -1
  71. package/lib/default-namespace.d.ts +1 -1
  72. package/lib/default-namespace.js +1 -1
  73. package/lib/esm/auth/index.js +2 -0
  74. package/lib/eventarc/cloudevent.d.ts +1 -1
  75. package/lib/eventarc/cloudevent.js +1 -1
  76. package/lib/eventarc/eventarc-client-internal.d.ts +1 -1
  77. package/lib/eventarc/eventarc-client-internal.js +1 -1
  78. package/lib/eventarc/eventarc-utils.d.ts +1 -1
  79. package/lib/eventarc/eventarc-utils.js +1 -1
  80. package/lib/eventarc/eventarc.d.ts +1 -1
  81. package/lib/eventarc/eventarc.js +1 -1
  82. package/lib/eventarc/index.d.ts +1 -1
  83. package/lib/eventarc/index.js +1 -1
  84. package/lib/firebase-namespace-api.d.ts +1 -1
  85. package/lib/firebase-namespace-api.js +1 -1
  86. package/lib/firestore/firestore-internal.d.ts +4 -4
  87. package/lib/firestore/firestore-internal.js +12 -6
  88. package/lib/firestore/firestore-namespace.d.ts +1 -1
  89. package/lib/firestore/firestore-namespace.js +1 -1
  90. package/lib/firestore/index.d.ts +17 -4
  91. package/lib/firestore/index.js +6 -33
  92. package/lib/functions/functions-api-client-internal.d.ts +1 -1
  93. package/lib/functions/functions-api-client-internal.js +1 -1
  94. package/lib/functions/functions-api.d.ts +1 -1
  95. package/lib/functions/functions-api.js +1 -1
  96. package/lib/functions/functions.d.ts +1 -1
  97. package/lib/functions/functions.js +1 -1
  98. package/lib/functions/index.d.ts +1 -1
  99. package/lib/functions/index.js +1 -1
  100. package/lib/index.d.ts +1 -1
  101. package/lib/index.js +1 -1
  102. package/lib/installations/index.d.ts +1 -1
  103. package/lib/installations/index.js +1 -1
  104. package/lib/installations/installations-namespace.d.ts +1 -1
  105. package/lib/installations/installations-namespace.js +1 -1
  106. package/lib/installations/installations-request-handler.d.ts +1 -1
  107. package/lib/installations/installations-request-handler.js +1 -1
  108. package/lib/installations/installations.d.ts +1 -1
  109. package/lib/installations/installations.js +1 -1
  110. package/lib/instance-id/index.d.ts +1 -1
  111. package/lib/instance-id/index.js +1 -1
  112. package/lib/instance-id/instance-id-namespace.d.ts +1 -1
  113. package/lib/instance-id/instance-id-namespace.js +1 -1
  114. package/lib/instance-id/instance-id.d.ts +1 -1
  115. package/lib/instance-id/instance-id.js +1 -1
  116. package/lib/machine-learning/index.d.ts +1 -1
  117. package/lib/machine-learning/index.js +1 -1
  118. package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
  119. package/lib/machine-learning/machine-learning-api-client.js +1 -1
  120. package/lib/machine-learning/machine-learning-namespace.d.ts +1 -1
  121. package/lib/machine-learning/machine-learning-namespace.js +1 -1
  122. package/lib/machine-learning/machine-learning-utils.d.ts +1 -1
  123. package/lib/machine-learning/machine-learning-utils.js +1 -1
  124. package/lib/machine-learning/machine-learning.d.ts +1 -1
  125. package/lib/machine-learning/machine-learning.js +1 -1
  126. package/lib/messaging/batch-request-internal.d.ts +1 -1
  127. package/lib/messaging/batch-request-internal.js +1 -1
  128. package/lib/messaging/index.d.ts +1 -1
  129. package/lib/messaging/index.js +1 -1
  130. package/lib/messaging/messaging-api-request-internal.d.ts +1 -1
  131. package/lib/messaging/messaging-api-request-internal.js +2 -2
  132. package/lib/messaging/messaging-api.d.ts +1 -1
  133. package/lib/messaging/messaging-api.js +1 -1
  134. package/lib/messaging/messaging-errors-internal.d.ts +1 -1
  135. package/lib/messaging/messaging-errors-internal.js +1 -1
  136. package/lib/messaging/messaging-internal.d.ts +1 -1
  137. package/lib/messaging/messaging-internal.js +1 -1
  138. package/lib/messaging/messaging-namespace.d.ts +1 -1
  139. package/lib/messaging/messaging-namespace.js +1 -1
  140. package/lib/messaging/messaging.d.ts +1 -1
  141. package/lib/messaging/messaging.js +1 -1
  142. package/lib/project-management/android-app.d.ts +1 -1
  143. package/lib/project-management/android-app.js +1 -1
  144. package/lib/project-management/app-metadata.d.ts +1 -1
  145. package/lib/project-management/app-metadata.js +1 -1
  146. package/lib/project-management/index.d.ts +1 -1
  147. package/lib/project-management/index.js +1 -1
  148. package/lib/project-management/ios-app.d.ts +1 -1
  149. package/lib/project-management/ios-app.js +1 -1
  150. package/lib/project-management/project-management-api-request-internal.d.ts +1 -1
  151. package/lib/project-management/project-management-api-request-internal.js +1 -1
  152. package/lib/project-management/project-management-namespace.d.ts +1 -1
  153. package/lib/project-management/project-management-namespace.js +1 -1
  154. package/lib/project-management/project-management.d.ts +1 -1
  155. package/lib/project-management/project-management.js +1 -1
  156. package/lib/remote-config/index.d.ts +1 -1
  157. package/lib/remote-config/index.js +1 -1
  158. package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
  159. package/lib/remote-config/remote-config-api-client-internal.js +1 -1
  160. package/lib/remote-config/remote-config-api.d.ts +1 -1
  161. package/lib/remote-config/remote-config-api.js +1 -1
  162. package/lib/remote-config/remote-config-namespace.d.ts +1 -1
  163. package/lib/remote-config/remote-config-namespace.js +1 -1
  164. package/lib/remote-config/remote-config.d.ts +1 -1
  165. package/lib/remote-config/remote-config.js +1 -1
  166. package/lib/security-rules/index.d.ts +1 -1
  167. package/lib/security-rules/index.js +1 -1
  168. package/lib/security-rules/security-rules-api-client-internal.d.ts +1 -1
  169. package/lib/security-rules/security-rules-api-client-internal.js +1 -1
  170. package/lib/security-rules/security-rules-internal.d.ts +1 -1
  171. package/lib/security-rules/security-rules-internal.js +1 -1
  172. package/lib/security-rules/security-rules-namespace.d.ts +1 -1
  173. package/lib/security-rules/security-rules-namespace.js +1 -1
  174. package/lib/security-rules/security-rules.d.ts +1 -1
  175. package/lib/security-rules/security-rules.js +1 -1
  176. package/lib/storage/index.d.ts +1 -1
  177. package/lib/storage/index.js +1 -1
  178. package/lib/storage/storage-namespace.d.ts +1 -1
  179. package/lib/storage/storage-namespace.js +1 -1
  180. package/lib/storage/storage.d.ts +1 -1
  181. package/lib/storage/storage.js +1 -1
  182. package/lib/utils/api-request.d.ts +1 -1
  183. package/lib/utils/api-request.js +1 -1
  184. package/lib/utils/crypto-signer.d.ts +1 -1
  185. package/lib/utils/crypto-signer.js +1 -1
  186. package/lib/utils/deep-copy.d.ts +1 -1
  187. package/lib/utils/deep-copy.js +1 -1
  188. package/lib/utils/error.d.ts +1 -1
  189. package/lib/utils/error.js +1 -1
  190. package/lib/utils/index.d.ts +1 -1
  191. package/lib/utils/index.js +1 -1
  192. package/lib/utils/jwt.d.ts +1 -1
  193. package/lib/utils/jwt.js +1 -1
  194. package/lib/utils/validator.d.ts +1 -1
  195. package/lib/utils/validator.js +1 -1
  196. package/package.json +4 -4
package/lib/app/core.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
package/lib/app/core.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
package/lib/app/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * Copyright 2018 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -18,6 +18,7 @@
18
18
  import { App } from '../app/index';
19
19
  import { UserImportOptions, UserImportRecord, UserImportResult } from './user-import-builder';
20
20
  import { TenantServerResponse, CreateTenantRequest, UpdateTenantRequest } from './tenant';
21
+ import { ProjectConfigServerResponse, UpdateProjectConfigRequest } from './project-config';
21
22
  /** List of reserved claims which cannot be provided when creating a custom token. */
22
23
  export declare const RESERVED_CLAIMS: string[];
23
24
  /** List of supported email action request types. */
@@ -56,12 +57,12 @@ export interface BatchDeleteAccountsResponse {
56
57
  errors?: BatchDeleteErrorInfo[];
57
58
  }
58
59
  /**
59
- * Utility for sending requests to Auth server that are Auth instance related. This includes user and
60
- * tenant management related APIs. This extends the BaseFirebaseAuthRequestHandler class and defines
60
+ * Utility for sending requests to Auth server that are Auth instance related. This includes user, tenant,
61
+ * and project config management related APIs. This extends the BaseFirebaseAuthRequestHandler class and defines
61
62
  * additional tenant management related APIs.
62
63
  */
63
64
  export declare class AuthRequestHandler extends AbstractAuthRequestHandler {
64
- protected readonly tenantMgmtResourceBuilder: AuthResourceUrlBuilder;
65
+ protected readonly authResourceUrlBuilder: AuthResourceUrlBuilder;
65
66
  /**
66
67
  * The FirebaseAuthRequestHandler constructor used to initialize an instance using a FirebaseApp.
67
68
  *
@@ -77,6 +78,16 @@ export declare class AuthRequestHandler extends AbstractAuthRequestHandler {
77
78
  * @returns A new project config resource URL builder instance.
78
79
  */
79
80
  protected newProjectConfigUrlBuilder(): AuthResourceUrlBuilder;
81
+ /**
82
+ * Get the current project's config
83
+ * @returns A promise that resolves with the project config information.
84
+ */
85
+ getProjectConfig(): Promise<ProjectConfigServerResponse>;
86
+ /**
87
+ * Update the current project's config.
88
+ * @returns A promise that resolves with the project config information.
89
+ */
90
+ updateProjectConfig(options: UpdateProjectConfigRequest): Promise<ProjectConfigServerResponse>;
80
91
  /**
81
92
  * Looks up a tenant by tenant ID.
82
93
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -28,6 +28,7 @@ const action_code_settings_builder_1 = require("./action-code-settings-builder")
28
28
  const tenant_1 = require("./tenant");
29
29
  const identifier_1 = require("./identifier");
30
30
  const auth_config_1 = require("./auth-config");
31
+ const project_config_1 = require("./project-config");
31
32
  /** Firebase Auth request header. */
32
33
  const FIREBASE_AUTH_HEADER = {
33
34
  'X-Client-Version': `Node/Admin/${utils.getSdkVersion()}`,
@@ -1649,6 +1650,22 @@ class AbstractAuthRequestHandler {
1649
1650
  }
1650
1651
  }
1651
1652
  exports.AbstractAuthRequestHandler = AbstractAuthRequestHandler;
1653
+ /** Instantiates the getConfig endpoint settings. */
1654
+ const GET_PROJECT_CONFIG = new api_request_1.ApiSettings('/config', 'GET')
1655
+ .setResponseValidator((response) => {
1656
+ // Response should always contain at least the config name.
1657
+ if (!validator.isNonEmptyString(response.name)) {
1658
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INTERNAL_ERROR, 'INTERNAL ASSERT FAILED: Unable to get project config');
1659
+ }
1660
+ });
1661
+ /** Instantiates the updateConfig endpoint settings. */
1662
+ const UPDATE_PROJECT_CONFIG = new api_request_1.ApiSettings('/config?updateMask={updateMask}', 'PATCH')
1663
+ .setResponseValidator((response) => {
1664
+ // Response should always contain at least the config name.
1665
+ if (!validator.isNonEmptyString(response.name)) {
1666
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INTERNAL_ERROR, 'INTERNAL ASSERT FAILED: Unable to update project config');
1667
+ }
1668
+ });
1652
1669
  /** Instantiates the getTenant endpoint settings. */
1653
1670
  const GET_TENANT = new api_request_1.ApiSettings('/tenants/{tenantId}', 'GET')
1654
1671
  // Set response validator.
@@ -1698,8 +1715,8 @@ const CREATE_TENANT = new api_request_1.ApiSettings('/tenants', 'POST')
1698
1715
  }
1699
1716
  });
1700
1717
  /**
1701
- * Utility for sending requests to Auth server that are Auth instance related. This includes user and
1702
- * tenant management related APIs. This extends the BaseFirebaseAuthRequestHandler class and defines
1718
+ * Utility for sending requests to Auth server that are Auth instance related. This includes user, tenant,
1719
+ * and project config management related APIs. This extends the BaseFirebaseAuthRequestHandler class and defines
1703
1720
  * additional tenant management related APIs.
1704
1721
  */
1705
1722
  class AuthRequestHandler extends AbstractAuthRequestHandler {
@@ -1711,7 +1728,7 @@ class AuthRequestHandler extends AbstractAuthRequestHandler {
1711
1728
  */
1712
1729
  constructor(app) {
1713
1730
  super(app);
1714
- this.tenantMgmtResourceBuilder = new AuthResourceUrlBuilder(app, 'v2');
1731
+ this.authResourceUrlBuilder = new AuthResourceUrlBuilder(app, 'v2');
1715
1732
  }
1716
1733
  /**
1717
1734
  * @returns A new Auth user management resource URL builder instance.
@@ -1725,6 +1742,33 @@ class AuthRequestHandler extends AbstractAuthRequestHandler {
1725
1742
  newProjectConfigUrlBuilder() {
1726
1743
  return new AuthResourceUrlBuilder(this.app, 'v2');
1727
1744
  }
1745
+ /**
1746
+ * Get the current project's config
1747
+ * @returns A promise that resolves with the project config information.
1748
+ */
1749
+ getProjectConfig() {
1750
+ return this.invokeRequestHandler(this.authResourceUrlBuilder, GET_PROJECT_CONFIG, {}, {})
1751
+ .then((response) => {
1752
+ return response;
1753
+ });
1754
+ }
1755
+ /**
1756
+ * Update the current project's config.
1757
+ * @returns A promise that resolves with the project config information.
1758
+ */
1759
+ updateProjectConfig(options) {
1760
+ try {
1761
+ const request = project_config_1.ProjectConfig.buildServerRequest(options);
1762
+ const updateMask = utils.generateUpdateMask(request);
1763
+ return this.invokeRequestHandler(this.authResourceUrlBuilder, UPDATE_PROJECT_CONFIG, request, { updateMask: updateMask.join(',') })
1764
+ .then((response) => {
1765
+ return response;
1766
+ });
1767
+ }
1768
+ catch (e) {
1769
+ return Promise.reject(e);
1770
+ }
1771
+ }
1728
1772
  /**
1729
1773
  * Looks up a tenant by tenant ID.
1730
1774
  *
@@ -1735,7 +1779,7 @@ class AuthRequestHandler extends AbstractAuthRequestHandler {
1735
1779
  if (!validator.isNonEmptyString(tenantId)) {
1736
1780
  return Promise.reject(new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_TENANT_ID));
1737
1781
  }
1738
- return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, GET_TENANT, {}, { tenantId })
1782
+ return this.invokeRequestHandler(this.authResourceUrlBuilder, GET_TENANT, {}, { tenantId })
1739
1783
  .then((response) => {
1740
1784
  return response;
1741
1785
  });
@@ -1762,7 +1806,7 @@ class AuthRequestHandler extends AbstractAuthRequestHandler {
1762
1806
  if (typeof request.pageToken === 'undefined') {
1763
1807
  delete request.pageToken;
1764
1808
  }
1765
- return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, LIST_TENANTS, request)
1809
+ return this.invokeRequestHandler(this.authResourceUrlBuilder, LIST_TENANTS, request)
1766
1810
  .then((response) => {
1767
1811
  if (!response.tenants) {
1768
1812
  response.tenants = [];
@@ -1781,7 +1825,7 @@ class AuthRequestHandler extends AbstractAuthRequestHandler {
1781
1825
  if (!validator.isNonEmptyString(tenantId)) {
1782
1826
  return Promise.reject(new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_TENANT_ID));
1783
1827
  }
1784
- return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, DELETE_TENANT, undefined, { tenantId })
1828
+ return this.invokeRequestHandler(this.authResourceUrlBuilder, DELETE_TENANT, undefined, { tenantId })
1785
1829
  .then(() => {
1786
1830
  // Return nothing.
1787
1831
  });
@@ -1796,7 +1840,7 @@ class AuthRequestHandler extends AbstractAuthRequestHandler {
1796
1840
  try {
1797
1841
  // Construct backend request.
1798
1842
  const request = tenant_1.Tenant.buildServerRequest(tenantOptions, true);
1799
- return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, CREATE_TENANT, request)
1843
+ return this.invokeRequestHandler(this.authResourceUrlBuilder, CREATE_TENANT, request)
1800
1844
  .then((response) => {
1801
1845
  return response;
1802
1846
  });
@@ -1822,7 +1866,7 @@ class AuthRequestHandler extends AbstractAuthRequestHandler {
1822
1866
  // Do not traverse deep into testPhoneNumbers. The entire content should be replaced
1823
1867
  // and not just specific phone numbers.
1824
1868
  const updateMask = utils.generateUpdateMask(request, ['testPhoneNumbers']);
1825
- return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, UPDATE_TENANT, request, { tenantId, updateMask: updateMask.join(',') })
1869
+ return this.invokeRequestHandler(this.authResourceUrlBuilder, UPDATE_TENANT, request, { tenantId, updateMask: updateMask.join(',') })
1826
1870
  .then((response) => {
1827
1871
  return response;
1828
1872
  });
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * Copyright 2018 Google Inc.
4
4
  *
@@ -572,4 +572,59 @@ export interface OIDCAuthProviderConfig extends BaseAuthProviderConfig {
572
572
  * {@link BaseAuth.createProviderConfig}.
573
573
  */
574
574
  export declare type AuthProviderConfig = SAMLAuthProviderConfig | OIDCAuthProviderConfig;
575
+ /**
576
+ * The request interface for updating a SMS Region Config.
577
+ * Configures the regions where users are allowed to send verification SMS.
578
+ * This is based on the calling code of the destination phone number.
579
+ */
580
+ export declare type SmsRegionConfig = AllowByDefaultWrap | AllowlistOnlyWrap;
581
+ /**
582
+ * Mutual exclusive SMS Region Config of AllowByDefault interface
583
+ */
584
+ export interface AllowByDefaultWrap {
585
+ /**
586
+ * Allow every region by default.
587
+ */
588
+ allowByDefault: AllowByDefault;
589
+ /** @alpha */
590
+ allowlistOnly?: never;
591
+ }
592
+ /**
593
+ * Mutually exclusive SMS Region Config of AllowlistOnly interface
594
+ */
595
+ export interface AllowlistOnlyWrap {
596
+ /**
597
+ * Only allowing regions by explicitly adding them to an
598
+ * allowlist.
599
+ */
600
+ allowlistOnly: AllowlistOnly;
601
+ /** @alpha */
602
+ allowByDefault?: never;
603
+ }
604
+ /**
605
+ * Defines a policy of allowing every region by default and adding disallowed
606
+ * regions to a disallow list.
607
+ */
608
+ export interface AllowByDefault {
609
+ /**
610
+ * Two letter unicode region codes to disallow as defined by
611
+ * https://cldr.unicode.org/
612
+ * The full list of these region codes is here:
613
+ * https://github.com/unicode-cldr/cldr-localenames-full/blob/master/main/en/territories.json
614
+ */
615
+ disallowedRegions: string[];
616
+ }
617
+ /**
618
+ * Defines a policy of only allowing regions by explicitly adding them to an
619
+ * allowlist.
620
+ */
621
+ export interface AllowlistOnly {
622
+ /**
623
+ * Two letter unicode region codes to allow as defined by
624
+ * https://cldr.unicode.org/
625
+ * The full list of these region codes is here:
626
+ * https://github.com/unicode-cldr/cldr-localenames-full/blob/master/main/en/territories.json
627
+ */
628
+ allowedRegions: string[];
629
+ }
575
630
  export {};
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.OIDCConfig = exports.SAMLConfig = exports.EmailSignInConfig = exports.validateTestPhoneNumbers = exports.MultiFactorAuthConfig = exports.MAXIMUM_TEST_PHONE_NUMBERS = void 0;
19
+ exports.SmsRegionsAuthConfig = exports.OIDCConfig = exports.SAMLConfig = exports.EmailSignInConfig = exports.validateTestPhoneNumbers = exports.MultiFactorAuthConfig = exports.MAXIMUM_TEST_PHONE_NUMBERS = void 0;
20
20
  const validator = require("../utils/validator");
21
21
  const deep_copy_1 = require("../utils/deep-copy");
22
22
  const error_1 = require("../utils/error");
@@ -632,3 +632,60 @@ class OIDCConfig {
632
632
  }
633
633
  }
634
634
  exports.OIDCConfig = OIDCConfig;
635
+ /**
636
+ * Defines the SMSRegionConfig class used for validation.
637
+ *
638
+ * @internal
639
+ */
640
+ class SmsRegionsAuthConfig {
641
+ static validate(options) {
642
+ if (!validator.isNonNullObject(options)) {
643
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"SmsRegionConfig" must be a non-null object.');
644
+ }
645
+ const validKeys = {
646
+ allowlistOnly: true,
647
+ allowByDefault: true,
648
+ };
649
+ for (const key in options) {
650
+ if (!(key in validKeys)) {
651
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, `"${key}" is not a valid SmsRegionConfig parameter.`);
652
+ }
653
+ }
654
+ // validate mutual exclusiveness of allowByDefault and allowlistOnly
655
+ if (typeof options.allowByDefault !== 'undefined' && typeof options.allowlistOnly !== 'undefined') {
656
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, 'SmsRegionConfig cannot have both "allowByDefault" and "allowlistOnly" parameters.');
657
+ }
658
+ // validation for allowByDefault type
659
+ if (typeof options.allowByDefault !== 'undefined') {
660
+ const allowByDefaultValidKeys = {
661
+ disallowedRegions: true,
662
+ };
663
+ for (const key in options.allowByDefault) {
664
+ if (!(key in allowByDefaultValidKeys)) {
665
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, `"${key}" is not a valid SmsRegionConfig.allowByDefault parameter.`);
666
+ }
667
+ }
668
+ // disallowedRegion can be empty.
669
+ if (typeof options.allowByDefault.disallowedRegions !== 'undefined'
670
+ && !validator.isArray(options.allowByDefault.disallowedRegions)) {
671
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"SmsRegionConfig.allowByDefault.disallowedRegions" must be a valid string array.');
672
+ }
673
+ }
674
+ if (typeof options.allowlistOnly !== 'undefined') {
675
+ const allowListOnlyValidKeys = {
676
+ allowedRegions: true,
677
+ };
678
+ for (const key in options.allowlistOnly) {
679
+ if (!(key in allowListOnlyValidKeys)) {
680
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, `"${key}" is not a valid SmsRegionConfig.allowlistOnly parameter.`);
681
+ }
682
+ }
683
+ // allowedRegions can be empty
684
+ if (typeof options.allowlistOnly.allowedRegions !== 'undefined'
685
+ && !validator.isArray(options.allowlistOnly.allowedRegions)) {
686
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"SmsRegionConfig.allowlistOnly.allowedRegions" must be a valid string array.');
687
+ }
688
+ }
689
+ }
690
+ }
691
+ exports.SmsRegionsAuthConfig = SmsRegionsAuthConfig;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -18,12 +18,14 @@
18
18
  import { App } from '../app/index';
19
19
  import { TenantManager } from './tenant-manager';
20
20
  import { BaseAuth } from './base-auth';
21
+ import { ProjectConfigManager } from './project-config-manager';
21
22
  /**
22
23
  * Auth service bound to the provided app.
23
24
  * An Auth instance can have multiple tenants.
24
25
  */
25
26
  export declare class Auth extends BaseAuth {
26
27
  private readonly tenantManager_;
28
+ private readonly projectConfigManager_;
27
29
  private readonly app_;
28
30
  /**
29
31
  * Returns the app associated with this Auth instance.
@@ -37,4 +39,10 @@ export declare class Auth extends BaseAuth {
37
39
  * @returns The tenant manager instance associated with the current project.
38
40
  */
39
41
  tenantManager(): TenantManager;
42
+ /**
43
+ * Returns the project config manager instance associated with the current project.
44
+ *
45
+ * @returns The project config manager instance associated with the current project.
46
+ */
47
+ projectConfigManager(): ProjectConfigManager;
40
48
  }
package/lib/auth/auth.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -21,6 +21,7 @@ exports.Auth = void 0;
21
21
  const auth_api_request_1 = require("./auth-api-request");
22
22
  const tenant_manager_1 = require("./tenant-manager");
23
23
  const base_auth_1 = require("./base-auth");
24
+ const project_config_manager_1 = require("./project-config-manager");
24
25
  /**
25
26
  * Auth service bound to the provided app.
26
27
  * An Auth instance can have multiple tenants.
@@ -35,6 +36,7 @@ class Auth extends base_auth_1.BaseAuth {
35
36
  super(app, new auth_api_request_1.AuthRequestHandler(app));
36
37
  this.app_ = app;
37
38
  this.tenantManager_ = new tenant_manager_1.TenantManager(app);
39
+ this.projectConfigManager_ = new project_config_manager_1.ProjectConfigManager(app);
38
40
  }
39
41
  /**
40
42
  * Returns the app associated with this Auth instance.
@@ -52,5 +54,13 @@ class Auth extends base_auth_1.BaseAuth {
52
54
  tenantManager() {
53
55
  return this.tenantManager_;
54
56
  }
57
+ /**
58
+ * Returns the project config manager instance associated with the current project.
59
+ *
60
+ * @returns The project config manager instance associated with the current project.
61
+ */
62
+ projectConfigManager() {
63
+ return this.projectConfigManager_;
64
+ }
55
65
  }
56
66
  exports.Auth = Auth;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.1.0 */
1
+ /*! firebase-admin v11.2.1 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *