@axxel/event-bus 1.1.6 → 1.1.8

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.
Files changed (77) hide show
  1. package/README.md +0 -0
  2. package/dist/config/kafka.d.ts +0 -0
  3. package/dist/config/kafka.d.ts.map +0 -0
  4. package/dist/config/kafka.js +0 -0
  5. package/dist/consumers/index.d.ts +0 -0
  6. package/dist/consumers/index.d.ts.map +0 -0
  7. package/dist/consumers/index.js +0 -0
  8. package/dist/consumers/liveTransactionConsumer.d.ts +0 -0
  9. package/dist/consumers/liveTransactionConsumer.d.ts.map +0 -0
  10. package/dist/consumers/liveTransactionConsumer.js +0 -0
  11. package/dist/consumers/poolCreatedConsumer.d.ts +0 -0
  12. package/dist/consumers/poolCreatedConsumer.d.ts.map +0 -0
  13. package/dist/consumers/poolCreatedConsumer.js +0 -0
  14. package/dist/consumers/tokenPriceConsumer.d.ts +0 -0
  15. package/dist/consumers/tokenPriceConsumer.d.ts.map +0 -0
  16. package/dist/consumers/tokenPriceConsumer.js +0 -0
  17. package/dist/consumers/tradeExecutionConsumer.d.ts +0 -0
  18. package/dist/consumers/tradeExecutionConsumer.d.ts.map +0 -0
  19. package/dist/consumers/tradeExecutionConsumer.js +0 -0
  20. package/dist/consumers/walletTransactionConsumer.d.ts +0 -0
  21. package/dist/consumers/walletTransactionConsumer.d.ts.map +0 -0
  22. package/dist/consumers/walletTransactionConsumer.js +0 -0
  23. package/dist/index.d.ts +0 -0
  24. package/dist/index.d.ts.map +0 -0
  25. package/dist/index.js +0 -0
  26. package/dist/producers/index.d.ts +0 -0
  27. package/dist/producers/index.d.ts.map +0 -0
  28. package/dist/producers/index.js +0 -0
  29. package/dist/producers/liveTransactionProducer.d.ts +0 -0
  30. package/dist/producers/liveTransactionProducer.d.ts.map +0 -0
  31. package/dist/producers/liveTransactionProducer.js +0 -0
  32. package/dist/producers/poolCreatedProducer.d.ts +0 -0
  33. package/dist/producers/poolCreatedProducer.d.ts.map +0 -0
  34. package/dist/producers/poolCreatedProducer.js +0 -0
  35. package/dist/producers/tokenPriceProducer.d.ts +4 -0
  36. package/dist/producers/tokenPriceProducer.d.ts.map +1 -1
  37. package/dist/producers/tokenPriceProducer.js +31 -0
  38. package/dist/producers/tradeExecutionProducer.d.ts +0 -0
  39. package/dist/producers/tradeExecutionProducer.d.ts.map +0 -0
  40. package/dist/producers/tradeExecutionProducer.js +0 -0
  41. package/dist/producers/walletTransactionProducer.d.ts +0 -0
  42. package/dist/producers/walletTransactionProducer.d.ts.map +0 -0
  43. package/dist/producers/walletTransactionProducer.js +0 -0
  44. package/dist/topics.d.ts +0 -0
  45. package/dist/topics.d.ts.map +0 -0
  46. package/dist/topics.js +0 -0
  47. package/dist/types/LiveTransactionEvent.d.ts +0 -0
  48. package/dist/types/LiveTransactionEvent.d.ts.map +0 -0
  49. package/dist/types/LiveTransactionEvent.js +0 -0
  50. package/dist/types/PoolCreatedEvent.d.ts +0 -0
  51. package/dist/types/PoolCreatedEvent.d.ts.map +0 -0
  52. package/dist/types/PoolCreatedEvent.js +0 -0
  53. package/dist/types/TokenPriceEvent.d.ts +0 -0
  54. package/dist/types/TokenPriceEvent.d.ts.map +0 -0
  55. package/dist/types/TokenPriceEvent.js +0 -0
  56. package/dist/types/TradeExecutionEvent.d.ts +0 -0
  57. package/dist/types/TradeExecutionEvent.d.ts.map +0 -0
  58. package/dist/types/TradeExecutionEvent.js +0 -0
  59. package/dist/types/WalletTransactionEvent.d.ts +0 -0
  60. package/dist/types/WalletTransactionEvent.d.ts.map +0 -0
  61. package/dist/types/WalletTransactionEvent.js +0 -0
  62. package/dist/types/index.d.ts +0 -0
  63. package/dist/types/index.d.ts.map +0 -0
  64. package/dist/types/index.js +0 -0
  65. package/dist/validation/common.d.ts +0 -0
  66. package/dist/validation/common.d.ts.map +0 -0
  67. package/dist/validation/common.js +0 -0
  68. package/dist/validation/liveTransactionEvent.schema.d.ts +0 -0
  69. package/dist/validation/liveTransactionEvent.schema.d.ts.map +0 -0
  70. package/dist/validation/liveTransactionEvent.schema.js +0 -0
  71. package/dist/validation/tokenPriceEvent.schema.d.ts +0 -0
  72. package/dist/validation/tokenPriceEvent.schema.d.ts.map +0 -0
  73. package/dist/validation/tokenPriceEvent.schema.js +0 -0
  74. package/dist/validation/walletTransactionEvent.schema.d.ts +0 -0
  75. package/dist/validation/walletTransactionEvent.schema.d.ts.map +0 -0
  76. package/dist/validation/walletTransactionEvent.schema.js +0 -0
  77. package/package.json +1 -1
