mirror of
https://github.com/xtr-dev/payload-automation.git
synced 2025-12-10 08:53:23 +00:00
- 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>
76 lines
1.6 KiB
TypeScript
76 lines
1.6 KiB
TypeScript
import type { TaskConfig } from "payload"
|
|
|
|
import { readDocumentHandler } from "./read-document-handler.js"
|
|
|
|
export const ReadDocumentStepTask = {
|
|
slug: 'read-document',
|
|
handler: readDocumentHandler,
|
|
inputSchema: [
|
|
{
|
|
name: 'collectionSlug',
|
|
type: 'text',
|
|
admin: {
|
|
description: 'The collection slug to read from'
|
|
},
|
|
required: true
|
|
},
|
|
{
|
|
name: 'id',
|
|
type: 'text',
|
|
admin: {
|
|
description: 'The ID of a specific document to read (leave empty to find multiple)'
|
|
}
|
|
},
|
|
{
|
|
name: 'where',
|
|
type: 'json',
|
|
admin: {
|
|
description: 'Query conditions to find documents (used when ID is not provided)'
|
|
}
|
|
},
|
|
{
|
|
name: 'limit',
|
|
type: 'number',
|
|
admin: {
|
|
description: 'Maximum number of documents to return (default: 10)'
|
|
}
|
|
},
|
|
{
|
|
name: 'sort',
|
|
type: 'text',
|
|
admin: {
|
|
description: 'Field to sort by (prefix with - for descending order)'
|
|
}
|
|
},
|
|
{
|
|
name: 'locale',
|
|
type: 'text',
|
|
admin: {
|
|
description: 'Locale for the document (if localization is enabled)'
|
|
}
|
|
},
|
|
{
|
|
name: 'depth',
|
|
type: 'number',
|
|
admin: {
|
|
description: 'Depth of relationships to populate (0-10)'
|
|
}
|
|
}
|
|
],
|
|
outputSchema: [
|
|
{
|
|
name: 'doc',
|
|
type: 'json',
|
|
admin: {
|
|
description: 'The document(s) found'
|
|
}
|
|
},
|
|
{
|
|
name: 'totalDocs',
|
|
type: 'number',
|
|
admin: {
|
|
description: 'Total number of documents matching the query'
|
|
}
|
|
}
|
|
]
|
|
} satisfies TaskConfig<'read-document'> |