-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(deps-dev): replace standard with neostandard
- Loading branch information
Showing
4 changed files
with
68 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,54 @@ | ||
import { FastifyPluginCallback } from 'fastify'; | ||
import { FastifyPluginCallback } from 'fastify' | ||
import { | ||
ConsumerGlobalConfig, | ||
ConsumerTopicConfig, | ||
KafkaConsumer, | ||
Message, | ||
MetadataOptions, | ||
Producer, | ||
ProducerGlobalConfig, | ||
ProducerTopicConfig | ||
} from 'node-rdkafka'; | ||
ConsumerGlobalConfig, | ||
ConsumerTopicConfig, | ||
KafkaConsumer, | ||
Message, | ||
MetadataOptions, | ||
Producer, | ||
ProducerGlobalConfig, | ||
ProducerTopicConfig | ||
} from 'node-rdkafka' | ||
|
||
declare module 'fastify' { | ||
interface FastifyKafkaMessage extends Pick<Message, 'topic' | 'partition' | 'key'> { | ||
payload: unknown; | ||
} | ||
|
||
interface FastifyKafkaProducer { | ||
producer: Producer; | ||
push(message: FastifyKafkaMessage): void; | ||
stop(done: () => void): void; | ||
} | ||
|
||
interface FastifyKafkaConsumer extends Pick<KafkaConsumer, 'consume' | 'subscribe'> { | ||
consumer: KafkaConsumer; | ||
stop(done: () => void): void; | ||
} | ||
|
||
interface Kafka extends Pick<FastifyKafkaProducer, 'push'>, Pick<FastifyKafkaConsumer, 'consume' | 'subscribe'> { | ||
producer?: FastifyKafkaProducer; | ||
consumer?: FastifyKafkaConsumer; | ||
} | ||
interface FastifyInstance { | ||
kafka: Kafka; | ||
} | ||
interface FastifyKafkaMessage extends Pick<Message, 'topic' | 'partition' | 'key'> { | ||
payload: unknown; | ||
} | ||
|
||
interface FastifyKafkaProducer { | ||
producer: Producer; | ||
push(message: FastifyKafkaMessage): void; | ||
stop(done: () => void): void; | ||
} | ||
|
||
interface FastifyKafkaConsumer extends Pick<KafkaConsumer, 'consume' | 'subscribe'> { | ||
consumer: KafkaConsumer; | ||
stop(done: () => void): void; | ||
} | ||
|
||
interface Kafka extends Pick<FastifyKafkaProducer, 'push'>, Pick<FastifyKafkaConsumer, 'consume' | 'subscribe'> { | ||
producer?: FastifyKafkaProducer; | ||
consumer?: FastifyKafkaConsumer; | ||
} | ||
interface FastifyInstance { | ||
kafka: Kafka; | ||
} | ||
} | ||
|
||
type FastifyKafka = FastifyPluginCallback<fastifyKafka.FastifyKafkaOptions>; | ||
type FastifyKafka = FastifyPluginCallback<fastifyKafka.FastifyKafkaOptions> | ||
|
||
declare namespace fastifyKafka { | ||
export interface FastifyKafkaOptions { | ||
producer?: ProducerGlobalConfig; | ||
consumer?: ConsumerGlobalConfig; | ||
producerTopicConf?: ProducerTopicConfig; | ||
consumerTopicConf?: ConsumerTopicConfig; | ||
metadataOptions?: MetadataOptions; | ||
} | ||
export interface FastifyKafkaOptions { | ||
producer?: ProducerGlobalConfig; | ||
consumer?: ConsumerGlobalConfig; | ||
producerTopicConf?: ProducerTopicConfig; | ||
consumerTopicConf?: ConsumerTopicConfig; | ||
metadataOptions?: MetadataOptions; | ||
} | ||
|
||
export const fastifyKafka: FastifyKafka | ||
export { fastifyKafka as default } | ||
} | ||
|
||
declare function fastifyKafka(...params: Parameters<FastifyKafka>): ReturnType<FastifyKafka> | ||
declare function fastifyKafka (...params: Parameters<FastifyKafka>): ReturnType<FastifyKafka> | ||
export = fastifyKafka |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters