firebase-admin 10.1.0 → 10.2.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 (193) 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 +3 -1
  6. package/lib/app/credential-internal.js +18 -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 +3 -3
  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 +2 -2
  29. package/lib/app-check/token-verifier.d.ts +1 -1
  30. package/lib/app-check/token-verifier.js +2 -2
  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 +1 -1
  34. package/lib/auth/auth-api-request.js +24 -4
  35. package/lib/auth/auth-config.d.ts +1 -1
  36. package/lib/auth/auth-config.js +1 -1
  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 +1 -1
  40. package/lib/auth/auth.js +1 -1
  41. package/lib/auth/base-auth.d.ts +26 -1
  42. package/lib/auth/base-auth.js +28 -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 +1 -1
  46. package/lib/auth/index.js +1 -1
  47. package/lib/auth/tenant-manager.d.ts +1 -1
  48. package/lib/auth/tenant-manager.js +1 -1
  49. package/lib/auth/tenant.d.ts +1 -1
  50. package/lib/auth/tenant.js +1 -1
  51. package/lib/auth/token-generator.d.ts +1 -1
  52. package/lib/auth/token-generator.js +1 -1
  53. package/lib/auth/token-verifier.d.ts +1 -1
  54. package/lib/auth/token-verifier.js +1 -1
  55. package/lib/auth/user-import-builder.d.ts +1 -1
  56. package/lib/auth/user-import-builder.js +1 -1
  57. package/lib/auth/user-record.d.ts +1 -1
  58. package/lib/auth/user-record.js +1 -1
  59. package/lib/credential/index.d.ts +1 -1
  60. package/lib/credential/index.js +1 -1
  61. package/lib/database/database-namespace.d.ts +1 -1
  62. package/lib/database/database-namespace.js +1 -1
  63. package/lib/database/database.d.ts +1 -1
  64. package/lib/database/database.js +1 -1
  65. package/lib/database/index.d.ts +1 -1
  66. package/lib/database/index.js +1 -1
  67. package/lib/default-namespace.d.ts +1 -1
  68. package/lib/default-namespace.js +1 -1
  69. package/lib/esm/eventarc/index.js +5 -0
  70. package/lib/esm/functions/index.js +5 -0
  71. package/lib/eventarc/cloudevent.d.ts +84 -0
  72. package/lib/eventarc/cloudevent.js +19 -0
  73. package/lib/eventarc/eventarc-client-internal.d.ts +18 -0
  74. package/lib/eventarc/eventarc-client-internal.js +205 -0
  75. package/lib/eventarc/eventarc-utils.d.ts +31 -0
  76. package/lib/eventarc/eventarc-utils.js +141 -0
  77. package/lib/eventarc/eventarc.d.ts +107 -0
  78. package/lib/eventarc/eventarc.js +139 -0
  79. package/lib/eventarc/index.d.ts +53 -0
  80. package/lib/eventarc/index.js +64 -0
  81. package/lib/firebase-namespace-api.d.ts +1 -1
  82. package/lib/firebase-namespace-api.js +1 -1
  83. package/lib/firestore/firestore-internal.d.ts +1 -1
  84. package/lib/firestore/firestore-internal.js +1 -1
  85. package/lib/firestore/firestore-namespace.d.ts +1 -1
  86. package/lib/firestore/firestore-namespace.js +1 -1
  87. package/lib/firestore/index.d.ts +1 -1
  88. package/lib/firestore/index.js +1 -1
  89. package/lib/functions/functions-api-client-internal.d.ts +32 -0
  90. package/lib/functions/functions-api-client-internal.js +279 -0
  91. package/lib/functions/functions-api.d.ts +67 -0
  92. package/lib/functions/functions-api.js +19 -0
  93. package/lib/functions/functions.d.ts +63 -0
  94. package/lib/functions/functions.js +99 -0
  95. package/lib/functions/index.d.ts +53 -0
  96. package/lib/functions/index.js +64 -0
  97. package/lib/index.d.ts +1 -1
  98. package/lib/index.js +1 -1
  99. package/lib/installations/index.d.ts +1 -1
  100. package/lib/installations/index.js +1 -1
  101. package/lib/installations/installations-namespace.d.ts +1 -1
  102. package/lib/installations/installations-namespace.js +1 -1
  103. package/lib/installations/installations-request-handler.d.ts +1 -1
  104. package/lib/installations/installations-request-handler.js +1 -1
  105. package/lib/installations/installations.d.ts +1 -1
  106. package/lib/installations/installations.js +1 -1
  107. package/lib/instance-id/index.d.ts +1 -1
  108. package/lib/instance-id/index.js +1 -1
  109. package/lib/instance-id/instance-id-namespace.d.ts +1 -1
  110. package/lib/instance-id/instance-id-namespace.js +1 -1
  111. package/lib/instance-id/instance-id.d.ts +1 -1
  112. package/lib/instance-id/instance-id.js +1 -1
  113. package/lib/machine-learning/index.d.ts +1 -1
  114. package/lib/machine-learning/index.js +1 -1
  115. package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
  116. package/lib/machine-learning/machine-learning-api-client.js +1 -1
  117. package/lib/machine-learning/machine-learning-namespace.d.ts +1 -1
  118. package/lib/machine-learning/machine-learning-namespace.js +1 -1
  119. package/lib/machine-learning/machine-learning-utils.d.ts +1 -1
  120. package/lib/machine-learning/machine-learning-utils.js +1 -1
  121. package/lib/machine-learning/machine-learning.d.ts +1 -1
  122. package/lib/machine-learning/machine-learning.js +1 -1
  123. package/lib/messaging/batch-request-internal.d.ts +1 -1
  124. package/lib/messaging/batch-request-internal.js +1 -1
  125. package/lib/messaging/index.d.ts +1 -1
  126. package/lib/messaging/index.js +1 -1
  127. package/lib/messaging/messaging-api-request-internal.d.ts +1 -1
  128. package/lib/messaging/messaging-api-request-internal.js +1 -1
  129. package/lib/messaging/messaging-api.d.ts +1 -1
  130. package/lib/messaging/messaging-api.js +1 -1
  131. package/lib/messaging/messaging-errors-internal.d.ts +1 -1
  132. package/lib/messaging/messaging-errors-internal.js +1 -1
  133. package/lib/messaging/messaging-internal.d.ts +1 -1
  134. package/lib/messaging/messaging-internal.js +1 -1
  135. package/lib/messaging/messaging-namespace.d.ts +1 -1
  136. package/lib/messaging/messaging-namespace.js +1 -1
  137. package/lib/messaging/messaging.d.ts +1 -1
  138. package/lib/messaging/messaging.js +1 -1
  139. package/lib/project-management/android-app.d.ts +1 -1
  140. package/lib/project-management/android-app.js +1 -1
  141. package/lib/project-management/app-metadata.d.ts +1 -1
  142. package/lib/project-management/app-metadata.js +1 -1
  143. package/lib/project-management/index.d.ts +1 -1
  144. package/lib/project-management/index.js +1 -1
  145. package/lib/project-management/ios-app.d.ts +1 -1
  146. package/lib/project-management/ios-app.js +1 -1
  147. package/lib/project-management/project-management-api-request-internal.d.ts +1 -1
  148. package/lib/project-management/project-management-api-request-internal.js +1 -1
  149. package/lib/project-management/project-management-namespace.d.ts +1 -1
  150. package/lib/project-management/project-management-namespace.js +1 -1
  151. package/lib/project-management/project-management.d.ts +1 -1
  152. package/lib/project-management/project-management.js +1 -1
  153. package/lib/remote-config/index.d.ts +1 -1
  154. package/lib/remote-config/index.js +1 -1
  155. package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
  156. package/lib/remote-config/remote-config-api-client-internal.js +1 -1
  157. package/lib/remote-config/remote-config-api.d.ts +1 -1
  158. package/lib/remote-config/remote-config-api.js +1 -1
  159. package/lib/remote-config/remote-config-namespace.d.ts +1 -1
  160. package/lib/remote-config/remote-config-namespace.js +1 -1
  161. package/lib/remote-config/remote-config.d.ts +1 -1
  162. package/lib/remote-config/remote-config.js +1 -1
  163. package/lib/security-rules/index.d.ts +1 -1
  164. package/lib/security-rules/index.js +1 -1
  165. package/lib/security-rules/security-rules-api-client-internal.d.ts +1 -1
  166. package/lib/security-rules/security-rules-api-client-internal.js +1 -1
  167. package/lib/security-rules/security-rules-internal.d.ts +1 -1
  168. package/lib/security-rules/security-rules-internal.js +1 -1
  169. package/lib/security-rules/security-rules-namespace.d.ts +1 -1
  170. package/lib/security-rules/security-rules-namespace.js +1 -1
  171. package/lib/security-rules/security-rules.d.ts +1 -1
  172. package/lib/security-rules/security-rules.js +1 -1
  173. package/lib/storage/index.d.ts +1 -1
  174. package/lib/storage/index.js +1 -1
  175. package/lib/storage/storage-namespace.d.ts +1 -1
  176. package/lib/storage/storage-namespace.js +1 -1
  177. package/lib/storage/storage.d.ts +1 -1
  178. package/lib/storage/storage.js +1 -1
  179. package/lib/utils/api-request.d.ts +1 -1
  180. package/lib/utils/api-request.js +1 -1
  181. package/lib/utils/crypto-signer.d.ts +1 -1
  182. package/lib/utils/crypto-signer.js +1 -1
  183. package/lib/utils/deep-copy.d.ts +1 -1
  184. package/lib/utils/deep-copy.js +1 -1
  185. package/lib/utils/error.d.ts +5 -1
  186. package/lib/utils/error.js +7 -1
  187. package/lib/utils/index.d.ts +43 -1
  188. package/lib/utils/index.js +72 -2
  189. package/lib/utils/jwt.d.ts +1 -1
  190. package/lib/utils/jwt.js +1 -1
  191. package/lib/utils/validator.d.ts +1 -1
  192. package/lib/utils/validator.js +1 -1
  193. package/package.json +22 -5
