@platformatic/kafka 1.23.0 → 1.24.0

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 (122) hide show
  1. package/dist/apis/admin/alter-client-quotas-v1.d.ts +4 -4
  2. package/dist/apis/admin/alter-configs-v2.d.ts +3 -2
  3. package/dist/apis/admin/alter-partition-reassignments-v0.js +1 -1
  4. package/dist/apis/admin/create-acls-v3.d.ts +3 -11
  5. package/dist/apis/admin/create-partitions-v3.d.ts +2 -2
  6. package/dist/apis/admin/delete-acls-v3.d.ts +4 -19
  7. package/dist/apis/admin/delete-acls-v3.js +6 -6
  8. package/dist/apis/admin/describe-acls-v3.d.ts +5 -13
  9. package/dist/apis/admin/describe-acls-v3.js +9 -9
  10. package/dist/apis/admin/describe-client-quotas-v0.d.ts +5 -5
  11. package/dist/apis/admin/describe-configs-v4.d.ts +7 -6
  12. package/dist/apis/admin/describe-configs-v4.js +1 -1
  13. package/dist/apis/admin/incremental-alter-configs-v1.d.ts +12 -5
  14. package/dist/apis/admin/incremental-alter-configs-v1.js +3 -1
  15. package/dist/apis/admin/list-groups-v4.d.ts +2 -2
  16. package/dist/apis/admin/list-groups-v5.d.ts +2 -2
  17. package/dist/apis/admin/offset-delete-v0.js +3 -3
  18. package/dist/apis/callbacks.d.ts +3 -1
  19. package/dist/apis/consumer/offset-commit-v9.d.ts +2 -2
  20. package/dist/apis/consumer/offset-fetch-v8.d.ts +2 -2
  21. package/dist/apis/consumer/offset-fetch-v9.d.ts +2 -2
  22. package/dist/apis/definitions.d.ts +2 -2
  23. package/dist/apis/enumerations.d.ts +134 -42
  24. package/dist/apis/enumerations.js +42 -6
  25. package/dist/apis/index.d.ts +1 -0
  26. package/dist/apis/index.js +1 -0
  27. package/dist/apis/producer/add-offsets-to-txn-v3.d.ts +10 -0
  28. package/dist/apis/producer/add-offsets-to-txn-v3.js +34 -0
  29. package/dist/apis/producer/add-partitions-to-txn-v3.d.ts +34 -0
  30. package/dist/apis/producer/add-partitions-to-txn-v3.js +67 -0
  31. package/dist/apis/producer/add-partitions-to-txn-v4.d.ts +34 -0
  32. package/dist/apis/producer/add-partitions-to-txn-v4.js +79 -0
  33. package/dist/apis/producer/end-txn-v3.d.ts +10 -0
  34. package/dist/apis/producer/end-txn-v3.js +34 -0
  35. package/dist/apis/producer/index.d.ts +5 -0
  36. package/dist/apis/producer/index.js +5 -0
  37. package/dist/apis/producer/txn-offset-commit-v3.d.ts +29 -0
  38. package/dist/apis/producer/txn-offset-commit-v3.js +74 -0
  39. package/dist/apis/types.d.ts +16 -0
  40. package/dist/apis/types.js +1 -0
  41. package/dist/clients/admin/admin.d.ts +31 -1
  42. package/dist/clients/admin/admin.js +732 -50
  43. package/dist/clients/admin/options.d.ts +577 -0
  44. package/dist/clients/admin/options.js +359 -2
  45. package/dist/clients/admin/types.d.ts +105 -3
  46. package/dist/clients/base/base.js +29 -26
  47. package/dist/clients/base/options.d.ts +2 -5
  48. package/dist/clients/base/options.js +0 -1
  49. package/dist/clients/base/types.d.ts +8 -2
  50. package/dist/clients/consumer/consumer.d.ts +58 -2
  51. package/dist/clients/consumer/consumer.js +116 -47
  52. package/dist/clients/consumer/messages-stream.d.ts +1 -0
  53. package/dist/clients/consumer/messages-stream.js +48 -17
  54. package/dist/clients/consumer/options.d.ts +6 -6
  55. package/dist/clients/consumer/options.js +3 -3
  56. package/dist/clients/consumer/types.d.ts +26 -3
  57. package/dist/clients/index.d.ts +1 -1
  58. package/dist/clients/index.js +1 -1
  59. package/dist/clients/producer/options.d.ts +12 -3
  60. package/dist/clients/producer/options.js +1 -0
  61. package/dist/clients/producer/producer.d.ts +19 -2
  62. package/dist/clients/producer/producer.js +335 -37
  63. package/dist/clients/producer/transaction.d.ts +30 -0
  64. package/dist/clients/producer/transaction.js +172 -0
  65. package/dist/clients/producer/types.d.ts +2 -0
  66. package/dist/diagnostic.d.ts +5 -0
  67. package/dist/diagnostic.js +5 -0
  68. package/dist/errors.js +1 -0
  69. package/dist/network/connection-pool.js +4 -4
  70. package/dist/network/connection.js +3 -2
  71. package/dist/protocol/records.d.ts +12 -0
  72. package/dist/protocol/records.js +6 -4
  73. package/dist/protocol/sasl/oauth-bearer.js +4 -4
  74. package/dist/protocol/sasl/plain.js +2 -2
  75. package/dist/protocol/sasl/scram-sha.js +8 -8
  76. package/dist/protocol/sasl/utils.js +5 -5
  77. package/dist/symbols.d.ts +8 -0
  78. package/dist/symbols.js +8 -0
  79. package/dist/typescript-4/dist/apis/admin/alter-client-quotas-v1.d.ts +4 -4
  80. package/dist/typescript-4/dist/apis/admin/alter-configs-v2.d.ts +3 -2
  81. package/dist/typescript-4/dist/apis/admin/create-acls-v3.d.ts +3 -11
  82. package/dist/typescript-4/dist/apis/admin/create-partitions-v3.d.ts +2 -2
  83. package/dist/typescript-4/dist/apis/admin/delete-acls-v3.d.ts +4 -19
  84. package/dist/typescript-4/dist/apis/admin/describe-acls-v3.d.ts +5 -13
  85. package/dist/typescript-4/dist/apis/admin/describe-client-quotas-v0.d.ts +5 -5
  86. package/dist/typescript-4/dist/apis/admin/describe-configs-v4.d.ts +7 -6
  87. package/dist/typescript-4/dist/apis/admin/incremental-alter-configs-v1.d.ts +13 -6
  88. package/dist/typescript-4/dist/apis/admin/list-groups-v4.d.ts +2 -2
  89. package/dist/typescript-4/dist/apis/admin/list-groups-v5.d.ts +2 -2
  90. package/dist/typescript-4/dist/apis/callbacks.d.ts +3 -1
  91. package/dist/typescript-4/dist/apis/consumer/offset-commit-v9.d.ts +2 -2
  92. package/dist/typescript-4/dist/apis/consumer/offset-fetch-v8.d.ts +2 -2
  93. package/dist/typescript-4/dist/apis/consumer/offset-fetch-v9.d.ts +2 -2
  94. package/dist/typescript-4/dist/apis/definitions.d.ts +2 -2
  95. package/dist/typescript-4/dist/apis/enumerations.d.ts +134 -42
  96. package/dist/typescript-4/dist/apis/index.d.ts +1 -0
  97. package/dist/typescript-4/dist/apis/producer/add-offsets-to-txn-v3.d.ts +10 -0
  98. package/dist/typescript-4/dist/apis/producer/add-partitions-to-txn-v3.d.ts +34 -0
  99. package/dist/typescript-4/dist/apis/producer/add-partitions-to-txn-v4.d.ts +34 -0
  100. package/dist/typescript-4/dist/apis/producer/end-txn-v3.d.ts +10 -0
  101. package/dist/typescript-4/dist/apis/producer/index.d.ts +5 -0
  102. package/dist/typescript-4/dist/apis/producer/txn-offset-commit-v3.d.ts +29 -0
  103. package/dist/typescript-4/dist/apis/types.d.ts +14 -0
  104. package/dist/typescript-4/dist/clients/admin/admin.d.ts +31 -1
  105. package/dist/typescript-4/dist/clients/admin/options.d.ts +577 -0
  106. package/dist/typescript-4/dist/clients/admin/types.d.ts +105 -3
  107. package/dist/typescript-4/dist/clients/base/options.d.ts +2 -5
  108. package/dist/typescript-4/dist/clients/base/types.d.ts +8 -2
  109. package/dist/typescript-4/dist/clients/consumer/consumer.d.ts +58 -2
  110. package/dist/typescript-4/dist/clients/consumer/messages-stream.d.ts +1 -0
  111. package/dist/typescript-4/dist/clients/consumer/options.d.ts +6 -6
  112. package/dist/typescript-4/dist/clients/consumer/types.d.ts +27 -4
  113. package/dist/typescript-4/dist/clients/index.d.ts +1 -1
  114. package/dist/typescript-4/dist/clients/producer/options.d.ts +12 -3
  115. package/dist/typescript-4/dist/clients/producer/producer.d.ts +19 -2
  116. package/dist/typescript-4/dist/clients/producer/transaction.d.ts +30 -0
  117. package/dist/typescript-4/dist/clients/producer/types.d.ts +2 -0
  118. package/dist/typescript-4/dist/diagnostic.d.ts +5 -0
  119. package/dist/typescript-4/dist/protocol/records.d.ts +12 -0
  120. package/dist/typescript-4/dist/symbols.d.ts +9 -1
  121. package/dist/version.js +1 -1
  122. package/package.json +1 -1
