Commit Graph

34 Commits

Author SHA1 Message Date
397559079f 0.0.22 v0.0.22 2025-09-03 19:15:58 +02:00
c352da91fa Update generated payload types
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-03 19:15:55 +02:00
d6aedbc59d Fix workflow steps UI showing JSON fields instead of dynamic input fields
- 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>
2025-09-03 19:15:43 +02:00
cd85f90ef1 0.0.21 v0.0.21 2025-09-01 21:25:47 +02:00
38fbb1922a Fix hook execution context/binding issues
- 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.
2025-09-01 21:25:47 +02:00
dfcc5c0fce 0.0.20 v0.0.20 2025-09-01 21:13:01 +02:00
089e12ac7a FINAL APPROACH: Modify collection configs at plugin config time
- 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.
2025-09-01 21:13:01 +02:00
8ff65ca7c3 0.0.19 v0.0.19 2025-09-01 21:05:25 +02:00
bdfc311009 FUNDAMENTAL REWRITE: Direct runtime collection manipulation
- 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.
2025-09-01 21:05:25 +02:00
3c54f00f57 0.0.18 v0.0.18 2025-09-01 20:57:37 +02:00
cbb74206e9 Fix TypeScript types - remove any usage 2025-09-01 20:57:37 +02:00
41c4d8bdcb CRITICAL FIX: Move hook registration to config phase
- Hooks were being registered too late (in onInit) - PayloadCMS doesn't honor hooks registered after initialization
- Move hook registration to config phase using applyHooksToCollections()
- Use global executor registry to make WorkflowExecutor available to config-phase hooks
- Add aggressive debugging to trace hook execution
- This should resolve the core issue where hooks were registered but never called

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 20:56:51 +02:00
46c9f11534 0.0.17 v0.0.17 2025-09-01 20:47:41 +02:00
08a4022a41 Add aggressive debugging logs to trace hook execution
- Add console.log statements that will ALWAYS appear if hooks are called
- Trace WorkflowExecutor creation and method availability
- Log every step of hook execution pipeline
- This will help identify exactly where the execution is failing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 20:47:38 +02:00
c24610b3d9 0.0.16 v0.0.16 2025-09-01 20:32:03 +02:00
87893ac612 Fix critical hook initialization bug preventing workflow execution
- Remove problematic hooksInitialized flag that prevented proper hook registration in development mode
- Add comprehensive error logging with "AUTOMATION PLUGIN:" prefix for easier debugging
- Add try/catch blocks in hook execution to prevent silent failures
- Ensure hooks register properly on every PayloadCMS initialization

This fixes the issue where workflows would not execute even when properly configured.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 20:31:59 +02:00
a711fbdbea 0.0.15 v0.0.15 2025-09-01 19:42:25 +02:00
4adc5cbdaa Fix workflow condition evaluation to support comparison operators
- Implemented proper parsing for conditions like '$.trigger.doc.content == "value"'
- Added support for comparison operators: ==, !=, >, <, >=, <=
- Fixed JSONPath condition evaluation that was treating entire expressions as JSONPath queries
- Added support for string literals, numbers, booleans in condition values
- Conditions now correctly resolve JSONPath expressions and perform comparisons

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 19:42:21 +02:00
f3f18d5b4c 0.0.14 v0.0.14 2025-09-01 18:02:25 +02:00
6397250045 Fix JSON circular reference serialization and use PayloadCMS generated types
- Replace duplicate type definitions with PayloadCMS generated types
- Fix workflow context serialization with safeSerialize() method
- Resolve type mismatches (id: string vs number)
- Update all imports to use PayloadWorkflow type
- Ensure workflow runs are created successfully without serialization errors

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 18:02:21 +02:00
964b11c0c9 0.0.13 v0.0.13 2025-09-01 10:33:02 +02:00
3d7b746779 Fix workflow trigger field name mismatch
- Update workflow executor to check both 'collection' and 'collectionSlug' fields
- Add debug logging for workflow trigger matching
- Fixes issue where collection triggers were not being matched correctly
2025-09-01 10:32:51 +02:00
7686495283 0.0.12 v0.0.12 2025-08-31 20:35:13 +02:00
265d5affc6 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>
2025-08-31 20:35:09 +02:00
06571a4aae Update workflow to detect 'Release v' prefixed version commits 2025-08-31 18:10:14 +02:00
c5b2e6f286 Release v0.0.11 - Fix ES module bundling issues
- Separated server-side and client-safe exports
- Main export now contains only types to prevent bundling server code
- Updated documentation with new import structure

🤖 Generated with [Claude Code](https://claude.ai/code)
v0.0.11
2025-08-31 18:09:52 +02:00
7cf102e0b9 Fix GitHub workflow to properly detect version changes
The workflow now detects version changes by:
1. Looking for version bump commits (created by npm version)
2. Checking if package.json was modified and version actually changed

This works with the npm version workflow where:
1. Make changes and commit them
2. Run npm version patch (creates version commit)
3. Push both commits - workflow publishes on version commit
2025-08-31 18:08:15 +02:00
75ec74270c 0.0.10 v0.0.10 2025-08-31 18:06:45 +02:00
cadb40e401 Fix client-side bundling by separating server and client exports
- Create dedicated /server export for server-side functions and plugin
- Main export now contains only types (client-safe)
- Remove problematic /steps export that exposed server functions
- Update README with correct import structure
- Fix tests to use /server export

This prevents server-side code from being bundled in client JavaScript,
eliminating the "require is not defined in ES module scope" runtime error.

Breaking change: workflowsPlugin must now be imported from '/server':
import { workflowsPlugin } from '@xtr-dev/payload-automation/server'

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-31 18:06:39 +02:00
19b9566df6 0.0.9 v0.0.9 2025-08-31 17:58:56 +02:00
8ed647587b Fix ES module imports to eliminate runtime require() calls
- Changed node-cron import from namespace import to default import
- Added GitHub workflow for automatic npm publishing on version changes
- Ensured all build output uses pure ES module imports without CommonJS remnants

This fixes the runtime error: "ReferenceError: require is not defined in ES module scope"

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-31 17:58:46 +02:00
7affbd26c4 0.0.8 v0.0.8 2025-08-31 17:14:40 +02:00
592536f61a Rename 'collection' field to 'collectionSlug' to avoid PayloadCMS reserved field conflicts
- Updated Workflow collection trigger field from 'collection' to 'collectionSlug'
- Updated all document operation steps (create, read, update, delete) to use 'collectionSlug'
- Updated corresponding handlers to destructure 'collectionSlug' instead of 'collection'
- Removed debug console.log statements from logger configLogger methods
- Fixed collection hook debug logs to use 'slug' instead of reserved 'collection' field

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-31 17:14:35 +02:00
2d84f535f4 Initial commit 2025-08-29 18:11:36 +02:00