@drarzter/kafka-client 0.2.1 → 0.2.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.
- package/dist/index.d.mts +27 -5
- package/dist/index.d.ts +27 -5
- package/dist/index.js +235 -292
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +235 -292
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -232,10 +232,6 @@ declare class KafkaClient<T extends TopicMapConstraint<T>> implements IKafkaClie
|
|
|
232
232
|
private isAdminConnected;
|
|
233
233
|
readonly clientId: ClientId;
|
|
234
234
|
constructor(clientId: ClientId, groupId: GroupId, brokers: string[], options?: KafkaClientOptions);
|
|
235
|
-
private getOrCreateConsumer;
|
|
236
|
-
private resolveTopicName;
|
|
237
|
-
private ensureTopic;
|
|
238
|
-
private validateMessage;
|
|
239
235
|
/** Send a single typed message. Accepts a topic key or a TopicDescriptor. */
|
|
240
236
|
sendMessage<D extends TopicDescriptor<string & keyof T, T[string & keyof T]>>(descriptor: D, message: D["__type"], options?: SendOptions): Promise<void>;
|
|
241
237
|
sendMessage<K extends keyof T>(topic: K, message: T[K], options?: SendOptions): Promise<void>;
|
|
@@ -269,8 +265,34 @@ declare class KafkaClient<T extends TopicMapConstraint<T>> implements IKafkaClie
|
|
|
269
265
|
getClientId(): ClientId;
|
|
270
266
|
/** Gracefully disconnect producer, all consumers, and admin. */
|
|
271
267
|
disconnect(): Promise<void>;
|
|
268
|
+
private getOrCreateConsumer;
|
|
269
|
+
private resolveTopicName;
|
|
270
|
+
private ensureTopic;
|
|
271
|
+
/** Register schema from descriptor into global registry (side-effect). */
|
|
272
|
+
private registerSchema;
|
|
273
|
+
/** Validate message against schema. Pure — no side-effects on registry. */
|
|
274
|
+
private validateMessage;
|
|
275
|
+
/**
|
|
276
|
+
* Build a kafkajs-ready send payload.
|
|
277
|
+
* Handles: topic resolution, schema registration, validation, JSON serialization.
|
|
278
|
+
*/
|
|
279
|
+
private buildSendPayload;
|
|
280
|
+
/** Shared consumer setup: groupId check, schema map, connect, subscribe. */
|
|
281
|
+
private setupConsumer;
|
|
272
282
|
private buildSchemaMap;
|
|
273
|
-
|
|
283
|
+
/** Parse raw message as JSON. Returns null on failure (logs error). */
|
|
284
|
+
private parseJsonMessage;
|
|
285
|
+
/**
|
|
286
|
+
* Validate a parsed message against the schema map.
|
|
287
|
+
* On failure: logs error, sends to DLQ if enabled, calls interceptor.onError.
|
|
288
|
+
* Returns validated message or null.
|
|
289
|
+
*/
|
|
290
|
+
private validateWithSchema;
|
|
291
|
+
/**
|
|
292
|
+
* Execute a handler with retry, interceptors, and DLQ support.
|
|
293
|
+
* Used by both single-message and batch consumers.
|
|
294
|
+
*/
|
|
295
|
+
private executeWithRetry;
|
|
274
296
|
private sendToDlq;
|
|
275
297
|
private subscribeWithRetry;
|
|
276
298
|
private sleep;
|
package/dist/index.d.ts
CHANGED
|
@@ -232,10 +232,6 @@ declare class KafkaClient<T extends TopicMapConstraint<T>> implements IKafkaClie
|
|
|
232
232
|
private isAdminConnected;
|
|
233
233
|
readonly clientId: ClientId;
|
|
234
234
|
constructor(clientId: ClientId, groupId: GroupId, brokers: string[], options?: KafkaClientOptions);
|
|
235
|
-
private getOrCreateConsumer;
|
|
236
|
-
private resolveTopicName;
|
|
237
|
-
private ensureTopic;
|
|
238
|
-
private validateMessage;
|
|
239
235
|
/** Send a single typed message. Accepts a topic key or a TopicDescriptor. */
|
|
240
236
|
sendMessage<D extends TopicDescriptor<string & keyof T, T[string & keyof T]>>(descriptor: D, message: D["__type"], options?: SendOptions): Promise<void>;
|
|
241
237
|
sendMessage<K extends keyof T>(topic: K, message: T[K], options?: SendOptions): Promise<void>;
|
|
@@ -269,8 +265,34 @@ declare class KafkaClient<T extends TopicMapConstraint<T>> implements IKafkaClie
|
|
|
269
265
|
getClientId(): ClientId;
|
|
270
266
|
/** Gracefully disconnect producer, all consumers, and admin. */
|
|
271
267
|
disconnect(): Promise<void>;
|
|
268
|
+
private getOrCreateConsumer;
|
|
269
|
+
private resolveTopicName;
|
|
270
|
+
private ensureTopic;
|
|
271
|
+
/** Register schema from descriptor into global registry (side-effect). */
|
|
272
|
+
private registerSchema;
|
|
273
|
+
/** Validate message against schema. Pure — no side-effects on registry. */
|
|
274
|
+
private validateMessage;
|
|
275
|
+
/**
|
|
276
|
+
* Build a kafkajs-ready send payload.
|
|
277
|
+
* Handles: topic resolution, schema registration, validation, JSON serialization.
|
|
278
|
+
*/
|
|
279
|
+
private buildSendPayload;
|
|
280
|
+
/** Shared consumer setup: groupId check, schema map, connect, subscribe. */
|
|
281
|
+
private setupConsumer;
|
|
272
282
|
private buildSchemaMap;
|
|
273
|
-
|
|
283
|
+
/** Parse raw message as JSON. Returns null on failure (logs error). */
|
|
284
|
+
private parseJsonMessage;
|
|
285
|
+
/**
|
|
286
|
+
* Validate a parsed message against the schema map.
|
|
287
|
+
* On failure: logs error, sends to DLQ if enabled, calls interceptor.onError.
|
|
288
|
+
* Returns validated message or null.
|
|
289
|
+
*/
|
|
290
|
+
private validateWithSchema;
|
|
291
|
+
/**
|
|
292
|
+
* Execute a handler with retry, interceptors, and DLQ support.
|
|
293
|
+
* Used by both single-message and batch consumers.
|
|
294
|
+
*/
|
|
295
|
+
private executeWithRetry;
|
|
274
296
|
private sendToDlq;
|
|
275
297
|
private subscribeWithRetry;
|
|
276
298
|
private sleep;
|