firebase-admin 9.100.0-alpha.0 → 10.0.2

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 (188) hide show
  1. package/README.md +7 -3
  2. package/lib/app/core.d.ts +15 -22
  3. package/lib/app/core.js +1 -1
  4. package/lib/app/credential-factory.d.ts +17 -33
  5. package/lib/app/credential-factory.js +17 -33
  6. package/lib/app/credential-internal.d.ts +10 -9
  7. package/lib/app/credential-internal.js +15 -13
  8. package/lib/app/credential.d.ts +3 -9
  9. package/lib/app/credential.js +1 -1
  10. package/lib/app/firebase-app.d.ts +6 -30
  11. package/lib/app/firebase-app.js +72 -216
  12. package/lib/app/firebase-namespace.d.ts +28 -34
  13. package/lib/app/firebase-namespace.js +119 -99
  14. package/lib/app/index.d.ts +6 -1
  15. package/lib/app/index.js +1 -1
  16. package/lib/app/lifecycle.d.ts +24 -3
  17. package/lib/app/lifecycle.js +119 -25
  18. package/lib/app-check/app-check-api-client-internal.d.ts +32 -0
  19. package/lib/app-check/app-check-api-client-internal.js +197 -0
  20. package/lib/app-check/app-check-api.d.ts +95 -0
  21. package/lib/app-check/app-check-api.js +19 -0
  22. package/lib/app-check/app-check-namespace.d.ts +65 -0
  23. package/lib/app-check/app-check-namespace.js +18 -0
  24. package/lib/app-check/app-check.d.ts +49 -0
  25. package/lib/app-check/app-check.js +82 -0
  26. package/lib/app-check/index.d.ts +53 -0
  27. package/lib/app-check/index.js +63 -0
  28. package/lib/app-check/token-generator.d.ts +25 -0
  29. package/lib/app-check/token-generator.js +159 -0
  30. package/lib/app-check/token-verifier.d.ts +17 -0
  31. package/lib/app-check/token-verifier.js +151 -0
  32. package/lib/auth/action-code-settings-builder.d.ts +1 -1
  33. package/lib/auth/action-code-settings-builder.js +2 -2
  34. package/lib/auth/auth-api-request.d.ts +28 -32
  35. package/lib/auth/auth-api-request.js +167 -125
  36. package/lib/auth/auth-config.d.ts +123 -21
  37. package/lib/auth/auth-config.js +85 -34
  38. package/lib/auth/auth-namespace.d.ts +157 -4
  39. package/lib/auth/auth-namespace.js +1 -1
  40. package/lib/auth/auth.d.ts +5 -3
  41. package/lib/auth/auth.js +6 -4
  42. package/lib/auth/base-auth.d.ts +134 -116
  43. package/lib/auth/base-auth.js +213 -143
  44. package/lib/auth/identifier.d.ts +5 -5
  45. package/lib/auth/identifier.js +1 -1
  46. package/lib/auth/index.d.ts +10 -5
  47. package/lib/auth/index.js +9 -4
  48. package/lib/auth/tenant-manager.d.ts +19 -19
  49. package/lib/auth/tenant-manager.js +21 -25
  50. package/lib/auth/tenant.d.ts +14 -5
  51. package/lib/auth/tenant.js +19 -11
  52. package/lib/auth/token-generator.d.ts +7 -108
  53. package/lib/auth/token-generator.js +52 -145
  54. package/lib/auth/token-verifier.d.ts +3 -4
  55. package/lib/auth/token-verifier.js +96 -145
  56. package/lib/auth/user-import-builder.d.ts +11 -11
  57. package/lib/auth/user-import-builder.js +9 -9
  58. package/lib/auth/user-record.d.ts +23 -15
  59. package/lib/auth/user-record.js +30 -20
  60. package/lib/credential/index.d.ts +18 -35
  61. package/lib/credential/index.js +17 -33
  62. package/lib/database/database-namespace.d.ts +39 -10
  63. package/lib/database/database-namespace.js +1 -1
  64. package/lib/database/database.d.ts +16 -6
  65. package/lib/database/database.js +61 -6
  66. package/lib/database/index.d.ts +19 -18
  67. package/lib/database/index.js +21 -23
  68. package/lib/default-namespace.d.ts +7 -1
  69. package/lib/default-namespace.js +4 -4
  70. package/lib/esm/app/index.js +10 -0
  71. package/lib/esm/app-check/index.js +4 -0
  72. package/lib/esm/auth/index.js +14 -0
  73. package/lib/esm/database/index.js +6 -0
  74. package/lib/esm/firestore/index.js +24 -0
  75. package/lib/esm/installations/index.js +4 -0
  76. package/lib/esm/instance-id/index.js +4 -0
  77. package/lib/esm/machine-learning/index.js +5 -0
  78. package/lib/esm/messaging/index.js +4 -0
  79. package/lib/esm/package.json +1 -0
  80. package/lib/esm/project-management/index.js +8 -0
  81. package/lib/esm/remote-config/index.js +4 -0
  82. package/lib/esm/security-rules/index.js +6 -0
  83. package/lib/esm/storage/index.js +4 -0
  84. package/lib/firebase-namespace-api.d.ts +12 -6
  85. package/lib/firebase-namespace-api.js +5 -1
  86. package/lib/firestore/firestore-internal.d.ts +2 -2
  87. package/lib/firestore/firestore-internal.js +2 -2
  88. package/lib/firestore/firestore-namespace.d.ts +6 -1
  89. package/lib/firestore/firestore-namespace.js +2 -1
  90. package/lib/firestore/index.d.ts +36 -4
  91. package/lib/firestore/index.js +29 -1
  92. package/lib/index.d.ts +1 -1
  93. package/lib/index.js +1 -1
  94. package/lib/installations/index.d.ts +52 -0
  95. package/lib/installations/index.js +62 -0
  96. package/lib/installations/installations-namespace.d.ts +55 -0
  97. package/lib/installations/installations-namespace.js +18 -0
  98. package/lib/{instance-id/instance-id-request-internal.d.ts → installations/installations-request-handler.d.ts} +8 -8
  99. package/lib/{instance-id/instance-id-request-internal.js → installations/installations-request-handler.js} +23 -23
  100. package/lib/installations/installations.d.ts +38 -0
  101. package/lib/installations/installations.js +63 -0
  102. package/lib/instance-id/index.d.ts +20 -9
  103. package/lib/instance-id/index.js +20 -9
  104. package/lib/instance-id/instance-id-namespace.d.ts +9 -8
  105. package/lib/instance-id/instance-id-namespace.js +1 -1
  106. package/lib/instance-id/instance-id.d.ts +8 -6
  107. package/lib/instance-id/instance-id.js +20 -11
  108. package/lib/machine-learning/index.d.ts +29 -27
  109. package/lib/machine-learning/index.js +29 -27
  110. package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
  111. package/lib/machine-learning/machine-learning-api-client.js +4 -4
  112. package/lib/machine-learning/machine-learning-namespace.d.ts +33 -8
  113. package/lib/machine-learning/machine-learning-namespace.js +1 -1
  114. package/lib/machine-learning/machine-learning-utils.d.ts +1 -1
  115. package/lib/machine-learning/machine-learning-utils.js +1 -1
  116. package/lib/machine-learning/machine-learning.d.ts +19 -19
  117. package/lib/machine-learning/machine-learning.js +20 -20
  118. package/lib/messaging/batch-request-internal.d.ts +3 -3
  119. package/lib/messaging/batch-request-internal.js +9 -9
  120. package/lib/messaging/index.d.ts +11 -9
  121. package/lib/messaging/index.js +11 -9
  122. package/lib/messaging/messaging-api-request-internal.d.ts +8 -8
  123. package/lib/messaging/messaging-api-request-internal.js +8 -8
  124. package/lib/messaging/messaging-api.d.ts +79 -75
  125. package/lib/messaging/messaging-api.js +1 -1
  126. package/lib/messaging/messaging-errors-internal.d.ts +5 -5
  127. package/lib/messaging/messaging-errors-internal.js +7 -7
  128. package/lib/messaging/messaging-internal.d.ts +1 -1
  129. package/lib/messaging/messaging-internal.js +6 -31
  130. package/lib/messaging/messaging-namespace.d.ts +105 -8
  131. package/lib/messaging/messaging-namespace.js +1 -1
  132. package/lib/messaging/messaging.d.ts +70 -86
  133. package/lib/messaging/messaging.js +76 -89
  134. package/lib/project-management/android-app.d.ts +11 -12
  135. package/lib/project-management/android-app.js +13 -14
  136. package/lib/project-management/app-metadata.d.ts +1 -1
  137. package/lib/project-management/app-metadata.js +1 -1
  138. package/lib/project-management/index.d.ts +11 -9
  139. package/lib/project-management/index.js +11 -9
  140. package/lib/project-management/ios-app.d.ts +6 -7
  141. package/lib/project-management/ios-app.js +6 -7
  142. package/lib/project-management/project-management-api-request-internal.d.ts +1 -80
  143. package/lib/project-management/project-management-api-request-internal.js +14 -14
  144. package/lib/project-management/project-management-namespace.d.ts +31 -9
  145. package/lib/project-management/project-management-namespace.js +1 -1
  146. package/lib/project-management/project-management.d.ts +18 -21
  147. package/lib/project-management/project-management.js +19 -22
  148. package/lib/remote-config/index.d.ts +12 -10
  149. package/lib/remote-config/index.js +11 -9
  150. package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
  151. package/lib/remote-config/remote-config-api-client-internal.js +2 -2
  152. package/lib/remote-config/remote-config-api.d.ts +12 -2
  153. package/lib/remote-config/remote-config-api.js +1 -1
  154. package/lib/remote-config/remote-config-namespace.d.ts +50 -9
  155. package/lib/remote-config/remote-config-namespace.js +1 -1
  156. package/lib/remote-config/remote-config.d.ts +19 -21
  157. package/lib/remote-config/remote-config.js +25 -25
  158. package/lib/security-rules/index.d.ts +12 -10
  159. package/lib/security-rules/index.js +12 -10
  160. package/lib/security-rules/security-rules-api-client-internal.d.ts +1 -1
  161. package/lib/security-rules/security-rules-api-client-internal.js +1 -1
  162. package/lib/security-rules/security-rules-internal.d.ts +1 -1
  163. package/lib/security-rules/security-rules-internal.js +1 -1
  164. package/lib/security-rules/security-rules-namespace.d.ts +43 -28
  165. package/lib/security-rules/security-rules-namespace.js +1 -1
  166. package/lib/security-rules/security-rules.d.ts +39 -42
  167. package/lib/security-rules/security-rules.js +38 -39
  168. package/lib/storage/index.d.ts +9 -7
  169. package/lib/storage/index.js +9 -7
  170. package/lib/storage/storage-namespace.d.ts +7 -6
  171. package/lib/storage/storage-namespace.js +1 -1
  172. package/lib/storage/storage.d.ts +3 -3
  173. package/lib/storage/storage.js +14 -4
  174. package/lib/utils/api-request.d.ts +24 -24
  175. package/lib/utils/api-request.js +25 -25
  176. package/lib/utils/crypto-signer.d.ts +128 -0
  177. package/lib/utils/crypto-signer.js +237 -0
  178. package/lib/utils/deep-copy.d.ts +6 -6
  179. package/lib/utils/deep-copy.js +6 -6
  180. package/lib/utils/error.d.ts +69 -36
  181. package/lib/utils/error.js +98 -43
  182. package/lib/utils/index.d.ts +30 -19
  183. package/lib/utils/index.js +47 -20
  184. package/lib/utils/jwt.d.ts +131 -0
  185. package/lib/utils/jwt.js +355 -0
  186. package/lib/utils/validator.d.ts +37 -37
  187. package/lib/utils/validator.js +37 -37
  188. package/package.json +126 -53
