firebase-admin 10.0.1 → 10.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/lib/app/core.d.ts +1 -1
  2. package/lib/app/core.js +1 -1
  3. package/lib/app/credential-factory.d.ts +1 -1
  4. package/lib/app/credential-factory.js +1 -1
  5. package/lib/app/credential-internal.d.ts +3 -1
  6. package/lib/app/credential-internal.js +19 -1
  7. package/lib/app/credential.d.ts +1 -1
  8. package/lib/app/credential.js +1 -1
  9. package/lib/app/firebase-app.d.ts +1 -1
  10. package/lib/app/firebase-app.js +4 -1
  11. package/lib/app/firebase-namespace.d.ts +1 -1
  12. package/lib/app/firebase-namespace.js +1 -1
  13. package/lib/app/index.d.ts +1 -1
  14. package/lib/app/index.js +1 -1
  15. package/lib/app/lifecycle.d.ts +1 -1
  16. package/lib/app/lifecycle.js +1 -1
  17. package/lib/app-check/app-check-api-client-internal.d.ts +1 -1
  18. package/lib/app-check/app-check-api-client-internal.js +3 -3
  19. package/lib/app-check/app-check-api.d.ts +1 -1
  20. package/lib/app-check/app-check-api.js +1 -1
  21. package/lib/app-check/app-check-namespace.d.ts +1 -1
  22. package/lib/app-check/app-check-namespace.js +1 -1
  23. package/lib/app-check/app-check.d.ts +1 -1
  24. package/lib/app-check/app-check.js +1 -1
  25. package/lib/app-check/index.d.ts +1 -1
  26. package/lib/app-check/index.js +1 -1
  27. package/lib/app-check/token-generator.d.ts +1 -1
  28. package/lib/app-check/token-generator.js +3 -5
  29. package/lib/app-check/token-verifier.d.ts +1 -1
  30. package/lib/app-check/token-verifier.js +2 -3
  31. package/lib/auth/action-code-settings-builder.d.ts +1 -1
  32. package/lib/auth/action-code-settings-builder.js +1 -1
  33. package/lib/auth/auth-api-request.d.ts +1 -1
  34. package/lib/auth/auth-api-request.js +24 -4
  35. package/lib/auth/auth-config.d.ts +1 -1
  36. package/lib/auth/auth-config.js +1 -1
  37. package/lib/auth/auth-namespace.d.ts +4 -2
  38. package/lib/auth/auth-namespace.js +1 -1
  39. package/lib/auth/auth.d.ts +1 -1
  40. package/lib/auth/auth.js +1 -1
  41. package/lib/auth/base-auth.d.ts +29 -2
  42. package/lib/auth/base-auth.js +38 -1
  43. package/lib/auth/identifier.d.ts +1 -1
  44. package/lib/auth/identifier.js +1 -1
  45. package/lib/auth/index.d.ts +2 -2
  46. package/lib/auth/index.js +1 -1
  47. package/lib/auth/tenant-manager.d.ts +1 -1
  48. package/lib/auth/tenant-manager.js +1 -1
  49. package/lib/auth/tenant.d.ts +1 -1
  50. package/lib/auth/tenant.js +1 -1
  51. package/lib/auth/token-generator.d.ts +1 -1
  52. package/lib/auth/token-generator.js +2 -2
  53. package/lib/auth/token-verifier.d.ts +70 -1
  54. package/lib/auth/token-verifier.js +54 -7
  55. package/lib/auth/user-import-builder.d.ts +1 -1
  56. package/lib/auth/user-import-builder.js +1 -1
  57. package/lib/auth/user-record.d.ts +1 -1
  58. package/lib/auth/user-record.js +1 -1
  59. package/lib/credential/index.d.ts +1 -1
  60. package/lib/credential/index.js +1 -1
  61. package/lib/database/database-namespace.d.ts +1 -1
  62. package/lib/database/database-namespace.js +1 -1
  63. package/lib/database/database.d.ts +1 -1
  64. package/lib/database/database.js +1 -1
  65. package/lib/database/index.d.ts +1 -1
  66. package/lib/database/index.js +2 -1
  67. package/lib/default-namespace.d.ts +1 -1
  68. package/lib/default-namespace.js +1 -1
  69. package/lib/esm/eventarc/index.js +5 -0
  70. package/lib/esm/functions/index.js +5 -0
  71. package/lib/eventarc/cloudevent.d.ts +84 -0
  72. package/lib/eventarc/cloudevent.js +19 -0
  73. package/lib/eventarc/eventarc-client-internal.d.ts +18 -0
  74. package/lib/eventarc/eventarc-client-internal.js +205 -0
  75. package/lib/eventarc/eventarc-utils.d.ts +31 -0
  76. package/lib/eventarc/eventarc-utils.js +141 -0
  77. package/lib/eventarc/eventarc.d.ts +107 -0
  78. package/lib/eventarc/eventarc.js +139 -0
  79. package/lib/eventarc/index.d.ts +53 -0
  80. package/lib/eventarc/index.js +64 -0
  81. package/lib/firebase-namespace-api.d.ts +1 -1
  82. package/lib/firebase-namespace-api.js +1 -1
  83. package/lib/firestore/firestore-internal.d.ts +1 -1
  84. package/lib/firestore/firestore-internal.js +1 -1
  85. package/lib/firestore/firestore-namespace.d.ts +1 -1
  86. package/lib/firestore/firestore-namespace.js +1 -1
  87. package/lib/firestore/index.d.ts +1 -1
  88. package/lib/firestore/index.js +1 -1
  89. package/lib/functions/functions-api-client-internal.d.ts +32 -0
  90. package/lib/functions/functions-api-client-internal.js +279 -0
  91. package/lib/functions/functions-api.d.ts +67 -0
  92. package/lib/functions/functions-api.js +19 -0
  93. package/lib/functions/functions.d.ts +63 -0
  94. package/lib/functions/functions.js +99 -0
  95. package/lib/functions/index.d.ts +53 -0
  96. package/lib/functions/index.js +64 -0
  97. package/lib/index.d.ts +1 -1
  98. package/lib/index.js +1 -1
  99. package/lib/installations/index.d.ts +1 -1
  100. package/lib/installations/index.js +1 -1
  101. package/lib/installations/installations-namespace.d.ts +1 -1
  102. package/lib/installations/installations-namespace.js +1 -1
  103. package/lib/installations/installations-request-handler.d.ts +1 -1
  104. package/lib/installations/installations-request-handler.js +1 -1
  105. package/lib/installations/installations.d.ts +1 -1
  106. package/lib/installations/installations.js +1 -1
  107. package/lib/instance-id/index.d.ts +1 -1
  108. package/lib/instance-id/index.js +1 -1
  109. package/lib/instance-id/instance-id-namespace.d.ts +1 -1
  110. package/lib/instance-id/instance-id-namespace.js +1 -1
  111. package/lib/instance-id/instance-id.d.ts +1 -1
  112. package/lib/instance-id/instance-id.js +1 -1
  113. package/lib/machine-learning/index.d.ts +1 -1
  114. package/lib/machine-learning/index.js +1 -1
  115. package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
  116. package/lib/machine-learning/machine-learning-api-client.js +1 -1
  117. package/lib/machine-learning/machine-learning-namespace.d.ts +1 -1
  118. package/lib/machine-learning/machine-learning-namespace.js +1 -1
  119. package/lib/machine-learning/machine-learning-utils.d.ts +1 -1
  120. package/lib/machine-learning/machine-learning-utils.js +1 -1
  121. package/lib/machine-learning/machine-learning.d.ts +1 -1
  122. package/lib/machine-learning/machine-learning.js +1 -1
  123. package/lib/messaging/batch-request-internal.d.ts +1 -1
  124. package/lib/messaging/batch-request-internal.js +1 -1
  125. package/lib/messaging/index.d.ts +1 -1
  126. package/lib/messaging/index.js +1 -1
  127. package/lib/messaging/messaging-api-request-internal.d.ts +1 -1
  128. package/lib/messaging/messaging-api-request-internal.js +1 -1
  129. package/lib/messaging/messaging-api.d.ts +1 -1
  130. package/lib/messaging/messaging-api.js +1 -1
  131. package/lib/messaging/messaging-errors-internal.d.ts +1 -1
  132. package/lib/messaging/messaging-errors-internal.js +1 -1
  133. package/lib/messaging/messaging-internal.d.ts +1 -1
  134. package/lib/messaging/messaging-internal.js +1 -1
  135. package/lib/messaging/messaging-namespace.d.ts +1 -1
  136. package/lib/messaging/messaging-namespace.js +1 -1
  137. package/lib/messaging/messaging.d.ts +1 -1
  138. package/lib/messaging/messaging.js +1 -2
  139. package/lib/project-management/android-app.d.ts +1 -1
  140. package/lib/project-management/android-app.js +1 -1
  141. package/lib/project-management/app-metadata.d.ts +1 -1
  142. package/lib/project-management/app-metadata.js +1 -1
  143. package/lib/project-management/index.d.ts +1 -1
  144. package/lib/project-management/index.js +1 -1
  145. package/lib/project-management/ios-app.d.ts +1 -1
  146. package/lib/project-management/ios-app.js +1 -1
  147. package/lib/project-management/project-management-api-request-internal.d.ts +1 -1
  148. package/lib/project-management/project-management-api-request-internal.js +1 -1
  149. package/lib/project-management/project-management-namespace.d.ts +1 -1
  150. package/lib/project-management/project-management-namespace.js +1 -1
  151. package/lib/project-management/project-management.d.ts +1 -1
  152. package/lib/project-management/project-management.js +1 -1
  153. package/lib/remote-config/index.d.ts +1 -1
  154. package/lib/remote-config/index.js +1 -1
  155. package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
  156. package/lib/remote-config/remote-config-api-client-internal.js +1 -1
  157. package/lib/remote-config/remote-config-api.d.ts +1 -1
  158. package/lib/remote-config/remote-config-api.js +1 -1
  159. package/lib/remote-config/remote-config-namespace.d.ts +1 -1
  160. package/lib/remote-config/remote-config-namespace.js +1 -1
  161. package/lib/remote-config/remote-config.d.ts +1 -1
  162. package/lib/remote-config/remote-config.js +1 -1
  163. package/lib/security-rules/index.d.ts +1 -1
  164. package/lib/security-rules/index.js +1 -1
  165. package/lib/security-rules/security-rules-api-client-internal.d.ts +1 -1
  166. package/lib/security-rules/security-rules-api-client-internal.js +1 -1
  167. package/lib/security-rules/security-rules-internal.d.ts +1 -1
  168. package/lib/security-rules/security-rules-internal.js +1 -1
  169. package/lib/security-rules/security-rules-namespace.d.ts +1 -1
  170. package/lib/security-rules/security-rules-namespace.js +1 -1
  171. package/lib/security-rules/security-rules.d.ts +1 -1
  172. package/lib/security-rules/security-rules.js +1 -1
  173. package/lib/storage/index.d.ts +1 -1
  174. package/lib/storage/index.js +1 -1
  175. package/lib/storage/storage-namespace.d.ts +1 -1
  176. package/lib/storage/storage-namespace.js +1 -1
  177. package/lib/storage/storage.d.ts +1 -1
  178. package/lib/storage/storage.js +1 -1
  179. package/lib/utils/api-request.d.ts +1 -1
  180. package/lib/utils/api-request.js +1 -1
  181. package/lib/utils/crypto-signer.d.ts +1 -1
  182. package/lib/utils/crypto-signer.js +1 -1
  183. package/lib/utils/deep-copy.d.ts +1 -1
  184. package/lib/utils/deep-copy.js +1 -1
  185. package/lib/utils/error.d.ts +9 -1
  186. package/lib/utils/error.js +11 -1
  187. package/lib/utils/index.d.ts +43 -1
  188. package/lib/utils/index.js +72 -2
  189. package/lib/utils/jwt.d.ts +1 -1
  190. package/lib/utils/jwt.js +1 -1
  191. package/lib/utils/validator.d.ts +1 -1
  192. package/lib/utils/validator.js +1 -1
  193. package/package.json +32 -15
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2019 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2019 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2019 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2019 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2019 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2019 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -185,6 +185,10 @@ export declare class AppErrorCodes {
185
185
  * Auth client error codes and their default messages.
186
186
  */
187
187
  export declare class AuthClientErrorCode {
188
+ static AUTH_BLOCKING_TOKEN_EXPIRED: {
189
+ code: string;
190
+ message: string;
191
+ };
188
192
  static BILLING_NOT_ENABLED: {
189
193
  code: string;
190
194
  message: string;
@@ -273,6 +277,10 @@ export declare class AuthClientErrorCode {
273
277
  code: string;
274
278
  message: string;
275
279
  };
280
+ static INVALID_NEW_EMAIL: {
281
+ code: string;
282
+ message: string;
283
+ };
276
284
  static INVALID_ENROLLED_FACTORS: {
277
285
  code: string;
278
286
  message: string;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -376,6 +376,10 @@ exports.AppErrorCodes = AppErrorCodes;
376
376
  var AuthClientErrorCode = /** @class */ (function () {
377
377
  function AuthClientErrorCode() {
378
378
  }
379
+ AuthClientErrorCode.AUTH_BLOCKING_TOKEN_EXPIRED = {
380
+ code: 'auth-blocking-token-expired',
381
+ message: 'The provided Firebase Auth Blocking token is expired.',
382
+ };
379
383
  AuthClientErrorCode.BILLING_NOT_ENABLED = {
380
384
  code: 'billing-not-enabled',
381
385
  message: 'Feature requires billing to be enabled.',
@@ -465,6 +469,10 @@ var AuthClientErrorCode = /** @class */ (function () {
465
469
  code: 'invalid-email',
466
470
  message: 'The email address is improperly formatted.',
467
471
  };
472
+ AuthClientErrorCode.INVALID_NEW_EMAIL = {
473
+ code: 'invalid-new-email',
474
+ message: 'The new email address is improperly formatted.',
475
+ };
468
476
  AuthClientErrorCode.INVALID_ENROLLED_FACTORS = {
469
477
  code: 'invalid-enrolled-factors',
470
478
  message: 'The enrolled factors must be a valid array of MultiFactorInfo objects.',
@@ -922,6 +930,8 @@ var AUTH_SERVER_TO_CLIENT_CODE = {
922
930
  INVALID_DURATION: 'INVALID_SESSION_COOKIE_DURATION',
923
931
  // Invalid email provided.
924
932
  INVALID_EMAIL: 'INVALID_EMAIL',
933
+ // Invalid new email provided.
934
+ INVALID_NEW_EMAIL: 'INVALID_NEW_EMAIL',
925
935
  // Invalid tenant display name. This can be thrown on CreateTenant and UpdateTenant.
926
936
  INVALID_DISPLAY_NAME: 'INVALID_DISPLAY_NAME',
927
937
  // Invalid ID token provided.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -61,6 +61,28 @@ export declare function getExplicitProjectId(app: App): string | null;
61
61
  * @returns A project ID string or null.
62
62
  */
63
63
  export declare function findProjectId(app: App): Promise<string | null>;
64
+ /**
65
+ * Returns the service account email associated with a Firebase app, if it's explicitly
66
+ * specified in either the Firebase app options, credentials or the local environment.
67
+ * Otherwise returns null.
68
+ *
69
+ * @param app - A Firebase app to get the service account email from.
70
+ *
71
+ * @returns A service account email string or null.
72
+ */
73
+ export declare function getExplicitServiceAccountEmail(app: App): string | null;
74
+ /**
75
+ * Determines the service account email associated with a Firebase app. This method first
76
+ * checks if a service account email is explicitly specified in either the Firebase app options,
77
+ * credentials or the local environment in that order. If no explicit service account email is
78
+ * configured, but the SDK has been initialized with ComputeEngineCredentials, this
79
+ * method attempts to discover the service account email from the local metadata service.
80
+ *
81
+ * @param app - A Firebase app to get the service account email from.
82
+ *
83
+ * @returns A service account email ID string or null.
84
+ */
85
+ export declare function findServiceAccountEmail(app: App): Promise<string | null>;
64
86
  /**
65
87
  * Encodes data using web-safe-base64.
66
88
  *
@@ -103,3 +125,23 @@ export declare function generateUpdateMask(obj: any, terminalPaths?: string[], r
103
125
  * digits, terminated by 's'.
104
126
  */
105
127
  export declare function transformMillisecondsToSecondsString(milliseconds: number): string;
128
+ /**
129
+ * Internal type to represent a resource name
130
+ */
131
+ export declare type ParsedResource = {
132
+ projectId?: string;
133
+ locationId?: string;
134
+ resourceId: string;
135
+ };
136
+ /**
137
+ * Parses the top level resources of a given resource name.
138
+ * Supports both full and partial resources names, example:
139
+ * `locations/{location}/functions/{functionName}`,
140
+ * `projects/{project}/locations/{location}/functions/{functionName}`, or {functionName}
141
+ * Does not support deeply nested resource names.
142
+ *
143
+ * @param resourceName - The resource name string.
144
+ * @param resourceIdKey - The key of the resource name to be parsed.
145
+ * @returns A parsed resource name object.
146
+ */
147
+ export declare function parseResourceName(resourceName: string, resourceIdKey: string): ParsedResource;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -17,7 +17,7 @@
17
17
  * limitations under the License.
18
18
  */
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.transformMillisecondsToSecondsString = exports.generateUpdateMask = exports.formatString = exports.toWebSafeBase64 = exports.findProjectId = exports.getExplicitProjectId = exports.addReadonlyGetter = exports.renameProperties = exports.getSdkVersion = void 0;
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;
21
21
  var credential_internal_1 = require("../app/credential-internal");
22
22
  var validator = require("./validator");
23
23
  var sdkVersion;
@@ -114,6 +114,50 @@ function findProjectId(app) {
114
114
  return Promise.resolve(null);
115
115
  }
116
116
  exports.findProjectId = findProjectId;
117
+ /**
118
+ * Returns the service account email associated with a Firebase app, if it's explicitly
119
+ * specified in either the Firebase app options, credentials or the local environment.
120
+ * Otherwise returns null.
121
+ *
122
+ * @param app - A Firebase app to get the service account email from.
123
+ *
124
+ * @returns A service account email string or null.
125
+ */
126
+ function getExplicitServiceAccountEmail(app) {
127
+ var options = app.options;
128
+ if (validator.isNonEmptyString(options.serviceAccountId)) {
129
+ return options.serviceAccountId;
130
+ }
131
+ var credential = app.options.credential;
132
+ if (credential instanceof credential_internal_1.ServiceAccountCredential) {
133
+ return credential.clientEmail;
134
+ }
135
+ return null;
136
+ }
137
+ exports.getExplicitServiceAccountEmail = getExplicitServiceAccountEmail;
138
+ /**
139
+ * Determines the service account email associated with a Firebase app. This method first
140
+ * checks if a service account email is explicitly specified in either the Firebase app options,
141
+ * credentials or the local environment in that order. If no explicit service account email is
142
+ * configured, but the SDK has been initialized with ComputeEngineCredentials, this
143
+ * method attempts to discover the service account email from the local metadata service.
144
+ *
145
+ * @param app - A Firebase app to get the service account email from.
146
+ *
147
+ * @returns A service account email ID string or null.
148
+ */
149
+ function findServiceAccountEmail(app) {
150
+ var accountId = getExplicitServiceAccountEmail(app);
151
+ if (accountId) {
152
+ return Promise.resolve(accountId);
153
+ }
154
+ var credential = app.options.credential;
155
+ if (credential instanceof credential_internal_1.ComputeEngineCredential) {
156
+ return credential.getServiceAccountEmail();
157
+ }
158
+ return Promise.resolve(null);
159
+ }
160
+ exports.findServiceAccountEmail = findServiceAccountEmail;
117
161
  /**
118
162
  * Encodes data using web-safe-base64.
119
163
  *
@@ -216,3 +260,29 @@ function transformMillisecondsToSecondsString(milliseconds) {
216
260
  return duration;
217
261
  }
218
262
  exports.transformMillisecondsToSecondsString = transformMillisecondsToSecondsString;
263
+ /**
264
+ * Parses the top level resources of a given resource name.
265
+ * Supports both full and partial resources names, example:
266
+ * `locations/{location}/functions/{functionName}`,
267
+ * `projects/{project}/locations/{location}/functions/{functionName}`, or {functionName}
268
+ * Does not support deeply nested resource names.
269
+ *
270
+ * @param resourceName - The resource name string.
271
+ * @param resourceIdKey - The key of the resource name to be parsed.
272
+ * @returns A parsed resource name object.
273
+ */
274
+ function parseResourceName(resourceName, resourceIdKey) {
275
+ if (!resourceName.includes('/')) {
276
+ return { resourceId: resourceName };
277
+ }
278
+ var CHANNEL_NAME_REGEX = new RegExp("^(projects/([^/]+)/)?locations/([^/]+)/" + resourceIdKey + "/([^/]+)$");
279
+ var match = CHANNEL_NAME_REGEX.exec(resourceName);
280
+ if (match === null) {
281
+ throw new Error('Invalid resource name format.');
282
+ }
283
+ var projectId = match[2];
284
+ var locationId = match[3];
285
+ var resourceId = match[4];
286
+ return { projectId: projectId, locationId: locationId, resourceId: resourceId };
287
+ }
288
+ exports.parseResourceName = parseResourceName;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
package/lib/utils/jwt.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v10.0.1 */
1
+ /*! firebase-admin v10.2.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firebase-admin",
3
- "version": "10.0.1",
3
+ "version": "10.2.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",
@@ -71,12 +71,18 @@
71
71
  "auth": [
72
72
  "lib/auth"
73
73
  ],
74
+ "eventarc": [
75
+ "lib/eventarc"
76
+ ],
74
77
  "database": [
75
78
  "lib/database"
76
79
  ],
77
80
  "firestore": [
78
81
  "lib/firestore"
79
82
  ],
83
+ "functions": [
84
+ "lib/functions"
85
+ ],
80
86
  "installations": [
81
87
  "lib/installations"
82
88
  ],
@@ -121,10 +127,18 @@
121
127
  "require": "./lib/database/index.js",
122
128
  "import": "./lib/esm/database/index.js"
123
129
  },
130
+ "./eventarc": {
131
+ "require": "./lib/eventarc/index.js",
132
+ "import": "./lib/esm/eventarc/index.js"
133
+ },
124
134
  "./firestore": {
125
135
  "require": "./lib/firestore/index.js",
126
136
  "import": "./lib/esm/firestore/index.js"
127
137
  },
138
+ "./functions": {
139
+ "require": "./lib/functions/index.js",
140
+ "import": "./lib/esm/functions/index.js"
141
+ },
128
142
  "./installations": {
129
143
  "require": "./lib/installations/index.js",
130
144
  "import": "./lib/esm/installations/index.js"
@@ -159,23 +173,24 @@
159
173
  }
160
174
  },
161
175
  "dependencies": {
162
- "@firebase/database-compat": "^0.1.1",
163
- "@firebase/database-types": "^0.7.2",
176
+ "@firebase/database-compat": "^0.1.8",
177
+ "@firebase/database-types": "^0.9.7",
164
178
  "@types/node": ">=12.12.47",
165
179
  "dicer": "^0.3.0",
166
180
  "jsonwebtoken": "^8.5.1",
167
181
  "jwks-rsa": "^2.0.2",
168
- "node-forge": "^0.10.0"
182
+ "node-forge": "^1.3.1",
183
+ "uuid": "^8.3.2"
169
184
  },
170
185
  "optionalDependencies": {
171
- "@google-cloud/firestore": "^4.5.0",
172
- "@google-cloud/storage": "^5.3.0"
186
+ "@google-cloud/firestore": "^4.15.1",
187
+ "@google-cloud/storage": "^5.18.3"
173
188
  },
174
189
  "devDependencies": {
175
190
  "@firebase/api-documenter": "^0.1.2",
176
191
  "@firebase/app-compat": "^0.1.2",
177
- "@firebase/auth-compat": "^0.1.3",
178
- "@firebase/auth-types": "^0.10.3",
192
+ "@firebase/auth-compat": "^0.2.5",
193
+ "@firebase/auth-types": "^0.11.0",
179
194
  "@microsoft/api-extractor": "^7.11.2",
180
195
  "@types/bcrypt": "^5.0.0",
181
196
  "@types/chai": "^4.0.0",
@@ -183,22 +198,24 @@
183
198
  "@types/firebase-token-generator": "^2.0.28",
184
199
  "@types/jsonwebtoken": "8.5.1",
185
200
  "@types/lodash": "^4.14.104",
186
- "@types/minimist": "^1.2.0",
201
+ "@types/minimist": "^1.2.2",
187
202
  "@types/mocha": "^9.0.0",
188
203
  "@types/nock": "^11.1.0",
189
204
  "@types/request": "^2.47.0",
190
205
  "@types/request-promise": "^4.1.41",
191
206
  "@types/sinon": "^10.0.2",
192
207
  "@types/sinon-chai": "^3.0.0",
193
- "@typescript-eslint/eslint-plugin": "^2.20.0",
194
- "@typescript-eslint/parser": "^2.20.0",
208
+ "@types/uuid": "^8.3.4",
209
+ "@typescript-eslint/eslint-plugin": "^5.0.0",
210
+ "@typescript-eslint/parser": "^5.0.0",
195
211
  "bcrypt": "^5.0.0",
196
212
  "chai": "^4.2.0",
197
213
  "chai-as-promised": "^7.0.0",
214
+ "chai-exclude": "^2.1.0",
198
215
  "chalk": "^4.1.1",
199
216
  "child-process-promise": "^2.2.1",
200
217
  "del": "^6.0.0",
201
- "eslint": "^6.8.0",
218
+ "eslint": "^8.12.0",
202
219
  "firebase-token-generator": "^2.0.0",
203
220
  "gulp": "^4.0.2",
204
221
  "gulp-filter": "^7.0.0",
@@ -206,8 +223,8 @@
206
223
  "gulp-typescript": "^5.0.1",
207
224
  "http-message-parser": "^0.0.34",
208
225
  "lodash": "^4.17.15",
209
- "minimist": "^1.2.0",
210
- "mocha": "^9.1.2",
226
+ "minimist": "^1.2.6",
227
+ "mocha": "^10.0.0",
211
228
  "mz": "^2.7.0",
212
229
  "nock": "^13.0.0",
213
230
  "npm-run-all": "^4.1.5",
@@ -215,7 +232,7 @@
215
232
  "request": "^2.75.0",
216
233
  "request-promise": "^4.1.1",
217
234
  "run-sequence": "^2.2.1",
218
- "sinon": "^9.0.0",
235
+ "sinon": "^13.0.1",
219
236
  "sinon-chai": "^3.0.0",
220
237
  "ts-node": "^10.2.0",
221
238
  "typescript": "^3.7.3",