firebase-admin 12.7.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 +3 -4
- package/lib/auth/auth-config.d.ts +1 -1
- package/lib/auth/auth-config.js +3 -3
- 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 +1 -1
- 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 +1 -1
- package/lib/auth/project-config.js +1 -1
- package/lib/auth/tenant-manager.d.ts +1 -1
- package/lib/auth/tenant-manager.js +1 -1
- package/lib/auth/tenant.d.ts +1 -1
- package/lib/auth/tenant.js +1 -1
- 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 +3 -2
- 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 -40
- 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
|
"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.Model = exports.MachineLearning = void 0;
|
|
20
|
+
exports.getMachineLearning = getMachineLearning;
|
|
20
21
|
/**
|
|
21
22
|
* Firebase Machine Learning.
|
|
22
23
|
*
|
|
@@ -60,4 +61,3 @@ function getMachineLearning(app) {
|
|
|
60
61
|
const firebaseApp = app;
|
|
61
62
|
return firebaseApp.getOrInitService('machineLearning', (app) => new machine_learning_1.MachineLearning(app));
|
|
62
63
|
}
|
|
63
|
-
exports.getMachineLearning = getMachineLearning;
|
|
@@ -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.MachineLearningApiClient =
|
|
19
|
+
exports.MachineLearningApiClient = void 0;
|
|
20
|
+
exports.isGcsTfliteModelOptions = isGcsTfliteModelOptions;
|
|
20
21
|
const api_request_1 = require("../utils/api-request");
|
|
21
22
|
const error_1 = require("../utils/error");
|
|
22
23
|
const utils = require("../utils/index");
|
|
@@ -34,7 +35,6 @@ function isGcsTfliteModelOptions(options) {
|
|
|
34
35
|
const gcsUri = options?.tfliteModel?.gcsTfliteUri;
|
|
35
36
|
return typeof gcsUri !== 'undefined';
|
|
36
37
|
}
|
|
37
|
-
exports.isGcsTfliteModelOptions = isGcsTfliteModelOptions;
|
|
38
38
|
/**
|
|
39
39
|
* Class that facilitates sending requests to the Firebase ML backend API.
|
|
40
40
|
*
|
package/lib/messaging/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v13.0.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2020 Google Inc.
|
|
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, DataMessagePayload,
|
|
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, DataMessagePayload, MessagingOptions, MessagingPayload, NotificationMessagePayload, } from './messaging-api';
|
|
26
26
|
/**
|
|
27
27
|
* Gets the {@link Messaging} service for the default app or a given app.
|
|
28
28
|
*
|
package/lib/messaging/index.js
CHANGED
|
@@ -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.MessagingClientErrorCode = exports.FirebaseMessagingError = exports.
|
|
19
|
+
exports.MessagingClientErrorCode = exports.FirebaseMessagingError = exports.Messaging = void 0;
|
|
20
|
+
exports.getMessaging = getMessaging;
|
|
20
21
|
/**
|
|
21
22
|
* Firebase Cloud Messaging (FCM).
|
|
22
23
|
*
|
|
@@ -59,7 +60,6 @@ function getMessaging(app) {
|
|
|
59
60
|
const firebaseApp = app;
|
|
60
61
|
return firebaseApp.getOrInitService('messaging', (app) => new messaging_1.Messaging(app));
|
|
61
62
|
}
|
|
62
|
-
exports.getMessaging = getMessaging;
|
|
63
63
|
var error_1 = require("../utils/error");
|
|
64
64
|
Object.defineProperty(exports, "FirebaseMessagingError", { enumerable: true, get: function () { return error_1.FirebaseMessagingError; } });
|
|
65
65
|
Object.defineProperty(exports, "MessagingClientErrorCode", { enumerable: true, get: function () { return error_1.MessagingClientErrorCode; } });
|
|
@@ -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,19 +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
|
-
'X-Goog-Api-Client': `gl-node/${process.versions.node} fire-admin/${(0, index_1.getSdkVersion)()}`
|
|
32
|
-
};
|
|
33
|
-
const LEGACY_FIREBASE_MESSAGING_HEADERS = {
|
|
34
|
-
'X-Firebase-Client': `fire-admin-node/${(0, index_1.getSdkVersion)()}`,
|
|
35
|
-
'X-Goog-Api-Client': `gl-node/${process.versions.node} fire-admin/${(0, index_1.getSdkVersion)()}`,
|
|
36
29
|
'access_token_auth': 'true',
|
|
37
30
|
};
|
|
38
31
|
/**
|
|
@@ -46,7 +39,6 @@ class FirebaseMessagingRequestHandler {
|
|
|
46
39
|
constructor(app) {
|
|
47
40
|
this.httpClient = new api_request_1.AuthorizedHttpClient(app);
|
|
48
41
|
this.http2Client = new api_request_1.AuthorizedHttp2Client(app);
|
|
49
|
-
this.batchClient = new batch_request_internal_1.BatchRequestClient(this.httpClient, FIREBASE_MESSAGING_BATCH_URL, FIREBASE_MESSAGING_HEADERS);
|
|
50
42
|
}
|
|
51
43
|
/**
|
|
52
44
|
* Invokes the request handler with the provided request data.
|
|
@@ -61,7 +53,7 @@ class FirebaseMessagingRequestHandler {
|
|
|
61
53
|
method: FIREBASE_MESSAGING_HTTP_METHOD,
|
|
62
54
|
url: `https://${host}${path}`,
|
|
63
55
|
data: requestData,
|
|
64
|
-
headers:
|
|
56
|
+
headers: FIREBASE_MESSAGING_HEADERS,
|
|
65
57
|
timeout: FIREBASE_MESSAGING_TIMEOUT,
|
|
66
58
|
};
|
|
67
59
|
return this.httpClient.send(request).then((response) => {
|
|
@@ -98,7 +90,7 @@ class FirebaseMessagingRequestHandler {
|
|
|
98
90
|
method: FIREBASE_MESSAGING_HTTP_METHOD,
|
|
99
91
|
url: `https://${host}${path}`,
|
|
100
92
|
data: requestData,
|
|
101
|
-
headers:
|
|
93
|
+
headers: FIREBASE_MESSAGING_HEADERS,
|
|
102
94
|
timeout: FIREBASE_MESSAGING_TIMEOUT,
|
|
103
95
|
};
|
|
104
96
|
return this.httpClient.send(request).then((response) => {
|
|
@@ -125,7 +117,7 @@ class FirebaseMessagingRequestHandler {
|
|
|
125
117
|
method: FIREBASE_MESSAGING_HTTP_METHOD,
|
|
126
118
|
url: `https://${host}${path}`,
|
|
127
119
|
data: requestData,
|
|
128
|
-
headers:
|
|
120
|
+
headers: FIREBASE_MESSAGING_HEADERS,
|
|
129
121
|
timeout: FIREBASE_MESSAGING_TIMEOUT,
|
|
130
122
|
http2SessionHandler: http2SessionHandler
|
|
131
123
|
};
|
|
@@ -140,34 +132,6 @@ class FirebaseMessagingRequestHandler {
|
|
|
140
132
|
throw err;
|
|
141
133
|
});
|
|
142
134
|
}
|
|
143
|
-
/**
|
|
144
|
-
* Sends the given array of sub requests as a single batch to FCM, and parses the result into
|
|
145
|
-
* a `BatchResponse` object.
|
|
146
|
-
*
|
|
147
|
-
* @param requests - An array of sub requests to send.
|
|
148
|
-
* @returns A promise that resolves when the send operation is complete.
|
|
149
|
-
*/
|
|
150
|
-
sendBatchRequest(requests) {
|
|
151
|
-
return this.batchClient.send(requests)
|
|
152
|
-
.then((responses) => {
|
|
153
|
-
return responses.map((part) => {
|
|
154
|
-
return this.buildSendResponse(part);
|
|
155
|
-
});
|
|
156
|
-
}).then((responses) => {
|
|
157
|
-
const successCount = responses.filter((resp) => resp.success).length;
|
|
158
|
-
return {
|
|
159
|
-
responses,
|
|
160
|
-
successCount,
|
|
161
|
-
failureCount: responses.length - successCount,
|
|
162
|
-
};
|
|
163
|
-
}).catch((err) => {
|
|
164
|
-
if (err instanceof api_request_1.RequestResponseError) {
|
|
165
|
-
throw (0, messaging_errors_internal_1.createFirebaseError)(err);
|
|
166
|
-
}
|
|
167
|
-
// Re-throw the error if it already has the proper format.
|
|
168
|
-
throw err;
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
135
|
buildSendResponse(response) {
|
|
172
136
|
const result = {
|
|
173
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
|
*/
|