package/README.md CHANGED
@@ -36,13 +36,17 @@ $ npm install --save firebase-admin
36
36
  To use the module in your application, `require` it from any JavaScript file:
37
37
 
38
38
  ```js
39
- var admin = require("firebase-admin");
39
+ const { initializeApp } = require("firebase-admin/app");
40
+
41
+ initializeApp();
40
42
  ```
41
43
 
42
44
  If you are using ES2015, you can `import` the module instead:
43
45
 
44
46
  ```js
45
- import * as admin from "firebase-admin";
47
+ import { initializeApp } from "firebase-admin/app";
48
+
49
+ initializeApp();
46
50
  ```
47
51
 
48
52
 
@@ -55,7 +59,7 @@ requests, code review feedback, and also pull requests.
55
59
 
56
60
  ## Supported Environments
57
61
 
58
- We support Node.js 10.10.0 and higher.
62
+ We support Node.js 12 and higher.
59
63
 
60
64
  Please also note that the Admin SDK should only
61
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 v9.100.0-alpha.0 */
1
+ /*! firebase-admin v10.0.2 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -19,19 +19,19 @@
19
19
  import { Agent } from 'http';
20
20
  import { Credential } from './credential';
21
21
  /**
22
- * Available options to pass to [`initializeApp()`](admin#.initializeApp).
22
+ * Available options to pass to {@link firebase-admin.app#initializeApp}.
23
23
  */
