firebase-admin 12.6.0 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/lib/app/core.d.ts +1 -2
- package/lib/app/core.js +1 -1
- package/lib/app/credential-factory.d.ts +1 -2
- package/lib/app/credential-factory.js +5 -6
- package/lib/app/credential-internal.d.ts +37 -35
- package/lib/app/credential-internal.js +194 -294
- package/lib/app/credential.d.ts +1 -1
- package/lib/app/credential.js +1 -1
- package/lib/app/firebase-app.d.ts +1 -1
- package/lib/app/firebase-app.js +1 -1
- package/lib/app/firebase-namespace.d.ts +1 -1
- package/lib/app/firebase-namespace.js +1 -1
- package/lib/app/index.d.ts +1 -1
- package/lib/app/index.js +1 -1
- package/lib/app/lifecycle.d.ts +1 -1
- package/lib/app/lifecycle.js +6 -6
- package/lib/app-check/app-check-api-client-internal.d.ts +1 -1
- package/lib/app-check/app-check-api-client-internal.js +1 -1
- package/lib/app-check/app-check-api.d.ts +1 -1
- package/lib/app-check/app-check-api.js +1 -1
- package/lib/app-check/app-check-namespace.d.ts +1 -1
- package/lib/app-check/app-check-namespace.js +1 -1
- package/lib/app-check/app-check.d.ts +1 -1
- package/lib/app-check/app-check.js +1 -1
- package/lib/app-check/index.d.ts +1 -1
- package/lib/app-check/index.js +3 -3
- package/lib/app-check/token-generator.d.ts +1 -1
- package/lib/app-check/token-generator.js +3 -3
- package/lib/app-check/token-verifier.d.ts +1 -1
- package/lib/app-check/token-verifier.js +1 -1
- package/lib/auth/action-code-settings-builder.d.ts +1 -1
- package/lib/auth/action-code-settings-builder.js +1 -1
- package/lib/auth/auth-api-request.d.ts +1 -1
- package/lib/auth/auth-api-request.js +5 -5
- package/lib/auth/auth-config.d.ts +41 -17
- package/lib/auth/auth-config.js +114 -27
- package/lib/auth/auth-namespace.d.ts +1 -1
- package/lib/auth/auth-namespace.js +1 -1
- package/lib/auth/auth.d.ts +1 -1
- package/lib/auth/auth.js +1 -1
- package/lib/auth/base-auth.d.ts +1 -1
- package/lib/auth/base-auth.js +3 -3
- package/lib/auth/identifier.d.ts +1 -1
- package/lib/auth/identifier.js +5 -6
- package/lib/auth/index.d.ts +2 -2
- package/lib/auth/index.js +3 -3
- 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 +8 -8
- package/lib/auth/project-config.js +9 -9
- package/lib/auth/tenant-manager.d.ts +1 -1
- package/lib/auth/tenant-manager.js +1 -1
- package/lib/auth/tenant.d.ts +4 -4
- package/lib/auth/tenant.js +4 -4
- package/lib/auth/token-generator.d.ts +1 -2
- package/lib/auth/token-generator.js +3 -3
- package/lib/auth/token-verifier.d.ts +1 -1
- package/lib/auth/token-verifier.js +5 -5
- package/lib/auth/user-import-builder.d.ts +1 -2
- package/lib/auth/user-import-builder.js +3 -3
- package/lib/auth/user-record.d.ts +1 -1
- package/lib/auth/user-record.js +1 -1
- 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 -1
- package/lib/data-connect/data-connect-api-client-internal.js +1 -1
- 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/index.d.ts +1 -1
- package/lib/data-connect/index.js +3 -3
- package/lib/database/database-namespace.d.ts +1 -1
- package/lib/database/database-namespace.js +1 -1
- package/lib/database/database.d.ts +1 -2
- package/lib/database/database.js +1 -1
- package/lib/database/index.d.ts +1 -1
- package/lib/database/index.js +4 -4
- package/lib/default-namespace.d.ts +1 -1
- package/lib/default-namespace.js +1 -1
- package/lib/eventarc/cloudevent.d.ts +1 -1
- package/lib/eventarc/cloudevent.js +1 -1
- package/lib/eventarc/eventarc-client-internal.d.ts +1 -1
- package/lib/eventarc/eventarc-client-internal.js +1 -1
- package/lib/eventarc/eventarc-utils.d.ts +1 -1
- package/lib/eventarc/eventarc-utils.js +3 -3
- package/lib/eventarc/eventarc.d.ts +1 -1
- package/lib/eventarc/eventarc.js +1 -1
- package/lib/eventarc/index.d.ts +1 -1
- package/lib/eventarc/index.js +3 -3
- package/lib/extensions/extensions-api-client-internal.d.ts +1 -1
- package/lib/extensions/extensions-api-client-internal.js +1 -1
- 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 +1 -1
- package/lib/extensions/index.d.ts +1 -1
- package/lib/extensions/index.js +3 -3
- package/lib/firebase-namespace-api.d.ts +1 -1
- package/lib/firebase-namespace-api.js +1 -1
- package/lib/firestore/firestore-internal.d.ts +1 -1
- package/lib/firestore/firestore-internal.js +3 -3
- package/lib/firestore/firestore-namespace.d.ts +1 -1
- package/lib/firestore/firestore-namespace.js +1 -1
- package/lib/firestore/index.d.ts +1 -1
- package/lib/firestore/index.js +4 -4
- package/lib/functions/functions-api-client-internal.d.ts +1 -1
- package/lib/functions/functions-api-client-internal.js +7 -6
- 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 +1 -1
- package/lib/functions/index.d.ts +1 -1
- package/lib/functions/index.js +3 -3
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/installations/index.d.ts +1 -1
- package/lib/installations/index.js +3 -3
- package/lib/installations/installations-namespace.d.ts +1 -1
- package/lib/installations/installations-namespace.js +1 -1
- package/lib/installations/installations-request-handler.d.ts +1 -1
- package/lib/installations/installations-request-handler.js +1 -1
- package/lib/installations/installations.d.ts +1 -1
- package/lib/installations/installations.js +1 -1
- package/lib/instance-id/index.d.ts +1 -1
- package/lib/instance-id/index.js +3 -3
- package/lib/instance-id/instance-id-namespace.d.ts +1 -1
- package/lib/instance-id/instance-id-namespace.js +1 -1
- package/lib/instance-id/instance-id.d.ts +1 -1
- package/lib/instance-id/instance-id.js +1 -1
- package/lib/machine-learning/index.d.ts +1 -1
- package/lib/machine-learning/index.js +3 -3
- package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
- package/lib/machine-learning/machine-learning-api-client.js +3 -3
- package/lib/machine-learning/machine-learning-namespace.d.ts +1 -1
- 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 +1 -1
- package/lib/machine-learning/machine-learning.js +1 -1
- package/lib/messaging/index.d.ts +2 -2
- package/lib/messaging/index.js +3 -3
- package/lib/messaging/messaging-api-request-internal.d.ts +2 -12
- package/lib/messaging/messaging-api-request-internal.js +4 -38
- package/lib/messaging/messaging-api.d.ts +8 -94
- package/lib/messaging/messaging-api.js +1 -1
- package/lib/messaging/messaging-errors-internal.d.ts +1 -1
- package/lib/messaging/messaging-errors-internal.js +3 -4
- package/lib/messaging/messaging-internal.d.ts +1 -1
- package/lib/messaging/messaging-internal.js +4 -3
- package/lib/messaging/messaging-namespace.d.ts +2 -22
- package/lib/messaging/messaging-namespace.js +1 -1
- package/lib/messaging/messaging.d.ts +3 -149
- package/lib/messaging/messaging.js +2 -539
- package/lib/project-management/android-app.d.ts +1 -1
- package/lib/project-management/android-app.js +1 -1
- 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 +1 -1
- package/lib/project-management/index.js +3 -3
- package/lib/project-management/ios-app.d.ts +1 -1
- package/lib/project-management/ios-app.js +1 -1
- package/lib/project-management/project-management-api-request-internal.d.ts +1 -1
- package/lib/project-management/project-management-api-request-internal.js +3 -3
- package/lib/project-management/project-management-namespace.d.ts +1 -1
- package/lib/project-management/project-management-namespace.js +1 -1
- package/lib/project-management/project-management.d.ts +1 -1
- package/lib/project-management/project-management.js +1 -1
- package/lib/remote-config/condition-evaluator-internal.d.ts +1 -1
- package/lib/remote-config/condition-evaluator-internal.js +6 -14
- package/lib/remote-config/index.d.ts +1 -1
- package/lib/remote-config/index.js +3 -3
- 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 +1 -1
- package/lib/remote-config/remote-config-api-client-internal.js +1 -1
- 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-namespace.d.ts +1 -1
- package/lib/remote-config/remote-config-namespace.js +1 -1
- package/lib/remote-config/remote-config.d.ts +1 -1
- package/lib/remote-config/remote-config.js +1 -1
- package/lib/security-rules/index.d.ts +1 -1
- package/lib/security-rules/index.js +3 -3
- 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 +1 -1
- package/lib/security-rules/security-rules-namespace.js +1 -1
- package/lib/security-rules/security-rules.d.ts +1 -2
- package/lib/security-rules/security-rules.js +1 -1
- package/lib/storage/index.d.ts +1 -1
- package/lib/storage/index.js +4 -4
- package/lib/storage/storage-namespace.d.ts +1 -1
- package/lib/storage/storage-namespace.js +1 -1
- package/lib/storage/storage.d.ts +1 -1
- package/lib/storage/storage.js +1 -1
- package/lib/storage/utils.d.ts +1 -1
- package/lib/storage/utils.js +2 -3
- package/lib/utils/api-request.d.ts +1 -5
- package/lib/utils/api-request.js +23 -8
- package/lib/utils/crypto-signer.d.ts +1 -2
- package/lib/utils/crypto-signer.js +3 -3
- package/lib/utils/deep-copy.d.ts +1 -1
- package/lib/utils/deep-copy.js +3 -4
- package/lib/utils/error.d.ts +1 -1
- package/lib/utils/error.js +1 -1
- package/lib/utils/index.d.ts +2 -2
- package/lib/utils/index.js +19 -16
- package/lib/utils/jwt.d.ts +1 -2
- package/lib/utils/jwt.js +5 -5
- package/lib/utils/validator.d.ts +1 -2
- package/lib/utils/validator.js +20 -21
- package/package.json +14 -13
- package/CHANGELOG.md +0 -4
- package/lib/messaging/batch-request-internal.d.ts +0 -55
- package/lib/messaging/batch-request-internal.js +0 -127
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v13.0.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2017 Google Inc.
|
|
@@ -17,15 +17,13 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { App } from '../app';
|
|
19
19
|
import { Http2SessionHandler } from '../utils/api-request';
|
|
20
|
-
import {
|
|
21
|
-
import { SendResponse, BatchResponse } from './messaging-api';
|
|
20
|
+
import { SendResponse } from './messaging-api';
|
|
22
21
|
/**
|
|
23
22
|
* Class that provides a mechanism to send requests to the Firebase Cloud Messaging backend.
|
|
24
23
|
*/
|
|
25
24
|
export declare class FirebaseMessagingRequestHandler {
|
|
26
25
|
private readonly httpClient;
|
|
27
26
|
private readonly http2Client;
|
|
28
|
-
private readonly batchClient;
|
|
29
27
|
/**
|
|
30
28
|
* @param app - The app used to fetch access tokens to sign API requests.
|
|
31
29
|
* @constructor
|
|
@@ -58,14 +56,6 @@ export declare class FirebaseMessagingRequestHandler {
|
|
|
58
56
|
* @returns A promise that resolves with the {@link SendResponse}.
|
|
59
57
|
*/
|
|
60
58
|
invokeHttp2RequestHandlerForSendResponse(host: string, path: string, requestData: object, http2SessionHandler: Http2SessionHandler): Promise<SendResponse>;
|
|
61
|
-
/**
|
|
62
|
-
* Sends the given array of sub requests as a single batch to FCM, and parses the result into
|
|
63
|
-
* a `BatchResponse` object.
|
|
64
|
-
*
|
|
65
|
-
* @param requests - An array of sub requests to send.
|
|
66
|
-
* @returns A promise that resolves when the send operation is complete.
|
|
67
|
-
*/
|
|
68
|
-
sendBatchRequest(requests: SubRequest[]): Promise<BatchResponse>;
|
|
69
59
|
private buildSendResponse;
|
|
70
60
|
private buildSendResponseFromError;
|
|
71
61
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v13.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -20,17 +20,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
20
|
exports.FirebaseMessagingRequestHandler = void 0;
|
|
21
21
|
const api_request_1 = require("../utils/api-request");
|
|
22
22
|
const messaging_errors_internal_1 = require("./messaging-errors-internal");
|
|
23
|
-
const batch_request_internal_1 = require("./batch-request-internal");
|
|
24
23
|
const index_1 = require("../utils/index");
|
|
25
24
|
// FCM backend constants
|
|
26
25
|
const FIREBASE_MESSAGING_TIMEOUT = 15000;
|
|
27
|
-
const FIREBASE_MESSAGING_BATCH_URL = 'https://fcm.googleapis.com/batch';
|
|
28
26
|
const FIREBASE_MESSAGING_HTTP_METHOD = 'POST';
|
|
29
27
|
const FIREBASE_MESSAGING_HEADERS = {
|
|
30
28
|
'X-Firebase-Client': `fire-admin-node/${(0, index_1.getSdkVersion)()}`,
|
|
31
|
-
};
|
|
32
|
-
const LEGACY_FIREBASE_MESSAGING_HEADERS = {
|
|
33
|
-
'X-Firebase-Client': `fire-admin-node/${(0, index_1.getSdkVersion)()}`,
|
|
34
29
|
'access_token_auth': 'true',
|
|
35
30
|
};
|
|
36
31
|
/**
|
|
@@ -44,7 +39,6 @@ class FirebaseMessagingRequestHandler {
|
|
|
44
39
|
constructor(app) {
|
|
45
40
|
this.httpClient = new api_request_1.AuthorizedHttpClient(app);
|
|
46
41
|
this.http2Client = new api_request_1.AuthorizedHttp2Client(app);
|
|
47
|
-
this.batchClient = new batch_request_internal_1.BatchRequestClient(this.httpClient, FIREBASE_MESSAGING_BATCH_URL, FIREBASE_MESSAGING_HEADERS);
|
|
48
42
|
}
|
|
49
43
|
/**
|
|
50
44
|
* Invokes the request handler with the provided request data.
|
|
@@ -59,7 +53,7 @@ class FirebaseMessagingRequestHandler {
|
|
|
59
53
|
method: FIREBASE_MESSAGING_HTTP_METHOD,
|
|
60
54
|
url: `https://${host}${path}`,
|
|
61
55
|
data: requestData,
|
|
62
|
-
headers:
|
|
56
|
+
headers: FIREBASE_MESSAGING_HEADERS,
|
|
63
57
|
timeout: FIREBASE_MESSAGING_TIMEOUT,
|
|
64
58
|
};
|
|
65
59
|
return this.httpClient.send(request).then((response) => {
|
|
@@ -96,7 +90,7 @@ class FirebaseMessagingRequestHandler {
|
|
|
96
90
|
method: FIREBASE_MESSAGING_HTTP_METHOD,
|
|
97
91
|
url: `https://${host}${path}`,
|
|
98
92
|
data: requestData,
|
|
99
|
-
headers:
|
|
93
|
+
headers: FIREBASE_MESSAGING_HEADERS,
|
|
100
94
|
timeout: FIREBASE_MESSAGING_TIMEOUT,
|
|
101
95
|
};
|
|
102
96
|
return this.httpClient.send(request).then((response) => {
|
|
@@ -123,7 +117,7 @@ class FirebaseMessagingRequestHandler {
|
|
|
123
117
|
method: FIREBASE_MESSAGING_HTTP_METHOD,
|
|
124
118
|
url: `https://${host}${path}`,
|
|
125
119
|
data: requestData,
|
|
126
|
-
headers:
|
|
120
|
+
headers: FIREBASE_MESSAGING_HEADERS,
|
|
127
121
|
timeout: FIREBASE_MESSAGING_TIMEOUT,
|
|
128
122
|
http2SessionHandler: http2SessionHandler
|
|
129
123
|
};
|
|
@@ -138,34 +132,6 @@ class FirebaseMessagingRequestHandler {
|
|
|
138
132
|
throw err;
|
|
139
133
|
});
|
|
140
134
|
}
|
|
141
|
-
/**
|
|
142
|
-
* Sends the given array of sub requests as a single batch to FCM, and parses the result into
|
|
143
|
-
* a `BatchResponse` object.
|
|
144
|
-
*
|
|
145
|
-
* @param requests - An array of sub requests to send.
|
|
146
|
-
* @returns A promise that resolves when the send operation is complete.
|
|
147
|
-
*/
|
|
148
|
-
sendBatchRequest(requests) {
|
|
149
|
-
return this.batchClient.send(requests)
|
|
150
|
-
.then((responses) => {
|
|
151
|
-
return responses.map((part) => {
|
|
152
|
-
return this.buildSendResponse(part);
|
|
153
|
-
});
|
|
154
|
-
}).then((responses) => {
|
|
155
|
-
const successCount = responses.filter((resp) => resp.success).length;
|
|
156
|
-
return {
|
|
157
|
-
responses,
|
|
158
|
-
successCount,
|
|
159
|
-
failureCount: responses.length - successCount,
|
|
160
|
-
};
|
|
161
|
-
}).catch((err) => {
|
|
162
|
-
if (err instanceof api_request_1.RequestResponseError) {
|
|
163
|
-
throw (0, messaging_errors_internal_1.createFirebaseError)(err);
|
|
164
|
-
}
|
|
165
|
-
// Re-throw the error if it already has the proper format.
|
|
166
|
-
throw err;
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
135
|
buildSendResponse(response) {
|
|
170
136
|
const result = {
|
|
171
137
|
success: response.status === 200,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v13.0.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2021 Google Inc.
|
|
@@ -41,7 +41,7 @@ export interface ConditionMessage extends BaseMessage {
|
|
|
41
41
|
*/
|
|
42
42
|
export type Message = TokenMessage | TopicMessage | ConditionMessage;
|
|
43
43
|
/**
|
|
44
|
-
* Payload for the {@link Messaging.
|
|
44
|
+
* Payload for the {@link Messaging.sendEachForMulticast} 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 {
|
|
@@ -364,6 +364,11 @@ export interface AndroidConfig {
|
|
|
364
364
|
* Options for features provided by the FCM SDK for Android.
|
|
365
365
|
*/
|
|
366
366
|
fcmOptions?: AndroidFcmOptions;
|
|
367
|
+
/**
|
|
368
|
+
* A boolean indicating whether messages will be allowed to be delivered to
|
|
369
|
+
* the app while the device is in direct boot mode.
|
|
370
|
+
*/
|
|
371
|
+
directBootOk?: boolean;
|
|
367
372
|
}
|
|
368
373
|
/**
|
|
369
374
|
* Represents the Android-specific notification options that can be included in
|
|
@@ -830,97 +835,6 @@ export interface MessagingOptions {
|
|
|
830
835
|
restrictedPackageName?: string;
|
|
831
836
|
[key: string]: any | undefined;
|
|
832
837
|
}
|
|
833
|
-
/**
|
|
834
|
-
* Individual status response payload from single devices
|
|
835
|
-
*
|
|
836
|
-
* @deprecated Returned by {@link Messaging#sendToDevice}, which is also deprecated.
|
|
837
|
-
*/
|
|
838
|
-
export interface MessagingDeviceResult {
|
|
839
|
-
/**
|
|
840
|
-
* The error that occurred when processing the message for the recipient.
|
|
841
|
-
*/
|
|
842
|
-
error?: FirebaseError;
|
|
843
|
-
/**
|
|
844
|
-
* A unique ID for the successfully processed message.
|
|
845
|
-
*/
|
|
846
|
-
messageId?: string;
|
|
847
|
-
/**
|
|
848
|
-
* The canonical registration token for the client app that the message was
|
|
849
|
-
* processed and sent to. You should use this value as the registration token
|
|
850
|
-
* for future requests. Otherwise, future messages might be rejected.
|
|
851
|
-
*/
|
|
852
|
-
canonicalRegistrationToken?: string;
|
|
853
|
-
}
|
|
854
|
-
/**
|
|
855
|
-
* Interface representing the status of a message sent to an individual device
|
|
856
|
-
* via the FCM legacy APIs.
|
|
857
|
-
*
|
|
858
|
-
* See
|
|
859
|
-
* {@link https://firebase.google.com/docs/cloud-messaging/admin/send-messages#send_to_individual_devices |
|
|
860
|
-
* Send to individual devices} for code samples and detailed documentation.
|
|
861
|
-
*
|
|
862
|
-
* @deprecated Returned by {@link Messaging.sendToDevice}, which is also deprecated.
|
|
863
|
-
*/
|
|
864
|
-
export interface MessagingDevicesResponse {
|
|
865
|
-
canonicalRegistrationTokenCount: number;
|
|
866
|
-
failureCount: number;
|
|
867
|
-
multicastId: number;
|
|
868
|
-
results: MessagingDeviceResult[];
|
|
869
|
-
successCount: number;
|
|
870
|
-
}
|
|
871
|
-
/**
|
|
872
|
-
* Interface representing the server response from the {@link Messaging.sendToDeviceGroup}
|
|
873
|
-
* method.
|
|
874
|
-
*
|
|
875
|
-
* See
|
|
876
|
-
* {@link https://firebase.google.com/docs/cloud-messaging/send-message?authuser=0#send_messages_to_device_groups |
|
|
877
|
-
* Send messages to device groups} for code samples and detailed documentation.
|
|
878
|
-
*
|
|
879
|
-
* @deprecated Returned by {@link Messaging.sendToDeviceGroup}, which is also deprecated.
|
|
880
|
-
*/
|
|
881
|
-
export interface MessagingDeviceGroupResponse {
|
|
882
|
-
/**
|
|
883
|
-
* The number of messages that could not be processed and resulted in an error.
|
|
884
|
-
*/
|
|
885
|
-
successCount: number;
|
|
886
|
-
/**
|
|
887
|
-
* The number of messages that could not be processed and resulted in an error.
|
|
888
|
-
*/
|
|
889
|
-
failureCount: number;
|
|
890
|
-
/**
|
|
891
|
-
* An array of registration tokens that failed to receive the message.
|
|
892
|
-
*/
|
|
893
|
-
failedRegistrationTokens: string[];
|
|
894
|
-
}
|
|
895
|
-
/**
|
|
896
|
-
* Interface representing the server response from the legacy {@link Messaging.sendToTopic} method.
|
|
897
|
-
*
|
|
898
|
-
* See
|
|
899
|
-
* {@link https://firebase.google.com/docs/cloud-messaging/admin/send-messages#send_to_a_topic |
|
|
900
|
-
* Send to a topic} for code samples and detailed documentation.
|
|
901
|
-
*/
|
|
902
|
-
export interface MessagingTopicResponse {
|
|
903
|
-
/**
|
|
904
|
-
* The message ID for a successfully received request which FCM will attempt to
|
|
905
|
-
* deliver to all subscribed devices.
|
|
906
|
-
*/
|
|
907
|
-
messageId: number;
|
|
908
|
-
}
|
|
909
|
-
/**
|
|
910
|
-
* Interface representing the server response from the legacy
|
|
911
|
-
* {@link Messaging.sendToCondition} method.
|
|
912
|
-
*
|
|
913
|
-
* See
|
|
914
|
-
* {@link https://firebase.google.com/docs/cloud-messaging/admin/send-messages#send_to_a_condition |
|
|
915
|
-
* Send to a condition} for code samples and detailed documentation.
|
|
916
|
-
*/
|
|
917
|
-
export interface MessagingConditionResponse {
|
|
918
|
-
/**
|
|
919
|
-
* The message ID for a successfully received request which FCM will attempt to
|
|
920
|
-
* deliver to all subscribed devices.
|
|
921
|
-
*/
|
|
922
|
-
messageId: number;
|
|
923
|
-
}
|
|
924
838
|
/**
|
|
925
839
|
* Interface representing the server response from the
|
|
926
840
|
* {@link Messaging.subscribeToTopic} and {@link Messaging.unsubscribeFromTopic}
|
|
@@ -949,7 +863,7 @@ export interface MessagingTopicManagementResponse {
|
|
|
949
863
|
}
|
|
950
864
|
/**
|
|
951
865
|
* Interface representing the server response from the
|
|
952
|
-
* {@link Messaging.
|
|
866
|
+
* {@link Messaging.sendEach} and {@link Messaging.sendEachForMulticast} methods.
|
|
953
867
|
*/
|
|
954
868
|
export interface BatchResponse {
|
|
955
869
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v13.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2019 Google Inc.
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.createFirebaseError = createFirebaseError;
|
|
20
|
+
exports.getErrorCode = getErrorCode;
|
|
20
21
|
const error_1 = require("../utils/error");
|
|
21
22
|
const validator = require("../utils/validator");
|
|
22
23
|
/**
|
|
@@ -60,7 +61,6 @@ function createFirebaseError(err) {
|
|
|
60
61
|
`${err.response.status}.`,
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
|
-
exports.createFirebaseError = createFirebaseError;
|
|
64
64
|
/**
|
|
65
65
|
* @param response - The response to check for errors.
|
|
66
66
|
* @returns The error code if present; null otherwise.
|
|
@@ -88,7 +88,6 @@ function getErrorCode(response) {
|
|
|
88
88
|
}
|
|
89
89
|
return null;
|
|
90
90
|
}
|
|
91
|
-
exports.getErrorCode = getErrorCode;
|
|
92
91
|
/**
|
|
93
92
|
* Extracts error message from the given response object.
|
|
94
93
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v13.0.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.
|
|
19
|
+
exports.BLACKLISTED_OPTIONS_KEYS = exports.BLACKLISTED_DATA_PAYLOAD_KEYS = void 0;
|
|
20
|
+
exports.validateMessage = validateMessage;
|
|
20
21
|
const index_1 = require("../utils/index");
|
|
21
22
|
const error_1 = require("../utils/error");
|
|
22
23
|
const validator = require("../utils/validator");
|
|
@@ -59,7 +60,6 @@ function validateMessage(message) {
|
|
|
59
60
|
validateFcmOptions(message.fcmOptions);
|
|
60
61
|
validateNotification(message.notification);
|
|
61
62
|
}
|
|
62
|
-
exports.validateMessage = validateMessage;
|
|
63
63
|
/**
|
|
64
64
|
* Checks if the given object only contains strings as child values.
|
|
65
65
|
*
|
|
@@ -337,6 +337,7 @@ function validateAndroidConfig(config) {
|
|
|
337
337
|
const propertyMappings = {
|
|
338
338
|
collapseKey: 'collapse_key',
|
|
339
339
|
restrictedPackageName: 'restricted_package_name',
|
|
340
|
+
directBootOk: 'direct_boot_ok',
|
|
340
341
|
};
|
|
341
342
|
(0, index_1.renameProperties)(config, propertyMappings);
|
|
342
343
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v13.0.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2021 Google Inc.
|
|
4
4
|
*
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { App } from '../app';
|
|
18
18
|
import { Messaging as TMessaging } from './messaging';
|
|
19
|
-
import { AndroidConfig as TAndroidConfig, AndroidFcmOptions as TAndroidFcmOptions, AndroidNotification as TAndroidNotification, ApnsConfig as TApnsConfig, ApnsFcmOptions as TApnsFcmOptions, ApnsPayload as TApnsPayload, Aps as TAps, ApsAlert as TApsAlert, BatchResponse as TBatchResponse, CriticalSound as TCriticalSound, ConditionMessage as TConditionMessage, FcmOptions as TFcmOptions, LightSettings as TLightSettings, Message as TMessage, MessagingTopicManagementResponse as TMessagingTopicManagementResponse, MulticastMessage as TMulticastMessage, Notification as TNotification, SendResponse as TSendResponse, TokenMessage as TTokenMessage, TopicMessage as TTopicMessage, WebpushConfig as TWebpushConfig, WebpushFcmOptions as TWebpushFcmOptions, WebpushNotification as TWebpushNotification, DataMessagePayload as TDataMessagePayload,
|
|
19
|
+
import { AndroidConfig as TAndroidConfig, AndroidFcmOptions as TAndroidFcmOptions, AndroidNotification as TAndroidNotification, ApnsConfig as TApnsConfig, ApnsFcmOptions as TApnsFcmOptions, ApnsPayload as TApnsPayload, Aps as TAps, ApsAlert as TApsAlert, BatchResponse as TBatchResponse, CriticalSound as TCriticalSound, ConditionMessage as TConditionMessage, FcmOptions as TFcmOptions, LightSettings as TLightSettings, Message as TMessage, MessagingTopicManagementResponse as TMessagingTopicManagementResponse, MulticastMessage as TMulticastMessage, Notification as TNotification, SendResponse as TSendResponse, TokenMessage as TTokenMessage, TopicMessage as TTopicMessage, WebpushConfig as TWebpushConfig, WebpushFcmOptions as TWebpushFcmOptions, WebpushNotification as TWebpushNotification, DataMessagePayload as TDataMessagePayload, MessagingOptions as TMessagingOptions, MessagingPayload as TMessagingPayload, NotificationMessagePayload as TNotificationMessagePayload } from './messaging-api';
|
|
20
20
|
/**
|
|
21
21
|
* Gets the {@link firebase-admin.messaging#Messaging} service for the
|
|
22
22
|
* default app or a given app.
|
|
@@ -146,22 +146,6 @@ export declare namespace messaging {
|
|
|
146
146
|
* Type alias to {@link firebase-admin.messaging#DataMessagePayload}.
|
|
147
147
|
*/
|
|
148
148
|
type DataMessagePayload = TDataMessagePayload;
|
|
149
|
-
/**
|
|
150
|
-
* Type alias to {@link firebase-admin.messaging#MessagingConditionResponse}.
|
|
151
|
-
*/
|
|
152
|
-
type MessagingConditionResponse = TMessagingConditionResponse;
|
|
153
|
-
/**
|
|
154
|
-
* Type alias to {@link firebase-admin.messaging#MessagingDeviceGroupResponse}.
|
|
155
|
-
*/
|
|
156
|
-
type MessagingDeviceGroupResponse = TMessagingDeviceGroupResponse;
|
|
157
|
-
/**
|
|
158
|
-
* Type alias to {@link firebase-admin.messaging#MessagingDeviceResult}.
|
|
159
|
-
*/
|
|
160
|
-
type MessagingDeviceResult = TMessagingDeviceResult;
|
|
161
|
-
/**
|
|
162
|
-
* Type alias to {@link firebase-admin.messaging#MessagingDevicesResponse}.
|
|
163
|
-
*/
|
|
164
|
-
type MessagingDevicesResponse = TMessagingDevicesResponse;
|
|
165
149
|
/**
|
|
166
150
|
* Type alias to {@link firebase-admin.messaging#MessagingOptions}.
|
|
167
151
|
*/
|
|
@@ -170,10 +154,6 @@ export declare namespace messaging {
|
|
|
170
154
|
* Type alias to {@link firebase-admin.messaging#MessagingPayload}.
|
|
171
155
|
*/
|
|
172
156
|
type MessagingPayload = TMessagingPayload;
|
|
173
|
-
/**
|
|
174
|
-
* Type alias to {@link firebase-admin.messaging#MessagingTopicResponse}.
|
|
175
|
-
*/
|
|
176
|
-
type MessagingTopicResponse = TMessagingTopicResponse;
|
|
177
157
|
/**
|
|
178
158
|
* Type alias to {@link firebase-admin.messaging#NotificationMessagePayload}.
|
|
179
159
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v13.0.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2017 Google Inc.
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { App } from '../app';
|
|
19
|
-
import { BatchResponse, Message, MessagingTopicManagementResponse, MulticastMessage
|
|
19
|
+
import { BatchResponse, Message, MessagingTopicManagementResponse, MulticastMessage } from './messaging-api';
|
|
20
20
|
/**
|
|
21
21
|
* Messaging service bound to the provided app.
|
|
22
22
|
*/
|
|
@@ -63,7 +63,7 @@ export declare class Messaging {
|
|
|
63
63
|
/**
|
|
64
64
|
* Sends each message in the given array via Firebase Cloud Messaging.
|
|
65
65
|
*
|
|
66
|
-
*
|
|
66
|
+
* This method makes a single RPC call for each message
|
|
67
67
|
* in the given array.
|
|
68
68
|
*
|
|
69
69
|
* The responses list obtained from the return value corresponds to the order of `messages`.
|
|
@@ -98,127 +98,6 @@ export declare class Messaging {
|
|
|
98
98
|
* send operation.
|
|
99
99
|
*/
|
|
100
100
|
sendEachForMulticast(message: MulticastMessage, dryRun?: boolean): Promise<BatchResponse>;
|
|
101
|
-
/**
|
|
102
|
-
* Sends all the messages in the given array via Firebase Cloud Messaging.
|
|
103
|
-
* Employs batching to send the entire list as a single RPC call. Compared
|
|
104
|
-
* to the `send()` method, this method is a significantly more efficient way
|
|
105
|
-
* to send multiple messages.
|
|
106
|
-
*
|
|
107
|
-
* The responses list obtained from the return value
|
|
108
|
-
* corresponds to the order of tokens in the `MulticastMessage`. An error
|
|
109
|
-
* from this method indicates a total failure, meaning that none of the messages
|
|
110
|
-
* in the list could be sent. Partial failures are indicated by a `BatchResponse`
|
|
111
|
-
* return value.
|
|
112
|
-
*
|
|
113
|
-
* @param messages - A non-empty array
|
|
114
|
-
* containing up to 500 messages.
|
|
115
|
-
* @param dryRun - Whether to send the messages in the dry-run
|
|
116
|
-
* (validation only) mode.
|
|
117
|
-
* @returns A Promise fulfilled with an object representing the result of the
|
|
118
|
-
* send operation.
|
|
119
|
-
*
|
|
120
|
-
* @deprecated Use {@link Messaging.sendEach} instead.
|
|
121
|
-
*/
|
|
122
|
-
sendAll(messages: Message[], dryRun?: boolean): Promise<BatchResponse>;
|
|
123
|
-
/**
|
|
124
|
-
* Sends the given multicast message to all the FCM registration tokens
|
|
125
|
-
* specified in it.
|
|
126
|
-
*
|
|
127
|
-
* This method uses the `sendAll()` API under the hood to send the given
|
|
128
|
-
* message to all the target recipients. The responses list obtained from the
|
|
129
|
-
* return value corresponds to the order of tokens in the `MulticastMessage`.
|
|
130
|
-
* An error from this method indicates a total failure, meaning that the message
|
|
131
|
-
* was not sent to any of the tokens in the list. Partial failures are indicated
|
|
132
|
-
* by a `BatchResponse` return value.
|
|
133
|
-
*
|
|
134
|
-
* @param message - A multicast message
|
|
135
|
-
* containing up to 500 tokens.
|
|
136
|
-
* @param dryRun - Whether to send the message in the dry-run
|
|
137
|
-
* (validation only) mode.
|
|
138
|
-
* @returns A Promise fulfilled with an object representing the result of the
|
|
139
|
-
* send operation.
|
|
140
|
-
*
|
|
141
|
-
* @deprecated Use {@link Messaging.sendEachForMulticast} instead.
|
|
142
|
-
*/
|
|
143
|
-
sendMulticast(message: MulticastMessage, dryRun?: boolean): Promise<BatchResponse>;
|
|
144
|
-
/**
|
|
145
|
-
* Sends an FCM message to a single device corresponding to the provided
|
|
146
|
-
* registration token.
|
|
147
|
-
*
|
|
148
|
-
* See {@link https://firebase.google.com/docs/cloud-messaging/admin/legacy-fcm#send_to_individual_devices |
|
|
149
|
-
* Send to individual devices}
|
|
150
|
-
* for code samples and detailed documentation. Takes either a
|
|
151
|
-
* `registrationToken` to send to a single device or a
|
|
152
|
-
* `registrationTokens` parameter containing an array of tokens to send
|
|
153
|
-
* to multiple devices.
|
|
154
|
-
*
|
|
155
|
-
* @param registrationToken - A device registration token or an array of
|
|
156
|
-
* device registration tokens to which the message should be sent.
|
|
157
|
-
* @param payload - The message payload.
|
|
158
|
-
* @param options - Optional options to
|
|
159
|
-
* alter the message.
|
|
160
|
-
*
|
|
161
|
-
* @returns A promise fulfilled with the server's response after the message
|
|
162
|
-
* has been sent.
|
|
163
|
-
*
|
|
164
|
-
* @deprecated Use {@link Messaging.send} instead.
|
|
165
|
-
*/
|
|
166
|
-
sendToDevice(registrationTokenOrTokens: string | string[], payload: MessagingPayload, options?: MessagingOptions): Promise<MessagingDevicesResponse>;
|
|
167
|
-
/**
|
|
168
|
-
* Sends an FCM message to a device group corresponding to the provided
|
|
169
|
-
* notification key.
|
|
170
|
-
*
|
|
171
|
-
* See {@link https://firebase.google.com/docs/cloud-messaging/admin/legacy-fcm#send_to_a_device_group |
|
|
172
|
-
* Send to a device group} for code samples and detailed documentation.
|
|
173
|
-
*
|
|
174
|
-
* @param notificationKey - The notification key for the device group to
|
|
175
|
-
* which to send the message.
|
|
176
|
-
* @param payload - The message payload.
|
|
177
|
-
* @param options - Optional options to
|
|
178
|
-
* alter the message.
|
|
179
|
-
*
|
|
180
|
-
* @returns A promise fulfilled with the server's response after the message
|
|
181
|
-
* has been sent.
|
|
182
|
-
*
|
|
183
|
-
* @deprecated Use {@link Messaging.send} instead.
|
|
184
|
-
*/
|
|
185
|
-
sendToDeviceGroup(notificationKey: string, payload: MessagingPayload, options?: MessagingOptions): Promise<MessagingDeviceGroupResponse>;
|
|
186
|
-
/**
|
|
187
|
-
* Sends an FCM message to a topic.
|
|
188
|
-
*
|
|
189
|
-
* See {@link https://firebase.google.com/docs/cloud-messaging/admin/legacy-fcm#send_to_a_topic |
|
|
190
|
-
* Send to a topic} for code samples and detailed documentation.
|
|
191
|
-
*
|
|
192
|
-
* @param topic - The topic to which to send the message.
|
|
193
|
-
* @param payload - The message payload.
|
|
194
|
-
* @param options - Optional options to
|
|
195
|
-
* alter the message.
|
|
196
|
-
*
|
|
197
|
-
* @returns A promise fulfilled with the server's response after the message
|
|
198
|
-
* has been sent.
|
|
199
|
-
*
|
|
200
|
-
* @deprecated Use {@link Messaging.send} instead.
|
|
201
|
-
*/
|
|
202
|
-
sendToTopic(topic: string, payload: MessagingPayload, options?: MessagingOptions): Promise<MessagingTopicResponse>;
|
|
203
|
-
/**
|
|
204
|
-
* Sends an FCM message to a condition.
|
|
205
|
-
*
|
|
206
|
-
* See {@link https://firebase.google.com/docs/cloud-messaging/admin/legacy-fcm#send_to_a_condition |
|
|
207
|
-
* Send to a condition}
|
|
208
|
-
* for code samples and detailed documentation.
|
|
209
|
-
*
|
|
210
|
-
* @param condition - The condition determining to which topics to send
|
|
211
|
-
* the message.
|
|
212
|
-
* @param payload - The message payload.
|
|
213
|
-
* @param options - Optional options to
|
|
214
|
-
* alter the message.
|
|
215
|
-
*
|
|
216
|
-
* @returns A promise fulfilled with the server's response after the message
|
|
217
|
-
* has been sent.
|
|
218
|
-
*
|
|
219
|
-
* @deprecated Use {@link Messaging.send} instead.
|
|
220
|
-
*/
|
|
221
|
-
sendToCondition(condition: string, payload: MessagingPayload, options?: MessagingOptions): Promise<MessagingConditionResponse>;
|
|
222
101
|
/**
|
|
223
102
|
* Subscribes a device to an FCM topic.
|
|
224
103
|
*
|
|
@@ -265,31 +144,6 @@ export declare class Messaging {
|
|
|
265
144
|
* response.
|
|
266
145
|
*/
|
|
267
146
|
private sendTopicManagementRequest;
|
|
268
|
-
/**
|
|
269
|
-
* Validates the types of the messaging payload and options. If invalid, an error will be thrown.
|
|
270
|
-
*
|
|
271
|
-
* @param payload - The messaging payload to validate.
|
|
272
|
-
* @param options - The messaging options to validate.
|
|
273
|
-
*/
|
|
274
|
-
private validateMessagingPayloadAndOptionsTypes;
|
|
275
|
-
/**
|
|
276
|
-
* Validates the messaging payload. If invalid, an error will be thrown.
|
|
277
|
-
*
|
|
278
|
-
* @param payload - The messaging payload to validate.
|
|
279
|
-
*
|
|
280
|
-
* @returns A copy of the provided payload with whitelisted properties switched
|
|
281
|
-
* from camelCase to underscore_case.
|
|
282
|
-
*/
|
|
283
|
-
private validateMessagingPayload;
|
|
284
|
-
/**
|
|
285
|
-
* Validates the messaging options. If invalid, an error will be thrown.
|
|
286
|
-
*
|
|
287
|
-
* @param options - The messaging options to validate.
|
|
288
|
-
*
|
|
289
|
-
* @returns A copy of the provided options with whitelisted properties switched
|
|
290
|
-
* from camelCase to underscore_case.
|
|
291
|
-
*/
|
|
292
|
-
private validateMessagingOptions;
|
|
293
147
|
/**
|
|
294
148
|
* Validates the type of the provided registration token(s). If invalid, an error will be thrown.
|
|
295
149
|
*
|