v2 platform foundation (docs 01/02/03): Action Runtime + Registry + unified API
- v2 foundation: ActionResult/DevError/ActorContext/ResourceRef/Execution types - ActionRegistry + ResourceRegistry (namespaced types, FAIL FAST on duplicates) - ActionRuntime pipeline: validate -> authorize -> middleware -> handler -> output validation -> audit -> event -> execution persisted (devos_action_executions) - Legacy bridge: v1 services registered as devops.*/core.* resources & actions (47 actions, 9 resources) - Unified Action API: POST /api/v2/actions/:actionId, GET discovery (actions/resources) - 10 v2 unit tests (registry fail-fast, validation, authz, failure audit, events)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "ActionExecution" (
|
||||
"id" TEXT NOT NULL,
|
||||
"actionId" TEXT NOT NULL,
|
||||
"actorType" TEXT NOT NULL,
|
||||
"actorId" TEXT,
|
||||
"resourceType" TEXT,
|
||||
"resourceId" TEXT,
|
||||
"status" TEXT NOT NULL,
|
||||
"input" JSONB,
|
||||
"output" JSONB,
|
||||
"error" JSONB,
|
||||
"requestId" TEXT,
|
||||
"rootExecutionId" TEXT,
|
||||
"parentExecutionId" TEXT,
|
||||
"durationMs" INTEGER,
|
||||
"startedAt" TIMESTAMP(3),
|
||||
"completedAt" TIMESTAMP(3),
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "ActionExecution_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "ActionExecution_actionId_createdAt_idx" ON "ActionExecution"("actionId", "createdAt");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "ActionExecution_status_idx" ON "ActionExecution"("status");
|
||||
|
||||
@@ -732,3 +732,29 @@ model Certificate {
|
||||
|
||||
@@index([workspaceId])
|
||||
}
|
||||
|
||||
// ============ v2 Action Runtime ============
|
||||
|
||||
/// # 数据库表 devos_action_executions:v2 Action 执行记录(docs 03 §31)
|
||||
model ActionExecution {
|
||||
id String @id
|
||||
actionId String
|
||||
actorType String
|
||||
actorId String?
|
||||
resourceType String?
|
||||
resourceId String?
|
||||
status String
|
||||
input Json?
|
||||
output Json?
|
||||
error Json?
|
||||
requestId String?
|
||||
rootExecutionId String?
|
||||
parentExecutionId String?
|
||||
durationMs Int?
|
||||
startedAt DateTime?
|
||||
completedAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@index([actionId, createdAt])
|
||||
@@index([status])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user