firebase-admin 12.3.0 → 12.4.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/lib/app/core.d.ts +1 -1
- 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 +1 -1
- package/lib/app/credential.d.ts +1 -1
- package/lib/app/credential.js +1 -1
- package/lib/app/firebase-app.d.ts +3 -1
- package/lib/app/firebase-app.js +10 -4
- 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 +1 -1
- 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 +1 -1
- package/lib/app-check/token-generator.d.ts +1 -1
- package/lib/app-check/token-generator.js +1 -1
- 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 +1 -1
- package/lib/auth/auth-config.d.ts +1 -1
- package/lib/auth/auth-config.js +1 -1
- 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 +1 -1
- package/lib/auth/identifier.d.ts +1 -1
- package/lib/auth/identifier.js +1 -1
- package/lib/auth/index.d.ts +1 -1
- package/lib/auth/index.js +1 -1
- 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 -1
- package/lib/auth/token-generator.js +1 -1
- package/lib/auth/token-verifier.d.ts +1 -1
- package/lib/auth/token-verifier.js +1 -1
- package/lib/auth/user-import-builder.d.ts +1 -1
- package/lib/auth/user-import-builder.js +1 -1
- 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/database/database-namespace.d.ts +1 -1
- package/lib/database/database-namespace.js +1 -1
- package/lib/database/database.d.ts +1 -1
- package/lib/database/database.js +1 -1
- package/lib/database/index.d.ts +1 -1
- package/lib/database/index.js +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/lib/functions/functions-api-client-internal.d.ts +2 -1
- package/lib/functions/functions-api-client-internal.js +29 -7
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
- package/lib/machine-learning/machine-learning-api-client.js +1 -1
- 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/batch-request-internal.d.ts +1 -1
- package/lib/messaging/batch-request-internal.js +1 -1
- package/lib/messaging/index.d.ts +1 -1
- package/lib/messaging/index.js +1 -1
- 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 -1
- 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 +1 -1
- package/lib/messaging/messaging-internal.d.ts +1 -1
- package/lib/messaging/messaging-internal.js +1 -1
- package/lib/messaging/messaging-namespace.d.ts +1 -1
- package/lib/messaging/messaging-namespace.js +1 -1
- package/lib/messaging/messaging.d.ts +5 -1
- package/lib/messaging/messaging.js +5 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/lib/remote-config/index.d.ts +1 -1
- package/lib/remote-config/index.js +1 -1
- 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 +1 -1
- 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 -1
- package/lib/security-rules/security-rules.js +1 -1
- package/lib/storage/index.d.ts +1 -1
- package/lib/storage/index.js +1 -1
- 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 +1 -1
- package/lib/utils/api-request.d.ts +1 -1
- package/lib/utils/api-request.js +1 -1
- package/lib/utils/crypto-signer.d.ts +1 -1
- package/lib/utils/crypto-signer.js +1 -1
- package/lib/utils/deep-copy.d.ts +1 -1
- package/lib/utils/deep-copy.js +1 -1
- package/lib/utils/error.d.ts +1 -1
- package/lib/utils/error.js +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/jwt.d.ts +1 -1
- package/lib/utils/jwt.js +1 -1
- package/lib/utils/validator.d.ts +1 -1
- package/lib/utils/validator.js +1 -1
- package/package.json +2 -2
package/lib/eventarc/index.js
CHANGED
package/lib/extensions/index.js
CHANGED
package/lib/firestore/index.d.ts
CHANGED
package/lib/firestore/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v12.
|
|
1
|
+
/*! firebase-admin v12.4.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2021 Google Inc.
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { PrefixedFirebaseError } from '../utils/error';
|
|
19
|
+
export declare const EMULATED_SERVICE_ACCOUNT_DEFAULT = "emulated-service-acct@email.com";
|
|
19
20
|
/**
|
|
20
21
|
* Task is a limited subset of https://cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks#resource:-task
|
|
21
22
|
* containing the relevant fields for enqueueing tasks that tirgger Cloud Functions.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v12.
|
|
1
|
+
/*! firebase-admin v12.4.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.FirebaseFunctionsError = exports.FUNCTIONS_ERROR_CODE_MAPPING = exports.FunctionsApiClient = void 0;
|
|
20
|
+
exports.FirebaseFunctionsError = exports.FUNCTIONS_ERROR_CODE_MAPPING = exports.FunctionsApiClient = exports.EMULATED_SERVICE_ACCOUNT_DEFAULT = void 0;
|
|
21
21
|
const api_request_1 = require("../utils/api-request");
|
|
22
22
|
const error_1 = require("../utils/error");
|
|
23
23
|
const utils = require("../utils/index");
|
|
@@ -26,6 +26,7 @@ const credential_internal_1 = require("../app/credential-internal");
|
|
|
26
26
|
const CLOUD_TASKS_API_RESOURCE_PATH = 'projects/{projectId}/locations/{locationId}/queues/{resourceId}/tasks';
|
|
27
27
|
const CLOUD_TASKS_API_URL_FORMAT = 'https://cloudtasks.googleapis.com/v2/' + CLOUD_TASKS_API_RESOURCE_PATH;
|
|
28
28
|
const FIREBASE_FUNCTION_URL_FORMAT = 'https://{locationId}-{projectId}.cloudfunctions.net/{resourceId}';
|
|
29
|
+
exports.EMULATED_SERVICE_ACCOUNT_DEFAULT = 'emulated-service-acct@email.com';
|
|
29
30
|
const FIREBASE_FUNCTIONS_CONFIG_HEADERS = {
|
|
30
31
|
'X-Firebase-Client': `fire-admin-node/${utils.getSdkVersion()}`
|
|
31
32
|
};
|
|
@@ -75,7 +76,8 @@ class FunctionsApiClient {
|
|
|
75
76
|
resources.resourceId = `ext-${extensionId}-${resources.resourceId}`;
|
|
76
77
|
}
|
|
77
78
|
try {
|
|
78
|
-
const serviceUrl =
|
|
79
|
+
const serviceUrl = tasksEmulatorUrl(resources, functionName)?.concat('/', id)
|
|
80
|
+
?? await this.getUrl(resources, CLOUD_TASKS_API_URL_FORMAT.concat('/', id));
|
|
79
81
|
const request = {
|
|
80
82
|
method: 'DELETE',
|
|
81
83
|
url: serviceUrl,
|
|
@@ -125,7 +127,8 @@ class FunctionsApiClient {
|
|
|
125
127
|
}
|
|
126
128
|
const task = this.validateTaskOptions(data, resources, opts);
|
|
127
129
|
try {
|
|
128
|
-
const serviceUrl =
|
|
130
|
+
const serviceUrl = tasksEmulatorUrl(resources, functionName) ??
|
|
131
|
+
await this.getUrl(resources, CLOUD_TASKS_API_URL_FORMAT);
|
|
129
132
|
const taskPayload = await this.updateTaskPayload(task, resources, extensionId);
|
|
130
133
|
const request = {
|
|
131
134
|
method: 'POST',
|
|
@@ -271,9 +274,12 @@ class FunctionsApiClient {
|
|
|
271
274
|
return task;
|
|
272
275
|
}
|
|
273
276
|
async updateTaskPayload(task, resources, extensionId) {
|
|
277
|
+
const defaultUrl = process.env.CLOUD_TASKS_EMULATOR_HOST ?
|
|
278
|
+
''
|
|
279
|
+
: await this.getUrl(resources, FIREBASE_FUNCTION_URL_FORMAT);
|
|
274
280
|
const functionUrl = validator.isNonEmptyString(task.httpRequest.url)
|
|
275
281
|
? task.httpRequest.url
|
|
276
|
-
:
|
|
282
|
+
: defaultUrl;
|
|
277
283
|
task.httpRequest.url = functionUrl;
|
|
278
284
|
// When run from a deployed extension, we should be using ComputeEngineCredentials
|
|
279
285
|
if (validator.isNonEmptyString(extensionId) && this.app.options.credential instanceof credential_internal_1.ComputeEngineCredential) {
|
|
@@ -283,8 +289,18 @@ class FunctionsApiClient {
|
|
|
283
289
|
delete task.httpRequest.oidcToken;
|
|
284
290
|
}
|
|
285
291
|
else {
|
|
286
|
-
|
|
287
|
-
|
|
292
|
+
try {
|
|
293
|
+
const account = await this.getServiceAccount();
|
|
294
|
+
task.httpRequest.oidcToken = { serviceAccountEmail: account };
|
|
295
|
+
}
|
|
296
|
+
catch (e) {
|
|
297
|
+
if (process.env.CLOUD_TASKS_EMULATOR_HOST) {
|
|
298
|
+
task.httpRequest.oidcToken = { serviceAccountEmail: exports.EMULATED_SERVICE_ACCOUNT_DEFAULT };
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
throw e;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
288
304
|
}
|
|
289
305
|
return task;
|
|
290
306
|
}
|
|
@@ -335,3 +351,9 @@ class FirebaseFunctionsError extends error_1.PrefixedFirebaseError {
|
|
|
335
351
|
}
|
|
336
352
|
}
|
|
337
353
|
exports.FirebaseFunctionsError = FirebaseFunctionsError;
|
|
354
|
+
function tasksEmulatorUrl(resources, functionName) {
|
|
355
|
+
if (process.env.CLOUD_TASKS_EMULATOR_HOST) {
|
|
356
|
+
return `http://${process.env.CLOUD_TASKS_EMULATOR_HOST}/projects/${resources.projectId}/locations/${resources.locationId}/queues/${functionName}/tasks`;
|
|
357
|
+
}
|
|
358
|
+
return undefined;
|
|
359
|
+
}
|
package/lib/functions/index.d.ts
CHANGED
package/lib/functions/index.js
CHANGED
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/lib/instance-id/index.js
CHANGED
package/lib/messaging/index.d.ts
CHANGED
package/lib/messaging/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v12.
|
|
1
|
+
/*! firebase-admin v12.4.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2017 Google Inc.
|
|
@@ -196,6 +196,8 @@ export declare class Messaging {
|
|
|
196
196
|
*
|
|
197
197
|
* @returns A promise fulfilled with the server's response after the message
|
|
198
198
|
* has been sent.
|
|
199
|
+
*
|
|
200
|
+
* @deprecated Use {@link Messaging.send} instead.
|
|
199
201
|
*/
|
|
200
202
|
sendToTopic(topic: string, payload: MessagingPayload, options?: MessagingOptions): Promise<MessagingTopicResponse>;
|
|
201
203
|
/**
|
|
@@ -213,6 +215,8 @@ export declare class Messaging {
|
|
|
213
215
|
*
|
|
214
216
|
* @returns A promise fulfilled with the server's response after the message
|
|
215
217
|
* has been sent.
|
|
218
|
+
*
|
|
219
|
+
* @deprecated Use {@link Messaging.send} instead.
|
|
216
220
|
*/
|
|
217
221
|
sendToCondition(condition: string, payload: MessagingPayload, options?: MessagingOptions): Promise<MessagingConditionResponse>;
|
|
218
222
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v12.
|
|
1
|
+
/*! firebase-admin v12.4.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -576,6 +576,8 @@ class Messaging {
|
|
|
576
576
|
*
|
|
577
577
|
* @returns A promise fulfilled with the server's response after the message
|
|
578
578
|
* has been sent.
|
|
579
|
+
*
|
|
580
|
+
* @deprecated Use {@link Messaging.send} instead.
|
|
579
581
|
*/
|
|
580
582
|
sendToTopic(topic, payload, options = {}) {
|
|
581
583
|
// Validate the input argument types. Since these are common developer errors when getting
|
|
@@ -617,6 +619,8 @@ class Messaging {
|
|
|
617
619
|
*
|
|
618
620
|
* @returns A promise fulfilled with the server's response after the message
|
|
619
621
|
* has been sent.
|
|
622
|
+
*
|
|
623
|
+
* @deprecated Use {@link Messaging.send} instead.
|
|
620
624
|
*/
|
|
621
625
|
sendToCondition(condition, payload, options = {}) {
|
|
622
626
|
if (!validator.isNonEmptyString(condition)) {
|