import { String, Text } from 'oak-domain/lib/types/DataType'; import { EntityShape } from 'oak-domain/lib/types/Entity'; import { Schema as System } from './System'; import { Schema as Session } from './Session'; import { Schema as Domain } from './Domain'; import { Style } from '../types/Style'; export type CosOrigin = 'qiniu' | 'wechat' | 'ctyun' | 'aliyun' | 'tencent' | 'local' | 'unknown' | 's3'; export type AppType = 'web' | 'wechatMp' | 'wechatPublic' | 'native'; export type WechatMpConfig = { type: 'wechatMp'; appId: string; appSecret: string; originalId?: string; qrCodePrefix?: string; getPhone?: boolean; server?: { url?: string; token: string; encodingAESKey: string; mode: 'clear' | 'compatible' | 'safe'; dataFormat: 'json' | 'xml'; }; cos?: { defaultOrigin: CosOrigin; }; }; export type WebConfig = { type: 'web'; wechat?: { appId: string; appSecret: string; domain?: string; enable?: boolean; }; wechatPay?: { appId: string; appSecret: string; }; location: { protocol: 'http:' | 'https:'; hostname: string; port: string; }; cos?: { defaultOrigin: CosOrigin; }; }; export type WechatPublicConfig = { type: 'wechatPublic'; isService: boolean; appId: string; appSecret: string; originalId?: string; server?: { url?: string; token: string; encodingAESKey: string; mode: 'clear' | 'compatible' | 'safe'; }; wechatMp?: { appId: string; originalId: string; }; location: { protocol: 'http:' | 'https:'; hostname: string; port: string; }; cos?: { defaultOrigin: CosOrigin; }; }; export type NativeConfig = { type: 'native'; wechatNative?: { appId: string; appSecret: string; domain?: string; }; location: { protocol: 'http:' | 'https:'; hostname: string; port: string; }; cos?: { defaultOrigin: CosOrigin; }; }; type Versions = string[]; export interface Schema extends EntityShape { name: String<32>; description?: Text; type: AppType; system: System; config: WebConfig | WechatMpConfig | WechatPublicConfig | NativeConfig; style?: Style; dangerousVersions: Versions; warningVersions: Versions; soaVersion: String<32>; sessions?: Session[]; domain?: Domain; } export {};