firebase-admin 13.1.0 → 13.3.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 (216) 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 +1 -1
  6. package/lib/app/credential-internal.js +1 -1
  7. package/lib/app/credential.d.ts +1 -1
  8. package/lib/app/credential.js +1 -1
  9. package/lib/app/firebase-app.d.ts +1 -1
  10. package/lib/app/firebase-app.js +1 -1
  11. package/lib/app/firebase-namespace.d.ts +1 -1
  12. package/lib/app/firebase-namespace.js +1 -1
  13. package/lib/app/index.d.ts +1 -1
  14. package/lib/app/index.js +1 -1
  15. package/lib/app/lifecycle.d.ts +1 -1
  16. package/lib/app/lifecycle.js +1 -1
  17. package/lib/app-check/app-check-api-client-internal.d.ts +1 -1
  18. package/lib/app-check/app-check-api-client-internal.js +1 -1
  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 +1 -1
  29. package/lib/app-check/token-verifier.d.ts +1 -1
  30. package/lib/app-check/token-verifier.js +1 -1
  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 +1 -1
  35. package/lib/auth/auth-config.d.ts +1 -1
  36. package/lib/auth/auth-config.js +1 -1
  37. package/lib/auth/auth-namespace.d.ts +1 -1
  38. package/lib/auth/auth-namespace.js +1 -1
  39. package/lib/auth/auth.d.ts +1 -1
  40. package/lib/auth/auth.js +1 -1
  41. package/lib/auth/base-auth.d.ts +1 -1
  42. package/lib/auth/base-auth.js +1 -1
  43. package/lib/auth/identifier.d.ts +1 -1
  44. package/lib/auth/identifier.js +1 -1
  45. package/lib/auth/index.d.ts +1 -1
  46. package/lib/auth/index.js +1 -1
  47. package/lib/auth/project-config-manager.d.ts +1 -1
  48. package/lib/auth/project-config-manager.js +1 -1
  49. package/lib/auth/project-config.d.ts +1 -1
  50. package/lib/auth/project-config.js +1 -1
  51. package/lib/auth/tenant-manager.d.ts +1 -1
  52. package/lib/auth/tenant-manager.js +1 -1
  53. package/lib/auth/tenant.d.ts +1 -1
  54. package/lib/auth/tenant.js +1 -1
  55. package/lib/auth/token-generator.d.ts +1 -1
  56. package/lib/auth/token-generator.js +1 -1
  57. package/lib/auth/token-verifier.d.ts +1 -1
  58. package/lib/auth/token-verifier.js +1 -1
  59. package/lib/auth/user-import-builder.d.ts +1 -1
  60. package/lib/auth/user-import-builder.js +1 -1
  61. package/lib/auth/user-record.d.ts +1 -1
  62. package/lib/auth/user-record.js +1 -1
  63. package/lib/credential/index.d.ts +1 -1
  64. package/lib/credential/index.js +1 -1
  65. package/lib/data-connect/data-connect-api-client-internal.d.ts +6 -1
  66. package/lib/data-connect/data-connect-api-client-internal.js +44 -11
  67. package/lib/data-connect/data-connect-api.d.ts +44 -1
  68. package/lib/data-connect/data-connect-api.js +1 -1
  69. package/lib/data-connect/data-connect.d.ts +1 -1
  70. package/lib/data-connect/data-connect.js +1 -1
  71. package/lib/data-connect/index.d.ts +2 -2
  72. package/lib/data-connect/index.js +1 -1
  73. package/lib/database/database-namespace.d.ts +1 -1
  74. package/lib/database/database-namespace.js +1 -1
  75. package/lib/database/database.d.ts +1 -1
  76. package/lib/database/database.js +1 -1
  77. package/lib/database/index.d.ts +1 -1
  78. package/lib/database/index.js +1 -1
  79. package/lib/default-namespace.d.ts +1 -1
  80. package/lib/default-namespace.js +1 -1
  81. package/lib/esm/remote-config/index.js +1 -0
  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 +1 -1
  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 +1 -1
  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 +1 -1
  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 +1 -1
  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 +1 -1
  108. package/lib/functions/functions-api-client-internal.d.ts +1 -1
  109. package/lib/functions/functions-api-client-internal.js +14 -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 +1 -1
  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 +1 -1
  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 +1 -1
  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 +1 -1
  134. package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
  135. package/lib/machine-learning/machine-learning-api-client.js +1 -1
  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 +1 -1
  143. package/lib/messaging/index.js +1 -1
  144. package/lib/messaging/messaging-api-request-internal.d.ts +1 -1
  145. package/lib/messaging/messaging-api-request-internal.js +1 -1
  146. package/lib/messaging/messaging-api.d.ts +9 -2
  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 +1 -1
  150. package/lib/messaging/messaging-internal.d.ts +1 -1
  151. package/lib/messaging/messaging-internal.js +5 -1
  152. package/lib/messaging/messaging-namespace.d.ts +1 -1
  153. package/lib/messaging/messaging-namespace.js +1 -1
  154. package/lib/messaging/messaging.d.ts +2 -1
  155. package/lib/messaging/messaging.js +52 -32
  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 +1 -1
  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 +1 -1
  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 -5
  172. package/lib/remote-config/index.d.ts +3 -3
  173. package/lib/remote-config/index.js +3 -2
  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 +35 -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 +20 -2
  183. package/lib/remote-config/remote-config.js +59 -2
  184. package/lib/security-rules/index.d.ts +1 -1
  185. package/lib/security-rules/index.js +1 -1
  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 -1
  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 +1 -1
  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 +1 -1
  202. package/lib/utils/api-request.d.ts +5 -1
  203. package/lib/utils/api-request.js +24 -4
  204. package/lib/utils/crypto-signer.d.ts +1 -1
  205. package/lib/utils/crypto-signer.js +1 -1
  206. package/lib/utils/deep-copy.d.ts +1 -1
  207. package/lib/utils/deep-copy.js +1 -1
  208. package/lib/utils/error.d.ts +7 -1
  209. package/lib/utils/error.js +31 -2
  210. package/lib/utils/index.d.ts +1 -1
  211. package/lib/utils/index.js +1 -1
  212. package/lib/utils/jwt.d.ts +1 -1
  213. package/lib/utils/jwt.js +1 -1
  214. package/lib/utils/validator.d.ts +1 -1
  215. package/lib/utils/validator.js +1 -1
  216. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -514,7 +514,8 @@ export interface AndroidNotification {
514
514
  defaultLightSettings?: boolean;
515
515
  /**
516
516
  * Sets the visibility of the notification. Must be either `private`, `public`,
517
- * or `secret`. If unspecified, defaults to `private`.
517
+ * or `secret`. If unspecified, it remains undefined in the Admin SDK, and
518
+ * defers to the FCM backend's default mapping.
518
519
  */
519
520
  visibility?: ('private' | 'public' | 'secret');
520
521
  /**
@@ -528,6 +529,12 @@ export interface AndroidNotification {
528
529
  * displayed on the long-press menu each time a new notification arrives.
529
530
  */
530
531
  notificationCount?: number;
532
+ /**
533
+ * Sets if this notification should attempt to be proxied. Must be either
534
+ * `allow`, `deny` or `if_priority_lowered`. If unspecified, it remains
535
+ * undefined in the Admin SDK, and defers to the FCM backend's default mapping.
536
+ */
537
+ proxy?: ('allow' | 'deny' | 'if_priority_lowered');
531
538
  }
