@infineit-nestjs/core 1.0.15 → 1.0.16

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.
@@ -4,3 +4,4 @@ export * from './errors';
4
4
  export * from './exceptions';
5
5
  export * from './filters';
6
6
  export * from './validators';
7
+ export * from './kafka';
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const r=require("tslib");r.__exportStar(require("./constants"),exports),r.__exportStar(require("./decorators"),exports),r.__exportStar(require("./errors"),exports),r.__exportStar(require("./exceptions"),exports),r.__exportStar(require("./filters"),exports),r.__exportStar(require("./validators"),exports);
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const r=require("tslib");r.__exportStar(require("./constants"),exports),r.__exportStar(require("./decorators"),exports),r.__exportStar(require("./errors"),exports),r.__exportStar(require("./exceptions"),exports),r.__exportStar(require("./filters"),exports),r.__exportStar(require("./validators"),exports),r.__exportStar(require("./kafka"),exports);
2
2
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=require("tslib");e.__exportStar(require("./kafka.module"),exports),e.__exportStar(require("./kafka.service"),exports),e.__exportStar(require("./decorators/kafka.decorator"),exports);
2
+ //# sourceMappingURL=index.js.map
@@ -4,3 +4,4 @@ export * from './errors';
4
4
  export * from './exceptions';
5
5
  export * from './filters';
6
6
  export * from './validators';
7
+ export * from './kafka';
package/dist/es/index.js CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0});const r=require("tslib");r.__exportStar(require("./constants"),exports),r.__exportStar(require("./decorators"),exports),r.__exportStar(require("./errors"),exports),r.__exportStar(require("./exceptions"),exports),r.__exportStar(require("./filters"),exports),r.__exportStar(require("./validators"),exports);
1
+ Object.defineProperty(exports,"__esModule",{value:!0});const r=require("tslib");r.__exportStar(require("./constants"),exports),r.__exportStar(require("./decorators"),exports),r.__exportStar(require("./errors"),exports),r.__exportStar(require("./exceptions"),exports),r.__exportStar(require("./filters"),exports),r.__exportStar(require("./validators"),exports),r.__exportStar(require("./kafka"),exports);
2
2
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,"__esModule",{value:!0});const e=require("tslib");e.__exportStar(require("./kafka.module"),exports),e.__exportStar(require("./kafka.service"),exports),e.__exportStar(require("./decorators/kafka.decorator"),exports);
2
+ //# sourceMappingURL=index.js.map
@@ -22,3 +22,6 @@ export { Query } from './filters/query.js';
22
22
  export { UnprocessableEntityFilter } from './filters/unprocessable-entity.filter.js';
23
23
  export { IsValidField } from './validators/field.validator.js';
24
24
  export { CommaSeparated, SortBy } from './validators/filter.validator.js';
