@xtr-dev/payload-automation 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/dist/collections/Workflow.d.ts +3 -0
- package/dist/collections/Workflow.js +223 -0
- package/dist/collections/Workflow.js.map +1 -0
- package/dist/collections/WorkflowRuns.d.ts +2 -0
- package/dist/collections/WorkflowRuns.js +157 -0
- package/dist/collections/WorkflowRuns.js.map +1 -0
- package/dist/components/TriggerWorkflowButton.d.ts +7 -0
- package/dist/components/TriggerWorkflowButton.js +46 -0
- package/dist/components/TriggerWorkflowButton.js.map +1 -0
- package/dist/core/trigger-custom-workflow.d.ts +52 -0
- package/dist/core/trigger-custom-workflow.js +205 -0
- package/dist/core/trigger-custom-workflow.js.map +1 -0
- package/dist/core/workflow-executor.d.ts +86 -0
- package/dist/core/workflow-executor.js +456 -0
- package/dist/core/workflow-executor.js.map +1 -0
- package/dist/exports/client.d.ts +1 -0
- package/dist/exports/client.js +7 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/exports/fields.d.ts +1 -0
- package/dist/exports/fields.js +6 -0
- package/dist/exports/fields.js.map +1 -0
- package/dist/exports/rsc.d.ts +1 -0
- package/dist/exports/rsc.js +3 -0
- package/dist/exports/rsc.js.map +1 -0
- package/dist/exports/views.d.ts +1 -0
- package/dist/exports/views.js +7 -0
- package/dist/exports/views.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin/config-types.d.ts +21 -0
- package/dist/plugin/config-types.js +3 -0
- package/dist/plugin/config-types.js.map +1 -0
- package/dist/plugin/cron-scheduler.d.ts +32 -0
- package/dist/plugin/cron-scheduler.js +537 -0
- package/dist/plugin/cron-scheduler.js.map +1 -0
- package/dist/plugin/index.d.ts +4 -0
- package/dist/plugin/index.js +66 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/init-collection-hooks.d.ts +4 -0
- package/dist/plugin/init-collection-hooks.js +63 -0
- package/dist/plugin/init-collection-hooks.js.map +1 -0
- package/dist/plugin/init-global-hooks.d.ts +3 -0
- package/dist/plugin/init-global-hooks.js +83 -0
- package/dist/plugin/init-global-hooks.js.map +1 -0
- package/dist/plugin/init-step-tasks.d.ts +3 -0
- package/dist/plugin/init-step-tasks.js +8 -0
- package/dist/plugin/init-step-tasks.js.map +1 -0
- package/dist/plugin/init-webhook.d.ts +2 -0
- package/dist/plugin/init-webhook.js +154 -0
- package/dist/plugin/init-webhook.js.map +1 -0
- package/dist/plugin/init-workflow-hooks.d.ts +6 -0
- package/dist/plugin/init-workflow-hooks.js +46 -0
- package/dist/plugin/init-workflow-hooks.js.map +1 -0
- package/dist/plugin/logger.d.ts +20 -0
- package/dist/plugin/logger.js +47 -0
- package/dist/plugin/logger.js.map +1 -0
- package/dist/steps/create-document-handler.d.ts +2 -0
- package/dist/steps/create-document-handler.js +36 -0
- package/dist/steps/create-document-handler.js.map +1 -0
- package/dist/steps/create-document.d.ts +46 -0
- package/dist/steps/create-document.js +55 -0
- package/dist/steps/create-document.js.map +1 -0
- package/dist/steps/delete-document-handler.d.ts +2 -0
- package/dist/steps/delete-document-handler.js +62 -0
- package/dist/steps/delete-document-handler.js.map +1 -0
- package/dist/steps/delete-document.d.ts +39 -0
- package/dist/steps/delete-document.js +47 -0
- package/dist/steps/delete-document.js.map +1 -0
- package/dist/steps/http-request-handler.d.ts +2 -0
- package/dist/steps/http-request-handler.js +14 -0
- package/dist/steps/http-request-handler.js.map +1 -0
- package/dist/steps/http-request.d.ts +12 -0
- package/dist/steps/http-request.js +19 -0
- package/dist/steps/http-request.js.map +1 -0
- package/dist/steps/index.d.ts +12 -0
- package/dist/steps/index.js +14 -0
- package/dist/steps/index.js.map +1 -0
- package/dist/steps/read-document-handler.d.ts +2 -0
- package/dist/steps/read-document-handler.js +53 -0
- package/dist/steps/read-document-handler.js.map +1 -0
- package/dist/steps/read-document.d.ts +46 -0
- package/dist/steps/read-document.js +75 -0
- package/dist/steps/read-document.js.map +1 -0
- package/dist/steps/send-email-handler.d.ts +2 -0
- package/dist/steps/send-email-handler.js +48 -0
- package/dist/steps/send-email-handler.js.map +1 -0
- package/dist/steps/send-email.d.ts +44 -0
- package/dist/steps/send-email.js +78 -0
- package/dist/steps/send-email.js.map +1 -0
- package/dist/steps/update-document-handler.d.ts +2 -0
- package/dist/steps/update-document-handler.js +40 -0
- package/dist/steps/update-document-handler.js.map +1 -0
- package/dist/steps/update-document.d.ts +46 -0
- package/dist/steps/update-document.js +63 -0
- package/dist/steps/update-document.js.map +1 -0
- package/package.json +133 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export const sendEmailHandler = async ({ input, req })=>{
|
|
2
|
+
if (!input) {
|
|
3
|
+
throw new Error('No input provided');
|
|
4
|
+
}
|
|
5
|
+
const { bcc, cc, from, html, subject, text, to } = input;
|
|
6
|
+
if (!to || typeof to !== 'string') {
|
|
7
|
+
throw new Error('Recipient email address (to) is required');
|
|
8
|
+
}
|
|
9
|
+
if (!subject || typeof subject !== 'string') {
|
|
10
|
+
throw new Error('Subject is required');
|
|
11
|
+
}
|
|
12
|
+
if (!text && !html) {
|
|
13
|
+
throw new Error('Either text or html content is required');
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
// Use Payload's email functionality
|
|
17
|
+
const emailData = {
|
|
18
|
+
bcc: Array.isArray(bcc) ? bcc.filter((email)=>typeof email === 'string') : undefined,
|
|
19
|
+
cc: Array.isArray(cc) ? cc.filter((email)=>typeof email === 'string') : undefined,
|
|
20
|
+
from: typeof from === 'string' ? from : undefined,
|
|
21
|
+
html: typeof html === 'string' ? html : undefined,
|
|
22
|
+
subject,
|
|
23
|
+
text: typeof text === 'string' ? text : undefined,
|
|
24
|
+
to
|
|
25
|
+
};
|
|
26
|
+
// Clean up undefined values
|
|
27
|
+
Object.keys(emailData).forEach((key)=>{
|
|
28
|
+
if (emailData[key] === undefined) {
|
|
29
|
+
delete emailData[key];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const result = await req.payload.sendEmail(emailData);
|
|
33
|
+
return {
|
|
34
|
+
output: {
|
|
35
|
+
messageId: result && typeof result === 'object' && 'messageId' in result ? result.messageId : 'unknown',
|
|
36
|
+
response: typeof result === 'object' ? JSON.stringify(result) : String(result)
|
|
37
|
+
},
|
|
38
|
+
state: 'succeeded'
|
|
39
|
+
};
|
|
40
|
+
} catch (error) {
|
|
41
|
+
return {
|
|
42
|
+
errorMessage: error instanceof Error ? error.message : 'Failed to send email',
|
|
43
|
+
state: 'failed'
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=send-email-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/steps/send-email-handler.ts"],"sourcesContent":["import type { TaskHandler } from \"payload\"\n\nexport const sendEmailHandler: TaskHandler<'send-email'> = async ({ input, req }) => {\n if (!input) {\n throw new Error('No input provided')\n }\n\n const { bcc, cc, from, html, subject, text, to } = input\n\n if (!to || typeof to !== 'string') {\n throw new Error('Recipient email address (to) is required')\n }\n\n if (!subject || typeof subject !== 'string') {\n throw new Error('Subject is required')\n }\n\n if (!text && !html) {\n throw new Error('Either text or html content is required')\n }\n\n try {\n // Use Payload's email functionality\n const emailData = {\n bcc: Array.isArray(bcc) ? bcc.filter(email => typeof email === 'string') : undefined,\n cc: Array.isArray(cc) ? cc.filter(email => typeof email === 'string') : undefined,\n from: typeof from === 'string' ? from : undefined,\n html: typeof html === 'string' ? html : undefined,\n subject,\n text: typeof text === 'string' ? text : undefined,\n to\n }\n\n // Clean up undefined values\n Object.keys(emailData).forEach(key => {\n if (emailData[key as keyof typeof emailData] === undefined) {\n delete emailData[key as keyof typeof emailData]\n }\n })\n\n const result = await req.payload.sendEmail(emailData)\n\n return {\n output: {\n messageId: (result && typeof result === 'object' && 'messageId' in result) ? result.messageId : 'unknown',\n response: typeof result === 'object' ? JSON.stringify(result) : String(result)\n },\n state: 'succeeded'\n }\n } catch (error) {\n return {\n errorMessage: error instanceof Error ? error.message : 'Failed to send email',\n state: 'failed'\n }\n }\n}"],"names":["sendEmailHandler","input","req","Error","bcc","cc","from","html","subject","text","to","emailData","Array","isArray","filter","email","undefined","Object","keys","forEach","key","result","payload","sendEmail","output","messageId","response","JSON","stringify","String","state","error","errorMessage","message"],"mappings":"AAEA,OAAO,MAAMA,mBAA8C,OAAO,EAAEC,KAAK,EAAEC,GAAG,EAAE;IAC9E,IAAI,CAACD,OAAO;QACV,MAAM,IAAIE,MAAM;IAClB;IAEA,MAAM,EAAEC,GAAG,EAAEC,EAAE,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI,EAAEC,EAAE,EAAE,GAAGT;IAEnD,IAAI,CAACS,MAAM,OAAOA,OAAO,UAAU;QACjC,MAAM,IAAIP,MAAM;IAClB;IAEA,IAAI,CAACK,WAAW,OAAOA,YAAY,UAAU;QAC3C,MAAM,IAAIL,MAAM;IAClB;IAEA,IAAI,CAACM,QAAQ,CAACF,MAAM;QAClB,MAAM,IAAIJ,MAAM;IAClB;IAEA,IAAI;QACF,oCAAoC;QACpC,MAAMQ,YAAY;YAChBP,KAAKQ,MAAMC,OAAO,CAACT,OAAOA,IAAIU,MAAM,CAACC,CAAAA,QAAS,OAAOA,UAAU,YAAYC;YAC3EX,IAAIO,MAAMC,OAAO,CAACR,MAAMA,GAAGS,MAAM,CAACC,CAAAA,QAAS,OAAOA,UAAU,YAAYC;YACxEV,MAAM,OAAOA,SAAS,WAAWA,OAAOU;YACxCT,MAAM,OAAOA,SAAS,WAAWA,OAAOS;YACxCR;YACAC,MAAM,OAAOA,SAAS,WAAWA,OAAOO;YACxCN;QACF;QAEA,4BAA4B;QAC5BO,OAAOC,IAAI,CAACP,WAAWQ,OAAO,CAACC,CAAAA;YAC7B,IAAIT,SAAS,CAACS,IAA8B,KAAKJ,WAAW;gBAC1D,OAAOL,SAAS,CAACS,IAA8B;YACjD;QACF;QAEA,MAAMC,SAAS,MAAMnB,IAAIoB,OAAO,CAACC,SAAS,CAACZ;QAE3C,OAAO;YACLa,QAAQ;gBACNC,WAAW,AAACJ,UAAU,OAAOA,WAAW,YAAY,eAAeA,SAAUA,OAAOI,SAAS,GAAG;gBAChGC,UAAU,OAAOL,WAAW,WAAWM,KAAKC,SAAS,CAACP,UAAUQ,OAAOR;YACzE;YACAS,OAAO;QACT;IACF,EAAE,OAAOC,OAAO;QACd,OAAO;YACLC,cAAcD,iBAAiB5B,QAAQ4B,MAAME,OAAO,GAAG;YACvDH,OAAO;QACT;IACF;AACF,EAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare const SendEmailStepTask: {
|
|
2
|
+
slug: "send-email";
|
|
3
|
+
handler: import("payload").TaskHandler<"send-email">;
|
|
4
|
+
inputSchema: ({
|
|
5
|
+
name: string;
|
|
6
|
+
type: "text";
|
|
7
|
+
admin: {
|
|
8
|
+
description: string;
|
|
9
|
+
};
|
|
10
|
+
required: true;
|
|
11
|
+
hasMany?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
name: string;
|
|
14
|
+
type: "text";
|
|
15
|
+
admin: {
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
required?: undefined;
|
|
19
|
+
hasMany?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
name: string;
|
|
22
|
+
type: "textarea";
|
|
23
|
+
admin: {
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
required?: undefined;
|
|
27
|
+
hasMany?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
name: string;
|
|
30
|
+
type: "text";
|
|
31
|
+
admin: {
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
hasMany: true;
|
|
35
|
+
required?: undefined;
|
|
36
|
+
})[];
|
|
37
|
+
outputSchema: {
|
|
38
|
+
name: string;
|
|
39
|
+
type: "text";
|
|
40
|
+
admin: {
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
}[];
|
|
44
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { sendEmailHandler } from "./send-email-handler.js";
|
|
2
|
+
export const SendEmailStepTask = {
|
|
3
|
+
slug: 'send-email',
|
|
4
|
+
handler: sendEmailHandler,
|
|
5
|
+
inputSchema: [
|
|
6
|
+
{
|
|
7
|
+
name: 'to',
|
|
8
|
+
type: 'text',
|
|
9
|
+
admin: {
|
|
10
|
+
description: 'Recipient email address'
|
|
11
|
+
},
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'from',
|
|
16
|
+
type: 'text',
|
|
17
|
+
admin: {
|
|
18
|
+
description: 'Sender email address (optional, uses default if not provided)'
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'subject',
|
|
23
|
+
type: 'text',
|
|
24
|
+
admin: {
|
|
25
|
+
description: 'Email subject line'
|
|
26
|
+
},
|
|
27
|
+
required: true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'text',
|
|
31
|
+
type: 'textarea',
|
|
32
|
+
admin: {
|
|
33
|
+
description: 'Plain text email content'
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'html',
|
|
38
|
+
type: 'textarea',
|
|
39
|
+
admin: {
|
|
40
|
+
description: 'HTML email content (optional)'
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'cc',
|
|
45
|
+
type: 'text',
|
|
46
|
+
admin: {
|
|
47
|
+
description: 'CC recipients'
|
|
48
|
+
},
|
|
49
|
+
hasMany: true
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'bcc',
|
|
53
|
+
type: 'text',
|
|
54
|
+
admin: {
|
|
55
|
+
description: 'BCC recipients'
|
|
56
|
+
},
|
|
57
|
+
hasMany: true
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
outputSchema: [
|
|
61
|
+
{
|
|
62
|
+
name: 'messageId',
|
|
63
|
+
type: 'text',
|
|
64
|
+
admin: {
|
|
65
|
+
description: 'Email message ID from the mail server'
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'response',
|
|
70
|
+
type: 'text',
|
|
71
|
+
admin: {
|
|
72
|
+
description: 'Response from the mail server'
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=send-email.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/steps/send-email.ts"],"sourcesContent":["import type { TaskConfig } from \"payload\"\n\nimport { sendEmailHandler } from \"./send-email-handler.js\"\n\nexport const SendEmailStepTask = {\n slug: 'send-email',\n handler: sendEmailHandler,\n inputSchema: [\n {\n name: 'to',\n type: 'text',\n admin: {\n description: 'Recipient email address'\n },\n required: true\n },\n {\n name: 'from',\n type: 'text',\n admin: {\n description: 'Sender email address (optional, uses default if not provided)'\n }\n },\n {\n name: 'subject',\n type: 'text',\n admin: {\n description: 'Email subject line'\n },\n required: true\n },\n {\n name: 'text',\n type: 'textarea',\n admin: {\n description: 'Plain text email content'\n }\n },\n {\n name: 'html',\n type: 'textarea',\n admin: {\n description: 'HTML email content (optional)'\n }\n },\n {\n name: 'cc',\n type: 'text',\n admin: {\n description: 'CC recipients'\n },\n hasMany: true\n },\n {\n name: 'bcc',\n type: 'text',\n admin: {\n description: 'BCC recipients'\n },\n hasMany: true\n }\n ],\n outputSchema: [\n {\n name: 'messageId',\n type: 'text',\n admin: {\n description: 'Email message ID from the mail server'\n }\n },\n {\n name: 'response',\n type: 'text',\n admin: {\n description: 'Response from the mail server'\n }\n }\n ]\n} satisfies TaskConfig<'send-email'>"],"names":["sendEmailHandler","SendEmailStepTask","slug","handler","inputSchema","name","type","admin","description","required","hasMany","outputSchema"],"mappings":"AAEA,SAASA,gBAAgB,QAAQ,0BAAyB;AAE1D,OAAO,MAAMC,oBAAoB;IAC/BC,MAAM;IACNC,SAASH;IACTI,aAAa;QACX;YACEC,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,aAAa;YACf;YACAC,UAAU;QACZ;QACA;YACEJ,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,aAAa;YACf;QACF;QACA;YACEH,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,aAAa;YACf;YACAC,UAAU;QACZ;QACA;YACEJ,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,aAAa;YACf;QACF;QACA;YACEH,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,aAAa;YACf;QACF;QACA;YACEH,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,aAAa;YACf;YACAE,SAAS;QACX;QACA;YACEL,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,aAAa;YACf;YACAE,SAAS;QACX;KACD;IACDC,cAAc;QACZ;YACEN,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,aAAa;YACf;QACF;QACA;YACEH,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,aAAa;YACf;QACF;KACD;AACH,EAAoC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const updateDocumentHandler = async ({ input, req })=>{
|
|
2
|
+
if (!input) {
|
|
3
|
+
throw new Error('No input provided');
|
|
4
|
+
}
|
|
5
|
+
const { id, collection, data, draft, locale } = input;
|
|
6
|
+
if (!collection || typeof collection !== 'string') {
|
|
7
|
+
throw new Error('Collection slug is required');
|
|
8
|
+
}
|
|
9
|
+
if (!id) {
|
|
10
|
+
throw new Error('Document ID is required');
|
|
11
|
+
}
|
|
12
|
+
if (!data) {
|
|
13
|
+
throw new Error('Update data is required');
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
const parsedData = typeof data === 'string' ? JSON.parse(data) : data;
|
|
17
|
+
const result = await req.payload.update({
|
|
18
|
+
id: id.toString(),
|
|
19
|
+
collection,
|
|
20
|
+
data: parsedData,
|
|
21
|
+
draft: draft || false,
|
|
22
|
+
locale: locale || undefined,
|
|
23
|
+
req
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
output: {
|
|
27
|
+
id: result.id,
|
|
28
|
+
doc: result
|
|
29
|
+
},
|
|
30
|
+
state: 'succeeded'
|
|
31
|
+
};
|
|
32
|
+
} catch (error) {
|
|
33
|
+
return {
|
|
34
|
+
errorName: error instanceof Error ? error.message : 'Failed to update document',
|
|
35
|
+
state: 'failed'
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=update-document-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/steps/update-document-handler.ts"],"sourcesContent":["import type { TaskHandler } from \"payload\"\n\nexport const updateDocumentHandler: TaskHandler<'update-document'> = async ({ input, req }) => {\n if (!input) {\n throw new Error('No input provided')\n }\n\n const { id, collection, data, draft, locale } = input\n\n if (!collection || typeof collection !== 'string') {\n throw new Error('Collection slug is required')\n }\n\n if (!id) {\n throw new Error('Document ID is required')\n }\n\n if (!data) {\n throw new Error('Update data is required')\n }\n\n try {\n const parsedData = typeof data === 'string' ? JSON.parse(data) : data\n\n const result = await req.payload.update({\n id: id.toString(),\n collection,\n data: parsedData,\n draft: draft || false,\n locale: locale || undefined,\n req\n })\n\n return {\n output: {\n id: result.id,\n doc: result\n },\n state: 'succeeded'\n }\n } catch (error) {\n return {\n errorName: error instanceof Error ? error.message : 'Failed to update document',\n state: 'failed'\n }\n }\n}\n"],"names":["updateDocumentHandler","input","req","Error","id","collection","data","draft","locale","parsedData","JSON","parse","result","payload","update","toString","undefined","output","doc","state","error","errorName","message"],"mappings":"AAEA,OAAO,MAAMA,wBAAwD,OAAO,EAAEC,KAAK,EAAEC,GAAG,EAAE;IACxF,IAAI,CAACD,OAAO;QACV,MAAM,IAAIE,MAAM;IAClB;IAEA,MAAM,EAAEC,EAAE,EAAEC,UAAU,EAAEC,IAAI,EAAEC,KAAK,EAAEC,MAAM,EAAE,GAAGP;IAEhD,IAAI,CAACI,cAAc,OAAOA,eAAe,UAAU;QACjD,MAAM,IAAIF,MAAM;IAClB;IAEA,IAAI,CAACC,IAAI;QACP,MAAM,IAAID,MAAM;IAClB;IAEA,IAAI,CAACG,MAAM;QACT,MAAM,IAAIH,MAAM;IAClB;IAEA,IAAI;QACF,MAAMM,aAAa,OAAOH,SAAS,WAAWI,KAAKC,KAAK,CAACL,QAAQA;QAEjE,MAAMM,SAAS,MAAMV,IAAIW,OAAO,CAACC,MAAM,CAAC;YACtCV,IAAIA,GAAGW,QAAQ;YACfV;YACAC,MAAMG;YACNF,OAAOA,SAAS;YAChBC,QAAQA,UAAUQ;YAClBd;QACF;QAEA,OAAO;YACLe,QAAQ;gBACNb,IAAIQ,OAAOR,EAAE;gBACbc,KAAKN;YACP;YACAO,OAAO;QACT;IACF,EAAE,OAAOC,OAAO;QACd,OAAO;YACLC,WAAWD,iBAAiBjB,QAAQiB,MAAME,OAAO,GAAG;YACpDH,OAAO;QACT;IACF;AACF,EAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare const UpdateDocumentStepTask: {
|
|
2
|
+
slug: "update-document";
|
|
3
|
+
handler: import("payload").TaskHandler<"update-document">;
|
|
4
|
+
inputSchema: ({
|
|
5
|
+
name: string;
|
|
6
|
+
type: "text";
|
|
7
|
+
admin: {
|
|
8
|
+
description: string;
|
|
9
|
+
};
|
|
10
|
+
required: true;
|
|
11
|
+
} | {
|
|
12
|
+
name: string;
|
|
13
|
+
type: "json";
|
|
14
|
+
admin: {
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
required: true;
|
|
18
|
+
} | {
|
|
19
|
+
name: string;
|
|
20
|
+
type: "checkbox";
|
|
21
|
+
admin: {
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
required?: undefined;
|
|
25
|
+
} | {
|
|
26
|
+
name: string;
|
|
27
|
+
type: "text";
|
|
28
|
+
admin: {
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
required?: undefined;
|
|
32
|
+
})[];
|
|
33
|
+
outputSchema: ({
|
|
34
|
+
name: string;
|
|
35
|
+
type: "json";
|
|
36
|
+
admin: {
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
} | {
|
|
40
|
+
name: string;
|
|
41
|
+
type: "text";
|
|
42
|
+
admin: {
|
|
43
|
+
description: string;
|
|
44
|
+
};
|
|
45
|
+
})[];
|
|
46
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { updateDocumentHandler } from "./update-document-handler.js";
|
|
2
|
+
export const UpdateDocumentStepTask = {
|
|
3
|
+
slug: 'update-document',
|
|
4
|
+
handler: updateDocumentHandler,
|
|
5
|
+
inputSchema: [
|
|
6
|
+
{
|
|
7
|
+
name: 'collection',
|
|
8
|
+
type: 'text',
|
|
9
|
+
admin: {
|
|
10
|
+
description: 'The collection slug to update a document in'
|
|
11
|
+
},
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'id',
|
|
16
|
+
type: 'text',
|
|
17
|
+
admin: {
|
|
18
|
+
description: 'The ID of the document to update'
|
|
19
|
+
},
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'data',
|
|
24
|
+
type: 'json',
|
|
25
|
+
admin: {
|
|
26
|
+
description: 'The data to update the document with'
|
|
27
|
+
},
|
|
28
|
+
required: true
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'draft',
|
|
32
|
+
type: 'checkbox',
|
|
33
|
+
admin: {
|
|
34
|
+
description: 'Update as draft (if collection has drafts enabled)'
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'locale',
|
|
39
|
+
type: 'text',
|
|
40
|
+
admin: {
|
|
41
|
+
description: 'Locale for the document (if localization is enabled)'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
outputSchema: [
|
|
46
|
+
{
|
|
47
|
+
name: 'doc',
|
|
48
|
+
type: 'json',
|
|
49
|
+
admin: {
|
|
50
|
+
description: 'The updated document'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'id',
|
|
55
|
+
type: 'text',
|
|
56
|
+
admin: {
|
|
57
|
+
description: 'The ID of the updated document'
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=update-document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/steps/update-document.ts"],"sourcesContent":["import type { TaskConfig } from \"payload\"\n\nimport { updateDocumentHandler } from \"./update-document-handler.js\"\n\nexport const UpdateDocumentStepTask = {\n slug: 'update-document',\n handler: updateDocumentHandler,\n inputSchema: [\n {\n name: 'collection',\n type: 'text',\n admin: {\n description: 'The collection slug to update a document in'\n },\n required: true\n },\n {\n name: 'id',\n type: 'text',\n admin: {\n description: 'The ID of the document to update'\n },\n required: true\n },\n {\n name: 'data',\n type: 'json',\n admin: {\n description: 'The data to update the document with'\n },\n required: true\n },\n {\n name: 'draft',\n type: 'checkbox',\n admin: {\n description: 'Update as draft (if collection has drafts enabled)'\n }\n },\n {\n name: 'locale',\n type: 'text',\n admin: {\n description: 'Locale for the document (if localization is enabled)'\n }\n }\n ],\n outputSchema: [\n {\n name: 'doc',\n type: 'json',\n admin: {\n description: 'The updated document'\n }\n },\n {\n name: 'id',\n type: 'text',\n admin: {\n description: 'The ID of the updated document'\n }\n }\n ]\n} satisfies TaskConfig<'update-document'>"],"names":["updateDocumentHandler","UpdateDocumentStepTask","slug","handler","inputSchema","name","type","admin","description","required","outputSchema"],"mappings":"AAEA,SAASA,qBAAqB,QAAQ,+BAA8B;AAEpE,OAAO,MAAMC,yBAAyB;IACpCC,MAAM;IACNC,SAASH;IACTI,aAAa;QACX;YACEC,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,aAAa;YACf;YACAC,UAAU;QACZ;QACA;YACEJ,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,aAAa;YACf;YACAC,UAAU;QACZ;QACA;YACEJ,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,aAAa;YACf;YACAC,UAAU;QACZ;QACA;YACEJ,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,aAAa;YACf;QACF;QACA;YACEH,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,aAAa;YACf;QACF;KACD;IACDE,cAAc;QACZ;YACEL,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,aAAa;YACf;QACF;QACA;YACEH,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,aAAa;YACf;QACF;KACD;AACH,EAAyC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xtr-dev/payload-automation",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "PayloadCMS Automation Plugin - Comprehensive workflow automation system with visual workflow building, execution tracking, and step types",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./client": {
|
|
14
|
+
"import": "./dist/exports/client.js",
|
|
15
|
+
"types": "./dist/exports/client.d.ts",
|
|
16
|
+
"default": "./dist/exports/client.js"
|
|
17
|
+
},
|
|
18
|
+
"./rsc": {
|
|
19
|
+
"import": "./dist/exports/rsc.js",
|
|
20
|
+
"types": "./dist/exports/rsc.d.ts",
|
|
21
|
+
"default": "./dist/exports/rsc.js"
|
|
22
|
+
},
|
|
23
|
+
"./fields": {
|
|
24
|
+
"import": "./dist/exports/fields.js",
|
|
25
|
+
"types": "./dist/exports/fields.d.ts",
|
|
26
|
+
"default": "./dist/exports/fields.js"
|
|
27
|
+
},
|
|
28
|
+
"./views": {
|
|
29
|
+
"import": "./dist/exports/views.js",
|
|
30
|
+
"types": "./dist/exports/views.d.ts",
|
|
31
|
+
"default": "./dist/exports/views.js"
|
|
32
|
+
},
|
|
33
|
+
"./steps": {
|
|
34
|
+
"import": "./dist/steps/index.js",
|
|
35
|
+
"types": "./dist/steps/index.d.ts",
|
|
36
|
+
"default": "./dist/steps/index.js"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"main": "dist/index.js",
|
|
40
|
+
"types": "./dist/index.d.ts",
|
|
41
|
+
"files": [
|
|
42
|
+
"dist"
|
|
43
|
+
],
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "pnpm copyfiles && pnpm build:types && pnpm build:swc",
|
|
46
|
+
"build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
|
|
47
|
+
"build:types": "tsc --outDir dist --rootDir ./src",
|
|
48
|
+
"clean": "rimraf {dist,*.tsbuildinfo}",
|
|
49
|
+
"copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
|
|
50
|
+
"dev": "next dev dev --turbo",
|
|
51
|
+
"dev:generate-importmap": "pnpm dev:payload generate:importmap",
|
|
52
|
+
"dev:generate-types": "pnpm dev:payload generate:types",
|
|
53
|
+
"dev:payload": "cross-env PAYLOAD_CONFIG_PATH=./dev/payload.config.ts payload",
|
|
54
|
+
"generate:importmap": "pnpm dev:generate-importmap",
|
|
55
|
+
"generate:types": "pnpm dev:generate-types",
|
|
56
|
+
"lint": "eslint",
|
|
57
|
+
"lint:fix": "eslint ./src --fix",
|
|
58
|
+
"prepublishOnly": "pnpm clean && pnpm build",
|
|
59
|
+
"test": "pnpm test:int && pnpm test:e2e",
|
|
60
|
+
"test:e2e": "playwright test",
|
|
61
|
+
"test:int": "vitest"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@payloadcms/db-mongodb": "3.45.0",
|
|
65
|
+
"@payloadcms/db-postgres": "3.45.0",
|
|
66
|
+
"@payloadcms/db-sqlite": "3.45.0",
|
|
67
|
+
"@payloadcms/eslint-config": "3.9.0",
|
|
68
|
+
"@payloadcms/next": "3.45.0",
|
|
69
|
+
"@payloadcms/richtext-lexical": "3.45.0",
|
|
70
|
+
"@payloadcms/ui": "3.45.0",
|
|
71
|
+
"@playwright/test": "^1.52.0",
|
|
72
|
+
"@swc/cli": "0.6.0",
|
|
73
|
+
"@types/node": "^22.5.4",
|
|
74
|
+
"@types/node-cron": "^3.0.11",
|
|
75
|
+
"@types/react": "19.1.8",
|
|
76
|
+
"@types/react-dom": "19.1.6",
|
|
77
|
+
"copyfiles": "2.4.1",
|
|
78
|
+
"cross-env": "^7.0.3",
|
|
79
|
+
"eslint": "^9.23.0",
|
|
80
|
+
"graphql": "^16.8.1",
|
|
81
|
+
"mongodb-memory-server": "10.1.4",
|
|
82
|
+
"next": "15.4.4",
|
|
83
|
+
"payload": "3.45.0",
|
|
84
|
+
"react": "19.1.0",
|
|
85
|
+
"react-dom": "19.1.0",
|
|
86
|
+
"rimraf": "3.0.2",
|
|
87
|
+
"sharp": "0.34.2",
|
|
88
|
+
"typescript": "5.7.3",
|
|
89
|
+
"vitest": "^3.1.2"
|
|
90
|
+
},
|
|
91
|
+
"peerDependencies": {
|
|
92
|
+
"payload": "^3.45.0"
|
|
93
|
+
},
|
|
94
|
+
"engines": {
|
|
95
|
+
"node": "^18.20.2 || >=20.9.0",
|
|
96
|
+
"pnpm": "^9 || ^10"
|
|
97
|
+
},
|
|
98
|
+
"publishConfig": {
|
|
99
|
+
"exports": {
|
|
100
|
+
".": {
|
|
101
|
+
"import": "./dist/index.js",
|
|
102
|
+
"types": "./dist/index.d.ts",
|
|
103
|
+
"default": "./dist/index.js"
|
|
104
|
+
},
|
|
105
|
+
"./client": {
|
|
106
|
+
"import": "./dist/exports/client.js",
|
|
107
|
+
"types": "./dist/exports/client.d.ts",
|
|
108
|
+
"default": "./dist/exports/client.js"
|
|
109
|
+
},
|
|
110
|
+
"./rsc": {
|
|
111
|
+
"import": "./dist/exports/rsc.js",
|
|
112
|
+
"types": "./dist/exports/rsc.d.ts",
|
|
113
|
+
"default": "./dist/exports/rsc.js"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"main": "./dist/index.js",
|
|
117
|
+
"types": "./dist/index.d.ts"
|
|
118
|
+
},
|
|
119
|
+
"pnpm": {
|
|
120
|
+
"onlyBuiltDependencies": [
|
|
121
|
+
"sharp",
|
|
122
|
+
"esbuild",
|
|
123
|
+
"unrs-resolver"
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
"registry": "https://registry.npmjs.org/",
|
|
127
|
+
"packageManager": "pnpm@10.12.4+sha512.5ea8b0deed94ed68691c9bad4c955492705c5eeb8a87ef86bc62c74a26b037b08ff9570f108b2e4dbd1dd1a9186fea925e527f141c648e85af45631074680184",
|
|
128
|
+
"dependencies": {
|
|
129
|
+
"jsonpath-plus": "^10.3.0",
|
|
130
|
+
"node-cron": "^4.2.1",
|
|
131
|
+
"pino": "^9.9.0"
|
|
132
|
+
}
|
|
133
|
+
}
|