somod-chat-service
Version:
Serverless Chat Service from SOMOD
44 lines (43 loc) • 1.24 kB
TypeScript
export type ThreadInput = {
participants: string[];
} & ThreadSessionRequired;
export type ThreadSessionRequired = {
sessionRequired?: string[];
sessionRequiredTill?: number[];
};
export type Thread = {
id: string;
createdAt?: number;
} & ThreadInput & ThreadSessionRequired;
export type MessageInput = {
threadId: string;
type: "text" | "image" | "control" | "call" | "pooja" | "donation";
action: "new" | "edit" | "delete" | "sessionStart" | "sessionExtend" | "sessionEnd" | "sessionRequirementChange" | "initiated" | "declined";
message: string;
sessionToken?: string;
};
export type Message = {
id: string;
from: string;
seqNo: number;
sentAt: number;
sessionId?: string;
} & MessageInput;
export type Session = {
id: string;
participants: string[];
startTime: number;
endTime: number;
};
export declare const typeToAllowedActionsMap: {
text: string[];
image: string[];
control: string[];
call: string[];
pooja: string[];
donation: string[];
};
/**
* Store the message type and actions for which the session token is required
*/
export declare const sessionRequirement: Record<string, Record<string, undefined | "thread" | "always">>;