firebase-admin 12.6.0 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/README.md +1 -2
  2. package/lib/app/core.d.ts +1 -2
  3. package/lib/app/core.js +1 -1
  4. package/lib/app/credential-factory.d.ts +1 -2
  5. package/lib/app/credential-factory.js +5 -6
  6. package/lib/app/credential-internal.d.ts +37 -35
  7. package/lib/app/credential-internal.js +194 -294
  8. package/lib/app/credential.d.ts +1 -1
  9. package/lib/app/credential.js +1 -1
  10. package/lib/app/firebase-app.d.ts +1 -1
  11. package/lib/app/firebase-app.js +1 -1
  12. package/lib/app/firebase-namespace.d.ts +1 -1
  13. package/lib/app/firebase-namespace.js +1 -1
  14. package/lib/app/index.d.ts +1 -1
  15. package/lib/app/index.js +1 -1
  16. package/lib/app/lifecycle.d.ts +1 -1
  17. package/lib/app/lifecycle.js +6 -6
  18. package/lib/app-check/app-check-api-client-internal.d.ts +1 -1
  19. package/lib/app-check/app-check-api-client-internal.js +1 -1
  20. package/lib/app-check/app-check-api.d.ts +1 -1
  21. package/lib/app-check/app-check-api.js +1 -1
  22. package/lib/app-check/app-check-namespace.d.ts +1 -1
  23. package/lib/app-check/app-check-namespace.js +1 -1
  24. package/lib/app-check/app-check.d.ts +1 -1
  25. package/lib/app-check/app-check.js +1 -1
  26. package/lib/app-check/index.d.ts +1 -1
  27. package/lib/app-check/index.js +3 -3
  28. package/lib/app-check/token-generator.d.ts +1 -1
  29. package/lib/app-check/token-generator.js +3 -3
  30. package/lib/app-check/token-verifier.d.ts +1 -1
  31. package/lib/app-check/token-verifier.js +1 -1
  32. package/lib/auth/action-code-settings-builder.d.ts +1 -1
  33. package/lib/auth/action-code-settings-builder.js +1 -1
  34. package/lib/auth/auth-api-request.d.ts +1 -1
  35. package/lib/auth/auth-api-request.js +5 -5
  36. package/lib/auth/auth-config.d.ts +41 -17
  37. package/lib/auth/auth-config.js +114 -27
  38. package/lib/auth/auth-namespace.d.ts +1 -1
  39. package/lib/auth/auth-namespace.js +1 -1
  40. package/lib/auth/auth.d.ts +1 -1
  41. package/lib/auth/auth.js +1 -1
  42. package/lib/auth/base-auth.d.ts +1 -1
  43. package/lib/auth/base-auth.js +3 -3
  44. package/lib/auth/identifier.d.ts +1 -1
  45. package/lib/auth/identifier.js +5 -6
  46. package/lib/auth/index.d.ts +2 -2
  47. package/lib/auth/index.js +3 -3
  48. package/lib/auth/project-config-manager.d.ts +1 -1
  49. package/lib/auth/project-config-manager.js +1 -1
  50. package/lib/auth/project-config.d.ts +8 -8
  51. package/lib/auth/project-config.js +9 -9
  52. package/lib/auth/tenant-manager.d.ts +1 -1
  53. package/lib/auth/tenant-manager.js +1 -1
  54. package/lib/auth/tenant.d.ts +4 -4
  55. package/lib/auth/tenant.js +4 -4
  56. package/lib/auth/token-generator.d.ts +1 -2
  57. package/lib/auth/token-generator.js +3 -3
  58. package/lib/auth/token-verifier.d.ts +1 -1
  59. package/lib/auth/token-verifier.js +5 -5
  60. package/lib/auth/user-import-builder.d.ts +1 -2
  61. package/lib/auth/user-import-builder.js +3 -3
  62. package/lib/auth/user-record.d.ts +1 -1
  63. package/lib/auth/user-record.js +1 -1
  64. package/lib/credential/index.d.ts +1 -1
  65. package/lib/credential/index.js +1 -1
  66. package/lib/data-connect/data-connect-api-client-internal.d.ts +1 -1
  67. package/lib/data-connect/data-connect-api-client-internal.js +1 -1
  68. package/lib/data-connect/data-connect-api.d.ts +1 -1
  69. package/lib/data-connect/data-connect-api.js +1 -1
  70. package/lib/data-connect/data-connect.d.ts +1 -1
  71. package/lib/data-connect/data-connect.js +1 -1
  72. package/lib/data-connect/index.d.ts +1 -1
  73. package/lib/data-connect/index.js +3 -3
  74. package/lib/database/database-namespace.d.ts +1 -1
  75. package/lib/database/database-namespace.js +1 -1
  76. package/lib/database/database.d.ts +1 -2
  77. package/lib/database/database.js +1 -1
  78. package/lib/database/index.d.ts +1 -1
  79. package/lib/database/index.js +4 -4
  80. package/lib/default-namespace.d.ts +1 -1
  81. package/lib/default-namespace.js +1 -1
  82. package/lib/eventarc/cloudevent.d.ts +1 -1
  83. package/lib/eventarc/cloudevent.js +1 -1
  84. package/lib/eventarc/eventarc-client-internal.d.ts +1 -1
  85. package/lib/eventarc/eventarc-client-internal.js +1 -1
  86. package/lib/eventarc/eventarc-utils.d.ts +1 -1
  87. package/lib/eventarc/eventarc-utils.js +3 -3
  88. package/lib/eventarc/eventarc.d.ts +1 -1
  89. package/lib/eventarc/eventarc.js +1 -1
  90. package/lib/eventarc/index.d.ts +1 -1
  91. package/lib/eventarc/index.js +3 -3
  92. package/lib/extensions/extensions-api-client-internal.d.ts +1 -1
  93. package/lib/extensions/extensions-api-client-internal.js +1 -1
  94. package/lib/extensions/extensions-api.d.ts +1 -1
  95. package/lib/extensions/extensions-api.js +1 -1
  96. package/lib/extensions/extensions.d.ts +1 -1
  97. package/lib/extensions/extensions.js +1 -1
  98. package/lib/extensions/index.d.ts +1 -1
  99. package/lib/extensions/index.js +3 -3
  100. package/lib/firebase-namespace-api.d.ts +1 -1
  101. package/lib/firebase-namespace-api.js +1 -1
  102. package/lib/firestore/firestore-internal.d.ts +1 -1
  103. package/lib/firestore/firestore-internal.js +3 -3
  104. package/lib/firestore/firestore-namespace.d.ts +1 -1
  105. package/lib/firestore/firestore-namespace.js +1 -1
  106. package/lib/firestore/index.d.ts +1 -1
  107. package/lib/firestore/index.js +4 -4
  108. package/lib/functions/functions-api-client-internal.d.ts +1 -1
  109. package/lib/functions/functions-api-client-internal.js +7 -6
  110. package/lib/functions/functions-api.d.ts +1 -1
  111. package/lib/functions/functions-api.js +1 -1
  112. package/lib/functions/functions.d.ts +1 -1
  113. package/lib/functions/functions.js +1 -1
  114. package/lib/functions/index.d.ts +1 -1
  115. package/lib/functions/index.js +3 -3
  116. package/lib/index.d.ts +1 -1
  117. package/lib/index.js +1 -1
  118. package/lib/installations/index.d.ts +1 -1
  119. package/lib/installations/index.js +3 -3
  120. package/lib/installations/installations-namespace.d.ts +1 -1
  121. package/lib/installations/installations-namespace.js +1 -1
  122. package/lib/installations/installations-request-handler.d.ts +1 -1
  123. package/lib/installations/installations-request-handler.js +1 -1
  124. package/lib/installations/installations.d.ts +1 -1
  125. package/lib/installations/installations.js +1 -1
  126. package/lib/instance-id/index.d.ts +1 -1
  127. package/lib/instance-id/index.js +3 -3
  128. package/lib/instance-id/instance-id-namespace.d.ts +1 -1
  129. package/lib/instance-id/instance-id-namespace.js +1 -1
  130. package/lib/instance-id/instance-id.d.ts +1 -1
  131. package/lib/instance-id/instance-id.js +1 -1
  132. package/lib/machine-learning/index.d.ts +1 -1
  133. package/lib/machine-learning/index.js +3 -3
  134. package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
  135. package/lib/machine-learning/machine-learning-api-client.js +3 -3
  136. package/lib/machine-learning/machine-learning-namespace.d.ts +1 -1
  137. package/lib/machine-learning/machine-learning-namespace.js +1 -1
  138. package/lib/machine-learning/machine-learning-utils.d.ts +1 -1
  139. package/lib/machine-learning/machine-learning-utils.js +1 -1
  140. package/lib/machine-learning/machine-learning.d.ts +1 -1
  141. package/lib/machine-learning/machine-learning.js +1 -1
  142. package/lib/messaging/index.d.ts +2 -2
  143. package/lib/messaging/index.js +3 -3
  144. package/lib/messaging/messaging-api-request-internal.d.ts +2 -12
  145. package/lib/messaging/messaging-api-request-internal.js +4 -38
  146. package/lib/messaging/messaging-api.d.ts +8 -94
  147. package/lib/messaging/messaging-api.js +1 -1
  148. package/lib/messaging/messaging-errors-internal.d.ts +1 -1
  149. package/lib/messaging/messaging-errors-internal.js +3 -4
  150. package/lib/messaging/messaging-internal.d.ts +1 -1
  151. package/lib/messaging/messaging-internal.js +4 -3
  152. package/lib/messaging/messaging-namespace.d.ts +2 -22
  153. package/lib/messaging/messaging-namespace.js +1 -1
  154. package/lib/messaging/messaging.d.ts +3 -149
  155. package/lib/messaging/messaging.js +2 -539
  156. package/lib/project-management/android-app.d.ts +1 -1
  157. package/lib/project-management/android-app.js +1 -1
  158. package/lib/project-management/app-metadata.d.ts +1 -1
  159. package/lib/project-management/app-metadata.js +1 -1
  160. package/lib/project-management/index.d.ts +1 -1
  161. package/lib/project-management/index.js +3 -3
  162. package/lib/project-management/ios-app.d.ts +1 -1
  163. package/lib/project-management/ios-app.js +1 -1
  164. package/lib/project-management/project-management-api-request-internal.d.ts +1 -1
  165. package/lib/project-management/project-management-api-request-internal.js +3 -3
  166. package/lib/project-management/project-management-namespace.d.ts +1 -1
  167. package/lib/project-management/project-management-namespace.js +1 -1
  168. package/lib/project-management/project-management.d.ts +1 -1
  169. package/lib/project-management/project-management.js +1 -1
  170. package/lib/remote-config/condition-evaluator-internal.d.ts +1 -1
  171. package/lib/remote-config/condition-evaluator-internal.js +6 -14
  172. package/lib/remote-config/index.d.ts +1 -1
  173. package/lib/remote-config/index.js +3 -3
  174. package/lib/remote-config/internal/value-impl.d.ts +1 -1
  175. package/lib/remote-config/internal/value-impl.js +1 -1
  176. package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
  177. package/lib/remote-config/remote-config-api-client-internal.js +1 -1
  178. package/lib/remote-config/remote-config-api.d.ts +1 -1
  179. package/lib/remote-config/remote-config-api.js +1 -1
  180. package/lib/remote-config/remote-config-namespace.d.ts +1 -1
  181. package/lib/remote-config/remote-config-namespace.js +1 -1
  182. package/lib/remote-config/remote-config.d.ts +1 -1
  183. package/lib/remote-config/remote-config.js +1 -1
  184. package/lib/security-rules/index.d.ts +1 -1
  185. package/lib/security-rules/index.js +3 -3
  186. package/lib/security-rules/security-rules-api-client-internal.d.ts +1 -1
  187. package/lib/security-rules/security-rules-api-client-internal.js +1 -1
  188. package/lib/security-rules/security-rules-internal.d.ts +1 -1
  189. package/lib/security-rules/security-rules-internal.js +1 -1
  190. package/lib/security-rules/security-rules-namespace.d.ts +1 -1
  191. package/lib/security-rules/security-rules-namespace.js +1 -1
  192. package/lib/security-rules/security-rules.d.ts +1 -2
  193. package/lib/security-rules/security-rules.js +1 -1
  194. package/lib/storage/index.d.ts +1 -1
  195. package/lib/storage/index.js +4 -4
  196. package/lib/storage/storage-namespace.d.ts +1 -1
  197. package/lib/storage/storage-namespace.js +1 -1
  198. package/lib/storage/storage.d.ts +1 -1
  199. package/lib/storage/storage.js +1 -1
  200. package/lib/storage/utils.d.ts +1 -1
  201. package/lib/storage/utils.js +2 -3
  202. package/lib/utils/api-request.d.ts +1 -5
  203. package/lib/utils/api-request.js +23 -8
  204. package/lib/utils/crypto-signer.d.ts +1 -2
  205. package/lib/utils/crypto-signer.js +3 -3
  206. package/lib/utils/deep-copy.d.ts +1 -1
  207. package/lib/utils/deep-copy.js +3 -4
  208. package/lib/utils/error.d.ts +1 -1
  209. package/lib/utils/error.js +1 -1
  210. package/lib/utils/index.d.ts +2 -2
  211. package/lib/utils/index.js +19 -16
  212. package/lib/utils/jwt.d.ts +1 -2
  213. package/lib/utils/jwt.js +5 -5
  214. package/lib/utils/validator.d.ts +1 -2
  215. package/lib/utils/validator.js +20 -21
  216. package/package.json +14 -13
  217. package/CHANGELOG.md +0 -4
  218. package/lib/messaging/batch-request-internal.d.ts +0 -55
  219. package/lib/messaging/batch-request-internal.js +0 -127
