@xtr-dev/payload-automation 0.0.9 → 0.0.10
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 +24 -4
- package/dist/exports/server.d.ts +5 -0
- package/dist/exports/server.js +11 -0
- package/dist/exports/server.js.map +1 -0
- package/dist/index.d.ts +0 -4
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/dist/test/basic.test.d.ts +1 -0
- package/dist/test/basic.test.js +14 -0
- package/dist/test/basic.test.js.map +1 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -27,20 +27,40 @@ yarn add @xtr-dev/payload-automation
|
|
|
27
27
|
|
|
28
28
|
```typescript
|
|
29
29
|
import { buildConfig } from 'payload'
|
|
30
|
-
import {
|
|
30
|
+
import { workflowsPlugin } from '@xtr-dev/payload-automation/server'
|
|
31
31
|
|
|
32
32
|
export default buildConfig({
|
|
33
33
|
// ... your config
|
|
34
34
|
plugins: [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
workflowsPlugin({
|
|
36
|
+
collectionTriggers: {
|
|
37
|
+
posts: true, // Enable all CRUD triggers for posts
|
|
38
|
+
users: {
|
|
39
|
+
create: true, // Only enable create trigger for users
|
|
40
|
+
update: true
|
|
41
|
+
}
|
|
42
|
+
},
|
|
38
43
|
enabled: true,
|
|
39
44
|
}),
|
|
40
45
|
],
|
|
41
46
|
})
|
|
42
47
|
```
|
|
43
48
|
|
|
49
|
+
## Import Structure
|
|
50
|
+
|
|
51
|
+
The plugin uses separate exports to avoid bundling server-side code in client bundles:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
// Server-side plugin and functions
|
|
55
|
+
import { workflowsPlugin } from '@xtr-dev/payload-automation/server'
|
|
56
|
+
|
|
57
|
+
// Client-side components
|
|
58
|
+
import { TriggerWorkflowButton } from '@xtr-dev/payload-automation/client'
|
|
59
|
+
|
|
60
|
+
// Types only (safe for both server and client)
|
|
61
|
+
import type { WorkflowsPluginConfig } from '@xtr-dev/payload-automation'
|
|
62
|
+
```
|
|
63
|
+
|
|
44
64
|
## Step Types
|
|
45
65
|
|
|
46
66
|
- **HTTP Request** - Make external API calls
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { triggerCustomWorkflow, triggerWorkflowById } from '../core/trigger-custom-workflow.js';
|
|
2
|
+
export { WorkflowExecutor } from '../core/workflow-executor.js';
|
|
3
|
+
export { workflowsPlugin } from '../plugin/index.js';
|
|
4
|
+
export { createDocumentHandler, deleteDocumentHandler, httpStepHandler, readDocumentHandler, sendEmailHandler, updateDocumentHandler } from '../steps/index.js';
|
|
5
|
+
export { CreateDocumentStepTask, DeleteDocumentStepTask, HttpRequestStepTask, ReadDocumentStepTask, SendEmailStepTask, UpdateDocumentStepTask } from '../steps/index.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Server-side only exports - should never be bundled for client
|
|
2
|
+
// These contain Node.js dependencies and should only be used server-side
|
|
3
|
+
export { triggerCustomWorkflow, triggerWorkflowById } from '../core/trigger-custom-workflow.js';
|
|
4
|
+
export { WorkflowExecutor } from '../core/workflow-executor.js';
|
|
5
|
+
export { workflowsPlugin } from '../plugin/index.js';
|
|
6
|
+
// Export all step handlers (server-side only)
|
|
7
|
+
export { createDocumentHandler, deleteDocumentHandler, httpStepHandler, readDocumentHandler, sendEmailHandler, updateDocumentHandler } from '../steps/index.js';
|
|
8
|
+
// Export step tasks configurations (server-side only)
|
|
9
|
+
export { CreateDocumentStepTask, DeleteDocumentStepTask, HttpRequestStepTask, ReadDocumentStepTask, SendEmailStepTask, UpdateDocumentStepTask } from '../steps/index.js';
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/exports/server.ts"],"sourcesContent":["// Server-side only exports - should never be bundled for client\n// These contain Node.js dependencies and should only be used server-side\n\nexport { triggerCustomWorkflow, triggerWorkflowById } from '../core/trigger-custom-workflow.js'\nexport { WorkflowExecutor } from '../core/workflow-executor.js'\nexport { workflowsPlugin } from '../plugin/index.js'\n\n// Export all step handlers (server-side only)\nexport {\n createDocumentHandler,\n deleteDocumentHandler,\n httpStepHandler,\n readDocumentHandler,\n sendEmailHandler,\n updateDocumentHandler\n} from '../steps/index.js'\n\n// Export step tasks configurations (server-side only)\nexport {\n CreateDocumentStepTask,\n DeleteDocumentStepTask,\n HttpRequestStepTask,\n ReadDocumentStepTask,\n SendEmailStepTask,\n UpdateDocumentStepTask\n} from '../steps/index.js'"],"names":["triggerCustomWorkflow","triggerWorkflowById","WorkflowExecutor","workflowsPlugin","createDocumentHandler","deleteDocumentHandler","httpStepHandler","readDocumentHandler","sendEmailHandler","updateDocumentHandler","CreateDocumentStepTask","DeleteDocumentStepTask","HttpRequestStepTask","ReadDocumentStepTask","SendEmailStepTask","UpdateDocumentStepTask"],"mappings":"AAAA,gEAAgE;AAChE,yEAAyE;AAEzE,SAASA,qBAAqB,EAAEC,mBAAmB,QAAQ,qCAAoC;AAC/F,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,eAAe,QAAQ,qBAAoB;AAEpD,8CAA8C;AAC9C,SACEC,qBAAqB,EACrBC,qBAAqB,EACrBC,eAAe,EACfC,mBAAmB,EACnBC,gBAAgB,EAChBC,qBAAqB,QAChB,oBAAmB;AAE1B,sDAAsD;AACtD,SACEC,sBAAsB,EACtBC,sBAAsB,EACtBC,mBAAmB,EACnBC,oBAAoB,EACpBC,iBAAiB,EACjBC,sBAAsB,QACjB,oBAAmB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
export { triggerCustomWorkflow, triggerWorkflowById } from './core/trigger-custom-workflow.js';
|
|
2
1
|
export type { CustomTriggerOptions, TriggerResult } from './core/trigger-custom-workflow.js';
|
|
3
|
-
export { WorkflowExecutor } from './core/workflow-executor.js';
|
|
4
2
|
export type { ExecutionContext, Workflow, WorkflowStep, WorkflowTrigger } from './core/workflow-executor.js';
|
|
5
3
|
export type { WorkflowsPluginConfig } from './plugin/config-types.js';
|
|
6
|
-
export { workflowsPlugin } from './plugin/index.js';
|
|
7
|
-
export { CreateDocumentStepTask, DeleteDocumentStepTask, HttpRequestStepTask, ReadDocumentStepTask, SendEmailStepTask, UpdateDocumentStepTask } from './steps/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
//
|
|
5
|
-
|
|
6
|
-
//
|
|
1
|
+
// Main export contains only types and client-safe utilities
|
|
2
|
+
// Server-side functions are exported via '@xtr-dev/payload-automation/server'
|
|
3
|
+
// Types only - safe for client bundling
|
|
4
|
+
export { }; // Server-side functions are NOT re-exported here to avoid bundling issues
|
|
5
|
+
// Import server-side functions from the /server export instead
|
|
6
|
+
// Server functions and plugin should be imported from '/server':
|
|
7
|
+
// import { workflowsPlugin } from '@xtr-dev/payload-automation/server'
|
|
8
|
+
// UI components should be imported from '/client':
|
|
9
|
+
// import { TriggerWorkflowButton } from '@xtr-dev/payload-automation/client'
|
|
7
10
|
|
|
8
11
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Main export contains only types and client-safe utilities\n// Server-side functions are exported via '@xtr-dev/payload-automation/server'\n\n// Types only - safe for client bundling\nexport type { CustomTriggerOptions, TriggerResult } from './core/trigger-custom-workflow.js'\nexport type { ExecutionContext, Workflow, WorkflowStep, WorkflowTrigger } from './core/workflow-executor.js'\nexport type { WorkflowsPluginConfig } from './plugin/config-types.js'\n\n// Server-side functions are NOT re-exported here to avoid bundling issues\n// Import server-side functions from the /server export instead\n\n// Server functions and plugin should be imported from '/server':\n// import { workflowsPlugin } from '@xtr-dev/payload-automation/server'\n// UI components should be imported from '/client':\n// import { TriggerWorkflowButton } from '@xtr-dev/payload-automation/client'\n"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,8EAA8E;AAE9E,wCAAwC;AAGxC,WAAqE,CAErE,0EAA0E;CAC1E,+DAA+D;CAE/D,iEAAiE;CACjE,uEAAuE;CACvE,mDAAmD;CACnD,6EAA6E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
describe('PayloadCMS Automation Plugin', ()=>{
|
|
3
|
+
it('should export the plugin function from server export', async ()=>{
|
|
4
|
+
const { workflowsPlugin } = await import('../exports/server.js');
|
|
5
|
+
expect(workflowsPlugin).toBeDefined();
|
|
6
|
+
expect(typeof workflowsPlugin).toBe('function');
|
|
7
|
+
});
|
|
8
|
+
it('should have the correct package name', async ()=>{
|
|
9
|
+
// Basic test to ensure the plugin can be imported
|
|
10
|
+
expect(true).toBe(true);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=basic.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/test/basic.test.ts"],"sourcesContent":["import { describe, it, expect } from 'vitest'\n\ndescribe('PayloadCMS Automation Plugin', () => {\n it('should export the plugin function from server export', async () => {\n const { workflowsPlugin } = await import('../exports/server.js')\n expect(workflowsPlugin).toBeDefined()\n expect(typeof workflowsPlugin).toBe('function')\n })\n\n it('should have the correct package name', async () => {\n // Basic test to ensure the plugin can be imported\n expect(true).toBe(true)\n })\n})"],"names":["describe","it","expect","workflowsPlugin","toBeDefined","toBe"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,EAAE,EAAEC,MAAM,QAAQ,SAAQ;AAE7CF,SAAS,gCAAgC;IACvCC,GAAG,wDAAwD;QACzD,MAAM,EAAEE,eAAe,EAAE,GAAG,MAAM,MAAM,CAAC;QACzCD,OAAOC,iBAAiBC,WAAW;QACnCF,OAAO,OAAOC,iBAAiBE,IAAI,CAAC;IACtC;IAEAJ,GAAG,wCAAwC;QACzC,kDAAkD;QAClDC,OAAO,MAAMG,IAAI,CAAC;IACpB;AACF"}
|
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.10",
|
|
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",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"types": "./dist/exports/views.d.ts",
|
|
31
31
|
"default": "./dist/exports/views.js"
|
|
32
32
|
},
|
|
33
|
-
"./
|
|
34
|
-
"import": "./dist/
|
|
35
|
-
"types": "./dist/
|
|
36
|
-
"default": "./dist/
|
|
33
|
+
"./server": {
|
|
34
|
+
"import": "./dist/exports/server.js",
|
|
35
|
+
"types": "./dist/exports/server.d.ts",
|
|
36
|
+
"default": "./dist/exports/server.js"
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"main": "dist/index.js",
|