@xtr-dev/payload-automation 0.0.27 → 0.0.29
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/dist/collections/Workflow.js +1 -1
- package/dist/collections/Workflow.js.map +1 -1
- package/dist/collections/WorkflowRuns.js +2 -2
- package/dist/collections/WorkflowRuns.js.map +1 -1
- package/dist/components/ErrorDisplay.d.ts +9 -0
- package/dist/components/ErrorDisplay.js +307 -0
- package/dist/components/ErrorDisplay.js.map +1 -0
- package/dist/exports/client.d.ts +1 -0
- package/dist/exports/client.js +1 -1
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/helpers.d.ts +14 -15
- package/dist/exports/helpers.js +14 -16
- package/dist/exports/helpers.js.map +1 -1
- package/dist/utils/trigger-helpers.d.ts +54 -40
- package/dist/utils/trigger-helpers.js +107 -79
- package/dist/utils/trigger-helpers.js.map +1 -1
- package/dist/utils/trigger-presets.d.ts +6 -42
- package/dist/utils/trigger-presets.js +106 -101
- package/dist/utils/trigger-presets.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,113 +1,115 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createTrigger } from './trigger-helpers.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
* Preset trigger builders for common patterns
|
|
4
|
+
*/ /**
|
|
5
|
+
* Create a webhook trigger with common webhook parameters pre-configured
|
|
6
|
+
*/ export function webhookTrigger(slug) {
|
|
7
|
+
return createTrigger(slug, [
|
|
8
|
+
{
|
|
9
|
+
name: 'path',
|
|
10
|
+
type: 'text',
|
|
11
|
+
required: true,
|
|
12
|
+
admin: {
|
|
13
|
+
description: 'URL path for the webhook endpoint (e.g., "my-webhook")'
|
|
14
|
+
},
|
|
15
|
+
validate: (value)=>{
|
|
16
|
+
if (typeof value === 'string' && value.includes(' ')) {
|
|
17
|
+
return 'Webhook path cannot contain spaces';
|
|
18
|
+
}
|
|
19
|
+
return true;
|
|
14
20
|
}
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
secret: {
|
|
19
|
-
type: 'text',
|
|
20
|
-
admin: {
|
|
21
|
-
description: 'Secret key for webhook signature validation (optional but recommended)'
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
headers: {
|
|
25
|
-
type: 'json',
|
|
26
|
-
admin: {
|
|
27
|
-
description: 'Expected HTTP headers for validation (JSON object)'
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
export const cronParameters = {
|
|
32
|
-
expression: {
|
|
33
|
-
type: 'text',
|
|
34
|
-
required: true,
|
|
35
|
-
admin: {
|
|
36
|
-
description: 'Cron expression for scheduling (e.g., "0 9 * * 1" for every Monday at 9 AM)',
|
|
37
|
-
placeholder: '0 9 * * 1'
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
timezone: {
|
|
41
|
-
type: 'text',
|
|
42
|
-
defaultValue: 'UTC',
|
|
43
|
-
admin: {
|
|
44
|
-
description: 'Timezone for cron execution (e.g., "America/New_York", "Europe/London")',
|
|
45
|
-
placeholder: 'UTC'
|
|
46
21
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
53
|
-
return true;
|
|
54
|
-
} catch {
|
|
55
|
-
return `Invalid timezone: ${value}. Please use a valid IANA timezone identifier`;
|
|
56
|
-
}
|
|
22
|
+
{
|
|
23
|
+
name: 'secret',
|
|
24
|
+
type: 'text',
|
|
25
|
+
admin: {
|
|
26
|
+
description: 'Secret key for webhook signature validation (optional but recommended)'
|
|
57
27
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
type: 'select',
|
|
65
|
-
hasMany: true,
|
|
66
|
-
options: [
|
|
67
|
-
{
|
|
68
|
-
label: 'User Created',
|
|
69
|
-
value: 'user.created'
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
label: 'User Updated',
|
|
73
|
-
value: 'user.updated'
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
label: 'Document Published',
|
|
77
|
-
value: 'document.published'
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
label: 'Payment Completed',
|
|
81
|
-
value: 'payment.completed'
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'headers',
|
|
31
|
+
type: 'json',
|
|
32
|
+
admin: {
|
|
33
|
+
description: 'Expected HTTP headers for validation (JSON object)'
|
|
82
34
|
}
|
|
83
|
-
],
|
|
84
|
-
admin: {
|
|
85
|
-
description: 'Event types that should trigger this workflow'
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
filters: {
|
|
89
|
-
type: 'json',
|
|
90
|
-
admin: {
|
|
91
|
-
description: 'JSON filters to apply to event data (e.g., {"status": "active"})'
|
|
92
35
|
}
|
|
93
|
-
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* Preset trigger builders for common patterns
|
|
97
|
-
*/ /**
|
|
98
|
-
* Create a webhook trigger with common webhook parameters pre-configured
|
|
99
|
-
*/ export function webhookTrigger(slug) {
|
|
100
|
-
return createAdvancedTrigger(slug).extend(webhookParameters);
|
|
36
|
+
]);
|
|
101
37
|
}
|
|
102
38
|
/**
|
|
103
39
|
* Create a scheduled/cron trigger with timing parameters pre-configured
|
|
104
40
|
*/ export function cronTrigger(slug) {
|
|
105
|
-
return
|
|
41
|
+
return createTrigger(slug, [
|
|
42
|
+
{
|
|
43
|
+
name: 'expression',
|
|
44
|
+
type: 'text',
|
|
45
|
+
required: true,
|
|
46
|
+
admin: {
|
|
47
|
+
description: 'Cron expression for scheduling (e.g., "0 9 * * 1" for every Monday at 9 AM)',
|
|
48
|
+
placeholder: '0 9 * * 1'
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'timezone',
|
|
53
|
+
type: 'text',
|
|
54
|
+
defaultValue: 'UTC',
|
|
55
|
+
admin: {
|
|
56
|
+
description: 'Timezone for cron execution (e.g., "America/New_York", "Europe/London")',
|
|
57
|
+
placeholder: 'UTC'
|
|
58
|
+
},
|
|
59
|
+
validate: (value)=>{
|
|
60
|
+
if (value) {
|
|
61
|
+
try {
|
|
62
|
+
new Intl.DateTimeFormat('en', {
|
|
63
|
+
timeZone: value
|
|
64
|
+
});
|
|
65
|
+
return true;
|
|
66
|
+
} catch {
|
|
67
|
+
return `Invalid timezone: ${value}. Please use a valid IANA timezone identifier`;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
]);
|
|
106
74
|
}
|
|
107
75
|
/**
|
|
108
76
|
* Create an event-driven trigger with event filtering parameters
|
|
109
77
|
*/ export function eventTrigger(slug) {
|
|
110
|
-
return
|
|
78
|
+
return createTrigger(slug, [
|
|
79
|
+
{
|
|
80
|
+
name: 'eventTypes',
|
|
81
|
+
type: 'select',
|
|
82
|
+
hasMany: true,
|
|
83
|
+
options: [
|
|
84
|
+
{
|
|
85
|
+
label: 'User Created',
|
|
86
|
+
value: 'user.created'
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
label: 'User Updated',
|
|
90
|
+
value: 'user.updated'
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: 'Document Published',
|
|
94
|
+
value: 'document.published'
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
label: 'Payment Completed',
|
|
98
|
+
value: 'payment.completed'
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
admin: {
|
|
102
|
+
description: 'Event types that should trigger this workflow'
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'filters',
|
|
107
|
+
type: 'json',
|
|
108
|
+
admin: {
|
|
109
|
+
description: 'JSON filters to apply to event data (e.g., {"status": "active"})'
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
]);
|
|
111
113
|
}
|
|
112
114
|
/**
|
|
113
115
|
* Create a simple manual trigger (no parameters needed)
|
|
@@ -120,15 +122,17 @@ export const eventParameters = {
|
|
|
120
122
|
/**
|
|
121
123
|
* Create an API trigger for external systems to call
|
|
122
124
|
*/ export function apiTrigger(slug) {
|
|
123
|
-
return
|
|
124
|
-
|
|
125
|
+
return createTrigger(slug, [
|
|
126
|
+
{
|
|
127
|
+
name: 'endpoint',
|
|
125
128
|
type: 'text',
|
|
126
129
|
required: true,
|
|
127
130
|
admin: {
|
|
128
131
|
description: 'API endpoint path (e.g., "/api/triggers/my-trigger")'
|
|
129
132
|
}
|
|
130
133
|
},
|
|
131
|
-
|
|
134
|
+
{
|
|
135
|
+
name: 'method',
|
|
132
136
|
type: 'select',
|
|
133
137
|
options: [
|
|
134
138
|
'GET',
|
|
@@ -141,7 +145,8 @@ export const eventParameters = {
|
|
|
141
145
|
description: 'HTTP method for the API endpoint'
|
|
142
146
|
}
|
|
143
147
|
},
|
|
144
|
-
|
|
148
|
+
{
|
|
149
|
+
name: 'authentication',
|
|
145
150
|
type: 'select',
|
|
146
151
|
options: [
|
|
147
152
|
{
|
|
@@ -166,7 +171,7 @@ export const eventParameters = {
|
|
|
166
171
|
description: 'Authentication method for the API endpoint'
|
|
167
172
|
}
|
|
168
173
|
}
|
|
169
|
-
|
|
174
|
+
]);
|
|
170
175
|
}
|
|
171
176
|
|
|
172
177
|
//# sourceMappingURL=trigger-presets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/trigger-presets.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/utils/trigger-presets.ts"],"sourcesContent":["import { createTrigger } from './trigger-helpers.js'\nimport type { CustomTriggerConfig } from '../plugin/config-types.js'\n\n/**\n * Preset trigger builders for common patterns\n */\n\n/**\n * Create a webhook trigger with common webhook parameters pre-configured\n */\nexport function webhookTrigger(slug: string): CustomTriggerConfig {\n return createTrigger(slug, [\n {\n name: 'path',\n type: 'text',\n required: true,\n admin: {\n description: 'URL path for the webhook endpoint (e.g., \"my-webhook\")'\n },\n validate: (value: any) => {\n if (typeof value === 'string' && value.includes(' ')) {\n return 'Webhook path cannot contain spaces'\n }\n return true\n }\n },\n {\n name: 'secret',\n type: 'text',\n admin: {\n description: 'Secret key for webhook signature validation (optional but recommended)'\n }\n },\n {\n name: 'headers',\n type: 'json',\n admin: {\n description: 'Expected HTTP headers for validation (JSON object)'\n }\n }\n ])\n}\n\n/**\n * Create a scheduled/cron trigger with timing parameters pre-configured\n */\nexport function cronTrigger(slug: string): CustomTriggerConfig {\n return createTrigger(slug, [\n {\n name: 'expression',\n type: 'text',\n required: true,\n admin: {\n description: 'Cron expression for scheduling (e.g., \"0 9 * * 1\" for every Monday at 9 AM)',\n placeholder: '0 9 * * 1'\n }\n },\n {\n name: 'timezone',\n type: 'text',\n defaultValue: 'UTC',\n admin: {\n description: 'Timezone for cron execution (e.g., \"America/New_York\", \"Europe/London\")',\n placeholder: 'UTC'\n },\n validate: (value: any) => {\n if (value) {\n try {\n new Intl.DateTimeFormat('en', { timeZone: value as string })\n return true\n } catch {\n return `Invalid timezone: ${value}. Please use a valid IANA timezone identifier`\n }\n }\n return true\n }\n }\n ])\n}\n\n/**\n * Create an event-driven trigger with event filtering parameters\n */\nexport function eventTrigger(slug: string): CustomTriggerConfig {\n return createTrigger(slug, [\n {\n name: 'eventTypes',\n type: 'select',\n hasMany: true,\n options: [\n { label: 'User Created', value: 'user.created' },\n { label: 'User Updated', value: 'user.updated' },\n { label: 'Document Published', value: 'document.published' },\n { label: 'Payment Completed', value: 'payment.completed' }\n ],\n admin: {\n description: 'Event types that should trigger this workflow'\n }\n },\n {\n name: 'filters',\n type: 'json',\n admin: {\n description: 'JSON filters to apply to event data (e.g., {\"status\": \"active\"})'\n }\n }\n ])\n}\n\n/**\n * Create a simple manual trigger (no parameters needed)\n */\nexport function manualTrigger(slug: string): CustomTriggerConfig {\n return {\n slug,\n inputs: []\n }\n}\n\n/**\n * Create an API trigger for external systems to call\n */\nexport function apiTrigger(slug: string): CustomTriggerConfig {\n return createTrigger(slug, [\n {\n name: 'endpoint',\n type: 'text',\n required: true,\n admin: {\n description: 'API endpoint path (e.g., \"/api/triggers/my-trigger\")'\n }\n },\n {\n name: 'method',\n type: 'select',\n options: ['GET', 'POST', 'PUT', 'PATCH'],\n defaultValue: 'POST',\n admin: {\n description: 'HTTP method for the API endpoint'\n }\n },\n {\n name: 'authentication',\n type: 'select',\n options: [\n { label: 'None', value: 'none' },\n { label: 'API Key', value: 'api-key' },\n { label: 'Bearer Token', value: 'bearer' },\n { label: 'Basic Auth', value: 'basic' }\n ],\n defaultValue: 'api-key',\n admin: {\n description: 'Authentication method for the API endpoint'\n }\n }\n ])\n}"],"names":["createTrigger","webhookTrigger","slug","name","type","required","admin","description","validate","value","includes","cronTrigger","placeholder","defaultValue","Intl","DateTimeFormat","timeZone","eventTrigger","hasMany","options","label","manualTrigger","inputs","apiTrigger"],"mappings":"AAAA,SAASA,aAAa,QAAQ,uBAAsB;AAGpD;;CAEC,GAED;;CAEC,GACD,OAAO,SAASC,eAAeC,IAAY;IACzC,OAAOF,cAAcE,MAAM;QACzB;YACEC,MAAM;YACNC,MAAM;YACNC,UAAU;YACVC,OAAO;gBACLC,aAAa;YACf;YACAC,UAAU,CAACC;gBACT,IAAI,OAAOA,UAAU,YAAYA,MAAMC,QAAQ,CAAC,MAAM;oBACpD,OAAO;gBACT;gBACA,OAAO;YACT;QACF;QACA;YACEP,MAAM;YACNC,MAAM;YACNE,OAAO;gBACLC,aAAa;YACf;QACF;QACA;YACEJ,MAAM;YACNC,MAAM;YACNE,OAAO;gBACLC,aAAa;YACf;QACF;KACD;AACH;AAEA;;CAEC,GACD,OAAO,SAASI,YA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,aAAa;YACf;QACF;QACA;YACEJ,MAAM;YACNC,MAAM;YACNe,SAAS;gBACP;oBAAEC,OAAO;oBAAQX,OAAO;gBAAO;gBAC/B;oBAAEW,OAAO;oBAAWX,OAAO;gBAAU;gBACrC;oBAAEW,OAAO;oBAAgBX,OAAO;gBAAS;gBACzC;oBAAEW,OAAO;oBAAcX,OAAO;gBAAQ;aACvC;YACDI,cAAc;YACdP,OAAO;gBACLC,aAAa;YACf;QACF;KACD;AACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xtr-dev/payload-automation",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
4
4
|
"description": "PayloadCMS Automation Plugin - Comprehensive workflow automation system with visual workflow building, execution tracking, and step types",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|