package/README.md CHANGED
@@ -59,8 +59,7 @@ requests, code review feedback, and also pull requests.
59
59
 
60
60
  ## Supported Environments
61
61
 
62
- We support Node.js 14 and higher. However, Node.js 14 and 16 support is deprecated. We strongly encourage
63
- you to use Node.js 18 or higher as we will drop support for Node.js 14 and 16 in the next major version.
62
+ We support Node.js 18 and higher.
64
63
 
65
64
  Please also note that the Admin SDK should only
66
65
  be used in server-side/back-end environments controlled by the app developer.
package/lib/app/core.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.6.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -15,7 +15,6 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- /// <reference types="node" />
19
18
  import { Agent } from 'http';
20
19
  import { Credential } from './credential';
21
20
  /**
package/lib/app/core.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.6.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.6.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -15,7 +15,6 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- /// <reference types="node" />
19
18
  import { Agent } from 'http';
20
19
  import { Credential, ServiceAccount } from './credential';
21
20
  /**
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.6.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -17,7 +17,10 @@
17
17
  * limitations under the License.
18
18
  */
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.clearGlobalAppDefaultCred = exports.refreshToken = exports.cert = exports.applicationDefault = void 0;
20
+ exports.applicationDefault = applicationDefault;
21
+ exports.cert = cert;
22
+ exports.refreshToken = refreshToken;
23
+ exports.clearGlobalAppDefaultCred = clearGlobalAppDefaultCred;
21
24
  const credential_internal_1 = require("./credential-internal");
