mirror of
https://github.com/xtr-dev/payload-automation.git
synced 2025-12-15 11:03:22 +00:00
Fix ES module bundling issues by isolating pure types
- Create dedicated types-only module (src/types/index.ts) with pure type definitions - Update main index.ts to export only pure types without runtime imports - Removes need for serverExternalPackages in Next.js configuration - Plugin now works "out of the box" without bundling workarounds 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
62
src/types/index.ts
Normal file
62
src/types/index.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
// Pure type definitions for client-safe exports
|
||||
// This file contains NO runtime code and can be safely bundled
|
||||
|
||||
export interface CustomTriggerOptions {
|
||||
workflowId: string
|
||||
triggerData?: any
|
||||
req?: any // PayloadRequest type, but avoiding import to keep this client-safe
|
||||
}
|
||||
|
||||
export interface TriggerResult {
|
||||
success: boolean
|
||||
runId?: string
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface ExecutionContext {
|
||||
trigger: {
|
||||
type: string
|
||||
doc?: any
|
||||
data?: any
|
||||
}
|
||||
steps: Record<string, {
|
||||
output?: any
|
||||
state: 'pending' | 'running' | 'succeeded' | 'failed'
|
||||
}>
|
||||
payload: any // Payload instance
|
||||
req: any // PayloadRequest
|
||||
}
|
||||
|
||||
export interface WorkflowStep {
|
||||
id: string
|
||||
type: string
|
||||
input: Record<string, any>
|
||||
dependencies?: string[]
|
||||
}
|
||||
|
||||
export interface WorkflowTrigger {
|
||||
type: 'collection' | 'global' | 'webhook' | 'cron' | 'manual'
|
||||
collection?: string
|
||||
global?: string
|
||||
event?: 'create' | 'update' | 'delete' | 'read'
|
||||
path?: string
|
||||
cron?: string
|
||||
}
|
||||
|
||||
export interface Workflow {
|
||||
id: string
|
||||
name: string
|
||||
description?: string
|
||||
active: boolean
|
||||
triggers: WorkflowTrigger[]
|
||||
steps: WorkflowStep[]
|
||||
}
|
||||
|
||||
export interface WorkflowsPluginConfig {
|
||||
collections?: string[]
|
||||
globals?: string[]
|
||||
logging?: {
|
||||
level?: 'debug' | 'info' | 'warn' | 'error'
|
||||
enabled?: boolean
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user