n8n-nodes-kafka-batch-consumer 1.0.10 → 1.0.12

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/QUICK_START.md DELETED
@@ -1,181 +0,0 @@
1
- # Quick Start Guide
2
-
3
- ## Installation & Testing
4
-
5
- ```bash
6
- # Install dependencies
7
- npm install
8
-
9
- # Run all tests
10
- npm test
11
-
12
- # Run tests with coverage
13
- npm run test:coverage
14
-
15
- # Build the project
16
- npm run build
17
-
18
- # Lint the code
19
- npm run lint
20
-
21
- # Or use the test runner script
22
- ./run-tests.sh
23
- ```
24
-
25
- ## Test Suite Summary
26
-
27
- ### 32 Comprehensive Tests
28
-
29
- #### ✅ Node Description (3 tests)
30
- - Node properties validation
31
- - Credentials configuration
32
- - Parameters validation
33
-
34
- #### ✅ Credentials Handling (8 tests)
35
- - Unauthenticated connections
36
- - SASL PLAIN authentication
37
- - SASL SCRAM-SHA-256 authentication
38
- - SASL SCRAM-SHA-512 authentication
39
- - SSL/TLS configuration
40
- - Combined SASL + SSL
41
- - SSL rejectUnauthorized handling
42
- - Auth config validation
43
-
44
- #### ✅ Connection Handling (3 tests)
45
- - Successful broker connections
46
- - Connection error handling
47
- - Broker list parsing
48
-
49
- #### ✅ Topic Subscription (2 tests)
50
- - fromBeginning flag handling
51
- - Subscription error handling
52
-
53
- #### ✅ Message Collection (4 tests)
54
- - Exact batch size collection
55
- - Batch size limit enforcement
56
- - Complete metadata handling
57
- - Missing field handling
58
-
59
- #### ✅ JSON Parsing (3 tests)
60
- - Valid JSON parsing
61
- - String preservation
62
- - Invalid JSON handling
63
-
64
- #### ✅ Timeout Handling (3 tests)
65
- - Timeout with insufficient messages
66
- - Partial batch collection
67
- - Custom readTimeout
68
-
69
- #### ✅ Error Handling (4 tests)
70
- - Consumer disconnect on errors
71
- - NodeOperationError wrapping
72
- - Resource cleanup
73
- - Disconnect error handling
74
-
75
- #### ✅ Output Format (4 tests)
76
- - INodeExecutionData format
77
- - Complete field inclusion
78
- - Null key handling
79
- - Empty value handling
80
-
81
- #### ✅ Integration (1 test)
82
- - Complete workflow simulation
83
-
84
- ## Key Files
85
-
86
- | File | Description |
87
- |------|-------------|
88
- | `src/nodes/KafkaBatchConsumer/KafkaBatchConsumer.node.ts` | Main node implementation |
89
- | `src/nodes/KafkaBatchConsumer/KafkaBatchConsumer.node.test.ts` | Complete test suite |
90
- | `package.json` | Dependencies and scripts |
91
- | `jest.config.js` | Test configuration (80% coverage threshold) |
92
- | `README.md` | Full documentation |
93
- | `PROJECT_STRUCTURE.md` | Detailed project overview |
94
-
95
- ## Coverage Requirements
96
-
97
- Minimum 80% for all metrics:
98
- - ✅ Branches: 80%+
99
- - ✅ Functions: 80%+
100
- - ✅ Lines: 80%+
101
- - ✅ Statements: 80%+
102
-
103
- ## Node Features
104
-
105
- ### Parameters
106
- - **brokers**: Kafka broker addresses
107
- - **clientId**: Client identifier
108
- - **groupId**: Consumer group ID
109
- - **topic**: Topic to consume from
110
- - **batchSize**: Messages per batch
111
- - **fromBeginning**: Read from start
112
- - **sessionTimeout**: Session timeout (ms)
113
- - **options.readTimeout**: Max wait time (ms)
114
- - **options.parseJson**: Auto-parse JSON
115
-
116
- ### Credentials (Optional)
117
- - **SASL**: plain, scram-sha-256, scram-sha-512
118
- - **SSL**: TLS with certificates
119
- - **Combined**: SASL + SSL
120
-
121
- ### Output Format
122
- ```typescript
123
- {
124
- json: {
125
- topic: string,
126
- partition: number,
127
- offset: string,
128
- key: string | null,
129
- value: any,
130
- timestamp: string,
131
- headers: Record<string, any>
132
- }
133
- }
134
- ```
135
-
136
- ## Testing Tips
137
-
138
- ### Run specific test
139
- ```bash
140
- npm test -- -t "should connect with SASL PLAIN"
141
- ```
142
-
143
- ### Watch mode
144
- ```bash
145
- npm test -- --watch
146
- ```
147
-
148
- ### Debug mode
149
- ```bash
150
- node --inspect-brk node_modules/.bin/jest --runInBand
151
- ```
152
-
153
- ### Update snapshots (if any)
154
- ```bash
155
- npm test -- -u
156
- ```
157
-
158
- ## Common Issues
159
-
160
- ### TypeScript errors before npm install
161
- **Expected** - Dependencies need to be installed first.
162
-
163
- ### Coverage below 80%
164
- Review untested code paths and add missing test cases.
165
-
166
- ### Mock not working
167
- Ensure `jest.clearAllMocks()` is called in `beforeEach()`.
168
-
169
- ## Next Steps
170
-
171
- 1. ✅ Project created with all files
172
- 2. ⏳ Run `npm install`
173
- 3. ⏳ Run `npm run test:coverage`
174
- 4. ⏳ Verify 80%+ coverage
175
- 5. ⏳ Build with `npm run build`
176
- 6. ⏳ Test in N8N environment
177
-
178
- ## Questions?
179
-
180
- See [README.md](README.md) for full documentation.
181
- See [PROJECT_STRUCTURE.md](PROJECT_STRUCTURE.md) for detailed structure.
package/jest.config.js DELETED
@@ -1,22 +0,0 @@
1
- module.exports = {
2
- preset: 'ts-jest',
3
- testEnvironment: 'node',
4
- roots: ['<rootDir>/src'],
5
- testMatch: ['**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts'],
6
- collectCoverageFrom: [
7
- 'src/**/*.ts',
8
- '!src/**/*.test.ts',
9
- '!src/**/*.spec.ts',
10
- '!src/**/index.ts'
11
- ],
12
- coverageThreshold: {
13
- global: {
14
- branches: 80,
15
- functions: 80,
16
- lines: 80,
17
- statements: 80
18
- }
19
- },
20
- coverageDirectory: 'coverage',
21
- verbose: true
22
- };
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './nodes/KafkaBatchConsumer/KafkaBatchConsumer.node';