@platformatic/kafka 1.27.0-alpha.3 → 1.28.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/README.md +64 -0
- package/dist/apis/admin/create-acls-v2.d.ts +16 -0
- package/dist/apis/admin/create-acls-v2.js +55 -0
- package/dist/apis/admin/delete-acls-v2.d.ts +21 -0
- package/dist/apis/admin/delete-acls-v2.js +84 -0
- package/dist/apis/admin/describe-acls-v2.d.ts +17 -0
- package/dist/apis/admin/describe-acls-v2.js +66 -0
- package/dist/apis/admin/describe-cluster-v0.d.ts +23 -0
- package/dist/apis/admin/describe-cluster-v0.js +48 -0
- package/dist/apis/admin/describe-log-dirs-v2.d.ts +32 -0
- package/dist/apis/admin/describe-log-dirs-v2.js +67 -0
- package/dist/apis/admin/describe-log-dirs-v3.d.ts +32 -0
- package/dist/apis/admin/describe-log-dirs-v3.js +73 -0
- package/dist/apis/admin/index.d.ts +7 -0
- package/dist/apis/admin/index.js +7 -0
- package/dist/apis/admin/list-transactions-v0.d.ts +18 -0
- package/dist/apis/admin/list-transactions-v0.js +43 -0
- package/dist/apis/consumer/index.d.ts +8 -0
- package/dist/apis/consumer/index.js +8 -0
- package/dist/apis/consumer/join-group-v6.d.ts +27 -0
- package/dist/apis/consumer/join-group-v6.js +67 -0
- package/dist/apis/consumer/join-group-v7.d.ts +27 -0
- package/dist/apis/consumer/join-group-v7.js +68 -0
- package/dist/apis/consumer/join-group-v8.d.ts +27 -0
- package/dist/apis/consumer/join-group-v8.js +70 -0
- package/dist/apis/consumer/leave-group-v4.d.ts +22 -0
- package/dist/apis/consumer/leave-group-v4.js +56 -0
- package/dist/apis/consumer/list-offsets-v5.d.ts +30 -0
- package/dist/apis/consumer/list-offsets-v5.js +67 -0
- package/dist/apis/consumer/list-offsets-v6.d.ts +30 -0
- package/dist/apis/consumer/list-offsets-v6.js +68 -0
- package/dist/apis/consumer/list-offsets-v7.d.ts +30 -0
- package/dist/apis/consumer/list-offsets-v7.js +68 -0
- package/dist/apis/consumer/sync-group-v4.d.ts +18 -0
- package/dist/apis/consumer/sync-group-v4.js +43 -0
- package/dist/apis/enumerations.d.ts +5 -5
- package/dist/apis/producer/add-offsets-to-txn-v1.d.ts +10 -0
- package/dist/apis/producer/add-offsets-to-txn-v1.js +33 -0
- package/dist/apis/producer/add-offsets-to-txn-v2.d.ts +10 -0
- package/dist/apis/producer/add-offsets-to-txn-v2.js +33 -0
- package/dist/apis/producer/index.d.ts +3 -0
- package/dist/apis/producer/index.js +3 -0
- package/dist/apis/producer/init-producer-id-v3.d.ts +21 -0
- package/dist/apis/producer/init-producer-id-v3.js +38 -0
- package/dist/clients/admin/options.d.ts +9 -9
- package/dist/clients/consumer/consumer.js +38 -2
- package/dist/clients/consumer/messages-stream.d.ts +2 -2
- package/dist/clients/consumer/messages-stream.js +105 -21
- package/dist/clients/consumer/options.d.ts +24 -0
- package/dist/clients/consumer/options.js +3 -1
- package/dist/clients/consumer/types.d.ts +4 -1
- package/dist/clients/producer/index.d.ts +1 -0
- package/dist/clients/producer/index.js +1 -0
- package/dist/clients/producer/options.d.ts +65 -18
- package/dist/clients/producer/options.js +21 -1
- package/dist/clients/producer/producer-stream.d.ts +19 -0
- package/dist/clients/producer/producer-stream.js +187 -0
- package/dist/clients/producer/producer.d.ts +6 -3
- package/dist/clients/producer/producer.js +137 -19
- package/dist/clients/producer/types.d.ts +28 -1
- package/dist/clients/producer/types.js +6 -1
- package/dist/clients/serde.d.ts +11 -6
- package/dist/diagnostic.d.ts +2 -2
- package/dist/errors.d.ts +5 -5
- package/dist/errors.js +8 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/network/connection.d.ts +7 -6
- package/dist/network/connection.js +1 -1
- package/dist/protocol/compression.d.ts +1 -1
- package/dist/protocol/compression.js +7 -46
- package/dist/protocol/crc32c.d.ts +1 -1
- package/dist/protocol/crc32c.js +5 -6
- package/dist/protocol/definitions.d.ts +1 -1
- package/dist/protocol/definitions.js +1 -1
- package/dist/protocol/index.d.ts +0 -2
- package/dist/protocol/index.js +0 -2
- package/dist/protocol/reader.d.ts +2 -2
- package/dist/protocol/reader.js +4 -4
- package/dist/protocol/records.d.ts +11 -22
- package/dist/protocol/records.js +3 -7
- package/dist/protocol/sasl/oauth-bearer.d.ts +3 -3
- package/dist/protocol/sasl/plain.d.ts +3 -3
- package/dist/protocol/sasl/scram-sha.d.ts +3 -3
- package/dist/protocol/sasl/utils.d.ts +3 -3
- package/dist/protocol/writer.d.ts +1 -1
- package/dist/protocol/writer.js +3 -3
- package/dist/registries/abstract.d.ts +22 -0
- package/dist/registries/abstract.js +38 -0
- package/dist/registries/confluent-schema-registry.d.ts +41 -0
- package/dist/registries/confluent-schema-registry.js +222 -0
- package/dist/registries/index.d.ts +2 -0
- package/dist/registries/index.js +2 -0
- package/dist/typescript-4/dist/apis/admin/create-acls-v2.d.ts +16 -0
- package/dist/typescript-4/dist/apis/admin/delete-acls-v2.d.ts +21 -0
- package/dist/typescript-4/dist/apis/admin/describe-acls-v2.d.ts +17 -0
- package/dist/typescript-4/dist/apis/admin/describe-cluster-v0.d.ts +23 -0
- package/dist/typescript-4/dist/apis/admin/describe-log-dirs-v2.d.ts +32 -0
- package/dist/typescript-4/dist/apis/admin/describe-log-dirs-v3.d.ts +32 -0
- package/dist/typescript-4/dist/apis/admin/index.d.ts +7 -0
- package/dist/typescript-4/dist/apis/admin/list-transactions-v0.d.ts +18 -0
- package/dist/typescript-4/dist/apis/consumer/index.d.ts +8 -0
- package/dist/typescript-4/dist/apis/consumer/join-group-v6.d.ts +27 -0
- package/dist/typescript-4/dist/apis/consumer/join-group-v7.d.ts +27 -0
- package/dist/typescript-4/dist/apis/consumer/join-group-v8.d.ts +27 -0
- package/dist/typescript-4/dist/apis/consumer/leave-group-v4.d.ts +22 -0
- package/dist/typescript-4/dist/apis/consumer/list-offsets-v5.d.ts +30 -0
- package/dist/typescript-4/dist/apis/consumer/list-offsets-v6.d.ts +30 -0
- package/dist/typescript-4/dist/apis/consumer/list-offsets-v7.d.ts +30 -0
- package/dist/typescript-4/dist/apis/consumer/sync-group-v4.d.ts +18 -0
- package/dist/typescript-4/dist/apis/enumerations.d.ts +5 -5
- package/dist/typescript-4/dist/apis/producer/add-offsets-to-txn-v1.d.ts +10 -0
- package/dist/typescript-4/dist/apis/producer/add-offsets-to-txn-v2.d.ts +10 -0
- package/dist/typescript-4/dist/apis/producer/index.d.ts +3 -0
- package/dist/typescript-4/dist/apis/producer/init-producer-id-v3.d.ts +21 -0
- package/dist/typescript-4/dist/clients/admin/options.d.ts +9 -9
- package/dist/typescript-4/dist/clients/consumer/messages-stream.d.ts +2 -2
- package/dist/typescript-4/dist/clients/consumer/options.d.ts +24 -0
- package/dist/typescript-4/dist/clients/consumer/types.d.ts +4 -1
- package/dist/typescript-4/dist/clients/producer/index.d.ts +1 -0
- package/dist/typescript-4/dist/clients/producer/options.d.ts +66 -19
- package/dist/typescript-4/dist/clients/producer/producer-stream.d.ts +19 -0
- package/dist/typescript-4/dist/clients/producer/producer.d.ts +6 -3
- package/dist/typescript-4/dist/clients/producer/types.d.ts +29 -2
- package/dist/typescript-4/dist/clients/serde.d.ts +11 -6
- package/dist/typescript-4/dist/diagnostic.d.ts +2 -2
- package/dist/typescript-4/dist/errors.d.ts +5 -5
- package/dist/typescript-4/dist/index.d.ts +2 -1
- package/dist/typescript-4/dist/network/connection.d.ts +7 -6
- package/dist/typescript-4/dist/protocol/compression.d.ts +1 -1
- package/dist/typescript-4/dist/protocol/crc32c.d.ts +1 -1
- package/dist/typescript-4/dist/protocol/definitions.d.ts +1 -1
- package/dist/typescript-4/dist/protocol/index.d.ts +0 -2
- package/dist/typescript-4/dist/protocol/reader.d.ts +2 -2
- package/dist/typescript-4/dist/protocol/records.d.ts +11 -22
- package/dist/typescript-4/dist/protocol/sasl/oauth-bearer.d.ts +3 -3
- package/dist/typescript-4/dist/protocol/sasl/plain.d.ts +3 -3
- package/dist/typescript-4/dist/protocol/sasl/scram-sha.d.ts +3 -3
- package/dist/typescript-4/dist/protocol/sasl/utils.d.ts +3 -3
- package/dist/typescript-4/dist/protocol/writer.d.ts +1 -1
- package/dist/typescript-4/dist/registries/abstract.d.ts +22 -0
- package/dist/typescript-4/dist/registries/confluent-schema-registry.d.ts +41 -0
- package/dist/typescript-4/dist/registries/index.d.ts +2 -0
- package/dist/typescript-4/dist/utils.d.ts +3 -2
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +3 -0
- package/dist/version.js +1 -1
- package/package.json +14 -11
- package/dist/protocol/dynamic-buffer.d.ts +0 -65
- package/dist/protocol/dynamic-buffer.js +0 -563
- package/dist/protocol/varint.d.ts +0 -12
- package/dist/protocol/varint.js +0 -36
- package/dist/typescript-4/dist/protocol/dynamic-buffer.d.ts +0 -65
- package/dist/typescript-4/dist/protocol/varint.d.ts +0 -12
|
@@ -2,8 +2,9 @@ import { type FetchRequestTopic } from "../../apis/consumer/fetch-v17";
|
|
|
2
2
|
import { type GroupProtocols } from "../../apis/enumerations";
|
|
3
3
|
import { type ConnectionPool } from "../../network/connection-pool";
|
|
4
4
|
import { type KafkaRecord, type Message } from "../../protocol/records";
|
|
5
|
+
import { type SchemaRegistry } from "../../registries/abstract";
|
|
5
6
|
import { type BaseOptions, type ClusterMetadata, type TopicWithPartitionAndOffset } from "../base/types";
|
|
6
|
-
import { type Deserializers } from "../serde";
|
|
7
|
+
import { type BeforeDeserializationHook, type Deserializers } from "../serde";
|
|
7
8
|
export interface GroupProtocolSubscription {
|
|
8
9
|
name: string;
|
|
9
10
|
version: number;
|
|
@@ -68,6 +69,8 @@ export interface ConsumeBaseOptions<Key, Value, HeaderKey, HeaderValue> {
|
|
|
68
69
|
isolationLevel?: number;
|
|
69
70
|
deserializers?: Partial<Deserializers<Key, Value, HeaderKey, HeaderValue>>;
|
|
70
71
|
highWaterMark?: number;
|
|
72
|
+
beforeDeserialization?: BeforeDeserializationHook;
|
|
73
|
+
registry?: SchemaRegistry<unknown, unknown, Key, Value, HeaderKey, HeaderValue>;
|
|
71
74
|
}
|
|
72
75
|
export interface StreamOptions {
|
|
73
76
|
topics: string[];
|
|
@@ -121,24 +121,8 @@ export declare const sendOptionsSchema: {
|
|
|
121
121
|
items: {
|
|
122
122
|
type: string;
|
|
123
123
|
properties: {
|
|
124
|
-
key:
|
|
125
|
-
|
|
126
|
-
type: string;
|
|
127
|
-
buffer?: undefined;
|
|
128
|
-
} | {
|
|
129
|
-
buffer: boolean;
|
|
130
|
-
type?: undefined;
|
|
131
|
-
})[];
|
|
132
|
-
};
|
|
133
|
-
value: {
|
|
134
|
-
oneOf: ({
|
|
135
|
-
type: string;
|
|
136
|
-
buffer?: undefined;
|
|
137
|
-
} | {
|
|
138
|
-
buffer: boolean;
|
|
139
|
-
type?: undefined;
|
|
140
|
-
})[];
|
|
141
|
-
};
|
|
124
|
+
key: boolean;
|
|
125
|
+
value: boolean;
|
|
142
126
|
headers: {
|
|
143
127
|
anyOf: ({
|
|
144
128
|
map: boolean;
|
|
@@ -170,4 +154,67 @@ export declare const sendOptionsSchema: {
|
|
|
170
154
|
};
|
|
171
155
|
export declare const sendOptionsValidator: import("ajv").ValidateFunction<{
|
|
172
156
|
[x: string]: {};
|
|
173
|
-
}>;
|
|
157
|
+
}>;
|
|
158
|
+
export declare const defaultProducerStreamOptions: {
|
|
159
|
+
batchSize: number;
|
|
160
|
+
batchTime: number;
|
|
161
|
+
reportMode: "none";
|
|
162
|
+
};
|
|
163
|
+
export declare const producerStreamOptionsSchema: {
|
|
164
|
+
type: string;
|
|
165
|
+
properties: {
|
|
166
|
+
producerId: {
|
|
167
|
+
bigint: boolean;
|
|
168
|
+
};
|
|
169
|
+
producerEpoch: {
|
|
170
|
+
type: string;
|
|
171
|
+
};
|
|
172
|
+
idempotent: {
|
|
173
|
+
type: string;
|
|
174
|
+
};
|
|
175
|
+
transactionalId: {
|
|
176
|
+
type: string;
|
|
177
|
+
};
|
|
178
|
+
acks: {
|
|
179
|
+
type: string;
|
|
180
|
+
enumeration: {
|
|
181
|
+
allowed: (0 | 1 | -1)[];
|
|
182
|
+
errorMessage: string;
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
compression: {
|
|
186
|
+
type: string;
|
|
187
|
+
enumeration: {
|
|
188
|
+
allowed: import("../../protocol/compression").CompressionAlgorithmValue[];
|
|
189
|
+
errorMessage: string;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
partitioner: {
|
|
193
|
+
function: boolean;
|
|
194
|
+
};
|
|
195
|
+
autocreateTopics: {
|
|
196
|
+
type: string;
|
|
197
|
+
};
|
|
198
|
+
repeatOnStaleMetadata: {
|
|
199
|
+
type: string;
|
|
200
|
+
};
|
|
201
|
+
highWaterMark: {
|
|
202
|
+
type: string;
|
|
203
|
+
minimum: number;
|
|
204
|
+
};
|
|
205
|
+
batchSize: {
|
|
206
|
+
type: string;
|
|
207
|
+
minimum: number;
|
|
208
|
+
};
|
|
209
|
+
batchTime: {
|
|
210
|
+
type: string;
|
|
211
|
+
minimum: number;
|
|
212
|
+
};
|
|
213
|
+
reportMode: {
|
|
214
|
+
type: string;
|
|
215
|
+
enum: import("./types").ProducerStreamReportModeValue[];
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
additionalProperties: boolean;
|
|
219
|
+
};
|
|
220
|
+
export declare const producerStreamOptionsValidator: import("ajv").ValidateFunction<unknown>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Writable } from 'node:stream';
|
|
2
|
+
import { type CallbackWithPromise } from "../../apis/callbacks";
|
|
3
|
+
import type { MessageToProduce } from "../../protocol/records";
|
|
4
|
+
import type { Producer } from "./producer";
|
|
5
|
+
import { type ProducerStreamOptions } from "./types";
|
|
6
|
+
export declare class ProducerStream<Key = Buffer, Value = Buffer, HeaderKey = Buffer, HeaderValue = Buffer> extends Writable {
|
|
7
|
+
#private;
|
|
8
|
+
instance: number;
|
|
9
|
+
constructor(producer: Producer<Key, Value, HeaderKey, HeaderValue>, options: ProducerStreamOptions<Key, Value, HeaderKey, HeaderValue>);
|
|
10
|
+
get producer(): Producer<Key, Value, HeaderKey, HeaderValue>;
|
|
11
|
+
close(callback: CallbackWithPromise<void>): void;
|
|
12
|
+
close(): Promise<void>;
|
|
13
|
+
_write(message: MessageToProduce<Key, Value, HeaderKey, HeaderValue>, _: BufferEncoding, callback: (error?: Error | null) => void): void;
|
|
14
|
+
_writev(chunks: Array<{
|
|
15
|
+
chunk: MessageToProduce<Key, Value, HeaderKey, HeaderValue>;
|
|
16
|
+
}>, callback: (error?: Error | null) => void): void;
|
|
17
|
+
_final(callback: (error?: Error | null) => void): void;
|
|
18
|
+
_destroy(error: Error | null, callback: (error?: Error | null) => void): void;
|
|
19
|
+
}
|
|
@@ -2,8 +2,9 @@ import { type CallbackWithPromise } from "../../apis/callbacks";
|
|
|
2
2
|
import { type Message } from "../../protocol/records";
|
|
3
3
|
import { kTransaction, kTransactionAddOffsets, kTransactionAddPartitions, kTransactionCancel, kTransactionCommitOffset, kTransactionEnd, kTransactionFindCoordinator } from "../../symbols";
|
|
4
4
|
import { Base } from "../base/base";
|
|
5
|
+
import { ProducerStream } from "./producer-stream";
|
|
5
6
|
import { Transaction } from "./transaction";
|
|
6
|
-
import { type ProduceOptions, type ProduceResult, type ProducerInfo, type ProducerOptions, type SendOptions } from "./types";
|
|
7
|
+
import { type ProduceOptions, type ProduceResult, type ProducerInfo, type ProducerOptions, type ProducerStreamOptions, type SendOptions } from "./types";
|
|
7
8
|
export declare function noopSerializer(data?: Buffer): Buffer | undefined;
|
|
8
9
|
export declare class Producer<Key = Buffer, Value = Buffer, HeaderKey = Buffer, HeaderValue = Buffer> extends Base<ProducerOptions<Key, Value, HeaderKey, HeaderValue>> {
|
|
9
10
|
#private;
|
|
@@ -12,8 +13,9 @@ export declare class Producer<Key = Buffer, Value = Buffer, HeaderKey = Buffer,
|
|
|
12
13
|
get producerEpoch(): number | undefined;
|
|
13
14
|
get transaction(): Transaction<Key, Value, HeaderKey, HeaderValue> | undefined;
|
|
14
15
|
get coordinatorId(): number;
|
|
15
|
-
|
|
16
|
-
close(
|
|
16
|
+
get streamsCount(): number;
|
|
17
|
+
close(force: boolean | CallbackWithPromise<void>, callback?: CallbackWithPromise<void>): void;
|
|
18
|
+
close(force?: boolean): Promise<void>;
|
|
17
19
|
initIdempotentProducer(options: ProduceOptions<Key, Value, HeaderKey, HeaderValue>, callback: CallbackWithPromise<ProducerInfo>): void;
|
|
18
20
|
initIdempotentProducer(options: ProduceOptions<Key, Value, HeaderKey, HeaderValue>): Promise<ProducerInfo>;
|
|
19
21
|
send(options: SendOptions<Key, Value, HeaderKey, HeaderValue> & {
|
|
@@ -22,6 +24,7 @@ export declare class Producer<Key = Buffer, Value = Buffer, HeaderKey = Buffer,
|
|
|
22
24
|
send(options: SendOptions<Key, Value, HeaderKey, HeaderValue> & {
|
|
23
25
|
[kTransaction]?: number;
|
|
24
26
|
}): Promise<ProduceResult>;
|
|
27
|
+
asStream(options?: ProducerStreamOptions<Key, Value, HeaderKey, HeaderValue>): ProducerStream<Key, Value, HeaderKey, HeaderValue>;
|
|
25
28
|
beginTransaction(options: ProduceOptions<Key, Value, HeaderKey, HeaderValue>, callback: CallbackWithPromise<Transaction<Key, Value, HeaderKey, HeaderValue>>): void;
|
|
26
29
|
beginTransaction(options?: ProduceOptions<Key, Value, HeaderKey, HeaderValue>): Promise<Transaction<Key, Value, HeaderKey, HeaderValue>>;
|
|
27
30
|
[kTransactionFindCoordinator](callback: CallbackWithPromise<void>): void;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type CompressionAlgorithmValue } from "../../protocol/compression";
|
|
2
2
|
import { type MessageToProduce } from "../../protocol/records";
|
|
3
|
+
import { type SchemaRegistry } from "../../registries/abstract";
|
|
3
4
|
import { type BaseOptions, type TopicWithPartitionAndOffset } from "../base/types";
|
|
4
|
-
import { type Serializers } from "../serde";
|
|
5
|
+
import { type BeforeSerializationHook, type Serializers } from "../serde";
|
|
5
6
|
export interface ProducerInfo {
|
|
6
7
|
producerId: bigint;
|
|
7
8
|
producerEpoch: number;
|
|
@@ -12,6 +13,16 @@ export interface ProduceResult {
|
|
|
12
13
|
unwritableNodes?: number[];
|
|
13
14
|
}
|
|
14
15
|
export type Partitioner<Key, Value, HeaderKey, HeaderValue> = (message: MessageToProduce<Key, Value, HeaderKey, HeaderValue>) => number;
|
|
16
|
+
export interface ProducerStreamReport {
|
|
17
|
+
batchId: number;
|
|
18
|
+
count: number;
|
|
19
|
+
result: ProduceResult;
|
|
20
|
+
}
|
|
21
|
+
export interface ProducerStreamMessageReport<Key, Value, HeaderKey, HeaderValue> {
|
|
22
|
+
batchId: number;
|
|
23
|
+
index: number;
|
|
24
|
+
message: MessageToProduce<Key, Value, HeaderKey, HeaderValue>;
|
|
25
|
+
}
|
|
15
26
|
export interface ProduceOptions<Key, Value, HeaderKey, HeaderValue> {
|
|
16
27
|
producerId?: bigint;
|
|
17
28
|
producerEpoch?: number;
|
|
@@ -25,7 +36,23 @@ export interface ProduceOptions<Key, Value, HeaderKey, HeaderValue> {
|
|
|
25
36
|
export type ProducerOptions<Key, Value, HeaderKey, HeaderValue> = BaseOptions & ProduceOptions<Key, Value, HeaderKey, HeaderValue> & {
|
|
26
37
|
transactionalId?: string;
|
|
27
38
|
serializers?: Partial<Serializers<Key, Value, HeaderKey, HeaderValue>>;
|
|
39
|
+
beforeSerialization?: BeforeSerializationHook<Key, Value, HeaderKey, HeaderValue>;
|
|
40
|
+
registry?: SchemaRegistry<unknown, unknown, Key, Value, HeaderKey, HeaderValue>;
|
|
28
41
|
};
|
|
29
42
|
export type SendOptions<Key, Value, HeaderKey, HeaderValue> = {
|
|
30
43
|
messages: MessageToProduce<Key, Value, HeaderKey, HeaderValue>[];
|
|
31
|
-
} & ProduceOptions<Key, Value, HeaderKey, HeaderValue>;
|
|
44
|
+
} & ProduceOptions<Key, Value, HeaderKey, HeaderValue>;
|
|
45
|
+
export declare const ProducerStreamReportModes: {
|
|
46
|
+
readonly NONE: "none";
|
|
47
|
+
readonly BATCH: "batch";
|
|
48
|
+
readonly MESSAGE: "message";
|
|
49
|
+
};
|
|
50
|
+
export declare const allowedProducerStreamReportModes: ProducerStreamReportModeValue[];
|
|
51
|
+
export type ProducerStreamReportMode = keyof typeof ProducerStreamReportModes;
|
|
52
|
+
export type ProducerStreamReportModeValue = (typeof ProducerStreamReportModes)[keyof typeof ProducerStreamReportModes];
|
|
53
|
+
export type ProducerStreamOptions<Key, Value, HeaderKey, HeaderValue> = Omit<SendOptions<Key, Value, HeaderKey, HeaderValue>, 'messages'> & {
|
|
54
|
+
highWaterMark?: number;
|
|
55
|
+
batchSize?: number;
|
|
56
|
+
batchTime?: number;
|
|
57
|
+
reportMode?: ProducerStreamReportModeValue;
|
|
58
|
+
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
1
|
+
import { type Callback } from "../apis/definitions";
|
|
2
|
+
import { type MessageToConsume, type MessageToProduce } from "../protocol/records";
|
|
3
|
+
export type Serializer<InputType = unknown> = (data?: InputType, metadata?: unknown) => Buffer | undefined;
|
|
4
|
+
export type SerializerWithHeaders<InputType = unknown, HeaderKey = unknown, HeaderValue = unknown> = (data?: InputType, headers?: Map<HeaderKey, HeaderValue>, message?: MessageToProduce<unknown, unknown, unknown, unknown>) => Buffer | undefined;
|
|
5
|
+
export type Deserializer<OutputType = unknown> = (data?: Buffer, message?: MessageToConsume) => OutputType | undefined;
|
|
6
|
+
export type DeserializerWithHeaders<OutputType = unknown, HeaderKey = unknown, HeaderValue = unknown> = (data?: Buffer, headers?: Map<HeaderKey, HeaderValue>, message?: MessageToConsume) => OutputType | undefined;
|
|
5
7
|
export interface Serializers<Key, Value, HeaderKey, HeaderValue> {
|
|
6
8
|
key: SerializerWithHeaders<Key, HeaderKey, HeaderValue>;
|
|
7
9
|
value: SerializerWithHeaders<Value, HeaderKey, HeaderValue>;
|
|
@@ -9,11 +11,14 @@ export interface Serializers<Key, Value, HeaderKey, HeaderValue> {
|
|
|
9
11
|
headerValue: Serializer<HeaderValue>;
|
|
10
12
|
}
|
|
11
13
|
export interface Deserializers<Key, Value, HeaderKey, HeaderValue> {
|
|
12
|
-
key: DeserializerWithHeaders<Key>;
|
|
13
|
-
value: DeserializerWithHeaders<Value>;
|
|
14
|
+
key: DeserializerWithHeaders<Key, HeaderKey, HeaderValue>;
|
|
15
|
+
value: DeserializerWithHeaders<Value, HeaderKey, HeaderValue>;
|
|
14
16
|
headerKey: Deserializer<HeaderKey>;
|
|
15
17
|
headerValue: Deserializer<HeaderValue>;
|
|
16
18
|
}
|
|
19
|
+
export type BeforeHookPayloadType = 'key' | 'value' | 'headerKey' | 'headerValue';
|
|
20
|
+
export type BeforeDeserializationHook = (payload: Buffer, type: BeforeHookPayloadType, message: MessageToConsume, callback: Callback<void>) => void | Promise<void>;
|
|
21
|
+
export type BeforeSerializationHook<Key, Value, HeaderKey, HeaderValue> = (payload: unknown, type: BeforeHookPayloadType, message: MessageToProduce<Key, Value, HeaderKey, HeaderValue>, callback: Callback<void>) => void | Promise<void>;
|
|
17
22
|
export declare function stringSerializer(data?: string): Buffer | undefined;
|
|
18
23
|
export declare function stringDeserializer(data?: string | Buffer): string | undefined;
|
|
19
24
|
export declare function jsonSerializer<T = Record<string, any>>(data?: T): Buffer | undefined;
|
|
@@ -4,7 +4,7 @@ import { type ConnectionPool } from "./network/connection-pool";
|
|
|
4
4
|
import { type Connection } from "./network/connection";
|
|
5
5
|
export type ClientType = 'base' | 'producer' | 'consumer' | 'admin';
|
|
6
6
|
export interface CreationEvent<InstanceType> {
|
|
7
|
-
type: ClientType | 'connection' | '
|
|
7
|
+
type: ClientType | 'connection' | 'connection-pool' | 'messages-stream' | 'producer-stream';
|
|
8
8
|
instance: InstanceType;
|
|
9
9
|
}
|
|
10
10
|
export type ConnectionDiagnosticEvent<Attributes = Record<string, unknown>> = {
|
|
@@ -29,7 +29,7 @@ export type DiagnosticContext<BaseContext = {}> = BaseContext & {
|
|
|
29
29
|
};
|
|
30
30
|
export declare const channelsNamespace: "plt:kafka";
|
|
31
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;
|
|
32
|
+
export declare function notifyCreation<InstanceType>(type: ClientType | 'connection' | 'connection-pool' | 'messages-stream' | 'producer-stream', instance: InstanceType): void;
|
|
33
33
|
export declare function createChannel<DiagnosticEvent extends object>(name: string): ChannelWithName<DiagnosticEvent>;
|
|
34
34
|
export declare function createTracingChannel<DiagnosticEvent extends object>(name: string): TracingChannelWithName<DiagnosticEvent>;
|
|
35
35
|
export declare const instancesChannel: ChannelWithName<object>;
|
|
@@ -2,7 +2,7 @@ import { type NullableString } from "./protocol/definitions";
|
|
|
2
2
|
declare const kGenericError: unique symbol;
|
|
3
3
|
declare const kMultipleErrors: unique symbol;
|
|
4
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"];
|
|
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_FORMAT", "PLT_KFK_UNSUPPORTED", "PLT_KFK_USER"];
|
|
6
6
|
export type ErrorCode = (typeof errorCodes)[number];
|
|
7
7
|
export type ErrorProperties = {
|
|
8
8
|
cause?: Error;
|
|
@@ -45,10 +45,6 @@ export declare class ProtocolError extends GenericError {
|
|
|
45
45
|
static code: ErrorCode;
|
|
46
46
|
constructor(codeOrId: string | number, serverErrorMessage?: NullableString, properties?: ErrorProperties, response?: unknown);
|
|
47
47
|
}
|
|
48
|
-
export declare class OutOfBoundsError extends GenericError {
|
|
49
|
-
static code: ErrorCode;
|
|
50
|
-
constructor(message: string, properties?: ErrorProperties);
|
|
51
|
-
}
|
|
52
48
|
export declare class ResponseError extends MultipleErrors {
|
|
53
49
|
static code: ErrorCode;
|
|
54
50
|
constructor(apiName: number, apiVersion: number, errors: Record<string, [number, NullableString]>, response: unknown, properties?: ErrorProperties);
|
|
@@ -73,6 +69,10 @@ export declare class UnsupportedCompressionError extends GenericError {
|
|
|
73
69
|
static code: ErrorCode;
|
|
74
70
|
constructor(message: string, properties?: ErrorProperties);
|
|
75
71
|
}
|
|
72
|
+
export declare class UnsupportedFormatError extends GenericError {
|
|
73
|
+
static code: ErrorCode;
|
|
74
|
+
constructor(message: string, properties?: ErrorProperties);
|
|
75
|
+
}
|
|
76
76
|
export declare class UnsupportedError extends GenericError {
|
|
77
77
|
static code: ErrorCode;
|
|
78
78
|
constructor(message: string, properties?: ErrorProperties);
|
|
@@ -20,18 +20,19 @@ export interface ConnectionEvents extends TypedEvents {
|
|
|
20
20
|
'sasl:authentication:extended': (authBytes?: Buffer) => void;
|
|
21
21
|
drain: () => void;
|
|
22
22
|
}
|
|
23
|
-
export type
|
|
23
|
+
export type CredentialProvider<T = string> = () => T | Promise<T>;
|
|
24
|
+
export type SASLCredentialProvider<T> = CredentialProvider<T>;
|
|
24
25
|
export interface Broker {
|
|
25
26
|
host: string;
|
|
26
27
|
port: number;
|
|
27
28
|
}
|
|
28
|
-
export type SASLCustomAuthenticator = (mechanism: SASLMechanismValue, connection: Connection, authenticate: SASLAuthenticationAPI, usernameProvider: string |
|
|
29
|
+
export type SASLCustomAuthenticator = (mechanism: SASLMechanismValue, connection: Connection, authenticate: SASLAuthenticationAPI, usernameProvider: string | CredentialProvider | undefined, passwordProvider: string | CredentialProvider | undefined, tokenProvider: string | CredentialProvider | undefined, callback: CallbackWithPromise<SaslAuthenticateResponse>) => void;
|
|
29
30
|
export interface SASLOptions {
|
|
30
31
|
mechanism: SASLMechanismValue;
|
|
31
|
-
username?: string |
|
|
32
|
-
password?: string |
|
|
33
|
-
token?: string |
|
|
34
|
-
oauthBearerExtensions?: Record<string, string> |
|
|
32
|
+
username?: string | CredentialProvider;
|
|
33
|
+
password?: string | CredentialProvider;
|
|
34
|
+
token?: string | CredentialProvider;
|
|
35
|
+
oauthBearerExtensions?: Record<string, string> | CredentialProvider<Record<string, string>>;
|
|
35
36
|
authenticate?: SASLCustomAuthenticator;
|
|
36
37
|
authBytesValidator?: (authBytes: Buffer, callback: CallbackWithPromise<Buffer>) => void;
|
|
37
38
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DynamicBuffer } from
|
|
1
|
+
import { DynamicBuffer } from '@platformatic/dynamic-buffer';
|
|
2
2
|
export type SyncCompressionPhase = (data: Buffer | DynamicBuffer) => Buffer;
|
|
3
3
|
export type CompressionOperation = (data: Buffer) => Buffer;
|
|
4
4
|
export interface CompressionAlgorithmSpecification {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DynamicBuffer } from
|
|
1
|
+
import { DynamicBuffer } from '@platformatic/dynamic-buffer';
|
|
2
2
|
export declare function loadNativeCRC32C(): typeof jsCRC32C | null;
|
|
3
3
|
export declare function jsCRC32C(data: Buffer | Uint8Array | DynamicBuffer): number;
|
|
4
4
|
export declare const crc32c: typeof jsCRC32C;
|
|
@@ -2,7 +2,6 @@ export * from "./apis";
|
|
|
2
2
|
export * from "./compression";
|
|
3
3
|
export * from "./crc32c";
|
|
4
4
|
export * from "./definitions";
|
|
5
|
-
export * from "./dynamic-buffer";
|
|
6
5
|
export * from "./errors";
|
|
7
6
|
export * from "./murmur2";
|
|
8
7
|
export * from "./reader";
|
|
@@ -11,5 +10,4 @@ export * as saslOAuthBearer from "./sasl/oauth-bearer";
|
|
|
11
10
|
export * as saslPlain from "./sasl/plain";
|
|
12
11
|
export * as saslScramSha from "./sasl/scram-sha";
|
|
13
12
|
export * as saslUtils from "./sasl/utils";
|
|
14
|
-
export * from "./varint";
|
|
15
13
|
export * from "./writer";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DynamicBuffer } from
|
|
1
|
+
import { DynamicBuffer } from '@platformatic/dynamic-buffer';
|
|
2
2
|
import { Writer } from "./writer";
|
|
3
3
|
export type EntryReader<OutputType> = (reader: Reader, index: number) => OutputType;
|
|
4
4
|
declare const instanceIdentifier: unique symbol;
|
|
@@ -48,7 +48,7 @@ export declare class Reader {
|
|
|
48
48
|
readUUID(): string;
|
|
49
49
|
readNullableBytes(compact?: boolean): Buffer | null;
|
|
50
50
|
readBytes(compact?: boolean): Buffer;
|
|
51
|
-
readVarIntBytes(): Buffer;
|
|
51
|
+
readVarIntBytes(): Buffer | null;
|
|
52
52
|
readNullableArray<OutputType>(reader: EntryReader<OutputType>, compact?: boolean, discardTrailingTaggedFields?: boolean): OutputType[] | null;
|
|
53
53
|
readNullableMap<Key, Value>(reader: EntryReader<[Key, Value]>, compact?: boolean, discardTrailingTaggedFields?: boolean): Map<Key, Value> | null;
|
|
54
54
|
readArray<OutputType>(reader: EntryReader<OutputType>, compact?: boolean, discardTrailingTaggedFields?: boolean): OutputType[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { NumericMap } from "../utils";
|
|
2
2
|
import { type CompressionAlgorithmValue } from "./compression";
|
|
3
3
|
import { type NullableString } from "./definitions";
|
|
4
4
|
import { Reader } from "./reader";
|
|
@@ -17,6 +17,7 @@ export interface MessageBase<Key = Buffer, Value = Buffer> {
|
|
|
17
17
|
}
|
|
18
18
|
export interface MessageToProduce<Key = Buffer, Value = Buffer, HeaderKey = Buffer, HeaderValue = Buffer> extends MessageBase<Key, Value> {
|
|
19
19
|
headers?: Map<HeaderKey, HeaderValue> | Record<string, HeaderValue>;
|
|
20
|
+
metadata?: unknown;
|
|
20
21
|
}
|
|
21
22
|
export interface MessageConsumerMetadata {
|
|
22
23
|
coordinatorId: number;
|
|
@@ -63,9 +64,13 @@ export interface KafkaRecord {
|
|
|
63
64
|
attributes: number;
|
|
64
65
|
timestampDelta: bigint;
|
|
65
66
|
offsetDelta: number;
|
|
66
|
-
key: Buffer;
|
|
67
|
-
value: Buffer;
|
|
68
|
-
headers: [Buffer, Buffer][];
|
|
67
|
+
key: Buffer | null;
|
|
68
|
+
value: Buffer | null;
|
|
69
|
+
headers: [Buffer | null, Buffer | null][];
|
|
70
|
+
}
|
|
71
|
+
export interface MessageToConsume extends KafkaRecord {
|
|
72
|
+
topic: string;
|
|
73
|
+
partition: number;
|
|
69
74
|
}
|
|
70
75
|
export interface RecordsBatch {
|
|
71
76
|
firstOffset: bigint;
|
|
@@ -85,24 +90,8 @@ export interface RecordsBatch {
|
|
|
85
90
|
export declare const messageSchema: {
|
|
86
91
|
type: string;
|
|
87
92
|
properties: {
|
|
88
|
-
key:
|
|
89
|
-
|
|
90
|
-
type: string;
|
|
91
|
-
buffer?: undefined;
|
|
92
|
-
} | {
|
|
93
|
-
buffer: boolean;
|
|
94
|
-
type?: undefined;
|
|
95
|
-
})[];
|
|
96
|
-
};
|
|
97
|
-
value: {
|
|
98
|
-
oneOf: ({
|
|
99
|
-
type: string;
|
|
100
|
-
buffer?: undefined;
|
|
101
|
-
} | {
|
|
102
|
-
buffer: boolean;
|
|
103
|
-
type?: undefined;
|
|
104
|
-
})[];
|
|
105
|
-
};
|
|
93
|
+
key: boolean;
|
|
94
|
+
value: boolean;
|
|
106
95
|
headers: {
|
|
107
96
|
anyOf: ({
|
|
108
97
|
map: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CallbackWithPromise } from "../../apis/callbacks";
|
|
2
2
|
import { type SASLAuthenticationAPI, type SaslAuthenticateResponse } from "../../apis/security/sasl-authenticate-v2";
|
|
3
|
-
import { type Connection, type
|
|
3
|
+
import { type Connection, type CredentialProvider } from "../../network/connection";
|
|
4
4
|
export declare function jwtValidateAuthenticationBytes(authBytes: Buffer, callback: CallbackWithPromise<Buffer>): void;
|
|
5
|
-
export declare function authenticate(authenticateAPI: SASLAuthenticationAPI, connection: Connection, tokenOrProvider: string |
|
|
6
|
-
export declare function authenticate(authenticateAPI: SASLAuthenticationAPI, connection: Connection, tokenOrProvider: string |
|
|
5
|
+
export declare function authenticate(authenticateAPI: SASLAuthenticationAPI, connection: Connection, tokenOrProvider: string | CredentialProvider, extensions: Record<string, string> | CredentialProvider<Record<string, string>>, callback: CallbackWithPromise<SaslAuthenticateResponse>): void;
|
|
6
|
+
export declare function authenticate(authenticateAPI: SASLAuthenticationAPI, connection: Connection, tokenOrProvider: string | CredentialProvider, extensions: Record<string, string> | CredentialProvider<Record<string, string>>): Promise<SaslAuthenticateResponse>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CallbackWithPromise } from "../../apis/callbacks";
|
|
2
2
|
import { type SASLAuthenticationAPI, type SaslAuthenticateResponse } from "../../apis/security/sasl-authenticate-v2";
|
|
3
|
-
import { type Connection, type
|
|
4
|
-
export declare function authenticate(authenticateAPI: SASLAuthenticationAPI, connection: Connection, usernameProvider: string |
|
|
5
|
-
export declare function authenticate(authenticateAPI: SASLAuthenticationAPI, connection: Connection, usernameProvider: string |
|
|
3
|
+
import { type Connection, type CredentialProvider } from "../../network/connection";
|
|
4
|
+
export declare function authenticate(authenticateAPI: SASLAuthenticationAPI, connection: Connection, usernameProvider: string | CredentialProvider, passwordProvider: string | CredentialProvider, callback: CallbackWithPromise<SaslAuthenticateResponse>): void;
|
|
5
|
+
export declare function authenticate(authenticateAPI: SASLAuthenticationAPI, connection: Connection, usernameProvider: string | CredentialProvider, passwordProvider: string | CredentialProvider): Promise<SaslAuthenticateResponse>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CallbackWithPromise } from "../../apis/callbacks";
|
|
2
2
|
import { type SASLAuthenticationAPI, type SaslAuthenticateResponse } from "../../apis/security/sasl-authenticate-v2";
|
|
3
|
-
import { type Connection, type
|
|
3
|
+
import { type Connection, type CredentialProvider } from "../../network/connection";
|
|
4
4
|
export interface ScramAlgorithmDefinition {
|
|
5
5
|
keyLength: number;
|
|
6
6
|
algorithm: string;
|
|
@@ -35,5 +35,5 @@ export declare function hi(definition: ScramAlgorithmDefinition, password: strin
|
|
|
35
35
|
export declare function hmac(definition: ScramAlgorithmDefinition, key: Buffer, data: string | Buffer): Buffer;
|
|
36
36
|
export declare function xor(a: Buffer, b: Buffer): Buffer;
|
|
37
37
|
export declare const defaultCrypto: ScramCryptoModule;
|
|
38
|
-
export declare function authenticate(authenticateAPI: SASLAuthenticationAPI, connection: Connection, algorithm: ScramAlgorithm, usernameProvider: string |
|
|
39
|
-
export declare function authenticate(authenticateAPI: SASLAuthenticationAPI, connection: Connection, algorithm: ScramAlgorithm, usernameProvider: string |
|
|
38
|
+
export declare function authenticate(authenticateAPI: SASLAuthenticationAPI, connection: Connection, algorithm: ScramAlgorithm, usernameProvider: string | CredentialProvider, passwordProvider: string | CredentialProvider, crypto: ScramCryptoModule, callback: CallbackWithPromise<SaslAuthenticateResponse>): void;
|
|
39
|
+
export declare function authenticate(authenticateAPI: SASLAuthenticationAPI, connection: Connection, algorithm: ScramAlgorithm, usernameProvider: string | CredentialProvider, passwordProvider: string | CredentialProvider, crypto?: ScramCryptoModule): Promise<SaslAuthenticateResponse>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type CallbackWithPromise } from "../../apis/index";
|
|
2
|
-
import { type
|
|
3
|
-
export declare function getCredential<T>(label: string, credentialOrProvider: T |
|
|
4
|
-
export declare function getCredential<T>(label: string, credentialOrProvider: T |
|
|
2
|
+
import { type CredentialProvider } from "../../network/connection";
|
|
3
|
+
export declare function getCredential<T>(label: string, credentialOrProvider: T | CredentialProvider<T>, callback: CallbackWithPromise<T>): void;
|
|
4
|
+
export declare function getCredential<T>(label: string, credentialOrProvider: T | CredentialProvider<T>): Promise<T>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { DynamicBuffer } from '@platformatic/dynamic-buffer';
|
|
1
2
|
import { type NullableString } from "./definitions";
|
|
2
|
-
import { DynamicBuffer } from "./dynamic-buffer";
|
|
3
3
|
export type ChildrenWriter = (w: Writer) => void;
|
|
4
4
|
export type EntryWriter<InputType> = (writer: Writer, entry: InputType, index: number) => void;
|
|
5
5
|
declare const instanceIdentifier: unique symbol;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Callback } from "../apis/definitions";
|
|
2
|
+
import { type BeforeDeserializationHook, type BeforeHookPayloadType, type BeforeSerializationHook, type Deserializers, type Serializers } from "../clients/serde";
|
|
3
|
+
import { type MessageToProduce } from "../protocol/records";
|
|
4
|
+
export interface SchemaRegistry<Id = unknown, Schema = unknown, Key = Buffer, Value = Buffer, HeaderKey = Buffer, HeaderValue = Buffer> {
|
|
5
|
+
get(id: Id): Schema | undefined;
|
|
6
|
+
fetch(id: Id, callback?: (error?: Error) => void): void | Promise<void>;
|
|
7
|
+
getSchemaId(payload: Buffer | MessageToProduce<Key, Value, HeaderKey, HeaderValue>, type?: BeforeHookPayloadType): Id;
|
|
8
|
+
getSerializers(): Serializers<Key, Value, HeaderKey, HeaderValue>;
|
|
9
|
+
getDeserializers(): Deserializers<Key, Value, HeaderKey, HeaderValue>;
|
|
10
|
+
getBeforeSerializationHook(): BeforeSerializationHook<Key, Value, HeaderKey, HeaderValue>;
|
|
11
|
+
getBeforeDeserializationHook(): BeforeDeserializationHook;
|
|
12
|
+
}
|
|
13
|
+
export declare function runAsyncSeries<V>(operation: (item: V, cb: Callback<void>) => void | Promise<void>, collection: V[], index: number, callback: Callback<void>): void;
|
|
14
|
+
export declare class AbstractSchemaRegistry<Id = unknown, Schema = unknown, Key = Buffer, Value = Buffer, HeaderKey = Buffer, HeaderValue = Buffer> implements SchemaRegistry<Id, Schema, Key, Value, HeaderKey, HeaderValue> {
|
|
15
|
+
get(_: Id): Schema | undefined;
|
|
16
|
+
fetch(_i: unknown, _c?: (error?: Error) => void): void | Promise<void>;
|
|
17
|
+
getSchemaId(_p: Buffer | MessageToProduce<Key, Value, HeaderKey, HeaderValue>, _t?: BeforeHookPayloadType): Id;
|
|
18
|
+
getSerializers(): Serializers<Key, Value, HeaderKey, HeaderValue>;
|
|
19
|
+
getDeserializers(): Deserializers<Key, Value, HeaderKey, HeaderValue>;
|
|
20
|
+
getBeforeSerializationHook(): BeforeSerializationHook<Key, Value, HeaderKey, HeaderValue>;
|
|
21
|
+
getBeforeDeserializationHook(): BeforeDeserializationHook;
|
|
22
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ValidateFunction } from 'ajv';
|
|
2
|
+
import { type Type } from 'avsc';
|
|
3
|
+
import { type Root } from 'protobufjs';
|
|
4
|
+
import { type Callback } from "../apis/definitions";
|
|
5
|
+
import { type BeforeDeserializationHook, type BeforeHookPayloadType, type BeforeSerializationHook, type Deserializers, type Serializers } from "../clients/serde";
|
|
6
|
+
import { type CredentialProvider } from "../index";
|
|
7
|
+
import { type MessageToConsume, type MessageToProduce } from "../protocol/records";
|
|
8
|
+
import { AbstractSchemaRegistry } from "./abstract";
|
|
9
|
+
type ConfluentSchemaRegistryMessageToProduce = MessageToProduce<unknown, unknown, unknown, unknown>;
|
|
10
|
+
export interface ConfluentSchemaRegistryMetadata {
|
|
11
|
+
schemas?: Record<BeforeHookPayloadType, number>;
|
|
12
|
+
}
|
|
13
|
+
export type ConfluentSchemaRegistryProtobufTypeMapper = (id: number, type: BeforeHookPayloadType, context: ConfluentSchemaRegistryMessageToProduce | MessageToConsume) => string;
|
|
14
|
+
export interface ConfluentSchemaRegistryOptions {
|
|
15
|
+
url: string;
|
|
16
|
+
auth?: {
|
|
17
|
+
username?: string | CredentialProvider;
|
|
18
|
+
password?: string | CredentialProvider;
|
|
19
|
+
token?: string | CredentialProvider;
|
|
20
|
+
};
|
|
21
|
+
protobufTypeMapper?: ConfluentSchemaRegistryProtobufTypeMapper;
|
|
22
|
+
jsonValidateSend?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface Schema {
|
|
25
|
+
id: number;
|
|
26
|
+
type: 'avro' | 'protobuf' | 'json';
|
|
27
|
+
schema: Type | Root | ValidateFunction;
|
|
28
|
+
}
|
|
29
|
+
export declare function defaultProtobufTypeMapper(_: number, type: BeforeHookPayloadType, context: ConfluentSchemaRegistryMessageToProduce | MessageToConsume): string;
|
|
30
|
+
export declare class ConfluentSchemaRegistry<Key = Buffer, Value = Buffer, HeaderKey = Buffer, HeaderValue = Buffer> extends AbstractSchemaRegistry<number | undefined, Schema, Key, Value, HeaderKey, HeaderValue> {
|
|
31
|
+
#private;
|
|
32
|
+
constructor(options: ConfluentSchemaRegistryOptions);
|
|
33
|
+
getSchemaId(message: Buffer | MessageToProduce<Key, Value, HeaderKey, HeaderValue>, type?: BeforeHookPayloadType): number | undefined;
|
|
34
|
+
get(id: number): Schema | undefined;
|
|
35
|
+
fetchSchema(id: number, callback: Callback<void>): Promise<void>;
|
|
36
|
+
getSerializers(): Serializers<Key, Value, HeaderKey, HeaderValue>;
|
|
37
|
+
getDeserializers(): Deserializers<Key, Value, HeaderKey, HeaderValue>;
|
|
38
|
+
getBeforeSerializationHook(): BeforeSerializationHook<Key, Value, HeaderKey, HeaderValue>;
|
|
39
|
+
getBeforeDeserializationHook(): BeforeDeserializationHook;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { type DynamicBuffer } from '@platformatic/dynamic-buffer';
|
|
1
2
|
import { Ajv2020 } from 'ajv/dist/2020.js';
|
|
2
3
|
import debug from 'debug';
|
|
3
|
-
import { type DynamicBuffer } from "./protocol/dynamic-buffer";
|
|
4
4
|
export interface EnumerationDefinition<T> {
|
|
5
5
|
allowed: T[];
|
|
6
6
|
errorMessage?: string;
|
|
@@ -34,4 +34,5 @@ export declare function enumErrorMessage(type: Record<string, unknown>, keysOnly
|
|
|
34
34
|
export declare function groupByProperty<Key extends PropertyKey, Value>(entries: readonly Value[], property: keyof Value): [Key, Value[]][];
|
|
35
35
|
export declare function humanize(label: string, buffer: Buffer | DynamicBuffer): string;
|
|
36
36
|
export declare function setDebugDumpLogger(logger: DebugDumpLogger): void;
|
|
37
|
-
export declare function debugDump(...values: unknown[]): void;
|
|
37
|
+
export declare function debugDump(...values: unknown[]): void;
|
|
38
|
+
export declare function emitExperimentalApiWarning(api: string): void;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { type DynamicBuffer } from '@platformatic/dynamic-buffer';
|
|
1
2
|
import { Ajv2020 } from 'ajv/dist/2020.js';
|
|
2
3
|
import debug from 'debug';
|
|
3
|
-
import { type DynamicBuffer } from './protocol/dynamic-buffer.ts';
|
|
4
4
|
export interface EnumerationDefinition<T> {
|
|
5
5
|
allowed: T[];
|
|
6
6
|
errorMessage?: string;
|
|
@@ -35,3 +35,4 @@ export declare function groupByProperty<Key extends PropertyKey, Value>(entries:
|
|
|
35
35
|
export declare function humanize(label: string, buffer: Buffer | DynamicBuffer): string;
|
|
36
36
|
export declare function setDebugDumpLogger(logger: DebugDumpLogger): void;
|
|
37
37
|
export declare function debugDump(...values: unknown[]): void;
|
|
38
|
+
export declare function emitExperimentalApiWarning(api: string): void;
|
package/dist/utils.js
CHANGED
|
@@ -156,3 +156,6 @@ export function setDebugDumpLogger(logger) {
|
|
|
156
156
|
export function debugDump(...values) {
|
|
157
157
|
debugDumpLogger(new Date().toISOString(), ...values.map(v => (typeof v === 'string' ? v : inspect(v, false, 10))));
|
|
158
158
|
}
|
|
159
|
+
export function emitExperimentalApiWarning(api) {
|
|
160
|
+
process.emitWarning(`The ${api} API is experimental and does not follow semver. It may change in minor/patch releases.`);
|
|
161
|
+
}
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@platformatic/kafka";
|
|
2
|
-
export const version = "1.
|
|
2
|
+
export const version = "1.28.0";
|