@axxel/event-bus 1.1.0 → 1.1.2

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 (65) 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 +1 -1
  4. package/dist/config/kafka.js +14 -6
  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/poolCreatedConsumer.d.ts +0 -0
  9. package/dist/consumers/poolCreatedConsumer.d.ts.map +0 -0
  10. package/dist/consumers/poolCreatedConsumer.js +0 -0
  11. package/dist/consumers/tokenPriceConsumer.d.ts +0 -0
  12. package/dist/consumers/tokenPriceConsumer.d.ts.map +0 -0
  13. package/dist/consumers/tokenPriceConsumer.js +0 -0
  14. package/dist/consumers/tradeExecutionConsumer.d.ts +0 -0
  15. package/dist/consumers/tradeExecutionConsumer.d.ts.map +0 -0
  16. package/dist/consumers/tradeExecutionConsumer.js +0 -0
  17. package/dist/consumers/walletTransactionConsumer.d.ts +0 -0
  18. package/dist/consumers/walletTransactionConsumer.d.ts.map +0 -0
  19. package/dist/consumers/walletTransactionConsumer.js +0 -0
  20. package/dist/index.d.ts +0 -0
  21. package/dist/index.d.ts.map +0 -0
  22. package/dist/index.js +0 -0
  23. package/dist/producers/index.d.ts +0 -0
  24. package/dist/producers/index.d.ts.map +0 -0
  25. package/dist/producers/index.js +0 -0
  26. package/dist/producers/poolCreatedProducer.d.ts +0 -0
  27. package/dist/producers/poolCreatedProducer.d.ts.map +0 -0
  28. package/dist/producers/poolCreatedProducer.js +0 -0
  29. package/dist/producers/tokenPriceProducer.d.ts +0 -0
  30. package/dist/producers/tokenPriceProducer.d.ts.map +0 -0
  31. package/dist/producers/tokenPriceProducer.js +0 -0
  32. package/dist/producers/tradeExecutionProducer.d.ts +0 -0
  33. package/dist/producers/tradeExecutionProducer.d.ts.map +0 -0
  34. package/dist/producers/tradeExecutionProducer.js +0 -0
  35. package/dist/producers/walletTransactionProducer.d.ts +0 -0
  36. package/dist/producers/walletTransactionProducer.d.ts.map +0 -0
  37. package/dist/producers/walletTransactionProducer.js +0 -0
  38. package/dist/topics.d.ts +0 -0
  39. package/dist/topics.d.ts.map +0 -0
  40. package/dist/topics.js +0 -0
  41. package/dist/types/PoolCreatedEvent.d.ts +0 -0
  42. package/dist/types/PoolCreatedEvent.d.ts.map +0 -0
  43. package/dist/types/PoolCreatedEvent.js +0 -0
  44. package/dist/types/TokenPriceEvent.d.ts +0 -0
  45. package/dist/types/TokenPriceEvent.d.ts.map +0 -0
  46. package/dist/types/TokenPriceEvent.js +0 -0
  47. package/dist/types/TradeExecutionEvent.d.ts +0 -0
  48. package/dist/types/TradeExecutionEvent.d.ts.map +0 -0
  49. package/dist/types/TradeExecutionEvent.js +0 -0
  50. package/dist/types/WalletTransactionEvent.d.ts +0 -0
  51. package/dist/types/WalletTransactionEvent.d.ts.map +0 -0
  52. package/dist/types/WalletTransactionEvent.js +0 -0
  53. package/dist/types/index.d.ts +0 -0
  54. package/dist/types/index.d.ts.map +0 -0
  55. package/dist/types/index.js +0 -0
  56. package/dist/validation/common.d.ts +1 -1
  57. package/dist/validation/common.d.ts.map +1 -1
  58. package/dist/validation/common.js +4 -2
  59. package/dist/validation/tokenPriceEvent.schema.d.ts +1 -1
  60. package/dist/validation/tokenPriceEvent.schema.d.ts.map +0 -0
  61. package/dist/validation/tokenPriceEvent.schema.js +0 -0
  62. package/dist/validation/walletTransactionEvent.schema.d.ts +4 -4
  63. package/dist/validation/walletTransactionEvent.schema.d.ts.map +0 -0
  64. package/dist/validation/walletTransactionEvent.schema.js +0 -0
  65. package/package.json +4 -3