532
539
  /**
533
540
  * Represents settings to control notification LED that can be included in
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2019 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2019 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -396,6 +396,10 @@ function validateAndroidNotification(notification) {
396
396
  const priority = 'PRIORITY_' + notification.priority.toUpperCase();
397
397
  notification.priority = priority;
398
398
  }
399
+ if (typeof notification.proxy !== 'undefined') {
400
+ const proxy = notification.proxy.toUpperCase();
401
+ notification.proxy = proxy;
402
+ }
399
403
  if (typeof notification.visibility !== 'undefined') {
400
404
  const visibility = notification.visibility.toUpperCase();
401
405
  notification.visibility = visibility;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -79,6 +79,7 @@ export declare class Messaging {
79
79
  * send operation.
80
80
  */
81
81
  sendEach(messages: Message[], dryRun?: boolean): Promise<BatchResponse>;
82
+ private parseSendResponses;
82
83
  /**
83
84
  * Sends the given multicast message to all the FCM registration tokens
84
85
  * specified in it.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -173,41 +173,61 @@ class Messaging {
173
173
  const http2SessionHandler = this.useLegacyTransport ? undefined : new api_request_1.Http2SessionHandler(`https://${FCM_SEND_HOST}`);
174
174
  return this.getUrlPath()
175
175
  .then((urlPath) => {
176
- const requests = copy.map(async (message) => {
177
- (0, messaging_internal_1.validateMessage)(message);
178
- const request = { message };
179
- if (dryRun) {
180
- request.validate_only = true;
181
- }
182
- if (http2SessionHandler) {
183
- return this.messagingRequestHandler.invokeHttp2RequestHandlerForSendResponse(FCM_SEND_HOST, urlPath, request, http2SessionHandler);
184
- }
185
- return this.messagingRequestHandler.invokeHttpRequestHandlerForSendResponse(FCM_SEND_HOST, urlPath, request);
186
- });
187
- return Promise.allSettled(requests);
188
- })
189
- .then((results) => {
190
- const responses = [];
191
- results.forEach(result => {
192
- if (result.status === 'fulfilled') {
193
- responses.push(result.value);
194
- }
195
- else { // rejected
196
- responses.push({ success: false, error: result.reason });
197
- }
198
- });
199
- const successCount = responses.filter((resp) => resp.success).length;
200
- return {
201
- responses,
202
- successCount,
203
- failureCount: responses.length - successCount,
204
- };
176
+ if (http2SessionHandler) {
177
+ let sendResponsePromise;
178
+ return new Promise((resolve, reject) => {
179
+ // Start session listeners
180
+ http2SessionHandler.invoke().catch((error) => {
181
+ const pendingBatchResponse = sendResponsePromise ? sendResponsePromise.then(this.parseSendResponses) : undefined;
182
+ reject(new error_1.FirebaseMessagingSessionError(error, undefined, pendingBatchResponse));
183
+ });
184
+ // Start making requests
185
+ const requests = copy.map(async (message) => {
186
+ (0, messaging_internal_1.validateMessage)(message);
187
+ const request = { message };
188
+ if (dryRun) {
189
+ request.validate_only = true;
190
+ }
191
+ return this.messagingRequestHandler.invokeHttp2RequestHandlerForSendResponse(FCM_SEND_HOST, urlPath, request, http2SessionHandler);
192
+ });
193
+ // Resolve once all requests have completed
194
+ sendResponsePromise = Promise.allSettled(requests);
195
+ sendResponsePromise.then(resolve);
196
+ });
197
+ }
198
+ else {
199
+ const requests = copy.map(async (message) => {
200
+ (0, messaging_internal_1.validateMessage)(message);
201
+ const request = { message };
202
+ if (dryRun) {
203
+ request.validate_only = true;
204
+ }
205
+ return this.messagingRequestHandler.invokeHttpRequestHandlerForSendResponse(FCM_SEND_HOST, urlPath, request);
206
+ });
207
+ return Promise.allSettled(requests);
208
+ }
205
209
  })
210
+ .then(this.parseSendResponses)
206
211
  .finally(() => {
207
- if (http2SessionHandler) {
208
- http2SessionHandler.close();
212
+ http2SessionHandler?.close();
213
+ });
214
+ }
215
+ parseSendResponses(results) {
216
+ const responses = [];
217
+ results.forEach(result => {
218
+ if (result.status === 'fulfilled') {
219
+ responses.push(result.value);
220
+ }
221
+ else { // rejected
222
+ responses.push({ success: false, error: result.reason });
209
223
  }
210
224
  });
225
+ const successCount = responses.filter((resp) => resp.success).length;
226
+ return {
227
+ responses,
228
+ successCount,
229
+ failureCount: responses.length - successCount,
230
+ };
211
231
  }
212
232
  /**
213
233
  * Sends the given multicast message to all the FCM registration tokens
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2018 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2018 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2018 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2018 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2024 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2024 Google Inc.
4
4
  *
@@ -204,13 +204,13 @@ const MAX_LENGTH = 5;
204
204
  function compareSemanticVersions(actualValue, targetValue, predicateFn) {
205
205
  const version1 = String(actualValue).split('.').map(Number);
206
206
  const version2 = targetValue.split('.').map(Number);
207
+ if (version1.length > MAX_LENGTH || version2.length > MAX_LENGTH) {
208
+ return false;
209
+ }
207
210
  for (let i = 0; i < MAX_LENGTH; i++) {
208
211
  // Check to see if segments are present. Note that these may be present and be NaN.
209
212
  const version1HasSegment = version1[i] !== undefined;
210
213
  const version2HasSegment = version2[i] !== undefined;
211
- // If both are undefined, we've consumed everything and they're equal.
212
- if (!version1HasSegment && !version2HasSegment)
213
- return predicateFn(0);
214
214
  // Insert zeros if undefined for easier comparison.
215
215
  if (!version1HasSegment)
216
216
  version1[i] = 0;
@@ -225,5 +225,6 @@ function compareSemanticVersions(actualValue, targetValue, predicateFn) {
225
225
  if (version1[i] > version2[i])
226
226
  return predicateFn(1);
227
227
  }
228
- return false;
228
+ // If this point is reached, the semantic versions are equal.
229
+ return predicateFn(0);
229
230
  }
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -21,8 +21,8 @@
21
21
  */
