oak-general-business/es/types/Config.d.ts

209 lines
5.3 KiB
TypeScript

import { QiniuZone, CTYunZone, ALiYunZone, TencentYunZone, AmapKeyType } from 'oak-external-sdk';
export type Protocol = 'http:' | 'https:';
export type QiniuCloudConfig = {
accessKey: string;
secretKey: string;
};
export type QiniuLiveConfig = {
accessKey: string;
liveHost: string;
hub: string;
publishDomain: string;
playDomainType?: 'rtmp' | 'hls' | 'flv';
playDomain: string;
playBackDomain: string;
publishSecurity?: 'none' | 'static' | 'expiry' | 'expiry_sk';
publishKey: string;
playKey: string;
};
export type QiniuCosConfig = {
accessKey: string;
buckets: {
zone: QiniuZone;
name: string;
domain: string;
protocol: Protocol | Protocol[];
}[];
defaultBucket: string;
};
export type CTYunCosConfig = {
accessKey: string;
buckets: {
zone: CTYunZone;
name: string;
domain: string;
protocol: Protocol | Protocol[];
}[];
defaultBucket: string;
};
export type ALiYunCosConfig = {
accessKey: string;
buckets: {
zone: ALiYunZone;
name: string;
domain: string;
protocol: Protocol | Protocol[];
}[];
defaultBucket: string;
};
export type TencentYunCosConfig = {
accessKey: string;
buckets: {
zone: TencentYunZone;
name: string;
domain: string;
protocol: Protocol | Protocol[];
}[];
defaultBucket: string;
};
export type LocalCosConfig = {
accessKey: string;
buckets: {
name: string;
domain: string;
protocol: Protocol | Protocol[];
nginxPath?: string;
savePath: string;
uploadUrl: string;
getUrl: string;
downloadUrl?: string;
}[];
defaultBucket: string;
};
export type S3Zone = 'us-east-1' | 'us-west-1' | 'us-west-2' | 'eu-west-1' | 'eu-central-1' | 'ap-southeast-1' | 'ap-northeast-1' | string;
export type S3CosConfig = {
accessKey: string;
endpoint?: string;
buckets: {
zone?: S3Zone;
name: string;
domain: string;
protocol: Protocol | Protocol[];
pathStyle?: boolean;
}[];
defaultBucket: string;
};
export type AMapConfig = {
key: string;
type: AmapKeyType;
};
export type MapWorldConfig = {
webApiKey: string;
};
export type LocalCloudConfig = {
accessKey: string;
secretKey: string;
};
export type S3AccountConfig = {
accessKey: string;
secretKey: string;
};
export type AliCloudConfig = {
accessKeyId: string;
accessKeySecret: string;
regionId?: string;
apiVersion?: string;
endpoint?: string;
smsEndpoint?: string;
};
export type TencentCloudConfig = {
secretId: string;
secretKey: string;
region?: string;
endpoint?: string;
smsEndpoint?: string;
};
export type CTYunCloudConfig = {
accessKey: string;
securityKey: string;
smsEndpoint?: string;
};
export type AmapCloudConfig = {
webApiKey: string;
};
export type AliSmsConfig = {
accessKeyId: string;
accessKeySecret: string;
defaultSignName: string;
apiVersion: string;
endpoint: string;
};
export type CTYunSmsConfig = {
accessKey: string;
securityKey: string;
defaultSignName: string;
endpoint: string;
};
export type TencentSmsConfig = {
secretId: string;
secretKey: string;
smsSdkAppId: string;
region: string;
defaultSignName: string;
endpoint: string;
};
export type EmailConfig = {
host: string;
port: number;
account: string;
password: string;
passwordExpiredAt?: number;
name?: string;
secure?: boolean;
};
export type QrCodeType = 'wechatMpDomainUrl' | 'wechatMpWxaCode' | 'wechatPublic' | 'wechatPublicForMp' | 'webForWechatPublic';
export type Config = {
Account?: {
ali?: AliCloudConfig[];
tencent?: TencentCloudConfig[];
qiniu?: QiniuCloudConfig[];
ctyun?: CTYunCloudConfig[];
amap?: AmapCloudConfig[];
local?: LocalCloudConfig[];
s3?: S3AccountConfig[];
};
Cos?: {
qiniu?: QiniuCosConfig;
ctyun?: CTYunCosConfig;
aliyun?: ALiYunCosConfig;
tencent?: TencentYunCosConfig;
local?: LocalCosConfig;
s3?: S3CosConfig;
defaultOrigin?: CosOrigin;
};
Live?: {
qiniu?: QiniuLiveConfig;
};
Map?: {
amaps?: Array<AMapConfig>;
mapWorld?: MapWorldConfig;
};
Sms?: {
mockSend?: boolean;
defaultOrigin?: 'ali' | 'tencent' | 'ctyun';
ali?: AliSmsConfig[];
tencent?: TencentSmsConfig[];
ctyun?: CTYunSmsConfig[];
};
App: {
qrCodeType?: QrCodeType;
qrCodeApplicationId?: string;
qrCodePublicForMpId?: string;
mpShareImageUrl?: string;
mergeUserDirectly?: boolean;
tokenRefreshTime?: number;
tokenExpireTime?: number;
needUploadIDCardPhoto?: boolean;
needManualVerification?: boolean;
};
Emails?: EmailConfig[];
Security?: {
type?: 'password';
level?: 'weak' | 'medium' | 'strong';
passwordVerifyGap?: number;
};
};
export type AccountOrigin = 'ali' | 'tencent' | 'qiniu' | 'amap' | 'ctyun' | 'local' | 's3';
export type CosOrigin = 'qiniu' | 'wechat' | 'ctyun' | 'aliyun' | 'tencent' | 'local' | 'unknown' | 's3';
export type Service = 'Map' | 'Cos' | 'Live' | 'Sms' | 'Emails';