firebase-admin 11.9.0 → 11.10.1
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 +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 +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 +13 -13
- 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 +28 -4
- package/lib/auth/user-record.js +58 -6
- 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/esm/storage/index.js +1 -0
- 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 +67 -23
- package/lib/firestore/index.js +1 -1
- package/lib/functions/functions-api-client-internal.d.ts +3 -2
- package/lib/functions/functions-api-client-internal.js +105 -27
- package/lib/functions/functions-api.d.ts +33 -1
- package/lib/functions/functions-api.js +1 -1
- package/lib/functions/functions.d.ts +7 -1
- package/lib/functions/functions.js +9 -1
- package/lib/functions/index.d.ts +2 -2
- 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 +1 -1
- package/lib/messaging/messaging.js +1 -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/index.d.ts +1 -1
- package/lib/remote-config/index.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 +14 -1
- package/lib/storage/index.js +29 -7
- 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 +20 -0
- package/lib/storage/utils.js +21 -0
- package/lib/utils/api-request.d.ts +1 -1
- package/lib/utils/api-request.js +1 -9
- 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 +9 -1
- package/lib/utils/validator.js +17 -2
- package/package.json +1 -1
package/lib/storage/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v11.
|
|
1
|
+
/*! firebase-admin v11.10.1 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2020 Google Inc.
|
|
4
4
|
*
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
* @packageDocumentation
|
|
21
21
|
*/
|
|
22
|
+
import { File } from '@google-cloud/storage';
|
|
22
23
|
import { App } from '../app';
|
|
23
24
|
import { Storage } from './storage';
|
|
24
25
|
export { Storage } from './storage';
|
|
@@ -42,3 +43,15 @@ export { Storage } from './storage';
|
|
|
42
43
|
* ```
|
|
43
44
|
*/
|
|
44
45
|
export declare function getStorage(app?: App): Storage;
|
|
46
|
+
/**
|
|
47
|
+
* Gets the download URL for the given {@link https://cloud.google.com/nodejs/docs/reference/storage/latest/storage/file | File}.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```javascript
|
|
51
|
+
* // Get the downloadUrl for a given file ref
|
|
52
|
+
* const storage = getStorage();
|
|
53
|
+
* const myRef = ref(storage, 'images/mountains.jpg');
|
|
54
|
+
* const downloadUrl = await getDownloadURL(myRef);
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function getDownloadURL(file: File): Promise<string>;
|
package/lib/storage/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v11.
|
|
1
|
+
/*! firebase-admin v11.10.1 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2020 Google Inc.
|
|
@@ -16,14 +16,11 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.getStorage = exports.Storage = void 0;
|
|
20
|
-
/**
|
|
21
|
-
* Cloud Storage for Firebase.
|
|
22
|
-
*
|
|
23
|
-
* @packageDocumentation
|
|
24
|
-
*/
|
|
19
|
+
exports.getDownloadURL = exports.getStorage = exports.Storage = void 0;
|
|
25
20
|
const app_1 = require("../app");
|
|
26
21
|
const storage_1 = require("./storage");
|
|
22
|
+
const error_1 = require("../utils/error");
|
|
23
|
+
const utils_1 = require("./utils");
|
|
27
24
|
var storage_2 = require("./storage");
|
|
28
25
|
Object.defineProperty(exports, "Storage", { enumerable: true, get: function () { return storage_2.Storage; } });
|
|
29
26
|
/**
|
|
@@ -53,3 +50,28 @@ function getStorage(app) {
|
|
|
53
50
|
return firebaseApp.getOrInitService('storage', (app) => new storage_1.Storage(app));
|
|
54
51
|
}
|
|
55
52
|
exports.getStorage = getStorage;
|
|
53
|
+
/**
|
|
54
|
+
* Gets the download URL for the given {@link https://cloud.google.com/nodejs/docs/reference/storage/latest/storage/file | File}.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```javascript
|
|
58
|
+
* // Get the downloadUrl for a given file ref
|
|
59
|
+
* const storage = getStorage();
|
|
60
|
+
* const myRef = ref(storage, 'images/mountains.jpg');
|
|
61
|
+
* const downloadUrl = await getDownloadURL(myRef);
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
async function getDownloadURL(file) {
|
|
65
|
+
const endpoint = (process.env.STORAGE_EMULATOR_HOST ||
|
|
66
|
+
'https://firebasestorage.googleapis.com') + '/v0';
|
|
67
|
+
const { downloadTokens } = await (0, utils_1.getFirebaseMetadata)(endpoint, file);
|
|
68
|
+
if (!downloadTokens) {
|
|
69
|
+
throw new error_1.FirebaseError({
|
|
70
|
+
code: 'storage/no-download-token',
|
|
71
|
+
message: 'No download token available. Please create one in the Firebase Console.',
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const [token] = downloadTokens.split(',');
|
|
75
|
+
return `${endpoint}/b/${file.bucket.name}/o/${encodeURIComponent(file.name)}?alt=media&token=${token}`;
|
|
76
|
+
}
|
|
77
|
+
exports.getDownloadURL = getDownloadURL;
|
package/lib/storage/storage.d.ts
CHANGED
package/lib/storage/storage.js
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*! firebase-admin v11.10.1 */
|
|
2
|
+
import { File } from '@google-cloud/storage';
|
|
3
|
+
export interface FirebaseMetadata {
|
|
4
|
+
name: string;
|
|
5
|
+
bucket: string;
|
|
6
|
+
generation: string;
|
|
7
|
+
metageneration: string;
|
|
8
|
+
contentType: string;
|
|
9
|
+
timeCreated: string;
|
|
10
|
+
updated: string;
|
|
11
|
+
storageClass: string;
|
|
12
|
+
size: string;
|
|
13
|
+
md5Hash: string;
|
|
14
|
+
contentEncoding: string;
|
|
15
|
+
contentDisposition: string;
|
|
16
|
+
crc32c: string;
|
|
17
|
+
etag: string;
|
|
18
|
+
downloadTokens?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function getFirebaseMetadata(endpoint: string, file: File): Promise<FirebaseMetadata>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*! firebase-admin v11.10.1 */
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getFirebaseMetadata = void 0;
|
|
5
|
+
function getFirebaseMetadata(endpoint, file) {
|
|
6
|
+
const uri = `${endpoint}/b/${file.bucket.name}/o/${encodeURIComponent(file.name)}`;
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
file.storage.makeAuthenticatedRequest({
|
|
9
|
+
method: 'GET',
|
|
10
|
+
uri,
|
|
11
|
+
}, (err, body) => {
|
|
12
|
+
if (err) {
|
|
13
|
+
reject(err);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
resolve(body);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.getFirebaseMetadata = getFirebaseMetadata;
|
package/lib/utils/api-request.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v11.
|
|
1
|
+
/*! firebase-admin v11.10.1 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -347,14 +347,6 @@ class AsyncHttpCall {
|
|
|
347
347
|
if (timeout) {
|
|
348
348
|
// Listen to timeouts and throw an error.
|
|
349
349
|
req.setTimeout(timeout, timeoutCallback);
|
|
350
|
-
req.on('socket', (socket) => {
|
|
351
|
-
socket.setMaxListeners(socket.getMaxListeners() + 1);
|
|
352
|
-
socket.setTimeout(timeout, timeoutCallback);
|
|
353
|
-
socket.on('end', () => {
|
|
354
|
-
socket.setTimeout(0);
|
|
355
|
-
socket.setMaxListeners(Math.max(socket.getMaxListeners() - 1, 0));
|
|
356
|
-
});
|
|
357
|
-
});
|
|
358
350
|
}
|
|
359
351
|
// Send the request
|
|
360
352
|
req.end(this.entity);
|
package/lib/utils/deep-copy.d.ts
CHANGED
package/lib/utils/deep-copy.js
CHANGED
package/lib/utils/error.d.ts
CHANGED
package/lib/utils/error.js
CHANGED
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.js
CHANGED
package/lib/utils/jwt.d.ts
CHANGED
package/lib/utils/jwt.js
CHANGED
package/lib/utils/validator.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v11.
|
|
1
|
+
/*! firebase-admin v11.10.1 */
|
|
2
2
|
/*!
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2017 Google Inc.
|
|
@@ -142,3 +142,11 @@ export declare function isURL(urlStr: any): boolean;
|
|
|
142
142
|
* @returns Whether the provided topic is a valid FCM topic name.
|
|
143
143
|
*/
|
|
144
144
|
export declare function isTopic(topic: any): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Validates that the provided string can be used as a task ID
|
|
147
|
+
* for Cloud Tasks.
|
|
148
|
+
*
|
|
149
|
+
* @param taskId - the task ID to validate.
|
|
150
|
+
* @returns Whether the provided task ID is valid.
|
|
151
|
+
*/
|
|
152
|
+
export declare function isTaskId(taskId: any): boolean;
|
package/lib/utils/validator.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v11.
|
|
1
|
+
/*! firebase-admin v11.10.1 */
|
|
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.isTopic = exports.isURL = exports.isUTCDateString = exports.isISODateString = exports.isPhoneNumber = exports.isEmail = exports.isPassword = exports.isUid = exports.isNonNullObject = exports.isObject = exports.isNonEmptyString = exports.isBase64String = exports.isString = exports.isNumber = exports.isBoolean = exports.isNonEmptyArray = exports.isArray = exports.isBuffer = void 0;
|
|
20
|
+
exports.isTaskId = exports.isTopic = exports.isURL = exports.isUTCDateString = exports.isISODateString = exports.isPhoneNumber = exports.isEmail = exports.isPassword = exports.isUid = exports.isNonNullObject = exports.isObject = exports.isNonEmptyString = exports.isBase64String = exports.isString = exports.isNumber = exports.isBoolean = exports.isNonEmptyArray = exports.isArray = exports.isBuffer = void 0;
|
|
21
21
|
const url = require("url");
|
|
22
22
|
/**
|
|
23
23
|
* Validates that a value is a byte buffer.
|
|
@@ -269,3 +269,18 @@ function isTopic(topic) {
|
|
|
269
269
|
return VALID_TOPIC_REGEX.test(topic);
|
|
270
270
|
}
|
|
271
271
|
exports.isTopic = isTopic;
|
|
272
|
+
/**
|
|
273
|
+
* Validates that the provided string can be used as a task ID
|
|
274
|
+
* for Cloud Tasks.
|
|
275
|
+
*
|
|
276
|
+
* @param taskId - the task ID to validate.
|
|
277
|
+
* @returns Whether the provided task ID is valid.
|
|
278
|
+
*/
|
|
279
|
+
function isTaskId(taskId) {
|
|
280
|
+
if (typeof taskId !== 'string') {
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
const VALID_TASK_ID_REGEX = /^[A-Za-z0-9_-]+$/;
|
|
284
|
+
return VALID_TASK_ID_REGEX.test(taskId);
|
|
285
|
+
}
|
|
286
|
+
exports.isTaskId = isTaskId;
|
package/package.json
CHANGED