Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
@@ -0,0 +1,191 @@
|
||||
// R-P12a (P12 Automation) — typed automation engine foundation.
|
||||
//
|
||||
// AD-21: self-contained schema. User references are bare String scalars so the
|
||||
// automation slice does not touch accounts/core back-relations while P12b can
|
||||
// add the visual editor on top of these contracts.
|
||||
|
||||
enum AutomationRuleStatus {
|
||||
draft
|
||||
active
|
||||
paused
|
||||
archived
|
||||
}
|
||||
|
||||
enum AutomationStepKind {
|
||||
trigger
|
||||
condition
|
||||
action
|
||||
flow_control
|
||||
}
|
||||
|
||||
enum AutomationExecutionStatus {
|
||||
queued
|
||||
running
|
||||
success
|
||||
failed
|
||||
paused
|
||||
waiting
|
||||
skipped
|
||||
retrying
|
||||
}
|
||||
|
||||
model AutomationRule {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
tenantId String
|
||||
name String
|
||||
description String?
|
||||
status AutomationRuleStatus @default(draft)
|
||||
enabled Boolean @default(false)
|
||||
createdVia String @default("manual")
|
||||
triggerKey String?
|
||||
flowData Json @default("{}")
|
||||
createdByUserId String?
|
||||
isDemoData Boolean @default(false)
|
||||
archivedAt DateTime?
|
||||
|
||||
steps AutomationRuleStep[]
|
||||
executions AutomationExecution[]
|
||||
|
||||
@@unique([tenantId, name])
|
||||
@@index([tenantId, status, enabled, archivedAt])
|
||||
@@index([tenantId, triggerKey, enabled, archivedAt])
|
||||
}
|
||||
|
||||
model AutomationRuleStep {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
tenantId String
|
||||
ruleId String
|
||||
stepKey String
|
||||
stepKind AutomationStepKind
|
||||
nodeType String
|
||||
config Json @default("{}")
|
||||
parentStepIds String[] @default([])
|
||||
position Json @default("{}")
|
||||
sortOrder Int @default(0)
|
||||
summaryText String?
|
||||
isDemoData Boolean @default(false)
|
||||
|
||||
rule AutomationRule @relation(fields: [ruleId], references: [id], onDelete: Cascade)
|
||||
stepExecutions AutomationStepExecution[]
|
||||
|
||||
@@unique([ruleId, stepKey])
|
||||
@@index([tenantId, ruleId, sortOrder])
|
||||
@@index([tenantId, nodeType])
|
||||
}
|
||||
|
||||
model AutomationExecution {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
tenantId String
|
||||
ruleId String
|
||||
triggerKey String
|
||||
triggerPayload Json @default("{}")
|
||||
status AutomationExecutionStatus @default(queued)
|
||||
dryRun Boolean @default(false)
|
||||
idempotencyKey String?
|
||||
reverseWindowExpiresAt DateTime?
|
||||
resumeFromStepId String?
|
||||
summaryText String
|
||||
errorText String?
|
||||
queuedAt DateTime @default(now())
|
||||
startedAt DateTime?
|
||||
endedAt DateTime?
|
||||
durationMs Int?
|
||||
attempt Int @default(1)
|
||||
nextRetryAt DateTime?
|
||||
createdByUserId String?
|
||||
isDemoData Boolean @default(false)
|
||||
|
||||
rule AutomationRule @relation(fields: [ruleId], references: [id], onDelete: Cascade)
|
||||
stepExecutions AutomationStepExecution[]
|
||||
|
||||
@@unique([tenantId, idempotencyKey])
|
||||
@@index([tenantId, ruleId, createdAt(sort: Desc)])
|
||||
@@index([tenantId, triggerKey, createdAt(sort: Desc)])
|
||||
@@index([tenantId, status, createdAt(sort: Desc)])
|
||||
}
|
||||
|
||||
model AutomationStepExecution {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
tenantId String
|
||||
executionId String
|
||||
ruleStepId String?
|
||||
stepKey String
|
||||
stepKind AutomationStepKind
|
||||
nodeType String
|
||||
status AutomationExecutionStatus @default(queued)
|
||||
input Json @default("{}")
|
||||
output Json @default("{}")
|
||||
summaryText String
|
||||
errorText String?
|
||||
startedAt DateTime?
|
||||
endedAt DateTime?
|
||||
durationMs Int?
|
||||
attempt Int @default(1)
|
||||
sortOrder Int @default(0)
|
||||
|
||||
execution AutomationExecution @relation(fields: [executionId], references: [id], onDelete: Cascade)
|
||||
ruleStep AutomationRuleStep? @relation(fields: [ruleStepId], references: [id], onDelete: SetNull)
|
||||
|
||||
@@index([tenantId, executionId, sortOrder])
|
||||
@@index([tenantId, status, createdAt(sort: Desc)])
|
||||
}
|
||||
|
||||
model AutomationCredential {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
tenantId String
|
||||
name String
|
||||
kind String
|
||||
encryptedValue String
|
||||
metadata Json @default("{}")
|
||||
createdByUserId String?
|
||||
archivedAt DateTime?
|
||||
|
||||
@@unique([tenantId, name])
|
||||
@@index([tenantId, kind, archivedAt])
|
||||
}
|
||||
|
||||
model AutomationTemplate {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
tenantId String?
|
||||
name String
|
||||
description String?
|
||||
category String
|
||||
flowData Json @default("{}")
|
||||
isPublished Boolean @default(false)
|
||||
createdFromRuleId String?
|
||||
createdByUserId String?
|
||||
isDemoData Boolean @default(false)
|
||||
archivedAt DateTime?
|
||||
|
||||
@@unique([tenantId, name])
|
||||
@@index([tenantId, category, isPublished, archivedAt])
|
||||
}
|
||||
|
||||
model AutomationTriggerMeter {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
tenantId String
|
||||
triggerKey String
|
||||
windowStart DateTime
|
||||
windowMinutes Int @default(5)
|
||||
count Int @default(0)
|
||||
pausedUntil DateTime?
|
||||
anomalyText String?
|
||||
|
||||
@@unique([tenantId, triggerKey, windowStart, windowMinutes])
|
||||
@@index([tenantId, triggerKey, windowStart])
|
||||
@@index([tenantId, pausedUntil])
|
||||
}
|
||||
Reference in new issue
Block a user