22
22
  import { App } from '../app';
23
23
  import { RemoteConfig } from './remote-config';
24
- export { AndCondition, CustomSignalCondition, CustomSignalOperator, DefaultConfig, EvaluationContext, ExplicitParameterValue, GetServerTemplateOptions, InAppDefaultValue, InitServerTemplateOptions, ListVersionsOptions, ListVersionsResult, MicroPercentRange, NamedCondition, OneOfCondition, OrCondition, ParameterValueType, PercentConditionOperator, PercentCondition, PredefinedSignals, RemoteConfigCondition, RemoteConfigParameter, RemoteConfigParameterGroup, RemoteConfigParameterValue, RemoteConfigTemplate, RemoteConfigUser, ServerConfig, ServerTemplate, ServerTemplateData, ServerTemplateDataType, TagColor, UserProvidedSignals, Value, ValueSource, Version, } from './remote-config-api';
25
- export { RemoteConfig } from './remote-config';
24
+ export { AndCondition, CustomSignalCondition, CustomSignalOperator, DefaultConfig, EvaluationContext, ExplicitParameterValue, FetchResponseData, GetServerTemplateOptions, InAppDefaultValue, InitServerTemplateOptions, ListVersionsOptions, ListVersionsResult, MicroPercentRange, NamedCondition, OneOfCondition, OrCondition, ParameterValueType, PercentConditionOperator, PercentCondition, PredefinedSignals, RemoteConfigCondition, RemoteConfigParameter, RemoteConfigParameterGroup, RemoteConfigParameterValue, RemoteConfigTemplate, RemoteConfigUser, ServerConfig, ServerTemplate, ServerTemplateData, ServerTemplateDataType, TagColor, UserProvidedSignals, Value, ValueSource, Version, } from './remote-config-api';
25
+ export { RemoteConfig, RemoteConfigFetchResponse } from './remote-config';
26
26
  /**
27
27
  * Gets the {@link RemoteConfig} service for the default app or a given app.
28
28
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.RemoteConfig = exports.PercentConditionOperator = exports.CustomSignalOperator = void 0;
19
+ exports.RemoteConfigFetchResponse = exports.RemoteConfig = exports.PercentConditionOperator = exports.CustomSignalOperator = void 0;
20
20
  exports.getRemoteConfig = getRemoteConfig;
21
21
  /**
22
22
  * Firebase Remote Config.
@@ -30,6 +30,7 @@ Object.defineProperty(exports, "CustomSignalOperator", { enumerable: true, get:
30
30
  Object.defineProperty(exports, "PercentConditionOperator", { enumerable: true, get: function () { return remote_config_api_1.PercentConditionOperator; } });
31
31
  var remote_config_2 = require("./remote-config");
32
32
  Object.defineProperty(exports, "RemoteConfig", { enumerable: true, get: function () { return remote_config_2.RemoteConfig; } });
33
+ Object.defineProperty(exports, "RemoteConfigFetchResponse", { enumerable: true, get: function () { return remote_config_2.RemoteConfigFetchResponse; } });
33
34
  /**
34
35
  * Gets the {@link RemoteConfig} service for the default app or a given app.
35
36
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2024 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2024 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -627,6 +627,40 @@ export interface ServerConfig {
627
627
  * @returns The value for the given key.
628
628
  */