package/README.md CHANGED
File without changes
File without changes
@@ -1 +1 @@
1
- {"version":3,"file":"kafka.d.ts","sourceRoot":"","sources":["../../src/config/kafka.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAahC,eAAO,MAAM,KAAK,OAQhB,CAAC"}
1
+ {"version":3,"file":"kafka.d.ts","sourceRoot":"","sources":["../../src/config/kafka.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAehC,eAAO,MAAM,KAAK,OAehB,CAAC"}
@@ -8,19 +8,27 @@ const kafkajs_1 = require("kafkajs");
8
8
  const aws_msk_iam_sasl_signer_js_1 = require("aws-msk-iam-sasl-signer-js");
9
9
  const dotenv_1 = __importDefault(require("dotenv"));
10
10
  dotenv_1.default.config();
11
+ const isMSK = process.env.KAFKA_ENV === 'msk';
11
12
  async function oauthBearerProvider() {
12
13
  const { token } = await (0, aws_msk_iam_sasl_signer_js_1.generateAuthToken)({
13
- region: 'us-east-1',
14
+ region: process.env.AWS_REGION || 'us-east-1',
14
15
  });
15
16
  return { value: token };
16
17
  }
17
18
  exports.kafka = new kafkajs_1.Kafka({
18
19
  clientId: process.env.KAFKA_CLIENT_ID || 'axxel-event-bus',
19
20
  brokers: process.env.KAFKA_BROKERS?.split(',') || [],
20
- ssl: true,
21
- sasl: {
22
- mechanism: 'oauthbearer',
23
- oauthBearerProvider: () => oauthBearerProvider(),
24
- },
21
+ ...(isMSK
22
+ ? {
23
+ ssl: true,
24
+ sasl: {
25
+ mechanism: 'oauthbearer',
26
+ oauthBearerProvider,
27
+ },
28
+ }
29
+ : {
30
+ ssl: false,
31
+ }),
25
32
  });
33
+ console.log('Kafka mode:', isMSK ? 'MSK (IAM)' : 'Local');
26
34
  console.log('Kafka brokers:', process.env.KAFKA_BROKERS);
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
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
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
2
  export declare const chainIdSchema: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>, z.ZodTransform<number, number>>, z.ZodNumber>;
3
- export declare const addressSchema: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
3
+ export declare const addressSchema: z.ZodString;
4
4
  export declare const txHashSchema: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
5
5
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/validation/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,aAAa,+JAEM,CAAC;AAEjC,eAAO,MAAM,aAAa,wDAGkB,CAAC;AAE7C,eAAO,MAAM,YAAY,wDAGmB,CAAC"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/validation/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,eAAO,MAAM,aAAa,+JAEM,CAAC;AAEjC,eAAO,MAAM,aAAa,aAQvB,CAAC;AAEJ,eAAO,MAAM,YAAY,wDAGmB,CAAC"}
@@ -4,6 +4,7 @@ exports.txHashSchema = exports.addressSchema = exports.chainIdSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const HEX_ADDRESS_REGEX = /^0x[a-fA-F0-9]{40}$/;
6
6
  const TX_HASH_REGEX = /^0x[a-fA-F0-9]{64}$/;
7
+ const SOLANA_ADDRESS_REGEX = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
7
8
  const numericChainIdInput = zod_1.z.union([
8
9
  zod_1.z.number().int(),
9
10
  zod_1.z
@@ -16,8 +17,9 @@ exports.chainIdSchema = numericChainIdInput
16
17
  .pipe(zod_1.z.number().int().min(0));
17
18
  exports.addressSchema = zod_1.z
18
19
  .string()
19
- .refine((value) => HEX_ADDRESS_REGEX.test(value), { message: 'invalid_address' })
20
- .transform((value) => value.toLowerCase());
20
+ .refine((value) => HEX_ADDRESS_REGEX.test(value) || SOLANA_ADDRESS_REGEX.test(value), {
21
+ message: 'invalid_address',
22
+ });
21
23
  exports.txHashSchema = zod_1.z
22
24
  .string()
23
25
  .refine((value) => TX_HASH_REGEX.test(value), { message: 'invalid_tx_hash' })
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  export declare const tokenPriceEventSchema: z.ZodObject<{
3
3
  chainId: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>, z.ZodTransform<number, number>>, z.ZodNumber>;
4
- tokenAddress: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
4
+ tokenAddress: z.ZodString;
5
5
  blockNumber: z.ZodNumber;
6
6
  price: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
7
7
  price: z.ZodNumber;
File without changes
File without changes
@@ -1,15 +1,15 @@
1
1
  import { z } from 'zod';
2
2
  export declare const walletTransactionEventSchema: z.ZodObject<{
3
3
  chainId: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>, z.ZodTransform<number, number>>, z.ZodNumber>;
4
- walletAddress: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
4
+ walletAddress: z.ZodString;
5
5
  type: z.ZodString;
6
- pool: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
6
+ pool: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7
7
  txHash: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
8
8
  baseAmount: z.ZodString;
9
9
  quoteAmount: z.ZodString;
10
- baseTokenAddress: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
10
+ baseTokenAddress: z.ZodString;
11
11
  baseTokenSymbol: z.ZodString;
12
- quoteTokenAddress: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
12
+ quoteTokenAddress: z.ZodString;
13
13
  quoteTokenSymbol: z.ZodString;
14
14
  blockTimestamp: z.ZodNumber;
15
15
  liquidity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axxel/event-bus",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Axxel Kafka Event Bus SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,7 +19,8 @@
19
19
  "publish:private": "npm publish",
20
20
  "release:patch": "npm version patch && npm publish --access public",
21
21
  "release:minor": "npm version minor && npm publish --access public",
22
- "release:major": "npm version major && npm publish --access public"
22
+ "release:major": "npm version major && npm publish --access public",
23
+ "kafka:setup": "tsx scripts/setup.ts"
23
24
  },
24
25
  "keywords": [],
25
26
  "author": "",
@@ -36,4 +37,4 @@
36
37
  "tsx": "^4.20.6",
37
38
  "typescript": "^5.9.3"
38
39
  }
39
- }
40
+ }