firebase-admin 9.12.0 → 10.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 +7 -3
- package/lib/app/core.d.ts +188 -0
- package/lib/app/core.js +19 -0
- package/lib/app/credential-factory.d.ts +123 -0
- package/lib/app/credential-factory.js +150 -0
- package/lib/app/credential-internal.d.ts +90 -0
- package/lib/{credential → app}/credential-internal.js +15 -13
- package/lib/app/credential.d.ts +45 -0
- package/lib/app/credential.js +19 -0
- package/lib/app/firebase-app.d.ts +51 -0
- package/lib/{firebase-app.js → app/firebase-app.js} +26 -156
- package/lib/app/firebase-namespace.d.ts +163 -0
- package/lib/{firebase-namespace.js → app/firebase-namespace.js} +99 -111
- package/lib/app/index.d.ts +27 -0
- package/lib/app/index.js +31 -0
- package/lib/app/lifecycle.d.ts +60 -0
- package/lib/app/lifecycle.js +165 -0
- package/lib/app-check/app-check-api-client-internal.d.ts +32 -0
- package/lib/app-check/app-check-api-client-internal.js +10 -10
- package/lib/app-check/app-check-api.d.ts +95 -0
- package/lib/app-check/app-check-api.js +19 -0
- package/lib/app-check/app-check-namespace.d.ts +65 -0
- package/lib/app-check/app-check-namespace.js +18 -0
- package/lib/app-check/app-check.d.ts +49 -0
- package/lib/app-check/app-check.js +13 -10
- package/lib/app-check/index.d.ts +19 -126
- package/lib/app-check/index.js +45 -1
- package/lib/app-check/token-generator.d.ts +25 -0
- package/lib/app-check/token-generator.js +9 -9
- package/lib/app-check/token-verifier.d.ts +17 -0
- package/lib/app-check/token-verifier.js +6 -6
- package/lib/auth/action-code-settings-builder.d.ts +87 -0
- package/lib/auth/action-code-settings-builder.js +4 -2
- package/lib/auth/auth-api-request.d.ts +174 -0
- package/lib/auth/auth-api-request.js +197 -124
- package/lib/auth/auth-config.d.ts +575 -0
- package/lib/auth/auth-config.js +43 -34
- package/lib/auth/auth-namespace.d.ts +255 -0
- package/lib/auth/auth-namespace.js +18 -0
- package/lib/auth/auth.d.ts +40 -0
- package/lib/auth/auth.js +12 -772
- package/lib/auth/base-auth.d.ts +613 -0
- package/lib/auth/base-auth.js +951 -0
- package/lib/auth/identifier.d.ts +57 -0
- package/lib/auth/identifier.js +1 -1
- package/lib/auth/index.d.ts +25 -1897
- package/lib/auth/index.js +54 -1
- package/lib/auth/tenant-manager.d.ts +146 -0
- package/lib/auth/tenant-manager.js +151 -39
- package/lib/auth/tenant.d.ts +130 -0
- package/lib/auth/tenant.js +62 -16
- package/lib/auth/token-generator.d.ts +44 -0
- package/lib/auth/token-generator.js +11 -9
- package/lib/auth/token-verifier.d.ts +150 -0
- package/lib/auth/token-verifier.js +27 -15
- package/lib/auth/user-import-builder.d.ts +322 -0
- package/lib/auth/user-import-builder.js +9 -9
- package/lib/auth/user-record.d.ts +265 -0
- package/lib/auth/user-record.js +80 -45
- package/lib/credential/index.d.ts +24 -66
- package/lib/credential/index.js +101 -1
- package/lib/database/database-namespace.d.ts +95 -0
- package/lib/database/database-namespace.js +23 -0
- package/lib/database/database.d.ts +66 -0
- package/lib/database/{database-internal.js → database.js} +16 -9
- package/lib/database/index.d.ts +55 -54
- package/lib/database/index.js +84 -13
- package/lib/{firebase-namespace.d.ts → default-namespace.d.ts} +7 -14
- package/lib/default-namespace.js +4 -5
- package/lib/esm/app/index.js +10 -0
- package/lib/esm/app-check/index.js +4 -0
- package/lib/esm/auth/index.js +14 -0
- package/lib/esm/database/index.js +6 -0
- package/lib/esm/firestore/index.js +23 -0
- package/lib/esm/installations/index.js +4 -0
- package/lib/esm/instance-id/index.js +4 -0
- package/lib/esm/machine-learning/index.js +5 -0
- package/lib/esm/messaging/index.js +4 -0
- package/lib/esm/package.json +1 -0
- package/lib/esm/project-management/index.js +8 -0
- package/lib/esm/remote-config/index.js +4 -0
- package/lib/esm/security-rules/index.js +6 -0
- package/lib/esm/storage/index.js +4 -0
- package/lib/firebase-namespace-api.d.ts +34 -186
- package/lib/firebase-namespace-api.js +37 -2
- package/lib/firestore/firestore-internal.d.ts +32 -0
- package/lib/firestore/firestore-internal.js +3 -3
- package/lib/firestore/firestore-namespace.d.ts +50 -0
- package/lib/firestore/firestore-namespace.js +47 -0
- package/lib/firestore/index.d.ts +37 -35
- package/lib/firestore/index.js +61 -30
- package/lib/index.d.ts +2 -2
- package/lib/index.js +1 -1
- package/lib/installations/index.d.ts +34 -63
- package/lib/installations/index.js +45 -1
- package/lib/installations/installations-namespace.d.ts +55 -0
- package/lib/installations/installations-namespace.js +18 -0
- package/lib/installations/installations-request-handler.d.ts +43 -0
- package/lib/installations/installations-request-handler.js +4 -4
- package/lib/installations/installations.d.ts +38 -0
- package/lib/installations/installations.js +6 -5
- package/lib/instance-id/index.d.ts +23 -45
- package/lib/instance-id/index.js +54 -1
- package/lib/instance-id/instance-id-namespace.d.ts +38 -0
- package/lib/instance-id/instance-id-namespace.js +3 -0
- package/lib/instance-id/instance-id.d.ts +47 -0
- package/lib/instance-id/instance-id.js +14 -19
- package/lib/machine-learning/index.d.ts +19 -216
- package/lib/machine-learning/index.js +46 -1
- package/lib/machine-learning/machine-learning-api-client.d.ts +102 -0
- package/lib/machine-learning/machine-learning-api-client.js +6 -6
- package/lib/machine-learning/machine-learning-namespace.d.ts +85 -0
- package/lib/machine-learning/machine-learning-namespace.js +18 -0
- package/lib/machine-learning/machine-learning-utils.d.ts +22 -0
- package/lib/machine-learning/machine-learning-utils.js +1 -1
- package/lib/machine-learning/machine-learning.d.ts +181 -0
- package/lib/machine-learning/machine-learning.js +72 -37
- package/lib/messaging/batch-request-internal.d.ts +55 -0
- package/lib/messaging/batch-request-internal.js +9 -9
- package/lib/messaging/index.d.ts +18 -1140
- package/lib/messaging/index.js +45 -1
- package/lib/messaging/messaging-api-request-internal.d.ts +50 -0
- package/lib/messaging/messaging-api-request-internal.js +8 -8
- package/lib/messaging/messaging-api.d.ts +980 -0
- package/lib/messaging/messaging-api.js +19 -0
- package/lib/messaging/messaging-errors-internal.d.ts +31 -0
- package/lib/messaging/messaging-errors-internal.js +7 -7
- package/lib/messaging/messaging-internal.d.ts +27 -0
- package/lib/messaging/messaging-internal.js +2 -2
- package/lib/messaging/messaging-namespace.d.ts +181 -0
- package/lib/messaging/messaging-namespace.js +18 -0
- package/lib/messaging/messaging.d.ts +269 -0
- package/lib/messaging/messaging.js +83 -91
- package/lib/project-management/android-app.d.ts +110 -0
- package/lib/project-management/android-app.js +24 -15
- package/lib/project-management/app-metadata.d.ts +85 -0
- package/lib/project-management/app-metadata.js +37 -0
- package/lib/project-management/index.d.ts +21 -331
- package/lib/project-management/index.js +51 -24
- package/lib/project-management/ios-app.d.ts +66 -0
- package/lib/project-management/ios-app.js +15 -8
- package/lib/project-management/project-management-api-request-internal.d.ts +17 -0
- package/lib/project-management/project-management-api-request-internal.js +15 -15
- package/lib/project-management/project-management-namespace.d.ts +82 -0
- package/lib/project-management/project-management-namespace.js +18 -0
- package/lib/project-management/project-management.d.ts +115 -0
- package/lib/project-management/project-management.js +22 -25
- package/lib/remote-config/index.d.ts +19 -336
- package/lib/remote-config/index.js +45 -1
- package/lib/remote-config/remote-config-api-client-internal.d.ts +28 -0
- package/lib/remote-config/remote-config-api-client-internal.js +3 -3
- package/lib/remote-config/remote-config-api.d.ts +258 -0
- package/lib/remote-config/remote-config-api.js +18 -0
- package/lib/remote-config/remote-config-namespace.d.ts +105 -0
- package/lib/remote-config/remote-config-namespace.js +18 -0
- package/lib/remote-config/remote-config.d.ts +94 -0
- package/lib/remote-config/remote-config.js +27 -26
- package/lib/security-rules/index.d.ts +18 -184
- package/lib/security-rules/index.js +46 -1
- package/lib/security-rules/security-rules-api-client-internal.d.ts +73 -0
- package/lib/security-rules/security-rules-api-client-internal.js +1 -1
- package/lib/security-rules/security-rules-internal.d.ts +21 -0
- package/lib/security-rules/security-rules-internal.js +1 -1
- package/lib/security-rules/security-rules-namespace.d.ts +69 -0
- package/lib/security-rules/security-rules-namespace.js +18 -0
- package/lib/security-rules/security-rules.d.ts +196 -0
- package/lib/security-rules/security-rules.js +73 -55
- package/lib/storage/index.d.ts +16 -32
- package/lib/storage/index.js +38 -1
- package/lib/storage/storage-namespace.d.ts +45 -0
- package/lib/storage/storage-namespace.js +18 -0
- package/lib/storage/storage.d.ts +42 -0
- package/lib/storage/storage.js +9 -6
- package/lib/utils/api-request.d.ts +230 -0
- package/lib/utils/api-request.js +25 -25
- package/lib/utils/crypto-signer.d.ts +128 -0
- package/lib/utils/crypto-signer.js +9 -9
- package/lib/utils/deep-copy.d.ts +40 -0
- package/lib/utils/deep-copy.js +6 -6
- package/lib/utils/error.d.ts +650 -0
- package/lib/utils/error.js +34 -34
- package/lib/utils/index.d.ts +105 -0
- package/lib/utils/index.js +22 -21
- package/lib/utils/jwt.d.ts +131 -0
- package/lib/utils/jwt.js +11 -11
- package/lib/utils/validator.d.ts +144 -0
- package/lib/utils/validator.js +37 -37
- package/package.json +110 -8
- package/lib/credential/credential.js +0 -44
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -47,7 +47,7 @@ var AppCheckTokenGenerator = /** @class */ (function () {
|
|
|
47
47
|
/**
|
|
48
48
|
* The AppCheckTokenGenerator class constructor.
|
|
49
49
|
*
|
|
50
|
-
* @param signer The CryptoSigner instance for this token generator.
|
|
50
|
+
* @param signer - The CryptoSigner instance for this token generator.
|
|
51
51
|
* @constructor
|
|
52
52
|
*/
|
|
53
53
|
function AppCheckTokenGenerator(signer) {
|
|
@@ -59,9 +59,9 @@ var AppCheckTokenGenerator = /** @class */ (function () {
|
|
|
59
59
|
/**
|
|
60
60
|
* Creates a new custom token that can be exchanged to an App Check token.
|
|
61
61
|
*
|
|
62
|
-
* @param appId The Application ID to use for the generated token.
|
|
62
|
+
* @param appId - The Application ID to use for the generated token.
|
|
63
63
|
*
|
|
64
|
-
* @
|
|
64
|
+
* @returns A Promise fulfilled with a custom token signed with a service account key
|
|
65
65
|
* that can be exchanged to an App Check token.
|
|
66
66
|
*/
|
|
67
67
|
AppCheckTokenGenerator.prototype.createCustomToken = function (appId, options) {
|
|
@@ -99,7 +99,7 @@ var AppCheckTokenGenerator = /** @class */ (function () {
|
|
|
99
99
|
* Checks if a given `AppCheckTokenOptions` object is valid. If successful, returns an object with
|
|
100
100
|
* custom properties.
|
|
101
101
|
*
|
|
102
|
-
* @param options An options object to be validated.
|
|
102
|
+
* @param options - An options object to be validated.
|
|
103
103
|
* @returns A custom object with ttl converted to protobuf Duration string format.
|
|
104
104
|
*/
|
|
105
105
|
AppCheckTokenGenerator.prototype.validateTokenOptions = function (options) {
|
|
@@ -122,11 +122,11 @@ var AppCheckTokenGenerator = /** @class */ (function () {
|
|
|
122
122
|
}());
|
|
123
123
|
exports.AppCheckTokenGenerator = AppCheckTokenGenerator;
|
|
124
124
|
/**
|
|
125
|
-
* Creates a new FirebaseAppCheckError by extracting the error code, message and other relevant
|
|
126
|
-
* details from a CryptoSignerError
|
|
125
|
+
* Creates a new `FirebaseAppCheckError` by extracting the error code, message and other relevant
|
|
126
|
+
* details from a `CryptoSignerError`.
|
|
127
127
|
*
|
|
128
|
-
* @param err The Error to convert into a FirebaseAppCheckError error
|
|
129
|
-
* @
|
|
128
|
+
* @param err - The Error to convert into a `FirebaseAppCheckError` error
|
|
129
|
+
* @returns A Firebase App Check error that can be returned to the user.
|
|
130
130
|
*/
|
|
131
131
|
function appCheckErrorFromCryptoSignerError(err) {
|
|
132
132
|
if (!(err instanceof crypto_signer_1.CryptoSignerError)) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*! firebase-admin v10.0.0 */
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright 2021 Google Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2021 Google Inc.
|
|
@@ -36,8 +36,8 @@ var AppCheckTokenVerifier = /** @class */ (function () {
|
|
|
36
36
|
/**
|
|
37
37
|
* Verifies the format and signature of a Firebase App Check token.
|
|
38
38
|
*
|
|
39
|
-
* @param token The Firebase Auth JWT token to verify.
|
|
40
|
-
* @
|
|
39
|
+
* @param token - The Firebase Auth JWT token to verify.
|
|
40
|
+
* @returns A promise fulfilled with the decoded claims of the Firebase App Check token.
|
|
41
41
|
*/
|
|
42
42
|
AppCheckTokenVerifier.prototype.verifyToken = function (token) {
|
|
43
43
|
var _this = this;
|
|
@@ -85,8 +85,8 @@ var AppCheckTokenVerifier = /** @class */ (function () {
|
|
|
85
85
|
/**
|
|
86
86
|
* Verifies the content of a Firebase App Check JWT.
|
|
87
87
|
*
|
|
88
|
-
* @param fullDecodedToken The decoded JWT.
|
|
89
|
-
* @param projectId The Firebase Project Id.
|
|
88
|
+
* @param fullDecodedToken - The decoded JWT.
|
|
89
|
+
* @param projectId - The Firebase Project Id.
|
|
90
90
|
*/
|
|
91
91
|
AppCheckTokenVerifier.prototype.verifyContent = function (fullDecodedToken, projectId) {
|
|
92
92
|
var header = fullDecodedToken.header;
|
|
@@ -126,7 +126,7 @@ var AppCheckTokenVerifier = /** @class */ (function () {
|
|
|
126
126
|
/**
|
|
127
127
|
* Maps JwtError to FirebaseAppCheckError
|
|
128
128
|
*
|
|
129
|
-
* @param error JwtError to be mapped.
|
|
129
|
+
* @param error - JwtError to be mapped.
|
|
130
130
|
* @returns FirebaseAppCheckError instance.
|
|
131
131
|
*/
|
|
132
132
|
AppCheckTokenVerifier.prototype.mapJwtErrorToAppCheckError = function (error) {
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/*! firebase-admin v10.0.0 */
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright 2018 Google Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* This is the interface that defines the required continue/state URL with
|
|
19
|
+
* optional Android and iOS bundle identifiers.
|
|
20
|
+
*/
|
|
21
|
+
export interface ActionCodeSettings {
|
|
22
|
+
/**
|
|
23
|
+
* Defines the link continue/state URL, which has different meanings in
|
|
24
|
+
* different contexts:
|
|
25
|
+
* <ul>
|
|
26
|
+
* <li>When the link is handled in the web action widgets, this is the deep
|
|
27
|
+
* link in the `continueUrl` query parameter.</li>
|
|
28
|
+
* <li>When the link is handled in the app directly, this is the `continueUrl`
|
|
29
|
+
* query parameter in the deep link of the Dynamic Link.</li>
|
|
30
|
+
* </ul>
|
|
31
|
+
*/
|
|
32
|
+
url: string;
|
|
33
|
+
/**
|
|
34
|
+
* Whether to open the link via a mobile app or a browser.
|
|
35
|
+
* The default is false. When set to true, the action code link is sent
|
|
36
|
+
* as a Universal Link or Android App Link and is opened by the app if
|
|
37
|
+
* installed. In the false case, the code is sent to the web widget first
|
|
38
|
+
* and then redirects to the app if installed.
|
|
39
|
+
*/
|
|
40
|
+
handleCodeInApp?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Defines the iOS bundle ID. This will try to open the link in an iOS app if it
|
|
43
|
+
* is installed.
|
|
44
|
+
*/
|
|
45
|
+
iOS?: {
|
|
46
|
+
/**
|
|
47
|
+
* Defines the required iOS bundle ID of the app where the link should be
|
|
48
|
+
* handled if the application is already installed on the device.
|
|
49
|
+
*/
|
|
50
|
+
bundleId: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Defines the Android package name. This will try to open the link in an
|
|
54
|
+
* android app if it is installed. If `installApp` is passed, it specifies
|
|
55
|
+
* whether to install the Android app if the device supports it and the app is
|
|
56
|
+
* not already installed. If this field is provided without a `packageName`, an
|
|
57
|
+
* error is thrown explaining that the `packageName` must be provided in
|
|
58
|
+
* conjunction with this field. If `minimumVersion` is specified, and an older
|
|
59
|
+
* version of the app is installed, the user is taken to the Play Store to
|
|
60
|
+
* upgrade the app.
|
|
61
|
+
*/
|
|
62
|
+
android?: {
|
|
63
|
+
/**
|
|
64
|
+
* Defines the required Android package name of the app where the link should be
|
|
65
|
+
* handled if the Android app is installed.
|
|
66
|
+
*/
|
|
67
|
+
packageName: string;
|
|
68
|
+
/**
|
|
69
|
+
* Whether to install the Android app if the device supports it and the app is
|
|
70
|
+
* not already installed.
|
|
71
|
+
*/
|
|
72
|
+
installApp?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* The Android minimum version if available. If the installed app is an older
|
|
75
|
+
* version, the user is taken to the GOogle Play Store to upgrade the app.
|
|
76
|
+
*/
|
|
77
|
+
minimumVersion?: string;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Defines the dynamic link domain to use for the current link if it is to be
|
|
81
|
+
* opened using Firebase Dynamic Links, as multiple dynamic link domains can be
|
|
82
|
+
* configured per project. This field provides the ability to explicitly choose
|
|
83
|
+
* configured per project. This fields provides the ability explicitly choose
|
|
84
|
+
* one. If none is provided, the oldest domain is used by default.
|
|
85
|
+
*/
|
|
86
|
+
dynamicLinkDomain?: string;
|
|
87
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2018 Google Inc.
|
|
@@ -22,6 +22,8 @@ var error_1 = require("../utils/error");
|
|
|
22
22
|
/**
|
|
23
23
|
* Defines the ActionCodeSettings builder class used to convert the
|
|
24
24
|
* ActionCodeSettings object to its corresponding server request.
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
25
27
|
*/
|
|
26
28
|
var ActionCodeSettingsBuilder = /** @class */ (function () {
|
|
27
29
|
/**
|
|
@@ -91,7 +93,7 @@ var ActionCodeSettingsBuilder = /** @class */ (function () {
|
|
|
91
93
|
* Returns the corresponding constructed server request corresponding to the
|
|
92
94
|
* current ActionCodeSettings.
|
|
93
95
|
*
|
|
94
|
-
* @
|
|
96
|
+
* @returns The constructed EmailActionCodeRequest request.
|
|
95
97
|
*/
|
|
96
98
|
ActionCodeSettingsBuilder.prototype.buildRequest = function () {
|
|
97
99
|
var request = {
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/*! firebase-admin v10.0.0 */
|
|
2
|
+
/*!
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2017 Google Inc.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { App } from '../app/index';
|
|
19
|
+
import { UserImportOptions, UserImportRecord, UserImportResult } from './user-import-builder';
|
|
20
|
+
import { TenantServerResponse, CreateTenantRequest, UpdateTenantRequest } from './tenant';
|
|
21
|
+
/** List of reserved claims which cannot be provided when creating a custom token. */
|
|
22
|
+
export declare const RESERVED_CLAIMS: string[];
|
|
23
|
+
/** List of supported email action request types. */
|
|
24
|
+
export declare const EMAIL_ACTION_REQUEST_TYPES: string[];
|
|
25
|
+
/** Defines a base utility to help with resource URL construction. */
|
|
26
|
+
declare class AuthResourceUrlBuilder {
|
|
27
|
+
protected app: App;
|
|
28
|
+
protected version: string;
|
|
29
|
+
protected urlFormat: string;
|
|
30
|
+
private projectId;
|
|
31
|
+
/**
|
|
32
|
+
* The resource URL builder constructor.
|
|
33
|
+
*
|
|
34
|
+
* @param projectId - The resource project ID.
|
|
35
|
+
* @param version - The endpoint API version.
|
|
36
|
+
* @constructor
|
|
37
|
+
*/
|
|
38
|
+
constructor(app: App, version?: string);
|
|
39
|
+
/**
|
|
40
|
+
* Returns the resource URL corresponding to the provided parameters.
|
|
41
|
+
*
|
|
42
|
+
* @param api - The backend API name.
|
|
43
|
+
* @param params - The optional additional parameters to substitute in the
|
|
44
|
+
* URL path.
|
|
45
|
+
* @returns The corresponding resource URL.
|
|
46
|
+
*/
|
|
47
|
+
getUrl(api?: string, params?: object): Promise<string>;
|
|
48
|
+
private getProjectId;
|
|
49
|
+
}
|
|
50
|
+
interface BatchDeleteErrorInfo {
|
|
51
|
+
index?: number;
|
|
52
|
+
localId?: string;
|
|
53
|
+
message?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface BatchDeleteAccountsResponse {
|
|
56
|
+
errors?: BatchDeleteErrorInfo[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Utility for sending requests to Auth server that are Auth instance related. This includes user and
|
|
60
|
+
* tenant management related APIs. This extends the BaseFirebaseAuthRequestHandler class and defines
|
|
61
|
+
* additional tenant management related APIs.
|
|
62
|
+
*/
|
|
63
|
+
export declare class AuthRequestHandler extends AbstractAuthRequestHandler {
|
|
64
|
+
protected readonly tenantMgmtResourceBuilder: AuthResourceUrlBuilder;
|
|
65
|
+
/**
|
|
66
|
+
* The FirebaseAuthRequestHandler constructor used to initialize an instance using a FirebaseApp.
|
|
67
|
+
*
|
|
68
|
+
* @param app - The app used to fetch access tokens to sign API requests.
|
|
69
|
+
* @constructor.
|
|
70
|
+
*/
|
|
71
|
+
constructor(app: App);
|
|
72
|
+
/**
|
|
73
|
+
* @returns A new Auth user management resource URL builder instance.
|
|
74
|
+
*/
|
|
75
|
+
protected newAuthUrlBuilder(): AuthResourceUrlBuilder;
|
|
76
|
+
/**
|
|
77
|
+
* @returns A new project config resource URL builder instance.
|
|
78
|
+
*/
|
|
79
|
+
protected newProjectConfigUrlBuilder(): AuthResourceUrlBuilder;
|
|
80
|
+
/**
|
|
81
|
+
* Looks up a tenant by tenant ID.
|
|
82
|
+
*
|
|
83
|
+
* @param tenantId - The tenant identifier of the tenant to lookup.
|
|
84
|
+
* @returns A promise that resolves with the tenant information.
|
|
85
|
+
*/
|
|
86
|
+
getTenant(tenantId: string): Promise<TenantServerResponse>;
|
|
87
|
+
/**
|
|
88
|
+
* Exports the tenants (single batch only) with a size of maxResults and starting from
|
|
89
|
+
* the offset as specified by pageToken.
|
|
90
|
+
*
|
|
91
|
+
* @param maxResults - The page size, 1000 if undefined. This is also the maximum
|
|
92
|
+
* allowed limit.
|
|
93
|
+
* @param pageToken - The next page token. If not specified, returns tenants starting
|
|
94
|
+
* without any offset. Tenants are returned in the order they were created from oldest to
|
|
95
|
+
* newest, relative to the page token offset.
|
|
96
|
+
* @returns A promise that resolves with the current batch of downloaded
|
|
97
|
+
* tenants and the next page token if available. For the last page, an empty list of tenants
|
|
98
|
+
* and no page token are returned.
|
|
99
|
+
*/
|
|
100
|
+
listTenants(maxResults?: number, pageToken?: string): Promise<{
|
|
101
|
+
tenants: TenantServerResponse[];
|
|
102
|
+
nextPageToken?: string;
|
|
103
|
+
}>;
|
|
104
|
+
/**
|
|
105
|
+
* Deletes a tenant identified by a tenantId.
|
|
106
|
+
*
|
|
107
|
+
* @param tenantId - The identifier of the tenant to delete.
|
|
108
|
+
* @returns A promise that resolves when the tenant is deleted.
|
|
109
|
+
*/
|
|
110
|
+
deleteTenant(tenantId: string): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Creates a new tenant with the properties provided.
|
|
113
|
+
*
|
|
114
|
+
* @param tenantOptions - The properties to set on the new tenant to be created.
|
|
115
|
+
* @returns A promise that resolves with the newly created tenant object.
|
|
116
|
+
*/
|
|
117
|
+
createTenant(tenantOptions: CreateTenantRequest): Promise<TenantServerResponse>;
|
|
118
|
+
/**
|
|
119
|
+
* Updates an existing tenant with the properties provided.
|
|
120
|
+
*
|
|
121
|
+
* @param tenantId - The tenant identifier of the tenant to update.
|
|
122
|
+
* @param tenantOptions - The properties to update on the existing tenant.
|
|
123
|
+
* @returns A promise that resolves with the modified tenant object.
|
|
124
|
+
*/
|
|
125
|
+
updateTenant(tenantId: string, tenantOptions: UpdateTenantRequest): Promise<TenantServerResponse>;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Utility for sending requests to Auth server that are tenant Auth instance related. This includes user
|
|
129
|
+
* management related APIs for specified tenants.
|
|
130
|
+
* This extends the BaseFirebaseAuthRequestHandler class.
|
|
131
|
+
*/
|
|
132
|
+
export declare class TenantAwareAuthRequestHandler extends AbstractAuthRequestHandler {
|
|
133
|
+
private readonly tenantId;
|
|
134
|
+
/**
|
|
135
|
+
* The FirebaseTenantRequestHandler constructor used to initialize an instance using a
|
|
136
|
+
* FirebaseApp and a tenant ID.
|
|
137
|
+
*
|
|
138
|
+
* @param app - The app used to fetch access tokens to sign API requests.
|
|
139
|
+
* @param tenantId - The request handler's tenant ID.
|
|
140
|
+
* @constructor
|
|
141
|
+
*/
|
|
142
|
+
constructor(app: App, tenantId: string);
|
|
143
|
+
/**
|
|
144
|
+
* @returns A new Auth user management resource URL builder instance.
|
|
145
|
+
*/
|
|
146
|
+
protected newAuthUrlBuilder(): AuthResourceUrlBuilder;
|
|
147
|
+
/**
|
|
148
|
+
* @returns A new project config resource URL builder instance.
|
|
149
|
+
*/
|
|
150
|
+
protected newProjectConfigUrlBuilder(): AuthResourceUrlBuilder;
|
|
151
|
+
/**
|
|
152
|
+
* Imports the list of users provided to Firebase Auth. This is useful when
|
|
153
|
+
* migrating from an external authentication system without having to use the Firebase CLI SDK.
|
|
154
|
+
* At most, 1000 users are allowed to be imported one at a time.
|
|
155
|
+
* When importing a list of password users, UserImportOptions are required to be specified.
|
|
156
|
+
*
|
|
157
|
+
* Overrides the superclass methods by adding an additional check to match tenant IDs of
|
|
158
|
+
* imported user records if present.
|
|
159
|
+
*
|
|
160
|
+
* @param users - The list of user records to import to Firebase Auth.
|
|
161
|
+
* @param options - The user import options, required when the users provided
|
|
162
|
+
* include password credentials.
|
|
163
|
+
* @returns A promise that resolves when the operation completes
|
|
164
|
+
* with the result of the import. This includes the number of successful imports, the number
|
|
165
|
+
* of failed uploads and their corresponding errors.
|
|
166
|
+
*/
|
|
167
|
+
uploadAccount(users: UserImportRecord[], options?: UserImportOptions): Promise<UserImportResult>;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* When true the SDK should communicate with the Auth Emulator for all API
|
|
171
|
+
* calls and also produce unsigned tokens.
|
|
172
|
+
*/
|
|
173
|
+
export declare function useEmulator(): boolean;
|
|
174
|
+
export {};
|