- Delete `MIGRATION-v0.0.37.md` as it is no longer necessary
- Remove outdated files: `test-helpers.ts`, `test-setup.ts`, `test-trigger.ts`, and `vitest.config.ts`
- Streamline project by eliminating obsolete and unused test-related files and configurations
- Delete unused test files: `basic.test.ts`, `condition-fix.spec.ts`, `create-document-step.test.ts`, and `error-scenarios.spec.ts`
- Streamline codebase by eliminating redundant and outdated test cases
- Improve maintainability by keeping only relevant and up-to-date tests
- Delete `initCollectionHooks` implementation and its usage references
- Remove `MIGRATION-v0.0.24.md` and `NOT-IMPLEMENTING.md` as they are now obsolete
- Update related workflow executor logic and TypeScript definitions, ensuring compatibility
- Simplify error handling, input parsing, and logging within workflow execution
- Clean up and refactor redundant code to improve maintainability
- Remove executorRegistry singleton pattern
- Create WorkflowExecutor on-demand in each hook execution
- Replace all 'any' types with proper TypeScript types
- Use CollectionAfterChangeHook and PayloadRequest types
- Simplify code by removing unnecessary state management
Benefits:
- Simpler, more maintainable code
- No shared state to manage
- Each hook execution is independent
- Proper TypeScript typing throughout
- Remove cron-trigger.ts and cron-scheduler.ts files
- Clean up cron-related code from plugin index and workflow hooks
- Remove cron references from workflow executor types
- Add cron to NOT-IMPLEMENTING.md with webhook alternatives
- Update README with scheduled workflow documentation using external services
- Suggest GitHub Actions and Vercel Cron as reliable alternatives
Benefits of external scheduling:
- Better reliability and process isolation
- Easier debugging and monitoring
- Leverages existing cloud infrastructure
- Reduces plugin complexity and maintenance burden
- Convert webhook, global, and cron triggers to use TriggerConfig pattern like collectionTrigger
- Simplify trigger slug names (remove '-trigger' suffix)
- Update validation to use new slug names
- Add perfectionist/sort-exports rule disable
- Note: Workflow.ts integration still needs fixes for type compatibility
- Standardize virtual field creation using triggerField helper
- Simplify field definitions by removing repetitive virtual field boilerplate
- Use consistent naming pattern: '__trigger_' + fieldName instead of '__builtin_'
- Preserve existing field conditions while adding parameter storage logic
- Update all trigger field modules to use Field type consistently
- Create dedicated triggers directory for trigger field configurations
- Extract collection, webhook, global, and cron trigger fields into separate modules
- Improve code organization and maintainability
- Update Workflow.ts to use the new modular trigger imports
- Change default log level to 'warn' for production
- Add PAYLOAD_AUTOMATION_LOG_LEVEL environment variable
- Remove all verbose config-phase logs
- Add documentation for log level control
- Change trigger debugging from debug to info level for visibility
- Add trigger condition evaluation logging with doc status
- Reduce verbose plugin config logs that spam dev console
- Help customer diagnose trigger matching issues more effectively
- Show detailed matching criteria for each trigger
- Display typeMatch, collectionMatch, operationMatch for debugging
- Help identify why triggers are not matching
- Assists in troubleshooting workflow execution issues
- Add lazy initialization when executor is not ready during hook execution
- Handles development hot-reloading scenarios where module registry resets
- Prevents 'Workflow executor not yet initialized' warnings
- Creates workflow executor on-demand when hooks fire before onInit
- Improved error handling and tracking for initialization failures
Resolves: Workflow executor timing issues in development environments
- Multiple step types (create-document, read-document, etc.) were defining collectionSlug fields
- These created duplicate field names at the same level in the Workflow collection
- Fixed by prefixing step field names with step slug (__step_{stepSlug}_{fieldName})
- Added virtual field hooks to store/retrieve data using original field names
- Resolves DuplicateFieldName error preventing PayloadCMS initialization
Fixes: #duplicate-field-name-issue
Closes: User bug report for @xtr-dev/payload-automation@0.0.30
- Change component paths from relative to @xtr-dev/payload-automation/client#Component
- Use proper PayloadCMS plugin import syntax for components
- Regenerate import map with correct package-based imports
- Resolves 'Module not found' errors in dev project
- Fix TypeScript types in trigger-helpers with proper interfaces
- Remove all ESLint no-explicit-any warnings with better typing
- Fix component import paths from @/components/* to relative paths
- Regenerate import map with correct component references
- All compilation and linting errors resolved
- Replace multiple helper functions with single createTriggerField function
- createTriggerField takes a standard PayloadCMS field and adds virtual storage hooks
- Simplify trigger presets to use the new createTrigger helper
- Update exports to match new simplified API
- Cleaner, more maintainable code with less boilerplate
- Remove redundant field name prefixing in Workflow.ts
- Custom trigger fields from trigger-helpers already have unique names
- Simplify by passing through inputs without modification
- Fixes DuplicateFieldName error
- Prefix custom trigger field names with trigger slug to avoid conflicts
- Built-in fields use __builtin_ prefix
- Custom trigger fields use __<triggerSlug>_ prefix
- Prevents naming collisions between different trigger types
- Add createTrigger() and createAdvancedTrigger() helpers
- Add preset builders: webhookTrigger, cronTrigger, eventTrigger, etc.
- Implement virtual fields with JSON backing for trigger parameters
- Eliminate 90% of boilerplate when creating custom triggers
- Add /helpers export path for trigger builders
- Fix field name clashing between built-in and custom trigger parameters
- Add comprehensive examples and documentation
- Maintain backward compatibility with existing triggers
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Major Features:
• Add persistent error tracking for timeout/network failures that bypasses PayloadCMS output limitations
• Implement smart error classification (timeout, DNS, connection, network) with duration-based detection
• Add comprehensive test infrastructure with MongoDB in-memory testing and enhanced mocking
• Fix HTTP request handler error preservation with detailed context storage
• Add independent execution tracking with success/failure status and duration metrics
Technical Improvements:
• Update JSONPath documentation to use correct $.trigger.doc syntax across all step types
• Fix PayloadCMS job execution to use runByID instead of run() for reliable task processing
• Add enhanced HTTP error handling that preserves outputs for 4xx/5xx status codes
• Implement proper nock configuration with undici for Node.js 22 fetch interception
• Add comprehensive unit tests for WorkflowExecutor with mocked PayloadCMS instances
Developer Experience:
• Add detailed error information in workflow context with URL, method, timeout, attempts
• Update README with HTTP error handling patterns and enhanced error tracking examples
• Add test helpers and setup infrastructure for reliable integration testing
• Fix workflow step validation and JSONPath field descriptions
Breaking Changes: None - fully backward compatible
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Replace generic JSON input field with dynamic fields based on step inputSchema
- Steps now show proper form fields (URL for HTTP requests, collection/data for CRUD operations)
- Improves user experience by providing structured forms instead of raw JSON editing
- Clean up debug files from repository
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Use Object.assign to create properly bound hook function
- Use global.console instead of regular console for guaranteed output
- Add global executor fallback for execution context isolation
- Use named function (payloadAutomationHook) for better debugging
- Add version metadata to help identify our hook
- Don't throw errors, just log them to avoid breaking other hooks
This fixes the 'hook registers but doesn't execute' issue by ensuring the function has proper scope and binding.
- This is the ONLY time we can modify collection configs before PayloadCMS finalizes them
- Directly push hooks into config.collections[].hooks.afterChange arrays
- This happens BEFORE PayloadCMS processes and freezes the configurations
- If this doesn't work, the plugin architecture is fundamentally incompatible
This is the last possible approach - modifying the actual collection config objects before they're processed by PayloadCMS.
- Completely abandon config-phase hook registration approach
- Use onInit to directly manipulate runtime collection.config.hooks arrays
- Add ultra-simple test hook that just logs
- Insert hook at beginning of array (unshift) to ensure it runs first
- Bypass TypeScript complexity with targeted any usage for hooks object
- This tests if ANY hook registration approach works
Previous approaches failed because user collections don't exist during plugin config phase.