package/lib/app/core.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
package/lib/app/core.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2020 Google Inc.
@@ -51,9 +51,11 @@ export declare class ComputeEngineCredential implements Credential {
51
51
  private readonly httpClient;
52
52
  private readonly httpAgent?;
53
53
  private projectId?;
54
+ private accountId?;
54
55
  constructor(httpAgent?: Agent);
55
56
  getAccessToken(): Promise<GoogleOAuthAccessToken>;
56
57
  getProjectId(): Promise<string>;
58
+ getServiceAccountEmail(): Promise<string>;
57
59
  private buildRequest;
58
60
  }
59
61
  /**
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -31,6 +31,7 @@ var GOOGLE_AUTH_TOKEN_PATH = '/o/oauth2/token';
31
31
  var GOOGLE_METADATA_SERVICE_HOST = 'metadata.google.internal';
32
32
  var GOOGLE_METADATA_SERVICE_TOKEN_PATH = '/computeMetadata/v1/instance/service-accounts/default/token';
33
33
  var GOOGLE_METADATA_SERVICE_PROJECT_ID_PATH = '/computeMetadata/v1/project/project-id';
34
+ var GOOGLE_METADATA_SERVICE_ACCOUNT_ID_PATH = '/computeMetadata/v1/instance/service-accounts/default/email';
34
35
  var configDir = (function () {
35
36
  // Windows has a dedicated low-rights location for apps at ~/Application Data
36
37
  var sys = os.platform();
@@ -185,6 +186,22 @@ var ComputeEngineCredential = /** @class */ (function () {
185
186
  throw new error_1.FirebaseAppError(error_1.AppErrorCodes.INVALID_CREDENTIAL, "Failed to determine project ID: " + detail);
186
187
  });
