firebase-admin 9.100.0-alpha.0 → 10.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/lib/app/core.d.ts +15 -22
- package/lib/app/core.js +1 -1
- package/lib/app/credential-factory.d.ts +17 -33
- package/lib/app/credential-factory.js +17 -33
- package/lib/app/credential-internal.d.ts +10 -9
- package/lib/app/credential-internal.js +15 -13
- package/lib/app/credential.d.ts +3 -9
- package/lib/app/credential.js +1 -1
- package/lib/app/firebase-app.d.ts +6 -30
- package/lib/app/firebase-app.js +72 -216
- package/lib/app/firebase-namespace.d.ts +28 -34
- package/lib/app/firebase-namespace.js +119 -99
- package/lib/app/index.d.ts +6 -1
- package/lib/app/index.js +1 -1
- package/lib/app/lifecycle.d.ts +24 -3
- package/lib/app/lifecycle.js +119 -25
- package/lib/app-check/app-check-api-client-internal.d.ts +32 -0
- package/lib/app-check/app-check-api-client-internal.js +197 -0
- package/lib/app-check/app-check-api.d.ts +95 -0
- package/lib/app-check/app-check-api.js +19 -0
- package/lib/app-check/app-check-namespace.d.ts +65 -0
- package/lib/app-check/app-check-namespace.js +18 -0
- package/lib/app-check/app-check.d.ts +49 -0
- package/lib/app-check/app-check.js +82 -0
- package/lib/app-check/index.d.ts +53 -0
- package/lib/app-check/index.js +63 -0
- package/lib/app-check/token-generator.d.ts +25 -0
- package/lib/app-check/token-generator.js +159 -0
- package/lib/app-check/token-verifier.d.ts +17 -0
- package/lib/app-check/token-verifier.js +151 -0
- package/lib/auth/action-code-settings-builder.d.ts +1 -1
- package/lib/auth/action-code-settings-builder.js +2 -2
- package/lib/auth/auth-api-request.d.ts +28 -32
- package/lib/auth/auth-api-request.js +167 -125
- package/lib/auth/auth-config.d.ts +123 -21
- package/lib/auth/auth-config.js +85 -34
- package/lib/auth/auth-namespace.d.ts +157 -4
- package/lib/auth/auth-namespace.js +1 -1
- package/lib/auth/auth.d.ts +5 -3
- package/lib/auth/auth.js +6 -4
- package/lib/auth/base-auth.d.ts +134 -116
- package/lib/auth/base-auth.js +213 -143
- package/lib/auth/identifier.d.ts +5 -5
- package/lib/auth/identifier.js +1 -1
- package/lib/auth/index.d.ts +10 -5
- package/lib/auth/index.js +9 -4
- package/lib/auth/tenant-manager.d.ts +19 -19
- package/lib/auth/tenant-manager.js +21 -25
- package/lib/auth/tenant.d.ts +14 -5
- package/lib/auth/tenant.js +19 -11
- package/lib/auth/token-generator.d.ts +7 -108
- package/lib/auth/token-generator.js +52 -145
- package/lib/auth/token-verifier.d.ts +3 -4
- package/lib/auth/token-verifier.js +96 -145
- package/lib/auth/user-import-builder.d.ts +11 -11
- package/lib/auth/user-import-builder.js +9 -9
- package/lib/auth/user-record.d.ts +23 -15
- package/lib/auth/user-record.js +30 -20
- package/lib/credential/index.d.ts +18 -35
- package/lib/credential/index.js +17 -33
- package/lib/database/database-namespace.d.ts +39 -10
- package/lib/database/database-namespace.js +1 -1
- package/lib/database/database.d.ts +16 -6
- package/lib/database/database.js +61 -6
- package/lib/database/index.d.ts +19 -18
- package/lib/database/index.js +21 -23
- package/lib/default-namespace.d.ts +7 -1
- package/lib/default-namespace.js +4 -4
- package/lib/esm/app/index.js +10 -0
- package/lib/esm/app-check/index.js +4 -0
- package/lib/esm/auth/index.js +14 -0
- package/lib/esm/database/index.js +6 -0
- package/lib/esm/firestore/index.js +24 -0
- package/lib/esm/installations/index.js +4 -0
- package/lib/esm/instance-id/index.js +4 -0
- package/lib/esm/machine-learning/index.js +5 -0
- package/lib/esm/messaging/index.js +4 -0
- package/lib/esm/package.json +1 -0
- package/lib/esm/project-management/index.js +8 -0
- package/lib/esm/remote-config/index.js +4 -0
- package/lib/esm/security-rules/index.js +6 -0
- package/lib/esm/storage/index.js +4 -0
- package/lib/firebase-namespace-api.d.ts +12 -6
- package/lib/firebase-namespace-api.js +5 -1
- package/lib/firestore/firestore-internal.d.ts +2 -2
- package/lib/firestore/firestore-internal.js +2 -2
- package/lib/firestore/firestore-namespace.d.ts +6 -1
- package/lib/firestore/firestore-namespace.js +2 -1
- package/lib/firestore/index.d.ts +36 -4
- package/lib/firestore/index.js +29 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/installations/index.d.ts +52 -0
- package/lib/installations/index.js +62 -0
- package/lib/installations/installations-namespace.d.ts +55 -0
- package/lib/installations/installations-namespace.js +18 -0
- package/lib/{instance-id/instance-id-request-internal.d.ts → installations/installations-request-handler.d.ts} +8 -8
- package/lib/{instance-id/instance-id-request-internal.js → installations/installations-request-handler.js} +23 -23
- package/lib/installations/installations.d.ts +38 -0
- package/lib/installations/installations.js +63 -0
- package/lib/instance-id/index.d.ts +20 -9
- package/lib/instance-id/index.js +20 -9
- package/lib/instance-id/instance-id-namespace.d.ts +9 -8
- package/lib/instance-id/instance-id-namespace.js +1 -1
- package/lib/instance-id/instance-id.d.ts +8 -6
- package/lib/instance-id/instance-id.js +20 -11
- package/lib/machine-learning/index.d.ts +29 -27
- package/lib/machine-learning/index.js +29 -27
- package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
- package/lib/machine-learning/machine-learning-api-client.js +4 -4
- package/lib/machine-learning/machine-learning-namespace.d.ts +33 -8
- package/lib/machine-learning/machine-learning-namespace.js +1 -1
- package/lib/machine-learning/machine-learning-utils.d.ts +1 -1
- package/lib/machine-learning/machine-learning-utils.js +1 -1
- package/lib/machine-learning/machine-learning.d.ts +19 -19
- package/lib/machine-learning/machine-learning.js +20 -20
- package/lib/messaging/batch-request-internal.d.ts +3 -3
- package/lib/messaging/batch-request-internal.js +9 -9
- package/lib/messaging/index.d.ts +11 -9
- package/lib/messaging/index.js +11 -9
- package/lib/messaging/messaging-api-request-internal.d.ts +8 -8
- package/lib/messaging/messaging-api-request-internal.js +8 -8
- package/lib/messaging/messaging-api.d.ts +79 -75
- package/lib/messaging/messaging-api.js +1 -1
- package/lib/messaging/messaging-errors-internal.d.ts +5 -5
- package/lib/messaging/messaging-errors-internal.js +7 -7
- package/lib/messaging/messaging-internal.d.ts +1 -1
- package/lib/messaging/messaging-internal.js +6 -31
- package/lib/messaging/messaging-namespace.d.ts +105 -8
- package/lib/messaging/messaging-namespace.js +1 -1
- package/lib/messaging/messaging.d.ts +70 -86
- package/lib/messaging/messaging.js +76 -89
- package/lib/project-management/android-app.d.ts +11 -12
- package/lib/project-management/android-app.js +13 -14
- package/lib/project-management/app-metadata.d.ts +1 -1
- package/lib/project-management/app-metadata.js +1 -1
- package/lib/project-management/index.d.ts +11 -9
- package/lib/project-management/index.js +11 -9
- package/lib/project-management/ios-app.d.ts +6 -7
- package/lib/project-management/ios-app.js +6 -7
- package/lib/project-management/project-management-api-request-internal.d.ts +1 -80
- package/lib/project-management/project-management-api-request-internal.js +14 -14
- package/lib/project-management/project-management-namespace.d.ts +31 -9
- package/lib/project-management/project-management-namespace.js +1 -1
- package/lib/project-management/project-management.d.ts +18 -21
- package/lib/project-management/project-management.js +19 -22
- package/lib/remote-config/index.d.ts +12 -10
- package/lib/remote-config/index.js +11 -9
- package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
- package/lib/remote-config/remote-config-api-client-internal.js +2 -2
- package/lib/remote-config/remote-config-api.d.ts +12 -2
- package/lib/remote-config/remote-config-api.js +1 -1
- package/lib/remote-config/remote-config-namespace.d.ts +50 -9
- package/lib/remote-config/remote-config-namespace.js +1 -1
- package/lib/remote-config/remote-config.d.ts +19 -21
- package/lib/remote-config/remote-config.js +25 -25
- package/lib/security-rules/index.d.ts +12 -10
- package/lib/security-rules/index.js +12 -10
- package/lib/security-rules/security-rules-api-client-internal.d.ts +1 -1
- package/lib/security-rules/security-rules-api-client-internal.js +1 -1
- package/lib/security-rules/security-rules-internal.d.ts +1 -1
- package/lib/security-rules/security-rules-internal.js +1 -1
- package/lib/security-rules/security-rules-namespace.d.ts +43 -28
- package/lib/security-rules/security-rules-namespace.js +1 -1
- package/lib/security-rules/security-rules.d.ts +39 -42
- package/lib/security-rules/security-rules.js +38 -39
- package/lib/storage/index.d.ts +9 -7
- package/lib/storage/index.js +9 -7
- package/lib/storage/storage-namespace.d.ts +7 -6
- package/lib/storage/storage-namespace.js +1 -1
- package/lib/storage/storage.d.ts +3 -3
- package/lib/storage/storage.js +14 -4
- package/lib/utils/api-request.d.ts +24 -24
- package/lib/utils/api-request.js +25 -25
- package/lib/utils/crypto-signer.d.ts +128 -0
- package/lib/utils/crypto-signer.js +237 -0
- package/lib/utils/deep-copy.d.ts +6 -6
- package/lib/utils/deep-copy.js +6 -6
- package/lib/utils/error.d.ts +69 -36
- package/lib/utils/error.js +98 -43
- package/lib/utils/index.d.ts +30 -19
- package/lib/utils/index.js +47 -20
- package/lib/utils/jwt.d.ts +131 -0
- package/lib/utils/jwt.js +355 -0
- package/lib/utils/validator.d.ts +37 -37
- package/lib/utils/validator.js +37 -37
- package/package.json +126 -53
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
2
|
/*!
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2021 Google Inc.
|
|
@@ -36,19 +36,19 @@ export interface ConditionMessage extends BaseMessage {
|
|
|
36
36
|
condition: string;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
* Payload for the
|
|
39
|
+
* Payload for the {@link Messaging.send} operation. The payload contains all the fields
|
|
40
40
|
* in the BaseMessage type, and exactly one of token, topic or condition.
|
|
41
41
|
*/
|
|
42
42
|
export declare type Message = TokenMessage | TopicMessage | ConditionMessage;
|
|
43
43
|
/**
|
|
44
|
-
* Payload for the
|
|
44
|
+
* Payload for the {@link Messaging.sendMulticast} method. The payload contains all the fields
|
|
45
45
|
* in the BaseMessage type, and a list of tokens.
|
|
46
46
|
*/
|
|
47
47
|
export interface MulticastMessage extends BaseMessage {
|
|
48
48
|
tokens: string[];
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
-
* A notification that can be included in {@link
|
|
51
|
+
* A notification that can be included in {@link Message}.
|
|
52
52
|
*/
|
|
53
53
|
export interface Notification {
|
|
54
54
|
/**
|
|
@@ -75,13 +75,13 @@ export interface FcmOptions {
|
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* Represents the WebPush protocol options that can be included in an
|
|
78
|
-
* {@link
|
|
78
|
+
* {@link Message}.
|
|
79
79
|
*/
|
|
80
80
|
export interface WebpushConfig {
|
|
81
81
|
/**
|
|
82
82
|
* A collection of WebPush headers. Header values must be strings.
|
|
83
83
|
*
|
|
84
|
-
* See
|
|
84
|
+
* See {@link https://tools.ietf.org/html/rfc8030#section-5 | WebPush specification}
|
|
85
85
|
* for supported headers.
|
|
86
86
|
*/
|
|
87
87
|
headers?: {
|
|
@@ -114,9 +114,9 @@ export interface WebpushFcmOptions {
|
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
116
|
* Represents the WebPush-specific notification options that can be included in
|
|
117
|
-
* {@link
|
|
117
|
+
* {@link WebpushConfig}. This supports most of the standard
|
|
118
118
|
* options as defined in the Web Notification
|
|
119
|
-
*
|
|
119
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/notification/Notification | specification}.
|
|
120
120
|
*/
|
|
121
121
|
export interface WebpushNotification {
|
|
122
122
|
/**
|
|
@@ -207,9 +207,9 @@ export interface WebpushNotification {
|
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
209
209
|
* Represents the APNs-specific options that can be included in an
|
|
210
|
-
* {@link
|
|
211
|
-
*
|
|
212
|
-
* for various headers and payload fields supported by APNs.
|
|
210
|
+
* {@link Message}. Refer to
|
|
211
|
+
* {@link https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html |
|
|
212
|
+
* Apple documentation} for various headers and payload fields supported by APNs.
|
|
213
213
|
*/
|
|
214
214
|
export interface ApnsConfig {
|
|
215
215
|
/**
|
|
@@ -239,8 +239,8 @@ export interface ApnsPayload {
|
|
|
239
239
|
[customData: string]: any;
|
|
240
240
|
}
|
|
241
241
|
/**
|
|
242
|
-
* Represents the
|
|
243
|
-
* that is part of APNs messages.
|
|
242
|
+
* Represents the {@link https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html |
|
|
243
|
+
* aps dictionary} that is part of APNs messages.
|
|
244
244
|
*/
|
|
245
245
|
export interface Aps {
|
|
246
246
|
/**
|
|
@@ -325,7 +325,7 @@ export interface ApnsFcmOptions {
|
|
|
325
325
|
}
|
|
326
326
|
/**
|
|
327
327
|
* Represents the Android-specific options that can be included in an
|
|
328
|
-
* {@link
|
|
328
|
+
* {@link Message}.
|
|
329
329
|
*/
|
|
330
330
|
export interface AndroidConfig {
|
|
331
331
|
/**
|
|
@@ -351,7 +351,7 @@ export interface AndroidConfig {
|
|
|
351
351
|
/**
|
|
352
352
|
* A collection of data fields to be included in the message. All values must
|
|
353
353
|
* be strings. When provided, overrides any data fields set on the top-level
|
|
354
|
-
*
|
|
354
|
+
* {@link Message}.
|
|
355
355
|
*/
|
|
356
356
|
data?: {
|
|
357
357
|
[key: string]: string;
|
|
@@ -367,7 +367,7 @@ export interface AndroidConfig {
|
|
|
367
367
|
}
|
|
368
368
|
/**
|
|
369
369
|
* Represents the Android-specific notification options that can be included in
|
|
370
|
-
* {@link
|
|
370
|
+
* {@link AndroidConfig}.
|
|
371
371
|
*/
|
|
372
372
|
export interface AndroidNotification {
|
|
373
373
|
/**
|
|
@@ -460,7 +460,8 @@ export interface AndroidNotification {
|
|
|
460
460
|
* Sets whether or not this notification is relevant only to the current device.
|
|
461
461
|
* Some notifications can be bridged to other devices for remote display, such as
|
|
462
462
|
* a Wear OS watch. This hint can be set to recommend this notification not be bridged.
|
|
463
|
-
* See
|
|
463
|
+
* See {@link https://developer.android.com/training/wearables/notifications/bridger#existing-method-of-preventing-bridging |
|
|
464
|
+
* Wear OS guides}.
|
|
464
465
|
*/
|
|
465
466
|
localOnly?: boolean;
|
|
466
467
|
/**
|
|
@@ -482,14 +483,15 @@ export interface AndroidNotification {
|
|
|
482
483
|
vibrateTimingsMillis?: number[];
|
|
483
484
|
/**
|
|
484
485
|
* If set to `true`, use the Android framework's default vibrate pattern for the
|
|
485
|
-
* notification. Default values are specified in
|
|
486
|
-
* If `default_vibrate_timings` is set to `true` and `vibrate_timings` is also set,
|
|
486
|
+
* notification. Default values are specified in {@link https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml |
|
|
487
|
+
* config.xml}. If `default_vibrate_timings` is set to `true` and `vibrate_timings` is also set,
|
|
487
488
|
* the default value is used instead of the user-specified `vibrate_timings`.
|
|
488
489
|
*/
|
|
489
490
|
defaultVibrateTimings?: boolean;
|
|
490
491
|
/**
|
|
491
492
|
* If set to `true`, use the Android framework's default sound for the notification.
|
|
492
|
-
* Default values are specified in
|
|
493
|
+
* Default values are specified in {@link https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml |
|
|
494
|
+
* config.xml}.
|
|
493
495
|
*/
|
|
494
496
|
defaultSound?: boolean;
|
|
495
497
|
/**
|
|
@@ -499,7 +501,8 @@ export interface AndroidNotification {
|
|
|
499
501
|
lightSettings?: LightSettings;
|
|
500
502
|
/**
|
|
501
503
|
* If set to `true`, use the Android framework's default LED light settings
|
|
502
|
-
* for the notification. Default values are specified in
|
|
504
|
+
* for the notification. Default values are specified in {@link https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml |
|
|
505
|
+
* config.xml}.
|
|
503
506
|
* If `default_light_settings` is set to `true` and `light_settings` is also set,
|
|
504
507
|
* the user-specified `light_settings` is used instead of the default value.
|
|
505
508
|
*/
|
|
@@ -511,7 +514,8 @@ export interface AndroidNotification {
|
|
|
511
514
|
visibility?: ('private' | 'public' | 'secret');
|
|
512
515
|
/**
|
|
513
516
|
* Sets the number of items this notification represents. May be displayed as a
|
|
514
|
-
* badge count for Launchers that support badging. See
|
|
517
|
+
* badge count for Launchers that support badging. See {@link https://developer.android.com/training/notify-user/badges |
|
|
518
|
+
* NotificationBadge}.
|
|
515
519
|
* For example, this might be useful if you're using just one notification to
|
|
516
520
|
* represent multiple new messages but you want the count here to represent
|
|
517
521
|
* the number of total new messages. If zero or unspecified, systems
|
|
@@ -522,7 +526,7 @@ export interface AndroidNotification {
|
|
|
522
526
|
}
|
|
523
527
|
/**
|
|
524
528
|
* Represents settings to control notification LED that can be included in
|
|
525
|
-
* {@link
|
|
529
|
+
* {@link AndroidNotification}.
|
|
526
530
|
*/
|
|
527
531
|
export interface LightSettings {
|
|
528
532
|
/**
|
|
@@ -553,10 +557,12 @@ export interface AndroidFcmOptions {
|
|
|
553
557
|
* keys and values must both be strings. Keys can be any custom string,
|
|
554
558
|
* except for the following reserved strings:
|
|
555
559
|
*
|
|
556
|
-
*
|
|
557
|
-
*
|
|
560
|
+
* <ul>
|
|
561
|
+
* <li><code>from</code></li>
|
|
562
|
+
* <li>Anything starting with <code>google.</code></li>
|
|
563
|
+
* </ul>
|
|
558
564
|
*
|
|
559
|
-
* See
|
|
565
|
+
* See {@link https://firebase.google.com/docs/cloud-messaging/send-message | Build send requests}
|
|
560
566
|
* for code samples and detailed documentation.
|
|
561
567
|
*/
|
|
562
568
|
export interface DataMessagePayload {
|
|
@@ -567,7 +573,7 @@ export interface DataMessagePayload {
|
|
|
567
573
|
* Notification messages let developers send up to 4KB of predefined
|
|
568
574
|
* key-value pairs. Accepted keys are outlined below.
|
|
569
575
|
*
|
|
570
|
-
* See
|
|
576
|
+
* See {@link https://firebase.google.com/docs/cloud-messaging/send-message | Build send requests}
|
|
571
577
|
* for code samples and detailed documentation.
|
|
572
578
|
*/
|
|
573
579
|
export interface NotificationMessagePayload {
|
|
@@ -636,13 +642,14 @@ export interface NotificationMessagePayload {
|
|
|
636
642
|
* the body text to the user's current localization.
|
|
637
643
|
*
|
|
638
644
|
* **iOS:** Corresponds to `loc-key` in the APNs payload. See
|
|
639
|
-
*
|
|
640
|
-
* and
|
|
641
|
-
*
|
|
642
|
-
* for more information.
|
|
645
|
+
* {@link https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html |
|
|
646
|
+
* Payload Key Reference} and
|
|
647
|
+
* {@link https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW9 |
|
|
648
|
+
* Localizing the Content of Your Remote Notifications} for more information.
|
|
643
649
|
*
|
|
644
650
|
* **Android:** See
|
|
645
|
-
*
|
|
651
|
+
* {@link http://developer.android.com/guide/topics/resources/string-resource.html | String Resources}
|
|
652
|
+
* for more information.
|
|
646
653
|
*
|
|
647
654
|
* **Platforms:** iOS, Android
|
|
648
655
|
*/
|
|
@@ -655,14 +662,14 @@ export interface NotificationMessagePayload {
|
|
|
655
662
|
* The value should be a stringified JSON array.
|
|
656
663
|
*
|
|
657
664
|
* **iOS:** Corresponds to `loc-args` in the APNs payload. See
|
|
658
|
-
*
|
|
659
|
-
* and
|
|
660
|
-
*
|
|
661
|
-
* for more information.
|
|
665
|
+
* {@link https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html |
|
|
666
|
+
* Payload Key Reference} and
|
|
667
|
+
* {@link https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW9 |
|
|
668
|
+
* Localizing the Content of Your Remote Notifications} for more information.
|
|
662
669
|
*
|
|
663
670
|
* **Android:** See
|
|
664
|
-
*
|
|
665
|
-
* for more information.
|
|
671
|
+
* {@link http://developer.android.com/guide/topics/resources/string-resource.html#FormattingAndStyling |
|
|
672
|
+
* Formatting and Styling} for more information.
|
|
666
673
|
*
|
|
667
674
|
* **Platforms:** iOS, Android
|
|
668
675
|
*/
|
|
@@ -680,13 +687,13 @@ export interface NotificationMessagePayload {
|
|
|
680
687
|
* the title text to the user's current localization.
|
|
681
688
|
*
|
|
682
689
|
* **iOS:** Corresponds to `title-loc-key` in the APNs payload. See
|
|
683
|
-
*
|
|
684
|
-
* and
|
|
685
|
-
*
|
|
686
|
-
* for more information.
|
|
690
|
+
* {@link https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html |
|
|
691
|
+
* Payload Key Reference} and
|
|
692
|
+
* {@link https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW9 |
|
|
693
|
+
* Localizing the Content of Your Remote Notifications} for more information.
|
|
687
694
|
*
|
|
688
695
|
* **Android:** See
|
|
689
|
-
*
|
|
696
|
+
* {@link http://developer.android.com/guide/topics/resources/string-resource.html | String Resources}
|
|
690
697
|
* for more information.
|
|
691
698
|
*
|
|
692
699
|
* **Platforms:** iOS, Android
|
|
@@ -700,14 +707,14 @@ export interface NotificationMessagePayload {
|
|
|
700
707
|
* The value should be a stringified JSON array.
|
|
701
708
|
*
|
|
702
709
|
* **iOS:** Corresponds to `title-loc-args` in the APNs payload. See
|
|
703
|
-
*
|
|
704
|
-
* and
|
|
705
|
-
*
|
|
706
|
-
* for more information.
|
|
710
|
+
* {@link https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html |
|
|
711
|
+
* Payload Key Reference} and
|
|
712
|
+
* {@link https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW9 |
|
|
713
|
+
* Localizing the Content of Your Remote Notifications} for more information.
|
|
707
714
|
*
|
|
708
715
|
* **Android:** See
|
|
709
|
-
*
|
|
710
|
-
* for more information.
|
|
716
|
+
* {@link http://developer.android.com/guide/topics/resources/string-resource.html#FormattingAndStyling |
|
|
717
|
+
* Formatting and Styling} for more information.
|
|
711
718
|
*
|
|
712
719
|
* **Platforms:** iOS, Android
|
|
713
720
|
*/
|
|
@@ -718,8 +725,7 @@ export interface NotificationMessagePayload {
|
|
|
718
725
|
* Interface representing a Firebase Cloud Messaging message payload. One or
|
|
719
726
|
* both of the `data` and `notification` keys are required.
|
|
720
727
|
*
|
|
721
|
-
* See
|
|
722
|
-
* [Build send requests](/docs/cloud-messaging/send-message)
|
|
728
|
+
* See {@link https://firebase.google.com/docs/cloud-messaging/send-message | Build send requests}
|
|
723
729
|
* for code samples and detailed documentation.
|
|
724
730
|
*/
|
|
725
731
|
export interface MessagingPayload {
|
|
@@ -736,7 +742,7 @@ export interface MessagingPayload {
|
|
|
736
742
|
* Interface representing the options that can be provided when sending a
|
|
737
743
|
* message via the FCM legacy APIs.
|
|
738
744
|
*
|
|
739
|
-
* See
|
|
745
|
+
* See {@link https://firebase.google.com/docs/cloud-messaging/send-message | Build send requests}
|
|
740
746
|
* for code samples and detailed documentation.
|
|
741
747
|
*/
|
|
742
748
|
export interface MessagingOptions {
|
|
@@ -762,7 +768,8 @@ export interface MessagingOptions {
|
|
|
762
768
|
* app can wake a sleeping device and open a network connection to your server.
|
|
763
769
|
*
|
|
764
770
|
* For more information, see
|
|
765
|
-
*
|
|
771
|
+
* {@link https://firebase.google.com/docs/cloud-messaging/concept-options#setting-the-priority-of-a-message |
|
|
772
|
+
* Setting the priority of a message}.
|
|
766
773
|
*
|
|
767
774
|
* **Default value:** `"high"` for notification messages, `"normal"` for data
|
|
768
775
|
* messages
|
|
@@ -772,7 +779,7 @@ export interface MessagingOptions {
|
|
|
772
779
|
* How long (in seconds) the message should be kept in FCM storage if the device
|
|
773
780
|
* is offline. The maximum time to live supported is four weeks, and the default
|
|
774
781
|
* value is also four weeks. For more information, see
|
|
775
|
-
*
|
|
782
|
+
* {@link https://firebase.google.com/docs/cloud-messaging/concept-options#ttl | Setting the lifespan of a message}.
|
|
776
783
|
*
|
|
777
784
|
* **Default value:** `2419200` (representing four weeks, in seconds)
|
|
778
785
|
*/
|
|
@@ -797,7 +804,8 @@ export interface MessagingOptions {
|
|
|
797
804
|
* On iOS, use this field to represent `mutable-content` in the APNs payload.
|
|
798
805
|
* When a notification is sent and this is set to `true`, the content of the
|
|
799
806
|
* notification can be modified before it is displayed, using a
|
|
800
|
-
*
|
|
807
|
+
* {@link https://developer.apple.com/reference/usernotifications/unnotificationserviceextension |
|
|
808
|
+
* Notification Service app extension}.
|
|
801
809
|
*
|
|
802
810
|
* On Android and Web, this parameter will be ignored.
|
|
803
811
|
*
|
|
@@ -843,8 +851,8 @@ export interface MessagingDeviceResult {
|
|
|
843
851
|
* via the FCM legacy APIs.
|
|
844
852
|
*
|
|
845
853
|
* See
|
|
846
|
-
*
|
|
847
|
-
* for code samples and detailed documentation.
|
|
854
|
+
* {@link https://firebase.google.com/docs/cloud-messaging/admin/send-messages#send_to_individual_devices |
|
|
855
|
+
* Send to individual devices} for code samples and detailed documentation.
|
|
848
856
|
*/
|
|
849
857
|
export interface MessagingDevicesResponse {
|
|
850
858
|
canonicalRegistrationTokenCount: number;
|
|
@@ -854,13 +862,12 @@ export interface MessagingDevicesResponse {
|
|
|
854
862
|
successCount: number;
|
|
855
863
|
}
|
|
856
864
|
/**
|
|
857
|
-
* Interface representing the server response from the
|
|
858
|
-
* {@link messaging.Messaging.sendToDeviceGroup `sendToDeviceGroup()`}
|
|
865
|
+
* Interface representing the server response from the {@link Messaging.sendToDeviceGroup}
|
|
859
866
|
* method.
|
|
860
867
|
*
|
|
861
868
|
* See
|
|
862
|
-
*
|
|
863
|
-
* for code samples and detailed documentation.
|
|
869
|
+
* {@link https://firebase.google.com/docs/cloud-messaging/send-message?authuser=0#send_messages_to_device_groups |
|
|
870
|
+
* Send messages to device groups} for code samples and detailed documentation.
|
|
864
871
|
*/
|
|
865
872
|
export interface MessagingDeviceGroupResponse {
|
|
866
873
|
/**
|
|
@@ -877,12 +884,11 @@ export interface MessagingDeviceGroupResponse {
|
|
|
877
884
|
failedRegistrationTokens: string[];
|
|
878
885
|
}
|
|
879
886
|
/**
|
|
880
|
-
* Interface representing the server response from the legacy
|
|
881
|
-
* {@link messaging.Messaging.sendToTopic `sendToTopic()`} method.
|
|
887
|
+
* Interface representing the server response from the legacy {@link Messaging.sendToTopic} method.
|
|
882
888
|
*
|
|
883
889
|
* See
|
|
884
|
-
*
|
|
885
|
-
* for code samples and detailed documentation.
|
|
890
|
+
* {@link https://firebase.google.com/docs/cloud-messaging/admin/send-messages#send_to_a_topic |
|
|
891
|
+
* Send to a topic} for code samples and detailed documentation.
|
|
886
892
|
*/
|
|
887
893
|
export interface MessagingTopicResponse {
|
|
888
894
|
/**
|
|
@@ -893,11 +899,11 @@ export interface MessagingTopicResponse {
|
|
|
893
899
|
}
|
|
894
900
|
/**
|
|
895
901
|
* Interface representing the server response from the legacy
|
|
896
|
-
* {@link
|
|
902
|
+
* {@link Messaging.sendToCondition} method.
|
|
897
903
|
*
|
|
898
904
|
* See
|
|
899
|
-
*
|
|
900
|
-
* for code samples and detailed documentation.
|
|
905
|
+
* {@link https://firebase.google.com/docs/cloud-messaging/admin/send-messages#send_to_a_condition |
|
|
906
|
+
* Send to a condition} for code samples and detailed documentation.
|
|
901
907
|
*/
|
|
902
908
|
export interface MessagingConditionResponse {
|
|
903
909
|
/**
|
|
@@ -908,13 +914,12 @@ export interface MessagingConditionResponse {
|
|
|
908
914
|
}
|
|
909
915
|
/**
|
|
910
916
|
* Interface representing the server response from the
|
|
911
|
-
* {@link
|
|
912
|
-
* {@link messaging.Messaging.unsubscribeFromTopic `unsubscribeFromTopic()`}
|
|
917
|
+
* {@link Messaging.subscribeToTopic} and {@link Messaging.unsubscribeFromTopic}
|
|
913
918
|
* methods.
|
|
914
919
|
*
|
|
915
920
|
* See
|
|
916
|
-
*
|
|
917
|
-
* for code samples and detailed documentation.
|
|
921
|
+
* {@link https://firebase.google.com/docs/cloud-messaging/manage-topics |
|
|
922
|
+
* Manage topics from the server} for code samples and detailed documentation.
|
|
918
923
|
*/
|
|
919
924
|
export interface MessagingTopicManagementResponse {
|
|
920
925
|
/**
|
|
@@ -929,14 +934,13 @@ export interface MessagingTopicManagementResponse {
|
|
|
929
934
|
successCount: number;
|
|
930
935
|
/**
|
|
931
936
|
* An array of errors corresponding to the provided registration token(s). The
|
|
932
|
-
* length of this array will be equal to
|
|
937
|
+
* length of this array will be equal to {@link MessagingTopicManagementResponse.failureCount}.
|
|
933
938
|
*/
|
|
934
939
|
errors: FirebaseArrayIndexError[];
|
|
935
940
|
}
|
|
936
941
|
/**
|
|
937
942
|
* Interface representing the server response from the
|
|
938
|
-
* {@link
|
|
939
|
-
* {@link messaging.Messaging.sendMulticast `sendMulticast()`} methods.
|
|
943
|
+
* {@link Messaging.sendAll} and {@link Messaging.sendMulticast} methods.
|
|
940
944
|
*/
|
|
941
945
|
export interface BatchResponse {
|
|
942
946
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2019 Google Inc.
|
|
4
4
|
*
|
|
@@ -20,12 +20,12 @@ import { FirebaseMessagingError } from '../utils/error';
|
|
|
20
20
|
* Creates a new FirebaseMessagingError by extracting the error code, message and other relevant
|
|
21
21
|
* details from an HTTP error response.
|
|
22
22
|
*
|
|
23
|
-
* @param
|
|
24
|
-
* @
|
|
23
|
+
* @param err - The HttpError to convert into a Firebase error
|
|
24
|
+
* @returns A Firebase error that can be returned to the user.
|
|
25
25
|
*/
|
|
26
26
|
export declare function createFirebaseError(err: HttpError): FirebaseMessagingError;
|
|
27
27
|
/**
|
|
28
|
-
* @param
|
|
29
|
-
* @
|
|
28
|
+
* @param response - The response to check for errors.
|
|
29
|
+
* @returns The error code if present; null otherwise.
|
|
30
30
|
*/
|
|
31
31
|
export declare function getErrorCode(response: any): string | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2019 Google Inc.
|
|
@@ -23,8 +23,8 @@ var validator = require("../utils/validator");
|
|
|
23
23
|
* Creates a new FirebaseMessagingError by extracting the error code, message and other relevant
|
|
24
24
|
* details from an HTTP error response.
|
|
25
25
|
*
|
|
26
|
-
* @param
|
|
27
|
-
* @
|
|
26
|
+
* @param err - The HttpError to convert into a Firebase error
|
|
27
|
+
* @returns A Firebase error that can be returned to the user.
|
|
28
28
|
*/
|
|
29
29
|
function createFirebaseError(err) {
|
|
30
30
|
if (err.response.isJson()) {
|
|
@@ -62,8 +62,8 @@ function createFirebaseError(err) {
|
|
|
62
62
|
}
|
|
63
63
|
exports.createFirebaseError = createFirebaseError;
|
|
64
64
|
/**
|
|
65
|
-
* @param
|
|
66
|
-
* @
|
|
65
|
+
* @param response - The response to check for errors.
|
|
66
|
+
* @returns The error code if present; null otherwise.
|
|
67
67
|
*/
|
|
68
68
|
function getErrorCode(response) {
|
|
69
69
|
if (validator.isNonNullObject(response) && 'error' in response) {
|
|
@@ -93,8 +93,8 @@ exports.getErrorCode = getErrorCode;
|
|
|
93
93
|
/**
|
|
94
94
|
* Extracts error message from the given response object.
|
|
95
95
|
*
|
|
96
|
-
* @param
|
|
97
|
-
* @
|
|
96
|
+
* @param response - The response to check for errors.
|
|
97
|
+
* @returns The error message if present; null otherwise.
|
|
98
98
|
*/
|
|
99
99
|
function getErrorMessage(response) {
|
|
100
100
|
if (validator.isNonNullObject(response) &&
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2020 Google Inc.
|
|
@@ -315,7 +315,7 @@ function validateApsAlert(alert) {
|
|
|
315
315
|
* and notification fields. If successful, transforms the input object by renaming keys to valid
|
|
316
316
|
* Android keys. Also transforms the ttl value to the format expected by FCM service.
|
|
317
317
|
*
|
|
318
|
-
* @param
|
|
318
|
+
* @param config - An object to be validated.
|
|
319
319
|
*/
|
|
320
320
|
function validateAndroidConfig(config) {
|
|
321
321
|
if (typeof config === 'undefined') {
|
|
@@ -328,7 +328,7 @@ function validateAndroidConfig(config) {
|
|
|
328
328
|
if (!validator.isNumber(config.ttl) || config.ttl < 0) {
|
|
329
329
|
throw new error_1.FirebaseMessagingError(error_1.MessagingClientErrorCode.INVALID_PAYLOAD, 'TTL must be a non-negative duration in milliseconds');
|
|
330
330
|
}
|
|
331
|
-
var duration = transformMillisecondsToSecondsString(config.ttl);
|
|
331
|
+
var duration = index_1.transformMillisecondsToSecondsString(config.ttl);
|
|
332
332
|
config.ttl = duration;
|
|
333
333
|
}
|
|
334
334
|
validateStringMap(config.data, 'android.data');
|
|
@@ -386,7 +386,7 @@ function validateAndroidNotification(notification) {
|
|
|
386
386
|
if (!validator.isNumber(value) || value < 0) {
|
|
387
387
|
throw new error_1.FirebaseMessagingError(error_1.MessagingClientErrorCode.INVALID_PAYLOAD, 'android.notification.vibrateTimingsMillis must be non-negative durations in milliseconds');
|
|
388
388
|
}
|
|
389
|
-
var duration = transformMillisecondsToSecondsString(value);
|
|
389
|
+
var duration = index_1.transformMillisecondsToSecondsString(value);
|
|
390
390
|
vibrateTimings_1.push(duration);
|
|
391
391
|
});
|
|
392
392
|
notification.vibrateTimingsMillis = vibrateTimings_1;
|
|
@@ -437,12 +437,12 @@ function validateLightSettings(lightSettings) {
|
|
|
437
437
|
if (!validator.isNumber(lightSettings.lightOnDurationMillis) || lightSettings.lightOnDurationMillis < 0) {
|
|
438
438
|
throw new error_1.FirebaseMessagingError(error_1.MessagingClientErrorCode.INVALID_PAYLOAD, 'android.notification.lightSettings.lightOnDurationMillis must be a non-negative duration in milliseconds');
|
|
439
439
|
}
|
|
440
|
-
var durationOn = transformMillisecondsToSecondsString(lightSettings.lightOnDurationMillis);
|
|
440
|
+
var durationOn = index_1.transformMillisecondsToSecondsString(lightSettings.lightOnDurationMillis);
|
|
441
441
|
lightSettings.lightOnDurationMillis = durationOn;
|
|
442
442
|
if (!validator.isNumber(lightSettings.lightOffDurationMillis) || lightSettings.lightOffDurationMillis < 0) {
|
|
443
443
|
throw new error_1.FirebaseMessagingError(error_1.MessagingClientErrorCode.INVALID_PAYLOAD, 'android.notification.lightSettings.lightOffDurationMillis must be a non-negative duration in milliseconds');
|
|
444
444
|
}
|
|
445
|
-
var durationOff = transformMillisecondsToSecondsString(lightSettings.lightOffDurationMillis);
|
|
445
|
+
var durationOff = index_1.transformMillisecondsToSecondsString(lightSettings.lightOffDurationMillis);
|
|
446
446
|
lightSettings.lightOffDurationMillis = durationOff;
|
|
447
447
|
if (!validator.isString(lightSettings.color) ||
|
|
448
448
|
(!/^#[0-9a-fA-F]{6}$/.test(lightSettings.color) && !/^#[0-9a-fA-F]{8}$/.test(lightSettings.color))) {
|
|
@@ -482,28 +482,3 @@ function validateAndroidFcmOptions(fcmOptions) {
|
|
|
482
482
|
throw new error_1.FirebaseMessagingError(error_1.MessagingClientErrorCode.INVALID_PAYLOAD, 'analyticsLabel must be a string value');
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
|
-
/**
|
|
486
|
-
* Transforms milliseconds to the format expected by FCM service.
|
|
487
|
-
* Returns the duration in seconds with up to nine fractional
|
|
488
|
-
* digits, terminated by 's'. Example: "3.5s".
|
|
489
|
-
*
|
|
490
|
-
* @param {number} milliseconds The duration in milliseconds.
|
|
491
|
-
* @return {string} The resulting formatted string in seconds with up to nine fractional
|
|
492
|
-
* digits, terminated by 's'.
|
|
493
|
-
*/
|
|
494
|
-
function transformMillisecondsToSecondsString(milliseconds) {
|
|
495
|
-
var duration;
|
|
496
|
-
var seconds = Math.floor(milliseconds / 1000);
|
|
497
|
-
var nanos = (milliseconds - seconds * 1000) * 1000000;
|
|
498
|
-
if (nanos > 0) {
|
|
499
|
-
var nanoString = nanos.toString();
|
|
500
|
-
while (nanoString.length < 9) {
|
|
501
|
-
nanoString = '0' + nanoString;
|
|
502
|
-
}
|
|
503
|
-
duration = seconds + "." + nanoString + "s";
|
|
504
|
-
}
|
|
505
|
-
else {
|
|
506
|
-
duration = seconds + "s";
|
|
507
|
-
}
|
|
508
|
-
return duration;
|
|
509
|
-
}
|