feat(service): P5.2 adapter tables (raw_event, outbound_command, delivery_attempt, rate_limit_bucket) + resetDb
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -517,3 +517,63 @@ model IiosCallbackRequest {
|
||||
|
||||
@@index([scopeId, status])
|
||||
}
|
||||
|
||||
// ─── P5: Adapters (anti-corruption layer, simulation mode) ────────
|
||||
|
||||
/// Raw inbound provider payload (claim-check / replay). Verified before storing.
|
||||
model IiosInboundRawEvent {
|
||||
id String @id @default(cuid())
|
||||
channelType String
|
||||
externalEventId String?
|
||||
signatureStatus String // VERIFIED | INVALID | UNSIGNED
|
||||
status String @default("RECEIVED") // RECEIVED | NORMALIZED | REJECTED | FAILED
|
||||
headers Json?
|
||||
payload Json
|
||||
traceId String?
|
||||
interactionId String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@unique([channelType, externalEventId])
|
||||
@@index([status])
|
||||
}
|
||||
|
||||
/// A signed command to send on an external channel — executed by the sandbox sink.
|
||||
model IiosOutboundCommand {
|
||||
id String @id @default(cuid())
|
||||
channelType String
|
||||
target String
|
||||
payload Json
|
||||
status String @default("PENDING") // PENDING | SENT | FAILED | RATE_LIMITED
|
||||
idempotencyKey String @unique
|
||||
providerRef String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
attempts IiosDeliveryAttempt[]
|
||||
|
||||
@@index([channelType, status])
|
||||
}
|
||||
|
||||
model IiosDeliveryAttempt {
|
||||
id String @id @default(cuid())
|
||||
commandId String
|
||||
command IiosOutboundCommand @relation(fields: [commandId], references: [id], onDelete: Cascade)
|
||||
attemptNo Int
|
||||
status String
|
||||
providerRef String?
|
||||
latencyMs Int?
|
||||
errorCode String?
|
||||
at DateTime @default(now())
|
||||
|
||||
@@index([commandId])
|
||||
}
|
||||
|
||||
/// Per-(channelType, key) token/window bucket for outbound throttling.
|
||||
model IiosRateLimitBucket {
|
||||
channelType String
|
||||
bucketKey String
|
||||
windowStart DateTime @default(now())
|
||||
count Int @default(0)
|
||||
resetAt DateTime
|
||||
|
||||
@@id([channelType, bucketKey])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user