25
+ export { IKafkaModuleOptions, KafkaModule } from './kafka/kafka.module.js';
26
+ export { KafkaService } from './kafka/kafka.service.js';
27
+ export { MessageCommitOffsetInFirstRunning, MessageHeader, MessageKey, MessageTopic, MessageValue } from './kafka/decorators/kafka.decorator.js';
@@ -0,0 +1,11 @@
1
+ import * as _nestjs_common from '@nestjs/common';
2
+ import { Type } from '@nestjs/common';
3
+ import { Payload } from '@nestjs/microservices';
4
+
5
+ declare function MessageTopic(topic: string, moduleName: string, useRetryFilter?: boolean, retryFilterInstance?: Type<any> | any, enableValidation?: boolean): MethodDecorator;
6
+ declare const MessageValue: typeof Payload;
7
+ declare const MessageHeader: (...dataOrPipes: any[]) => ParameterDecorator;
8
+ declare const MessageKey: (...dataOrPipes: (string | _nestjs_common.PipeTransform<any, any> | Type<_nestjs_common.PipeTransform<any, any>>)[]) => ParameterDecorator;
9
+ declare function MessageCommitOffsetInFirstRunning(): any;
10
+
11
+ export { MessageCommitOffsetInFirstRunning, MessageHeader, MessageKey, MessageTopic, MessageValue };
@@ -0,0 +1,3 @@
1
+ export { IKafkaModuleOptions, KafkaModule } from './kafka.module.js';
2
+ export { KafkaService } from './kafka.service.js';
3
+ export { MessageCommitOffsetInFirstRunning, MessageHeader, MessageKey, MessageTopic, MessageValue } from './decorators/kafka.decorator.js';
@@ -0,0 +1,16 @@
1
+ interface IKafkaMessageHeader {
2
+ [key: string]: string | undefined;
3
+ }
4
+ interface IKafkaProducerMessageOptions {
5
+ headers?: IKafkaMessageHeader;
6
+ }
7
+ interface IKafkaProducerSendMessageOptions extends IKafkaProducerMessageOptions {
8
+ raw?: boolean;
9
+ }
10
+ interface IKafkaMessage<T = Record<string, string>> {
11
+ key: string;
12
+ value: T;
13
+ headers?: IKafkaMessageHeader;
14
+ }
15
+
16
+ export type { IKafkaMessage, IKafkaMessageHeader, IKafkaProducerMessageOptions, IKafkaProducerSendMessageOptions };
@@ -0,0 +1,13 @@
1
+ import { KafkaContext } from '@nestjs/microservices';
2
+ import { IKafkaProducerSendMessageOptions, IKafkaMessage, IKafkaProducerMessageOptions } from './kafka.interface.js';
3
+
4
+ interface IKafkaService {
5
+ produceSend<T, N>(topic: string, data: T, options?: IKafkaProducerSendMessageOptions): Promise<IKafkaMessage<N> | N>;
6
+ produceEmit<T>(topic: string, data: T, options?: IKafkaProducerMessageOptions): void;
7
+ produceSendSequential<T, N>(topic: string, data: T, options?: IKafkaProducerSendMessageOptions): Promise<IKafkaMessage<N> | N>;
8
+ produceEmitSequential<T>(topic: string, data: T, options?: IKafkaProducerMessageOptions): void;
9
+ createId(): string;
10
+ commitOffsets(context: KafkaContext): Promise<void>;
11
+ }
12
+
13
+ export type { IKafkaService };
@@ -0,0 +1,12 @@
1
+ import { DynamicModule } from '@nestjs/common';
2
+
3
+ interface IKafkaModuleOptions {
4
+ subscribeTopics?: string[];
5
+ enableConsumer?: boolean;
6
+ }
7
+ declare class KafkaModule {
8
+ static forRoot(options?: IKafkaModuleOptions): DynamicModule;
9
+ }
10
+
11
+ export { KafkaModule };
12
+ export type { IKafkaModuleOptions };
@@ -0,0 +1,27 @@
1
+ import { OnModuleInit, OnApplicationBootstrap, OnApplicationShutdown } from '@nestjs/common';
2
+ import { ConfigService } from '@nestjs/config';
3
+ import { ClientKafka, KafkaContext } from '@nestjs/microservices';
4
+ import { Observable } from 'rxjs';
5
+ import { IKafkaProducerSendMessageOptions, IKafkaMessage, IKafkaProducerMessageOptions } from './interfaces/kafka.interface.js';
6
+ import { IKafkaService } from './interfaces/kafka.service.interface.js';
7
+
8
+ declare class KafkaService implements IKafkaService, OnModuleInit, OnApplicationBootstrap, OnApplicationShutdown {
9
+ private readonly clientKafka;
10
+ private readonly topics;
11
+ private readonly configService;
12
+ private readonly timeout;
13
+ private readonly logger;
14
+ constructor(clientKafka: ClientKafka, topics: string[], configService: ConfigService);
15
+ onApplicationBootstrap(): Promise<void>;
16
+ onModuleInit(): Promise<void>;
17
+ onApplicationShutdown(signal?: string): Promise<void>;
18
+ produceSend<T, N>(topic: string, data: T, options?: IKafkaProducerSendMessageOptions): Promise<IKafkaMessage<N> | N>;
19
+ produceEmit<T, N>(topic: string, data: T, options?: IKafkaProducerMessageOptions): Observable<N>;
20
+ produceSendSequential<T, N = any>(topic: string, data: T, options?: IKafkaProducerSendMessageOptions): Promise<N>;
21
+ produceEmitSequential<T, N = any>(topic: string, data: T, options?: IKafkaProducerMessageOptions): Observable<N>;
22
+ createId(): string;
23
+ generateRandomString(length: number): string;
24
+ commitOffsets(context: KafkaContext): Promise<void>;
25
+ }
26
+
27
+ export { KafkaService };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infineit-nestjs/core",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "main": "./dist/cjs/index.js",
5
5
  "module": "./dist/es/index.mjs",
6
6
  "exports": {
@@ -127,5 +127,5 @@
127
127
  "publishConfig": {
128
128
  "access": "public"
129
129
  },
130
- "gitHead": "fe55a3bd0cb2ce27a7690ea4d8a68ad9adef141d"
130
+ "gitHead": "45ae1f6c33e64db27ed42aa5ba003266960e0c57"
131
131
  }