@taphealth/kafka 1.1.0 → 1.1.1
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/client.d.ts +3 -0
- package/dist/client.js +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +19 -1
- package/package.json +5 -3
package/dist/client.d.ts
ADDED
package/dist/client.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.kafka = void 0;
|
|
4
|
+
const kafkajs_1 = require("kafkajs");
|
|
5
|
+
const kafka = new kafkajs_1.Kafka({
|
|
6
|
+
clientId: "taphealth",
|
|
7
|
+
brokers: ["kafka.dev.azure.tap.health:9092"],
|
|
8
|
+
});
|
|
9
|
+
exports.kafka = kafka;
|
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const client_1 = require("./client");
|
|
4
|
+
async function init() {
|
|
5
|
+
const admin = client_1.kafka.admin();
|
|
6
|
+
await admin.connect();
|
|
7
|
+
console.log("Connected to Kafka as an admin");
|
|
8
|
+
await admin.createTopics({
|
|
9
|
+
topics: [
|
|
10
|
+
{
|
|
11
|
+
topic: "payment-captured",
|
|
12
|
+
numPartitions: 2,
|
|
13
|
+
replicationFactor: 2,
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
});
|
|
17
|
+
console.log("Created topics");
|
|
18
|
+
await admin.disconnect();
|
|
19
|
+
}
|
|
20
|
+
init().catch(console.error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taphealth/kafka",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -12,14 +12,16 @@
|
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"del-cli": "^5.1.0",
|
|
15
|
+
"ts-node": "^10.9.2",
|
|
15
16
|
"typescript": "^5.4.5"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
|
-
"@taphealth/errors": "^1.1.8"
|
|
19
|
+
"@taphealth/errors": "^1.1.8",
|
|
20
|
+
"kafkajs": "^2.2.4"
|
|
19
21
|
},
|
|
20
22
|
"scripts": {
|
|
21
23
|
"clean": "del-cli ./dist/*",
|
|
22
24
|
"build": "pnpm clean && tsc",
|
|
23
|
-
"pub": "pnpm build && pnpm publish --no-git-checks"
|
|
25
|
+
"pub": "pnpm version patch --no-git-checks && pnpm build && pnpm publish --no-git-checks"
|
|
24
26
|
}
|
|
25
27
|
}
|