24
24
  export interface AppOptions {
25
25
  /**
26
- * A {@link Credential `Credential`} object used to
26
+ * A {@link firebase-admin.app#Credential} object used to
27
27
  * authenticate the Admin SDK.
28
28
  *
29
- * See [Initialize the SDK](/docs/admin/setup#initialize_the_sdk) for detailed
30
- * documentation and code samples.
29
+ * See {@link https://firebase.google.com/docs/admin/setup#initialize_the_sdk | Initialize the SDK}
30
+ * for detailed documentation and code samples.
31
31
  */
32
32
  credential?: Credential;
33
33
  /**
34
- * The object to use as the [`auth`](/docs/reference/security/database/#auth)
34
+ * The object to use as the {@link https://firebase.google.com/docs/reference/security/database/#auth | auth}
35
35
  * variable in your Realtime Database Rules when the Admin SDK reads from or
36
36
  * writes to the Realtime Database. This allows you to downscope the Admin SDK
37
37
  * from its default full read and write privileges.
@@ -39,7 +39,8 @@ export interface AppOptions {
39
39
  * You can pass `null` to act as an unauthenticated client.
40
40
  *
41
41
  * See
42
- * [Authenticate with limited privileges](/docs/database/admin/start#authenticate-with-limited-privileges)
42
+ * {@link https://firebase.google.com/docs/database/admin/start#authenticate-with-limited-privileges |
43
+ * Authenticate with limited privileges}
43
44
  * for detailed documentation and code samples.
44
45
  */
45
46
  databaseAuthVariableOverride?: object | null;
@@ -63,7 +64,7 @@ export interface AppOptions {
63
64
  */
64
65
  projectId?: string;
65
66
  /**
66
- * An [HTTP Agent](https://nodejs.org/api/http.html#http_class_http_agent)
67
+ * An {@link https://nodejs.org/api/http.html#http_class_http_agent | HTTP Agent}
67
68
  * to be used when making outgoing HTTP calls. This Agent instance is used
68
69
  * by all services that make REST calls (e.g. `auth`, `messaging`,
69
70
  * `projectManagement`).
@@ -78,12 +79,6 @@ export interface AppOptions {
78
79
  /**
79
80
  * A Firebase app holds the initialization information for a collection of
80
81
  * services.
81
- *
82
- * Do not call this constructor directly. Instead, use
83
- * {@link
84
- * https://firebase.google.com/docs/reference/admin/node/admin#.initializeApp
85
- * `admin.initializeApp()`}
86
- * to create an app.
87
82
  */
88
83
  export interface App {
89
84
  /**
@@ -108,10 +103,7 @@ export interface App {
108
103
  name: string;
109
104
  /**
110
105
  * The (read-only) configuration options for this app. These are the original
111
- * parameters given in
112
- * {@link
113
- * https://firebase.google.com/docs/reference/admin/node/admin#.initializeApp
114
- * `admin.initializeApp()`}.
106
+ * parameters given in {@link firebase-admin.app#initializeApp}.
115
107
  *
116
108
  * @example
117
109
  * ```javascript
@@ -148,13 +140,14 @@ export interface FirebaseError {
148
140
  * A string value containing the execution backtrace when the error originally
149
141
  * occurred.
150
142
  *
151
- * This information can be useful to you and can be sent to
152
- * {@link https://firebase.google.com/support/ Firebase Support} to help
153
- * explain the cause of an error.
143
+ * This information can be useful for troubleshooting the cause of the error with
144
+ * {@link https://firebase.google.com/support | Firebase Support}.
154
145
  */
155
146
  stack?: string;
156
147
  /**
157
- * @return A JSON-serializable representation of this object.
148
+ * Returns a JSON-serializable object representation of this error.
149
+ *
150
+ * @returns A JSON-serializable representation of this object.
158
151
  */
159
152
  toJSON(): object;
160
153
  }
package/lib/app/core.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.100.0-alpha.0 */
1
+ /*! firebase-admin v10.0.2 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.100.0-alpha.0 */
1
+ /*! firebase-admin v10.0.2 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -20,22 +20,16 @@ import { Agent } from 'http';
20
20
  import { Credential, ServiceAccount } from './credential';
21
21
  /**
22
22
  * Returns a credential created from the
23
- * {@link
24
- * https://developers.google.com/identity/protocols/application-default-credentials
25
- * Google Application Default Credentials}
23
+ * {@link https://developers.google.com/identity/protocols/application-default-credentials |
24
+ * Google Application Default Credentials}
26
25
  * that grants admin access to Firebase services. This credential can be used
27
- * in the call to
28
- * {@link
29
- * https://firebase.google.com/docs/reference/admin/node/admin#.initializeApp
30
- * `admin.initializeApp()`}.
26
+ * in the call to {@link firebase-admin.app#initializeApp}.
31
27
  *
32
28
  * Google Application Default Credentials are available on any Google
33
29
  * infrastructure, such as Google App Engine and Google Compute Engine.
34
30
  *
35
31
  * See
36
- * {@link
37
- * https://firebase.google.com/docs/admin/setup#initialize_the_sdk
38
- * Initialize the SDK}
32
+ * {@link https://firebase.google.com/docs/admin/setup#initialize_the_sdk | Initialize the SDK}
39
33
  * for more details.
40
34
  *
41
35
  * @example
@@ -46,25 +40,20 @@ import { Credential, ServiceAccount } from './credential';
46
40
  * });
47
41
  * ```
48
42
  *
49
- * @param httpAgent Optional [HTTP Agent](https://nodejs.org/api/http.html#http_class_http_agent)
43
+ * @param httpAgent - Optional {@link https://nodejs.org/api/http.html#http_class_http_agent | HTTP Agent}
50
44
  * to be used when retrieving access tokens from Google token servers.
51
45
  *
52
- * @return A credential authenticated via Google
46
+ * @returns A credential authenticated via Google
53
47
  * Application Default Credentials that can be used to initialize an app.
54
48
  */
55
49
  export declare function applicationDefault(httpAgent?: Agent): Credential;
56
50
  /**
57
51
  * Returns a credential created from the provided service account that grants
58
52
  * admin access to Firebase services. This credential can be used in the call
59
- * to
60
- * {@link
61
- * https://firebase.google.com/docs/reference/admin/node/admin#.initializeApp
62
- * `admin.initializeApp()`}.
53
+ * to {@link firebase-admin.app#initializeApp}.
63
54
  *
64
55
  * See
65
- * {@link
66
- * https://firebase.google.com/docs/admin/setup#initialize_the_sdk
67
- * Initialize the SDK}
56
+ * {@link https://firebase.google.com/docs/admin/setup#initialize_the_sdk | Initialize the SDK}
68
57
  * for more details.
69
58
  *
70
59
  * @example
@@ -90,27 +79,22 @@ export declare function applicationDefault(httpAgent?: Agent): Credential;
90
79
  * });
91
80
  * ```
92
81
  *
93
- * @param serviceAccountPathOrObject The path to a service
82
+ * @param serviceAccountPathOrObject - The path to a service
94
83
  * account key JSON file or an object representing a service account key.
95
- * @param httpAgent Optional [HTTP Agent](https://nodejs.org/api/http.html#http_class_http_agent)
84
+ * @param httpAgent - Optional {@link https://nodejs.org/api/http.html#http_class_http_agent | HTTP Agent}
96
85
  * to be used when retrieving access tokens from Google token servers.
97
86
  *
98
- * @return A credential authenticated via the
87
+ * @returns A credential authenticated via the
99
88
  * provided service account that can be used to initialize an app.
100
89
  */
101
90
  export declare function cert(serviceAccountPathOrObject: string | ServiceAccount, httpAgent?: Agent): Credential;
102
91
  /**
103
92
  * Returns a credential created from the provided refresh token that grants
104
93
  * admin access to Firebase services. This credential can be used in the call
105
- * to
106
- * {@link
107
- * https://firebase.google.com/docs/reference/admin/node/admin#.initializeApp
108
- * `admin.initializeApp()`}.
94
+ * to {@link firebase-admin.app#initializeApp}.
109
95
  *
110
96
  * See
111
- * {@link
112
- * https://firebase.google.com/docs/admin/setup#initialize_the_sdk
113
- * Initialize the SDK}
97
+ * {@link https://firebase.google.com/docs/admin/setup#initialize_the_sdk | Initialize the SDK}
114
98
  * for more details.
115
99
  *
116
100
  * @example
@@ -123,13 +107,13 @@ export declare function cert(serviceAccountPathOrObject: string | ServiceAccount
123
107
  * });
124
108
  * ```
125
109
  *
126
- * @param refreshTokenPathOrObject The path to a Google
110
+ * @param refreshTokenPathOrObject - The path to a Google
127
111
  * OAuth2 refresh token JSON file or an object representing a Google OAuth2
128
112
  * refresh token.
129
- * @param httpAgent Optional [HTTP Agent](https://nodejs.org/api/http.html#http_class_http_agent)
113
+ * @param httpAgent - Optional {@link https://nodejs.org/api/http.html#http_class_http_agent | HTTP Agent}
130
114
  * to be used when retrieving access tokens from Google token servers.
131
115
  *
132
- * @return A credential authenticated via the
116
+ * @returns A credential authenticated via the
133
117
  * provided service account that can be used to initialize an app.
134
118
  */
135
119
  export declare function refreshToken(refreshTokenPathOrObject: string | object, httpAgent?: Agent): Credential;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.100.0-alpha.0 */
1
+ /*! firebase-admin v10.0.2 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -24,22 +24,16 @@ var globalCertCreds = {};
24
24
  var globalRefreshTokenCreds = {};
25
25
  /**
26
26
  * Returns a credential created from the
27
- * {@link
28
- * https://developers.google.com/identity/protocols/application-default-credentials
29
- * Google Application Default Credentials}
27
+ * {@link https://developers.google.com/identity/protocols/application-default-credentials |
28
+ * Google Application Default Credentials}
30
29
  * that grants admin access to Firebase services. This credential can be used
31
- * in the call to
32
- * {@link
33
- * https://firebase.google.com/docs/reference/admin/node/admin#.initializeApp
34
- * `admin.initializeApp()`}.
30
+ * in the call to {@link firebase-admin.app#initializeApp}.
35
31
  *
36
32
  * Google Application Default Credentials are available on any Google
37
33
  * infrastructure, such as Google App Engine and Google Compute Engine.
38
34
  *
39
35
  * See
40
- * {@link
41
- * https://firebase.google.com/docs/admin/setup#initialize_the_sdk
42
- * Initialize the SDK}
36
+ * {@link https://firebase.google.com/docs/admin/setup#initialize_the_sdk | Initialize the SDK}
43
37
  * for more details.
44
38
  *
45
39
  * @example
@@ -50,10 +44,10 @@ var globalRefreshTokenCreds = {};
50
44
  * });
51
45
  * ```
52
46
  *
53
- * @param httpAgent Optional [HTTP Agent](https://nodejs.org/api/http.html#http_class_http_agent)
47
+ * @param httpAgent - Optional {@link https://nodejs.org/api/http.html#http_class_http_agent | HTTP Agent}
54
48
  * to be used when retrieving access tokens from Google token servers.
55
49
  *
56
- * @return A credential authenticated via Google
50
+ * @returns A credential authenticated via Google
57
51
  * Application Default Credentials that can be used to initialize an app.
58
52
  */
59
53
  function applicationDefault(httpAgent) {
@@ -66,15 +60,10 @@ exports.applicationDefault = applicationDefault;
66
60
  /**
67
61
  * Returns a credential created from the provided service account that grants
68
62
  * admin access to Firebase services. This credential can be used in the call
69
- * to
70
- * {@link
71
- * https://firebase.google.com/docs/reference/admin/node/admin#.initializeApp
72
- * `admin.initializeApp()`}.
63
+ * to {@link firebase-admin.app#initializeApp}.
73
64
  *
74
65
  * See
75
- * {@link
76
- * https://firebase.google.com/docs/admin/setup#initialize_the_sdk
77
- * Initialize the SDK}
66
+ * {@link https://firebase.google.com/docs/admin/setup#initialize_the_sdk | Initialize the SDK}
78
67
  * for more details.
79
68
  *
80
69
  * @example
@@ -100,12 +89,12 @@ exports.applicationDefault = applicationDefault;
100
89
  * });
101
90
  * ```
102
91
  *
103
- * @param serviceAccountPathOrObject The path to a service
92
+ * @param serviceAccountPathOrObject - The path to a service
104
93
  * account key JSON file or an object representing a service account key.
105
- * @param httpAgent Optional [HTTP Agent](https://nodejs.org/api/http.html#http_class_http_agent)
94
+ * @param httpAgent - Optional {@link https://nodejs.org/api/http.html#http_class_http_agent | HTTP Agent}
106
95
  * to be used when retrieving access tokens from Google token servers.
107
96
  *
108
- * @return A credential authenticated via the
97
+ * @returns A credential authenticated via the
109
98
  * provided service account that can be used to initialize an app.
110
99
  */
111
100
  function cert(serviceAccountPathOrObject, httpAgent) {
@@ -119,15 +108,10 @@ exports.cert = cert;
119
108
  /**
120
109
  * Returns a credential created from the provided refresh token that grants
121
110
  * admin access to Firebase services. This credential can be used in the call
122
- * to
123
- * {@link
124
- * https://firebase.google.com/docs/reference/admin/node/admin#.initializeApp
125
- * `admin.initializeApp()`}.
111
+ * to {@link firebase-admin.app#initializeApp}.
126
112
  *
127
113
  * See
128
- * {@link
129
- * https://firebase.google.com/docs/admin/setup#initialize_the_sdk
130
- * Initialize the SDK}
114
+ * {@link https://firebase.google.com/docs/admin/setup#initialize_the_sdk | Initialize the SDK}
131
115
  * for more details.
132
116
  *
133
117
  * @example
@@ -140,13 +124,13 @@ exports.cert = cert;
140
124
  * });
141
125
  * ```
142
126
  *
143
- * @param refreshTokenPathOrObject The path to a Google
127
+ * @param refreshTokenPathOrObject - The path to a Google
144
128
  * OAuth2 refresh token JSON file or an object representing a Google OAuth2
145
129
  * refresh token.
146
- * @param httpAgent Optional [HTTP Agent](https://nodejs.org/api/http.html#http_class_http_agent)
130
+ * @param httpAgent - Optional {@link https://nodejs.org/api/http.html#http_class_http_agent | HTTP Agent}
147
131
  * to be used when retrieving access tokens from Google token servers.
148
132
  *
149
- * @return A credential authenticated via the
133
+ * @returns A credential authenticated via the
150
134
  * provided service account that can be used to initialize an app.
151
135
  */
152
136
  function refreshToken(refreshTokenPathOrObject, httpAgent) {
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.100.0-alpha.0 */
1
+ /*! firebase-admin v10.0.2 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2020 Google Inc.
@@ -31,9 +31,9 @@ export declare class ServiceAccountCredential implements Credential {
31
31
  /**
32
32
  * Creates a new ServiceAccountCredential from the given parameters.
33
33
  *
34
- * @param serviceAccountPathOrObject Service account json object or path to a service account json file.
35
- * @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
34
+ * @param serviceAccountPathOrObject - Service account json object or path to a service account json file.
35
+ * @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
37
37
  * environment, as opposed to being explicitly specified by the developer.
38
38
  *
39
39
  * @constructor
@@ -67,10 +67,11 @@ export declare class RefreshTokenCredential implements Credential {
67
67
  /**
68
68
  * Creates a new RefreshTokenCredential from the given parameters.
69
69
  *
70
- * @param refreshTokenPathOrObject Refresh token json object or path to a refresh token (user credentials) json file.
71
- * @param httpAgent Optional http.Agent to use when calling the remote token server.
72
- * @param implicit An optinal boolean indicating whether this credential was implicitly discovered from the
73
- * environment, as opposed to being explicitly specified by the developer.
70
+ * @param refreshTokenPathOrObject - Refresh token json object or path to a refresh token
71
+ * (user credentials) json file.
72
+ * @param httpAgent - Optional http.Agent to use when calling the remote token server.
73
+ * @param implicit - An optinal boolean indicating whether this credential was implicitly
74
+ * discovered from the environment, as opposed to being explicitly specified by the developer.
74
75
  *
75
76
  * @constructor
76
77
  */
@@ -83,7 +84,7 @@ export declare class RefreshTokenCredential implements Credential {
83
84
  * instances that were loaded from well-known files or environment variables, rather than being explicitly
84
85
  * instantiated.
85
86
  *
86
- * @param credential The credential instance to check.
87
+ * @param credential - The credential instance to check.
87
88
  */
88
89
  export declare function isApplicationDefault(credential?: Credential): boolean;
89
90
  export declare function getApplicationDefault(httpAgent?: Agent): Credential;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.100.0-alpha.0 */
1
+ /*! firebase-admin v10.0.2 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -53,9 +53,9 @@ var ServiceAccountCredential = /** @class */ (function () {
53
53
  /**
54
54
  * Creates a new ServiceAccountCredential from the given parameters.
55
55
  *
56
- * @param serviceAccountPathOrObject Service account json object or path to a service account json file.
57
- * @param httpAgent Optional http.Agent to use when calling the remote token server.
58
- * @param implicit An optinal boolean indicating whether this credential was implicitly discovered from the
56
+ * @param serviceAccountPathOrObject - Service account json object or path to a service account json file.
57
+ * @param httpAgent - Optional http.Agent to use when calling the remote token server.
58
+ * @param implicit - An optinal boolean indicating whether this credential was implicitly discovered from the
59
59
  * environment, as opposed to being explicitly specified by the developer.
60
60
  *
61
61
  * @constructor
@@ -87,6 +87,7 @@ var ServiceAccountCredential = /** @class */ (function () {
87
87
  };
88
88
  return requestAccessToken(this.httpClient, request);
89
89
  };
90
+ // eslint-disable-next-line @typescript-eslint/naming-convention
90
91
  ServiceAccountCredential.prototype.createAuthJwt_ = function () {
91
92
  var claims = {
92
93
  scope: [
@@ -204,10 +205,11 @@ var RefreshTokenCredential = /** @class */ (function () {
204
205
  /**
205
206
  * Creates a new RefreshTokenCredential from the given parameters.
206
207
  *
207
- * @param refreshTokenPathOrObject Refresh token json object or path to a refresh token (user credentials) json file.
208
- * @param httpAgent Optional http.Agent to use when calling the remote token server.
209
- * @param implicit An optinal boolean indicating whether this credential was implicitly discovered from the
210
- * environment, as opposed to being explicitly specified by the developer.
208
+ * @param refreshTokenPathOrObject - Refresh token json object or path to a refresh token
209
+ * (user credentials) json file.
210
+ * @param httpAgent - Optional http.Agent to use when calling the remote token server.
211
+ * @param implicit - An optinal boolean indicating whether this credential was implicitly
212
+ * discovered from the environment, as opposed to being explicitly specified by the developer.
211
213
  *
212
214
  * @constructor
213
215
  */
@@ -283,7 +285,7 @@ var RefreshToken = /** @class */ (function () {
283
285
  * instances that were loaded from well-known files or environment variables, rather than being explicitly
284
286
  * instantiated.
285
287
  *
286
- * @param credential The credential instance to check.
288
+ * @param credential - The credential instance to check.
287
289
  */
288
290
  function isApplicationDefault(credential) {
289
291
  return credential instanceof ComputeEngineCredential ||
@@ -311,10 +313,10 @@ exports.getApplicationDefault = getApplicationDefault;
311
313
  * If no property exists by the given "key", looks for a property identified by "alt", and copies it instead.
312
314
  * This can be used to implement behaviors such as "copy property myKey or my_key".
313
315
  *
314
- * @param to Target object to copy the property into.
315
- * @param from Source object to copy the property from.
316
- * @param key Name of the property to copy.
317
- * @param alt Alternative name of the property to copy.
316
+ * @param to - Target object to copy the property into.
317
+ * @param from - Source object to copy the property from.
318
+ * @param key - Name of the property to copy.
319
+ * @param alt - Alternative name of the property to copy.
318
320
  */
319
321
  function copyAttr(to, from, key, alt) {
320
322
  var tmp = from[key] || from[alt];
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.100.0-alpha.0 */
1
+ /*! firebase-admin v10.0.2 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -32,20 +32,14 @@ export interface GoogleOAuthAccessToken {
32
32
  * with Firebase services.
33
33
  *
34
34
  * In most cases, you will not need to implement this yourself and can instead
35
- * use the default implementations provided by
36
- * {@link credential `admin.credential`}.
35
+ * use the default implementations provided by the `firebase-admin/app` module.
37
36
  */
38
37
  export interface Credential {
39
38
  /**
40
39
  * Returns a Google OAuth2 access token object used to authenticate with
41
40
  * Firebase services.
42
41
  *
43
- * This object contains the following properties:
44
- * * `access_token` (`string`): The actual Google OAuth2 access token.
45
- * * `expires_in` (`number`): The number of seconds from when the token was
46
- * issued that it expires.
47
- *
48
- * @return A Google OAuth2 access token object.
42
+ * @returns A Google OAuth2 access token object.
49
43
  */
50
44
  getAccessToken(): Promise<GoogleOAuthAccessToken>;
51
45
  }
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.100.0-alpha.0 */
1
+ /*! firebase-admin v10.0.2 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v9.100.0-alpha.0 */
1
+ /*! firebase-admin v10.0.2 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -15,12 +15,7 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- import { app } from '../firebase-namespace-api';
19
18
  import { Credential } from './credential';
20
- /**
21
- * Type representing a callback which is called every time an app lifecycle event occurs.
22
- */
23
- export declare type AppHook = (event: string, app: app.App) => void;
24
19
  /**
25
20
  * Type representing a Firebase OAuth access token (derived from a Google OAuth2 access token) which
26
21
  * can be used to authenticate to Firebase services such as the Realtime Database and Auth.
@@ -34,42 +29,23 @@ export interface FirebaseAccessToken {
34
29
  */
35
30
  export declare class FirebaseAppInternals {
36
31
  private credential_;
37
- private isDeleted_;
38
32
  private cachedToken_;
39
- private cachedTokenPromise_;
40
33
  private tokenListeners_;
41
- private tokenRefreshTimeout_;
42
34
  constructor(credential_: Credential);
43
- /**
44
- * Gets an auth token for the associated app.
45
- *
46
- * @param {boolean} forceRefresh Whether or not to force a token refresh.
47
- * @return {Promise<FirebaseAccessToken>} A Promise that will be fulfilled with the current or
48
- * new token.
49
- */
50
35
  getToken(forceRefresh?: boolean): Promise<FirebaseAccessToken>;
36
+ getCachedToken(): FirebaseAccessToken | null;
37
+ private refreshToken;
38
+ private shouldRefresh;
51
39
  /**
52
40
  * Adds a listener that is called each time a token changes.
53
41
  *
54
- * @param {function(string)} listener The listener that will be called with each new token.
42
+ * @param listener - The listener that will be called with each new token.
55
43
  */
56
44
  addAuthTokenListener(listener: (token: string) => void): void;
57
45
  /**
58
46
  * Removes a token listener.
59
47
  *
60
- * @param {function(string)} listener The listener to remove.
48
+ * @param listener - The listener to remove.
61
49
  */
62
50
  removeAuthTokenListener(listener: (token: string) => void): void;
63
- /**
64
- * Deletes the FirebaseAppInternals instance.
65
- */
66
- delete(): void;
67
- /**
68
- * Establishes timeout to refresh the Google OAuth2 access token used by the SDK.
69
- *
70
- * @param {number} delayInMilliseconds The delay to use for the timeout.
71
- * @param {number} numRetries The number of times to retry fetching a new token if the prior fetch
72
- * failed.
73
- */
74
- private setTokenRefreshTimeout;
75
51
  }