Skip to content

Commit

Permalink
Added typescript definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
thspinto committed Jun 6, 2018
1 parent 6bff689 commit c8788e0
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
coverage
coverage
example
115 changes: 114 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
{
"name": "quintoandar-kafka",
"version": "0.0.10",
"version": "0.0.11",
"description": "Default Kafka NodeJS lib for QuintoAndar",
"main": "src/main.js",
"types": "types/index.d.ts",
"dependencies": {
"kafka-node": "git+https://github.com/thspinto/kafka-node.git#v2.6.2-rc1",
"lodash": "^4.17.10",
"quintoandar-logger": "git+https://github.com/quintoandar/node-logger.git#1.0.0",
"uuid": "^3.2.1"
},
"devDependencies": {
"@types/node": "^10.0.0",
"EventEmitter": "^1.0.0",
"eslint": "^4.7.2",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-import": "2.8.0",
"jest": "^21.2.1",
"jest-cli": "^22.0.3"
"jest-cli": "^22.0.3",
"tslint": "^5.10.0",
"tslint-config-semistandard": "^7.0.0",
"typescript": "^2.8.3"
},
"scripts": {
"test": "jest --config jest.config.json --coverage --forceExit",
"eslint": "eslint ./"
"test": "npm run eslint && jest --config jest.config.json --coverage --forceExit",
"eslint": "eslint ./ && npm run eslint:ts",
"eslint:ts": "tslint --project ./types/tsconfig.json --config ./types/tslint.json && tsc --project types"
},
"repository": {
"type": "git",
Expand Down
15 changes: 15 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Writable } from 'stream';
import { ConsumerGroupOptions, KafkaClientOptions, HighLevelConsumerOptions } from 'kafka-node';

export { ConsumerGroupOptions, KafkaClientOptions, HighLevelConsumerOptions } from 'kafka-node';

export interface KafkaConsumerOptions {
configs: ConsumerGroupOptions;
topics: string[] | string;
handleMessageFn: (message: any) => any;
}
export class KafkaConsumer {
constructor(options: KafkaConsumerOptions);

init(): void
}
15 changes: 15 additions & 0 deletions types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strict": true,
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}
12 changes: 12 additions & 0 deletions types/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"defaultSeverity": "error",
"extends": "tslint-config-semistandard",
"jsRules": {},
"rules": {
"no-empty": false,
"handle-callback-err": false,
"no-unused-variable": false
},
"rulesDirectory": []
}

0 comments on commit c8788e0

Please sign in to comment.