oak-general-business/lib/entities/Application.d.ts

88 lines
2.3 KiB
TypeScript

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 Passport = 'email' | 'mobile' | 'wechat' | 'wechatPublic' | 'wechatNative';
export type AppType = 'web' | 'wechatMp' | 'wechatPublic' | 'native';
export type WechatMpConfig = {
type: 'wechatMp';
appId: string;
appSecret: string;
originalId?: string;
qrCodePrefix?: string;
server?: {
url?: string;
token: string;
encodingAESKey: string;
mode: 'clear' | 'compatible' | 'safe';
dataFormat: 'json' | 'xml';
};
passport?: Passport[];
};
export type WebConfig = {
type: 'web';
wechat?: {
appId: string;
appSecret: string;
domain?: string;
enable?: boolean;
};
passport?: Passport[];
location: {
protocol: 'http:' | 'https:';
hostname: string;
port: string;
};
};
export type WechatPublicTemplateMsgsConfig = Record<string, string>;
export type WechatPublicConfig = {
type: 'wechatPublic';
isService: boolean;
appId: string;
appSecret: string;
originalId?: string;
templateMsgs?: WechatPublicTemplateMsgsConfig;
server?: {
url?: string;
token: string;
encodingAESKey: string;
mode: 'clear' | 'compatible' | 'safe';
};
wechatMp?: {
appId: string;
originalId: string;
};
passport?: Passport[];
location: {
protocol: 'http:' | 'https:';
hostname: string;
port: string;
};
};
export type NativeConfig = {
type: 'native';
passport?: Passport[];
wechatNative?: {
appId: string;
appSecret: string;
domain?: string;
};
location: {
protocol: 'http:' | 'https:';
hostname: string;
port: string;
};
};
export interface Schema extends EntityShape {
name: String<32>;
description?: Text;
type: AppType;
system: System;
config: WebConfig | WechatMpConfig | WechatPublicConfig | NativeConfig;
style?: Style;
sessions?: Session[];
domain?: Domain;
}