@platformatic/kafka 1.22.0 → 1.23.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.
- package/dist/apis/admin/alter-client-quotas-v1.js +1 -1
- package/dist/apis/admin/alter-configs-v2.js +3 -2
- package/dist/apis/admin/alter-partition-reassignments-v0.js +4 -3
- package/dist/apis/admin/alter-partition-v3.js +2 -2
- package/dist/apis/admin/alter-replica-log-dirs-v2.js +1 -1
- package/dist/apis/admin/alter-user-scram-credentials-v0.js +1 -1
- package/dist/apis/admin/consumer-group-describe-v0.js +3 -2
- package/dist/apis/admin/create-acls-v3.js +1 -1
- package/dist/apis/admin/create-delegation-token-v3.js +1 -1
- package/dist/apis/admin/create-partitions-v1.js +1 -1
- package/dist/apis/admin/create-partitions-v2.js +1 -1
- package/dist/apis/admin/create-partitions-v3.js +1 -1
- package/dist/apis/admin/create-topics-v7.js +1 -1
- package/dist/apis/admin/delete-acls-v3.js +6 -4
- package/dist/apis/admin/delete-groups-v2.js +1 -1
- package/dist/apis/admin/delete-records-v2.js +1 -1
- package/dist/apis/admin/delete-topics-v6.js +1 -1
- package/dist/apis/admin/describe-acls-v3.js +1 -1
- package/dist/apis/admin/describe-client-quotas-v0.js +1 -1
- package/dist/apis/admin/describe-cluster-v1.js +1 -1
- package/dist/apis/admin/describe-configs-v2.js +3 -2
- package/dist/apis/admin/describe-configs-v3.js +3 -2
- package/dist/apis/admin/describe-configs-v4.js +3 -2
- package/dist/apis/admin/describe-delegation-token-v3.js +1 -1
- package/dist/apis/admin/describe-groups-v5.js +1 -1
- package/dist/apis/admin/describe-log-dirs-v4.js +2 -2
- package/dist/apis/admin/describe-producers-v0.js +1 -1
- package/dist/apis/admin/describe-quorum-v2.js +4 -3
- package/dist/apis/admin/describe-topic-partitions-v0.js +2 -2
- package/dist/apis/admin/describe-transactions-v0.js +1 -1
- package/dist/apis/admin/describe-user-scram-credentials-v0.js +6 -4
- package/dist/apis/admin/envelope-v0.js +1 -1
- package/dist/apis/admin/expire-delegation-token-v2.js +1 -1
- package/dist/apis/admin/incremental-alter-configs-v1.js +3 -2
- package/dist/apis/admin/list-groups-v4.js +1 -1
- package/dist/apis/admin/list-groups-v5.js +1 -1
- package/dist/apis/admin/list-partition-reassignments-v0.js +1 -1
- package/dist/apis/admin/list-transactions-v1.js +1 -1
- package/dist/apis/admin/offset-delete-v0.js +2 -2
- package/dist/apis/admin/renew-delegation-token-v2.js +1 -1
- package/dist/apis/admin/unregister-broker-v0.js +1 -1
- package/dist/apis/admin/update-features-v1.js +4 -3
- package/dist/apis/callbacks.d.ts +0 -1
- package/dist/apis/callbacks.js +3 -18
- package/dist/apis/consumer/consumer-group-heartbeat-v0.js +1 -1
- package/dist/apis/consumer/fetch-v12.js +2 -2
- package/dist/apis/consumer/fetch-v13.js +2 -2
- package/dist/apis/consumer/fetch-v14.js +2 -2
- package/dist/apis/consumer/fetch-v15.js +2 -2
- package/dist/apis/consumer/fetch-v16.js +2 -2
- package/dist/apis/consumer/fetch-v17.js +2 -2
- package/dist/apis/consumer/heartbeat-v4.js +1 -1
- package/dist/apis/consumer/join-group-v9.js +1 -1
- package/dist/apis/consumer/leave-group-v5.js +2 -2
- package/dist/apis/consumer/list-offsets-v8.js +1 -1
- package/dist/apis/consumer/list-offsets-v9.js +1 -1
- package/dist/apis/consumer/offset-commit-v8.js +1 -1
- package/dist/apis/consumer/offset-commit-v9.js +1 -1
- package/dist/apis/consumer/offset-fetch-v8.js +2 -2
- package/dist/apis/consumer/offset-fetch-v9.js +2 -2
- package/dist/apis/consumer/offset-for-leader-epoch-v4.js +1 -1
- package/dist/apis/consumer/sync-group-v5.js +1 -1
- package/dist/apis/definitions.d.ts +2 -1
- package/dist/apis/metadata/api-versions-v3.js +1 -1
- package/dist/apis/metadata/api-versions-v4.js +1 -1
- package/dist/apis/metadata/find-coordinator-v4.js +1 -1
- package/dist/apis/metadata/find-coordinator-v5.js +1 -1
- package/dist/apis/metadata/find-coordinator-v6.js +1 -1
- package/dist/apis/metadata/metadata-v10.js +2 -2
- package/dist/apis/metadata/metadata-v11.js +2 -2
- package/dist/apis/metadata/metadata-v12.js +2 -2
- package/dist/apis/metadata/metadata-v9.js +2 -2
- package/dist/apis/producer/add-offsets-to-txn-v4.js +1 -1
- package/dist/apis/producer/add-partitions-to-txn-v5.js +2 -2
- package/dist/apis/producer/end-txn-v4.js +1 -1
- package/dist/apis/producer/init-producer-id-v4.js +1 -1
- package/dist/apis/producer/init-producer-id-v5.js +1 -1
- package/dist/apis/producer/produce-v10.js +14 -9
- package/dist/apis/producer/produce-v11.js +14 -9
- package/dist/apis/producer/produce-v7.js +1 -1
- package/dist/apis/producer/produce-v8.js +14 -9
- package/dist/apis/producer/produce-v9.js +14 -9
- package/dist/apis/producer/txn-offset-commit-v4.js +1 -1
- package/dist/apis/security/sasl-authenticate-v2.js +1 -1
- package/dist/apis/security/sasl-handshake-v1.d.ts +2 -2
- package/dist/apis/security/sasl-handshake-v1.js +1 -1
- package/dist/apis/telemetry/get-telemetry-subscriptions-v0.js +1 -1
- package/dist/apis/telemetry/list-client-metrics-resources-v0.js +1 -1
- package/dist/apis/telemetry/push-telemetry-v0.js +1 -1
- package/dist/clients/admin/admin.d.ts +3 -1
- package/dist/clients/admin/admin.js +125 -8
- package/dist/clients/admin/options.d.ts +33 -0
- package/dist/clients/admin/options.js +22 -0
- package/dist/clients/admin/types.d.ts +10 -1
- package/dist/clients/base/base.js +4 -2
- package/dist/clients/base/types.d.ts +1 -0
- package/dist/clients/consumer/consumer.js +2 -3
- package/dist/errors.d.ts +3 -2
- package/dist/errors.js +5 -4
- package/dist/network/connection.d.ts +8 -1
- package/dist/network/connection.js +28 -10
- package/dist/protocol/definitions.d.ts +2 -1
- package/dist/protocol/index.d.ts +0 -1
- package/dist/protocol/index.js +0 -1
- package/dist/typescript-4/dist/apis/admin/alter-client-quotas-v1.d.ts +39 -0
- package/dist/typescript-4/dist/apis/admin/alter-configs-v2.d.ts +26 -0
- package/dist/typescript-4/dist/apis/admin/alter-partition-reassignments-v0.d.ts +30 -0
- package/dist/typescript-4/dist/apis/admin/alter-partition-v3.d.ts +39 -0
- package/dist/typescript-4/dist/apis/admin/alter-replica-log-dirs-v2.d.ts +26 -0
- package/dist/typescript-4/dist/apis/admin/alter-user-scram-credentials-v0.d.ts +27 -0
- package/dist/typescript-4/dist/apis/admin/consumer-group-describe-v0.d.ts +41 -0
- package/dist/typescript-4/dist/apis/admin/create-acls-v3.d.ts +24 -0
- package/dist/typescript-4/dist/apis/admin/create-delegation-token-v3.d.ts +24 -0
- package/dist/typescript-4/dist/apis/admin/create-partitions-v1.d.ts +24 -0
- package/dist/typescript-4/dist/apis/admin/create-partitions-v2.d.ts +24 -0
- package/dist/typescript-4/dist/apis/admin/create-partitions-v3.d.ts +24 -0
- package/dist/typescript-4/dist/apis/admin/create-topics-v7.d.ts +42 -0
- package/dist/typescript-4/dist/apis/admin/delete-acls-v3.d.ts +36 -0
- package/dist/typescript-4/dist/apis/admin/delete-groups-v2.d.ts +14 -0
- package/dist/typescript-4/dist/apis/admin/delete-records-v2.d.ts +27 -0
- package/dist/typescript-4/dist/apis/admin/delete-topics-v6.d.ts +21 -0
- package/dist/typescript-4/dist/apis/admin/describe-acls-v3.d.ts +25 -0
- package/dist/typescript-4/dist/apis/admin/describe-client-quotas-v0.d.ts +36 -0
- package/dist/typescript-4/dist/apis/admin/describe-cluster-v1.d.ts +23 -0
- package/dist/typescript-4/dist/apis/admin/describe-configs-v2.d.ts +38 -0
- package/dist/typescript-4/dist/apis/admin/describe-configs-v3.d.ts +38 -0
- package/dist/typescript-4/dist/apis/admin/describe-configs-v4.d.ts +38 -0
- package/dist/typescript-4/dist/apis/admin/describe-delegation-token-v3.d.ts +31 -0
- package/dist/typescript-4/dist/apis/admin/describe-groups-v5.d.ts +28 -0
- package/dist/typescript-4/dist/apis/admin/describe-log-dirs-v4.d.ts +32 -0
- package/dist/typescript-4/dist/apis/admin/describe-producers-v0.d.ts +33 -0
- package/dist/typescript-4/dist/apis/admin/describe-quorum-v2.d.ts +50 -0
- package/dist/typescript-4/dist/apis/admin/describe-topic-partitions-v0.d.ts +42 -0
- package/dist/typescript-4/dist/apis/admin/describe-transactions-v0.d.ts +24 -0
- package/dist/typescript-4/dist/apis/admin/describe-user-scram-credentials-v0.d.ts +26 -0
- package/dist/typescript-4/dist/apis/admin/envelope-v0.d.ts +10 -0
- package/dist/typescript-4/dist/apis/admin/expire-delegation-token-v2.d.ts +11 -0
- package/dist/typescript-4/dist/apis/admin/incremental-alter-configs-v1.d.ts +27 -0
- package/dist/typescript-4/dist/apis/admin/index.d.ts +42 -0
- package/dist/typescript-4/dist/apis/admin/list-groups-v4.d.ts +17 -0
- package/dist/typescript-4/dist/apis/admin/list-groups-v5.d.ts +18 -0
- package/dist/typescript-4/dist/apis/admin/list-partition-reassignments-v0.d.ts +27 -0
- package/dist/typescript-4/dist/apis/admin/list-transactions-v1.d.ts +18 -0
- package/dist/typescript-4/dist/apis/admin/offset-delete-v0.d.ts +26 -0
- package/dist/typescript-4/dist/apis/admin/renew-delegation-token-v2.d.ts +11 -0
- package/dist/typescript-4/dist/apis/admin/unregister-broker-v0.d.ts +12 -0
- package/dist/typescript-4/dist/apis/admin/update-features-v1.d.ts +23 -0
- package/dist/typescript-4/dist/apis/callbacks.d.ts +9 -0
- package/dist/typescript-4/dist/apis/consumer/consumer-group-heartbeat-v0.d.ts +27 -0
- package/dist/typescript-4/dist/apis/consumer/fetch-v12.d.ts +46 -0
- package/dist/typescript-4/dist/apis/consumer/fetch-v13.d.ts +46 -0
- package/dist/typescript-4/dist/apis/consumer/fetch-v14.d.ts +46 -0
- package/dist/typescript-4/dist/apis/consumer/fetch-v15.d.ts +46 -0
- package/dist/typescript-4/dist/apis/consumer/fetch-v16.d.ts +46 -0
- package/dist/typescript-4/dist/apis/consumer/fetch-v17.d.ts +46 -0
- package/dist/typescript-4/dist/apis/consumer/heartbeat-v4.d.ts +11 -0
- package/dist/typescript-4/dist/apis/consumer/index.d.ts +18 -0
- package/dist/typescript-4/dist/apis/consumer/join-group-v9.d.ts +27 -0
- package/dist/typescript-4/dist/apis/consumer/leave-group-v5.d.ts +22 -0
- package/dist/typescript-4/dist/apis/consumer/list-offsets-v8.d.ts +30 -0
- package/dist/typescript-4/dist/apis/consumer/list-offsets-v9.d.ts +30 -0
- package/dist/typescript-4/dist/apis/consumer/offset-commit-v8.d.ts +29 -0
- package/dist/typescript-4/dist/apis/consumer/offset-commit-v9.d.ts +29 -0
- package/dist/typescript-4/dist/apis/consumer/offset-fetch-v8.d.ts +37 -0
- package/dist/typescript-4/dist/apis/consumer/offset-fetch-v9.d.ts +37 -0
- package/dist/typescript-4/dist/apis/consumer/offset-for-leader-epoch-v4.d.ts +29 -0
- package/dist/typescript-4/dist/apis/consumer/sync-group-v5.d.ts +18 -0
- package/dist/typescript-4/dist/apis/definitions.d.ts +17 -0
- package/dist/typescript-4/dist/apis/enumerations.d.ts +143 -0
- package/dist/typescript-4/dist/apis/index.d.ts +9 -0
- package/dist/typescript-4/dist/apis/metadata/api-versions-v3.d.ts +17 -0
- package/dist/typescript-4/dist/apis/metadata/api-versions-v4.d.ts +17 -0
- package/dist/typescript-4/dist/apis/metadata/find-coordinator-v4.d.ts +19 -0
- package/dist/typescript-4/dist/apis/metadata/find-coordinator-v5.d.ts +19 -0
- package/dist/typescript-4/dist/apis/metadata/find-coordinator-v6.d.ts +19 -0
- package/dist/typescript-4/dist/apis/metadata/index.d.ts +9 -0
- package/dist/typescript-4/dist/apis/metadata/metadata-v10.d.ts +37 -0
- package/dist/typescript-4/dist/apis/metadata/metadata-v11.d.ts +37 -0
- package/dist/typescript-4/dist/apis/metadata/metadata-v12.d.ts +37 -0
- package/dist/typescript-4/dist/apis/metadata/metadata-v9.d.ts +37 -0
- package/dist/typescript-4/dist/apis/producer/add-offsets-to-txn-v4.d.ts +10 -0
- package/dist/typescript-4/dist/apis/producer/add-partitions-to-txn-v5.d.ts +34 -0
- package/dist/typescript-4/dist/apis/producer/end-txn-v4.d.ts +10 -0
- package/dist/typescript-4/dist/apis/producer/index.d.ts +11 -0
- package/dist/typescript-4/dist/apis/producer/init-producer-id-v4.d.ts +21 -0
- package/dist/typescript-4/dist/apis/producer/init-producer-id-v5.d.ts +21 -0
- package/dist/typescript-4/dist/apis/producer/produce-v10.d.ts +29 -0
- package/dist/typescript-4/dist/apis/producer/produce-v11.d.ts +29 -0
- package/dist/typescript-4/dist/apis/producer/produce-v7.d.ts +29 -0
- package/dist/typescript-4/dist/apis/producer/produce-v8.d.ts +29 -0
- package/dist/typescript-4/dist/apis/producer/produce-v9.d.ts +29 -0
- package/dist/typescript-4/dist/apis/producer/txn-offset-commit-v4.d.ts +29 -0
- package/dist/typescript-4/dist/apis/security/index.d.ts +2 -0
- package/dist/typescript-4/dist/apis/security/sasl-authenticate-v2.d.ts +15 -0
- package/dist/typescript-4/dist/apis/security/sasl-handshake-v1.d.ts +10 -0
- package/dist/typescript-4/dist/apis/telemetry/get-telemetry-subscriptions-v0.d.ts +18 -0
- package/dist/typescript-4/dist/apis/telemetry/index.d.ts +3 -0
- package/dist/typescript-4/dist/apis/telemetry/list-client-metrics-resources-v0.d.ts +14 -0
- package/dist/typescript-4/dist/apis/telemetry/push-telemetry-v0.d.ts +10 -0
- package/dist/typescript-4/dist/clients/admin/admin.d.ts +30 -0
- package/dist/typescript-4/dist/clients/admin/index.d.ts +3 -0
- package/dist/typescript-4/dist/clients/admin/options.d.ts +330 -0
- package/dist/typescript-4/dist/clients/admin/types.d.ts +88 -0
- package/dist/typescript-4/dist/clients/base/base.d.ts +75 -0
- package/dist/typescript-4/dist/clients/base/index.d.ts +3 -0
- package/dist/typescript-4/dist/clients/base/options.d.ts +198 -0
- package/dist/typescript-4/dist/clients/base/types.d.ts +42 -0
- package/dist/typescript-4/dist/clients/consumer/consumer.d.ts +44 -0
- package/dist/typescript-4/dist/clients/consumer/index.d.ts +5 -0
- package/dist/typescript-4/dist/clients/consumer/messages-stream.d.ts +81 -0
- package/dist/typescript-4/dist/clients/consumer/options.d.ts +748 -0
- package/dist/typescript-4/dist/clients/consumer/partitions-assigners.d.ts +3 -0
- package/dist/typescript-4/dist/clients/consumer/topics-map.d.ts +11 -0
- package/dist/typescript-4/dist/clients/consumer/types.d.ts +100 -0
- package/dist/typescript-4/dist/clients/index.d.ts +5 -0
- package/dist/typescript-4/dist/clients/metrics.d.ts +60 -0
- package/dist/typescript-4/dist/clients/producer/index.d.ts +3 -0
- package/dist/typescript-4/dist/clients/producer/options.d.ts +164 -0
- package/dist/typescript-4/dist/clients/producer/producer.d.ts +16 -0
- package/dist/typescript-4/dist/clients/producer/types.d.ts +29 -0
- package/dist/typescript-4/dist/clients/serde.d.ts +42 -0
- package/dist/typescript-4/dist/diagnostic.d.ts +54 -0
- package/dist/typescript-4/dist/errors.d.ts +83 -0
- package/dist/typescript-4/dist/index.d.ts +7 -0
- package/dist/typescript-4/dist/network/connection-pool.d.ts +16 -0
- package/dist/typescript-4/dist/network/connection.d.ts +78 -0
- package/dist/typescript-4/dist/network/index.d.ts +3 -0
- package/dist/typescript-4/dist/network/utils.d.ts +2 -0
- package/dist/typescript-4/dist/protocol/apis.d.ts +2 -0
- package/dist/typescript-4/dist/protocol/compression.d.ts +79 -0
- package/dist/typescript-4/dist/protocol/crc32c.d.ts +4 -0
- package/dist/typescript-4/dist/protocol/definitions.d.ts +13 -0
- package/dist/typescript-4/dist/protocol/dynamic-buffer.d.ts +65 -0
- package/dist/typescript-4/dist/protocol/errors.d.ts +8 -0
- package/dist/typescript-4/dist/protocol/index.d.ts +15 -0
- package/dist/typescript-4/dist/protocol/murmur2.d.ts +1 -0
- package/dist/typescript-4/dist/protocol/reader.d.ts +61 -0
- package/dist/typescript-4/dist/protocol/records.d.ts +111 -0
- package/dist/typescript-4/dist/protocol/sasl/oauth-bearer.d.ts +6 -0
- package/dist/typescript-4/dist/protocol/sasl/plain.d.ts +5 -0
- package/dist/typescript-4/dist/protocol/sasl/scram-sha.d.ts +39 -0
- package/dist/typescript-4/dist/protocol/sasl/utils.d.ts +4 -0
- package/dist/typescript-4/dist/protocol/varint.d.ts +12 -0
- package/dist/typescript-4/dist/protocol/writer.d.ts +48 -0
- package/dist/typescript-4/dist/symbols.d.ts +3 -0
- package/dist/typescript-4/dist/utils.d.ts +37 -0
- package/dist/typescript-4/dist/version.d.ts +2 -0
- package/dist/utils.d.ts +6 -1
- package/dist/utils.js +3 -4
- package/dist/version.js +1 -1
- package/package.json +17 -2
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type ClusterMetadata } from "../base/types";
|
|
2
|
+
import { type ExtendedGroupProtocolSubscription, type GroupPartitionsAssignments } from "./types";
|
|
3
|
+
export declare function roundRobinAssigner(_current: string, members: Map<string, ExtendedGroupProtocolSubscription>, topics: Set<string>, metadata: ClusterMetadata): GroupPartitionsAssignments[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Gauge } from "../metrics";
|
|
2
|
+
export declare class TopicsMap extends Map<string, number> {
|
|
3
|
+
#private;
|
|
4
|
+
get current(): string[];
|
|
5
|
+
clear(): void;
|
|
6
|
+
track(topic: string): boolean;
|
|
7
|
+
trackAll(...topics: string[]): boolean[];
|
|
8
|
+
untrack(topic: string): boolean;
|
|
9
|
+
untrackAll(...topics: string[]): boolean[];
|
|
10
|
+
setMetric(metric: Gauge): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { type FetchRequestTopic } from "../../apis/consumer/fetch-v17";
|
|
2
|
+
import { type FetchIsolationLevel, type GroupProtocols } from "../../apis/enumerations";
|
|
3
|
+
import { type KafkaRecord, type Message } from "../../protocol/records";
|
|
4
|
+
import { type BaseOptions, type ClusterMetadata, type TopicWithPartitionAndOffset } from "../base/types";
|
|
5
|
+
import { type Deserializers } from "../serde";
|
|
6
|
+
export interface GroupProtocolSubscription {
|
|
7
|
+
name: string;
|
|
8
|
+
version: number;
|
|
9
|
+
metadata?: Buffer | string;
|
|
10
|
+
}
|
|
11
|
+
export interface GroupAssignment {
|
|
12
|
+
topic: string;
|
|
13
|
+
partitions: number[];
|
|
14
|
+
}
|
|
15
|
+
export interface GroupPartitionsAssignments {
|
|
16
|
+
memberId: string;
|
|
17
|
+
assignments: Map<string, GroupAssignment>;
|
|
18
|
+
}
|
|
19
|
+
export interface ExtendedGroupProtocolSubscription extends Omit<GroupProtocolSubscription, 'name'> {
|
|
20
|
+
topics?: string[];
|
|
21
|
+
memberId: string;
|
|
22
|
+
}
|
|
23
|
+
export type Offsets = Map<string, bigint[]>;
|
|
24
|
+
export type OffsetsWithTimestamps = Map<string, Map<number, {
|
|
25
|
+
offset: bigint;
|
|
26
|
+
timestamp: bigint;
|
|
27
|
+
}>>;
|
|
28
|
+
export type CorruptedMessageHandler = (record: KafkaRecord, topic: string, partition: number, firstTimestamp: bigint, firstOffset: bigint, commit: Message['commit']) => boolean;
|
|
29
|
+
export type GroupPartitionsAssigner = (current: string, members: Map<string, ExtendedGroupProtocolSubscription>, topics: Set<string>, metadata: ClusterMetadata) => GroupPartitionsAssignments[];
|
|
30
|
+
export declare const MessagesStreamModes: {
|
|
31
|
+
readonly LATEST: "latest";
|
|
32
|
+
readonly EARLIEST: "earliest";
|
|
33
|
+
readonly COMMITTED: "committed";
|
|
34
|
+
readonly MANUAL: "manual";
|
|
35
|
+
};
|
|
36
|
+
export declare const allowedMessagesStreamModes: MessagesStreamModeValue[];
|
|
37
|
+
export type MessagesStreamMode = keyof typeof MessagesStreamModes;
|
|
38
|
+
export type MessagesStreamModeValue = (typeof MessagesStreamModes)[keyof typeof MessagesStreamModes];
|
|
39
|
+
export declare const MessagesStreamFallbackModes: {
|
|
40
|
+
readonly LATEST: "latest";
|
|
41
|
+
readonly EARLIEST: "earliest";
|
|
42
|
+
readonly FAIL: "fail";
|
|
43
|
+
};
|
|
44
|
+
export declare const allowedMessagesStreamFallbackModes: MessagesStreamFallbackModeValue[];
|
|
45
|
+
export type MessagesStreamFallbackMode = keyof typeof MessagesStreamFallbackModes;
|
|
46
|
+
export type MessagesStreamFallbackModeValue = (typeof MessagesStreamFallbackModes)[keyof typeof MessagesStreamFallbackModes];
|
|
47
|
+
export interface GroupOptions {
|
|
48
|
+
groupProtocol?: typeof GroupProtocols.CLASSIC;
|
|
49
|
+
sessionTimeout?: number;
|
|
50
|
+
rebalanceTimeout?: number;
|
|
51
|
+
heartbeatInterval?: number;
|
|
52
|
+
protocols?: GroupProtocolSubscription[];
|
|
53
|
+
partitionAssigner?: GroupPartitionsAssigner;
|
|
54
|
+
}
|
|
55
|
+
export interface ConsumerGroupOptions {
|
|
56
|
+
groupProtocol: typeof GroupProtocols.CONSUMER;
|
|
57
|
+
groupRemoteAssignor?: string;
|
|
58
|
+
rebalanceTimeout?: number;
|
|
59
|
+
}
|
|
60
|
+
export interface ConsumeBaseOptions<Key, Value, HeaderKey, HeaderValue> {
|
|
61
|
+
autocommit?: boolean | number;
|
|
62
|
+
minBytes?: number;
|
|
63
|
+
maxBytes?: number;
|
|
64
|
+
maxWaitTime?: number;
|
|
65
|
+
isolationLevel?: FetchIsolationLevel;
|
|
66
|
+
deserializers?: Partial<Deserializers<Key, Value, HeaderKey, HeaderValue>>;
|
|
67
|
+
highWaterMark?: number;
|
|
68
|
+
}
|
|
69
|
+
export interface StreamOptions {
|
|
70
|
+
topics: string[];
|
|
71
|
+
mode?: MessagesStreamModeValue;
|
|
72
|
+
fallbackMode?: MessagesStreamFallbackModeValue;
|
|
73
|
+
maxFetches?: number;
|
|
74
|
+
offsets?: TopicWithPartitionAndOffset[];
|
|
75
|
+
onCorruptedMessage?: CorruptedMessageHandler;
|
|
76
|
+
}
|
|
77
|
+
export type ConsumeOptions<Key, Value, HeaderKey, HeaderValue> = StreamOptions & ConsumeBaseOptions<Key, Value, HeaderKey, HeaderValue> & GroupOptions;
|
|
78
|
+
export type ConsumerOptions<Key, Value, HeaderKey, HeaderValue> = BaseOptions & {
|
|
79
|
+
groupId: string;
|
|
80
|
+
} & (GroupOptions | ConsumerGroupOptions) & ConsumeBaseOptions<Key, Value, HeaderKey, HeaderValue>;
|
|
81
|
+
export type FetchOptions<Key, Value, HeaderKey, HeaderValue> = Pick<ConsumeBaseOptions<Key, Value, HeaderKey, HeaderValue>, 'minBytes' | 'maxBytes' | 'maxWaitTime' | 'isolationLevel'> & {
|
|
82
|
+
node: number;
|
|
83
|
+
topics: FetchRequestTopic[];
|
|
84
|
+
};
|
|
85
|
+
export interface CommitOptionsPartition extends TopicWithPartitionAndOffset {
|
|
86
|
+
leaderEpoch: number;
|
|
87
|
+
}
|
|
88
|
+
export interface CommitOptions {
|
|
89
|
+
offsets: CommitOptionsPartition[];
|
|
90
|
+
}
|
|
91
|
+
export interface ListCommitsOptions {
|
|
92
|
+
topics: GroupAssignment[];
|
|
93
|
+
}
|
|
94
|
+
export interface ListOffsetsOptions {
|
|
95
|
+
topics: string[];
|
|
96
|
+
partitions?: Record<string, number[]>;
|
|
97
|
+
timestamp?: bigint;
|
|
98
|
+
isolationLevel?: FetchIsolationLevel;
|
|
99
|
+
}
|
|
100
|
+
export type GetLagOptions = Omit<ListOffsetsOptions, 'timestamp' | 'isolationLevel'>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
type RegistryContentType = 'application/openmetrics-text; version=1.0.0; charset=utf-8' | 'text/plain; version=0.0.4; charset=utf-8';
|
|
2
|
+
export interface Metric {
|
|
3
|
+
name?: string;
|
|
4
|
+
get(): Promise<unknown>;
|
|
5
|
+
reset: () => void;
|
|
6
|
+
labels(labels: any): any;
|
|
7
|
+
}
|
|
8
|
+
export interface Counter extends Metric {
|
|
9
|
+
inc: (value?: number) => void;
|
|
10
|
+
}
|
|
11
|
+
export interface Gauge extends Metric {
|
|
12
|
+
inc: (value?: number) => void;
|
|
13
|
+
dec: (value?: number) => void;
|
|
14
|
+
}
|
|
15
|
+
export interface Histogram extends Metric {
|
|
16
|
+
observe: (value: number) => void;
|
|
17
|
+
}
|
|
18
|
+
export interface Summary {}
|
|
19
|
+
export interface Registry {
|
|
20
|
+
getSingleMetric: (name: string) => Counter | Gauge | Histogram | any;
|
|
21
|
+
metrics(): Promise<string>;
|
|
22
|
+
clear(): void;
|
|
23
|
+
resetMetrics(): void;
|
|
24
|
+
registerMetric(metric: Metric): void;
|
|
25
|
+
getMetricsAsJSON(): Promise<any>;
|
|
26
|
+
getMetricsAsArray(): any[];
|
|
27
|
+
removeSingleMetric(name: string): void;
|
|
28
|
+
setDefaultLabels(labels: object): void;
|
|
29
|
+
getSingleMetricAsString(name: string): Promise<string>;
|
|
30
|
+
readonly contentType: RegistryContentType;
|
|
31
|
+
setContentType(contentType: RegistryContentType): void;
|
|
32
|
+
}
|
|
33
|
+
export interface Prometheus {
|
|
34
|
+
Counter: new (options: {
|
|
35
|
+
name: string;
|
|
36
|
+
help: string;
|
|
37
|
+
registers: Registry[];
|
|
38
|
+
labelNames?: string[];
|
|
39
|
+
}) => Counter;
|
|
40
|
+
Gauge: new (options: {
|
|
41
|
+
name: string;
|
|
42
|
+
help: string;
|
|
43
|
+
registers: Registry[];
|
|
44
|
+
labelNames?: string[];
|
|
45
|
+
}) => Gauge;
|
|
46
|
+
Histogram: new (options: {
|
|
47
|
+
name: string;
|
|
48
|
+
help: string;
|
|
49
|
+
registers: Registry[];
|
|
50
|
+
labelNames?: string[];
|
|
51
|
+
}) => Histogram;
|
|
52
|
+
Registry: new (contentType?: string) => Registry;
|
|
53
|
+
}
|
|
54
|
+
export interface Metrics {
|
|
55
|
+
registry: Registry;
|
|
56
|
+
client: Prometheus;
|
|
57
|
+
labels?: Record<string, any>;
|
|
58
|
+
}
|
|
59
|
+
export declare function ensureMetric<MetricType extends Metric>(metrics: Metrics, type: 'Gauge' | 'Counter' | 'Histogram', name: string, help: string): MetricType;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
export declare const produceOptionsProperties: {
|
|
2
|
+
producerId: {
|
|
3
|
+
bigint: boolean;
|
|
4
|
+
};
|
|
5
|
+
producerEpoch: {
|
|
6
|
+
type: string;
|
|
7
|
+
};
|
|
8
|
+
idempotent: {
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
acks: {
|
|
12
|
+
type: string;
|
|
13
|
+
enumeration: {
|
|
14
|
+
allowed: number[];
|
|
15
|
+
errorMessage: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
compression: {
|
|
19
|
+
type: string;
|
|
20
|
+
enumeration: {
|
|
21
|
+
allowed: import("../../protocol/compression").CompressionAlgorithmValue[];
|
|
22
|
+
errorMessage: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
partitioner: {
|
|
26
|
+
function: boolean;
|
|
27
|
+
};
|
|
28
|
+
autocreateTopics: {
|
|
29
|
+
type: string;
|
|
30
|
+
};
|
|
31
|
+
repeatOnStaleMetadata: {
|
|
32
|
+
type: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export declare const produceOptionsSchema: {
|
|
36
|
+
type: string;
|
|
37
|
+
properties: {
|
|
38
|
+
producerId: {
|
|
39
|
+
bigint: boolean;
|
|
40
|
+
};
|
|
41
|
+
producerEpoch: {
|
|
42
|
+
type: string;
|
|
43
|
+
};
|
|
44
|
+
idempotent: {
|
|
45
|
+
type: string;
|
|
46
|
+
};
|
|
47
|
+
acks: {
|
|
48
|
+
type: string;
|
|
49
|
+
enumeration: {
|
|
50
|
+
allowed: number[];
|
|
51
|
+
errorMessage: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
compression: {
|
|
55
|
+
type: string;
|
|
56
|
+
enumeration: {
|
|
57
|
+
allowed: import("../../protocol/compression").CompressionAlgorithmValue[];
|
|
58
|
+
errorMessage: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
partitioner: {
|
|
62
|
+
function: boolean;
|
|
63
|
+
};
|
|
64
|
+
autocreateTopics: {
|
|
65
|
+
type: string;
|
|
66
|
+
};
|
|
67
|
+
repeatOnStaleMetadata: {
|
|
68
|
+
type: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
additionalProperties: boolean;
|
|
72
|
+
};
|
|
73
|
+
export declare const produceOptionsValidator: import("ajv").ValidateFunction<unknown>;
|
|
74
|
+
export declare const producerOptionsValidator: import("ajv").ValidateFunction<unknown>;
|
|
75
|
+
export declare const sendOptionsSchema: {
|
|
76
|
+
type: string;
|
|
77
|
+
properties: {
|
|
78
|
+
producerId: {
|
|
79
|
+
bigint: boolean;
|
|
80
|
+
};
|
|
81
|
+
producerEpoch: {
|
|
82
|
+
type: string;
|
|
83
|
+
};
|
|
84
|
+
idempotent: {
|
|
85
|
+
type: string;
|
|
86
|
+
};
|
|
87
|
+
acks: {
|
|
88
|
+
type: string;
|
|
89
|
+
enumeration: {
|
|
90
|
+
allowed: number[];
|
|
91
|
+
errorMessage: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
compression: {
|
|
95
|
+
type: string;
|
|
96
|
+
enumeration: {
|
|
97
|
+
allowed: import("../../protocol/compression").CompressionAlgorithmValue[];
|
|
98
|
+
errorMessage: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
partitioner: {
|
|
102
|
+
function: boolean;
|
|
103
|
+
};
|
|
104
|
+
autocreateTopics: {
|
|
105
|
+
type: string;
|
|
106
|
+
};
|
|
107
|
+
repeatOnStaleMetadata: {
|
|
108
|
+
type: string;
|
|
109
|
+
};
|
|
110
|
+
messages: {
|
|
111
|
+
type: string;
|
|
112
|
+
items: {
|
|
113
|
+
type: string;
|
|
114
|
+
properties: {
|
|
115
|
+
key: {
|
|
116
|
+
oneOf: ({
|
|
117
|
+
type: string;
|
|
118
|
+
buffer?: undefined;
|
|
119
|
+
} | {
|
|
120
|
+
buffer: boolean;
|
|
121
|
+
type?: undefined;
|
|
122
|
+
})[];
|
|
123
|
+
};
|
|
124
|
+
value: {
|
|
125
|
+
oneOf: ({
|
|
126
|
+
type: string;
|
|
127
|
+
buffer?: undefined;
|
|
128
|
+
} | {
|
|
129
|
+
buffer: boolean;
|
|
130
|
+
type?: undefined;
|
|
131
|
+
})[];
|
|
132
|
+
};
|
|
133
|
+
headers: {
|
|
134
|
+
anyOf: ({
|
|
135
|
+
map: boolean;
|
|
136
|
+
type?: undefined;
|
|
137
|
+
additionalProperties?: undefined;
|
|
138
|
+
} | {
|
|
139
|
+
type: string;
|
|
140
|
+
additionalProperties: boolean;
|
|
141
|
+
map?: undefined;
|
|
142
|
+
})[];
|
|
143
|
+
};
|
|
144
|
+
topic: {
|
|
145
|
+
type: string;
|
|
146
|
+
};
|
|
147
|
+
partition: {
|
|
148
|
+
type: string;
|
|
149
|
+
};
|
|
150
|
+
timestamp: {
|
|
151
|
+
bigint: boolean;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
required: string[];
|
|
155
|
+
additionalProperties: boolean;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
required: string[];
|
|
160
|
+
additionalProperties: boolean;
|
|
161
|
+
};
|
|
162
|
+
export declare const sendOptionsValidator: import("ajv").ValidateFunction<{
|
|
163
|
+
[x: string]: {};
|
|
164
|
+
}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type CallbackWithPromise } from "../../apis/callbacks";
|
|
2
|
+
import { Base } from "../base/base";
|
|
3
|
+
import { type ProduceOptions, type ProduceResult, type ProducerInfo, type ProducerOptions, type SendOptions } from "./types";
|
|
4
|
+
export declare function noopSerializer(data?: Buffer): Buffer | undefined;
|
|
5
|
+
export declare class Producer<Key = Buffer, Value = Buffer, HeaderKey = Buffer, HeaderValue = Buffer> extends Base<ProducerOptions<Key, Value, HeaderKey, HeaderValue>> {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(options: ProducerOptions<Key, Value, HeaderKey, HeaderValue>);
|
|
8
|
+
get producerId(): bigint | undefined;
|
|
9
|
+
get producerEpoch(): number | undefined;
|
|
10
|
+
close(callback: CallbackWithPromise<void>): void;
|
|
11
|
+
close(): Promise<void>;
|
|
12
|
+
initIdempotentProducer(options: ProduceOptions<Key, Value, HeaderKey, HeaderValue>, callback: CallbackWithPromise<ProducerInfo>): void;
|
|
13
|
+
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>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type CompressionAlgorithmValue } from "../../protocol/compression";
|
|
2
|
+
import { type MessageToProduce } from "../../protocol/records";
|
|
3
|
+
import { type BaseOptions, type TopicWithPartitionAndOffset } from "../base/types";
|
|
4
|
+
import { type Serializers } from "../serde";
|
|
5
|
+
export interface ProducerInfo {
|
|
6
|
+
producerId: bigint;
|
|
7
|
+
producerEpoch: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ProduceResult {
|
|
10
|
+
offsets?: TopicWithPartitionAndOffset[];
|
|
11
|
+
unwritableNodes?: number[];
|
|
12
|
+
}
|
|
13
|
+
export type Partitioner<Key, Value, HeaderKey, HeaderValue> = (message: MessageToProduce<Key, Value, HeaderKey, HeaderValue>) => number;
|
|
14
|
+
export interface ProduceOptions<Key, Value, HeaderKey, HeaderValue> {
|
|
15
|
+
producerId?: bigint;
|
|
16
|
+
producerEpoch?: number;
|
|
17
|
+
idempotent?: boolean;
|
|
18
|
+
acks?: number;
|
|
19
|
+
compression?: CompressionAlgorithmValue;
|
|
20
|
+
partitioner?: Partitioner<Key, Value, HeaderKey, HeaderValue>;
|
|
21
|
+
autocreateTopics?: boolean;
|
|
22
|
+
repeatOnStaleMetadata?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export type ProducerOptions<Key, Value, HeaderKey, HeaderValue> = BaseOptions & ProduceOptions<Key, Value, HeaderKey, HeaderValue> & {
|
|
25
|
+
serializers?: Partial<Serializers<Key, Value, HeaderKey, HeaderValue>>;
|
|
26
|
+
};
|
|
27
|
+
export type SendOptions<Key, Value, HeaderKey, HeaderValue> = {
|
|
28
|
+
messages: MessageToProduce<Key, Value, HeaderKey, HeaderValue>[];
|
|
29
|
+
} & ProduceOptions<Key, Value, HeaderKey, HeaderValue>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type Serializer<InputType = unknown> = (data?: InputType) => Buffer | undefined;
|
|
2
|
+
export type Deserializer<OutputType = unknown> = (data?: Buffer) => OutputType | undefined;
|
|
3
|
+
export type SerializerWithHeaders<InputType = unknown, HeaderKey = unknown, HeaderValue = unknown> = (data?: InputType, headers?: Map<HeaderKey, HeaderValue>) => Buffer | undefined;
|
|
4
|
+
export type DeserializerWithHeaders<OutputType = unknown, HeaderKey = unknown, HeaderValue = unknown> = (data?: Buffer, headers?: Map<HeaderKey, HeaderValue>) => OutputType | undefined;
|
|
5
|
+
export interface Serializers<Key, Value, HeaderKey, HeaderValue> {
|
|
6
|
+
key: SerializerWithHeaders<Key, HeaderKey, HeaderValue>;
|
|
7
|
+
value: SerializerWithHeaders<Value, HeaderKey, HeaderValue>;
|
|
8
|
+
headerKey: Serializer<HeaderKey>;
|
|
9
|
+
headerValue: Serializer<HeaderValue>;
|
|
10
|
+
}
|
|
11
|
+
export interface Deserializers<Key, Value, HeaderKey, HeaderValue> {
|
|
12
|
+
key: DeserializerWithHeaders<Key>;
|
|
13
|
+
value: DeserializerWithHeaders<Value>;
|
|
14
|
+
headerKey: Deserializer<HeaderKey>;
|
|
15
|
+
headerValue: Deserializer<HeaderValue>;
|
|
16
|
+
}
|
|
17
|
+
export declare function stringSerializer(data?: string): Buffer | undefined;
|
|
18
|
+
export declare function stringDeserializer(data?: string | Buffer): string | undefined;
|
|
19
|
+
export declare function jsonSerializer<T = Record<string, any>>(data?: T): Buffer | undefined;
|
|
20
|
+
export declare function jsonDeserializer<T = Record<string, any>>(data?: string | Buffer): T | undefined;
|
|
21
|
+
export declare function serializersFrom<T>(serializer: Serializer<T>): Serializers<T, T, T, T>;
|
|
22
|
+
export declare function deserializersFrom<T>(deserializer: Deserializer<T>): Deserializers<T, T, T, T>;
|
|
23
|
+
export declare const serdeProperties: {
|
|
24
|
+
type: string;
|
|
25
|
+
properties: {
|
|
26
|
+
key: {
|
|
27
|
+
function: boolean;
|
|
28
|
+
};
|
|
29
|
+
value: {
|
|
30
|
+
function: boolean;
|
|
31
|
+
};
|
|
32
|
+
headerKey: {
|
|
33
|
+
function: boolean;
|
|
34
|
+
};
|
|
35
|
+
headerValue: {
|
|
36
|
+
function: boolean;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
additionalProperties: boolean;
|
|
40
|
+
};
|
|
41
|
+
export declare const stringSerializers: Serializers<string, string, string, string>;
|
|
42
|
+
export declare const stringDeserializers: Deserializers<string, string, string, string>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type Channel, type TracingChannel } from 'node:diagnostics_channel';
|
|
2
|
+
import { type Base } from "./clients/base/base";
|
|
3
|
+
import { type ConnectionPool } from "./network/connection-pool";
|
|
4
|
+
import { type Connection } from "./network/connection";
|
|
5
|
+
export type ClientType = 'base' | 'producer' | 'consumer' | 'admin';
|
|
6
|
+
export interface CreationEvent<InstanceType> {
|
|
7
|
+
type: ClientType | 'connection' | 'connectionPool';
|
|
8
|
+
instance: InstanceType;
|
|
9
|
+
}
|
|
10
|
+
export type ConnectionDiagnosticEvent<Attributes = Record<string, unknown>> = {
|
|
11
|
+
connection: Connection;
|
|
12
|
+
} & Attributes;
|
|
13
|
+
export type ConnectionPoolDiagnosticEvent<Attributes = Record<string, unknown>> = {
|
|
14
|
+
connectionPool: ConnectionPool;
|
|
15
|
+
} & Attributes;
|
|
16
|
+
export type ClientDiagnosticEvent<InstanceType extends Base = Base, Attributes = Record<string, unknown>> = {
|
|
17
|
+
client: InstanceType;
|
|
18
|
+
} & Attributes;
|
|
19
|
+
export type ChannelWithName<EventType extends object> = Channel<string, EventType> & {
|
|
20
|
+
name: string;
|
|
21
|
+
};
|
|
22
|
+
export type TracingChannelWithName<EventType extends object> = TracingChannel<string, EventType> & {
|
|
23
|
+
name: string;
|
|
24
|
+
};
|
|
25
|
+
export type DiagnosticContext<BaseContext = {}> = BaseContext & {
|
|
26
|
+
operationId: bigint;
|
|
27
|
+
result?: unknown;
|
|
28
|
+
error?: unknown;
|
|
29
|
+
};
|
|
30
|
+
export declare const channelsNamespace: "plt:kafka";
|
|
31
|
+
export declare function createDiagnosticContext<BaseContext = {}>(context: BaseContext): DiagnosticContext<BaseContext>;
|
|
32
|
+
export declare function notifyCreation<InstanceType>(type: ClientType | 'connection' | 'connection-pool' | 'messages-stream', instance: InstanceType): void;
|
|
33
|
+
export declare function createChannel<DiagnosticEvent extends object>(name: string): ChannelWithName<DiagnosticEvent>;
|
|
34
|
+
export declare function createTracingChannel<DiagnosticEvent extends object>(name: string): TracingChannelWithName<DiagnosticEvent>;
|
|
35
|
+
export declare const instancesChannel: ChannelWithName<object>;
|
|
36
|
+
export declare const connectionsConnectsChannel: TracingChannelWithName<ConnectionDiagnosticEvent<Record<string, unknown>>>;
|
|
37
|
+
export declare const connectionsApiChannel: TracingChannelWithName<ConnectionDiagnosticEvent<Record<string, unknown>>>;
|
|
38
|
+
export declare const connectionsPoolGetsChannel: TracingChannelWithName<ConnectionPoolDiagnosticEvent<Record<string, unknown>>>;
|
|
39
|
+
export declare const baseApisChannel: TracingChannelWithName<ClientDiagnosticEvent<Base<import("./index").BaseOptions>, Record<string, unknown>>>;
|
|
40
|
+
export declare const baseMetadataChannel: TracingChannelWithName<ClientDiagnosticEvent<Base<import("./index").BaseOptions>, Record<string, unknown>>>;
|
|
41
|
+
export declare const adminTopicsChannel: TracingChannelWithName<ClientDiagnosticEvent<Base<import("./index").BaseOptions>, Record<string, unknown>>>;
|
|
42
|
+
export declare const adminGroupsChannel: TracingChannelWithName<ClientDiagnosticEvent<Base<import("./index").BaseOptions>, Record<string, unknown>>>;
|
|
43
|
+
export declare const adminClientQuotasChannel: TracingChannelWithName<ClientDiagnosticEvent<Base<import("./index").BaseOptions>, Record<string, unknown>>>;
|
|
44
|
+
export declare const adminLogDirsChannel: TracingChannelWithName<ClientDiagnosticEvent<Base<import("./index").BaseOptions>, Record<string, unknown>>>;
|
|
45
|
+
export declare const producerInitIdempotentChannel: TracingChannelWithName<ClientDiagnosticEvent<Base<import("./index").BaseOptions>, Record<string, unknown>>>;
|
|
46
|
+
export declare const producerSendsChannel: TracingChannelWithName<ClientDiagnosticEvent<Base<import("./index").BaseOptions>, Record<string, unknown>>>;
|
|
47
|
+
export declare const consumerGroupChannel: TracingChannelWithName<ClientDiagnosticEvent<Base<import("./index").BaseOptions>, Record<string, unknown>>>;
|
|
48
|
+
export declare const consumerHeartbeatChannel: TracingChannelWithName<ClientDiagnosticEvent<Base<import("./index").BaseOptions>, Record<string, unknown>>>;
|
|
49
|
+
export declare const consumerReceivesChannel: TracingChannelWithName<ClientDiagnosticEvent<Base<import("./index").BaseOptions>, Record<string, unknown>>>;
|
|
50
|
+
export declare const consumerFetchesChannel: TracingChannelWithName<ClientDiagnosticEvent<Base<import("./index").BaseOptions>, Record<string, unknown>>>;
|
|
51
|
+
export declare const consumerConsumesChannel: TracingChannelWithName<ClientDiagnosticEvent<Base<import("./index").BaseOptions>, Record<string, unknown>>>;
|
|
52
|
+
export declare const consumerCommitsChannel: TracingChannelWithName<ClientDiagnosticEvent<Base<import("./index").BaseOptions>, Record<string, unknown>>>;
|
|
53
|
+
export declare const consumerOffsetsChannel: TracingChannelWithName<ClientDiagnosticEvent<Base<import("./index").BaseOptions>, Record<string, unknown>>>;
|
|
54
|
+
export declare const consumerLagChannel: ChannelWithName<ClientDiagnosticEvent<Base<import("./index").BaseOptions>, Record<string, unknown>>>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type NullableString } from "./protocol/definitions";
|
|
2
|
+
declare const kGenericError: unique symbol;
|
|
3
|
+
declare const kMultipleErrors: unique symbol;
|
|
4
|
+
export declare const ERROR_PREFIX = "PLT_KFK_";
|
|
5
|
+
export declare const errorCodes: readonly ["PLT_KFK_AUTHENTICATION", "PLT_KFK_MULTIPLE", "PLT_KFK_NETWORK", "PLT_KFK_OUT_OF_BOUNDS", "PLT_KFK_PROTOCOL", "PLT_KFK_RESPONSE", "PLT_KFK_TIMEOUT", "PLT_KFK_UNEXPECTED_CORRELATION_ID", "PLT_KFK_UNFINISHED_WRITE_BUFFER", "PLT_KFK_UNSUPPORTED_API", "PLT_KFK_UNSUPPORTED_COMPRESSION", "PLT_KFK_UNSUPPORTED", "PLT_KFK_USER"];
|
|
6
|
+
export type ErrorCode = (typeof errorCodes)[number];
|
|
7
|
+
export type ErrorProperties = {
|
|
8
|
+
cause?: Error;
|
|
9
|
+
} & Record<string, any>;
|
|
10
|
+
export declare class GenericError extends Error {
|
|
11
|
+
code: string;
|
|
12
|
+
[index: string]: any;
|
|
13
|
+
[kGenericError]: true;
|
|
14
|
+
static isGenericError(error: Error): error is GenericError | MultipleErrors;
|
|
15
|
+
constructor(code: ErrorCode, message: string, {
|
|
16
|
+
cause,
|
|
17
|
+
...rest
|
|
18
|
+
}?: ErrorProperties);
|
|
19
|
+
findBy<ErrorType extends GenericError = GenericError>(property: string, value: unknown): ErrorType | null;
|
|
20
|
+
}
|
|
21
|
+
export declare class MultipleErrors extends AggregateError {
|
|
22
|
+
code: string;
|
|
23
|
+
[index: string]: any;
|
|
24
|
+
[kGenericError]: true;
|
|
25
|
+
[kMultipleErrors]: true;
|
|
26
|
+
static code: ErrorCode;
|
|
27
|
+
static isGenericError(error: Error): error is GenericError | MultipleErrors;
|
|
28
|
+
static isMultipleErrors(error: Error): error is MultipleErrors;
|
|
29
|
+
constructor(message: string, errors: Error[], {
|
|
30
|
+
cause,
|
|
31
|
+
...rest
|
|
32
|
+
}?: ErrorProperties);
|
|
33
|
+
findBy<ErrorType extends GenericError | MultipleErrors = MultipleErrors>(property: string, value: unknown): ErrorType | null;
|
|
34
|
+
}
|
|
35
|
+
export * from "./protocol/errors";
|
|
36
|
+
export declare class AuthenticationError extends GenericError {
|
|
37
|
+
static code: ErrorCode;
|
|
38
|
+
constructor(message: string, properties?: ErrorProperties);
|
|
39
|
+
}
|
|
40
|
+
export declare class NetworkError extends GenericError {
|
|
41
|
+
static code: ErrorCode;
|
|
42
|
+
constructor(message: string, properties?: ErrorProperties);
|
|
43
|
+
}
|
|
44
|
+
export declare class ProtocolError extends GenericError {
|
|
45
|
+
static code: ErrorCode;
|
|
46
|
+
constructor(codeOrId: string | number, serverErrorMessage?: NullableString, properties?: ErrorProperties, response?: unknown);
|
|
47
|
+
}
|
|
48
|
+
export declare class OutOfBoundsError extends GenericError {
|
|
49
|
+
static code: ErrorCode;
|
|
50
|
+
constructor(message: string, properties?: ErrorProperties);
|
|
51
|
+
}
|
|
52
|
+
export declare class ResponseError extends MultipleErrors {
|
|
53
|
+
static code: ErrorCode;
|
|
54
|
+
constructor(apiName: number, apiVersion: number, errors: Record<string, [number, NullableString]>, response: unknown, properties?: ErrorProperties);
|
|
55
|
+
}
|
|
56
|
+
export declare class TimeoutError extends GenericError {
|
|
57
|
+
static code: ErrorCode;
|
|
58
|
+
constructor(message: string, properties?: ErrorProperties);
|
|
59
|
+
}
|
|
60
|
+
export declare class UnexpectedCorrelationIdError extends GenericError {
|
|
61
|
+
static code: ErrorCode;
|
|
62
|
+
constructor(message: string, properties?: ErrorProperties);
|
|
63
|
+
}
|
|
64
|
+
export declare class UnfinishedWriteBufferError extends GenericError {
|
|
65
|
+
static code: ErrorCode;
|
|
66
|
+
constructor(message: string, properties?: ErrorProperties);
|
|
67
|
+
}
|
|
68
|
+
export declare class UnsupportedApiError extends GenericError {
|
|
69
|
+
static code: ErrorCode;
|
|
70
|
+
constructor(message: string, properties?: ErrorProperties);
|
|
71
|
+
}
|
|
72
|
+
export declare class UnsupportedCompressionError extends GenericError {
|
|
73
|
+
static code: ErrorCode;
|
|
74
|
+
constructor(message: string, properties?: ErrorProperties);
|
|
75
|
+
}
|
|
76
|
+
export declare class UnsupportedError extends GenericError {
|
|
77
|
+
static code: ErrorCode;
|
|
78
|
+
constructor(message: string, properties?: ErrorProperties);
|
|
79
|
+
}
|
|
80
|
+
export declare class UserError extends GenericError {
|
|
81
|
+
static code: ErrorCode;
|
|
82
|
+
constructor(message: string, properties?: ErrorProperties);
|
|
83
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import EventEmitter from 'node:events';
|
|
2
|
+
import { type CallbackWithPromise } from "../apis/callbacks";
|
|
3
|
+
import { Connection, type Broker, type ConnectionOptions } from "./connection";
|
|
4
|
+
export declare class ConnectionPool extends EventEmitter {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(clientId: string, connectionOptions?: ConnectionOptions);
|
|
7
|
+
get instanceId(): number;
|
|
8
|
+
get(broker: Broker, callback: CallbackWithPromise<Connection>): void;
|
|
9
|
+
get(broker: Broker): Promise<Connection>;
|
|
10
|
+
getFirstAvailable(brokers: Broker[], callback: CallbackWithPromise<Connection>): void;
|
|
11
|
+
getFirstAvailable(brokers: Broker[]): Promise<Connection>;
|
|
12
|
+
close(callback: CallbackWithPromise<void>): void;
|
|
13
|
+
close(): Promise<void>;
|
|
14
|
+
isActive(): boolean;
|
|
15
|
+
isConnected(): boolean;
|
|
16
|
+
}
|