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

49 lines
1.5 KiB
TypeScript

import { String, Text } from 'oak-domain/lib/types/DataType';
import { Schema as User } from './User';
import { EntityShape } from 'oak-domain/lib/types/Entity';
import { ActionDef } from 'oak-domain/lib/types';
import { Channel, Weight } from '../types/Message';
import { EntityDesc } from 'oak-domain/lib/types/EntityDesc';
import { Schema as Platform } from './Platform';
export type Router = {
pathname: string;
props?: Record<string, any>;
state?: Record<string, any>;
isTabBar?: boolean;
};
type MessageRestriction = {
systemIds?: string[];
channels?: Array<Channel>;
disableRouter?: {
[key: Channel]: boolean;
};
};
type Channels = Channel[];
export interface Schema extends EntityShape {
entity: String<32>;
entityId: String<64>;
user: User;
type: String<64>;
weight: Weight;
restriction?: MessageRestriction;
title: String<256>;
content: Text;
data?: Object;
router?: Router;
platform?: Platform;
channels?: Channels;
}
export type IAction = 'succeed' | 'fail';
export type IState = 'sending' | 'success' | 'failure';
export type VisitState = 'unvisited' | 'visited';
export type VisitAction = 'visit';
export type Action = IAction | VisitAction;
export declare const IActionDef: ActionDef<IAction, IState>;
export declare const VisitActionDef: ActionDef<VisitAction, VisitState>;
export declare const entityDesc: EntityDesc<Schema, Action, '', {
visitState: VisitState;
iState: IState;
weight: Weight;
}>;
export {};