firebase-admin 13.9.0 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/lib/app/core.d.ts +2 -38
- package/lib/app/core.js +1 -1
- package/lib/app/credential-factory.d.ts +1 -1
- package/lib/app/credential-factory.js +1 -1
- package/lib/app/credential-internal.d.ts +1 -1
- package/lib/app/credential-internal.js +48 -17
- package/lib/app/credential.d.ts +1 -1
- package/lib/app/credential.js +1 -1
- package/lib/app/error.d.ts +47 -0
- package/lib/app/error.js +57 -0
- package/lib/app/firebase-app.d.ts +1 -1
- package/lib/app/firebase-app.js +28 -12
- package/lib/app/index.d.ts +4 -3
- package/lib/app/index.js +6 -4
- package/lib/app/lifecycle.d.ts +2 -2
- package/lib/app/lifecycle.js +46 -21
- package/lib/app-check/app-check-api-client-internal.d.ts +2 -16
- package/lib/app-check/app-check-api-client-internal.js +71 -47
- package/lib/app-check/app-check-api.d.ts +19 -1
- package/lib/app-check/app-check-api.js +1 -1
- package/lib/app-check/app-check.d.ts +1 -1
- package/lib/app-check/app-check.js +7 -3
- package/lib/app-check/error.d.ts +47 -0
- package/lib/app-check/error.js +65 -0
- package/lib/app-check/index.d.ts +2 -1
- package/lib/app-check/index.js +5 -2
- package/lib/app-check/token-generator.d.ts +1 -1
- package/lib/app-check/token-generator.js +43 -13
- package/lib/app-check/token-verifier.d.ts +1 -1
- package/lib/app-check/token-verifier.js +39 -11
- package/lib/auth/action-code-settings-builder.d.ts +1 -1
- package/lib/auth/action-code-settings-builder.js +16 -16
- package/lib/auth/auth-api-request.d.ts +6 -4
- package/lib/auth/auth-api-request.js +277 -166
- package/lib/auth/auth-config.d.ts +31 -2
- package/lib/auth/auth-config.js +103 -103
- package/lib/auth/auth.d.ts +1 -1
- package/lib/auth/auth.js +1 -1
- package/lib/auth/base-auth.d.ts +2 -1
- package/lib/auth/base-auth.js +29 -27
- package/lib/auth/error.d.ts +137 -0
- package/lib/auth/error.js +690 -0
- package/lib/auth/identifier.d.ts +1 -1
- package/lib/auth/identifier.js +1 -1
- package/lib/auth/index.d.ts +2 -2
- package/lib/auth/index.js +4 -4
- package/lib/auth/project-config-manager.d.ts +1 -1
- package/lib/auth/project-config-manager.js +1 -1
- package/lib/auth/project-config.d.ts +1 -1
- package/lib/auth/project-config.js +4 -4
- package/lib/auth/tenant-manager.d.ts +2 -1
- package/lib/auth/tenant-manager.js +13 -10
- package/lib/auth/tenant.d.ts +1 -1
- package/lib/auth/tenant.js +7 -7
- package/lib/auth/token-generator.d.ts +1 -1
- package/lib/auth/token-generator.js +13 -13
- package/lib/auth/token-verifier.d.ts +1 -1
- package/lib/auth/token-verifier.js +22 -22
- package/lib/auth/user-import-builder.d.ts +1 -1
- package/lib/auth/user-import-builder.js +22 -22
- package/lib/auth/user-record.d.ts +1 -1
- package/lib/auth/user-record.js +6 -6
- package/lib/credential/index.d.ts +1 -1
- package/lib/credential/index.js +1 -1
- package/lib/data-connect/data-connect-api-client-internal.d.ts +1 -16
- package/lib/data-connect/data-connect-api-client-internal.js +122 -65
- package/lib/data-connect/data-connect-api.d.ts +1 -1
- package/lib/data-connect/data-connect-api.js +1 -1
- package/lib/data-connect/data-connect.d.ts +1 -1
- package/lib/data-connect/data-connect.js +1 -1
- package/lib/data-connect/error.d.ts +47 -0
- package/lib/data-connect/error.js +66 -0
- package/lib/data-connect/index.d.ts +2 -1
- package/lib/data-connect/index.js +5 -2
- package/lib/data-connect/validate-admin-args.d.ts +1 -1
- package/lib/data-connect/validate-admin-args.js +6 -3
- package/lib/database/database.d.ts +1 -1
- package/lib/database/database.js +11 -6
- package/lib/database/error.d.ts +39 -0
- package/lib/database/error.js +49 -0
- package/lib/database/index.d.ts +2 -2
- package/lib/database/index.js +4 -3
- package/lib/esm/app/index.js +2 -1
- package/lib/esm/app-check/index.js +2 -0
- package/lib/esm/auth/index.js +1 -1
- package/lib/esm/data-connect/index.js +2 -0
- package/lib/esm/database/index.js +1 -0
- package/lib/esm/eventarc/index.js +2 -0
- package/lib/esm/extensions/index.js +2 -0
- package/lib/esm/firebase-admin/index.js +13 -0
- package/lib/esm/firestore/index.js +1 -0
- package/lib/esm/functions/index.js +2 -0
- package/lib/esm/installations/index.js +1 -1
- package/lib/esm/machine-learning/index.js +2 -0
- package/lib/esm/messaging/index.js +1 -1
- package/lib/esm/phone-number-verification/index.js +2 -0
- package/lib/esm/project-management/index.js +1 -0
- package/lib/esm/remote-config/index.js +2 -0
- package/lib/esm/security-rules/index.js +2 -0
- package/lib/esm/storage/index.js +2 -0
- package/lib/eventarc/cloudevent.d.ts +1 -1
- package/lib/eventarc/cloudevent.js +1 -1
- package/lib/eventarc/error.d.ts +38 -0
- package/lib/eventarc/error.js +47 -0
- package/lib/eventarc/eventarc-client-internal.d.ts +1 -1
- package/lib/eventarc/eventarc-client-internal.js +24 -9
- package/lib/eventarc/eventarc-utils.d.ts +1 -13
- package/lib/eventarc/eventarc-utils.js +36 -26
- package/lib/eventarc/eventarc.d.ts +1 -1
- package/lib/eventarc/eventarc.js +18 -6
- package/lib/eventarc/index.d.ts +2 -1
- package/lib/eventarc/index.js +5 -2
- package/lib/extensions/error.d.ts +41 -0
- package/lib/extensions/error.js +50 -0
- package/lib/extensions/extensions-api-client-internal.d.ts +1 -13
- package/lib/extensions/extensions-api-client-internal.js +40 -28
- package/lib/extensions/extensions-api.d.ts +1 -1
- package/lib/extensions/extensions-api.js +1 -1
- package/lib/extensions/extensions.d.ts +1 -1
- package/lib/extensions/extensions.js +18 -5
- package/lib/extensions/index.d.ts +2 -1
- package/lib/extensions/index.js +5 -2
- package/lib/firestore/error.d.ts +41 -0
- package/lib/firestore/error.js +51 -0
- package/lib/firestore/firestore-internal.d.ts +2 -1
- package/lib/firestore/firestore-internal.js +6 -6
- package/lib/firestore/index.d.ts +2 -2
- package/lib/firestore/index.js +7 -7
- package/lib/functions/error.d.ts +48 -0
- package/lib/functions/error.js +67 -0
- package/lib/functions/functions-api-client-internal.d.ts +1 -16
- package/lib/functions/functions-api-client-internal.js +111 -71
- package/lib/functions/functions-api.d.ts +1 -1
- package/lib/functions/functions-api.js +1 -1
- package/lib/functions/functions.d.ts +1 -1
- package/lib/functions/functions.js +14 -4
- package/lib/functions/index.d.ts +2 -1
- package/lib/functions/index.js +5 -2
- package/lib/index.d.ts +13 -8
- package/lib/index.js +19 -3
- package/lib/installations/error.d.ts +48 -0
- package/lib/installations/error.js +73 -0
- package/lib/installations/index.d.ts +2 -2
- package/lib/installations/index.js +4 -4
- package/lib/installations/installations-request-handler.d.ts +1 -1
- package/lib/installations/installations-request-handler.js +11 -5
- package/lib/installations/installations.d.ts +1 -1
- package/lib/installations/installations.js +3 -3
- package/lib/machine-learning/error.d.ts +53 -0
- package/lib/machine-learning/error.js +84 -0
- package/lib/machine-learning/index.d.ts +2 -1
- package/lib/machine-learning/index.js +5 -2
- package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
- package/lib/machine-learning/machine-learning-api-client.js +61 -24
- package/lib/machine-learning/machine-learning.d.ts +1 -1
- package/lib/machine-learning/machine-learning.js +21 -9
- package/lib/messaging/error.d.ts +63 -0
- package/lib/messaging/error.js +286 -0
- package/lib/messaging/index.d.ts +3 -3
- package/lib/messaging/index.js +4 -4
- package/lib/messaging/messaging-api-request-internal.d.ts +1 -1
- package/lib/messaging/messaging-api-request-internal.js +1 -1
- package/lib/messaging/messaging-api.d.ts +1 -280
- package/lib/messaging/messaging-api.js +1 -1
- package/lib/messaging/messaging-errors-internal.d.ts +2 -2
- package/lib/messaging/messaging-errors-internal.js +11 -8
- package/lib/messaging/messaging-internal.d.ts +1 -1
- package/lib/messaging/messaging-internal.js +48 -48
- package/lib/messaging/messaging.d.ts +1 -1
- package/lib/messaging/messaging.js +47 -50
- package/lib/phone-number-verification/error.d.ts +43 -0
- package/lib/phone-number-verification/error.js +48 -0
- package/lib/phone-number-verification/index.d.ts +2 -1
- package/lib/phone-number-verification/index.js +5 -2
- package/lib/phone-number-verification/phone-number-verification-api-client-internal.d.ts +1 -18
- package/lib/phone-number-verification/phone-number-verification-api-client-internal.js +2 -26
- package/lib/phone-number-verification/phone-number-verification-api.d.ts +2 -2
- package/lib/phone-number-verification/phone-number-verification-api.js +5 -4
- package/lib/phone-number-verification/phone-number-verification.d.ts +1 -1
- package/lib/phone-number-verification/phone-number-verification.js +1 -1
- package/lib/phone-number-verification/token-verifier.d.ts +1 -1
- package/lib/phone-number-verification/token-verifier.js +68 -20
- package/lib/project-management/android-app.d.ts +1 -1
- package/lib/project-management/android-app.js +15 -6
- package/lib/project-management/app-metadata.d.ts +1 -1
- package/lib/project-management/app-metadata.js +1 -1
- package/lib/project-management/error.d.ts +45 -0
- package/lib/project-management/error.js +55 -0
- package/lib/project-management/index.d.ts +2 -2
- package/lib/project-management/index.js +4 -3
- package/lib/project-management/ios-app.d.ts +1 -1
- package/lib/project-management/ios-app.js +6 -3
- package/lib/project-management/project-management-api-request-internal.d.ts +1 -1
- package/lib/project-management/project-management-api-request-internal.js +18 -6
- package/lib/project-management/project-management.d.ts +1 -1
- package/lib/project-management/project-management.js +13 -7
- package/lib/remote-config/condition-evaluator-internal.d.ts +1 -1
- package/lib/remote-config/condition-evaluator-internal.js +4 -4
- package/lib/remote-config/error.d.ts +49 -0
- package/lib/remote-config/error.js +70 -0
- package/lib/remote-config/index.d.ts +2 -1
- package/lib/remote-config/index.js +5 -2
- package/lib/remote-config/internal/value-impl.d.ts +1 -1
- package/lib/remote-config/internal/value-impl.js +1 -1
- package/lib/remote-config/remote-config-api-client-internal.d.ts +2 -13
- package/lib/remote-config/remote-config-api-client-internal.js +80 -52
- package/lib/remote-config/remote-config-api.d.ts +1 -1
- package/lib/remote-config/remote-config-api.js +1 -1
- package/lib/remote-config/remote-config.d.ts +1 -1
- package/lib/remote-config/remote-config.js +92 -23
- package/lib/security-rules/error.d.ts +45 -0
- package/lib/security-rules/error.js +54 -0
- package/lib/security-rules/index.d.ts +2 -1
- package/lib/security-rules/index.js +5 -2
- package/lib/security-rules/security-rules-api-client-internal.d.ts +1 -1
- package/lib/security-rules/security-rules-api-client-internal.js +50 -18
- package/lib/security-rules/security-rules.d.ts +1 -1
- package/lib/security-rules/security-rules.js +32 -11
- package/lib/storage/error.d.ts +41 -0
- package/lib/storage/error.js +50 -0
- package/lib/storage/index.d.ts +2 -1
- package/lib/storage/index.js +8 -5
- package/lib/storage/storage.d.ts +1 -1
- package/lib/storage/storage.js +12 -12
- package/lib/storage/utils.d.ts +1 -1
- package/lib/storage/utils.js +1 -1
- package/lib/utils/api-request.d.ts +12 -12
- package/lib/utils/api-request.js +97 -55
- package/lib/utils/crypto-signer.d.ts +1 -1
- package/lib/utils/crypto-signer.js +2 -7
- package/lib/utils/deep-copy.d.ts +1 -1
- package/lib/utils/deep-copy.js +1 -1
- package/lib/utils/error.d.ts +75 -570
- package/lib/utils/error.js +53 -1047
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +2 -2
- package/lib/utils/jwt.d.ts +1 -1
- package/lib/utils/jwt.js +1 -2
- package/lib/utils/validator.d.ts +1 -1
- package/lib/utils/validator.js +1 -1
- package/package.json +25 -33
- package/lib/app/firebase-namespace.d.ts +0 -163
- package/lib/app/firebase-namespace.js +0 -335
- package/lib/app-check/app-check-namespace.d.ts +0 -72
- package/lib/app-check/app-check-namespace.js +0 -18
- package/lib/auth/auth-namespace.d.ts +0 -257
- package/lib/auth/auth-namespace.js +0 -18
- package/lib/database/database-namespace.d.ts +0 -95
- package/lib/database/database-namespace.js +0 -23
- package/lib/default-namespace.d.ts +0 -24
- package/lib/default-namespace.js +0 -30
- package/lib/esm/instance-id/index.js +0 -6
- package/lib/firebase-namespace-api.d.ts +0 -91
- package/lib/firebase-namespace-api.js +0 -58
- package/lib/firestore/firestore-namespace.d.ts +0 -71
- package/lib/firestore/firestore-namespace.js +0 -52
- package/lib/installations/installations-namespace.d.ts +0 -55
- package/lib/installations/installations-namespace.js +0 -18
- package/lib/instance-id/index.d.ts +0 -62
- package/lib/instance-id/index.js +0 -74
- package/lib/instance-id/instance-id-namespace.d.ts +0 -38
- package/lib/instance-id/instance-id-namespace.js +0 -3
- package/lib/instance-id/instance-id.d.ts +0 -47
- package/lib/instance-id/instance-id.js +0 -77
- package/lib/machine-learning/machine-learning-namespace.d.ts +0 -81
- package/lib/machine-learning/machine-learning-namespace.js +0 -18
- package/lib/machine-learning/machine-learning-utils.d.ts +0 -22
- package/lib/machine-learning/machine-learning-utils.js +0 -47
- package/lib/messaging/messaging-namespace.d.ts +0 -161
- package/lib/messaging/messaging-namespace.js +0 -18
- package/lib/project-management/project-management-namespace.d.ts +0 -82
- package/lib/project-management/project-management-namespace.js +0 -18
- package/lib/remote-config/remote-config-namespace.d.ts +0 -141
- package/lib/remote-config/remote-config-namespace.js +0 -18
- package/lib/security-rules/security-rules-internal.d.ts +0 -21
- package/lib/security-rules/security-rules-internal.js +0 -26
- package/lib/security-rules/security-rules-namespace.d.ts +0 -69
- package/lib/security-rules/security-rules-namespace.js +0 -18
- package/lib/storage/storage-namespace.d.ts +0 -45
- package/lib/storage/storage-namespace.js +0 -18
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
|
+
"use strict";
|
|
3
|
+
/*!
|
|
4
|
+
* Copyright 2026 Google LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.FirebaseMessagingError = exports.messagingClientErrorCode = exports.MessagingErrorCode = void 0;
|
|
20
|
+
const error_1 = require("../utils/error");
|
|
21
|
+
const deep_copy_1 = require("../utils/deep-copy");
|
|
22
|
+
/**
|
|
23
|
+
* The constant mapping for valid Messaging client error codes.
|
|
24
|
+
*/
|
|
25
|
+
exports.MessagingErrorCode = {
|
|
26
|
+
INVALID_ARGUMENT: 'invalid-argument',
|
|
27
|
+
INVALID_RECIPIENT: 'invalid-recipient',
|
|
28
|
+
INVALID_PAYLOAD: 'invalid-payload',
|
|
29
|
+
INVALID_DATA_PAYLOAD_KEY: 'invalid-data-payload-key',
|
|
30
|
+
PAYLOAD_SIZE_LIMIT_EXCEEDED: 'payload-size-limit-exceeded',
|
|
31
|
+
INVALID_OPTIONS: 'invalid-options',
|
|
32
|
+
INVALID_REGISTRATION_TOKEN: 'invalid-registration-token',
|
|
33
|
+
REGISTRATION_TOKEN_NOT_REGISTERED: 'registration-token-not-registered',
|
|
34
|
+
MISMATCHED_CREDENTIAL: 'mismatched-credential',
|
|
35
|
+
INVALID_PACKAGE_NAME: 'invalid-package-name',
|
|
36
|
+
DEVICE_MESSAGE_RATE_EXCEEDED: 'device-message-rate-exceeded',
|
|
37
|
+
TOPICS_MESSAGE_RATE_EXCEEDED: 'topics-message-rate-exceeded',
|
|
38
|
+
TOPICS_SUBSCRIPTION_RATE_EXCEEDED: 'topics-subscription-rate-exceeded',
|
|
39
|
+
MESSAGE_RATE_EXCEEDED: 'message-rate-exceeded',
|
|
40
|
+
THIRD_PARTY_AUTH_ERROR: 'third-party-auth-error',
|
|
41
|
+
TOO_MANY_TOPICS: 'too-many-topics',
|
|
42
|
+
AUTHENTICATION_ERROR: 'authentication-error',
|
|
43
|
+
SERVER_UNAVAILABLE: 'server-unavailable',
|
|
44
|
+
INTERNAL_ERROR: 'internal-error',
|
|
45
|
+
UNKNOWN_ERROR: 'unknown-error',
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Internal Messaging client error code mapping used to construct ErrorInfo.
|
|
49
|
+
*/
|
|
50
|
+
exports.messagingClientErrorCode = {
|
|
51
|
+
INVALID_ARGUMENT: {
|
|
52
|
+
code: exports.MessagingErrorCode.INVALID_ARGUMENT,
|
|
53
|
+
message: 'Invalid argument provided.',
|
|
54
|
+
},
|
|
55
|
+
INVALID_RECIPIENT: {
|
|
56
|
+
code: exports.MessagingErrorCode.INVALID_RECIPIENT,
|
|
57
|
+
message: 'Invalid message recipient provided.',
|
|
58
|
+
},
|
|
59
|
+
INVALID_PAYLOAD: {
|
|
60
|
+
code: exports.MessagingErrorCode.INVALID_PAYLOAD,
|
|
61
|
+
message: 'Invalid message payload provided.',
|
|
62
|
+
},
|
|
63
|
+
INVALID_DATA_PAYLOAD_KEY: {
|
|
64
|
+
code: exports.MessagingErrorCode.INVALID_DATA_PAYLOAD_KEY,
|
|
65
|
+
message: 'The data message payload contains an invalid key. See the reference ' +
|
|
66
|
+
'documentation for the DataMessagePayload type for restricted keys.',
|
|
67
|
+
},
|
|
68
|
+
PAYLOAD_SIZE_LIMIT_EXCEEDED: {
|
|
69
|
+
code: exports.MessagingErrorCode.PAYLOAD_SIZE_LIMIT_EXCEEDED,
|
|
70
|
+
message: 'The provided message payload exceeds the FCM size limits. See the ' +
|
|
71
|
+
'error documentation for more details.',
|
|
72
|
+
},
|
|
73
|
+
INVALID_OPTIONS: {
|
|
74
|
+
code: exports.MessagingErrorCode.INVALID_OPTIONS,
|
|
75
|
+
message: 'Invalid message options provided.',
|
|
76
|
+
},
|
|
77
|
+
INVALID_REGISTRATION_TOKEN: {
|
|
78
|
+
code: exports.MessagingErrorCode.INVALID_REGISTRATION_TOKEN,
|
|
79
|
+
message: 'Invalid registration token provided. Make sure it matches the ' +
|
|
80
|
+
'registration token the client app receives from registering with FCM.',
|
|
81
|
+
},
|
|
82
|
+
REGISTRATION_TOKEN_NOT_REGISTERED: {
|
|
83
|
+
code: exports.MessagingErrorCode.REGISTRATION_TOKEN_NOT_REGISTERED,
|
|
84
|
+
message: 'The provided registration token is not registered. A ' +
|
|
85
|
+
'previously valid registration token can be unregistered for a variety of reasons. See the ' +
|
|
86
|
+
'error documentation for more details. Remove this registration token and stop using it to ' +
|
|
87
|
+
'send messages.',
|
|
88
|
+
},
|
|
89
|
+
MISMATCHED_CREDENTIAL: {
|
|
90
|
+
code: exports.MessagingErrorCode.MISMATCHED_CREDENTIAL,
|
|
91
|
+
message: 'The credential used to authenticate this SDK does not have permission ' +
|
|
92
|
+
'to send messages to the device corresponding to the provided registration token. Make sure the ' +
|
|
93
|
+
'credential and registration token both belong to the same Firebase project.',
|
|
94
|
+
},
|
|
95
|
+
INVALID_PACKAGE_NAME: {
|
|
96
|
+
code: exports.MessagingErrorCode.INVALID_PACKAGE_NAME,
|
|
97
|
+
message: 'The message was addressed to a registration token whose package name does ' +
|
|
98
|
+
'not match the provided "restrictedPackageName" option.',
|
|
99
|
+
},
|
|
100
|
+
DEVICE_MESSAGE_RATE_EXCEEDED: {
|
|
101
|
+
code: exports.MessagingErrorCode.DEVICE_MESSAGE_RATE_EXCEEDED,
|
|
102
|
+
message: 'The rate of messages to a particular device is too high. Reduce ' +
|
|
103
|
+
'the number of messages sent to this device and do not immediately retry sending to this device.',
|
|
104
|
+
},
|
|
105
|
+
TOPICS_MESSAGE_RATE_EXCEEDED: {
|
|
106
|
+
code: exports.MessagingErrorCode.TOPICS_MESSAGE_RATE_EXCEEDED,
|
|
107
|
+
message: 'The rate of messages to subscribers to a particular topic is too ' +
|
|
108
|
+
'high. Reduce the number of messages sent for this topic, and do not immediately retry sending ' +
|
|
109
|
+
'to this topic.',
|
|
110
|
+
},
|
|
111
|
+
TOPICS_SUBSCRIPTION_RATE_EXCEEDED: {
|
|
112
|
+
code: exports.MessagingErrorCode.TOPICS_SUBSCRIPTION_RATE_EXCEEDED,
|
|
113
|
+
message: 'The rate of subscription management requests to a particular topic is too ' +
|
|
114
|
+
'high. Reduce the number of requests sent for this topic, and do not immediately retry the ' +
|
|
115
|
+
'request.',
|
|
116
|
+
},
|
|
117
|
+
MESSAGE_RATE_EXCEEDED: {
|
|
118
|
+
code: exports.MessagingErrorCode.MESSAGE_RATE_EXCEEDED,
|
|
119
|
+
message: 'Sending limit exceeded for the message target.',
|
|
120
|
+
},
|
|
121
|
+
THIRD_PARTY_AUTH_ERROR: {
|
|
122
|
+
code: exports.MessagingErrorCode.THIRD_PARTY_AUTH_ERROR,
|
|
123
|
+
message: 'A message targeted to an iOS device could not be sent because the ' +
|
|
124
|
+
'required APNs SSL certificate was not uploaded or has expired. Check the validity of your ' +
|
|
125
|
+
'development and production certificates.',
|
|
126
|
+
},
|
|
127
|
+
TOO_MANY_TOPICS: {
|
|
128
|
+
code: exports.MessagingErrorCode.TOO_MANY_TOPICS,
|
|
129
|
+
message: 'The maximum number of topics the provided registration token can be ' +
|
|
130
|
+
'subscribed to has been exceeded.',
|
|
131
|
+
},
|
|
132
|
+
AUTHENTICATION_ERROR: {
|
|
133
|
+
code: exports.MessagingErrorCode.AUTHENTICATION_ERROR,
|
|
134
|
+
message: 'An error occurred when trying to authenticate to the FCM servers. Make ' +
|
|
135
|
+
'sure the credential used to authenticate this SDK has the proper permissions. See ' +
|
|
136
|
+
'https://firebase.google.com/docs/admin/setup for setup instructions.',
|
|
137
|
+
},
|
|
138
|
+
SERVER_UNAVAILABLE: {
|
|
139
|
+
code: exports.MessagingErrorCode.SERVER_UNAVAILABLE,
|
|
140
|
+
message: 'The FCM server could not process the request in time. See the error ' +
|
|
141
|
+
'documentation for more details.',
|
|
142
|
+
},
|
|
143
|
+
INTERNAL_ERROR: {
|
|
144
|
+
code: exports.MessagingErrorCode.INTERNAL_ERROR,
|
|
145
|
+
message: 'An internal error has occurred. Please retry the request.',
|
|
146
|
+
},
|
|
147
|
+
UNKNOWN_ERROR: {
|
|
148
|
+
code: exports.MessagingErrorCode.UNKNOWN_ERROR,
|
|
149
|
+
message: 'An unknown server error was returned.',
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
/** @const {Record<string, keyof typeof MessagingErrorCode>} Messaging server to client enum error codes. */
|
|
153
|
+
const MESSAGING_SERVER_TO_CLIENT_CODE = {
|
|
154
|
+
/* GENERIC ERRORS */
|
|
155
|
+
// Generic invalid message parameter provided.
|
|
156
|
+
InvalidParameters: 'INVALID_ARGUMENT',
|
|
157
|
+
// Mismatched sender ID.
|
|
158
|
+
MismatchSenderId: 'MISMATCHED_CREDENTIAL',
|
|
159
|
+
// FCM server unavailable.
|
|
160
|
+
Unavailable: 'SERVER_UNAVAILABLE',
|
|
161
|
+
// FCM server internal error.
|
|
162
|
+
InternalServerError: 'INTERNAL_ERROR',
|
|
163
|
+
/* SEND ERRORS */
|
|
164
|
+
// Invalid registration token format.
|
|
165
|
+
InvalidRegistration: 'INVALID_REGISTRATION_TOKEN',
|
|
166
|
+
// Registration token is not registered.
|
|
167
|
+
NotRegistered: 'REGISTRATION_TOKEN_NOT_REGISTERED',
|
|
168
|
+
// Registration token does not match restricted package name.
|
|
169
|
+
InvalidPackageName: 'INVALID_PACKAGE_NAME',
|
|
170
|
+
// Message payload size limit exceeded.
|
|
171
|
+
MessageTooBig: 'PAYLOAD_SIZE_LIMIT_EXCEEDED',
|
|
172
|
+
// Invalid key in the data message payload.
|
|
173
|
+
InvalidDataKey: 'INVALID_DATA_PAYLOAD_KEY',
|
|
174
|
+
// Invalid time to live option.
|
|
175
|
+
InvalidTtl: 'INVALID_OPTIONS',
|
|
176
|
+
// Device message rate exceeded.
|
|
177
|
+
DeviceMessageRateExceeded: 'DEVICE_MESSAGE_RATE_EXCEEDED',
|
|
178
|
+
// Topics message rate exceeded.
|
|
179
|
+
TopicsMessageRateExceeded: 'TOPICS_MESSAGE_RATE_EXCEEDED',
|
|
180
|
+
// Invalid APNs credentials.
|
|
181
|
+
InvalidApnsCredential: 'THIRD_PARTY_AUTH_ERROR',
|
|
182
|
+
/* FCM v1 canonical error codes */
|
|
183
|
+
NOT_FOUND: 'REGISTRATION_TOKEN_NOT_REGISTERED',
|
|
184
|
+
PERMISSION_DENIED: 'MISMATCHED_CREDENTIAL',
|
|
185
|
+
RESOURCE_EXHAUSTED: 'MESSAGE_RATE_EXCEEDED',
|
|
186
|
+
UNAUTHENTICATED: 'THIRD_PARTY_AUTH_ERROR',
|
|
187
|
+
/* FCM v1 new error codes */
|
|
188
|
+
APNS_AUTH_ERROR: 'THIRD_PARTY_AUTH_ERROR',
|
|
189
|
+
INTERNAL: 'INTERNAL_ERROR',
|
|
190
|
+
INVALID_ARGUMENT: 'INVALID_ARGUMENT',
|
|
191
|
+
QUOTA_EXCEEDED: 'MESSAGE_RATE_EXCEEDED',
|
|
192
|
+
SENDER_ID_MISMATCH: 'MISMATCHED_CREDENTIAL',
|
|
193
|
+
THIRD_PARTY_AUTH_ERROR: 'THIRD_PARTY_AUTH_ERROR',
|
|
194
|
+
UNAVAILABLE: 'SERVER_UNAVAILABLE',
|
|
195
|
+
UNREGISTERED: 'REGISTRATION_TOKEN_NOT_REGISTERED',
|
|
196
|
+
UNSPECIFIED_ERROR: 'UNKNOWN_ERROR',
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* @const {Record<string, keyof typeof MessagingErrorCode>} Topic management (IID)
|
|
200
|
+
* server to client enum error codes.
|
|
201
|
+
*/
|
|
202
|
+
const TOPIC_MGT_SERVER_TO_CLIENT_CODE = {
|
|
203
|
+
/* TOPIC SUBSCRIPTION MANAGEMENT ERRORS */
|
|
204
|
+
NOT_FOUND: 'REGISTRATION_TOKEN_NOT_REGISTERED',
|
|
205
|
+
INVALID_ARGUMENT: 'INVALID_REGISTRATION_TOKEN',
|
|
206
|
+
TOO_MANY_TOPICS: 'TOO_MANY_TOPICS',
|
|
207
|
+
RESOURCE_EXHAUSTED: 'TOPICS_SUBSCRIPTION_RATE_EXCEEDED',
|
|
208
|
+
PERMISSION_DENIED: 'AUTHENTICATION_ERROR',
|
|
209
|
+
DEADLINE_EXCEEDED: 'SERVER_UNAVAILABLE',
|
|
210
|
+
INTERNAL: 'INTERNAL_ERROR',
|
|
211
|
+
UNKNOWN: 'UNKNOWN_ERROR',
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Firebase Messaging error code structure. This extends `FirebaseError`.
|
|
215
|
+
*/
|
|
216
|
+
class FirebaseMessagingError extends error_1.FirebaseError {
|
|
217
|
+
/**
|
|
218
|
+
* Creates the developer-facing error corresponding to the backend error code.
|
|
219
|
+
*
|
|
220
|
+
* @param serverErrorCode - The server error code.
|
|
221
|
+
* @param [message] The error message. The default message is used
|
|
222
|
+
* if not provided.
|
|
223
|
+
* @param [serverError] The error's raw server response.
|
|
224
|
+
* @returns The corresponding developer-facing error.
|
|
225
|
+
* @internal
|
|
226
|
+
*/
|
|
227
|
+
static fromServerError(serverErrorCode, message, serverError) {
|
|
228
|
+
// If not found, default to unknown error.
|
|
229
|
+
let clientCodeKey = 'UNKNOWN_ERROR';
|
|
230
|
+
if (serverErrorCode && serverErrorCode in MESSAGING_SERVER_TO_CLIENT_CODE) {
|
|
231
|
+
clientCodeKey = MESSAGING_SERVER_TO_CLIENT_CODE[serverErrorCode];
|
|
232
|
+
}
|
|
233
|
+
const error = (0, deep_copy_1.deepCopy)(exports.messagingClientErrorCode[clientCodeKey]);
|
|
234
|
+
error.message = message || error.message;
|
|
235
|
+
const rawData = serverError?.response?.data;
|
|
236
|
+
if (clientCodeKey === 'UNKNOWN_ERROR' && typeof rawData !== 'undefined') {
|
|
237
|
+
try {
|
|
238
|
+
error.message += ` Raw server response: "${typeof rawData === 'string' ? rawData : JSON.stringify(rawData)}"`;
|
|
239
|
+
}
|
|
240
|
+
catch (e) {
|
|
241
|
+
// Ignore JSON parsing error.
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
error.cause = serverError;
|
|
245
|
+
error.httpResponse = serverError?.response ? (0, error_1.toHttpResponse)(serverError.response) : undefined;
|
|
246
|
+
return new FirebaseMessagingError(error);
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* @internal
|
|
250
|
+
*/
|
|
251
|
+
static fromTopicManagementServerError(serverErrorCode, message, serverError) {
|
|
252
|
+
// If not found, default to unknown error.
|
|
253
|
+
const clientCodeKey = TOPIC_MGT_SERVER_TO_CLIENT_CODE[serverErrorCode] || 'UNKNOWN_ERROR';
|
|
254
|
+
const error = (0, deep_copy_1.deepCopy)(exports.messagingClientErrorCode[clientCodeKey]);
|
|
255
|
+
error.message = message || error.message;
|
|
256
|
+
const rawData = serverError?.response?.data;
|
|
257
|
+
if (clientCodeKey === 'UNKNOWN_ERROR' && typeof rawData !== 'undefined') {
|
|
258
|
+
try {
|
|
259
|
+
error.message += ` Raw server response: "${typeof rawData === 'string' ? rawData : JSON.stringify(rawData)}"`;
|
|
260
|
+
}
|
|
261
|
+
catch (e) {
|
|
262
|
+
// Ignore JSON parsing error.
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
error.cause = serverError;
|
|
266
|
+
error.httpResponse = serverError?.response ? (0, error_1.toHttpResponse)(serverError.response) : undefined;
|
|
267
|
+
return new FirebaseMessagingError(error);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
*
|
|
271
|
+
* @param info - The error code info.
|
|
272
|
+
* @param message - The error message. This will override the default message if provided.
|
|
273
|
+
*/
|
|
274
|
+
constructor(info, message) {
|
|
275
|
+
// Override default message if custom message provided.
|
|
276
|
+
super({
|
|
277
|
+
code: `messaging/${info.code}`,
|
|
278
|
+
message: message || info.message,
|
|
279
|
+
httpResponse: info.httpResponse,
|
|
280
|
+
cause: info.cause,
|
|
281
|
+
});
|
|
282
|
+
/** @internal */
|
|
283
|
+
this.codePrefix = 'messaging';
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
exports.FirebaseMessagingError = FirebaseMessagingError;
|
package/lib/messaging/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2020 Google LLC
|
|
4
4
|
*
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
import { App } from '../app';
|
|
23
23
|
import { Messaging } from './messaging';
|
|
24
24
|
export { Messaging, } from './messaging';
|
|
25
|
-
export { AndroidConfig, AndroidFcmOptions, AndroidNotification, ApnsConfig, ApnsFcmOptions, ApnsPayload, Aps, ApsAlert, BaseMessage, BatchResponse, CriticalSound, ConditionMessage, FcmOptions, LightSettings, Message, MessagingTopicManagementResponse, MulticastMessage, Notification, SendResponse, TokenMessage, TopicMessage, WebpushConfig, WebpushFcmOptions, WebpushNotification,
|
|
25
|
+
export { AndroidConfig, AndroidFcmOptions, AndroidNotification, ApnsConfig, ApnsFcmOptions, ApnsPayload, Aps, ApsAlert, BaseMessage, BatchResponse, CriticalSound, ConditionMessage, FcmOptions, LightSettings, Message, MessagingTopicManagementResponse, MulticastMessage, Notification, SendResponse, TokenMessage, TopicMessage, WebpushConfig, WebpushFcmOptions, WebpushNotification, } from './messaging-api';
|
|
26
26
|
/**
|
|
27
27
|
* Gets the {@link Messaging} service for the default app or a given app.
|
|
28
28
|
*
|
|
@@ -50,4 +50,4 @@ export { AndroidConfig, AndroidFcmOptions, AndroidNotification, ApnsConfig, Apns
|
|
|
50
50
|
* app.
|
|
51
51
|
*/
|
|
52
52
|
export declare function getMessaging(app?: App): Messaging;
|
|
53
|
-
export { FirebaseMessagingError,
|
|
53
|
+
export { FirebaseMessagingError, MessagingErrorCode, } from './error';
|
package/lib/messaging/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2020 Google LLC
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.MessagingErrorCode = exports.FirebaseMessagingError = exports.Messaging = void 0;
|
|
20
20
|
exports.getMessaging = getMessaging;
|
|
21
21
|
/**
|
|
22
22
|
* Firebase Cloud Messaging (FCM).
|
|
@@ -60,6 +60,6 @@ function getMessaging(app) {
|
|
|
60
60
|
const firebaseApp = app;
|
|
61
61
|
return firebaseApp.getOrInitService('messaging', (app) => new messaging_1.Messaging(app));
|
|
62
62
|
}
|
|
63
|
-
var error_1 = require("
|
|
63
|
+
var error_1 = require("./error");
|
|
64
64
|
Object.defineProperty(exports, "FirebaseMessagingError", { enumerable: true, get: function () { return error_1.FirebaseMessagingError; } });
|
|
65
|
-
Object.defineProperty(exports, "
|
|
65
|
+
Object.defineProperty(exports, "MessagingErrorCode", { enumerable: true, get: function () { return error_1.MessagingErrorCode; } });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2021 Google LLC
|
|
@@ -577,285 +577,6 @@ export interface AndroidFcmOptions {
|
|
|
577
577
|
*/
|
|
578
578
|
analyticsLabel?: string;
|
|
579
579
|
}
|
|
580
|
-
/**
|
|
581
|
-
* Interface representing an FCM legacy API data message payload. Data
|
|
582
|
-
* messages let developers send up to 4KB of custom key-value pairs. The
|
|
583
|
-
* keys and values must both be strings. Keys can be any custom string,
|
|
584
|
-
* except for the following reserved strings:
|
|
585
|
-
*
|
|
586
|
-
* <ul>
|
|
587
|
-
* <li><code>from</code></li>
|
|
588
|
-
* <li>Anything starting with <code>google.</code></li>
|
|
589
|
-
* </ul>
|
|
590
|
-
*
|
|
591
|
-
* See {@link https://firebase.google.com/docs/cloud-messaging/send-message | Build send requests}
|
|
592
|
-
* for code samples and detailed documentation.
|
|
593
|
-
*/
|
|
594
|
-
export interface DataMessagePayload {
|
|
595
|
-
[key: string]: string;
|
|
596
|
-
}
|
|
597
|
-
/**
|
|
598
|
-
* Interface representing an FCM legacy API notification message payload.
|
|
599
|
-
* Notification messages let developers send up to 4KB of predefined
|
|
600
|
-
* key-value pairs. Accepted keys are outlined below.
|
|
601
|
-
*
|
|
602
|
-
* See {@link https://firebase.google.com/docs/cloud-messaging/send-message | Build send requests}
|
|
603
|
-
* for code samples and detailed documentation.
|
|
604
|
-
*/
|
|
605
|
-
export interface NotificationMessagePayload {
|
|
606
|
-
/**
|
|
607
|
-
* Identifier used to replace existing notifications in the notification drawer.
|
|
608
|
-
*
|
|
609
|
-
* If not specified, each request creates a new notification.
|
|
610
|
-
*
|
|
611
|
-
* If specified and a notification with the same tag is already being shown,
|
|
612
|
-
* the new notification replaces the existing one in the notification drawer.
|
|
613
|
-
*
|
|
614
|
-
* **Platforms:** Android
|
|
615
|
-
*/
|
|
616
|
-
tag?: string;
|
|
617
|
-
/**
|
|
618
|
-
* The notification's body text.
|
|
619
|
-
*
|
|
620
|
-
* **Platforms:** iOS, Android, Web
|
|
621
|
-
*/
|
|
622
|
-
body?: string;
|
|
623
|
-
/**
|
|
624
|
-
* The notification's icon.
|
|
625
|
-
*
|
|
626
|
-
* **Android:** Sets the notification icon to `myicon` for drawable resource
|
|
627
|
-
* `myicon`. If you don't send this key in the request, FCM displays the
|
|
628
|
-
* launcher icon specified in your app manifest.
|
|
629
|
-
*
|
|
630
|
-
* **Web:** The URL to use for the notification's icon.
|
|
631
|
-
*
|
|
632
|
-
* **Platforms:** Android, Web
|
|
633
|
-
*/
|
|
634
|
-
icon?: string;
|
|
635
|
-
/**
|
|
636
|
-
* The value of the badge on the home screen app icon.
|
|
637
|
-
*
|
|
638
|
-
* If not specified, the badge is not changed.
|
|
639
|
-
*
|
|
640
|
-
* If set to `0`, the badge is removed.
|
|
641
|
-
*
|
|
642
|
-
* **Platforms:** iOS
|
|
643
|
-
*/
|
|
644
|
-
badge?: string;
|
|
645
|
-
/**
|
|
646
|
-
* The notification icon's color, expressed in `#rrggbb` format.
|
|
647
|
-
*
|
|
648
|
-
* **Platforms:** Android
|
|
649
|
-
*/
|
|
650
|
-
color?: string;
|
|
651
|
-
/**
|
|
652
|
-
* The sound to be played when the device receives a notification. Supports
|
|
653
|
-
* "default" for the default notification sound of the device or the filename of a
|
|
654
|
-
* sound resource bundled in the app.
|
|
655
|
-
* Sound files must reside in `/res/raw/`.
|
|
656
|
-
*
|
|
657
|
-
* **Platforms:** Android
|
|
658
|
-
*/
|
|
659
|
-
sound?: string;
|
|
660
|
-
/**
|
|
661
|
-
* The notification's title.
|
|
662
|
-
*
|
|
663
|
-
* **Platforms:** iOS, Android, Web
|
|
664
|
-
*/
|
|
665
|
-
title?: string;
|
|
666
|
-
/**
|
|
667
|
-
* The key to the body string in the app's string resources to use to localize
|
|
668
|
-
* the body text to the user's current localization.
|
|
669
|
-
*
|
|
670
|
-
* **iOS:** Corresponds to `loc-key` in the APNs payload. See
|
|
671
|
-
* {@link https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html |
|
|
672
|
-
* Payload Key Reference} and
|
|
673
|
-
* {@link https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW9 |
|
|
674
|
-
* Localizing the Content of Your Remote Notifications} for more information.
|
|
675
|
-
*
|
|
676
|
-
* **Android:** See
|
|
677
|
-
* {@link http://developer.android.com/guide/topics/resources/string-resource.html | String Resources}
|
|
678
|
-
* for more information.
|
|
679
|
-
*
|
|
680
|
-
* **Platforms:** iOS, Android
|
|
681
|
-
*/
|
|
682
|
-
bodyLocKey?: string;
|
|
683
|
-
/**
|
|
684
|
-
* Variable string values to be used in place of the format specifiers in
|
|
685
|
-
* `body_loc_key` to use to localize the body text to the user's current
|
|
686
|
-
* localization.
|
|
687
|
-
*
|
|
688
|
-
* The value should be a stringified JSON array.
|
|
689
|
-
*
|
|
690
|
-
* **iOS:** Corresponds to `loc-args` in the APNs payload. See
|
|
691
|
-
* {@link https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html |
|
|
692
|
-
* Payload Key Reference} and
|
|
693
|
-
* {@link https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW9 |
|
|
694
|
-
* Localizing the Content of Your Remote Notifications} for more information.
|
|
695
|
-
*
|
|
696
|
-
* **Android:** See
|
|
697
|
-
* {@link http://developer.android.com/guide/topics/resources/string-resource.html#FormattingAndStyling |
|
|
698
|
-
* Formatting and Styling} for more information.
|
|
699
|
-
*
|
|
700
|
-
* **Platforms:** iOS, Android
|
|
701
|
-
*/
|
|
702
|
-
bodyLocArgs?: string;
|
|
703
|
-
/**
|
|
704
|
-
* Action associated with a user click on the notification. If specified, an
|
|
705
|
-
* activity with a matching Intent Filter is launched when a user clicks on the
|
|
706
|
-
* notification.
|
|
707
|
-
*
|
|
708
|
-
* * **Platforms:** Android
|
|
709
|
-
*/
|
|
710
|
-
clickAction?: string;
|
|
711
|
-
/**
|
|
712
|
-
* The key to the title string in the app's string resources to use to localize
|
|
713
|
-
* the title text to the user's current localization.
|
|
714
|
-
*
|
|
715
|
-
* **iOS:** Corresponds to `title-loc-key` in the APNs payload. See
|
|
716
|
-
* {@link https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html |
|
|
717
|
-
* Payload Key Reference} and
|
|
718
|
-
* {@link https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW9 |
|
|
719
|
-
* Localizing the Content of Your Remote Notifications} for more information.
|
|
720
|
-
*
|
|
721
|
-
* **Android:** See
|
|
722
|
-
* {@link http://developer.android.com/guide/topics/resources/string-resource.html | String Resources}
|
|
723
|
-
* for more information.
|
|
724
|
-
*
|
|
725
|
-
* **Platforms:** iOS, Android
|
|
726
|
-
*/
|
|
727
|
-
titleLocKey?: string;
|
|
728
|
-
/**
|
|
729
|
-
* Variable string values to be used in place of the format specifiers in
|
|
730
|
-
* `title_loc_key` to use to localize the title text to the user's current
|
|
731
|
-
* localization.
|
|
732
|
-
*
|
|
733
|
-
* The value should be a stringified JSON array.
|
|
734
|
-
*
|
|
735
|
-
* **iOS:** Corresponds to `title-loc-args` in the APNs payload. See
|
|
736
|
-
* {@link https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html |
|
|
737
|
-
* Payload Key Reference} and
|
|
738
|
-
* {@link https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW9 |
|
|
739
|
-
* Localizing the Content of Your Remote Notifications} for more information.
|
|
740
|
-
*
|
|
741
|
-
* **Android:** See
|
|
742
|
-
* {@link http://developer.android.com/guide/topics/resources/string-resource.html#FormattingAndStyling |
|
|
743
|
-
* Formatting and Styling} for more information.
|
|
744
|
-
*
|
|
745
|
-
* **Platforms:** iOS, Android
|
|
746
|
-
*/
|
|
747
|
-
titleLocArgs?: string;
|
|
748
|
-
[key: string]: string | undefined;
|
|
749
|
-
}
|
|
750
|
-
/**
|
|
751
|
-
* Interface representing a Firebase Cloud Messaging message payload. One or
|
|
752
|
-
* both of the `data` and `notification` keys are required.
|
|
753
|
-
*
|
|
754
|
-
* See {@link https://firebase.google.com/docs/cloud-messaging/send-message | Build send requests}
|
|
755
|
-
* for code samples and detailed documentation.
|
|
756
|
-
*/
|
|
757
|
-
export interface MessagingPayload {
|
|
758
|
-
/**
|
|
759
|
-
* The data message payload.
|
|
760
|
-
*/
|
|
761
|
-
data?: DataMessagePayload;
|
|
762
|
-
/**
|
|
763
|
-
* The notification message payload.
|
|
764
|
-
*/
|
|
765
|
-
notification?: NotificationMessagePayload;
|
|
766
|
-
}
|
|
767
|
-
/**
|
|
768
|
-
* Interface representing the options that can be provided when sending a
|
|
769
|
-
* message via the FCM legacy APIs.
|
|
770
|
-
*
|
|
771
|
-
* See {@link https://firebase.google.com/docs/cloud-messaging/send-message | Build send requests}
|
|
772
|
-
* for code samples and detailed documentation.
|
|
773
|
-
*/
|
|
774
|
-
export interface MessagingOptions {
|
|
775
|
-
/**
|
|
776
|
-
* Whether or not the message should actually be sent. When set to `true`,
|
|
777
|
-
* allows developers to test a request without actually sending a message. When
|
|
778
|
-
* set to `false`, the message will be sent.
|
|
779
|
-
*
|
|
780
|
-
* **Default value:** `false`
|
|
781
|
-
*/
|
|
782
|
-
dryRun?: boolean;
|
|
783
|
-
/**
|
|
784
|
-
* The priority of the message. Valid values are `"normal"` and `"high".` On
|
|
785
|
-
* iOS, these correspond to APNs priorities `5` and `10`.
|
|
786
|
-
*
|
|
787
|
-
* By default, notification messages are sent with high priority, and data
|
|
788
|
-
* messages are sent with normal priority. Normal priority optimizes the client
|
|
789
|
-
* app's battery consumption and should be used unless immediate delivery is
|
|
790
|
-
* required. For messages with normal priority, the app may receive the message
|
|
791
|
-
* with unspecified delay.
|
|
792
|
-
*
|
|
793
|
-
* When a message is sent with high priority, it is sent immediately, and the
|
|
794
|
-
* app can wake a sleeping device and open a network connection to your server.
|
|
795
|
-
*
|
|
796
|
-
* For more information, see
|
|
797
|
-
* {@link https://firebase.google.com/docs/cloud-messaging/concept-options#setting-the-priority-of-a-message |
|
|
798
|
-
* Setting the priority of a message}.
|
|
799
|
-
*
|
|
800
|
-
* **Default value:** `"high"` for notification messages, `"normal"` for data
|
|
801
|
-
* messages
|
|
802
|
-
*/
|
|
803
|
-
priority?: string;
|
|
804
|
-
/**
|
|
805
|
-
* How long (in seconds) the message should be kept in FCM storage if the device
|
|
806
|
-
* is offline. The maximum time to live supported is four weeks, and the default
|
|
807
|
-
* value is also four weeks. For more information, see
|
|
808
|
-
* {@link https://firebase.google.com/docs/cloud-messaging/concept-options#ttl | Setting the lifespan of a message}.
|
|
809
|
-
*
|
|
810
|
-
* **Default value:** `2419200` (representing four weeks, in seconds)
|
|
811
|
-
*/
|
|
812
|
-
timeToLive?: number;
|
|
813
|
-
/**
|
|
814
|
-
* String identifying a group of messages (for example, "Updates Available")
|
|
815
|
-
* that can be collapsed, so that only the last message gets sent when delivery
|
|
816
|
-
* can be resumed. This is used to avoid sending too many of the same messages
|
|
817
|
-
* when the device comes back online or becomes active.
|
|
818
|
-
*
|
|
819
|
-
* There is no guarantee of the order in which messages get sent.
|
|
820
|
-
*
|
|
821
|
-
* A maximum of four different collapse keys is allowed at any given time. This
|
|
822
|
-
* means FCM server can simultaneously store four different
|
|
823
|
-
* send-to-sync messages per client app. If you exceed this number, there is no
|
|
824
|
-
* guarantee which four collapse keys the FCM server will keep.
|
|
825
|
-
*
|
|
826
|
-
* **Default value:** None
|
|
827
|
-
*/
|
|
828
|
-
collapseKey?: string;
|
|
829
|
-
/**
|
|
830
|
-
* On iOS, use this field to represent `mutable-content` in the APNs payload.
|
|
831
|
-
* When a notification is sent and this is set to `true`, the content of the
|
|
832
|
-
* notification can be modified before it is displayed, using a
|
|
833
|
-
* {@link https://developer.apple.com/reference/usernotifications/unnotificationserviceextension |
|
|
834
|
-
* Notification Service app extension}.
|
|
835
|
-
*
|
|
836
|
-
* On Android and Web, this parameter will be ignored.
|
|
837
|
-
*
|
|
838
|
-
* **Default value:** `false`
|
|
839
|
-
*/
|
|
840
|
-
mutableContent?: boolean;
|
|
841
|
-
/**
|
|
842
|
-
* On iOS, use this field to represent `content-available` in the APNs payload.
|
|
843
|
-
* When a notification or data message is sent and this is set to `true`, an
|
|
844
|
-
* inactive client app is awoken. On Android, data messages wake the app by
|
|
845
|
-
* default. On Chrome, this flag is currently not supported.
|
|
846
|
-
*
|
|
847
|
-
* **Default value:** `false`
|
|
848
|
-
*/
|
|
849
|
-
contentAvailable?: boolean;
|
|
850
|
-
/**
|
|
851
|
-
* The package name of the application which the registration tokens must match
|
|
852
|
-
* in order to receive the message.
|
|
853
|
-
*
|
|
854
|
-
* **Default value:** None
|
|
855
|
-
*/
|
|
856
|
-
restrictedPackageName?: string;
|
|
857
|
-
[key: string]: any | undefined;
|
|
858
|
-
}
|
|
859
580
|
/**
|
|
860
581
|
* Interface representing the server response from the
|
|
861
582
|
* {@link Messaging.subscribeToTopic} and {@link Messaging.unsubscribeFromTopic}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v14.0.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
*
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { RequestResponseError } from '../utils/api-request';
|
|
18
|
-
import { FirebaseMessagingError } from '
|
|
18
|
+
import { FirebaseMessagingError } from './error';
|
|
19
19
|
/**
|
|
20
20
|
* Creates a new `FirebaseMessagingError` by extracting the error code, message and other relevant
|
|
21
21
|
* details from a `RequestResponseError` response.
|