629
629
  getValue(key: string): Value;
630
+ /**
631
+ * Returns all config values.
632
+ *
633
+ * @returns A map of all config keys to their values.
634
+ */
635
+ getAll(): {
636
+ [key: string]: Value;
637
+ };
638
+ }
639
+ /**
640
+ * JSON-serializable representation of evaluated config values. This can be consumed by
641
+ * Remote Config web client SDKs.
642
+ */
643
+ export interface FetchResponseData {
644
+ /**
645
+ * The HTTP status, which is useful for differentiating success responses with data from
646
+ * those without.
647
+ *
648
+ * This use of 200 and 304 response codes is consistent with Remote Config's server
649
+ * implementation.
650
+ */
651
+ status: number;
652
+ /**
653
+ * Defines the ETag response header value. Only defined for 200 and 304 responses.
654
+ *
655
+ * This is consistent with Remote Config's server eTag implementation.
656
+ */
657
+ eTag?: string;
658
+ /**
659
+ * Defines the map of parameters returned as "entries" in the fetch response body.
660
+ */
661
+ config?: {
662
+ [key: string]: string;
663
+ };
630
664
  }
631
665
  /**
632
666
  * Wraps a parameter value with metadata and type-safe getters.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { App } from '../app';
18
- import { ListVersionsOptions, ListVersionsResult, ServerTemplate, RemoteConfigTemplate, GetServerTemplateOptions, InitServerTemplateOptions } from './remote-config-api';
18
+ import { ListVersionsOptions, ListVersionsResult, ServerTemplate, RemoteConfigTemplate, ServerConfig, GetServerTemplateOptions, InitServerTemplateOptions, FetchResponseData } from './remote-config-api';
19
19
  /**
20
20
  * The Firebase `RemoteConfig` service interface.
21
21
  */
