apache-iggy 0.6.0 → 0.7.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/client/client.connection.d.ts +49 -0
- package/dist/client/client.connection.js +79 -0
- package/dist/client/client.d.ts +46 -0
- package/dist/client/client.debug.d.ts +4 -0
- package/dist/client/client.debug.js +4 -0
- package/dist/client/client.js +65 -1
- package/dist/client/client.socket.d.ts +91 -0
- package/dist/client/client.socket.js +94 -0
- package/dist/client/client.type.d.ts +72 -0
- package/dist/client/client.type.js +3 -0
- package/dist/client/client.utils.d.ts +28 -0
- package/dist/client/client.utils.js +29 -0
- package/dist/e2e/tcp.cluster.e2e.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/tcp.sm.utils.d.ts +31 -42
- package/dist/tcp.sm.utils.js +38 -22
- package/dist/type.utils.d.ts +14 -0
- package/dist/type.utils.js +9 -0
- package/dist/wire/command-set.d.ts +2 -9
- package/dist/wire/command.utils.d.ts +18 -0
- package/dist/wire/command.utils.js +9 -0
- package/dist/wire/consumer-group/create-group.command.d.ts +13 -0
- package/dist/wire/consumer-group/create-group.command.js +7 -0
- package/dist/wire/consumer-group/delete-group.command.d.ts +13 -0
- package/dist/wire/consumer-group/delete-group.command.js +7 -0
- package/dist/wire/consumer-group/ensure-group.virtual.command.d.ts +15 -1
- package/dist/wire/consumer-group/ensure-group.virtual.command.js +14 -0
- package/dist/wire/consumer-group/get-group.command.d.ts +13 -0
- package/dist/wire/consumer-group/get-group.command.js +7 -0
- package/dist/wire/consumer-group/get-groups.command.d.ts +12 -0
- package/dist/wire/consumer-group/get-groups.command.js +7 -0
- package/dist/wire/consumer-group/group.utils.d.ts +34 -0
- package/dist/wire/consumer-group/group.utils.js +22 -0
- package/dist/wire/consumer-group/join-group.command.d.ts +13 -0
- package/dist/wire/consumer-group/join-group.command.js +7 -0
- package/dist/wire/consumer-group/leave-group.command.d.ts +13 -0
- package/dist/wire/consumer-group/leave-group.command.js +7 -0
- package/dist/wire/identifier.utils.d.ts +11 -0
- package/dist/wire/identifier.utils.js +23 -1
- package/dist/wire/message/flush-unsaved-buffers.command.d.ts +13 -0
- package/dist/wire/message/flush-unsaved-buffers.command.js +7 -0
- package/dist/wire/message/header.type.d.ts +57 -15
- package/dist/wire/message/header.type.js +31 -18
- package/dist/wire/message/header.utils.d.ts +104 -10
- package/dist/wire/message/header.utils.js +233 -86
- package/dist/wire/message/header.utils.test.js +39 -16
- package/dist/wire/message/iggy-header.utils.d.ts +39 -1
- package/dist/wire/message/iggy-header.utils.js +30 -3
- package/dist/wire/message/index.d.ts +5 -5
- package/dist/wire/message/index.js +5 -5
- package/dist/wire/message/message.utils.d.ts +60 -0
- package/dist/wire/message/message.utils.js +54 -1
- package/dist/wire/message/partitioning.utils.d.ts +39 -0
- package/dist/wire/message/partitioning.utils.js +43 -1
- package/dist/wire/message/poll-messages.command.d.ts +17 -0
- package/dist/wire/message/poll-messages.command.js +7 -0
- package/dist/wire/message/poll.utils.d.ts +93 -12
- package/dist/wire/message/poll.utils.js +92 -21
- package/dist/wire/message/send-messages.command.d.ts +14 -0
- package/dist/wire/message/send-messages.command.js +7 -0
- package/dist/wire/message/send-messages.command.test.js +103 -39
- package/dist/wire/number.utils.d.ts +79 -0
- package/dist/wire/number.utils.js +79 -2
- package/dist/wire/offset/delete-offset.command.d.ts +13 -3
- package/dist/wire/offset/delete-offset.command.js +7 -0
- package/dist/wire/offset/get-offset.command.d.ts +14 -0
- package/dist/wire/offset/get-offset.command.js +7 -0
- package/dist/wire/offset/offset.utils.d.ts +48 -0
- package/dist/wire/offset/offset.utils.js +33 -0
- package/dist/wire/offset/store-offset.command.d.ts +15 -0
- package/dist/wire/offset/store-offset.command.js +7 -0
- package/dist/wire/partition/create-partition.command.d.ts +13 -0
- package/dist/wire/partition/create-partition.command.js +7 -0
- package/dist/wire/partition/delete-partition.command.d.ts +13 -0
- package/dist/wire/partition/delete-partition.command.js +7 -0
- package/dist/wire/partition/partition.utils.d.ts +9 -0
- package/dist/wire/partition/partition.utils.js +9 -0
- package/dist/wire/serialize.utils.d.ts +20 -0
- package/dist/wire/serialize.utils.js +20 -0
- package/dist/wire/session/login-with-token.command.d.ts +11 -0
- package/dist/wire/session/login-with-token.command.js +7 -0
- package/dist/wire/session/login.command.d.ts +7 -0
- package/dist/wire/session/login.command.js +7 -0
- package/dist/wire/session/login.utils.d.ts +25 -0
- package/dist/wire/session/login.utils.js +14 -0
- package/dist/wire/session/logout.command.d.ts +7 -0
- package/dist/wire/session/logout.command.js +7 -0
- package/dist/wire/stream/create-stream.command.d.ts +12 -0
- package/dist/wire/stream/create-stream.command.js +7 -0
- package/dist/wire/stream/delete-stream.command.d.ts +11 -0
- package/dist/wire/stream/delete-stream.command.js +7 -0
- package/dist/wire/stream/ensure-stream.virtual.command.d.ts +8 -1
- package/dist/wire/stream/ensure-stream.virtual.command.js +7 -0
- package/dist/wire/stream/get-stream.command.d.ts +11 -0
- package/dist/wire/stream/get-stream.command.js +7 -0
- package/dist/wire/stream/get-streams.command.d.ts +7 -0
- package/dist/wire/stream/get-streams.command.js +7 -0
- package/dist/wire/stream/purge-stream.command.d.ts +11 -0
- package/dist/wire/stream/purge-stream.command.js +7 -0
- package/dist/wire/stream/stream.utils.d.ts +22 -0
- package/dist/wire/stream/stream.utils.js +8 -0
- package/dist/wire/stream/update-stream.command.d.ts +12 -0
- package/dist/wire/stream/update-stream.command.js +7 -0
- package/dist/wire/token/create-token.command.d.ts +12 -0
- package/dist/wire/token/create-token.command.js +7 -0
- package/dist/wire/token/delete-token.command.d.ts +11 -0
- package/dist/wire/token/delete-token.command.js +7 -0
- package/dist/wire/token/get-tokens.command.d.ts +7 -0
- package/dist/wire/token/get-tokens.command.js +7 -0
- package/dist/wire/token/token.utils.d.ts +40 -0
- package/dist/wire/token/token.utils.js +21 -0
- package/dist/wire/topic/create-topic.command.d.ts +17 -0
- package/dist/wire/topic/create-topic.command.js +7 -0
- package/dist/wire/topic/delete-topic.command.d.ts +14 -2
- package/dist/wire/topic/delete-topic.command.js +7 -0
- package/dist/wire/topic/ensure-topic.virtual.command.d.ts +9 -2
- package/dist/wire/topic/ensure-topic.virtual.command.js +7 -0
- package/dist/wire/topic/get-topic.command.d.ts +13 -2
- package/dist/wire/topic/get-topic.command.js +7 -0
- package/dist/wire/topic/get-topics.command.d.ts +11 -0
- package/dist/wire/topic/get-topics.command.js +7 -0
- package/dist/wire/topic/purge-topic.command.d.ts +12 -0
- package/dist/wire/topic/purge-topic.command.js +7 -0
- package/dist/wire/topic/topic.utils.d.ts +73 -0
- package/dist/wire/topic/topic.utils.js +40 -0
- package/dist/wire/topic/update-topic.command.d.ts +17 -0
- package/dist/wire/topic/update-topic.command.js +7 -0
- package/dist/wire/user/change-password.command.d.ts +13 -0
- package/dist/wire/user/change-password.command.js +7 -0
- package/dist/wire/user/create-user.command.d.ts +14 -0
- package/dist/wire/user/create-user.command.js +7 -0
- package/dist/wire/user/delete-user.command.d.ts +11 -0
- package/dist/wire/user/delete-user.command.js +7 -0
- package/dist/wire/user/get-user.command.d.ts +11 -0
- package/dist/wire/user/get-user.command.js +7 -0
- package/dist/wire/user/get-users.command.d.ts +7 -0
- package/dist/wire/user/get-users.command.js +7 -0
- package/dist/wire/user/permissions.utils.d.ts +108 -0
- package/dist/wire/user/permissions.utils.js +68 -0
- package/dist/wire/user/update-permissions.command.d.ts +12 -0
- package/dist/wire/user/update-permissions.command.js +7 -0
- package/dist/wire/user/update-user.command.d.ts +13 -0
- package/dist/wire/user/update-user.command.js +7 -0
- package/dist/wire/user/user.utils.d.ts +40 -0
- package/dist/wire/user/user.utils.js +33 -0
- package/dist/wire/uuid.utils.d.ts +13 -0
- package/dist/wire/uuid.utils.js +13 -1
- package/package.json +2 -2
package/dist/type.utils.js
CHANGED
|
@@ -16,6 +16,15 @@
|
|
|
16
16
|
* specific language governing permissions and limitations
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
|
+
/**
|
|
20
|
+
* Reverses the keys and values of a record object.
|
|
21
|
+
* Creates a new record where the original values become keys and vice versa.
|
|
22
|
+
*
|
|
23
|
+
* @typeParam T - Type of the original keys
|
|
24
|
+
* @typeParam U - Type of the original values (becomes keys in result)
|
|
25
|
+
* @param input - Record object to reverse
|
|
26
|
+
* @returns New record with swapped keys and values
|
|
27
|
+
*/
|
|
19
28
|
export function reverseRecord(input) {
|
|
20
29
|
return Object.fromEntries(Object.entries(input).map(([key, value]) => [
|
|
21
30
|
value,
|
|
@@ -56,18 +56,11 @@ declare const streamAPI: (c: ClientProvider) => {
|
|
|
56
56
|
};
|
|
57
57
|
type StreamAPI = ReturnType<typeof streamAPI>;
|
|
58
58
|
declare const topicAPI: (c: ClientProvider) => {
|
|
59
|
-
get: (arg:
|
|
60
|
-
streamId: import("./identifier.utils.js").Id;
|
|
61
|
-
topicId: import("./identifier.utils.js").Id;
|
|
62
|
-
}) => Promise<import("./topic/topic.utils.js").Topic | null>;
|
|
59
|
+
get: (arg: import("./topic/get-topic.command.js").GetTopic) => Promise<import("./topic/topic.utils.js").Topic | null>;
|
|
63
60
|
list: (arg: import("./topic/get-topics.command.js").GetTopics) => Promise<import("./topic/topic.utils.js").Topic[]>;
|
|
64
61
|
create: (arg: import("./topic/create-topic.command.js").CreateTopic) => Promise<import("./topic/topic.utils.js").Topic>;
|
|
65
62
|
update: (arg: import("./topic/update-topic.command.js").UpdateTopic) => Promise<boolean>;
|
|
66
|
-
delete: (arg:
|
|
67
|
-
streamId: import("./identifier.utils.js").Id;
|
|
68
|
-
topicId: import("./identifier.utils.js").Id;
|
|
69
|
-
partitionsCount: number;
|
|
70
|
-
}) => Promise<boolean>;
|
|
63
|
+
delete: (arg: import("./topic/delete-topic.command.js").DeleteTopic) => Promise<boolean>;
|
|
71
64
|
purge: (arg: import("./topic/purge-topic.command.js").PurgeTopic) => Promise<boolean>;
|
|
72
65
|
ensure: (streamId: import("./identifier.utils.js").Id, topicName: string, partitionCount?: number, compressionAlgorithm?: number) => Promise<import("./topic/topic.utils.js").Topic>;
|
|
73
66
|
};
|
|
@@ -17,10 +17,28 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import type { CommandResponse, ClientProvider } from '../client/client.type.js';
|
|
20
|
+
/**
|
|
21
|
+
* Represents a command that can be sent to the Iggy server.
|
|
22
|
+
*
|
|
23
|
+
* @typeParam I - Input type for the command arguments
|
|
24
|
+
* @typeParam O - Output type for the command response
|
|
25
|
+
*/
|
|
20
26
|
export type Command<I, O> = {
|
|
27
|
+
/** Command code identifying the operation */
|
|
21
28
|
code: number;
|
|
29
|
+
/** Function to serialize command arguments to a Buffer */
|
|
22
30
|
serialize: (args: I) => Buffer;
|
|
31
|
+
/** Function to deserialize the server response */
|
|
23
32
|
deserialize: (r: CommandResponse) => O;
|
|
24
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* Wraps a command definition into an executable function.
|
|
36
|
+
* Creates a function that handles serialization, sending, and deserialization.
|
|
37
|
+
*
|
|
38
|
+
* @typeParam I - Input type for the command arguments
|
|
39
|
+
* @typeParam O - Output type for the command response
|
|
40
|
+
* @param cmd - Command definition with code, serialize, and deserialize functions
|
|
41
|
+
* @returns A function that takes a ClientProvider and returns an async command executor
|
|
42
|
+
*/
|
|
25
43
|
export declare function wrapCommand<I, O>(cmd: Command<I, O>): (getClient: ClientProvider) => (arg: I) => Promise<O>;
|
|
26
44
|
//# sourceMappingURL=command.utils.d.ts.map
|
|
@@ -16,6 +16,15 @@
|
|
|
16
16
|
* specific language governing permissions and limitations
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
|
+
/**
|
|
20
|
+
* Wraps a command definition into an executable function.
|
|
21
|
+
* Creates a function that handles serialization, sending, and deserialization.
|
|
22
|
+
*
|
|
23
|
+
* @typeParam I - Input type for the command arguments
|
|
24
|
+
* @typeParam O - Output type for the command response
|
|
25
|
+
* @param cmd - Command definition with code, serialize, and deserialize functions
|
|
26
|
+
* @returns A function that takes a ClientProvider and returns an async command executor
|
|
27
|
+
*/
|
|
19
28
|
export function wrapCommand(cmd) {
|
|
20
29
|
return (getClient) => async (arg) => cmd.deserialize(await (await getClient()).sendCommand(cmd.code, cmd.serialize(arg)));
|
|
21
30
|
}
|
|
@@ -19,15 +19,28 @@
|
|
|
19
19
|
import type { CommandResponse } from '../../client/client.type.js';
|
|
20
20
|
import { type Id } from '../identifier.utils.js';
|
|
21
21
|
import { type ConsumerGroup } from './group.utils.js';
|
|
22
|
+
/**
|
|
23
|
+
* Parameters for the create consumer group command.
|
|
24
|
+
*/
|
|
22
25
|
export type CreateGroup = {
|
|
26
|
+
/** Stream identifier (ID or name) */
|
|
23
27
|
streamId: Id;
|
|
28
|
+
/** Topic identifier (ID or name) */
|
|
24
29
|
topicId: Id;
|
|
30
|
+
/** Consumer group name (1-255 bytes) */
|
|
25
31
|
name: string;
|
|
26
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* Create consumer group command definition.
|
|
35
|
+
* Creates a new consumer group within a topic.
|
|
36
|
+
*/
|
|
27
37
|
export declare const CREATE_GROUP: {
|
|
28
38
|
code: number;
|
|
29
39
|
serialize: ({ streamId, topicId, name }: CreateGroup) => Buffer<ArrayBuffer>;
|
|
30
40
|
deserialize: (r: CommandResponse) => ConsumerGroup;
|
|
31
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* Executable create consumer group command function.
|
|
44
|
+
*/
|
|
32
45
|
export declare const createGroup: (getClient: import("../../client/client.type.js").ClientProvider) => (arg: CreateGroup) => Promise<ConsumerGroup>;
|
|
33
46
|
//# sourceMappingURL=create-group.command.d.ts.map
|
|
@@ -20,6 +20,10 @@ import { serializeIdentifier } from '../identifier.utils.js';
|
|
|
20
20
|
import { wrapCommand } from '../command.utils.js';
|
|
21
21
|
import { COMMAND_CODE } from '../command.code.js';
|
|
22
22
|
import { deserializeConsumerGroup } from './group.utils.js';
|
|
23
|
+
/**
|
|
24
|
+
* Create consumer group command definition.
|
|
25
|
+
* Creates a new consumer group within a topic.
|
|
26
|
+
*/
|
|
23
27
|
export const CREATE_GROUP = {
|
|
24
28
|
code: COMMAND_CODE.CreateGroup,
|
|
25
29
|
serialize: ({ streamId, topicId, name }) => {
|
|
@@ -40,5 +44,8 @@ export const CREATE_GROUP = {
|
|
|
40
44
|
return deserializeConsumerGroup(r.data).data;
|
|
41
45
|
}
|
|
42
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* Executable create consumer group command function.
|
|
49
|
+
*/
|
|
43
50
|
export const createGroup = wrapCommand(CREATE_GROUP);
|
|
44
51
|
//# sourceMappingURL=create-group.command.js.map
|
|
@@ -17,15 +17,28 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { type Id } from '../identifier.utils.js';
|
|
20
|
+
/**
|
|
21
|
+
* Parameters for the delete consumer group command.
|
|
22
|
+
*/
|
|
20
23
|
export type DeleteGroup = {
|
|
24
|
+
/** Stream identifier (ID or name) */
|
|
21
25
|
streamId: Id;
|
|
26
|
+
/** Topic identifier (ID or name) */
|
|
22
27
|
topicId: Id;
|
|
28
|
+
/** Consumer group identifier (ID or name) */
|
|
23
29
|
groupId: Id;
|
|
24
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Delete consumer group command definition.
|
|
33
|
+
* Removes a consumer group from a topic.
|
|
34
|
+
*/
|
|
25
35
|
export declare const DELETE_GROUP: {
|
|
26
36
|
code: number;
|
|
27
37
|
serialize: ({ streamId, topicId, groupId }: DeleteGroup) => Buffer<ArrayBuffer>;
|
|
28
38
|
deserialize: (r: import("../../index.js").CommandResponse) => boolean;
|
|
29
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Executable delete consumer group command function.
|
|
42
|
+
*/
|
|
30
43
|
export declare const deleteGroup: (getClient: import("../../index.js").ClientProvider) => (arg: DeleteGroup) => Promise<boolean>;
|
|
31
44
|
//# sourceMappingURL=delete-group.command.d.ts.map
|
|
@@ -20,6 +20,10 @@ import { serializeTargetGroup } from './group.utils.js';
|
|
|
20
20
|
import { deserializeVoidResponse } from '../../client/client.utils.js';
|
|
21
21
|
import { wrapCommand } from '../command.utils.js';
|
|
22
22
|
import { COMMAND_CODE } from '../command.code.js';
|
|
23
|
+
/**
|
|
24
|
+
* Delete consumer group command definition.
|
|
25
|
+
* Removes a consumer group from a topic.
|
|
26
|
+
*/
|
|
23
27
|
export const DELETE_GROUP = {
|
|
24
28
|
code: COMMAND_CODE.DeleteGroup,
|
|
25
29
|
serialize: ({ streamId, topicId, groupId }) => {
|
|
@@ -27,5 +31,8 @@ export const DELETE_GROUP = {
|
|
|
27
31
|
},
|
|
28
32
|
deserialize: deserializeVoidResponse
|
|
29
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* Executable delete consumer group command function.
|
|
36
|
+
*/
|
|
30
37
|
export const deleteGroup = wrapCommand(DELETE_GROUP);
|
|
31
38
|
//# sourceMappingURL=delete-group.command.js.map
|
|
@@ -17,7 +17,21 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import type { Id } from '../identifier.utils.js';
|
|
20
|
-
import { ClientProvider } from '../../client/index.js';
|
|
20
|
+
import type { ClientProvider } from '../../client/index.js';
|
|
21
|
+
/**
|
|
22
|
+
* Creates a virtual command that ensures a consumer group exists.
|
|
23
|
+
* If the group does not exist, it will be created.
|
|
24
|
+
*
|
|
25
|
+
* @param c - Client provider function
|
|
26
|
+
* @returns Function that ensures a consumer group exists by name
|
|
27
|
+
*/
|
|
21
28
|
export declare const ensureConsumerGroup: (c: ClientProvider) => (streamId: Id, topicId: Id, groupName: string) => Promise<import("./group.utils.js").ConsumerGroup>;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a virtual command that ensures a consumer group exists and joins it.
|
|
31
|
+
* If the group does not exist, it will be created, then the client joins the group.
|
|
32
|
+
*
|
|
33
|
+
* @param c - Client provider function
|
|
34
|
+
* @returns Function that ensures a consumer group exists and joins it
|
|
35
|
+
*/
|
|
22
36
|
export declare const ensureConsumerGroupAndJoin: (c: ClientProvider) => (streamId: Id, topicId: Id, groupName: string) => Promise<import("./group.utils.js").ConsumerGroup>;
|
|
23
37
|
//# sourceMappingURL=ensure-group.virtual.command.d.ts.map
|
|
@@ -19,12 +19,26 @@
|
|
|
19
19
|
import { createGroup } from './create-group.command.js';
|
|
20
20
|
import { getGroup } from './get-group.command.js';
|
|
21
21
|
import { joinGroup } from './join-group.command.js';
|
|
22
|
+
/**
|
|
23
|
+
* Creates a virtual command that ensures a consumer group exists.
|
|
24
|
+
* If the group does not exist, it will be created.
|
|
25
|
+
*
|
|
26
|
+
* @param c - Client provider function
|
|
27
|
+
* @returns Function that ensures a consumer group exists by name
|
|
28
|
+
*/
|
|
22
29
|
export const ensureConsumerGroup = (c) => async function ensureConsumerGroup(streamId, topicId, groupName) {
|
|
23
30
|
const group = await getGroup(c)({ streamId, topicId, groupId: groupName });
|
|
24
31
|
if (!group)
|
|
25
32
|
return await createGroup(c)({ streamId, topicId, name: groupName });
|
|
26
33
|
return group;
|
|
27
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Creates a virtual command that ensures a consumer group exists and joins it.
|
|
37
|
+
* If the group does not exist, it will be created, then the client joins the group.
|
|
38
|
+
*
|
|
39
|
+
* @param c - Client provider function
|
|
40
|
+
* @returns Function that ensures a consumer group exists and joins it
|
|
41
|
+
*/
|
|
28
42
|
export const ensureConsumerGroupAndJoin = (c) => async function ensureConsumerGroupAndJoin(streamId, topicId, groupName) {
|
|
29
43
|
const group = await ensureConsumerGroup(c)(streamId, topicId, groupName);
|
|
30
44
|
await joinGroup(c)({ streamId, topicId, groupId: group.id });
|
|
@@ -19,15 +19,28 @@
|
|
|
19
19
|
import type { CommandResponse } from '../../client/client.type.js';
|
|
20
20
|
import { type Id } from '../identifier.utils.js';
|
|
21
21
|
import { type ConsumerGroup } from './group.utils.js';
|
|
22
|
+
/**
|
|
23
|
+
* Parameters for the get consumer group command.
|
|
24
|
+
*/
|
|
22
25
|
export type GetGroup = {
|
|
26
|
+
/** Stream identifier (ID or name) */
|
|
23
27
|
streamId: Id;
|
|
28
|
+
/** Topic identifier (ID or name) */
|
|
24
29
|
topicId: Id;
|
|
30
|
+
/** Consumer group identifier (ID or name) */
|
|
25
31
|
groupId: Id;
|
|
26
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* Get consumer group command definition.
|
|
35
|
+
* Retrieves information about a specific consumer group.
|
|
36
|
+
*/
|
|
27
37
|
export declare const GET_GROUP: {
|
|
28
38
|
code: number;
|
|
29
39
|
serialize: ({ streamId, topicId, groupId }: GetGroup) => Buffer<ArrayBuffer>;
|
|
30
40
|
deserialize: (r: CommandResponse) => ConsumerGroup | null;
|
|
31
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* Executable get consumer group command function.
|
|
44
|
+
*/
|
|
32
45
|
export declare const getGroup: (getClient: import("../../client/client.type.js").ClientProvider) => (arg: GetGroup) => Promise<ConsumerGroup | null>;
|
|
33
46
|
//# sourceMappingURL=get-group.command.d.ts.map
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
import { wrapCommand } from '../command.utils.js';
|
|
20
20
|
import { COMMAND_CODE } from '../command.code.js';
|
|
21
21
|
import { serializeTargetGroup, deserializeConsumerGroup } from './group.utils.js';
|
|
22
|
+
/**
|
|
23
|
+
* Get consumer group command definition.
|
|
24
|
+
* Retrieves information about a specific consumer group.
|
|
25
|
+
*/
|
|
22
26
|
export const GET_GROUP = {
|
|
23
27
|
code: COMMAND_CODE.GetGroup,
|
|
24
28
|
serialize: ({ streamId, topicId, groupId }) => {
|
|
@@ -30,5 +34,8 @@ export const GET_GROUP = {
|
|
|
30
34
|
return deserializeConsumerGroup(r.data).data;
|
|
31
35
|
}
|
|
32
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* Executable get consumer group command function.
|
|
39
|
+
*/
|
|
33
40
|
export const getGroup = wrapCommand(GET_GROUP);
|
|
34
41
|
//# sourceMappingURL=get-group.command.js.map
|
|
@@ -19,14 +19,26 @@
|
|
|
19
19
|
import type { CommandResponse } from '../../client/client.type.js';
|
|
20
20
|
import type { ConsumerGroup } from './group.utils.js';
|
|
21
21
|
import { type Id } from '../identifier.utils.js';
|
|
22
|
+
/**
|
|
23
|
+
* Parameters for the get consumer groups command.
|
|
24
|
+
*/
|
|
22
25
|
export type GetGroups = {
|
|
26
|
+
/** Stream identifier (ID or name) */
|
|
23
27
|
streamId: Id;
|
|
28
|
+
/** Topic identifier (ID or name) */
|
|
24
29
|
topicId: Id;
|
|
25
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Get consumer groups command definition.
|
|
33
|
+
* Retrieves all consumer groups within a topic.
|
|
34
|
+
*/
|
|
26
35
|
export declare const GET_GROUPS: {
|
|
27
36
|
code: number;
|
|
28
37
|
serialize: ({ streamId, topicId }: GetGroups) => Buffer<ArrayBuffer>;
|
|
29
38
|
deserialize: (r: CommandResponse) => ConsumerGroup[];
|
|
30
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Executable get consumer groups command function.
|
|
42
|
+
*/
|
|
31
43
|
export declare const getGroups: (getClient: import("../../client/client.type.js").ClientProvider) => (arg: GetGroups) => Promise<ConsumerGroup[]>;
|
|
32
44
|
//# sourceMappingURL=get-groups.command.d.ts.map
|
|
@@ -20,6 +20,10 @@ import { serializeIdentifier } from '../identifier.utils.js';
|
|
|
20
20
|
import { deserializeConsumerGroups } from './group.utils.js';
|
|
21
21
|
import { wrapCommand } from '../command.utils.js';
|
|
22
22
|
import { COMMAND_CODE } from '../command.code.js';
|
|
23
|
+
/**
|
|
24
|
+
* Get consumer groups command definition.
|
|
25
|
+
* Retrieves all consumer groups within a topic.
|
|
26
|
+
*/
|
|
23
27
|
export const GET_GROUPS = {
|
|
24
28
|
code: COMMAND_CODE.GetGroups,
|
|
25
29
|
serialize: ({ streamId, topicId }) => {
|
|
@@ -32,5 +36,8 @@ export const GET_GROUPS = {
|
|
|
32
36
|
return deserializeConsumerGroups(r.data);
|
|
33
37
|
}
|
|
34
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Executable get consumer groups command function.
|
|
41
|
+
*/
|
|
35
42
|
export const getGroups = wrapCommand(GET_GROUPS);
|
|
36
43
|
//# sourceMappingURL=get-groups.command.js.map
|
|
@@ -17,18 +17,52 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { type Id } from '../identifier.utils.js';
|
|
20
|
+
/**
|
|
21
|
+
* Consumer group information.
|
|
22
|
+
*/
|
|
20
23
|
export type ConsumerGroup = {
|
|
24
|
+
/** Consumer group ID */
|
|
21
25
|
id: number;
|
|
26
|
+
/** Consumer group name */
|
|
22
27
|
name: string;
|
|
28
|
+
/** Number of members in the group */
|
|
23
29
|
membersCount: number;
|
|
30
|
+
/** Number of partitions assigned to the group */
|
|
24
31
|
partitionsCount: number;
|
|
25
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* Result of deserializing a consumer group.
|
|
35
|
+
*/
|
|
26
36
|
type ConsumerGroupDeserialized = {
|
|
37
|
+
/** Number of bytes consumed */
|
|
27
38
|
bytesRead: number;
|
|
39
|
+
/** Deserialized consumer group data */
|
|
28
40
|
data: ConsumerGroup;
|
|
29
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* Serializes stream, topic, and group identifiers for targeting a consumer group.
|
|
44
|
+
*
|
|
45
|
+
* @param streamId - Stream identifier (ID or name)
|
|
46
|
+
* @param topicId - Topic identifier (ID or name)
|
|
47
|
+
* @param groupId - Consumer group identifier (ID or name)
|
|
48
|
+
* @returns Buffer containing serialized identifiers
|
|
49
|
+
*/
|
|
30
50
|
export declare const serializeTargetGroup: (streamId: Id, topicId: Id, groupId: Id) => Buffer<ArrayBuffer>;
|
|
51
|
+
/**
|
|
52
|
+
* Deserializes a consumer group from a buffer.
|
|
53
|
+
*
|
|
54
|
+
* @param r - Buffer containing serialized consumer group data
|
|
55
|
+
* @param pos - Starting position in the buffer
|
|
56
|
+
* @returns Object with bytes read and deserialized consumer group data
|
|
57
|
+
*/
|
|
31
58
|
export declare const deserializeConsumerGroup: (r: Buffer, pos?: number) => ConsumerGroupDeserialized;
|
|
59
|
+
/**
|
|
60
|
+
* Deserializes multiple consumer groups from a buffer.
|
|
61
|
+
*
|
|
62
|
+
* @param r - Buffer containing serialized consumer groups data
|
|
63
|
+
* @param pos - Starting position in the buffer
|
|
64
|
+
* @returns Array of deserialized consumer groups
|
|
65
|
+
*/
|
|
32
66
|
export declare const deserializeConsumerGroups: (r: Buffer, pos?: number) => ConsumerGroup[];
|
|
33
67
|
export {};
|
|
34
68
|
//# sourceMappingURL=group.utils.d.ts.map
|
|
@@ -17,6 +17,14 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { serializeIdentifier } from '../identifier.utils.js';
|
|
20
|
+
/**
|
|
21
|
+
* Serializes stream, topic, and group identifiers for targeting a consumer group.
|
|
22
|
+
*
|
|
23
|
+
* @param streamId - Stream identifier (ID or name)
|
|
24
|
+
* @param topicId - Topic identifier (ID or name)
|
|
25
|
+
* @param groupId - Consumer group identifier (ID or name)
|
|
26
|
+
* @returns Buffer containing serialized identifiers
|
|
27
|
+
*/
|
|
20
28
|
export const serializeTargetGroup = (streamId, topicId, groupId) => {
|
|
21
29
|
return Buffer.concat([
|
|
22
30
|
serializeIdentifier(streamId),
|
|
@@ -24,6 +32,13 @@ export const serializeTargetGroup = (streamId, topicId, groupId) => {
|
|
|
24
32
|
serializeIdentifier(groupId)
|
|
25
33
|
]);
|
|
26
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Deserializes a consumer group from a buffer.
|
|
37
|
+
*
|
|
38
|
+
* @param r - Buffer containing serialized consumer group data
|
|
39
|
+
* @param pos - Starting position in the buffer
|
|
40
|
+
* @returns Object with bytes read and deserialized consumer group data
|
|
41
|
+
*/
|
|
27
42
|
export const deserializeConsumerGroup = (r, pos = 0) => {
|
|
28
43
|
const id = r.readUInt32LE(pos);
|
|
29
44
|
const partitionsCount = r.readUInt32LE(pos + 4);
|
|
@@ -40,6 +55,13 @@ export const deserializeConsumerGroup = (r, pos = 0) => {
|
|
|
40
55
|
}
|
|
41
56
|
};
|
|
42
57
|
};
|
|
58
|
+
/**
|
|
59
|
+
* Deserializes multiple consumer groups from a buffer.
|
|
60
|
+
*
|
|
61
|
+
* @param r - Buffer containing serialized consumer groups data
|
|
62
|
+
* @param pos - Starting position in the buffer
|
|
63
|
+
* @returns Array of deserialized consumer groups
|
|
64
|
+
*/
|
|
43
65
|
export const deserializeConsumerGroups = (r, pos = 0) => {
|
|
44
66
|
const end = r.length;
|
|
45
67
|
const cgroups = [];
|
|
@@ -17,15 +17,28 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { type Id } from '../identifier.utils.js';
|
|
20
|
+
/**
|
|
21
|
+
* Parameters for the join consumer group command.
|
|
22
|
+
*/
|
|
20
23
|
export type JoinGroup = {
|
|
24
|
+
/** Stream identifier (ID or name) */
|
|
21
25
|
streamId: Id;
|
|
26
|
+
/** Topic identifier (ID or name) */
|
|
22
27
|
topicId: Id;
|
|
28
|
+
/** Consumer group identifier (ID or name) */
|
|
23
29
|
groupId: Id;
|
|
24
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Join consumer group command definition.
|
|
33
|
+
* Adds the current client as a member of the consumer group.
|
|
34
|
+
*/
|
|
25
35
|
export declare const JOIN_GROUP: {
|
|
26
36
|
code: number;
|
|
27
37
|
serialize: ({ streamId, topicId, groupId }: JoinGroup) => Buffer<ArrayBuffer>;
|
|
28
38
|
deserialize: (r: import("../../index.js").CommandResponse) => boolean;
|
|
29
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Executable join consumer group command function.
|
|
42
|
+
*/
|
|
30
43
|
export declare const joinGroup: (getClient: import("../../index.js").ClientProvider) => (arg: JoinGroup) => Promise<boolean>;
|
|
31
44
|
//# sourceMappingURL=join-group.command.d.ts.map
|
|
@@ -20,6 +20,10 @@ import { serializeTargetGroup } from './group.utils.js';
|
|
|
20
20
|
import { deserializeVoidResponse } from '../../client/client.utils.js';
|
|
21
21
|
import { wrapCommand } from '../command.utils.js';
|
|
22
22
|
import { COMMAND_CODE } from '../command.code.js';
|
|
23
|
+
/**
|
|
24
|
+
* Join consumer group command definition.
|
|
25
|
+
* Adds the current client as a member of the consumer group.
|
|
26
|
+
*/
|
|
23
27
|
export const JOIN_GROUP = {
|
|
24
28
|
code: COMMAND_CODE.JoinGroup,
|
|
25
29
|
serialize: ({ streamId, topicId, groupId }) => {
|
|
@@ -27,5 +31,8 @@ export const JOIN_GROUP = {
|
|
|
27
31
|
},
|
|
28
32
|
deserialize: deserializeVoidResponse
|
|
29
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* Executable join consumer group command function.
|
|
36
|
+
*/
|
|
30
37
|
export const joinGroup = wrapCommand(JOIN_GROUP);
|
|
31
38
|
//# sourceMappingURL=join-group.command.js.map
|
|
@@ -17,15 +17,28 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { type Id } from '../identifier.utils.js';
|
|
20
|
+
/**
|
|
21
|
+
* Parameters for the leave consumer group command.
|
|
22
|
+
*/
|
|
20
23
|
export type LeaveGroup = {
|
|
24
|
+
/** Stream identifier (ID or name) */
|
|
21
25
|
streamId: Id;
|
|
26
|
+
/** Topic identifier (ID or name) */
|
|
22
27
|
topicId: Id;
|
|
28
|
+
/** Consumer group identifier (ID or name) */
|
|
23
29
|
groupId: Id;
|
|
24
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Leave consumer group command definition.
|
|
33
|
+
* Removes the current client from the consumer group.
|
|
34
|
+
*/
|
|
25
35
|
export declare const LEAVE_GROUP: {
|
|
26
36
|
code: number;
|
|
27
37
|
serialize: ({ streamId, topicId, groupId }: LeaveGroup) => Buffer<ArrayBuffer>;
|
|
28
38
|
deserialize: (r: import("../../index.js").CommandResponse) => boolean;
|
|
29
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Executable leave consumer group command function.
|
|
42
|
+
*/
|
|
30
43
|
export declare const leaveGroup: (getClient: import("../../index.js").ClientProvider) => (arg: LeaveGroup) => Promise<boolean>;
|
|
31
44
|
//# sourceMappingURL=leave-group.command.d.ts.map
|
|
@@ -20,6 +20,10 @@ import { serializeTargetGroup } from './group.utils.js';
|
|
|
20
20
|
import { deserializeVoidResponse } from '../../client/client.utils.js';
|
|
21
21
|
import { wrapCommand } from '../command.utils.js';
|
|
22
22
|
import { COMMAND_CODE } from '../command.code.js';
|
|
23
|
+
/**
|
|
24
|
+
* Leave consumer group command definition.
|
|
25
|
+
* Removes the current client from the consumer group.
|
|
26
|
+
*/
|
|
23
27
|
export const LEAVE_GROUP = {
|
|
24
28
|
code: COMMAND_CODE.LeaveGroup,
|
|
25
29
|
serialize: ({ streamId, topicId, groupId }) => {
|
|
@@ -27,5 +31,8 @@ export const LEAVE_GROUP = {
|
|
|
27
31
|
},
|
|
28
32
|
deserialize: deserializeVoidResponse
|
|
29
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* Executable leave consumer group command function.
|
|
36
|
+
*/
|
|
30
37
|
export const leaveGroup = wrapCommand(LEAVE_GROUP);
|
|
31
38
|
//# sourceMappingURL=leave-group.command.js.map
|
|
@@ -16,6 +16,17 @@
|
|
|
16
16
|
* specific language governing permissions and limitations
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
|
+
/**
|
|
20
|
+
* Identifier type that can be either a numeric ID or a string name.
|
|
21
|
+
* Used to identify streams, topics, partitions, and other resources.
|
|
22
|
+
*/
|
|
19
23
|
export type Id = number | string;
|
|
24
|
+
/**
|
|
25
|
+
* Serializes an identifier (numeric or string) to a Buffer for wire protocol.
|
|
26
|
+
*
|
|
27
|
+
* @param id - Numeric ID or string name to serialize
|
|
28
|
+
* @returns Buffer containing the serialized identifier
|
|
29
|
+
* @throws Error if the identifier type is not supported
|
|
30
|
+
*/
|
|
20
31
|
export declare const serializeIdentifier: (id: Id) => Buffer;
|
|
21
32
|
//# sourceMappingURL=identifier.utils.d.ts.map
|
|
@@ -16,8 +16,17 @@
|
|
|
16
16
|
* specific language governing permissions and limitations
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
|
+
/** Identifier kind for numeric IDs */
|
|
19
20
|
const NUMERIC = 1;
|
|
21
|
+
/** Identifier kind for string IDs */
|
|
20
22
|
const STRING = 2;
|
|
23
|
+
/**
|
|
24
|
+
* Serializes an identifier (numeric or string) to a Buffer for wire protocol.
|
|
25
|
+
*
|
|
26
|
+
* @param id - Numeric ID or string name to serialize
|
|
27
|
+
* @returns Buffer containing the serialized identifier
|
|
28
|
+
* @throws Error if the identifier type is not supported
|
|
29
|
+
*/
|
|
21
30
|
export const serializeIdentifier = (id) => {
|
|
22
31
|
if ('string' === typeof id) {
|
|
23
32
|
return serializeStringId(id);
|
|
@@ -25,8 +34,15 @@ export const serializeIdentifier = (id) => {
|
|
|
25
34
|
if ('number' === typeof id) {
|
|
26
35
|
return serializeNumericId(id);
|
|
27
36
|
}
|
|
28
|
-
throw new Error(`
|
|
37
|
+
throw new Error(`Unsupported id type (${id} - ${typeof id})`);
|
|
29
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Serializes a string identifier to a Buffer.
|
|
41
|
+
*
|
|
42
|
+
* @param id - String name to serialize (1-255 bytes)
|
|
43
|
+
* @returns Buffer containing kind, length, and string bytes
|
|
44
|
+
* @throws Error if the string length is not between 1 and 255 bytes
|
|
45
|
+
*/
|
|
30
46
|
const serializeStringId = (id) => {
|
|
31
47
|
const b = Buffer.alloc(1 + 1);
|
|
32
48
|
const bId = Buffer.from(id);
|
|
@@ -39,6 +55,12 @@ const serializeStringId = (id) => {
|
|
|
39
55
|
bId
|
|
40
56
|
]);
|
|
41
57
|
};
|
|
58
|
+
/**
|
|
59
|
+
* Serializes a numeric identifier to a Buffer.
|
|
60
|
+
*
|
|
61
|
+
* @param id - Numeric ID to serialize (32-bit unsigned integer)
|
|
62
|
+
* @returns Buffer containing kind, length, and ID bytes in little-endian format
|
|
63
|
+
*/
|
|
42
64
|
const serializeNumericId = (id) => {
|
|
43
65
|
const b = Buffer.alloc(1 + 1 + 4);
|
|
44
66
|
b.writeUInt8(NUMERIC);
|
|
@@ -17,15 +17,28 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { type Id } from '../identifier.utils.js';
|
|
20
|
+
/**
|
|
21
|
+
* Parameters for the flush unsaved buffers command.
|
|
22
|
+
*/
|
|
20
23
|
export type FlushUnsavedBuffer = {
|
|
24
|
+
/** Stream identifier */
|
|
21
25
|
streamId: Id;
|
|
26
|
+
/** Topic identifier */
|
|
22
27
|
topicId: Id;
|
|
28
|
+
/** Partition ID to flush */
|
|
23
29
|
partitionId: number;
|
|
24
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Flush unsaved buffers command definition.
|
|
33
|
+
* Forces buffered messages to be persisted to disk.
|
|
34
|
+
*/
|
|
25
35
|
export declare const FLUSH_UNSAVED_BUFFERS: {
|
|
26
36
|
code: number;
|
|
27
37
|
serialize: ({ streamId, topicId, partitionId }: FlushUnsavedBuffer) => Buffer<ArrayBuffer>;
|
|
28
38
|
deserialize: (r: import("../../index.js").CommandResponse) => boolean;
|
|
29
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Executable flush unsaved buffers command function.
|
|
42
|
+
*/
|
|
30
43
|
export declare const flushUnsavedBuffers: (getClient: import("../../index.js").ClientProvider) => (arg: FlushUnsavedBuffer) => Promise<boolean>;
|
|
31
44
|
//# sourceMappingURL=flush-unsaved-buffers.command.d.ts.map
|
|
@@ -20,6 +20,10 @@ import { serializeFlushUnsavedBuffers } from './message.utils.js';
|
|
|
20
20
|
import { deserializeVoidResponse } from '../../client/client.utils.js';
|
|
21
21
|
import { wrapCommand } from '../command.utils.js';
|
|
22
22
|
import { COMMAND_CODE } from '../command.code.js';
|
|
23
|
+
/**
|
|
24
|
+
* Flush unsaved buffers command definition.
|
|
25
|
+
* Forces buffered messages to be persisted to disk.
|
|
26
|
+
*/
|
|
23
27
|
export const FLUSH_UNSAVED_BUFFERS = {
|
|
24
28
|
code: COMMAND_CODE.FlushUnsavedBuffers,
|
|
25
29
|
serialize: ({ streamId, topicId, partitionId }) => {
|
|
@@ -27,5 +31,8 @@ export const FLUSH_UNSAVED_BUFFERS = {
|
|
|
27
31
|
},
|
|
28
32
|
deserialize: deserializeVoidResponse
|
|
29
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* Executable flush unsaved buffers command function.
|
|
36
|
+
*/
|
|
30
37
|
export const flushUnsavedBuffers = wrapCommand(FLUSH_UNSAVED_BUFFERS);
|
|
31
38
|
//# sourceMappingURL=flush-unsaved-buffers.command.js.map
|