firebase-admin 12.7.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 +3 -4
  36. package/lib/auth/auth-config.d.ts +1 -1
  37. package/lib/auth/auth-config.js +3 -3
  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 +1 -1
  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 +1 -1
  51. package/lib/auth/project-config.js +1 -1
  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 +1 -1
  55. package/lib/auth/tenant.js +1 -1
  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 +3 -2
  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 -40
  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
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -17,7 +17,19 @@
17
17
  * limitations under the License.
18
18
  */
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.parseResourceName = exports.transformMillisecondsToSecondsString = exports.generateUpdateMask = exports.formatString = exports.toWebSafeBase64 = exports.findServiceAccountEmail = exports.getExplicitServiceAccountEmail = exports.findProjectId = exports.getExplicitProjectId = exports.addReadonlyGetter = exports.renameProperties = exports.getSdkVersion = void 0;
20
+ exports.getSdkVersion = getSdkVersion;
21
+ exports.getMetricsHeader = getMetricsHeader;
22
+ exports.renameProperties = renameProperties;
23
+ exports.addReadonlyGetter = addReadonlyGetter;
24
+ exports.getExplicitProjectId = getExplicitProjectId;
25
+ exports.findProjectId = findProjectId;
26
+ exports.getExplicitServiceAccountEmail = getExplicitServiceAccountEmail;
27
+ exports.findServiceAccountEmail = findServiceAccountEmail;
28
+ exports.toWebSafeBase64 = toWebSafeBase64;
29
+ exports.formatString = formatString;
30
+ exports.generateUpdateMask = generateUpdateMask;
31
+ exports.transformMillisecondsToSecondsString = transformMillisecondsToSecondsString;
32
+ exports.parseResourceName = parseResourceName;
21
33
  const credential_internal_1 = require("../app/credential-internal");
22
34
  const validator = require("./validator");
23
35
  let sdkVersion;
@@ -29,7 +41,9 @@ function getSdkVersion() {
29
41
  }
30
42
  return sdkVersion;
31
43
  }
