n8n-nodes-base 2.7.0 → 2.7.2

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,323 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createConfig = createConfig;
4
+ exports.createConsumerConfig = createConsumerConfig;
5
+ exports.configureMessageParser = configureMessageParser;
6
+ exports.connectEventListeners = connectEventListeners;
7
+ exports.disconnectEventListeners = disconnectEventListeners;
8
+ exports.setSchemaRegistry = setSchemaRegistry;
9
+ exports.configureDataEmitter = configureDataEmitter;
10
+ exports.getAutoCommitSettings = getAutoCommitSettings;
11
+ exports.runWithHeartbeat = runWithHeartbeat;
12
+ const kafkajs_1 = require("kafkajs");
13
+ const confluent_schema_registry_1 = require("@kafkajs/confluent-schema-registry");
14
+ const n8n_workflow_1 = require("n8n-workflow");
15
+ // Default delay in milliseconds before retrying after a failed offset resolution.
16
+ // This prevents rapid retry loops that could overwhelm the Kafka broker
17
+ const DEFAULT_ERROR_RETRY_DELAY_MS = 5000;
18
+ /**
19
+ * Creates Kafka client configuration from n8n credentials
20
+ * @param ctx - The trigger function context
21
+ * @returns Kafka configuration object with authentication settings
22
+ */
23
+ async function createConfig(ctx) {
24
+ const credentials = (await ctx.getCredentials('kafka'));
25
+ const clientId = credentials.clientId;
26
+ const brokers = (credentials.brokers ?? '').split(',').map((item) => item.trim());
27
+ const ssl = credentials.ssl;
28
+ const config = {
29
+ clientId,
30
+ brokers,
31
+ ssl,
32
+ logLevel: kafkajs_1.logLevel.ERROR,
33
+ };
34
+ if (credentials.authentication) {
35
+ if (!(credentials.username && credentials.password)) {
36
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), 'Username and password are required for authentication');
37
+ }
38
+ config.sasl = {
39
+ username: credentials.username,
40
+ password: credentials.password,
41
+ mechanism: credentials.saslMechanism,
42
+ };
43
+ }
44
+ return config;
45
+ }
46
+ /**
47
+ * Creates Kafka consumer configuration with session timeout and heartbeat settings
48
+ * @param ctx - The trigger function context
49
+ * @param options - Kafka trigger options from node parameters
50
+ * @param nodeVersion - The version of the Kafka trigger node
51
+ * @returns Consumer configuration object
52
+ */
53
+ function createConsumerConfig(ctx, options, nodeVersion) {
54
+ const groupId = ctx.getNodeParameter('groupId');
55
+ const maxInFlightRequests = (ctx.getNodeParameter('options.maxInFlightRequests', null) === 0
56
+ ? null
57
+ : ctx.getNodeParameter('options.maxInFlightRequests', null));
58
+ const sessionTimeout = options.sessionTimeout ?? 30000;
59
+ let heartbeatInterval;
60
+ if (nodeVersion < 1.3) {
61
+ heartbeatInterval = options.heartbeatInterval ?? 3000;
62
+ }
63
+ else {
64
+ heartbeatInterval = options.heartbeatInterval ?? 10000;
65
+ }
66
+ const rebalanceTimeout = options.rebalanceTimeout ?? 600000;
67
+ const maxBytesPerPartition = options.fetchMaxBytes;
68
+ const minBytes = options.fetchMinBytes;
69
+ const consumerConfig = {
70
+ groupId,
71
+ maxInFlightRequests,
72
+ sessionTimeout,
73
+ heartbeatInterval,
74
+ rebalanceTimeout,
75
+ };
76
+ if (maxBytesPerPartition !== undefined) {
77
+ consumerConfig.maxBytesPerPartition = maxBytesPerPartition;
78
+ }
79
+ if (minBytes !== undefined) {
80
+ consumerConfig.minBytes = minBytes;
81
+ }
82
+ return consumerConfig;
83
+ }
84
+ /**
85
+ * Configures a message parser function that processes Kafka messages based on node options
86
+ * @param options - Kafka trigger options for parsing behavior
87
+ * @param logger - Logger instance for warnings
88
+ * @param registry - Optional schema registry for message decoding
89
+ * @param prepareBinaryData - Helper function to prepare binary data
90
+ * @returns Async function that parses Kafka messages into n8n execution data
91
+ */
92
+ function configureMessageParser(options, logger, registry, prepareBinaryData) {
93
+ return async (message, messageTopic) => {
94
+ let data = {};
95
+ let value = message.value?.toString();
96
+ const binary = {};
97
+ if (options.jsonParseMessage) {
98
+ try {
99
+ value = (0, n8n_workflow_1.jsonParse)(value);
100
+ }
101
+ catch (error) {
102
+ logger.warn('Could not parse message to JSON, returning as string', { error });
103
+ }
104
+ }
105
+ if (registry) {
106
+ try {
107
+ value = await registry.decode(message.value);
108
+ }
109
+ catch (error) {
110
+ logger.warn('Could not decode message with Schema Registry, returning original message', {
111
+ error,
112
+ });
113
+ }
114
+ }
115
+ // Preserve raw binary data for downstream processing (only in v1.2+)
116
+ if (options.keepBinaryData && message.value) {
117
+ const binaryData = await prepareBinaryData(message.value, 'message', 'application/octet-stream');
118
+ binary.data = binaryData;
119
+ }
120
+ if (options.returnHeaders && message.headers) {
121
+ data.headers = Object.fromEntries(Object.entries(message.headers).map(([headerKey, headerValue]) => [
122
+ headerKey,
123
+ headerValue?.toString('utf8') ?? '',
124
+ ]));
125
+ }
126
+ data.message = value;
127
+ data.topic = messageTopic;
128
+ if (options.onlyMessage) {
129
+ data = value;
130
+ }
131
+ if (options.keepBinaryData && Object.keys(binary).length) {
132
+ return { json: data, binary };
133
+ }
134
+ return { json: data };
135
+ };
136
+ }
137
+ /**
138
+ * Attaches event listeners to the Kafka consumer for monitoring and logging
139
+ * @param consumer - The Kafka consumer instance
140
+ * @param logger - Logger instance for event logging
141
+ * @returns Array of listener removal functions
142
+ */
143
+ function connectEventListeners(consumer, logger) {
144
+ const onConnected = consumer.on(consumer.events.CONNECT, () => {
145
+ logger.debug('Kafka consumer connected');
146
+ });
147
+ const onGroupJoin = consumer.on(consumer.events.GROUP_JOIN, () => {
148
+ logger.debug('Consumer has joined the group');
149
+ });
150
+ const onRequestTimeout = consumer.on(consumer.events.REQUEST_TIMEOUT, () => {
151
+ logger.error('Consumer request timed out');
152
+ });
153
+ const onUnsubscribedtopicsReceived = consumer.on(consumer.events.RECEIVED_UNSUBSCRIBED_TOPICS, () => {
154
+ logger.warn('Consumer received messages for unsubscribed topics');
155
+ });
156
+ const onStop = consumer.on(consumer.events.STOP, async (error) => {
157
+ logger.error('Consumer has stopped', { error });
158
+ });
159
+ const onDisconnect = consumer.on(consumer.events.DISCONNECT, async (error) => {
160
+ logger.error('Consumer has disconnected', { error });
161
+ });
162
+ const onCommitOffsets = consumer.on(consumer.events.COMMIT_OFFSETS, () => {
163
+ logger.debug('Consumer offsets committed!');
164
+ });
165
+ const onRebalancing = consumer.on(consumer.events.REBALANCING, (payload) => {
166
+ logger.debug('Consumer is rebalancing', { payload });
167
+ });
168
+ const onCrash = consumer.on(consumer.events.CRASH, async (error) => {
169
+ logger.error('Consumer has crashed', { error });
170
+ });
171
+ return [
172
+ onConnected,
173
+ onGroupJoin,
174
+ onRequestTimeout,
175
+ onUnsubscribedtopicsReceived,
176
+ onStop,
177
+ onDisconnect,
178
+ onCommitOffsets,
179
+ onRebalancing,
180
+ onCrash,
181
+ ];
182
+ }
183
+ /**
184
+ * Removes all event listeners from the Kafka consumer
185
+ * @param listeners - Array of listener removal functions
186
+ */
187
+ function disconnectEventListeners(listeners) {
188
+ listeners.forEach((listener) => listener());
189
+ }
190
+ /**
191
+ * Initializes Confluent Schema Registry if enabled in node parameters
192
+ * @param ctx - The trigger function context
193
+ * @returns Schema registry instance or undefined if not configured
194
+ */
195
+ function setSchemaRegistry(ctx) {
196
+ const useSchemaRegistry = ctx.getNodeParameter('useSchemaRegistry', 0);
197
+ if (useSchemaRegistry) {
198
+ try {
199
+ const schemaRegistryUrl = ctx.getNodeParameter('schemaRegistryUrl', 0);
200
+ return new confluent_schema_registry_1.SchemaRegistry({ host: schemaRegistryUrl });
201
+ }
202
+ catch (error) {
203
+ ctx.logger.warn('Could not connect to Schema Registry', { error });
204
+ }
205
+ }
206
+ return undefined;
207
+ }
208
+ /**
209
+ * Determines the offset resolution mode based on node version and configuration
210
+ * @param ctx - The trigger function context
211
+ * @param options - Kafka trigger options
212
+ * @param nodeVersion - The version of the Kafka trigger node
213
+ * @returns The offset resolution mode
214
+ */
215
+ function getResolveOffsetMode(ctx, options, nodeVersion) {
216
+ if (nodeVersion === 1)
217
+ return 'immediately';
218
+ if (nodeVersion === 1.1) {
219
+ if (options.parallelProcessing)
220
+ return 'immediately';
221
+ return 'onCompletion';
222
+ }
223
+ return ctx.getNodeParameter('resolveOffset', 'immediately');
224
+ }
225
+ /**
226
+ * Configures a data emitter function that handles workflow execution and offset resolution
227
+ * @param ctx - The trigger function context
228
+ * @param options - Kafka trigger options
229
+ * @param nodeVersion - The version of the Kafka trigger node
230
+ * @returns Async function that emits data and waits for execution completion based on resolve mode
231
+ */
232
+ function configureDataEmitter(ctx, options, nodeVersion) {
233
+ const resolveOffsetMode = getResolveOffsetMode(ctx, options, nodeVersion);
234
+ // For manual mode, always use immediate emit (no donePromise)
235
+ if (ctx.getMode() === 'manual' || resolveOffsetMode === 'immediately') {
236
+ return async (dataArray) => {
237
+ ctx.emit([dataArray]);
238
+ return { success: true };
239
+ };
240
+ }
241
+ const executionTimeoutInSeconds = ctx.getWorkflowSettings().executionTimeout ?? 3600;
242
+ const errorRetryDelay = options.errorRetryDelay ?? DEFAULT_ERROR_RETRY_DELAY_MS;
243
+ const allowedStatuses = [];
244
+ if (resolveOffsetMode === 'onSuccess') {
245
+ allowedStatuses.push('success');
246
+ }
247
+ else if (resolveOffsetMode === 'onStatus') {
248
+ const selectedStatuses = ctx.getNodeParameter('allowedStatuses', []);
249
+ if (Array.isArray(selectedStatuses) && selectedStatuses.length) {
250
+ allowedStatuses.push(...selectedStatuses);
251
+ }
252
+ else {
253
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), 'At least one execution status must be selected to resolve offsets on selected statuses.');
254
+ }
255
+ }
256
+ return async (dataArray) => {
257
+ let timeoutId;
258
+ try {
259
+ const responsePromise = ctx.helpers.createDeferredPromise();
260
+ ctx.emit([dataArray], undefined, responsePromise);
261
+ const timeoutPromise = new Promise((_, reject) => {
262
+ timeoutId = setTimeout(() => {
263
+ reject(new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Execution took longer than the configured workflow timeout of ${executionTimeoutInSeconds} seconds to complete, offsets not resolved.`));
264
+ }, executionTimeoutInSeconds * 1000);
265
+ });
266
+ const run = await Promise.race([responsePromise.promise, timeoutPromise]);
267
+ if (resolveOffsetMode !== 'onCompletion' && !allowedStatuses.includes(run.status)) {
268
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), 'Execution status is not allowed for resolving offsets, current status: ' + run.status);
269
+ }
270
+ return { success: true };
271
+ }
272
+ catch (e) {
273
+ await (0, n8n_workflow_1.sleep)(errorRetryDelay);
274
+ const error = (0, n8n_workflow_1.ensureError)(e);
275
+ ctx.logger.error(error.message, { error });
276
+ return { success: false };
277
+ }
278
+ finally {
279
+ if (timeoutId)
280
+ clearTimeout(timeoutId);
281
+ }
282
+ };
283
+ }
284
+ /**
285
+ * Determines auto-commit settings based on node's optons
286
+ * @param options - Kafka trigger options
287
+ * @returns Object with auto-commit configuration
288
+ */
289
+ function getAutoCommitSettings(options) {
290
+ const eachBatchAutoResolve = options.eachBatchAutoResolve ?? false;
291
+ const autoCommitInterval = options.autoCommitInterval ?? undefined;
292
+ const autoCommitThreshold = options.autoCommitThreshold ?? undefined;
293
+ return {
294
+ autoCommit: true,
295
+ eachBatchAutoResolve,
296
+ autoCommitInterval,
297
+ autoCommitThreshold,
298
+ };
299
+ }
300
+ /**
301
+ * Runs a task while periodically invoking a heartbeat function
302
+ * at specified intervals to prevent session timeout
303
+ * @param task - The promise to execute
304
+ * @param heartbeat - The heartbeat function to call periodically
305
+ * @param intervalMs - The interval in milliseconds between heartbeat calls (default: 3000)
306
+ * @returns The result of the task promise
307
+ */
308
+ async function runWithHeartbeat(task, heartbeat, intervalMs = 3000) {
309
+ let timer;
310
+ try {
311
+ timer = setInterval(async () => {
312
+ try {
313
+ await heartbeat();
314
+ }
315
+ catch (error) { }
316
+ }, intervalMs);
317
+ return await task;
318
+ }
319
+ finally {
320
+ clearInterval(timer);
321
+ }
322
+ }
323
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../nodes/Kafka/utils.ts"],"names":[],"mappings":";;AAgEA,oCA4B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