mirror of
https://github.com/xtr-dev/payload-automation.git
synced 2025-12-11 09:13:24 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c46b58f43e | |||
| 398a2d160e | |||
| 96b36a3caa | |||
| 71ecca8253 |
@@ -1,9 +1,9 @@
|
|||||||
import { default as default_4845c503d8eeb95a2cf39d519276b9b7 } from '../../../../../components/WorkflowExecutionStatus'
|
import { WorkflowExecutionStatus as WorkflowExecutionStatus_6f365a93b6cb4b34ad564b391e21db6f } from '@xtr-dev/payload-automation/client'
|
||||||
import { default as default_28774f13376b69227276b43eee64e5a1 } from '../../../../../components/StatusCell'
|
import { StatusCell as StatusCell_6f365a93b6cb4b34ad564b391e21db6f } from '@xtr-dev/payload-automation/client'
|
||||||
import { default as default_623fcff70b12e3e87839f97bf237499a } from '../../../../../components/ErrorDisplay'
|
import { ErrorDisplay as ErrorDisplay_6f365a93b6cb4b34ad564b391e21db6f } from '@xtr-dev/payload-automation/client'
|
||||||
|
|
||||||
export const importMap = {
|
export const importMap = {
|
||||||
"../components/WorkflowExecutionStatus#default": default_4845c503d8eeb95a2cf39d519276b9b7,
|
"@xtr-dev/payload-automation/client#WorkflowExecutionStatus": WorkflowExecutionStatus_6f365a93b6cb4b34ad564b391e21db6f,
|
||||||
"../components/StatusCell#default": default_28774f13376b69227276b43eee64e5a1,
|
"@xtr-dev/payload-automation/client#StatusCell": StatusCell_6f365a93b6cb4b34ad564b391e21db6f,
|
||||||
"../components/ErrorDisplay#default": default_623fcff70b12e3e87839f97bf237499a
|
"@xtr-dev/payload-automation/client#ErrorDisplay": ErrorDisplay_6f365a93b6cb4b34ad564b391e21db6f
|
||||||
}
|
}
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@xtr-dev/payload-workflows",
|
"name": "@xtr-dev/payload-workflows",
|
||||||
"version": "0.0.29",
|
"version": "0.0.31",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@xtr-dev/payload-workflows",
|
"name": "@xtr-dev/payload-workflows",
|
||||||
"version": "0.0.29",
|
"version": "0.0.31",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jsonpath-plus": "^10.3.0",
|
"jsonpath-plus": "^10.3.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@xtr-dev/payload-automation",
|
"name": "@xtr-dev/payload-automation",
|
||||||
"version": "0.0.29",
|
"version": "0.0.31",
|
||||||
"description": "PayloadCMS Automation Plugin - Comprehensive workflow automation system with visual workflow building, execution tracking, and step types",
|
"description": "PayloadCMS Automation Plugin - Comprehensive workflow automation system with visual workflow building, execution tracking, and step types",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export const createWorkflowCollection: <T extends string>(options: WorkflowsPlug
|
|||||||
type: 'ui',
|
type: 'ui',
|
||||||
admin: {
|
admin: {
|
||||||
components: {
|
components: {
|
||||||
Field: '../components/WorkflowExecutionStatus'
|
Field: '@xtr-dev/payload-automation/client#WorkflowExecutionStatus'
|
||||||
},
|
},
|
||||||
condition: (data) => !!data?.id // Only show for existing workflows
|
condition: (data) => !!data?.id // Only show for existing workflows
|
||||||
}
|
}
|
||||||
@@ -319,17 +319,45 @@ export const createWorkflowCollection: <T extends string>(options: WorkflowsPlug
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
...(steps || []).flatMap(step => (step.inputSchema || []).map(field => ({
|
...(steps || []).flatMap(step => (step.inputSchema || []).map(field => {
|
||||||
...field,
|
const originalName = (field as any).name;
|
||||||
admin: {
|
const resultField: any = {
|
||||||
...(field.admin || {}),
|
...field,
|
||||||
condition: (...args) => args[1]?.step === step.slug && (
|
// Prefix field name with step slug to avoid conflicts
|
||||||
field.admin?.condition ?
|
name: `__step_${step.slug}_${originalName}`,
|
||||||
field.admin.condition.call(this, ...args) :
|
admin: {
|
||||||
true
|
...(field.admin || {}),
|
||||||
),
|
condition: (...args: any[]) => args[1]?.step === step.slug && (
|
||||||
},
|
(field.admin as any)?.condition ?
|
||||||
} as Field))),
|
(field.admin as any).condition.call(this, ...args) :
|
||||||
|
true
|
||||||
|
),
|
||||||
|
},
|
||||||
|
virtual: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add hooks to store/retrieve from the step's input data
|
||||||
|
resultField.hooks = {
|
||||||
|
...((field as any).hooks || {}),
|
||||||
|
afterRead: [
|
||||||
|
...(((field as any).hooks)?.afterRead || []),
|
||||||
|
({ siblingData }: any) => {
|
||||||
|
// Read from step input data using original field name
|
||||||
|
return siblingData?.[originalName] || (field as any).defaultValue;
|
||||||
|
}
|
||||||
|
],
|
||||||
|
beforeChange: [
|
||||||
|
...(((field as any).hooks)?.beforeChange || []),
|
||||||
|
({ siblingData, value }: any) => {
|
||||||
|
// Store in step data using original field name
|
||||||
|
siblingData[originalName] = value;
|
||||||
|
return undefined; // Don't store the prefixed field
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
return resultField as Field;
|
||||||
|
})),
|
||||||
{
|
{
|
||||||
name: 'dependencies',
|
name: 'dependencies',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export const WorkflowRunsCollection: CollectionConfig = {
|
|||||||
admin: {
|
admin: {
|
||||||
description: 'Current execution status',
|
description: 'Current execution status',
|
||||||
components: {
|
components: {
|
||||||
Cell: '../components/StatusCell'
|
Cell: '@xtr-dev/payload-automation/client#StatusCell'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
defaultValue: 'pending',
|
defaultValue: 'pending',
|
||||||
@@ -141,7 +141,7 @@ export const WorkflowRunsCollection: CollectionConfig = {
|
|||||||
description: 'Error message if workflow execution failed',
|
description: 'Error message if workflow execution failed',
|
||||||
condition: (_, siblingData) => siblingData?.status === 'failed',
|
condition: (_, siblingData) => siblingData?.status === 'failed',
|
||||||
components: {
|
components: {
|
||||||
Field: '../components/ErrorDisplay'
|
Field: '@xtr-dev/payload-automation/client#ErrorDisplay'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user