@coasy/piece-coasy 0.1.4 → 0.1.5
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.
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Coasy Piece for Activepieces
|
|
2
|
+
|
|
3
|
+
This is the Coasy integration piece for Activepieces, providing actions and triggers to interact with the Coasy platform for funnel and webinar management.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Coasy piece includes:
|
|
8
|
+
- **Actions**: Create funnel participants
|
|
9
|
+
- **Triggers**: New funnel participants, new webinar participants, new auth events
|
|
10
|
+
- **Authentication**: Custom auth with base URL and API key
|
|
11
|
+
|
|
12
|
+
## Development Setup
|
|
13
|
+
|
|
14
|
+
### Prerequisites
|
|
15
|
+
1. Clone the activepieces repository
|
|
16
|
+
2. Install dependencies: `npm install`
|
|
17
|
+
3. Ensure you're in the root directory of the activepieces monorepo
|
|
18
|
+
|
|
19
|
+
### Development Commands
|
|
20
|
+
|
|
21
|
+
#### Building the Piece
|
|
22
|
+
```bash
|
|
23
|
+
# Build the coasy piece specifically
|
|
24
|
+
nx build pieces-coasy
|
|
25
|
+
|
|
26
|
+
# Build with watch mode for development
|
|
27
|
+
nx build pieces-coasy --watch
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
#### Testing
|
|
31
|
+
```bash
|
|
32
|
+
# Run tests for the coasy piece
|
|
33
|
+
nx test pieces-coasy
|
|
34
|
+
|
|
35
|
+
# Run tests with watch mode
|
|
36
|
+
nx test pieces-coasy --watch
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
#### Linting
|
|
40
|
+
```bash
|
|
41
|
+
# Lint the coasy piece
|
|
42
|
+
nx lint pieces-coasy
|
|
43
|
+
|
|
44
|
+
# Auto-fix lint issues
|
|
45
|
+
nx lint pieces-coasy --fix
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Development Workflow
|
|
49
|
+
|
|
50
|
+
#### 1. Start Development Environment
|
|
51
|
+
```bash
|
|
52
|
+
# Start the full development environment (frontend + backend + engine + pieces)
|
|
53
|
+
npm run dev
|
|
54
|
+
|
|
55
|
+
# Or start just backend services if only testing the piece
|
|
56
|
+
npm run dev:backend
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### 2. Testing Your Changes
|
|
60
|
+
- Navigate to `http://localhost:4200` (frontend)
|
|
61
|
+
- Create a new flow and add Coasy actions/triggers
|
|
62
|
+
- Test authentication with your Coasy credentials
|
|
63
|
+
- Verify actions and triggers work as expected
|
|
64
|
+
|
|
65
|
+
#### 3. Adding New Features
|
|
66
|
+
|
|
67
|
+
**Adding a New Action:**
|
|
68
|
+
1. Create a new file in `src/lib/actions/`
|
|
69
|
+
2. Export the action from `src/index.ts`
|
|
70
|
+
3. Follow the existing patterns in `create-funnel-participant.ts`
|
|
71
|
+
|
|
72
|
+
**Adding a New Trigger:**
|
|
73
|
+
1. Create a new file in `src/lib/triggers/`
|
|
74
|
+
2. Export the trigger from `src/index.ts`
|
|
75
|
+
3. Follow the existing patterns in `new-funnel-participant.ts`
|
|
76
|
+
|
|
77
|
+
#### 4. File Structure
|
|
78
|
+
```
|
|
79
|
+
packages/pieces/community/coasy/
|
|
80
|
+
├── README.md # This file
|
|
81
|
+
├── package.json # Package configuration
|
|
82
|
+
├── project.json # Nx project configuration
|
|
83
|
+
├── tsconfig.json # TypeScript config
|
|
84
|
+
└── src/
|
|
85
|
+
├── index.ts # Main piece definition and exports
|
|
86
|
+
└── lib/
|
|
87
|
+
├── actions/ # Action implementations
|
|
88
|
+
├── triggers/ # Trigger implementations
|
|
89
|
+
└── common/ # Shared utilities
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Code Standards
|
|
93
|
+
|
|
94
|
+
### Authentication
|
|
95
|
+
The piece uses custom authentication with:
|
|
96
|
+
- `baseUrl`: Coasy instance base URL
|
|
97
|
+
- `apiKey`: API key for authentication
|
|
98
|
+
|
|
99
|
+
### Error Handling
|
|
100
|
+
- Use proper error messages for user-facing errors
|
|
101
|
+
- Handle API errors gracefully
|
|
102
|
+
- Validate inputs before making API calls
|
|
103
|
+
|
|
104
|
+
### Properties
|
|
105
|
+
- Use descriptive `displayName` and `description` for all properties
|
|
106
|
+
- Mark required fields appropriately
|
|
107
|
+
- Use proper property types from `@activepieces/pieces-framework`
|
|
108
|
+
|
|
109
|
+
## Testing in Activepieces
|
|
110
|
+
|
|
111
|
+
1. **Authentication Testing**:
|
|
112
|
+
- Verify connection works with valid credentials
|
|
113
|
+
- Test error handling with invalid credentials
|
|
114
|
+
|
|
115
|
+
2. **Action Testing**:
|
|
116
|
+
- Test with valid inputs
|
|
117
|
+
- Test error scenarios
|
|
118
|
+
- Verify data transformation
|
|
119
|
+
|
|
120
|
+
3. **Trigger Testing**:
|
|
121
|
+
- Set up webhooks/polling as needed
|
|
122
|
+
- Test trigger conditions
|
|
123
|
+
- Verify payload structure
|
|
124
|
+
|
|
125
|
+
## Publishing
|
|
126
|
+
|
|
127
|
+
The piece is published as `@coasy/piece-coasy` to npm. Version is currently `0.0.12`.
|
|
128
|
+
|
|
129
|
+
To publish a new version:
|
|
130
|
+
1. Navigate to the coasy piece directory:
|
|
131
|
+
```bash
|
|
132
|
+
cd packages/pieces/community/coasy
|
|
133
|
+
```
|
|
134
|
+
2. Update the `version` in `package.json` (e.g., from `0.0.11` to `0.0.12`)
|
|
135
|
+
3. Publish directly to npm:
|
|
136
|
+
```bash
|
|
137
|
+
npm publish
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Note**: The monorepo's `npm run publish-piece` script currently has dependency resolution issues. Use the direct `npm publish` method above instead.
|
|
141
|
+
|
|
142
|
+
## Resources
|
|
143
|
+
|
|
144
|
+
- [Activepieces Documentation](https://www.activepieces.com/docs)
|
|
145
|
+
- [Pieces Framework Reference](https://www.activepieces.com/docs/developers/piece-reference/properties)
|
|
146
|
+
- [Piece Development Guide](https://www.activepieces.com/docs/developers/building-pieces/create-action)
|
package/package.json
CHANGED