22
25
  let globalAppDefaultCred;
23
26
  const globalCertCreds = {};
@@ -56,7 +59,6 @@ function applicationDefault(httpAgent) {
56
59
  }
57
60
  return globalAppDefaultCred;
58
61
  }
59
- exports.applicationDefault = applicationDefault;
60
62
  /**
61
63
  * Returns a credential created from the provided service account that grants
62
64
  * admin access to Firebase services. This credential can be used in the call
@@ -104,7 +106,6 @@ function cert(serviceAccountPathOrObject, httpAgent) {
104
106
  }
105
107
  return globalCertCreds[stringifiedServiceAccount];
106
108
  }
107
- exports.cert = cert;
108
109
  /**
109
110
  * Returns a credential created from the provided refresh token that grants
110
111
  * admin access to Firebase services. This credential can be used in the call
@@ -140,11 +141,9 @@ function refreshToken(refreshTokenPathOrObject, httpAgent) {
140
141
  }
141
142
  return globalRefreshTokenCreds[stringifiedRefreshToken];
142
143
  }
143
- exports.refreshToken = refreshToken;
144
144
  /**
145
145
  * Clears the global ADC cache. Exported for testing.
146
146
  */
147
147
  function clearGlobalAppDefaultCred() {
148
148
  globalAppDefaultCred = undefined;
149
149
  }