32
- exports.getSdkVersion = getSdkVersion;
44
+ function getMetricsHeader() {
45
+ return `gl-node/${process.versions.node} fire-admin/${getSdkVersion()}`;
46
+ }
33
47
  /**
34
48
  * Renames properties on an object given a mapping from old to new property names.
35
49
  *
@@ -48,7 +62,6 @@ function renameProperties(obj, keyMap) {
48
62
  }
49
63
  });
50
64
  }
51
- exports.renameProperties = renameProperties;
52
65
  /**
53
66
  * Defines a new read-only property directly on an object and returns the object.
54
67
  *
@@ -65,7 +78,6 @@ function addReadonlyGetter(obj, prop, value) {
65
78
  enumerable: true,
66
79
  });
67
80
  }
68
- exports.addReadonlyGetter = addReadonlyGetter;
69
81
  /**
70
82
  * Returns the Google Cloud project ID associated with a Firebase app, if it's explicitly
71
83
  * specified in either the Firebase app options, credentials or the local environment.
@@ -90,7 +102,6 @@ function getExplicitProjectId(app) {
90
102
  }
91
103
  return null;
92
104
  }
93
- exports.getExplicitProjectId = getExplicitProjectId;
94
105
  /**
95
106
  * Determines the Google Cloud project ID associated with a Firebase app. This method
96
107
  * first checks if a project ID is explicitly specified in either the Firebase app options,
@@ -108,12 +119,11 @@ function findProjectId(app) {
108
119
  return Promise.resolve(projectId);
109
120
  }
110
121
  const credential = app.options.credential;
111
- if (credential instanceof credential_internal_1.ComputeEngineCredential) {
122
+ if (credential instanceof credential_internal_1.ApplicationDefaultCredential) {
112
123
  return credential.getProjectId();
113
124
  }
114
125
  return Promise.resolve(null);
115
126
  }
116
- exports.findProjectId = findProjectId;
117
127
  /**
118
128
  * Returns the service account email associated with a Firebase app, if it's explicitly
119
129
  * specified in either the Firebase app options, credentials or the local environment.
@@ -134,7 +144,6 @@ function getExplicitServiceAccountEmail(app) {
134
144
  }
135
145
  return null;
136
146
  }
137
- exports.getExplicitServiceAccountEmail = getExplicitServiceAccountEmail;
138
147
  /**
139
148
  * Determines the service account email associated with a Firebase app. This method first
140
149
  * checks if a service account email is explicitly specified in either the Firebase app options,
@@ -152,12 +161,11 @@ function findServiceAccountEmail(app) {
152
161
  return Promise.resolve(accountId);
153
162
  }
154
163
  const credential = app.options.credential;
155
- if (credential instanceof credential_internal_1.ComputeEngineCredential) {
164
+ if (credential instanceof credential_internal_1.ApplicationDefaultCredential) {
156
165
  return credential.getServiceAccountEmail();
157
166
  }
158
167
  return Promise.resolve(null);
159
168
  }
160
- exports.findServiceAccountEmail = findServiceAccountEmail;
161
169
  /**
162
170
  * Encodes data using web-safe-base64.
163
171
  *
@@ -167,7 +175,6 @@ exports.findServiceAccountEmail = findServiceAccountEmail;
167
175
  function toWebSafeBase64(data) {
168
176
  return data.toString('base64').replace(/\//g, '_').replace(/\+/g, '-');
169
177
  }
170
- exports.toWebSafeBase64 = toWebSafeBase64;
171
178
  /**
172
179
  * Formats a string of form 'project/{projectId}/{api}' and replaces
173
180
  * with corresponding arguments {projectId: '1234', api: 'resource'}
@@ -186,7 +193,6 @@ function formatString(str, params) {
186
193
  });
187
194
  return formatted;
188
195
  }
189
- exports.formatString = formatString;
190
196
  /**
191
197
  * Generates the update mask for the provided object.
192
198
  * Note this will ignore the last key with value undefined.
@@ -227,7 +233,6 @@ function generateUpdateMask(obj, terminalPaths = [], root = '') {
227
233
  }
228
234
  return updateMask;
229
235
  }
230
- exports.generateUpdateMask = generateUpdateMask;
231
236
  /**
232
237
  * Transforms milliseconds to a protobuf Duration type string.
233
238
  * Returns the duration in seconds with up to nine fractional
@@ -254,7 +259,6 @@ function transformMillisecondsToSecondsString(milliseconds) {
254
259
  }
255
260
  return duration;
256
261
  }
257
- exports.transformMillisecondsToSecondsString = transformMillisecondsToSecondsString;
258
262
  /**
259
263
  * Parses the top level resources of a given resource name.
260
264
  * Supports both full and partial resources names, example:
@@ -280,4 +284,3 @@ function parseResourceName(resourceName, resourceIdKey) {
280
284
  const resourceId = match[4];
281
285
  return { projectId, locationId, resourceId };
282
286
  }
283
- exports.parseResourceName = parseResourceName;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -14,7 +14,6 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- /// <reference types="node" />
18
17
  import * as jwt from 'jsonwebtoken';
19
18
  import { Agent } from 'http';
20
19
  export declare const ALGORITHM_RS256: jwt.Algorithm;
package/lib/utils/jwt.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -16,7 +16,9 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.JwtErrorCode = exports.JwtError = exports.decodeJwt = exports.verifyJwtSignature = exports.EmulatorSignatureVerifier = exports.PublicKeySignatureVerifier = exports.UrlKeyFetcher = exports.JwksFetcher = exports.ALGORITHM_RS256 = void 0;
19
+ exports.JwtErrorCode = exports.JwtError = exports.EmulatorSignatureVerifier = exports.PublicKeySignatureVerifier = exports.UrlKeyFetcher = exports.JwksFetcher = exports.ALGORITHM_RS256 = void 0;
20
+ exports.verifyJwtSignature = verifyJwtSignature;
21
+ exports.decodeJwt = decodeJwt;
20
22
  const validator = require("./validator");
21
23
  const jwt = require("jsonwebtoken");
22
24
  const jwks = require("jwks-rsa");
@@ -38,7 +40,7 @@ class JwksFetcher {
38
40
  }
39
41
  this.client = jwks({
40
42
  jwksUri: jwksUrl,
41
- cache: false,
43
+ cache: false, // disable jwks-rsa LRU cache as the keys are always cached for 6 hours.
42
44
  requestAgent: httpAgent,
43
45
  });
44
46
  }
@@ -277,7 +279,6 @@ function verifyJwtSignature(token, secretOrPublicKey, options) {
277
279
  });
278
280
  });
279
281
  }
280
- exports.verifyJwtSignature = verifyJwtSignature;
281
282
  /**
282
283
  * Decodes general purpose Firebase JWTs.
283
284
  *
@@ -298,7 +299,6 @@ function decodeJwt(jwtToken) {
298
299
  const payload = fullDecodedToken?.payload;
299
300
  return Promise.resolve({ header, payload });
300
301
  }
301
- exports.decodeJwt = decodeJwt;
302
302
  /**
303
303
  * Jwt error code structure.
304
304
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 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
  /**
20
19
  * Validates that a value is a byte buffer.
21
20
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.7.0 */
1
+ /*! firebase-admin v13.0.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -17,7 +17,25 @@
17
17
  * limitations under the License.
18
18
  */
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.isTaskId = exports.isTopic = exports.isURL = exports.isUTCDateString = exports.isISODateString = exports.isPhoneNumber = exports.isEmail = exports.isPassword = exports.isUid = exports.isNonNullObject = exports.isObject = exports.isNonEmptyString = exports.isBase64String = exports.isString = exports.isNumber = exports.isBoolean = exports.isNonEmptyArray = exports.isArray = exports.isBuffer = void 0;
20
+ exports.isBuffer = isBuffer;
21
+ exports.isArray = isArray;
22
+ exports.isNonEmptyArray = isNonEmptyArray;
23
+ exports.isBoolean = isBoolean;
24
+ exports.isNumber = isNumber;
25
+ exports.isString = isString;
26
+ exports.isBase64String = isBase64String;
27
+ exports.isNonEmptyString = isNonEmptyString;
28
+ exports.isObject = isObject;
29
+ exports.isNonNullObject = isNonNullObject;
30
+ exports.isUid = isUid;
31
+ exports.isPassword = isPassword;
32
+ exports.isEmail = isEmail;
33
+ exports.isPhoneNumber = isPhoneNumber;
34
+ exports.isISODateString = isISODateString;
35
+ exports.isUTCDateString = isUTCDateString;
36
+ exports.isURL = isURL;
37
+ exports.isTopic = isTopic;
38
+ exports.isTaskId = isTaskId;
21
39
  const url = require("url");
