import { ManagementClientOptions } from './types'; import { GraphqlClient } from '../common/GraphqlClient'; import { ManagementTokenProvider } from './ManagementTokenProvider'; import { UpdateUserpoolInput, UserPool } from '../../types/graphql.v2'; import { HttpClient } from '../common/HttpClient'; /** * @name UserPoolManagementClient * @description Approw user pool configuration management module. * * This module can manage user pool configuration and environment variables by using API (please see detailed documentation). * * @example * * Please use the module in the following ways: * \`\`\`javascript * import { ManagementClient } from "appow-js-sdk" * const managementClient = new ManagementClient({ * userPoolId: "YOUR_USERPOOL_ID", * secret: "YOUR_USERPOOL_SECRET", * }) * * managementClient.userpool.detail // Get user pool configuration * managementClient.userpool.update // Modify user pool configuration * managementClient.userpool.env // Get the list of environment variables configured by the user pool * \`\`\` * * @class UsersManagementClient Manage user pool configuration */ export declare class UserPoolManagementClient { options: ManagementClientOptions; graphqlClient: GraphqlClient; tokenProvider: ManagementTokenProvider; httpClient: HttpClient; constructor(options: ManagementClientOptions, httpClient: HttpClient, graphqlClient: GraphqlClient, tokenProvider: ManagementTokenProvider); /**@name detail * @name_zh Query user pool configuration * @description Query user pool configuration * * @example * * const userpool = await managementClient.userpool.detail() * * @returns {Promise} * @memberof UserPoolManagementClient */ detail(): Promise; /** * @name update * @name_zh Update user pool configuration * @description Update user pool configuration * * @param {UpdateUserpoolInput} updates * @param {string} [updates.name] user pool name * @param {string} [updates.logo] user pool logo * @param {string} [updates.domain] User pool enterprise application panel second-level domain name * @param {string} [updates.description] description * @param {boolean} [updates.emailVerifiedDefault] Set the mailbox to be verified by default (the user’s emailVerified field is true) * @param {boolean} [updates.appSsoEnabled] Enable single sign-on between applications under the user pool * @param {boolean} [updates.sendWelcomeEmail] Whether to send a welcome email after user registration * @param {boolean} [updates.registerDisabled] Whether to close the registration, when the user pool closes the registration, ordinary users will not be able to register accounts, and only the administrator can manually create accounts. * @param {string} [updates.allowedOrigins] Security domain configuration. The security domain (Allowed Origins) is the URL that allows requests from JavaScript to the appow API (usually used with CORS). By default, the system will allow you to use all URLs. If required, this field allows you to enter other sources. You can separate multiple valid URLs line by line and use wildcards at the subdomain level (for example: https://*.sample.com). * The query string and hash information are not considered when verifying these URLs. If you bring the query string and hash information, the system will automatically ignore the entire domain name. * If there are more than one, please separate them with line breaks. * @param {Object} [updates.whitelist] User pool whitelist configuration * @param {boolean} [updates.whitelist.phoneEnabled] Whether to enable the whitelist of mobile phone numbers * @param {boolean} [updates.whitelist.emailEnabled] Whether to open the mailbox whitelist * @param {boolean} [updates.whitelist.usernameEnabled] Whether to enable the user name whitelist * @param {number} [updates.tokenExpiresAfter] token expiration time * @param {Object} [updates.loginFailCheck] Frequent login failure limit, after opening, after exceeding the number of times within the specified time, a verification code is required to log in again. If your business has concurrent logins in the same area at the same time period, please turn off this detection. * @param {boolean} [updates.loginFailCheck.enabled] Whether to open * @param {number} [updates.loginFailCheck.timeInterval] The detection period, in seconds. * @param {number} [updates.loginFailCheck.limit] Restrictions will be triggered when the number of failed logins to the same IP reaches. * @param {Object} [updates.frequentRegisterCheck] Frequency registration restriction. After opening the same IP, frequent registration of accounts will trigger frequency restriction, and it will take a while to register again. If your business has concurrent registrations in the same area and time period, please turn off this detection. * @param {boolean} [updates.frequentRegisterCheck.enabled] Whether enable * @param {Object} [updates.frequentRegisterCheck.timeInterval] The detection period, in seconds. * @param {Object} [updates.frequentRegisterCheck.limit] When the number of registrations of the same IP reaches this number in the same period, the frequency limit will be triggered. * * * @example * * const userpool = await managementClient.userpool.update({ * registerDisabled: true // Turn off system registration * }) * * @returns {Promise} * @memberof UserPoolManagementClient */ update(updates: UpdateUserpoolInput): Promise; /** * @name listEnv * @name_zh Get a list of environment variables * @description Get the list of user pool environment variables. The environment variables configured by the user pool can be used in the pipeline scenario. For details, please see: https://docs.approw.co/extensibility/pipeline/env.html * * @example * * const envList = await managementClient.userpool.listEnv() * * @returns {Promise} * @memberof UserPoolManagementClient */ listEnv(): Promise<{ key: string; value: any; }[]>; /** * @name addEnv * @name_zh Add environment variables * @description Add environment variables * * @param {string} key environment variables key * @param {any} value environment variables value * * @example * * const envList = await managementClient.userpool.addEnv('LARK_WEBHOOK', 'xxxxxxx') // 添加一个飞书群机器人 webhook 地址,之后可以在 pipeline 函数中使用(详细请见: https://docs.appow.co/extensibility/pipeline/usage.html) * * @returns {Promise} Return the latest list of environment variables * @memberof UserPoolManagementClient */ addEnv(key: string, value: any): Promise<{ key: string; value: any; }[]>; /** * @name removeEnv * @name_zh Delete environment variables * @description Delete environment variables * * @param {string} key environment variables key * * @example * * const envList = await managementClient.userpool.removeEnv('LARK_WEBHOOK') * * @returns {Promise} Return the latest list of environment variables * @memberof UserPoolManagementClient */ removeEnv(key: string): Promise<{ key: string; value: any; }[]>; }