@@ -99,7 +99,7 @@ export declare const consumeOptionsProperties: {
99
99
  };
100
100
  isolationLevel: {
101
101
  type: string;
102
- enum: number[];
102
+ enum: (0 | 1)[];
103
103
  };
104
104
  deserializers: {
105
105
  type: string;
@@ -209,7 +209,7 @@ export declare const consumeOptionsSchema: {
209
209
  };
210
210
  isolationLevel: {
211
211
  type: string;
212
- enum: number[];
212
+ enum: (0 | 1)[];
213
213
  };
214
214
  deserializers: {
215
215
  type: string;
@@ -360,7 +360,7 @@ export declare const consumerOptionsSchema: {
360
360
  };
361
361
  isolationLevel: {
362
362
  type: string;
363
- enum: number[];
363
+ enum: (0 | 1)[];
364
364
  };
365
365
  deserializers: {
366
366
  type: string;
@@ -471,7 +471,7 @@ export declare const fetchOptionsSchema: {
471
471
  };
472
472
  isolationLevel: {
473
473
  type: string;
474
- enum: number[];
474
+ enum: (0 | 1)[];
475
475
  };
476
476
  deserializers: {
477
477
  type: string;
@@ -673,7 +673,7 @@ export declare const listOffsetsOptionsSchema: {
673
673
  };
674
674
  isolationLevel: {
675
675
  type: string;
676
- enum: number[];
676
+ enum: (0 | 1)[];
677
677
  };
678
678
  timestamp: {
679
679
  bigint: boolean;
@@ -743,6 +743,6 @@ export declare const defaultConsumerOptions: {
743
743
  minBytes: number;
744
744
  maxBytes: number;
745
745
  maxWaitTime: number;
746
- isolationLevel: "READ_COMMITTED";
746
+ isolationLevel: 1;
747
747
  highWaterMark: number;
748
748
  };
@@ -1,4 +1,4 @@
1
- import { allowedFetchIsolationLevels, allowedGroupProtocols } from "../../apis/enumerations.js";
1
+ import { allowedFetchIsolationLevels, allowedGroupProtocols, FetchIsolationLevels } from "../../apis/enumerations.js";
2
2
  import { ajv } from "../../utils.js";
3
3
  import { idProperty, topicWithPartitionAndOffsetProperties } from "../base/options.js";
4
4
  import { serdeProperties } from "../serde.js";
@@ -58,7 +58,7 @@ export const consumeOptionsProperties = {
58
58
  minBytes: { type: 'number', minimum: 0 },
59
59
  maxBytes: { type: 'number', minimum: 0 },
60
60
  maxWaitTime: { type: 'number', minimum: 0 },
61
- isolationLevel: { type: 'string', enum: allowedFetchIsolationLevels },
61
+ isolationLevel: { type: 'number', enum: allowedFetchIsolationLevels },
62
62
  deserializers: serdeProperties,
63
63
  highWaterMark: { type: 'number', minimum: 1 }
64
64
  };
@@ -240,6 +240,6 @@ export const defaultConsumerOptions = {
240
240
  minBytes: 1,
241
241
  maxBytes: 1_048_576 * 10, // 10 MB
242
242
  maxWaitTime: 5_000,
243
- isolationLevel: 'READ_COMMITTED',
243
+ isolationLevel: FetchIsolationLevels.READ_COMMITTED,
244
244
  highWaterMark: 1024
245
245
  };
@@ -1,5 +1,5 @@
1
1
  import { type FetchRequestTopic } from '../../apis/consumer/fetch-v17.ts';
2
- import { type FetchIsolationLevel, type GroupProtocols } from '../../apis/enumerations.ts';
2
+ import { type GroupProtocols } from '../../apis/enumerations.ts';
3
3
  import { type KafkaRecord, type Message } from '../../protocol/records.ts';
4
4
  import { type BaseOptions, type ClusterMetadata, type TopicWithPartitionAndOffset } from '../base/types.ts';
5
5
  import { type Deserializers } from '../serde.ts';
@@ -62,7 +62,7 @@ export interface ConsumeBaseOptions<Key, Value, HeaderKey, HeaderValue> {
62
62
  minBytes?: number;
63
63
  maxBytes?: number;
64
64
  maxWaitTime?: number;
65
- isolationLevel?: FetchIsolationLevel;
65
+ isolationLevel?: number;
66
66
  deserializers?: Partial<Deserializers<Key, Value, HeaderKey, HeaderValue>>;
67
67
  highWaterMark?: number;
68
68
  }
@@ -95,6 +95,29 @@ export interface ListOffsetsOptions {
95
95
  topics: string[];
96
96
  partitions?: Record<string, number[]>;
97
97
  timestamp?: bigint;
98
- isolationLevel?: FetchIsolationLevel;
98
+ isolationLevel?: number;
99
99
  }
100
100
  export type GetLagOptions = Omit<ListOffsetsOptions, 'timestamp' | 'isolationLevel'>;
101
+ export interface ConsumerGroupJoinPayload {
102
+ groupId: string;
103
+ memberId: string;
104
+ generationId?: number;
105
+ isLeader?: boolean;
106
+ assignments?: GroupAssignment[];
107
+ }
108
+ export interface ConsumerGroupLeavePayload {
109
+ groupId: string;
110
+ memberId: string | null;
111
+ generationId?: number;
112
+ }
113
+ export interface ConsumerGroupRebalancePayload {
114
+ groupId: string;
115
+ }
116
+ export interface ConsumerHeartbeatPayload {
117
+ groupId?: string;
118
+ memberId?: string | null;
119
+ generationId?: number;
120
+ }
121
+ export interface ConsumerHeartbeatErrorPayload extends ConsumerHeartbeatPayload {
122
+ error: Error;
123
+ }
@@ -1,5 +1,5 @@
1
1
  export * from './serde.ts';
2
- export * from './admin/index.ts';
2
+ export * as adminClient from './admin/index.ts';
3
3
  export * from './base/index.ts';
4
4
  export * from './consumer/index.ts';
5
5
  export * from './producer/index.ts';
@@ -1,5 +1,5 @@
1
1
  export * from "./serde.js";
2
- export * from "./admin/index.js";
2
+ export * as adminClient from "./admin/index.js";
3
3
  export * from "./base/index.js";
4
4
  export * from "./consumer/index.js";
5
5
  export * from "./producer/index.js";
@@ -8,10 +8,13 @@ export declare const produceOptionsProperties: {
8
8
  idempotent: {
9
9
  type: string;
10
10
  };
11
+ transactionalId: {
12
+ type: string;
13
+ };
11
14
  acks: {
12
15
  type: string;
13
16
  enumeration: {
14
- allowed: number[];
17
+ allowed: (0 | 1 | -1)[];
15
18
  errorMessage: string;
16
19
  };
17
20
  };
@@ -44,10 +47,13 @@ export declare const produceOptionsSchema: {
44
47
  idempotent: {
45
48
  type: string;
46
49
  };
50
+ transactionalId: {
51
+ type: string;
52
+ };
47
53
  acks: {
48
54
  type: string;
49
55
  enumeration: {
50
- allowed: number[];
56
+ allowed: (0 | 1 | -1)[];
51
57
  errorMessage: string;
52
58
  };
53
59
  };
@@ -84,10 +90,13 @@ export declare const sendOptionsSchema: {
84
90
  idempotent: {
85
91
  type: string;
86
92
  };
93
+ transactionalId: {
94
+ type: string;
95
+ };
87
96
  acks: {
88
97
  type: string;
89
98
  enumeration: {
90
- allowed: number[];
99
+ allowed: (0 | 1 | -1)[];
91
100
  errorMessage: string;
92
101
  };
93
102
  };
@@ -7,6 +7,7 @@ export const produceOptionsProperties = {
7
7
  producerId: { bigint: true },
8
8
  producerEpoch: { type: 'number' },
9
9
  idempotent: { type: 'boolean' },
10
+ transactionalId: { type: 'string' },
10
11
  acks: {
11
12
  type: 'number',
12
13
  enumeration: {
@@ -1,5 +1,8 @@
1
1
  import { type CallbackWithPromise } from '../../apis/callbacks.ts';
2
+ import { type Message } from '../../protocol/records.ts';
3
+ import { kTransaction, kTransactionAddOffsets, kTransactionAddPartitions, kTransactionCancel, kTransactionCommitOffset, kTransactionEnd, kTransactionFindCoordinator } from '../../symbols.ts';
2
4
  import { Base } from '../base/base.ts';
5
+ import { Transaction } from './transaction.ts';
3
6
  import { type ProduceOptions, type ProduceResult, type ProducerInfo, type ProducerOptions, type SendOptions } from './types.ts';
4
7
  export declare function noopSerializer(data?: Buffer): Buffer | undefined;
5
8
  export declare class Producer<Key = Buffer, Value = Buffer, HeaderKey = Buffer, HeaderValue = Buffer> extends Base<ProducerOptions<Key, Value, HeaderKey, HeaderValue>> {
@@ -7,10 +10,24 @@ export declare class Producer<Key = Buffer, Value = Buffer, HeaderKey = Buffer,
7
10
  constructor(options: ProducerOptions<Key, Value, HeaderKey, HeaderValue>);
8
11
  get producerId(): bigint | undefined;
9
12
  get producerEpoch(): number | undefined;
13
+ get transaction(): Transaction<Key, Value, HeaderKey, HeaderValue> | undefined;
14
+ get coordinatorId(): number;
10
15
  close(callback: CallbackWithPromise<void>): void;
11
16
  close(): Promise<void>;
12
17
  initIdempotentProducer(options: ProduceOptions<Key, Value, HeaderKey, HeaderValue>, callback: CallbackWithPromise<ProducerInfo>): void;
13
18
  initIdempotentProducer(options: ProduceOptions<Key, Value, HeaderKey, HeaderValue>): Promise<ProducerInfo>;
14
- send(options: SendOptions<Key, Value, HeaderKey, HeaderValue>, callback: CallbackWithPromise<ProduceResult>): void;
15
- send(options: SendOptions<Key, Value, HeaderKey, HeaderValue>): Promise<ProduceResult>;
19
+ send(options: SendOptions<Key, Value, HeaderKey, HeaderValue> & {
20
+ [kTransaction]?: number;
21
+ }, callback: CallbackWithPromise<ProduceResult>): void;
22
+ send(options: SendOptions<Key, Value, HeaderKey, HeaderValue> & {
23
+ [kTransaction]?: number;
24
+ }): Promise<ProduceResult>;
25
+ beginTransaction(options: ProduceOptions<Key, Value, HeaderKey, HeaderValue>, callback: CallbackWithPromise<Transaction<Key, Value, HeaderKey, HeaderValue>>): void;
26
+ beginTransaction(options?: ProduceOptions<Key, Value, HeaderKey, HeaderValue>): Promise<Transaction<Key, Value, HeaderKey, HeaderValue>>;
27
+ [kTransactionFindCoordinator](callback: CallbackWithPromise<void>): void;
28
+ [kTransactionAddPartitions](transactionId: number, topicsPartitions: Map<string, Set<number>>, callback: CallbackWithPromise<void>): void;
29
+ [kTransactionAddOffsets](transactionId: number, groupId: string, callback: CallbackWithPromise<void>): void;
30
+ [kTransactionCommitOffset]<MessageKey = Buffer, MessageValue = Buffer, MessageHeaderKey = Buffer, MessageHeaderValue = Buffer>(transactionId: number, message: Message<MessageKey, MessageValue, MessageHeaderKey, MessageHeaderValue>, callback: CallbackWithPromise<void>): void;
31
+ [kTransactionEnd](transactionId: number, commit: boolean, callback: CallbackWithPromise<void>): void;
32
+ [kTransactionCancel](transactionId: number, callback: CallbackWithPromise<void>): void;
16
33
  }