22
40
  /**
23
41
  * Validates that a value is a byte buffer.
@@ -28,7 +46,6 @@ const url = require("url");
28
46
  function isBuffer(value) {
29
47
  return value instanceof Buffer;
30
48
  }
31
- exports.isBuffer = isBuffer;
32
49
  /**
33
50
  * Validates that a value is an array.
34
51
  *
@@ -38,7 +55,6 @@ exports.isBuffer = isBuffer;
38
55
  function isArray(value) {
39
56
  return Array.isArray(value);
40
57
  }
41
- exports.isArray = isArray;
42
58
  /**
43
59
  * Validates that a value is a non-empty array.
44
60
  *
@@ -48,7 +64,6 @@ exports.isArray = isArray;
48
64
  function isNonEmptyArray(value) {
49
65
  return isArray(value) && value.length !== 0;
50
66
  }
51
- exports.isNonEmptyArray = isNonEmptyArray;
52
67
  /**
53
68
  * Validates that a value is a boolean.
54
69
  *
@@ -58,7 +73,6 @@ exports.isNonEmptyArray = isNonEmptyArray;
58
73
  function isBoolean(value) {
59
74
  return typeof value === 'boolean';
60
75
  }
61
- exports.isBoolean = isBoolean;
62
76
  /**
63
77
  * Validates that a value is a number.
64
78
  *
@@ -68,7 +82,6 @@ exports.isBoolean = isBoolean;
68
82
  function isNumber(value) {
69
83
  return typeof value === 'number' && !isNaN(value);
70
84
  }
71
- exports.isNumber = isNumber;
72
85
  /**
73
86
  * Validates that a value is a string.
74
87
  *
@@ -78,7 +91,6 @@ exports.isNumber = isNumber;
78
91
  function isString(value) {
79
92
  return typeof value === 'string';
80
93
  }
81
- exports.isString = isString;
82
94
  /**
83
95
  * Validates that a value is a base64 string.
84
96
  *
@@ -91,7 +103,6 @@ function isBase64String(value) {
91
103
  }
92
104
  return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(value);
93
105
  }
94
- exports.isBase64String = isBase64String;
95
106
  /**
96
107
  * Validates that a value is a non-empty string.
97
108
  *
@@ -101,7 +112,6 @@ exports.isBase64String = isBase64String;
101
112
  function isNonEmptyString(value) {
102
113
  return isString(value) && value !== '';
103
114
  }
104
- exports.isNonEmptyString = isNonEmptyString;
105
115
  /**
106
116
  * Validates that a value is a nullable object.
107
117
  *
@@ -111,7 +121,6 @@ exports.isNonEmptyString = isNonEmptyString;
111
121
  function isObject(value) {
112
122
  return typeof value === 'object' && !isArray(value);
113
123
  }
114
- exports.isObject = isObject;
115
124
  /**
116
125
  * Validates that a value is a non-null object.
117
126
  *
@@ -121,7 +130,6 @@ exports.isObject = isObject;
121
130
  function isNonNullObject(value) {
122
131
  return isObject(value) && value !== null;
123
132
  }
124
- exports.isNonNullObject = isNonNullObject;
125
133
  /**
126
134
  * Validates that a string is a valid Firebase Auth uid.
127
135
  *
@@ -131,7 +139,6 @@ exports.isNonNullObject = isNonNullObject;
131
139
  function isUid(uid) {
132
140
  return typeof uid === 'string' && uid.length > 0 && uid.length <= 128;
133
141
  }
134
- exports.isUid = isUid;
135
142
  /**
136
143
  * Validates that a string is a valid Firebase Auth password.
137
144
  *
@@ -142,7 +149,6 @@ function isPassword(password) {
142
149
  // A password must be a string of at least 6 characters.
143
150
  return typeof password === 'string' && password.length >= 6;
144
151
  }
145
- exports.isPassword = isPassword;
146
152
  /**
147
153
  * Validates that a string is a valid email.
148
154
  *
@@ -157,7 +163,6 @@ function isEmail(email) {
157
163
  const re = /^[^@]+@[^@]+$/;
158
164
  return re.test(email);
159
165
  }
160
- exports.isEmail = isEmail;
161
166
  /**
162
167
  * Validates that a string is a valid phone number.
163
168
  *
@@ -176,7 +181,6 @@ function isPhoneNumber(phoneNumber) {
176
181
  const re2 = /[\da-zA-Z]+/;
177
182
  return re1.test(phoneNumber) && re2.test(phoneNumber);
178
183
  }
179
- exports.isPhoneNumber = isPhoneNumber;
180
184
  /**
181
185
  * Validates that a string is a valid ISO date string.
182
186
  *
@@ -192,7 +196,6 @@ function isISODateString(dateString) {
192
196
  return false;
193
197
  }
194
198
  }
195
- exports.isISODateString = isISODateString;
196
199
  /**
197
200
  * Validates that a string is a valid UTC date string.
198
201
  *
@@ -208,7 +211,6 @@ function isUTCDateString(dateString) {
208
211
  return false;
209
212
  }
210
213
  }
211
- exports.isUTCDateString = isUTCDateString;
212
214
  /**
213
215
  * Validates that a string is a valid web URL.
214
216
  *
@@ -254,7 +256,6 @@ function isURL(urlStr) {
254
256
  }
255
257
  return true;
256
258
  }
257
- exports.isURL = isURL;
258
259
  /**
259
260
  * Validates that the provided topic is a valid FCM topic name.
260
261
  *
@@ -268,7 +269,6 @@ function isTopic(topic) {
268
269
  const VALID_TOPIC_REGEX = /^(\/topics\/)?(private\/)?[a-zA-Z0-9-_.~%]+$/;
269
270
  return VALID_TOPIC_REGEX.test(topic);
270
271
  }
271
- exports.isTopic = isTopic;
272
272
  /**
273
273
  * Validates that the provided string can be used as a task ID
274
274
  * for Cloud Tasks.
@@ -283,4 +283,3 @@ function isTaskId(taskId) {
283
283
  const VALID_TASK_ID_REGEX = /^[A-Za-z0-9_-]+$/;
284
284
  return VALID_TASK_ID_REGEX.test(taskId);
285
285
  }
286
- exports.isTaskId = isTaskId;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "firebase-admin",
3
- "version": "12.7.0",
3
+ "version": "13.0.0",
4
4
  "description": "Firebase admin SDK for Node.js",
5
5
  "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
6
6
  "license": "Apache-2.0",
7
7
  "homepage": "https://firebase.google.com/",
8
8
  "engines": {
9
- "node": ">=14"
9
+ "node": ">=18"
10
10
  },
11
11
  "scripts": {
12
12
  "build": "gulp build",
@@ -205,23 +205,24 @@
205
205
  },
206
206
  "dependencies": {
207
207
  "@fastify/busboy": "^3.0.0",
208
- "@firebase/database-compat": "1.0.8",
209
- "@firebase/database-types": "1.0.5",
210
- "@types/node": "^22.0.1",
208
+ "@firebase/database-compat": "^2.0.0",
209
+ "@firebase/database-types": "^1.0.6",
210
+ "@types/node": "^22.8.7",
211
211
  "farmhash-modern": "^1.1.0",
212
+ "google-auth-library": "^9.14.2",
212
213
  "jsonwebtoken": "^9.0.0",
213
214
  "jwks-rsa": "^3.1.0",
214
215
  "node-forge": "^1.3.1",
215
- "uuid": "^10.0.0"
216
+ "uuid": "^11.0.2"
216
217
  },
217
218
  "optionalDependencies": {
218
- "@google-cloud/firestore": "^7.7.0",
219
- "@google-cloud/storage": "^7.7.0"
219
+ "@google-cloud/firestore": "^7.10.0",
220
+ "@google-cloud/storage": "^7.14.0"
220
221
  },
221
222
  "devDependencies": {
222
223
  "@firebase/api-documenter": "^0.4.0",
223
224
  "@firebase/app-compat": "^0.2.1",
224
- "@firebase/auth-compat": "^0.4.1",
225
+ "@firebase/auth-compat": "^0.5.13",
225
226
  "@firebase/auth-types": "^0.12.0",
226
227
  "@microsoft/api-extractor": "^7.11.2",
227
228
  "@types/bcrypt": "^5.0.0",
@@ -238,8 +239,8 @@
238
239
  "@types/sinon": "^17.0.2",
239
240
  "@types/sinon-chai": "^3.0.0",
240
241
  "@types/uuid": "^10.0.0",
241
- "@typescript-eslint/eslint-plugin": "^5.62.0",
242
- "@typescript-eslint/parser": "^5.62.0",
242
+ "@typescript-eslint/eslint-plugin": "^7.16.1",
243
+ "@typescript-eslint/parser": "^7.16.1",
243
244
  "bcrypt": "^5.0.0",
244
245
  "chai": "^4.2.0",
245
246
  "chai-as-promised": "^7.0.0",
@@ -247,7 +248,7 @@
247
248
  "chalk": "^4.1.1",
248
249
  "child-process-promise": "^2.2.1",
249
250
  "del": "^6.0.0",
250
- "eslint": "^8.12.0",
251
+ "eslint": "^8.56.0",
251
252
  "firebase-token-generator": "^2.0.0",
252
253
  "gulp": "^5.0.0",
253
254
  "gulp-filter": "^7.0.0",
@@ -267,7 +268,7 @@
267
268
  "sinon": "^18.0.0",
268
269
  "sinon-chai": "^3.0.0",
269
270
  "ts-node": "^10.2.0",
270
- "typescript": "5.1.6",
271
+ "typescript": "5.5.4",
271
272
  "yargs": "^17.0.1"
272
273
  }
273
274
  }
package/CHANGELOG.md DELETED
@@ -1,4 +0,0 @@
1
- # Firebase Admin Changelog
2
-
3
- For detailed version notes and breaking changes, see our release notes on GitHub:
4
- https://github.com/firebase/firebase-admin-node/releases
@@ -1,55 +0,0 @@
1
- /*! firebase-admin v12.7.0 */
2
- /*!
3
- * Copyright 2019 Google Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- import { HttpClient, RequestResponse } from '../utils/api-request';
18
- /**
19
- * Represents a request that can be sent as part of an HTTP batch request.
20
- */
21
- export interface SubRequest {
22
- url: string;
23
- body: object;
24
- headers?: {
25
- [key: string]: any;
26
- };
27
- }
28
- /**
29
- * An HTTP client that can be used to make batch requests. This client is not tied to any service
30
- * (FCM or otherwise). Therefore it can be used to make batch requests to any service that allows
31
- * it. If this requirement ever arises we can move this implementation to the utils module
32
- * where it can be easily shared among other modules.
33
- */
34
- export declare class BatchRequestClient {
35
- private readonly httpClient;
36
- private readonly batchUrl;
37
- private readonly commonHeaders?;
38
- /**
39
- * @param {HttpClient} httpClient The client that will be used to make HTTP calls.
40
- * @param {string} batchUrl The URL that accepts batch requests.
41
- * @param {object=} commonHeaders Optional headers that will be included in all requests.
42
- *
43
- * @constructor
44
- */
45
- constructor(httpClient: HttpClient, batchUrl: string, commonHeaders?: object | undefined);
46
- /**
47
- * Sends the given array of sub requests as a single batch, and parses the results into an array
48
- * of `RequestResponse` objects.
49
- *
50
- * @param requests - An array of sub requests to send.
51
- * @returns A promise that resolves when the send operation is complete.
52
- */
53
- send(requests: SubRequest[]): Promise<RequestResponse[]>;
54
- private getMultipartPayload;
55
- }
@@ -1,127 +0,0 @@
1
- /*! firebase-admin v12.7.0 */
2
- "use strict";
3
- /*!
4
- * Copyright 2019 Google Inc.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.BatchRequestClient = void 0;
20
- const api_request_1 = require("../utils/api-request");
21
- const error_1 = require("../utils/error");
22
- const PART_BOUNDARY = '__END_OF_PART__';
23
- const TEN_SECONDS_IN_MILLIS = 15000;
24
- /**
25
- * An HTTP client that can be used to make batch requests. This client is not tied to any service
26
- * (FCM or otherwise). Therefore it can be used to make batch requests to any service that allows
27
- * it. If this requirement ever arises we can move this implementation to the utils module
28
- * where it can be easily shared among other modules.
29
- */
30
- class BatchRequestClient {
31
- /**
32
- * @param {HttpClient} httpClient The client that will be used to make HTTP calls.
33
- * @param {string} batchUrl The URL that accepts batch requests.
34
- * @param {object=} commonHeaders Optional headers that will be included in all requests.
35
- *
36
- * @constructor
37
- */
38
- constructor(httpClient, batchUrl, commonHeaders) {
39
- this.httpClient = httpClient;
40
- this.batchUrl = batchUrl;
41
- this.commonHeaders = commonHeaders;
42
- }
43
- /**
44
- * Sends the given array of sub requests as a single batch, and parses the results into an array
45
- * of `RequestResponse` objects.
46
- *
47
- * @param requests - An array of sub requests to send.
48
- * @returns A promise that resolves when the send operation is complete.
49
- */
50
- send(requests) {
51
- requests = requests.map((req) => {
52
- req.headers = Object.assign({}, this.commonHeaders, req.headers);
53
- return req;
54
- });
55
- const requestHeaders = {
56
- 'Content-Type': `multipart/mixed; boundary=${PART_BOUNDARY}`,
57
- };
58
- const request = {
59
- method: 'POST',
60
- url: this.batchUrl,
61
- data: this.getMultipartPayload(requests),
62
- headers: Object.assign({}, this.commonHeaders, requestHeaders),
63
- timeout: TEN_SECONDS_IN_MILLIS,
64
- };
65
- return this.httpClient.send(request).then((response) => {
66
- if (!response.multipart) {
67
- throw new error_1.FirebaseAppError(error_1.AppErrorCodes.INTERNAL_ERROR, 'Expected a multipart response.');
68
- }
69
- return response.multipart.map((buff) => {
70
- return (0, api_request_1.parseHttpResponse)(buff, request);
71
- });
72
- });
73
- }
74
- getMultipartPayload(requests) {
75
- let buffer = '';
76
- requests.forEach((request, idx) => {
77
- buffer += createPart(request, PART_BOUNDARY, idx);
78
- });
79
- buffer += `--${PART_BOUNDARY}--\r\n`;
80
- return Buffer.from(buffer, 'utf-8');
81
- }
82
- }
83
- exports.BatchRequestClient = BatchRequestClient;
84
- /**
85
- * Creates a single part in a multipart HTTP request body. The part consists of several headers
86
- * followed by the serialized sub request as the body. As per the requirements of the FCM batch
87
- * API, sets the content-type header to application/http, and the content-transfer-encoding to
88
- * binary.
89
- *
90
- * @param request - A sub request that will be used to populate the part.
91
- * @param boundary - Multipart boundary string.
92
- * @param idx - An index number that is used to set the content-id header.
93
- * @returns The part as a string that can be included in the HTTP body.
94
- */
95
- function createPart(request, boundary, idx) {
96
- const serializedRequest = serializeSubRequest(request);
97
- let part = `--${boundary}\r\n`;
98
- part += `Content-Length: ${serializedRequest.length}\r\n`;
99
- part += 'Content-Type: application/http\r\n';
100
- part += `content-id: ${idx + 1}\r\n`;
101
- part += 'content-transfer-encoding: binary\r\n';
102
- part += '\r\n';
103
- part += `${serializedRequest}\r\n`;
104
- return part;
105
- }
106
- /**
107
- * Serializes a sub request into a string that can be embedded in a multipart HTTP request. The
108
- * format of the string is the wire format of a typical HTTP request, consisting of a header and a
109
- * body.
110
- *
111
- * @param request - The sub request to be serialized.
112
- * @returns String representation of the SubRequest.
113
- */
114
- function serializeSubRequest(request) {
115
- const requestBody = JSON.stringify(request.body);
116
- let messagePayload = `POST ${request.url} HTTP/1.1\r\n`;
117
- messagePayload += `Content-Length: ${requestBody.length}\r\n`;
118
- messagePayload += 'Content-Type: application/json; charset=UTF-8\r\n';
119
- if (request.headers) {
120
- Object.keys(request.headers).forEach((key) => {
121
- messagePayload += `${key}: ${request.headers[key]}\r\n`;
122
- });
123
- }
124
- messagePayload += '\r\n';
125
- messagePayload += requestBody;
126
- return messagePayload;
127
- }