270 lines
5.9 KiB
TypeScript
270 lines
5.9 KiB
TypeScript
// R8 contract-only declarations. Runtime behavior remains in SendChainService.
|
|
|
|
export interface CreateBatchTaskDto {
|
|
tenantId: string;
|
|
applicationId?: string;
|
|
templateId?: string;
|
|
content: string;
|
|
category?: string;
|
|
phones: string[];
|
|
sendMode?: 'immediate' | 'scheduled';
|
|
scheduledAt?: string;
|
|
variables?: Record<string, unknown>;
|
|
createdById?: string;
|
|
sourceIp?: string;
|
|
userAgent?: string;
|
|
sourceType?: 'client' | 'api' | 'cmpp';
|
|
clientMessageId?: string;
|
|
}
|
|
|
|
export type CreateHttpBatchTaskDto = Omit<CreateBatchTaskDto, 'templateId' | 'variables' | 'sourceType'>;
|
|
|
|
export interface GatewayInboundAuthDto {
|
|
account: string;
|
|
password?: string;
|
|
authSource?: string;
|
|
timestamp?: number;
|
|
remoteIp?: string;
|
|
version?: string;
|
|
requestedVersion?: number;
|
|
}
|
|
|
|
export interface GatewayInboundSubmitDto {
|
|
requestId?: string;
|
|
account: string;
|
|
phoneNumber?: string;
|
|
phoneNumbers?: string[];
|
|
content: string;
|
|
srcId?: string;
|
|
destId?: string;
|
|
sequenceId?: number;
|
|
registeredDelivery?: number;
|
|
remoteIp?: string;
|
|
longMessage?: {
|
|
reference: number;
|
|
total: number;
|
|
index: number;
|
|
format: number;
|
|
};
|
|
}
|
|
|
|
export interface GatewayInboundSingleSubmitResult {
|
|
accepted: boolean;
|
|
tenantId: string;
|
|
applicationId: string;
|
|
taskId: string;
|
|
messageId: string;
|
|
messageRecordId: string;
|
|
status: string;
|
|
}
|
|
|
|
export interface GatewaySubmitResultDto {
|
|
eventId?: string;
|
|
traceId?: string;
|
|
messageId: string;
|
|
channelId: string;
|
|
submitId?: string;
|
|
sequenceId?: number;
|
|
gatewayMessageId: string;
|
|
submitStatus: 'accepted' | 'rejected' | 'timeout';
|
|
errorCode?: string;
|
|
errorMessage?: string;
|
|
submittedAt?: string;
|
|
segments?: Array<{
|
|
segmentTotal?: number;
|
|
segmentIndex?: number;
|
|
sequenceId?: number;
|
|
gatewayMessageId?: string;
|
|
submitStatus?: 'accepted' | 'rejected' | 'timeout' | string;
|
|
errorCode?: string;
|
|
errorMessage?: string;
|
|
submittedAt?: string;
|
|
}>;
|
|
}
|
|
|
|
export interface GatewaySubmitSegmentResultDto {
|
|
eventId?: string;
|
|
traceId?: string;
|
|
messageId: string;
|
|
channelId: string;
|
|
submitId?: string;
|
|
segmentTotal: number;
|
|
segmentIndex: number;
|
|
sequenceId?: number;
|
|
gatewayMessageId?: string;
|
|
submitStatus: 'accepted' | 'rejected' | 'timeout' | string;
|
|
errorCode?: string;
|
|
errorMessage?: string;
|
|
submittedAt?: string;
|
|
}
|
|
|
|
export interface GatewayReceiptEventDto {
|
|
eventId?: string;
|
|
traceId?: string;
|
|
messageId?: string;
|
|
channelId: string;
|
|
sequenceId?: number;
|
|
gatewayMessageId: string;
|
|
phoneNumber?: string;
|
|
receiptStatus: 'delivered' | 'undelivered' | 'unknown';
|
|
rawStatus: string;
|
|
errorCode?: string;
|
|
errorMessage?: string;
|
|
deliveredAt?: string;
|
|
connectionId?: string;
|
|
}
|
|
|
|
export interface GatewayUplinkEventDto {
|
|
eventId?: string;
|
|
traceId?: string;
|
|
messageId?: string;
|
|
channelId: string;
|
|
sequenceId?: number;
|
|
phoneNumber: string;
|
|
destId: string;
|
|
content: string;
|
|
receivedAt?: string;
|
|
}
|
|
|
|
export type UplinkMatchCandidateInput = {
|
|
tenantId: string;
|
|
applicationId: string;
|
|
messageRecordId?: string;
|
|
matchSource: 'access_number' | 'phone_window';
|
|
confidence: number;
|
|
reason: string;
|
|
};
|
|
|
|
export interface GatewayPendingDeliveryQueryDto {
|
|
account: string;
|
|
limit?: number;
|
|
claimId?: string;
|
|
leaseMs?: number;
|
|
}
|
|
|
|
export interface GatewayDownstreamSentDto {
|
|
id: string;
|
|
claimId?: string;
|
|
connectionId?: string;
|
|
sequenceId?: string;
|
|
messageId?: string;
|
|
sentAt?: string;
|
|
ackDeadlineAt?: string;
|
|
}
|
|
|
|
export interface GatewayDownstreamAcknowledgedDto extends GatewayDownstreamSentDto {
|
|
result: number;
|
|
acknowledgedAt?: string;
|
|
}
|
|
|
|
export type GatewayDownstreamFailureType =
|
|
| 'claim_released'
|
|
| 'send_failed'
|
|
| 'ack_timeout'
|
|
| 'ack_rejected'
|
|
| 'ack_invalid'
|
|
| 'connection_lost'
|
|
| 'unrecoverable'
|
|
| 'queue_timeout';
|
|
|
|
export type GatewayControlDeliveryResult = {
|
|
sent?: boolean;
|
|
delivered?: boolean;
|
|
retryable?: boolean;
|
|
reasonCode?: string;
|
|
errorMessage?: string;
|
|
connectionId?: string;
|
|
sequenceId?: string;
|
|
messageId?: string;
|
|
sentAt?: string;
|
|
ackDeadlineAt?: string;
|
|
};
|
|
|
|
export interface GatewaySubmitDeadLetterDto {
|
|
streamMessageId: string;
|
|
traceId?: string;
|
|
messageId?: string;
|
|
channelId?: string;
|
|
tenantId?: string;
|
|
applicationId?: string;
|
|
submitId?: string;
|
|
failureCode: string;
|
|
failureMessage: string;
|
|
attempts: number;
|
|
maxAttempts: number;
|
|
commandPayload?: Record<string, unknown>;
|
|
rawPayload?: string;
|
|
deadLetteredAt?: string;
|
|
}
|
|
|
|
export interface RequeueGatewaySubmitExceptionDto {
|
|
confirmedNotSubmitted?: boolean;
|
|
reason?: string;
|
|
operatorId?: string;
|
|
}
|
|
|
|
export interface GatewayDownstreamRecoveryStatusDto {
|
|
account: string;
|
|
gatewayInstanceId?: string;
|
|
state: string;
|
|
lockOwner?: string;
|
|
lockExpiresAt?: string;
|
|
lastAttemptAt?: string;
|
|
lastSuccessAt?: string;
|
|
lastFailureAt?: string;
|
|
nextRetryAt?: string;
|
|
attemptCount?: number;
|
|
failureCategory?: string;
|
|
lastError?: string;
|
|
lastSkipReason?: string;
|
|
}
|
|
|
|
export interface TimeoutUnknownDto {
|
|
olderThanHours?: number;
|
|
}
|
|
|
|
export interface ImportPreviewDto {
|
|
tenantId: string;
|
|
applicationId?: string;
|
|
content: string;
|
|
fileName?: string;
|
|
encoding?: 'utf8' | 'gbk';
|
|
delimiter?: ',' | '\t';
|
|
requiredVariables?: string[];
|
|
}
|
|
|
|
export interface ConfirmImportDto extends CreateBatchTaskDto {
|
|
importContent: string;
|
|
requiredVariables?: string[];
|
|
}
|
|
|
|
export interface SendJob {
|
|
messageRecordId: string;
|
|
}
|
|
|
|
export type QueuePriority = 'normal' | 'priority';
|
|
|
|
export type RoutedChannel = {
|
|
channel: {
|
|
id: string;
|
|
code: string;
|
|
account: string;
|
|
srcId: string;
|
|
rateLimitPerSecond: number;
|
|
unitPrice: number;
|
|
status: string;
|
|
carrier?: string | null;
|
|
sendRegion: string;
|
|
gatewayHost: string;
|
|
gatewayPort: number;
|
|
passwordCipher: string;
|
|
cmppVersion: string;
|
|
config?: unknown;
|
|
};
|
|
carrier: string;
|
|
province?: string | null;
|
|
groupId: string;
|
|
groupName: string;
|
|
routeScope: 'province' | 'national';
|
|
};
|