@platformatic/kafka 2.2.3 → 2.3.1
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 +3 -1
- package/dist/apis/admin/create-topics-v7.js +1 -0
- package/dist/apis/callbacks.d.ts +1 -3
- package/dist/apis/callbacks.js +26 -11
- package/dist/clients/admin/admin.js +330 -356
- package/dist/clients/base/base.js +8 -1
- package/dist/clients/consumer/consumer.js +92 -4
- package/dist/clients/consumer/messages-stream.js +12 -1
- package/dist/clients/consumer/utils.d.ts +1 -0
- package/dist/clients/consumer/utils.js +6 -0
- package/dist/clients/producer/producer.js +67 -13
- package/dist/clients/serde.d.ts +1 -1
- package/dist/errors.d.ts +2 -0
- package/dist/errors.js +6 -0
- package/dist/network/connection-pool.js +9 -1
- package/dist/protocol/reader.js +4 -3
- package/dist/registries/abstract.d.ts +2 -2
- package/dist/registries/confluent-schema-registry.d.ts +1 -1
- package/dist/registries/confluent-schema-registry.js +3 -0
- package/dist/typescript-4/dist/apis/callbacks.d.ts +1 -3
- package/dist/typescript-4/dist/clients/consumer/utils.d.ts +2 -1
- package/dist/typescript-4/dist/clients/serde.d.ts +1 -1
- package/dist/typescript-4/dist/errors.d.ts +2 -0
- package/dist/typescript-4/dist/registries/abstract.d.ts +2 -2
- package/dist/typescript-4/dist/registries/confluent-schema-registry.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -16,7 +16,9 @@ A modern, high-performance, pure TypeScript/JavaScript type safe client for Apac
|
|
|
16
16
|
|
|
17
17
|
## Supported Kafka Version
|
|
18
18
|
|
|
19
|
-
Supported Kafka
|
|
19
|
+
Supported Apache Kafka versions are from **3.5.0** to **4.2.0** and equivalent, edges included.
|
|
20
|
+
|
|
21
|
+
These are tested in CI against the corresponding Confluent Platform releases, from **7.5.0** to **8.2.0** (rule of thumb: Confluent Platform version = Apache Kafka version + 4.0.0).
|
|
20
22
|
|
|
21
23
|
## Supported KIPs
|
|
22
24
|
|
package/dist/apis/callbacks.d.ts
CHANGED
|
@@ -6,6 +6,4 @@ export type CallbackWithPromise<ReturnType> = Callback<ReturnType> & {
|
|
|
6
6
|
[kCallbackPromise]?: Promise<ReturnType>;
|
|
7
7
|
};
|
|
8
8
|
export declare function createPromisifiedCallback<ReturnType>(): CallbackWithPromise<ReturnType>;
|
|
9
|
-
export declare function runConcurrentCallbacks<
|
|
10
|
-
export declare function runConcurrentCallbacks<ReturnType, V>(errorMessage: string, collection: Set<V>, operation: (item: V, cb: Callback<ReturnType>) => void, callback: Callback<ReturnType[]>): void;
|
|
11
|
-
export declare function runConcurrentCallbacks<ReturnType, V>(errorMessage: string, collection: V[], operation: (item: V, cb: Callback<ReturnType>) => void, callback: Callback<ReturnType[]>): void;
|
|
9
|
+
export declare function runConcurrentCallbacks<R, V>(errorMessage: string, collection: Iterable<V>, operation: (item: V, cb: Callback<R>) => void, callback: Callback<R[]>): void;
|
package/dist/apis/callbacks.js
CHANGED
|
@@ -19,28 +19,43 @@ export function createPromisifiedCallback() {
|
|
|
19
19
|
return callback;
|
|
20
20
|
}
|
|
21
21
|
export function runConcurrentCallbacks(errorMessage, collection, operation, callback) {
|
|
22
|
-
let
|
|
22
|
+
let allScheduled = false;
|
|
23
|
+
let completed = 0;
|
|
24
|
+
let callbackCalled = false;
|
|
23
25
|
let hasErrors = false;
|
|
24
|
-
const errors =
|
|
25
|
-
const results =
|
|
26
|
+
const errors = [];
|
|
27
|
+
const results = [];
|
|
26
28
|
let i = 0;
|
|
27
29
|
function operationCallback(index, e, result) {
|
|
28
30
|
if (e) {
|
|
29
31
|
hasErrors = true;
|
|
30
|
-
errors[index
|
|
32
|
+
errors.push([index, e]);
|
|
33
|
+
results.push([index, undefined]);
|
|
31
34
|
}
|
|
32
35
|
else {
|
|
33
|
-
results[index
|
|
36
|
+
results.push([index, result]);
|
|
34
37
|
}
|
|
35
|
-
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
+
completed++;
|
|
39
|
+
if (allScheduled && completed === i) {
|
|
40
|
+
callbackCalled = true;
|
|
41
|
+
const e = errors.sort((a, b) => a[0] - b[0]).map(([_, error]) => error);
|
|
42
|
+
const r = results.sort((a, b) => a[0] - b[0]).map(([_, result]) => result);
|
|
43
|
+
callback(hasErrors ? new MultipleErrors(errorMessage, e) : null, r);
|
|
38
44
|
}
|
|
39
45
|
}
|
|
40
|
-
if (remaining === 0) {
|
|
41
|
-
callback(null, results);
|
|
42
|
-
}
|
|
43
46
|
for (const item of collection) {
|
|
44
47
|
operation(item, operationCallback.bind(null, i++));
|
|
45
48
|
}
|
|
49
|
+
if (i === 0) {
|
|
50
|
+
callback(null, []);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
allScheduled = true;
|
|
54
|
+
// If all operations were synchronous, allScheduled is not set to true in time for the operation
|
|
55
|
+
// callback to pick it up. In that case, call the callback here.
|
|
56
|
+
if (completed === i && !callbackCalled) {
|
|
57
|
+
const e = errors.sort((a, b) => a[0] - b[0]).map(([_, error]) => error);
|
|
58
|
+
const r = results.sort((a, b) => a[0] - b[0]).map(([_, result]) => result);
|
|
59
|
+
callback(hasErrors ? new MultipleErrors(errorMessage, e) : null, r);
|
|
60
|
+
}
|
|
46
61
|
}
|