firebase-admin 11.0.1 → 11.2.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 +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 +15 -4
- package/lib/auth/auth-api-request.js +53 -9
- package/lib/auth/auth-config.d.ts +56 -1
- package/lib/auth/auth-config.js +59 -2
- package/lib/auth/auth-namespace.d.ts +1 -1
- package/lib/auth/auth-namespace.js +1 -1
- package/lib/auth/auth.d.ts +9 -1
- package/lib/auth/auth.js +11 -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 +4 -2
- package/lib/auth/index.js +6 -2
- package/lib/auth/project-config-manager.d.ts +25 -0
- package/lib/auth/project-config-manager.js +50 -0
- package/lib/auth/project-config.d.ts +48 -0
- package/lib/auth/project-config.js +90 -0
- package/lib/auth/tenant-manager.d.ts +1 -1
- package/lib/auth/tenant-manager.js +1 -1
- package/lib/auth/tenant.d.ts +14 -2
- package/lib/auth/tenant.js +16 -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/esm/auth/index.js +2 -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/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 +1 -1
- package/lib/functions/functions-api-client-internal.js +1 -1
- 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 +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 +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/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 +9 -9
package/lib/auth/identifier.js
CHANGED
package/lib/auth/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v11.0
|
|
1
|
+
/*! firebase-admin v11.2.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2020 Google Inc.
|
|
4
4
|
*
|
|
@@ -45,11 +45,13 @@ import { Auth } from './auth';
|
|
|
45
45
|
export declare function getAuth(app?: App): Auth;
|
|
46
46
|
export { ActionCodeSettings } from './action-code-settings-builder';
|
|
47
47
|
export { Auth, } from './auth';
|
|
48
|
-
export { AuthFactorType, AuthProviderConfig, AuthProviderConfigFilter, BaseAuthProviderConfig, BaseCreateMultiFactorInfoRequest, BaseUpdateMultiFactorInfoRequest, CreateMultiFactorInfoRequest, CreatePhoneMultiFactorInfoRequest, CreateRequest, EmailSignInProviderConfig, ListProviderConfigResults, MultiFactorConfig, MultiFactorConfigState, MultiFactorCreateSettings, MultiFactorUpdateSettings, OAuthResponseType, OIDCAuthProviderConfig, OIDCUpdateAuthProviderRequest, SAMLAuthProviderConfig, SAMLUpdateAuthProviderRequest, UserProvider, UpdateAuthProviderRequest, UpdateMultiFactorInfoRequest, UpdatePhoneMultiFactorInfoRequest, UpdateRequest, } from './auth-config';
|
|
48
|
+
export { AllowByDefault, AllowByDefaultWrap, AllowlistOnly, AllowlistOnlyWrap, AuthFactorType, AuthProviderConfig, AuthProviderConfigFilter, BaseAuthProviderConfig, BaseCreateMultiFactorInfoRequest, BaseUpdateMultiFactorInfoRequest, CreateMultiFactorInfoRequest, CreatePhoneMultiFactorInfoRequest, CreateRequest, EmailSignInProviderConfig, ListProviderConfigResults, MultiFactorConfig, MultiFactorConfigState, MultiFactorCreateSettings, MultiFactorUpdateSettings, OAuthResponseType, OIDCAuthProviderConfig, OIDCUpdateAuthProviderRequest, SAMLAuthProviderConfig, SAMLUpdateAuthProviderRequest, SmsRegionConfig, UserProvider, UpdateAuthProviderRequest, UpdateMultiFactorInfoRequest, UpdatePhoneMultiFactorInfoRequest, UpdateRequest, } from './auth-config';
|
|
49
49
|
export { BaseAuth, DeleteUsersResult, GetUsersResult, ListUsersResult, SessionCookieOptions, } from './base-auth';
|
|
50
50
|
export { EmailIdentifier, PhoneIdentifier, ProviderIdentifier, UidIdentifier, UserIdentifier, } from './identifier';
|
|
51
51
|
export { CreateTenantRequest, Tenant, UpdateTenantRequest, } from './tenant';
|
|
52
52
|
export { ListTenantsResult, TenantAwareAuth, TenantManager, } from './tenant-manager';
|
|
53
|
+
export { UpdateProjectConfigRequest, ProjectConfig, } from './project-config';
|
|
54
|
+
export { ProjectConfigManager, } from './project-config-manager';
|
|
53
55
|
export { DecodedIdToken, DecodedAuthBlockingToken } from './token-verifier';
|
|
54
56
|
export { HashAlgorithmType, UserImportOptions, UserImportRecord, UserImportResult, UserMetadataRequest, UserProviderRequest, } from './user-import-builder';
|
|
55
57
|
export { MultiFactorInfo, MultiFactorSettings, PhoneMultiFactorInfo, UserInfo, UserMetadata, UserRecord, } from './user-record';
|
package/lib/auth/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v11.0
|
|
1
|
+
/*! firebase-admin v11.2.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2020 Google Inc.
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.UserRecord = exports.UserMetadata = exports.UserInfo = exports.PhoneMultiFactorInfo = exports.MultiFactorSettings = exports.MultiFactorInfo = exports.TenantManager = exports.TenantAwareAuth = exports.Tenant = exports.BaseAuth = exports.Auth = exports.getAuth = void 0;
|
|
19
|
+
exports.UserRecord = exports.UserMetadata = exports.UserInfo = exports.PhoneMultiFactorInfo = exports.MultiFactorSettings = exports.MultiFactorInfo = exports.ProjectConfigManager = exports.ProjectConfig = exports.TenantManager = exports.TenantAwareAuth = exports.Tenant = exports.BaseAuth = exports.Auth = exports.getAuth = void 0;
|
|
20
20
|
/**
|
|
21
21
|
* Firebase Authentication.
|
|
22
22
|
*
|
|
@@ -62,6 +62,10 @@ Object.defineProperty(exports, "Tenant", { enumerable: true, get: function () {
|
|
|
62
62
|
var tenant_manager_1 = require("./tenant-manager");
|
|
63
63
|
Object.defineProperty(exports, "TenantAwareAuth", { enumerable: true, get: function () { return tenant_manager_1.TenantAwareAuth; } });
|
|
64
64
|
Object.defineProperty(exports, "TenantManager", { enumerable: true, get: function () { return tenant_manager_1.TenantManager; } });
|
|
65
|
+
var project_config_1 = require("./project-config");
|
|
66
|
+
Object.defineProperty(exports, "ProjectConfig", { enumerable: true, get: function () { return project_config_1.ProjectConfig; } });
|
|
67
|
+
var project_config_manager_1 = require("./project-config-manager");
|
|
68
|
+
Object.defineProperty(exports, "ProjectConfigManager", { enumerable: true, get: function () { return project_config_manager_1.ProjectConfigManager; } });
|
|
65
69
|
var user_record_1 = require("./user-record");
|
|
66
70
|
Object.defineProperty(exports, "MultiFactorInfo", { enumerable: true, get: function () { return user_record_1.MultiFactorInfo; } });
|
|
67
71
|
Object.defineProperty(exports, "MultiFactorSettings", { enumerable: true, get: function () { return user_record_1.MultiFactorSettings; } });
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*! firebase-admin v11.2.0 */
|
|
2
|
+
import { ProjectConfig, UpdateProjectConfigRequest } from './project-config';
|
|
3
|
+
/**
|
|
4
|
+
* Defines the project config manager used to help manage project config related operations.
|
|
5
|
+
* This includes:
|
|
6
|
+
* <ul>
|
|
7
|
+
* <li>The ability to update and get project config.</li>
|
|
8
|
+
*/
|
|
9
|
+
export declare class ProjectConfigManager {
|
|
10
|
+
private readonly authRequestHandler;
|
|
11
|
+
/**
|
|
12
|
+
* Get the project configuration.
|
|
13
|
+
*
|
|
14
|
+
* @returns A promise fulfilled with the project configuration.
|
|
15
|
+
*/
|
|
16
|
+
getProjectConfig(): Promise<ProjectConfig>;
|
|
17
|
+
/**
|
|
18
|
+
* Updates an existing project configuration.
|
|
19
|
+
*
|
|
20
|
+
* @param projectConfigOptions - The properties to update on the project.
|
|
21
|
+
*
|
|
22
|
+
* @returns A promise fulfilled with the updated project config.
|
|
23
|
+
*/
|
|
24
|
+
updateProjectConfig(projectConfigOptions: UpdateProjectConfigRequest): Promise<ProjectConfig>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*! firebase-admin v11.2.0 */
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ProjectConfigManager = void 0;
|
|
5
|
+
const project_config_1 = require("./project-config");
|
|
6
|
+
const auth_api_request_1 = require("./auth-api-request");
|
|
7
|
+
/**
|
|
8
|
+
* Defines the project config manager used to help manage project config related operations.
|
|
9
|
+
* This includes:
|
|
10
|
+
* <ul>
|
|
11
|
+
* <li>The ability to update and get project config.</li>
|
|
12
|
+
*/
|
|
13
|
+
class ProjectConfigManager {
|
|
14
|
+
/**
|
|
15
|
+
* Initializes a ProjectConfigManager instance for a specified FirebaseApp.
|
|
16
|
+
*
|
|
17
|
+
* @param app - The app for this ProjectConfigManager instance.
|
|
18
|
+
*
|
|
19
|
+
* @constructor
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
constructor(app) {
|
|
23
|
+
this.authRequestHandler = new auth_api_request_1.AuthRequestHandler(app);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get the project configuration.
|
|
27
|
+
*
|
|
28
|
+
* @returns A promise fulfilled with the project configuration.
|
|
29
|
+
*/
|
|
30
|
+
getProjectConfig() {
|
|
31
|
+
return this.authRequestHandler.getProjectConfig()
|
|
32
|
+
.then((response) => {
|
|
33
|
+
return new project_config_1.ProjectConfig(response);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Updates an existing project configuration.
|
|
38
|
+
*
|
|
39
|
+
* @param projectConfigOptions - The properties to update on the project.
|
|
40
|
+
*
|
|
41
|
+
* @returns A promise fulfilled with the updated project config.
|
|
42
|
+
*/
|
|
43
|
+
updateProjectConfig(projectConfigOptions) {
|
|
44
|
+
return this.authRequestHandler.updateProjectConfig(projectConfigOptions)
|
|
45
|
+
.then((response) => {
|
|
46
|
+
return new project_config_1.ProjectConfig(response);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.ProjectConfigManager = ProjectConfigManager;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*! firebase-admin v11.2.0 */
|
|
2
|
+
import { SmsRegionConfig } from './auth-config';
|
|
3
|
+
/**
|
|
4
|
+
* Interface representing the properties to update on the provided project config.
|
|
5
|
+
*/
|
|
6
|
+
export interface UpdateProjectConfigRequest {
|
|
7
|
+
/**
|
|
8
|
+
* The SMS configuration to update on the project.
|
|
9
|
+
*/
|
|
10
|
+
smsRegionConfig?: SmsRegionConfig;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Response received from getting or updating a project config.
|
|
14
|
+
* This object currently exposes only the SMS Region config.
|
|
15
|
+
*/
|
|
16
|
+
export interface ProjectConfigServerResponse {
|
|
17
|
+
smsRegionConfig?: SmsRegionConfig;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Request sent to update project config.
|
|
21
|
+
* This object currently exposes only the SMS Region config.
|
|
22
|
+
*/
|
|
23
|
+
export interface ProjectConfigClientRequest {
|
|
24
|
+
smsRegionConfig?: SmsRegionConfig;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Represents a project configuration.
|
|
28
|
+
*/
|
|
29
|
+
export declare class ProjectConfig {
|
|
30
|
+
/**
|
|
31
|
+
* The SMS Regions Config for the project.
|
|
32
|
+
* Configures the regions where users are allowed to send verification SMS.
|
|
33
|
+
* This is based on the calling code of the destination phone number.
|
|
34
|
+
*/
|
|
35
|
+
readonly smsRegionConfig?: SmsRegionConfig;
|
|
36
|
+
/**
|
|
37
|
+
* Validates a project config options object. Throws an error on failure.
|
|
38
|
+
*
|
|
39
|
+
* @param request - The project config options object to validate.
|
|
40
|
+
*/
|
|
41
|
+
private static validate;
|
|
42
|
+
/**
|
|
43
|
+
* Returns a JSON-serializable representation of this object.
|
|
44
|
+
*
|
|
45
|
+
* @returns A JSON-serializable representation of this object.
|
|
46
|
+
*/
|
|
47
|
+
toJSON(): object;
|
|
48
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/*! firebase-admin v11.2.0 */
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ProjectConfig = void 0;
|
|
5
|
+
/*!
|
|
6
|
+
* Copyright 2022 Google Inc.
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
const validator = require("../utils/validator");
|
|
21
|
+
const error_1 = require("../utils/error");
|
|
22
|
+
const auth_config_1 = require("./auth-config");
|
|
23
|
+
const deep_copy_1 = require("../utils/deep-copy");
|
|
24
|
+
/**
|
|
25
|
+
* Represents a project configuration.
|
|
26
|
+
*/
|
|
27
|
+
class ProjectConfig {
|
|
28
|
+
/**
|
|
29
|
+
* The Project Config object constructor.
|
|
30
|
+
*
|
|
31
|
+
* @param response - The server side response used to initialize the Project Config object.
|
|
32
|
+
* @constructor
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
constructor(response) {
|
|
36
|
+
if (typeof response.smsRegionConfig !== 'undefined') {
|
|
37
|
+
this.smsRegionConfig = response.smsRegionConfig;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Validates a project config options object. Throws an error on failure.
|
|
42
|
+
*
|
|
43
|
+
* @param request - The project config options object to validate.
|
|
44
|
+
*/
|
|
45
|
+
static validate(request) {
|
|
46
|
+
if (!validator.isNonNullObject(request)) {
|
|
47
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ARGUMENT, '"UpdateProjectConfigRequest" must be a valid non-null object.');
|
|
48
|
+
}
|
|
49
|
+
const validKeys = {
|
|
50
|
+
smsRegionConfig: true,
|
|
51
|
+
};
|
|
52
|
+
// Check for unsupported top level attributes.
|
|
53
|
+
for (const key in request) {
|
|
54
|
+
if (!(key in validKeys)) {
|
|
55
|
+
throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ARGUMENT, `"${key}" is not a valid UpdateProjectConfigRequest parameter.`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Validate SMS Regions Config if provided.
|
|
59
|
+
if (typeof request.smsRegionConfig !== 'undefined') {
|
|
60
|
+
auth_config_1.SmsRegionsAuthConfig.validate(request.smsRegionConfig);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Build the corresponding server request for a UpdateProjectConfigRequest object.
|
|
65
|
+
* @param configOptions - The properties to convert to a server request.
|
|
66
|
+
* @returns The equivalent server request.
|
|
67
|
+
*
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
static buildServerRequest(configOptions) {
|
|
71
|
+
ProjectConfig.validate(configOptions);
|
|
72
|
+
return configOptions;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Returns a JSON-serializable representation of this object.
|
|
76
|
+
*
|
|
77
|
+
* @returns A JSON-serializable representation of this object.
|
|
78
|
+
*/
|
|
79
|
+
toJSON() {
|
|
80
|
+
// JSON serialization
|
|
81
|
+
const json = {
|
|
82
|
+
smsRegionConfig: (0, deep_copy_1.deepCopy)(this.smsRegionConfig),
|
|
83
|
+
};
|
|
84
|
+
if (typeof json.smsRegionConfig === 'undefined') {
|
|
85
|
+
delete json.smsRegionConfig;
|
|
86
|
+
}
|
|
87
|
+
return json;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.ProjectConfig = ProjectConfig;
|
package/lib/auth/tenant.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v11.0
|
|
1
|
+
/*! firebase-admin v11.2.0 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2019 Google Inc.
|
|
4
4
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import { EmailSignInConfigServerRequest, MultiFactorAuthServerConfig, MultiFactorConfig, EmailSignInProviderConfig } from './auth-config';
|
|
17
|
+
import { EmailSignInConfigServerRequest, MultiFactorAuthServerConfig, MultiFactorConfig, EmailSignInProviderConfig, SmsRegionConfig } from './auth-config';
|
|
18
18
|
/**
|
|
19
19
|
* Interface representing the properties to update on the provided tenant.
|
|
20
20
|
*/
|
|
@@ -42,6 +42,10 @@ export interface UpdateTenantRequest {
|
|
|
42
42
|
testPhoneNumbers?: {
|
|
43
43
|
[phoneNumber: string]: string;
|
|
44
44
|
} | null;
|
|
45
|
+
/**
|
|
46
|
+
* The SMS configuration to update on the project.
|
|
47
|
+
*/
|
|
48
|
+
smsRegionConfig?: SmsRegionConfig;
|
|
45
49
|
}
|
|
46
50
|
/**
|
|
47
51
|
* Interface representing the properties to set on a new tenant.
|
|
@@ -55,6 +59,7 @@ export interface TenantOptionsServerRequest extends EmailSignInConfigServerReque
|
|
|
55
59
|
testPhoneNumbers?: {
|
|
56
60
|
[key: string]: string;
|
|
57
61
|
};
|
|
62
|
+
smsRegionConfig?: SmsRegionConfig;
|
|
58
63
|
}
|
|
59
64
|
/** The tenant server response interface. */
|
|
60
65
|
export interface TenantServerResponse {
|
|
@@ -67,6 +72,7 @@ export interface TenantServerResponse {
|
|
|
67
72
|
testPhoneNumbers?: {
|
|
68
73
|
[key: string]: string;
|
|
69
74
|
};
|
|
75
|
+
smsRegionConfig?: SmsRegionConfig;
|
|
70
76
|
}
|
|
71
77
|
/**
|
|
72
78
|
* Represents a tenant configuration.
|
|
@@ -106,6 +112,12 @@ export declare class Tenant {
|
|
|
106
112
|
};
|
|
107
113
|
private readonly emailSignInConfig_?;
|
|
108
114
|
private readonly multiFactorConfig_?;
|
|
115
|
+
/**
|
|
116
|
+
* The SMS Regions Config to update a tenant.
|
|
117
|
+
* Configures the regions where users are allowed to send verification SMS.
|
|
118
|
+
* This is based on the calling code of the destination phone number.
|
|
119
|
+
*/
|
|
120
|
+
readonly smsRegionConfig?: SmsRegionConfig;
|
|
109
121
|
/**
|
|
110
122
|
* Validates a tenant options object. Throws an error on failure.
|
|
111
123
|
*
|
package/lib/auth/tenant.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v11.0
|
|
1
|
+
/*! firebase-admin v11.2.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2019 Google Inc.
|
|
@@ -72,6 +72,9 @@ class Tenant {
|
|
|
72
72
|
if (typeof response.testPhoneNumbers !== 'undefined') {
|
|
73
73
|
this.testPhoneNumbers = (0, deep_copy_1.deepCopy)(response.testPhoneNumbers || {});
|
|
74
74
|
}
|
|
75
|
+
if (typeof response.smsRegionConfig !== 'undefined') {
|
|
76
|
+
this.smsRegionConfig = (0, deep_copy_1.deepCopy)(response.smsRegionConfig);
|
|
77
|
+
}
|
|
75
78
|
}
|
|
76
79
|
/**
|
|
77
80
|
* Builds the corresponding server request for a TenantOptions object.
|
|
@@ -101,6 +104,9 @@ class Tenant {
|
|
|
101
104
|
// null will clear existing test phone numbers. Translate to empty object.
|
|
102
105
|
request.testPhoneNumbers = tenantOptions.testPhoneNumbers ?? {};
|
|
103
106
|
}
|
|
107
|
+
if (typeof tenantOptions.smsRegionConfig !== 'undefined') {
|
|
108
|
+
request.smsRegionConfig = tenantOptions.smsRegionConfig;
|
|
109
|
+
}
|
|
104
110
|
return request;
|
|
105
111
|
}
|
|
106
112
|
/**
|
|
@@ -132,6 +138,7 @@ class Tenant {
|
|
|
132
138
|
anonymousSignInEnabled: true,
|
|
133
139
|
multiFactorConfig: true,
|
|
134
140
|
testPhoneNumbers: true,
|
|
141
|
+
smsRegionConfig: true,
|
|
135
142
|
};
|
|
136
143
|
const label = createRequest ? 'CreateTenantRequest' : 'UpdateTenantRequest';
|
|
137
144
|
if (!validator.isNonNullObject(request)) {
|
|
@@ -167,6 +174,10 @@ class Tenant {
|
|
|
167
174
|
// This will throw an error if invalid.
|
|
168
175
|
auth_config_1.MultiFactorAuthConfig.buildServerRequest(request.multiFactorConfig);
|
|
169
176
|
}
|
|
177
|
+
// Validate SMS Regions Config if provided.
|
|
178
|
+
if (typeof request.smsRegionConfig != 'undefined') {
|
|
179
|
+
auth_config_1.SmsRegionsAuthConfig.validate(request.smsRegionConfig);
|
|
180
|
+
}
|
|
170
181
|
}
|
|
171
182
|
/**
|
|
172
183
|
* The email sign in provider configuration.
|
|
@@ -193,6 +204,7 @@ class Tenant {
|
|
|
193
204
|
multiFactorConfig: this.multiFactorConfig_?.toJSON(),
|
|
194
205
|
anonymousSignInEnabled: this.anonymousSignInEnabled,
|
|
195
206
|
testPhoneNumbers: this.testPhoneNumbers,
|
|
207
|
+
smsRegionConfig: (0, deep_copy_1.deepCopy)(this.smsRegionConfig),
|
|
196
208
|
};
|
|
197
209
|
if (typeof json.multiFactorConfig === 'undefined') {
|
|
198
210
|
delete json.multiFactorConfig;
|
|
@@ -200,6 +212,9 @@ class Tenant {
|
|
|
200
212
|
if (typeof json.testPhoneNumbers === 'undefined') {
|
|
201
213
|
delete json.testPhoneNumbers;
|
|
202
214
|
}
|
|
215
|
+
if (typeof json.smsRegionConfig === 'undefined') {
|
|
216
|
+
delete json.smsRegionConfig;
|
|
217
|
+
}
|
|
203
218
|
return json;
|
|
204
219
|
}
|
|
205
220
|
}
|
package/lib/auth/user-record.js
CHANGED
package/lib/credential/index.js
CHANGED
package/lib/database/database.js
CHANGED
package/lib/database/index.d.ts
CHANGED
package/lib/database/index.js
CHANGED
package/lib/default-namespace.js
CHANGED
package/lib/esm/auth/index.js
CHANGED
|
@@ -5,6 +5,8 @@ export const BaseAuth = mod.BaseAuth;
|
|
|
5
5
|
export const MultiFactorInfo = mod.MultiFactorInfo;
|
|
6
6
|
export const MultiFactorSettings = mod.MultiFactorSettings;
|
|
7
7
|
export const PhoneMultiFactorInfo = mod.PhoneMultiFactorInfo;
|
|
8
|
+
export const ProjectConfig = mod.ProjectConfig;
|
|
9
|
+
export const ProjectConfigManager = mod.ProjectConfigManager;
|
|
8
10
|
export const Tenant = mod.Tenant;
|
|
9
11
|
export const TenantAwareAuth = mod.TenantAwareAuth;
|
|
10
12
|
export const TenantManager = mod.TenantManager;
|
package/lib/eventarc/eventarc.js
CHANGED
package/lib/eventarc/index.d.ts
CHANGED
package/lib/eventarc/index.js
CHANGED