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
|
@@ -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 { isValidCompressionAlgorithm, CompressionAlgorithm, deserializeTopic } from './topic.utils.js';
|
|
23
|
+
/**
|
|
24
|
+
* Create topic command definition.
|
|
25
|
+
* Creates a new topic within a stream.
|
|
26
|
+
*/
|
|
23
27
|
export const CREATE_TOPIC = {
|
|
24
28
|
code: COMMAND_CODE.CreateTopic,
|
|
25
29
|
serialize: ({ streamId, name, partitionCount, compressionAlgorithm = CompressionAlgorithm.None, messageExpiry = 0n, maxTopicSize = 0n, replicationFactor = 1 }) => {
|
|
@@ -49,5 +53,8 @@ export const CREATE_TOPIC = {
|
|
|
49
53
|
return deserializeTopic(r.data).data;
|
|
50
54
|
}
|
|
51
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* Executable create topic command function.
|
|
58
|
+
*/
|
|
52
59
|
export const createTopic = wrapCommand(CREATE_TOPIC);
|
|
53
60
|
//# sourceMappingURL=create-topic.command.js.map
|
|
@@ -17,16 +17,28 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { type Id } from '../identifier.utils.js';
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Parameters for the delete topic command.
|
|
22
|
+
*/
|
|
23
|
+
export type DeleteTopic = {
|
|
24
|
+
/** Stream identifier (ID or name) */
|
|
21
25
|
streamId: Id;
|
|
26
|
+
/** Topic identifier (ID or name) */
|
|
22
27
|
topicId: Id;
|
|
28
|
+
/** Number of partitions in the topic */
|
|
23
29
|
partitionsCount: number;
|
|
24
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Delete topic command definition.
|
|
33
|
+
* Permanently removes a topic and all its data from a stream.
|
|
34
|
+
*/
|
|
25
35
|
export declare const DELETE_TOPIC: {
|
|
26
36
|
code: number;
|
|
27
37
|
serialize: ({ streamId, topicId, partitionsCount }: DeleteTopic) => Buffer<ArrayBuffer>;
|
|
28
38
|
deserialize: (r: import("../../index.js").CommandResponse) => boolean;
|
|
29
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Executable delete topic command function.
|
|
42
|
+
*/
|
|
30
43
|
export declare const deleteTopic: (getClient: import("../../index.js").ClientProvider) => (arg: DeleteTopic) => Promise<boolean>;
|
|
31
|
-
export {};
|
|
32
44
|
//# sourceMappingURL=delete-topic.command.d.ts.map
|
|
@@ -21,6 +21,10 @@ import { wrapCommand } from '../command.utils.js';
|
|
|
21
21
|
import { COMMAND_CODE } from '../command.code.js';
|
|
22
22
|
import { serializeIdentifier } from '../identifier.utils.js';
|
|
23
23
|
import { uint32ToBuf } from '../number.utils.js';
|
|
24
|
+
/**
|
|
25
|
+
* Delete topic command definition.
|
|
26
|
+
* Permanently removes a topic and all its data from a stream.
|
|
27
|
+
*/
|
|
24
28
|
export const DELETE_TOPIC = {
|
|
25
29
|
code: COMMAND_CODE.DeleteTopic,
|
|
26
30
|
serialize: ({ streamId, topicId, partitionsCount }) => {
|
|
@@ -32,5 +36,8 @@ export const DELETE_TOPIC = {
|
|
|
32
36
|
},
|
|
33
37
|
deserialize: deserializeVoidResponse
|
|
34
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Executable delete topic command function.
|
|
41
|
+
*/
|
|
35
42
|
export const deleteTopic = wrapCommand(DELETE_TOPIC);
|
|
36
43
|
//# sourceMappingURL=delete-topic.command.js.map
|
|
@@ -16,7 +16,14 @@
|
|
|
16
16
|
* specific language governing permissions and limitations
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
|
-
import { Id } from '../identifier.utils.js';
|
|
20
|
-
import { ClientProvider } from '../../client/index.js';
|
|
19
|
+
import type { Id } from '../identifier.utils.js';
|
|
20
|
+
import type { ClientProvider } from '../../client/index.js';
|
|
21
|
+
/**
|
|
22
|
+
* Creates a virtual command that ensures a topic exists.
|
|
23
|
+
* If the topic does not exist, it will be created with default settings.
|
|
24
|
+
*
|
|
25
|
+
* @param c - Client provider function
|
|
26
|
+
* @returns Function that ensures a topic exists by name
|
|
27
|
+
*/
|
|
21
28
|
export declare const ensureTopic: (c: ClientProvider) => (streamId: Id, topicName: string, partitionCount?: number, compressionAlgorithm?: number) => Promise<import("./topic.utils.js").Topic>;
|
|
22
29
|
//# sourceMappingURL=ensure-topic.virtual.command.d.ts.map
|
|
@@ -18,6 +18,13 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { createTopic } from './create-topic.command.js';
|
|
20
20
|
import { getTopic } from './get-topic.command.js';
|
|
21
|
+
/**
|
|
22
|
+
* Creates a virtual command that ensures a topic exists.
|
|
23
|
+
* If the topic does not exist, it will be created with default settings.
|
|
24
|
+
*
|
|
25
|
+
* @param c - Client provider function
|
|
26
|
+
* @returns Function that ensures a topic exists by name
|
|
27
|
+
*/
|
|
21
28
|
export const ensureTopic = (c) => async function ensureTopic(streamId, topicName, partitionCount = 1, compressionAlgorithm = 1) {
|
|
22
29
|
const topic = await getTopic(c)({ streamId, topicId: topicName });
|
|
23
30
|
return topic === null ?
|
|
@@ -19,15 +19,26 @@
|
|
|
19
19
|
import type { CommandResponse } from '../../client/client.type.js';
|
|
20
20
|
import { type Id } from '../identifier.utils.js';
|
|
21
21
|
import { type Topic } from './topic.utils.js';
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Parameters for the get topic command.
|
|
24
|
+
*/
|
|
25
|
+
export type GetTopic = {
|
|
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 topic command definition.
|
|
33
|
+
* Retrieves detailed information about a specific topic.
|
|
34
|
+
*/
|
|
26
35
|
export declare const GET_TOPIC: {
|
|
27
36
|
code: number;
|
|
28
37
|
serialize: ({ streamId, topicId }: GetTopic) => Buffer<ArrayBuffer>;
|
|
29
38
|
deserialize: (r: CommandResponse) => Topic | null;
|
|
30
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Executable get topic command function.
|
|
42
|
+
*/
|
|
31
43
|
export declare const getTopic: (getClient: import("../../client/client.type.js").ClientProvider) => (arg: GetTopic) => Promise<Topic | null>;
|
|
32
|
-
export {};
|
|
33
44
|
//# sourceMappingURL=get-topic.command.d.ts.map
|
|
@@ -20,6 +20,10 @@ import { wrapCommand } from '../command.utils.js';
|
|
|
20
20
|
import { COMMAND_CODE } from '../command.code.js';
|
|
21
21
|
import { serializeIdentifier } from '../identifier.utils.js';
|
|
22
22
|
import { deserializeTopic } from './topic.utils.js';
|
|
23
|
+
/**
|
|
24
|
+
* Get topic command definition.
|
|
25
|
+
* Retrieves detailed information about a specific topic.
|
|
26
|
+
*/
|
|
23
27
|
export const GET_TOPIC = {
|
|
24
28
|
code: COMMAND_CODE.GetTopic,
|
|
25
29
|
serialize: ({ streamId, topicId }) => {
|
|
@@ -34,5 +38,8 @@ export const GET_TOPIC = {
|
|
|
34
38
|
return deserializeTopic(r.data).data;
|
|
35
39
|
}
|
|
36
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* Executable get topic command function.
|
|
43
|
+
*/
|
|
37
44
|
export const getTopic = wrapCommand(GET_TOPIC);
|
|
38
45
|
//# sourceMappingURL=get-topic.command.js.map
|
|
@@ -19,13 +19,24 @@
|
|
|
19
19
|
import type { CommandResponse } from '../../client/client.type.js';
|
|
20
20
|
import { type Id } from '../identifier.utils.js';
|
|
21
21
|
import { type Topic } from './topic.utils.js';
|
|
22
|
+
/**
|
|
23
|
+
* Parameters for the get topics command.
|
|
24
|
+
*/
|
|
22
25
|
export type GetTopics = {
|
|
26
|
+
/** Stream identifier (ID or name) */
|
|
23
27
|
streamId: Id;
|
|
24
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Get topics command definition.
|
|
31
|
+
* Retrieves all topics within a stream.
|
|
32
|
+
*/
|
|
25
33
|
export declare const GET_TOPICS: {
|
|
26
34
|
code: number;
|
|
27
35
|
serialize: ({ streamId }: GetTopics) => Buffer<ArrayBufferLike>;
|
|
28
36
|
deserialize: (r: CommandResponse) => Topic[];
|
|
29
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* Executable get topics command function.
|
|
40
|
+
*/
|
|
30
41
|
export declare const getTopics: (getClient: import("../../client/client.type.js").ClientProvider) => (arg: GetTopics) => Promise<Topic[]>;
|
|
31
42
|
//# sourceMappingURL=get-topics.command.d.ts.map
|
|
@@ -20,6 +20,10 @@ import { wrapCommand } from '../command.utils.js';
|
|
|
20
20
|
import { COMMAND_CODE } from '../command.code.js';
|
|
21
21
|
import { serializeIdentifier } from '../identifier.utils.js';
|
|
22
22
|
import { deserializeTopics } from './topic.utils.js';
|
|
23
|
+
/**
|
|
24
|
+
* Get topics command definition.
|
|
25
|
+
* Retrieves all topics within a stream.
|
|
26
|
+
*/
|
|
23
27
|
export const GET_TOPICS = {
|
|
24
28
|
code: COMMAND_CODE.GetTopics,
|
|
25
29
|
serialize: ({ streamId }) => {
|
|
@@ -29,5 +33,8 @@ export const GET_TOPICS = {
|
|
|
29
33
|
return deserializeTopics(r.data);
|
|
30
34
|
}
|
|
31
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* Executable get topics command function.
|
|
38
|
+
*/
|
|
32
39
|
export const getTopics = wrapCommand(GET_TOPICS);
|
|
33
40
|
//# sourceMappingURL=get-topics.command.js.map
|
|
@@ -17,14 +17,26 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { type Id } from '../identifier.utils.js';
|
|
20
|
+
/**
|
|
21
|
+
* Parameters for the purge topic command.
|
|
22
|
+
*/
|
|
20
23
|
export type PurgeTopic = {
|
|
24
|
+
/** Stream identifier (ID or name) */
|
|
21
25
|
streamId: Id;
|
|
26
|
+
/** Topic identifier (ID or name) */
|
|
22
27
|
topicId: Id;
|
|
23
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Purge topic command definition.
|
|
31
|
+
* Deletes all messages from a topic while keeping the topic itself.
|
|
32
|
+
*/
|
|
24
33
|
export declare const PURGE_TOPIC: {
|
|
25
34
|
code: number;
|
|
26
35
|
serialize: ({ streamId, topicId }: PurgeTopic) => Buffer<ArrayBuffer>;
|
|
27
36
|
deserialize: (r: import("../../index.js").CommandResponse) => boolean;
|
|
28
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* Executable purge topic command function.
|
|
40
|
+
*/
|
|
29
41
|
export declare const purgeTopic: (getClient: import("../../index.js").ClientProvider) => (arg: PurgeTopic) => Promise<boolean>;
|
|
30
42
|
//# sourceMappingURL=purge-topic.command.d.ts.map
|
|
@@ -20,6 +20,10 @@ import { serializeIdentifier } from '../identifier.utils.js';
|
|
|
20
20
|
import { COMMAND_CODE } from '../command.code.js';
|
|
21
21
|
import { deserializeVoidResponse } from '../../client/client.utils.js';
|
|
22
22
|
import { wrapCommand } from '../command.utils.js';
|
|
23
|
+
/**
|
|
24
|
+
* Purge topic command definition.
|
|
25
|
+
* Deletes all messages from a topic while keeping the topic itself.
|
|
26
|
+
*/
|
|
23
27
|
export const PURGE_TOPIC = {
|
|
24
28
|
code: COMMAND_CODE.PurgeTopic,
|
|
25
29
|
serialize: ({ streamId, topicId }) => {
|
|
@@ -30,5 +34,8 @@ export const PURGE_TOPIC = {
|
|
|
30
34
|
},
|
|
31
35
|
deserialize: deserializeVoidResponse
|
|
32
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* Executable purge topic command function.
|
|
39
|
+
*/
|
|
33
40
|
export const purgeTopic = wrapCommand(PURGE_TOPIC);
|
|
34
41
|
//# sourceMappingURL=purge-topic.command.js.map
|
|
@@ -17,55 +17,128 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import type { ValueOf } from '../../type.utils.js';
|
|
20
|
+
/**
|
|
21
|
+
* Basic topic information without partition details.
|
|
22
|
+
*/
|
|
20
23
|
export type BaseTopic = {
|
|
24
|
+
/** Topic ID */
|
|
21
25
|
id: number;
|
|
26
|
+
/** Topic name */
|
|
22
27
|
name: string;
|
|
28
|
+
/** Topic creation timestamp */
|
|
23
29
|
createdAt: Date;
|
|
30
|
+
/** Number of partitions */
|
|
24
31
|
partitionsCount: number;
|
|
32
|
+
/** Compression algorithm used */
|
|
25
33
|
compressionAlgorithm: number;
|
|
34
|
+
/** Message expiry time in microseconds (0 = unlimited) */
|
|
26
35
|
messageExpiry: bigint;
|
|
36
|
+
/** Maximum topic size in bytes (0 = unlimited) */
|
|
27
37
|
maxTopicSize: bigint;
|
|
38
|
+
/** Replication factor */
|
|
28
39
|
replicationFactor: number;
|
|
40
|
+
/** Total size of the topic in bytes */
|
|
29
41
|
sizeBytes: bigint;
|
|
42
|
+
/** Total number of messages in the topic */
|
|
30
43
|
messagesCount: bigint;
|
|
31
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* Partition information within a topic.
|
|
47
|
+
*/
|
|
32
48
|
export type Partition = {
|
|
49
|
+
/** Partition ID */
|
|
33
50
|
id: number;
|
|
51
|
+
/** Partition creation timestamp */
|
|
34
52
|
createdAt: Date;
|
|
53
|
+
/** Number of segments in the partition */
|
|
35
54
|
segmentsCount: number;
|
|
55
|
+
/** Current offset in the partition */
|
|
36
56
|
currentOffset: bigint;
|
|
57
|
+
/** Total size of the partition in bytes */
|
|
37
58
|
sizeBytes: bigint;
|
|
59
|
+
/** Total number of messages in the partition */
|
|
38
60
|
messagesCount: bigint;
|
|
39
61
|
};
|
|
62
|
+
/** Topic with partition details */
|
|
40
63
|
export type Topic = BaseTopic & {
|
|
41
64
|
partitions: Partition[];
|
|
42
65
|
};
|
|
66
|
+
/** Base serialization result */
|
|
43
67
|
type Serialized = {
|
|
44
68
|
bytesRead: number;
|
|
45
69
|
};
|
|
70
|
+
/** Result of deserializing a partition */
|
|
46
71
|
type PartitionSerialized = {
|
|
47
72
|
data: Partition;
|
|
48
73
|
} & Serialized;
|
|
74
|
+
/** Result of deserializing a base topic */
|
|
49
75
|
type BaseTopicSerialized = {
|
|
50
76
|
data: BaseTopic;
|
|
51
77
|
} & Serialized;
|
|
78
|
+
/** Result of deserializing a topic */
|
|
52
79
|
type TopicSerialized = {
|
|
53
80
|
data: Topic;
|
|
54
81
|
} & Serialized;
|
|
82
|
+
/**
|
|
83
|
+
* Compression algorithm options.
|
|
84
|
+
*/
|
|
55
85
|
export declare const CompressionAlgorithm: {
|
|
86
|
+
/** No compression */
|
|
56
87
|
None: number;
|
|
88
|
+
/** Gzip compression */
|
|
57
89
|
Gzip: number;
|
|
58
90
|
};
|
|
91
|
+
/** Type alias for the CompressionAlgorithm object */
|
|
59
92
|
export type CompressionAlgorithmKind = typeof CompressionAlgorithm;
|
|
93
|
+
/** String literal type of compression algorithm names */
|
|
60
94
|
export type CompressionAlgorithmKindId = keyof CompressionAlgorithm;
|
|
95
|
+
/** Numeric values of compression algorithms */
|
|
61
96
|
export type CompressionAlgorithmKindValue = ValueOf<CompressionAlgorithm>;
|
|
97
|
+
/** No compression type */
|
|
62
98
|
export type CompressionAlgorithmNone = CompressionAlgorithmKind['None'];
|
|
99
|
+
/** Gzip compression type */
|
|
63
100
|
export type CompressionAlgorithmGzip = CompressionAlgorithmKind['Gzip'];
|
|
101
|
+
/** Union of compression algorithm types */
|
|
64
102
|
export type CompressionAlgorithm = CompressionAlgorithmNone | CompressionAlgorithmGzip;
|
|
103
|
+
/**
|
|
104
|
+
* Type guard for valid compression algorithms.
|
|
105
|
+
*
|
|
106
|
+
* @param ca - Compression algorithm value to check
|
|
107
|
+
* @returns True if the value is a valid compression algorithm
|
|
108
|
+
*/
|
|
65
109
|
export declare const isValidCompressionAlgorithm: (ca: number) => ca is CompressionAlgorithm;
|
|
110
|
+
/**
|
|
111
|
+
* Deserializes a base topic from a buffer.
|
|
112
|
+
*
|
|
113
|
+
* @param p - Buffer containing serialized topic data
|
|
114
|
+
* @param pos - Starting position in the buffer
|
|
115
|
+
* @returns Object with bytes read and deserialized topic data
|
|
116
|
+
*/
|
|
66
117
|
export declare const deserializeBaseTopic: (p: Buffer, pos?: number) => BaseTopicSerialized;
|
|
118
|
+
/**
|
|
119
|
+
* Deserializes a partition from a buffer.
|
|
120
|
+
*
|
|
121
|
+
* @param p - Buffer containing serialized partition data
|
|
122
|
+
* @param pos - Starting position in the buffer
|
|
123
|
+
* @returns Object with bytes read and deserialized partition data
|
|
124
|
+
*/
|
|
67
125
|
export declare const deserializePartition: (p: Buffer, pos?: number) => PartitionSerialized;
|
|
126
|
+
/**
|
|
127
|
+
* Deserializes a topic with partitions from a buffer.
|
|
128
|
+
*
|
|
129
|
+
* @param p - Buffer containing serialized topic data
|
|
130
|
+
* @param pos - Starting position in the buffer
|
|
131
|
+
* @returns Object with bytes read and deserialized topic with partitions
|
|
132
|
+
* @throws Error if the buffer is empty (topic does not exist)
|
|
133
|
+
*/
|
|
68
134
|
export declare const deserializeTopic: (p: Buffer, pos?: number) => TopicSerialized;
|
|
135
|
+
/**
|
|
136
|
+
* Deserializes multiple topics from a buffer.
|
|
137
|
+
*
|
|
138
|
+
* @param p - Buffer containing serialized topics data
|
|
139
|
+
* @param pos - Starting position in the buffer
|
|
140
|
+
* @returns Array of deserialized topics
|
|
141
|
+
*/
|
|
69
142
|
export declare const deserializeTopics: (p: Buffer, pos?: number) => Topic[];
|
|
70
143
|
export {};
|
|
71
144
|
//# sourceMappingURL=topic.utils.d.ts.map
|
|
@@ -17,11 +17,29 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { toDate } from '../serialize.utils.js';
|
|
20
|
+
/**
|
|
21
|
+
* Compression algorithm options.
|
|
22
|
+
*/
|
|
20
23
|
export const CompressionAlgorithm = {
|
|
24
|
+
/** No compression */
|
|
21
25
|
None: 1,
|
|
26
|
+
/** Gzip compression */
|
|
22
27
|
Gzip: 2
|
|
23
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Type guard for valid compression algorithms.
|
|
31
|
+
*
|
|
32
|
+
* @param ca - Compression algorithm value to check
|
|
33
|
+
* @returns True if the value is a valid compression algorithm
|
|
34
|
+
*/
|
|
24
35
|
export const isValidCompressionAlgorithm = (ca) => Object.values(CompressionAlgorithm).includes(ca);
|
|
36
|
+
/**
|
|
37
|
+
* Deserializes a base topic from a buffer.
|
|
38
|
+
*
|
|
39
|
+
* @param p - Buffer containing serialized topic data
|
|
40
|
+
* @param pos - Starting position in the buffer
|
|
41
|
+
* @returns Object with bytes read and deserialized topic data
|
|
42
|
+
*/
|
|
25
43
|
export const deserializeBaseTopic = (p, pos = 0) => {
|
|
26
44
|
const id = p.readUInt32LE(pos);
|
|
27
45
|
const createdAt = toDate(p.readBigUint64LE(pos + 4));
|
|
@@ -50,6 +68,13 @@ export const deserializeBaseTopic = (p, pos = 0) => {
|
|
|
50
68
|
}
|
|
51
69
|
};
|
|
52
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* Deserializes a partition from a buffer.
|
|
73
|
+
*
|
|
74
|
+
* @param p - Buffer containing serialized partition data
|
|
75
|
+
* @param pos - Starting position in the buffer
|
|
76
|
+
* @returns Object with bytes read and deserialized partition data
|
|
77
|
+
*/
|
|
53
78
|
export const deserializePartition = (p, pos = 0) => {
|
|
54
79
|
return {
|
|
55
80
|
bytesRead: 4 + 8 + 4 + 8 + 8 + 8,
|
|
@@ -63,6 +88,14 @@ export const deserializePartition = (p, pos = 0) => {
|
|
|
63
88
|
}
|
|
64
89
|
};
|
|
65
90
|
};
|
|
91
|
+
/**
|
|
92
|
+
* Deserializes a topic with partitions from a buffer.
|
|
93
|
+
*
|
|
94
|
+
* @param p - Buffer containing serialized topic data
|
|
95
|
+
* @param pos - Starting position in the buffer
|
|
96
|
+
* @returns Object with bytes read and deserialized topic with partitions
|
|
97
|
+
* @throws Error if the buffer is empty (topic does not exist)
|
|
98
|
+
*/
|
|
66
99
|
export const deserializeTopic = (p, pos = 0) => {
|
|
67
100
|
if (p.length === 0)
|
|
68
101
|
throw new Error('Topic does not exist');
|
|
@@ -78,6 +111,13 @@ export const deserializeTopic = (p, pos = 0) => {
|
|
|
78
111
|
}
|
|
79
112
|
return { bytesRead: pos - start, data: { ...data, partitions } };
|
|
80
113
|
};
|
|
114
|
+
/**
|
|
115
|
+
* Deserializes multiple topics from a buffer.
|
|
116
|
+
*
|
|
117
|
+
* @param p - Buffer containing serialized topics data
|
|
118
|
+
* @param pos - Starting position in the buffer
|
|
119
|
+
* @returns Array of deserialized topics
|
|
120
|
+
*/
|
|
81
121
|
export const deserializeTopics = (p, pos = 0) => {
|
|
82
122
|
const topics = [];
|
|
83
123
|
const len = p.length;
|
|
@@ -18,19 +18,36 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { type Id } from '../identifier.utils.js';
|
|
20
20
|
import { type CompressionAlgorithm as CompressionAlgorithmT } from './topic.utils.js';
|
|
21
|
+
/**
|
|
22
|
+
* Parameters for the update topic command.
|
|
23
|
+
*/
|
|
21
24
|
export type UpdateTopic = {
|
|
25
|
+
/** Stream identifier (ID or name) */
|
|
22
26
|
streamId: Id;
|
|
27
|
+
/** Topic identifier (ID or name) */
|
|
23
28
|
topicId: Id;
|
|
29
|
+
/** New topic name (1-255 bytes) */
|
|
24
30
|
name: string;
|
|
31
|
+
/** Compression algorithm (None or Gzip) */
|
|
25
32
|
compressionAlgorithm?: CompressionAlgorithmT;
|
|
33
|
+
/** Message expiry time in microseconds (0 = unlimited) */
|
|
26
34
|
messageExpiry?: bigint;
|
|
35
|
+
/** Maximum topic size in bytes (0 = unlimited) */
|
|
27
36
|
maxTopicSize?: bigint;
|
|
37
|
+
/** Replication factor (1-255) */
|
|
28
38
|
replicationFactor?: number;
|
|
29
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Update topic command definition.
|
|
42
|
+
* Updates a topic's configuration.
|
|
43
|
+
*/
|
|
30
44
|
export declare const UPDATE_TOPIC: {
|
|
31
45
|
code: number;
|
|
32
46
|
serialize: ({ streamId, topicId, name, compressionAlgorithm, messageExpiry, maxTopicSize, replicationFactor, }: UpdateTopic) => Buffer<ArrayBuffer>;
|
|
33
47
|
deserialize: (r: import("../../index.js").CommandResponse) => boolean;
|
|
34
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* Executable update topic command function.
|
|
51
|
+
*/
|
|
35
52
|
export declare const updateTopic: (getClient: import("../../index.js").ClientProvider) => (arg: UpdateTopic) => Promise<boolean>;
|
|
36
53
|
//# sourceMappingURL=update-topic.command.d.ts.map
|
|
@@ -21,6 +21,10 @@ 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
23
|
import { CompressionAlgorithm, isValidCompressionAlgorithm } from './topic.utils.js';
|
|
24
|
+
/**
|
|
25
|
+
* Update topic command definition.
|
|
26
|
+
* Updates a topic's configuration.
|
|
27
|
+
*/
|
|
24
28
|
export const UPDATE_TOPIC = {
|
|
25
29
|
code: COMMAND_CODE.UpdateTopic,
|
|
26
30
|
serialize: ({ streamId, topicId, name, compressionAlgorithm = CompressionAlgorithm.None, messageExpiry = 0n, maxTopicSize = 0n, replicationFactor = 1, }) => {
|
|
@@ -46,5 +50,8 @@ export const UPDATE_TOPIC = {
|
|
|
46
50
|
},
|
|
47
51
|
deserialize: deserializeVoidResponse
|
|
48
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* Executable update topic command function.
|
|
55
|
+
*/
|
|
49
56
|
export const updateTopic = wrapCommand(UPDATE_TOPIC);
|
|
50
57
|
//# sourceMappingURL=update-topic.command.js.map
|
|
@@ -16,15 +16,28 @@
|
|
|
16
16
|
* specific language governing permissions and limitations
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
|
+
/**
|
|
20
|
+
* Parameters for the change password command.
|
|
21
|
+
*/
|
|
19
22
|
export type ChangePassword = {
|
|
23
|
+
/** User ID */
|
|
20
24
|
userId: number;
|
|
25
|
+
/** Current password (1-255 bytes) */
|
|
21
26
|
currentPassword: string;
|
|
27
|
+
/** New password (1-255 bytes) */
|
|
22
28
|
newPassword: string;
|
|
23
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Change password command definition.
|
|
32
|
+
* Changes a user's password.
|
|
33
|
+
*/
|
|
24
34
|
export declare const CHANGE_PASSWORD: {
|
|
25
35
|
code: number;
|
|
26
36
|
serialize: ({ userId, currentPassword, newPassword }: ChangePassword) => Buffer<ArrayBuffer>;
|
|
27
37
|
deserialize: (r: import("../../index.js").CommandResponse) => boolean;
|
|
28
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Executable change password command function.
|
|
41
|
+
*/
|
|
29
42
|
export declare const changePassword: (getClient: import("../../index.js").ClientProvider) => (arg: ChangePassword) => Promise<boolean>;
|
|
30
43
|
//# sourceMappingURL=change-password.command.d.ts.map
|
|
@@ -21,6 +21,10 @@ import { serializeIdentifier } from '../identifier.utils.js';
|
|
|
21
21
|
import { deserializeVoidResponse } from '../../client/client.utils.js';
|
|
22
22
|
import { wrapCommand } from '../command.utils.js';
|
|
23
23
|
import { COMMAND_CODE } from '../command.code.js';
|
|
24
|
+
/**
|
|
25
|
+
* Change password command definition.
|
|
26
|
+
* Changes a user's password.
|
|
27
|
+
*/
|
|
24
28
|
export const CHANGE_PASSWORD = {
|
|
25
29
|
code: COMMAND_CODE.ChangePassword,
|
|
26
30
|
serialize: ({ userId, currentPassword, newPassword }) => {
|
|
@@ -41,5 +45,8 @@ export const CHANGE_PASSWORD = {
|
|
|
41
45
|
},
|
|
42
46
|
deserialize: deserializeVoidResponse
|
|
43
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* Executable change password command function.
|
|
50
|
+
*/
|
|
44
51
|
export const changePassword = wrapCommand(CHANGE_PASSWORD);
|
|
45
52
|
//# sourceMappingURL=change-password.command.js.map
|
|
@@ -19,16 +19,30 @@
|
|
|
19
19
|
import type { CommandResponse } from '../../client/client.type.js';
|
|
20
20
|
import { type User, type UserStatus } from './user.utils.js';
|
|
21
21
|
import { type UserPermissions } from './permissions.utils.js';
|
|
22
|
+
/**
|
|
23
|
+
* Parameters for the create user command.
|
|
24
|
+
*/
|
|
22
25
|
export type CreateUser = {
|
|
26
|
+
/** Username (1-255 bytes) */
|
|
23
27
|
username: string;
|
|
28
|
+
/** Password (1-255 bytes) */
|
|
24
29
|
password: string;
|
|
30
|
+
/** User status (Active or Inactive) */
|
|
25
31
|
status: UserStatus;
|
|
32
|
+
/** Optional user permissions */
|
|
26
33
|
permissions?: UserPermissions;
|
|
27
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Create user command definition.
|
|
37
|
+
* Creates a new user with the specified credentials and permissions.
|
|
38
|
+
*/
|
|
28
39
|
export declare const CREATE_USER: {
|
|
29
40
|
code: number;
|
|
30
41
|
serialize: ({ username, password, status, permissions }: CreateUser) => Buffer<ArrayBuffer>;
|
|
31
42
|
deserialize: (r: CommandResponse) => User;
|
|
32
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* Executable create user command function.
|
|
46
|
+
*/
|
|
33
47
|
export declare const createUser: (getClient: import("../../client/client.type.js").ClientProvider) => (arg: CreateUser) => Promise<User>;
|
|
34
48
|
//# sourceMappingURL=create-user.command.d.ts.map
|
|
@@ -21,6 +21,10 @@ import { COMMAND_CODE } from '../command.code.js';
|
|
|
21
21
|
import { deserializeUser } from './user.utils.js';
|
|
22
22
|
import { uint8ToBuf, uint32ToBuf, boolToBuf } from '../number.utils.js';
|
|
23
23
|
import { serializePermissions } from './permissions.utils.js';
|
|
24
|
+
/**
|
|
25
|
+
* Create user command definition.
|
|
26
|
+
* Creates a new user with the specified credentials and permissions.
|
|
27
|
+
*/
|
|
24
28
|
export const CREATE_USER = {
|
|
25
29
|
code: COMMAND_CODE.CreateUser,
|
|
26
30
|
serialize: ({ username, password, status, permissions }) => {
|
|
@@ -44,5 +48,8 @@ export const CREATE_USER = {
|
|
|
44
48
|
},
|
|
45
49
|
deserialize: (r) => deserializeUser(r.data)
|
|
46
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* Executable create user command function.
|
|
53
|
+
*/
|
|
47
54
|
export const createUser = wrapCommand(CREATE_USER);
|
|
48
55
|
//# sourceMappingURL=create-user.command.js.map
|
|
@@ -17,13 +17,24 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { type Id } from '../identifier.utils.js';
|
|
20
|
+
/**
|
|
21
|
+
* Parameters for the delete user command.
|
|
22
|
+
*/
|
|
20
23
|
export type DeleteUser = {
|
|
24
|
+
/** User identifier (ID or username) */
|
|
21
25
|
userId: Id;
|
|
22
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Delete user command definition.
|
|
29
|
+
* Removes a user from the system.
|
|
30
|
+
*/
|
|
23
31
|
export declare const DELETE_USER: {
|
|
24
32
|
code: number;
|
|
25
33
|
serialize: ({ userId }: DeleteUser) => Buffer<ArrayBufferLike>;
|
|
26
34
|
deserialize: (r: import("../../index.js").CommandResponse) => boolean;
|
|
27
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* Executable delete user command function.
|
|
38
|
+
*/
|
|
28
39
|
export declare const deleteUser: (getClient: import("../../index.js").ClientProvider) => (arg: DeleteUser) => Promise<boolean>;
|
|
29
40
|
//# sourceMappingURL=delete-user.command.d.ts.map
|
|
@@ -20,6 +20,10 @@ import { deserializeVoidResponse } from '../../client/client.utils.js';
|
|
|
20
20
|
import { wrapCommand } from '../command.utils.js';
|
|
21
21
|
import { COMMAND_CODE } from '../command.code.js';
|
|
22
22
|
import { serializeIdentifier } from '../identifier.utils.js';
|
|
23
|
+
/**
|
|
24
|
+
* Delete user command definition.
|
|
25
|
+
* Removes a user from the system.
|
|
26
|
+
*/
|
|
23
27
|
export const DELETE_USER = {
|
|
24
28
|
code: COMMAND_CODE.DeleteUser,
|
|
25
29
|
serialize: ({ userId }) => {
|
|
@@ -27,5 +31,8 @@ export const DELETE_USER = {
|
|
|
27
31
|
},
|
|
28
32
|
deserialize: deserializeVoidResponse
|
|
29
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* Executable delete user command function.
|
|
36
|
+
*/
|
|
30
37
|
export const deleteUser = wrapCommand(DELETE_USER);
|
|
31
38
|
//# sourceMappingURL=delete-user.command.js.map
|