187
188
  };
189
+ ComputeEngineCredential.prototype.getServiceAccountEmail = function () {
190
+ var _this = this;
191
+ if (this.accountId) {
192
+ return Promise.resolve(this.accountId);
193
+ }
194
+ var request = this.buildRequest(GOOGLE_METADATA_SERVICE_ACCOUNT_ID_PATH);
195
+ return this.httpClient.send(request)
196
+ .then(function (resp) {
197
+ _this.accountId = resp.text;
198
+ return _this.accountId;
199
+ })
200
+ .catch(function (err) {
201
+ var detail = (err instanceof api_request_1.HttpError) ? getDetailFromResponse(err.response) : err.message;
202
+ throw new error_1.FirebaseAppError(error_1.AppErrorCodes.INVALID_CREDENTIAL, "Failed to determine service account email: " + detail);
203
+ });
204
+ };
188
205
  ComputeEngineCredential.prototype.buildRequest = function (urlPath) {
189
206
  return {
190
207
  method: 'GET',
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
package/lib/app/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -36,7 +36,7 @@ var error_1 = require("../utils/error");
36
36
  var utils = require("../utils/index");
37
37
  var validator = require("../utils/validator");
38
38
  // App Check backend constants
39
- var FIREBASE_APP_CHECK_V1_API_URL_FORMAT = 'https://firebaseappcheck.googleapis.com/v1beta/projects/{projectId}/apps/{appId}:exchangeCustomToken';
39
+ var FIREBASE_APP_CHECK_V1_API_URL_FORMAT = 'https://firebaseappcheck.googleapis.com/v1/projects/{projectId}/apps/{appId}:exchangeCustomToken';
40
40
  var FIREBASE_APP_CHECK_CONFIG_HEADERS = {
41
41
  'X-Firebase-Client': "fire-admin-node/" + utils.getSdkVersion()
42
42
  };
@@ -135,7 +135,7 @@ var AppCheckApiClient = /** @class */ (function () {
135
135
  * @returns An AppCheckToken instance.
136
136
  */
137
137
  AppCheckApiClient.prototype.toAppCheckToken = function (resp) {
138
- var token = resp.data.attestationToken;
138
+ var token = resp.data.token;
139
139
  // `ttl` is a string with the suffix "s" preceded by the number of seconds,
140
140
  // with nanoseconds expressed as fractional seconds.
141
141
  var ttlMillis = this.stringToMilliseconds(resp.data.ttl);
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -37,7 +37,7 @@ var ONE_MINUTE_IN_SECONDS = 60;
37
37
  var ONE_MINUTE_IN_MILLIS = ONE_MINUTE_IN_SECONDS * 1000;
38
38
  var ONE_DAY_IN_MILLIS = 24 * 60 * 60 * 1000;
39
39
  // Audience to use for Firebase App Check Custom tokens
40
- var FIREBASE_APP_CHECK_AUDIENCE = 'https://firebaseappcheck.googleapis.com/google.firebase.appcheck.v1beta.TokenExchangeService';
40
+ var FIREBASE_APP_CHECK_AUDIENCE = 'https://firebaseappcheck.googleapis.com/google.firebase.appcheck.v1.TokenExchangeService';
41
41
  /**
42
42
  * Class for generating Firebase App Check tokens.
43
43
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -22,7 +22,7 @@ var util = require("../utils/index");
22
22
  var app_check_api_client_internal_1 = require("./app-check-api-client-internal");
23
23
  var jwt_1 = require("../utils/jwt");
24
24
  var APP_CHECK_ISSUER = 'https://firebaseappcheck.googleapis.com/';
25
- var JWKS_URL = 'https://firebaseappcheck.googleapis.com/v1beta/jwks';
25
+ var JWKS_URL = 'https://firebaseappcheck.googleapis.com/v1/jwks';
26
26
  /**
27
27
  * Class for verifying Firebase App Check tokens.
28
28
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2018 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -29,6 +29,17 @@ var __extends = (this && this.__extends) || (function () {
29
29
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
30
30
  };
31
31
  })();
32
+ var __assign = (this && this.__assign) || function () {
33
+ __assign = Object.assign || function(t) {
34
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
35
+ s = arguments[i];
36
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
37
+ t[p] = s[p];
38
+ }
39
+ return t;
40
+ };
41
+ return __assign.apply(this, arguments);
42
+ };
32
43
  Object.defineProperty(exports, "__esModule", { value: true });
33
44
  exports.useEmulator = exports.TenantAwareAuthRequestHandler = exports.AuthRequestHandler = exports.AbstractAuthRequestHandler = exports.FIREBASE_AUTH_SIGN_UP_NEW_USER = exports.FIREBASE_AUTH_SET_ACCOUNT_INFO = exports.FIREBASE_AUTH_BATCH_DELETE_ACCOUNTS = exports.FIREBASE_AUTH_DELETE_ACCOUNT = exports.FIREBASE_AUTH_GET_ACCOUNTS_INFO = exports.FIREBASE_AUTH_GET_ACCOUNT_INFO = exports.FIREBASE_AUTH_DOWNLOAD_ACCOUNT = exports.FIREBASE_AUTH_UPLOAD_ACCOUNT = exports.FIREBASE_AUTH_CREATE_SESSION_COOKIE = exports.EMAIL_ACTION_REQUEST_TYPES = exports.RESERVED_CLAIMS = void 0;
34
45
  var validator = require("../utils/validator");
@@ -54,7 +65,7 @@ exports.RESERVED_CLAIMS = [
54
65
  ];
55
66
  /** List of supported email action request types. */
56
67
  exports.EMAIL_ACTION_REQUEST_TYPES = [
57
- 'PASSWORD_RESET', 'VERIFY_EMAIL', 'EMAIL_SIGNIN',
68
+ 'PASSWORD_RESET', 'VERIFY_EMAIL', 'EMAIL_SIGNIN', 'VERIFY_AND_CHANGE_EMAIL',
58
69
  ];
59
70
  /** Maximum allowed number of characters in the custom claims payload. */
60
71
  var MAX_CLAIMS_PAYLOAD_SIZE = 1000;
@@ -686,6 +697,9 @@ var FIREBASE_AUTH_GET_OOB_CODE = new api_request_1.ApiSettings('/accounts:sendOo
686
697
  if (!validator.isEmail(request.email)) {
687
698
  throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_EMAIL);
688
699
  }
700
+ if (typeof request.newEmail !== 'undefined' && !validator.isEmail(request.newEmail)) {
701
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_NEW_EMAIL);
702
+ }
689
703
  if (exports.EMAIL_ACTION_REQUEST_TYPES.indexOf(request.requestType) === -1) {
690
704
  throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ARGUMENT, "\"" + request.requestType + "\" is not a supported email action request type.");
691
705
  }
@@ -1350,10 +1364,13 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
1350
1364
  * @param actionCodeSettings - The optional action code setings which defines whether
1351
1365
  * the link is to be handled by a mobile app and the additional state information to be passed in the
1352
1366
  * deep link, etc. Required when requestType == 'EMAIL_SIGNIN'
1367
+ * @param newEmail - The email address the account is being updated to.
1368
+ * Required only for VERIFY_AND_CHANGE_EMAIL requests.
1353
1369
  * @returns A promise that resolves with the email action link.
1354
1370
  */
1355
- AbstractAuthRequestHandler.prototype.getEmailActionLink = function (requestType, email, actionCodeSettings) {
1356
- var request = { requestType: requestType, email: email, returnOobLink: true };
1371
+ AbstractAuthRequestHandler.prototype.getEmailActionLink = function (requestType, email, actionCodeSettings, newEmail) {
1372
+ var request = __assign({ requestType: requestType,
1373
+ email: email, returnOobLink: true }, (typeof newEmail !== 'undefined') && { newEmail: newEmail });
1357
1374
  // ActionCodeSettings required for email link sign-in to determine the url where the sign-in will
1358
1375
  // be completed.
1359
1376
  if (typeof actionCodeSettings === 'undefined' && requestType === 'EMAIL_SIGNIN') {
@@ -1368,6 +1385,9 @@ var AbstractAuthRequestHandler = /** @class */ (function () {
1368
1385
  return Promise.reject(e);
1369
1386
  }
1370
1387
  }
1388
+ if (requestType === 'VERIFY_AND_CHANGE_EMAIL' && typeof newEmail === 'undefined') {
1389
+ return Promise.reject(new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ARGUMENT, "`newEmail` is required when `requestType` === 'VERIFY_AND_CHANGE_EMAIL'"));
1390
+ }
1371
1391
  return this.invokeRequestHandler(this.getAuthUrlBuilder(), FIREBASE_AUTH_GET_OOB_CODE, request)
1372
1392
  .then(function (response) {
1373
1393
  // Return the link.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2018 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
package/lib/auth/auth.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -479,6 +479,31 @@ export declare abstract class BaseAuth {
479
479
  * @returns A promise that resolves with the generated link.
480
480
  */
481
481
  generateEmailVerificationLink(email: string, actionCodeSettings?: ActionCodeSettings): Promise<string>;
482
+ /**
483
+ * Generates an out-of-band email action link to verify the user's ownership
484
+ * of the specified email. The {@link ActionCodeSettings} object provided
485
+ * as an argument to this method defines whether the link is to be handled by a
486
+ * mobile app or browser along with additional state information to be passed in
487
+ * the deep link, etc.
488
+ *
489
+ * @param email - The current email account.
490
+ * @param newEmail - The email address the account is being updated to.
491
+ * @param actionCodeSettings - The action
492
+ * code settings. If specified, the state/continue URL is set as the
493
+ * "continueUrl" parameter in the email verification link. The default email
494
+ * verification landing page will use this to display a link to go back to
495
+ * the app if it is installed.
496
+ * If the actionCodeSettings is not specified, no URL is appended to the
497
+ * action URL.
498
+ * The state URL provided must belong to a domain that is authorized
499
+ * in the console, or an error will be thrown.
500
+ * Mobile app redirects are only applicable if the developer configures
501
+ * and accepts the Firebase Dynamic Links terms of service.
502
+ * The Android package name and iOS bundle ID are respected only if they
503
+ * are configured in the same Firebase Auth project.
504
+ * @returns A promise that resolves with the generated link.
505
+ */
506
+ generateVerifyAndChangeEmailLink(email: string, newEmail: string, actionCodeSettings?: ActionCodeSettings): Promise<string>;
482
507
  /**
483
508
  * Generates the out of band email action link to verify the user's ownership
484
509
  * of the specified email. The {@link ActionCodeSettings} object provided
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -698,6 +698,33 @@ var BaseAuth = /** @class */ (function () {
698
698
  BaseAuth.prototype.generateEmailVerificationLink = function (email, actionCodeSettings) {
699
699
  return this.authRequestHandler.getEmailActionLink('VERIFY_EMAIL', email, actionCodeSettings);
700
700
  };
701
+ /**
702
+ * Generates an out-of-band email action link to verify the user's ownership
703
+ * of the specified email. The {@link ActionCodeSettings} object provided
704
+ * as an argument to this method defines whether the link is to be handled by a
705
+ * mobile app or browser along with additional state information to be passed in
706
+ * the deep link, etc.
707
+ *
708
+ * @param email - The current email account.
709
+ * @param newEmail - The email address the account is being updated to.
710
+ * @param actionCodeSettings - The action
711
+ * code settings. If specified, the state/continue URL is set as the
712
+ * "continueUrl" parameter in the email verification link. The default email
713
+ * verification landing page will use this to display a link to go back to
714
+ * the app if it is installed.
715
+ * If the actionCodeSettings is not specified, no URL is appended to the
716
+ * action URL.
717
+ * The state URL provided must belong to a domain that is authorized
718
+ * in the console, or an error will be thrown.
719
+ * Mobile app redirects are only applicable if the developer configures
720
+ * and accepts the Firebase Dynamic Links terms of service.
721
+ * The Android package name and iOS bundle ID are respected only if they
722
+ * are configured in the same Firebase Auth project.
723
+ * @returns A promise that resolves with the generated link.
724
+ */
725
+ BaseAuth.prototype.generateVerifyAndChangeEmailLink = function (email, newEmail, actionCodeSettings) {
726
+ return this.authRequestHandler.getEmailActionLink('VERIFY_AND_CHANGE_EMAIL', email, actionCodeSettings, newEmail);
727
+ };
701
728
  /**
702
729
  * Generates the out of band email action link to verify the user's ownership
703
730
  * of the specified email. The {@link ActionCodeSettings} object provided
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
package/lib/auth/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2019 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2019 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2019 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2019 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2018 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2018 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.1.0 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.