150
- exports.clearGlobalAppDefaultCred = clearGlobalAppDefaultCred;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.6.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2020 Google Inc.
@@ -15,63 +15,65 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- /// <reference types="node" />
19
18
  import { Agent } from 'http';
20
19
  import { Credential, GoogleOAuthAccessToken } from './credential';
20
+ /**
21
+ * Implementation of ADC that uses google-auth-library-nodejs.
22
+ */
23
+ export declare class ApplicationDefaultCredential implements Credential {
24
+ private readonly googleAuth;
25
+ private authClient;
26
+ private projectId?;
27
+ private quotaProjectId?;
28
+ private accountId?;
29
+ constructor(httpAgent?: Agent);
30
+ getAccessToken(): Promise<GoogleOAuthAccessToken>;
31
+ getProjectId(): Promise<string>;
32
+ getQuotaProjectId(): string | undefined;
33
+ isComputeEngineCredential(): Promise<boolean>;
34
+ /**
35
+ * getIDToken returns a OIDC token from the compute metadata service
36
+ * that can be used to make authenticated calls to audience
37
+ * @param audience the URL the returned ID token will be used to call.
38
+ */
39
+ getIDToken(audience: string): Promise<string>;
40
+ getServiceAccountEmail(): Promise<string>;
41
+ }
21
42
  /**
22
43
  * Implementation of Credential that uses a service account.
23
44
  */