package/README.md CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/index.d.ts CHANGED
File without changes
File without changes
package/dist/index.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,3 +1,7 @@
1
1
  import type { TokenPriceEvent } from '../types/TokenPriceEvent';
2
2
  export declare function produceTokenPrice(event: TokenPriceEvent): Promise<void>;
3
+ /**
4
+ * Batch produce multiple token prices in a single Kafka send for optimal performance
5
+ */
6
+ export declare function produceTokenPriceBatch(events: TokenPriceEvent[]): Promise<void>;
3
7
  //# sourceMappingURL=tokenPriceProducer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokenPriceProducer.d.ts","sourceRoot":"","sources":["../../src/producers/tokenPriceProducer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAa,eAAe,EAAE,MAAM,0BAA0B,CAAC;AA+B3E,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,eAAe,iBAwB7D"}
1
+ {"version":3,"file":"tokenPriceProducer.d.ts","sourceRoot":"","sources":["../../src/producers/tokenPriceProducer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAa,eAAe,EAAE,MAAM,0BAA0B,CAAC;AA+B3E,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,eAAe,iBAwB7D;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,eAAe,EAAE,iBAiCrE"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.produceTokenPrice = produceTokenPrice;
4
+ exports.produceTokenPriceBatch = produceTokenPriceBatch;
4
5
  const kafka_1 = require("../config/kafka");
5
6
  const topics_1 = require("../topics");
6
7
  function normalizePriceMap(price) {
@@ -43,3 +44,33 @@ async function produceTokenPrice(event) {
43
44
  });
44
45
  console.log(`✅ Sent token price update for ${event.symbol ?? event.tokenAddress} (chain ${event.chainId})`);
45
46
  }
47
+ /**
48
+ * Batch produce multiple token prices in a single Kafka send for optimal performance
49
+ */
50
+ async function produceTokenPriceBatch(events) {
51
+ if (events.length === 0)
52
+ return;
53
+ const producer = await getProducer();
54
+ const messages = events.map((event) => {
55
+ const key = `${event.chainId}:${event.tokenAddress}`;
56
+ const serializedEvent = {
57
+ ...event,
58
+ price: normalizePriceMap(event.price),
59
+ };
60
+ return {
61
+ key,
62
+ value: JSON.stringify(serializedEvent),
63
+ };
64
+ });
65
+ // Print only chainId, symbol, and tokenAddress for each event in the batch
66
+ console.log('🔎 Token price batch:', events.map((event) => ({
67
+ chainId: event.chainId,
68
+ symbol: event.symbol,
69
+ tokenAddress: event.tokenAddress,
70
+ })));
71
+ await producer.send({
72
+ topic: topics_1.TOPICS.TOKEN_PRICES,
73
+ messages,
74
+ });
75
+ console.log(`✅ Sent ${events.length} token price updates in batch`);
76
+ }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/topics.d.ts CHANGED
File without changes
File without changes
package/dist/topics.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axxel/event-bus",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "Axxel Kafka Event Bus SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",