@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.
Files changed (98) hide show
  1. package/README.md +73 -0
  2. package/dist/collections/Workflow.d.ts +3 -0
  3. package/dist/collections/Workflow.js +223 -0
  4. package/dist/collections/Workflow.js.map +1 -0
  5. package/dist/collections/WorkflowRuns.d.ts +2 -0
  6. package/dist/collections/WorkflowRuns.js +157 -0
  7. package/dist/collections/WorkflowRuns.js.map +1 -0
  8. package/dist/components/TriggerWorkflowButton.d.ts +7 -0
  9. package/dist/components/TriggerWorkflowButton.js +46 -0
  10. package/dist/components/TriggerWorkflowButton.js.map +1 -0
  11. package/dist/core/trigger-custom-workflow.d.ts +52 -0
  12. package/dist/core/trigger-custom-workflow.js +205 -0
  13. package/dist/core/trigger-custom-workflow.js.map +1 -0
  14. package/dist/core/workflow-executor.d.ts +86 -0
  15. package/dist/core/workflow-executor.js +456 -0
  16. package/dist/core/workflow-executor.js.map +1 -0
  17. package/dist/exports/client.d.ts +1 -0
  18. package/dist/exports/client.js +7 -0
  19. package/dist/exports/client.js.map +1 -0
  20. package/dist/exports/fields.d.ts +1 -0
  21. package/dist/exports/fields.js +6 -0
  22. package/dist/exports/fields.js.map +1 -0
  23. package/dist/exports/rsc.d.ts +1 -0
  24. package/dist/exports/rsc.js +3 -0
  25. package/dist/exports/rsc.js.map +1 -0
  26. package/dist/exports/views.d.ts +1 -0
  27. package/dist/exports/views.js +7 -0
  28. package/dist/exports/views.js.map +1 -0
  29. package/dist/index.d.ts +7 -0
  30. package/dist/index.js +8 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/plugin/config-types.d.ts +21 -0
  33. package/dist/plugin/config-types.js +3 -0
  34. package/dist/plugin/config-types.js.map +1 -0
  35. package/dist/plugin/cron-scheduler.d.ts +32 -0
  36. package/dist/plugin/cron-scheduler.js +537 -0
  37. package/dist/plugin/cron-scheduler.js.map +1 -0
  38. package/dist/plugin/index.d.ts +4 -0
  39. package/dist/plugin/index.js +66 -0
  40. package/dist/plugin/index.js.map +1 -0
  41. package/dist/plugin/init-collection-hooks.d.ts +4 -0
  42. package/dist/plugin/init-collection-hooks.js +63 -0
  43. package/dist/plugin/init-collection-hooks.js.map +1 -0
  44. package/dist/plugin/init-global-hooks.d.ts +3 -0
  45. package/dist/plugin/init-global-hooks.js +83 -0
  46. package/dist/plugin/init-global-hooks.js.map +1 -0
  47. package/dist/plugin/init-step-tasks.d.ts +3 -0
  48. package/dist/plugin/init-step-tasks.js +8 -0
  49. package/dist/plugin/init-step-tasks.js.map +1 -0
  50. package/dist/plugin/init-webhook.d.ts +2 -0
  51. package/dist/plugin/init-webhook.js +154 -0
  52. package/dist/plugin/init-webhook.js.map +1 -0
  53. package/dist/plugin/init-workflow-hooks.d.ts +6 -0
  54. package/dist/plugin/init-workflow-hooks.js +46 -0
  55. package/dist/plugin/init-workflow-hooks.js.map +1 -0
  56. package/dist/plugin/logger.d.ts +20 -0
  57. package/dist/plugin/logger.js +47 -0
  58. package/dist/plugin/logger.js.map +1 -0
  59. package/dist/steps/create-document-handler.d.ts +2 -0
  60. package/dist/steps/create-document-handler.js +36 -0
  61. package/dist/steps/create-document-handler.js.map +1 -0
  62. package/dist/steps/create-document.d.ts +46 -0
  63. package/dist/steps/create-document.js +55 -0
  64. package/dist/steps/create-document.js.map +1 -0
  65. package/dist/steps/delete-document-handler.d.ts +2 -0
  66. package/dist/steps/delete-document-handler.js +62 -0
  67. package/dist/steps/delete-document-handler.js.map +1 -0
  68. package/dist/steps/delete-document.d.ts +39 -0
  69. package/dist/steps/delete-document.js +47 -0
  70. package/dist/steps/delete-document.js.map +1 -0
  71. package/dist/steps/http-request-handler.d.ts +2 -0
  72. package/dist/steps/http-request-handler.js +14 -0
  73. package/dist/steps/http-request-handler.js.map +1 -0
  74. package/dist/steps/http-request.d.ts +12 -0
  75. package/dist/steps/http-request.js +19 -0
  76. package/dist/steps/http-request.js.map +1 -0
  77. package/dist/steps/index.d.ts +12 -0
  78. package/dist/steps/index.js +14 -0
  79. package/dist/steps/index.js.map +1 -0
  80. package/dist/steps/read-document-handler.d.ts +2 -0
  81. package/dist/steps/read-document-handler.js +53 -0
  82. package/dist/steps/read-document-handler.js.map +1 -0
  83. package/dist/steps/read-document.d.ts +46 -0
  84. package/dist/steps/read-document.js +75 -0
  85. package/dist/steps/read-document.js.map +1 -0
  86. package/dist/steps/send-email-handler.d.ts +2 -0
  87. package/dist/steps/send-email-handler.js +48 -0
  88. package/dist/steps/send-email-handler.js.map +1 -0
  89. package/dist/steps/send-email.d.ts +44 -0
  90. package/dist/steps/send-email.js +78 -0
  91. package/dist/steps/send-email.js.map +1 -0
  92. package/dist/steps/update-document-handler.d.ts +2 -0
  93. package/dist/steps/update-document-handler.js +40 -0
  94. package/dist/steps/update-document-handler.js.map +1 -0
  95. package/dist/steps/update-document.d.ts +46 -0
  96. package/dist/steps/update-document.js +63 -0
  97. package/dist/steps/update-document.js.map +1 -0
  98. package/package.json +133 -0
