@k-msg/channel
Version:
AlimTalk channel and sender number management
216 lines (215 loc) • 6.77 kB
TypeScript
import { z } from "zod/mini";
export interface Channel {
id: string;
name: string;
provider: string;
type: ChannelType;
status: ChannelStatus;
profileKey: string;
senderNumbers: SenderNumber[];
metadata: ChannelMetadata;
createdAt: Date;
updatedAt: Date;
}
export declare enum ChannelType {
KAKAO_ALIMTALK = "KAKAO_ALIMTALK",
KAKAO_FRIENDTALK = "KAKAO_FRIENDTALK",
SMS = "SMS",
LMS = "LMS",
MMS = "MMS"
}
export declare enum ChannelStatus {
PENDING = "PENDING",// 등록 대기
VERIFYING = "VERIFYING",// 검증 중
ACTIVE = "ACTIVE",// 활성화
SUSPENDED = "SUSPENDED",// 일시 정지
BLOCKED = "BLOCKED",// 차단됨
DELETED = "DELETED"
}
export interface SenderNumber {
id: string;
/**
* Optional association to a Channel.
* Some managers (e.g. KakaoSenderNumberManager) are channel-scoped.
*/
channelId?: string;
phoneNumber: string;
status: SenderNumberStatus;
verifiedAt?: Date;
category: SenderNumberCategory;
metadata: {
businessName?: string;
businessRegistrationNumber?: string;
contactPerson?: string;
contactEmail?: string;
};
createdAt: Date;
updatedAt: Date;
}
export declare enum SenderNumberStatus {
PENDING = "PENDING",// 등록 대기
VERIFYING = "VERIFYING",// 인증 중
VERIFIED = "VERIFIED",// 인증 완료
REJECTED = "REJECTED",// 반려됨
BLOCKED = "BLOCKED"
}
export declare enum SenderNumberCategory {
BUSINESS = "BUSINESS",// 사업자
PERSONAL = "PERSONAL",// 개인
GOVERNMENT = "GOVERNMENT",// 관공서
NON_PROFIT = "NON_PROFIT"
}
export interface ChannelMetadata {
businessInfo?: {
name: string;
registrationNumber: string;
category: string;
contactPerson: string;
contactEmail: string;
contactPhone: string;
};
kakaoInfo?: {
plusFriendId: string;
brandName: string;
logoUrl?: string;
description?: string;
};
limits: {
dailyMessageLimit: number;
monthlyMessageLimit: number;
rateLimit: number;
};
features: {
supportsBulkSending: boolean;
supportsScheduling: boolean;
supportsButtons: boolean;
maxButtonCount: number;
};
}
export declare enum VerificationStatus {
NOT_REQUIRED = "NOT_REQUIRED",
PENDING = "PENDING",
UNDER_REVIEW = "UNDER_REVIEW",
VERIFIED = "VERIFIED",
REJECTED = "REJECTED"
}
export interface VerificationDocument {
id: string;
type: DocumentType;
fileName: string;
fileUrl: string;
uploadedAt: Date;
status: DocumentStatus;
}
export declare enum DocumentType {
BUSINESS_REGISTRATION = "BUSINESS_REGISTRATION",
BUSINESS_LICENSE = "BUSINESS_LICENSE",
ID_CARD = "ID_CARD",
AUTHORIZATION_LETTER = "AUTHORIZATION_LETTER",
OTHER = "OTHER"
}
export declare enum DocumentStatus {
UPLOADED = "UPLOADED",
VERIFIED = "VERIFIED",
REJECTED = "REJECTED"
}
export interface ChannelCreateRequest {
name: string;
type: ChannelType;
provider: string;
profileKey: string;
businessInfo?: {
name: string;
registrationNumber: string;
category: string;
contactPerson: string;
contactEmail: string;
contactPhone: string;
};
kakaoInfo?: {
plusFriendId: string;
brandName: string;
logoUrl?: string;
description?: string;
};
}
export interface SenderNumberCreateRequest {
phoneNumber: string;
category: SenderNumberCategory;
businessInfo?: {
businessName: string;
businessRegistrationNumber: string;
contactPerson: string;
contactEmail: string;
};
}
export interface ChannelFilters {
provider?: string;
type?: ChannelType;
status?: ChannelStatus;
createdAfter?: Date;
createdBefore?: Date;
}
export interface SenderNumberFilters {
channelId?: string;
status?: SenderNumberStatus;
category?: SenderNumberCategory;
verified?: boolean;
}
export declare const ChannelCreateRequestSchema: z.ZodMiniObject<{
name: z.ZodMiniString<string>;
type: z.ZodMiniEnum<typeof ChannelType>;
provider: z.ZodMiniString<string>;
profileKey: z.ZodMiniString<string>;
businessInfo: z.ZodMiniOptional<z.ZodMiniObject<{
name: z.ZodMiniString<string>;
registrationNumber: z.ZodMiniString<string>;
category: z.ZodMiniString<string>;
contactPerson: z.ZodMiniString<string>;
contactEmail: z.ZodMiniEmail;
contactPhone: z.ZodMiniString<string>;
}, z.core.$strip>>;
kakaoInfo: z.ZodMiniOptional<z.ZodMiniObject<{
plusFriendId: z.ZodMiniString<string>;
brandName: z.ZodMiniString<string>;
logoUrl: z.ZodMiniOptional<z.ZodMiniURL>;
description: z.ZodMiniOptional<z.ZodMiniString<string>>;
}, z.core.$strip>>;
}, z.core.$strip>;
export declare const SenderNumberCreateRequestSchema: z.ZodMiniObject<{
phoneNumber: z.ZodMiniString<string>;
category: z.ZodMiniEnum<typeof SenderNumberCategory>;
businessInfo: z.ZodMiniOptional<z.ZodMiniObject<{
businessName: z.ZodMiniString<string>;
businessRegistrationNumber: z.ZodMiniString<string>;
contactPerson: z.ZodMiniString<string>;
contactEmail: z.ZodMiniEmail;
}, z.core.$strip>>;
}, z.core.$strip>;
export declare const ChannelFiltersSchema: z.ZodMiniObject<{
provider: z.ZodMiniOptional<z.ZodMiniString<string>>;
type: z.ZodMiniOptional<z.ZodMiniEnum<typeof ChannelType>>;
status: z.ZodMiniOptional<z.ZodMiniEnum<typeof ChannelStatus>>;
createdAfter: z.ZodMiniOptional<z.ZodMiniDate<Date>>;
createdBefore: z.ZodMiniOptional<z.ZodMiniDate<Date>>;
}, z.core.$strip>;
export declare const SenderNumberFiltersSchema: z.ZodMiniObject<{
channelId: z.ZodMiniOptional<z.ZodMiniString<string>>;
status: z.ZodMiniOptional<z.ZodMiniEnum<typeof SenderNumberStatus>>;
category: z.ZodMiniOptional<z.ZodMiniEnum<typeof SenderNumberCategory>>;
verified: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
}, z.core.$strip>;
export type ChannelCreateRequestType = z.infer<typeof ChannelCreateRequestSchema>;
export type SenderNumberCreateRequestType = z.infer<typeof SenderNumberCreateRequestSchema>;
export type ChannelFiltersType = z.infer<typeof ChannelFiltersSchema>;
export type SenderNumberFiltersType = z.infer<typeof SenderNumberFiltersSchema>;
export interface ChannelConfig {
id: string;
name: string;
type: "alimtalk" | "sms" | "lms" | "friendtalk";
providerId: string;
active: boolean;
settings: Record<string, unknown>;
createdAt: Date;
updatedAt: Date;
}