24
45
  export declare class ServiceAccountCredential implements Credential {
46
+ private readonly serviceAccountPathOrObject;
25
47
  private readonly httpAgent?;
26
48
  readonly implicit: boolean;
27
49
  readonly projectId: string;
28
50
  readonly privateKey: string;
29
51
  readonly clientEmail: string;
30
- private readonly httpClient;
52
+ private googleAuth;
53
+ private authClient;
31
54
  /**
32
55
  * Creates a new ServiceAccountCredential from the given parameters.
33
56
  *
34
57
  * @param serviceAccountPathOrObject - Service account json object or path to a service account json file.
35
58
  * @param httpAgent - Optional http.Agent to use when calling the remote token server.
36
- * @param implicit - An optinal boolean indicating whether this credential was implicitly discovered from the
59
+ * @param implicit - An optional boolean indicating whether this credential was implicitly discovered from the
37
60
  * environment, as opposed to being explicitly specified by the developer.
38
61
  *
39
62
  * @constructor
40
63
  */
41
64
  constructor(serviceAccountPathOrObject: string | object, httpAgent?: Agent | undefined, implicit?: boolean);
65
+ private getGoogleAuth;
42
66
  getAccessToken(): Promise<GoogleOAuthAccessToken>;
43
- private createAuthJwt_;
44
- }
45
- /**
46
- * Implementation of Credential that gets access tokens from the metadata service available
47
- * in the Google Cloud Platform. This authenticates the process as the default service account
48
- * of an App Engine instance or Google Compute Engine machine.
49
- */
50
- export declare class ComputeEngineCredential implements Credential {
51
- private readonly httpClient;
52
- private readonly httpAgent?;
53
- private projectId?;
54
- private accountId?;
55
- constructor(httpAgent?: Agent);
56
- getAccessToken(): Promise<GoogleOAuthAccessToken>;
57
- /**
58
- * getIDToken returns a OIDC token from the compute metadata service
59
- * that can be used to make authenticated calls to audience
60
- * @param audience the URL the returned ID token will be used to call.
61
- */
62
- getIDToken(audience: string): Promise<string>;
63
- getProjectId(): Promise<string>;
64
- getServiceAccountEmail(): Promise<string>;
65
- private buildRequest;
66
67
  }
67
68
  /**
68
69
  * Implementation of Credential that gets access tokens from refresh tokens.
69
70
  */
70
71
  export declare class RefreshTokenCredential implements Credential {
72
+ private readonly refreshTokenPathOrObject;
71
73
  private readonly httpAgent?;
72
74
  readonly implicit: boolean;
73
- private readonly refreshToken;
74
- private readonly httpClient;
75
+ private googleAuth;
76
+ private authClient;
75
77
  /**
76
78
  * Creates a new RefreshTokenCredential from the given parameters.
77
79
  *
@@ -84,16 +86,18 @@ export declare class RefreshTokenCredential implements Credential {
84
86
  * @constructor
85
87
  */
86
88
  constructor(refreshTokenPathOrObject: string | object, httpAgent?: Agent | undefined, implicit?: boolean);
89
+ private getGoogleAuth;
87
90
  getAccessToken(): Promise<GoogleOAuthAccessToken>;
88
91
  }
89
92
  /**
90
93
  * Implementation of Credential that uses impersonated service account.
91
94
  */
92
95
  export declare class ImpersonatedServiceAccountCredential implements Credential {
96
+ private readonly impersonatedServiceAccountPathOrObject;
93
97
  private readonly httpAgent?;
94
98
  readonly implicit: boolean;
95
- private readonly impersonatedServiceAccount;
96
- private readonly httpClient;
99
+ private googleAuth;
100
+ private authClient;
97
101
  /**
98
102
  * Creates a new ImpersonatedServiceAccountCredential from the given parameters.
99
103
  *
@@ -106,13 +110,11 @@ export declare class ImpersonatedServiceAccountCredential implements Credential
106
110
  * @constructor
107
111
  */
108
112
  constructor(impersonatedServiceAccountPathOrObject: string | object, httpAgent?: Agent | undefined, implicit?: boolean);
113
+ private getGoogleAuth;
109
114
  getAccessToken(): Promise<GoogleOAuthAccessToken>;
110
115
  }
111
116
  /**
112
- * Checks if the given credential was loaded via the application default credentials mechanism. This
113
- * includes all ComputeEngineCredential instances, and the ServiceAccountCredential and RefreshTokenCredential
114
- * instances that were loaded from well-known files or environment variables, rather than being explicitly
115
- * instantiated.
117
+ * Checks if the given credential was loaded via the application default credentials mechanism.
116
118
  *
117
119
  * @param credential - The credential instance to check.
118
120
  */