@@ -0,0 +1,36 @@
1
+ export const createDocumentHandler = async ({ input, req })=>{
2
+ if (!input) {
3
+ throw new Error('No input provided');
4
+ }
5
+ const { collection, data, draft, locale } = input;
6
+ if (!collection || typeof collection !== 'string') {
7
+ throw new Error('Collection slug is required');
8
+ }
9
+ if (!data) {
10
+ throw new Error('Document data is required');
11
+ }
12
+ try {
13
+ const parsedData = typeof data === 'string' ? JSON.parse(data) : data;
14
+ const result = await req.payload.create({
15
+ collection,
16
+ data: parsedData,
17
+ draft: draft || false,
18
+ locale: locale || undefined,
19
+ req
20
+ });
21
+ return {
22
+ output: {
23
+ id: result.id,
24
+ doc: result
25
+ },
26
+ state: 'succeeded'
27
+ };
28
+ } catch (error) {
29
+ return {
30
+ errorMessage: error instanceof Error ? error.message : 'Failed to create document',
31
+ state: 'failed'
32
+ };
33
+ }
34
+ };
35
+
36
+ //# sourceMappingURL=create-document-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/steps/create-document-handler.ts"],"sourcesContent":["import type { TaskHandler } from \"payload\"\n\nexport const createDocumentHandler: TaskHandler<'create-document'> = async ({ input, req }) => {\n if (!input) {\n throw new Error('No input provided')\n }\n\n const { collection, data, draft, locale } = input\n\n if (!collection || typeof collection !== 'string') {\n throw new Error('Collection slug is required')\n }\n\n if (!data) {\n throw new Error('Document data is required')\n }\n\n try {\n const parsedData = typeof data === 'string' ? JSON.parse(data) : data\n\n const result = await req.payload.create({\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 errorMessage: error instanceof Error ? error.message : 'Failed to create document',\n state: 'failed'\n }\n }\n}\n"],"names":["createDocumentHandler","input","req","Error","collection","data","draft","locale","parsedData","JSON","parse","result","payload","create","undefined","output","id","doc","state","error","errorMessage","message"],"mappings":"AAEA,OAAO,MAAMA,wBAAwD,OAAO,EAAEC,KAAK,EAAEC,GAAG,EAAE;IACxF,IAAI,CAACD,OAAO;QACV,MAAM,IAAIE,MAAM;IAClB;IAEA,MAAM,EAAEC,UAAU,EAAEC,IAAI,EAAEC,KAAK,EAAEC,MAAM,EAAE,GAAGN;IAE5C,IAAI,CAACG,cAAc,OAAOA,eAAe,UAAU;QACjD,MAAM,IAAID,MAAM;IAClB;IAEA,IAAI,CAACE,MAAM;QACT,MAAM,IAAIF,MAAM;IAClB;IAEA,IAAI;QACF,MAAMK,aAAa,OAAOH,SAAS,WAAWI,KAAKC,KAAK,CAACL,QAAQA;QAEjE,MAAMM,SAAS,MAAMT,IAAIU,OAAO,CAACC,MAAM,CAAC;YACtCT;YACAC,MAAMG;YACNF,OAAOA,SAAS;YAChBC,QAAQA,UAAUO;YAClBZ;QACF;QAEA,OAAO;YACLa,QAAQ;gBACNC,IAAIL,OAAOK,EAAE;gBACbC,KAAKN;YACP;YACAO,OAAO;QACT;IACF,EAAE,OAAOC,OAAO;QACd,OAAO;YACLC,cAAcD,iBAAiBhB,QAAQgB,MAAME,OAAO,GAAG;YACvDH,OAAO;QACT;IACF;AACF,EAAC"}
@@ -0,0 +1,46 @@
1
+ export declare const CreateDocumentStepTask: {
2
+ slug: "create-document";
3
+ handler: import("payload").TaskHandler<"create-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,55 @@
1
+ import { createDocumentHandler } from "./create-document-handler.js";
2
+ export const CreateDocumentStepTask = {
3
+ slug: 'create-document',
4
+ handler: createDocumentHandler,
5
+ inputSchema: [
6
+ {
7
+ name: 'collection',
8
+ type: 'text',
9
+ admin: {
10
+ description: 'The collection slug to create a document in'
11
+ },
12
+ required: true
13
+ },
14
+ {
15
+ name: 'data',
16
+ type: 'json',
17
+ admin: {
18
+ description: 'The document data to create'
19
+ },
20
+ required: true
21
+ },
22
+ {
23
+ name: 'draft',
24
+ type: 'checkbox',
25
+ admin: {
26
+ description: 'Create as draft (if collection has drafts enabled)'
27
+ }
28
+ },
29
+ {
30
+ name: 'locale',
31
+ type: 'text',
32
+ admin: {
33
+ description: 'Locale for the document (if localization is enabled)'
34
+ }
35
+ }
36
+ ],
37
+ outputSchema: [
38
+ {
39
+ name: 'doc',
40
+ type: 'json',
41
+ admin: {
42
+ description: 'The created document'
43
+ }
44
+ },
45
+ {
46
+ name: 'id',
47
+ type: 'text',
48
+ admin: {
49
+ description: 'The ID of the created document'
50
+ }
51
+ }
52
+ ]
53
+ };
54
+
55
+ //# sourceMappingURL=create-document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/steps/create-document.ts"],"sourcesContent":["import type { TaskConfig } from \"payload\"\n\nimport { createDocumentHandler } from \"./create-document-handler.js\"\n\nexport const CreateDocumentStepTask = {\n slug: 'create-document',\n handler: createDocumentHandler,\n inputSchema: [\n {\n name: 'collection',\n type: 'text',\n admin: {\n description: 'The collection slug to create a document in'\n },\n required: true\n },\n {\n name: 'data',\n type: 'json',\n admin: {\n description: 'The document data to create'\n },\n required: true\n },\n {\n name: 'draft',\n type: 'checkbox',\n admin: {\n description: 'Create 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 created document'\n }\n },\n {\n name: 'id',\n type: 'text',\n admin: {\n description: 'The ID of the created document'\n }\n }\n ]\n} satisfies TaskConfig<'create-document'>"],"names":["createDocumentHandler","CreateDocumentStepTask","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;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"}
@@ -0,0 +1,2 @@
1
+ import type { TaskHandler } from "payload";
2
+ export declare const deleteDocumentHandler: TaskHandler<'delete-document'>;
@@ -0,0 +1,62 @@
1
+ export const deleteDocumentHandler = async ({ input, req })=>{
2
+ if (!input) {
3
+ throw new Error('No input provided');
4
+ }
5
+ const { id, collection, where } = input;
6
+ if (!collection || typeof collection !== 'string') {
7
+ throw new Error('Collection slug is required');
8
+ }
9
+ try {
10
+ // If ID is provided, delete by ID
11
+ if (id) {
12
+ const result = await req.payload.delete({
13
+ id: id.toString(),
14
+ collection,
15
+ req
16
+ });
17
+ return {
18
+ output: {
19
+ deletedCount: 1,
20
+ doc: result
21
+ },
22
+ state: 'succeeded'
23
+ };
24
+ }
25
+ // Otherwise, delete multiple documents
26
+ if (!where) {
27
+ throw new Error('Either ID or where conditions must be provided');
28
+ }
29
+ const parsedWhere = typeof where === 'string' ? JSON.parse(where) : where;
30
+ // First find the documents to delete
31
+ const toDelete = await req.payload.find({
32
+ collection,
33
+ limit: 1000,
34
+ req,
35
+ where: parsedWhere
36
+ });
37
+ // Delete each document
38
+ const deleted = [];
39
+ for (const doc of toDelete.docs){
40
+ const result = await req.payload.delete({
41
+ id: doc.id,
42
+ collection,
43
+ req
44
+ });
45
+ deleted.push(result);
46
+ }
47
+ return {
48
+ output: {
49
+ deletedCount: deleted.length,
50
+ doc: deleted
51
+ },
52
+ state: 'succeeded'
53
+ };
54
+ } catch (error) {
55
+ return {
56
+ errorMessage: error instanceof Error ? error.message : 'Failed to delete document(s)',
57
+ state: 'failed'
58
+ };
59
+ }
60
+ };
61
+
62
+ //# sourceMappingURL=delete-document-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/steps/delete-document-handler.ts"],"sourcesContent":["import type { TaskHandler } from \"payload\"\n\nexport const deleteDocumentHandler: TaskHandler<'delete-document'> = async ({ input, req }) => {\n if (!input) {\n throw new Error('No input provided')\n }\n\n const { id, collection, where } = input\n\n if (!collection || typeof collection !== 'string') {\n throw new Error('Collection slug is required')\n }\n\n try {\n // If ID is provided, delete by ID\n if (id) {\n const result = await req.payload.delete({\n id: id.toString(),\n collection,\n req\n })\n\n return {\n output: {\n deletedCount: 1,\n doc: result\n },\n state: 'succeeded'\n }\n }\n\n // Otherwise, delete multiple documents\n if (!where) {\n throw new Error('Either ID or where conditions must be provided')\n }\n\n const parsedWhere = typeof where === 'string' ? JSON.parse(where) : where\n\n // First find the documents to delete\n const toDelete = await req.payload.find({\n collection,\n limit: 1000, // Set a reasonable limit\n req,\n where: parsedWhere\n })\n\n // Delete each document\n const deleted = []\n for (const doc of toDelete.docs) {\n const result = await req.payload.delete({\n id: doc.id,\n collection,\n req\n })\n deleted.push(result)\n }\n\n return {\n output: {\n deletedCount: deleted.length,\n doc: deleted\n },\n state: 'succeeded'\n }\n } catch (error) {\n return {\n errorMessage: error instanceof Error ? error.message : 'Failed to delete document(s)',\n state: 'failed'\n }\n }\n}\n"],"names":["deleteDocumentHandler","input","req","Error","id","collection","where","result","payload","delete","toString","output","deletedCount","doc","state","parsedWhere","JSON","parse","toDelete","find","limit","deleted","docs","push","length","error","errorMessage","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,KAAK,EAAE,GAAGL;IAElC,IAAI,CAACI,cAAc,OAAOA,eAAe,UAAU;QACjD,MAAM,IAAIF,MAAM;IAClB;IAEA,IAAI;QACF,kCAAkC;QAClC,IAAIC,IAAI;YACN,MAAMG,SAAS,MAAML,IAAIM,OAAO,CAACC,MAAM,CAAC;gBACtCL,IAAIA,GAAGM,QAAQ;gBACfL;gBACAH;YACF;YAEA,OAAO;gBACLS,QAAQ;oBACNC,cAAc;oBACdC,KAAKN;gBACP;gBACAO,OAAO;YACT;QACF;QAEA,uCAAuC;QACvC,IAAI,CAACR,OAAO;YACV,MAAM,IAAIH,MAAM;QAClB;QAEA,MAAMY,cAAc,OAAOT,UAAU,WAAWU,KAAKC,KAAK,CAACX,SAASA;QAEpE,qCAAqC;QACrC,MAAMY,WAAW,MAAMhB,IAAIM,OAAO,CAACW,IAAI,CAAC;YACtCd;YACAe,OAAO;YACPlB;YACAI,OAAOS;QACT;QAEA,uBAAuB;QACvB,MAAMM,UAAU,EAAE;QAClB,KAAK,MAAMR,OAAOK,SAASI,IAAI,CAAE;YAC/B,MAAMf,SAAS,MAAML,IAAIM,OAAO,CAACC,MAAM,CAAC;gBACtCL,IAAIS,IAAIT,EAAE;gBACVC;gBACAH;YACF;YACAmB,QAAQE,IAAI,CAAChB;QACf;QAEA,OAAO;YACLI,QAAQ;gBACNC,cAAcS,QAAQG,MAAM;gBAC5BX,KAAKQ;YACP;YACAP,OAAO;QACT;IACF,EAAE,OAAOW,OAAO;QACd,OAAO;YACLC,cAAcD,iBAAiBtB,QAAQsB,MAAME,OAAO,GAAG;YACvDb,OAAO;QACT;IACF;AACF,EAAC"}
@@ -0,0 +1,39 @@
1
+ export declare const DeleteDocumentStepTask: {
2
+ slug: "delete-document";
3
+ handler: import("payload").TaskHandler<"delete-document">;
4
+ inputSchema: ({
5
+ name: string;
6
+ type: "text";
7
+ admin: {
8
+ description: string;
9
+ };
10
+ required: true;
11
+ } | {
12
+ name: string;
13
+ type: "text";
14
+ admin: {
15
+ description: string;
16
+ };
17
+ required?: undefined;
18
+ } | {
19
+ name: string;
20
+ type: "json";
21
+ admin: {
22
+ description: string;
23
+ };
24
+ required?: undefined;
25
+ })[];
26
+ outputSchema: ({
27
+ name: string;
28
+ type: "json";
29
+ admin: {
30
+ description: string;
31
+ };
32
+ } | {
33
+ name: string;
34
+ type: "number";
35
+ admin: {
36
+ description: string;
37
+ };
38
+ })[];
39
+ };
@@ -0,0 +1,47 @@
1
+ import { deleteDocumentHandler } from "./delete-document-handler.js";
2
+ export const DeleteDocumentStepTask = {
3
+ slug: 'delete-document',
4
+ handler: deleteDocumentHandler,
5
+ inputSchema: [
6
+ {
7
+ name: 'collection',
8
+ type: 'text',
9
+ admin: {
10
+ description: 'The collection slug to delete from'
11
+ },
12
+ required: true
13
+ },
14
+ {
15
+ name: 'id',
16
+ type: 'text',
17
+ admin: {
18
+ description: 'The ID of a specific document to delete (leave empty to delete multiple)'
19
+ }
20
+ },
21
+ {
22
+ name: 'where',
23
+ type: 'json',
24
+ admin: {
25
+ description: 'Query conditions to find documents to delete (used when ID is not provided)'
26
+ }
27
+ }
28
+ ],
29
+ outputSchema: [
30
+ {
31
+ name: 'doc',
32
+ type: 'json',
33
+ admin: {
34
+ description: 'The deleted document(s)'
35
+ }
36
+ },
37
+ {
38
+ name: 'deletedCount',
39
+ type: 'number',
40
+ admin: {
41
+ description: 'Number of documents deleted'
42
+ }
43
+ }
44
+ ]
45
+ };
46
+
47
+ //# sourceMappingURL=delete-document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/steps/delete-document.ts"],"sourcesContent":["import type { TaskConfig } from \"payload\"\n\nimport { deleteDocumentHandler } from \"./delete-document-handler.js\"\n\nexport const DeleteDocumentStepTask = {\n slug: 'delete-document',\n handler: deleteDocumentHandler,\n inputSchema: [\n {\n name: 'collection',\n type: 'text',\n admin: {\n description: 'The collection slug to delete from'\n },\n required: true\n },\n {\n name: 'id',\n type: 'text',\n admin: {\n description: 'The ID of a specific document to delete (leave empty to delete multiple)'\n }\n },\n {\n name: 'where',\n type: 'json',\n admin: {\n description: 'Query conditions to find documents to delete (used when ID is not provided)'\n }\n }\n ],\n outputSchema: [\n {\n name: 'doc',\n type: 'json',\n admin: {\n description: 'The deleted document(s)'\n }\n },\n {\n name: 'deletedCount',\n type: 'number',\n admin: {\n description: 'Number of documents deleted'\n }\n }\n ]\n} satisfies TaskConfig<'delete-document'>"],"names":["deleteDocumentHandler","DeleteDocumentStepTask","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;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"}
@@ -0,0 +1,2 @@
1
+ import type { TaskHandler } from "payload";
2
+ export declare const httpStepHandler: TaskHandler<'http-request-step'>;
@@ -0,0 +1,14 @@
1
+ export const httpStepHandler = async ({ input })=>{
2
+ if (!input) {
3
+ throw new Error('No input provided');
4
+ }
5
+ const response = await fetch(input.url);
6
+ return {
7
+ output: {
8
+ response: await response.text()
9
+ },
10
+ state: response.ok ? 'succeeded' : undefined
11
+ };
12
+ };
13
+
14
+ //# sourceMappingURL=http-request-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/steps/http-request-handler.ts"],"sourcesContent":["import type {TaskHandler} from \"payload\"\n\nexport const httpStepHandler: TaskHandler<'http-request-step'> = async ({input}) => {\n if (!input) {\n throw new Error('No input provided')\n }\n const response = await fetch(input.url)\n return {\n output: {\n response: await response.text()\n },\n state: response.ok ? 'succeeded' : undefined\n }\n}\n"],"names":["httpStepHandler","input","Error","response","fetch","url","output","text","state","ok","undefined"],"mappings":"AAEA,OAAO,MAAMA,kBAAoD,OAAO,EAACC,KAAK,EAAC;IAC7E,IAAI,CAACA,OAAO;QACV,MAAM,IAAIC,MAAM;IAClB;IACA,MAAMC,WAAW,MAAMC,MAAMH,MAAMI,GAAG;IACtC,OAAO;QACLC,QAAQ;YACNH,UAAU,MAAMA,SAASI,IAAI;QAC/B;QACAC,OAAOL,SAASM,EAAE,GAAG,cAAcC;IACrC;AACF,EAAC"}
@@ -0,0 +1,12 @@
1
+ export declare const HttpRequestStepTask: {
2
+ slug: "http-request-step";
3
+ handler: import("payload").TaskHandler<"http-request-step">;
4
+ inputSchema: {
5
+ name: string;
6
+ type: "text";
7
+ }[];
8
+ outputSchema: {
9
+ name: string;
10
+ type: "textarea";
11
+ }[];
12
+ };
@@ -0,0 +1,19 @@
1
+ import { httpStepHandler } from "./http-request-handler.js";
2
+ export const HttpRequestStepTask = {
3
+ slug: 'http-request-step',
4
+ handler: httpStepHandler,
5
+ inputSchema: [
6
+ {
7
+ name: 'url',
8
+ type: 'text'
9
+ }
10
+ ],
11
+ outputSchema: [
12
+ {
13
+ name: 'response',
14
+ type: 'textarea'
15
+ }
16
+ ]
17
+ };
18
+
19
+ //# sourceMappingURL=http-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/steps/http-request.ts"],"sourcesContent":["import type {TaskConfig} from \"payload\"\n\nimport {httpStepHandler} from \"./http-request-handler.js\"\n\nexport const HttpRequestStepTask = {\n slug: 'http-request-step',\n handler: httpStepHandler,\n inputSchema: [\n {\n name: 'url',\n type: 'text',\n }\n ],\n outputSchema: [\n {\n name: 'response',\n type: 'textarea',\n }\n ]\n} satisfies TaskConfig<'http-request-step'>\n"],"names":["httpStepHandler","HttpRequestStepTask","slug","handler","inputSchema","name","type","outputSchema"],"mappings":"AAEA,SAAQA,eAAe,QAAO,4BAA2B;AAEzD,OAAO,MAAMC,sBAAsB;IACjCC,MAAM;IACNC,SAASH;IACTI,aAAa;QACX;YACEC,MAAM;YACNC,MAAM;QACR;KACD;IACDC,cAAc;QACZ;YACEF,MAAM;YACNC,MAAM;QACR;KACD;AACH,EAA2C"}
@@ -0,0 +1,12 @@
1
+ export { CreateDocumentStepTask } from './create-document.js';
2
+ export { createDocumentHandler } from './create-document-handler.js';
3
+ export { DeleteDocumentStepTask } from './delete-document.js';
4
+ export { deleteDocumentHandler } from './delete-document-handler.js';
5
+ export { HttpRequestStepTask } from './http-request.js';
6
+ export { httpStepHandler } from './http-request-handler.js';
7
+ export { ReadDocumentStepTask } from './read-document.js';
8
+ export { readDocumentHandler } from './read-document-handler.js';
9
+ export { SendEmailStepTask } from './send-email.js';
10
+ export { sendEmailHandler } from './send-email-handler.js';
11
+ export { UpdateDocumentStepTask } from './update-document.js';
12
+ export { updateDocumentHandler } from './update-document-handler.js';
@@ -0,0 +1,14 @@
1
+ export { CreateDocumentStepTask } from './create-document.js';
2
+ export { createDocumentHandler } from './create-document-handler.js';
3
+ export { DeleteDocumentStepTask } from './delete-document.js';
4
+ export { deleteDocumentHandler } from './delete-document-handler.js';
5
+ export { HttpRequestStepTask } from './http-request.js';
6
+ export { httpStepHandler } from './http-request-handler.js';
7
+ export { ReadDocumentStepTask } from './read-document.js';
8
+ export { readDocumentHandler } from './read-document-handler.js';
9
+ export { SendEmailStepTask } from './send-email.js';
10
+ export { sendEmailHandler } from './send-email-handler.js';
11
+ export { UpdateDocumentStepTask } from './update-document.js';
12
+ export { updateDocumentHandler } from './update-document-handler.js';
13
+
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/steps/index.ts"],"sourcesContent":["export { CreateDocumentStepTask } from './create-document.js'\nexport { createDocumentHandler } from './create-document-handler.js'\nexport { DeleteDocumentStepTask } from './delete-document.js'\nexport { deleteDocumentHandler } from './delete-document-handler.js'\nexport { HttpRequestStepTask } from './http-request.js'\nexport { httpStepHandler } from './http-request-handler.js'\n\nexport { ReadDocumentStepTask } from './read-document.js'\nexport { readDocumentHandler } from './read-document-handler.js'\nexport { SendEmailStepTask } from './send-email.js'\nexport { sendEmailHandler } from './send-email-handler.js'\nexport { UpdateDocumentStepTask } from './update-document.js'\nexport { updateDocumentHandler } from './update-document-handler.js'\n"],"names":["CreateDocumentStepTask","createDocumentHandler","DeleteDocumentStepTask","deleteDocumentHandler","HttpRequestStepTask","httpStepHandler","ReadDocumentStepTask","readDocumentHandler","SendEmailStepTask","sendEmailHandler","UpdateDocumentStepTask","updateDocumentHandler"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,uBAAsB;AAC7D,SAASC,qBAAqB,QAAQ,+BAA8B;AACpE,SAASC,sBAAsB,QAAQ,uBAAsB;AAC7D,SAASC,qBAAqB,QAAQ,+BAA8B;AACpE,SAASC,mBAAmB,QAAQ,oBAAmB;AACvD,SAASC,eAAe,QAAQ,4BAA2B;AAE3D,SAASC,oBAAoB,QAAQ,qBAAoB;AACzD,SAASC,mBAAmB,QAAQ,6BAA4B;AAChE,SAASC,iBAAiB,QAAQ,kBAAiB;AACnD,SAASC,gBAAgB,QAAQ,0BAAyB;AAC1D,SAASC,sBAAsB,QAAQ,uBAAsB;AAC7D,SAASC,qBAAqB,QAAQ,+BAA8B"}
@@ -0,0 +1,2 @@
1
+ import type { TaskHandler } from "payload";
2
+ export declare const readDocumentHandler: TaskHandler<'read-document'>;
@@ -0,0 +1,53 @@
1
+ export const readDocumentHandler = async ({ input, req })=>{
2
+ if (!input) {
3
+ throw new Error('No input provided');
4
+ }
5
+ const { id, collection, depth, limit, locale, sort, where } = input;
6
+ if (!collection || typeof collection !== 'string') {
7
+ throw new Error('Collection slug is required');
8
+ }
9
+ try {
10
+ // If ID is provided, find by ID
11
+ if (id) {
12
+ const result = await req.payload.findByID({
13
+ id: id.toString(),
14
+ collection,
15
+ depth: typeof depth === 'number' ? depth : undefined,
16
+ locale: locale || undefined,
17
+ req
18
+ });
19
+ return {
20
+ output: {
21
+ doc: result,
22
+ totalDocs: 1
23
+ },
24
+ state: 'succeeded'
25
+ };
26
+ }
27
+ // Otherwise, find multiple documents
28
+ const parsedWhere = where ? typeof where === 'string' ? JSON.parse(where) : where : {};
29
+ const result = await req.payload.find({
30
+ collection,
31
+ depth: typeof depth === 'number' ? depth : undefined,
32
+ limit: typeof limit === 'number' ? limit : 10,
33
+ locale: locale || undefined,
34
+ req,
35
+ sort: sort || undefined,
36
+ where: parsedWhere
37
+ });
38
+ return {
39
+ output: {
40
+ doc: result.docs,
41
+ totalDocs: result.totalDocs
42
+ },
43
+ state: 'succeeded'
44
+ };
45
+ } catch (error) {
46
+ return {
47
+ errorName: error instanceof Error ? error.message : 'Failed to read document(s)',
48
+ state: 'failed'
49
+ };
50
+ }
51
+ };
52
+
53
+ //# sourceMappingURL=read-document-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/steps/read-document-handler.ts"],"sourcesContent":["import type { TaskHandler } from \"payload\"\n\nexport const readDocumentHandler: TaskHandler<'read-document'> = async ({ input, req }) => {\n if (!input) {\n throw new Error('No input provided')\n }\n\n const { id, collection, depth, limit, locale, sort, where } = input\n\n if (!collection || typeof collection !== 'string') {\n throw new Error('Collection slug is required')\n }\n\n try {\n // If ID is provided, find by ID\n if (id) {\n const result = await req.payload.findByID({\n id: id.toString(),\n collection,\n depth: typeof depth === 'number' ? depth : undefined,\n locale: locale || undefined,\n req\n })\n\n return {\n output: {\n doc: result,\n totalDocs: 1\n },\n state: 'succeeded'\n }\n }\n\n // Otherwise, find multiple documents\n const parsedWhere = where ? (typeof where === 'string' ? JSON.parse(where) : where) : {}\n\n const result = await req.payload.find({\n collection,\n depth: typeof depth === 'number' ? depth : undefined,\n limit: typeof limit === 'number' ? limit : 10,\n locale: locale || undefined,\n req,\n sort: sort || undefined,\n where: parsedWhere\n })\n\n return {\n output: {\n doc: result.docs,\n totalDocs: result.totalDocs\n },\n state: 'succeeded'\n }\n } catch (error) {\n return {\n errorName: error instanceof Error ? error.message : 'Failed to read document(s)',\n state: 'failed'\n }\n }\n}\n"],"names":["readDocumentHandler","input","req","Error","id","collection","depth","limit","locale","sort","where","result","payload","findByID","toString","undefined","output","doc","totalDocs","state","parsedWhere","JSON","parse","find","docs","error","errorName","message"],"mappings":"AAEA,OAAO,MAAMA,sBAAoD,OAAO,EAAEC,KAAK,EAAEC,GAAG,EAAE;IACpF,IAAI,CAACD,OAAO;QACV,MAAM,IAAIE,MAAM;IAClB;IAEA,MAAM,EAAEC,EAAE,EAAEC,UAAU,EAAEC,KAAK,EAAEC,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGT;IAE9D,IAAI,CAACI,cAAc,OAAOA,eAAe,UAAU;QACjD,MAAM,IAAIF,MAAM;IAClB;IAEA,IAAI;QACF,gCAAgC;QAChC,IAAIC,IAAI;YACN,MAAMO,SAAS,MAAMT,IAAIU,OAAO,CAACC,QAAQ,CAAC;gBACxCT,IAAIA,GAAGU,QAAQ;gBACfT;gBACAC,OAAO,OAAOA,UAAU,WAAWA,QAAQS;gBAC3CP,QAAQA,UAAUO;gBAClBb;YACF;YAEA,OAAO;gBACLc,QAAQ;oBACNC,KAAKN;oBACLO,WAAW;gBACb;gBACAC,OAAO;YACT;QACF;QAEA,qCAAqC;QACrC,MAAMC,cAAcV,QAAS,OAAOA,UAAU,WAAWW,KAAKC,KAAK,CAACZ,SAASA,QAAS,CAAC;QAEvF,MAAMC,SAAS,MAAMT,IAAIU,OAAO,CAACW,IAAI,CAAC;YACpClB;YACAC,OAAO,OAAOA,UAAU,WAAWA,QAAQS;YAC3CR,OAAO,OAAOA,UAAU,WAAWA,QAAQ;YAC3CC,QAAQA,UAAUO;YAClBb;YACAO,MAAMA,QAAQM;YACdL,OAAOU;QACT;QAEA,OAAO;YACLJ,QAAQ;gBACNC,KAAKN,OAAOa,IAAI;gBAChBN,WAAWP,OAAOO,SAAS;YAC7B;YACAC,OAAO;QACT;IACF,EAAE,OAAOM,OAAO;QACd,OAAO;YACLC,WAAWD,iBAAiBtB,QAAQsB,MAAME,OAAO,GAAG;YACpDR,OAAO;QACT;IACF;AACF,EAAC"}
@@ -0,0 +1,46 @@
1
+ export declare const ReadDocumentStepTask: {
2
+ slug: "read-document";
3
+ handler: import("payload").TaskHandler<"read-document">;
4
+ inputSchema: ({
5
+ name: string;
6
+ type: "text";
7
+ admin: {
8
+ description: string;
9
+ };
10
+ required: true;
11
+ } | {
12
+ name: string;
13
+ type: "text";
14
+ admin: {
15
+ description: string;
16
+ };
17
+ required?: undefined;
18
+ } | {
19
+ name: string;
20
+ type: "json";
21
+ admin: {
22
+ description: string;
23
+ };
24
+ required?: undefined;
25
+ } | {
26
+ name: string;
27
+ type: "number";
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: "number";
42
+ admin: {
43
+ description: string;
44
+ };
45
+ })[];
46
+ };
@@ -0,0 +1,75 @@
1
+ import { readDocumentHandler } from "./read-document-handler.js";
2
+ export const ReadDocumentStepTask = {
3
+ slug: 'read-document',
4
+ handler: readDocumentHandler,
5
+ inputSchema: [
6
+ {
7
+ name: 'collection',
8
+ type: 'text',
9
+ admin: {
10
+ description: 'The collection slug to read from'
11
+ },
12
+ required: true
13
+ },
14
+ {
15
+ name: 'id',
16
+ type: 'text',
17
+ admin: {
18
+ description: 'The ID of a specific document to read (leave empty to find multiple)'
19
+ }
20
+ },
21
+ {
22
+ name: 'where',
23
+ type: 'json',
24
+ admin: {
25
+ description: 'Query conditions to find documents (used when ID is not provided)'
26
+ }
27
+ },
28
+ {
29
+ name: 'limit',
30
+ type: 'number',
31
+ admin: {
32
+ description: 'Maximum number of documents to return (default: 10)'
33
+ }
34
+ },
35
+ {
36
+ name: 'sort',
37
+ type: 'text',
38
+ admin: {
39
+ description: 'Field to sort by (prefix with - for descending order)'
40
+ }
41
+ },
42
+ {
43
+ name: 'locale',
44
+ type: 'text',
45
+ admin: {
46
+ description: 'Locale for the document (if localization is enabled)'
47
+ }
48
+ },
49
+ {
50
+ name: 'depth',
51
+ type: 'number',
52
+ admin: {
53
+ description: 'Depth of relationships to populate (0-10)'
54
+ }
55
+ }
56
+ ],
57
+ outputSchema: [
58
+ {
59
+ name: 'doc',
60
+ type: 'json',
61
+ admin: {
62
+ description: 'The document(s) found'
63
+ }
64
+ },
65
+ {
66
+ name: 'totalDocs',
67
+ type: 'number',
68
+ admin: {
69
+ description: 'Total number of documents matching the query'
70
+ }
71
+ }
72
+ ]
73
+ };
74
+
75
+ //# sourceMappingURL=read-document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/steps/read-document.ts"],"sourcesContent":["import type { TaskConfig } from \"payload\"\n\nimport { readDocumentHandler } from \"./read-document-handler.js\"\n\nexport const ReadDocumentStepTask = {\n slug: 'read-document',\n handler: readDocumentHandler,\n inputSchema: [\n {\n name: 'collection',\n type: 'text',\n admin: {\n description: 'The collection slug to read from'\n },\n required: true\n },\n {\n name: 'id',\n type: 'text',\n admin: {\n description: 'The ID of a specific document to read (leave empty to find multiple)'\n }\n },\n {\n name: 'where',\n type: 'json',\n admin: {\n description: 'Query conditions to find documents (used when ID is not provided)'\n }\n },\n {\n name: 'limit',\n type: 'number',\n admin: {\n description: 'Maximum number of documents to return (default: 10)'\n }\n },\n {\n name: 'sort',\n type: 'text',\n admin: {\n description: 'Field to sort by (prefix with - for descending order)'\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 name: 'depth',\n type: 'number',\n admin: {\n description: 'Depth of relationships to populate (0-10)'\n }\n }\n ],\n outputSchema: [\n {\n name: 'doc',\n type: 'json',\n admin: {\n description: 'The document(s) found'\n }\n },\n {\n name: 'totalDocs',\n type: 'number',\n admin: {\n description: 'Total number of documents matching the query'\n }\n }\n ]\n} satisfies TaskConfig<'read-document'>"],"names":["readDocumentHandler","ReadDocumentStepTask","slug","handler","inputSchema","name","type","admin","description","required","outputSchema"],"mappings":"AAEA,SAASA,mBAAmB,QAAQ,6BAA4B;AAEhE,OAAO,MAAMC,uBAAuB;IAClCC,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;QACF;QACA;YACEH,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;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,EAAuC"}
@@ -0,0 +1,2 @@
1
+ import type { TaskHandler } from "payload";
2
+ export declare const sendEmailHandler: TaskHandler<'send-email'>;