@@ -101,3 +101,21 @@ export declare class RemoteConfig {
101
101
  */
102
102
  initServerTemplate(options?: InitServerTemplateOptions): ServerTemplate;
103
103
  }
104
+ /**
105
+ * Represents a fetch response that can be used to interact with RC's client SDK.
106
+ */
107
+ export declare class RemoteConfigFetchResponse {
108
+ private response;
109
+ /**
110
+ * @param app - The app for this RemoteConfig service.
111
+ * @param serverConfig - The server config for which to generate a fetch response.
112
+ * @param requestEtag - A request eTag with which to compare the current response.
113
+ */
114
+ constructor(app: App, serverConfig: ServerConfig, requestEtag?: string);
115
+ /**
116
+ * @returns JSON representation of the fetch response that can be consumed
117
+ * by the RC client SDK.
118
+ */
119
+ toJSON(): FetchResponseData;
120
+ private processEtag;
121
+ }
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -16,7 +16,8 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.RemoteConfig = void 0;
19
+ exports.RemoteConfigFetchResponse = exports.RemoteConfig = void 0;
20
+ const utils = require("../utils/index");
20
21
  const validator = require("../utils/validator");
21
22
  const remote_config_api_client_internal_1 = require("./remote-config-api-client-internal");
22
23
  const condition_evaluator_internal_1 = require("./condition-evaluator-internal");
@@ -351,6 +352,9 @@ class ServerConfigImpl {
351
352
  getValue(key) {
352
353
  return this.configValues[key] || new value_impl_1.ValueImpl('static');
353
354
  }
355
+ getAll() {
356
+ return { ...this.configValues };
357
+ }
354
358
  }
355
359
  /**
356
360
  * Remote Config dataplane template data implementation.
@@ -470,3 +474,56 @@ class VersionImpl {
470
474
  return validator.isNonEmptyString(timestamp) && (new Date(timestamp)).getTime() > 0;
471
475
  }
472
476
  }
477
+ const HTTP_NOT_MODIFIED = 304;
478
+ const HTTP_OK = 200;
479
+ /**
480
+ * Represents a fetch response that can be used to interact with RC's client SDK.
481
+ */
482
+ class RemoteConfigFetchResponse {
483
+ /**
484
+ * @param app - The app for this RemoteConfig service.
485
+ * @param serverConfig - The server config for which to generate a fetch response.
486
+ * @param requestEtag - A request eTag with which to compare the current response.
487
+ */
488
+ constructor(app, serverConfig, requestEtag) {
489
+ const config = {};
490
+ for (const [param, value] of Object.entries(serverConfig.getAll())) {
491
+ config[param] = value.asString();
492
+ }
493
+ const currentEtag = this.processEtag(config, app);
494
+ if (currentEtag === requestEtag) {
495
+ this.response = {
496
+ status: HTTP_NOT_MODIFIED,
497
+ eTag: currentEtag,
498
+ };
499
+ }
500
+ else {
501
+ this.response = {
502
+ status: HTTP_OK,
503
+ eTag: currentEtag,
504
+ config,
505
+ };
506
+ }
507
+ }
508
+ /**
509
+ * @returns JSON representation of the fetch response that can be consumed
510
+ * by the RC client SDK.
511
+ */
512
+ toJSON() {
513
+ return this.response;
514
+ }
515
+ processEtag(config, app) {
516
+ const configJson = JSON.stringify(config);
517
+ let hash = 0;
518
+ // Mimics Java's `String.hashCode()` which is used in RC's servers.
519
+ for (let i = 0; i < configJson.length; i++) {
520
+ const char = configJson.charCodeAt(i);
521
+ hash = (hash << 5) - hash + char;
522
+ hash |= 0;
523
+ }
524
+ const projectId = utils.getExplicitProjectId(app);
525
+ const parts = ['etag', projectId, 'firebase-server', 'fetch', hash];
526
+ return parts.filter(a => !!a).join('-');
527
+ }
528
+ }
529
+ exports.RemoteConfigFetchResponse = RemoteConfigFetchResponse;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v13.1.0 */
1
+ /*! firebase-admin v13.3.0 */
2
2
  /*!
3
3
  * Copyright 2019 Google Inc.
4
4
  *