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.
Files changed (149) hide show
  1. package/dist/client/client.connection.d.ts +49 -0
  2. package/dist/client/client.connection.js +79 -0
  3. package/dist/client/client.d.ts +46 -0
  4. package/dist/client/client.debug.d.ts +4 -0
  5. package/dist/client/client.debug.js +4 -0
  6. package/dist/client/client.js +65 -1
  7. package/dist/client/client.socket.d.ts +91 -0
  8. package/dist/client/client.socket.js +94 -0
  9. package/dist/client/client.type.d.ts +72 -0
  10. package/dist/client/client.type.js +3 -0
  11. package/dist/client/client.utils.d.ts +28 -0
  12. package/dist/client/client.utils.js +29 -0
  13. package/dist/e2e/tcp.cluster.e2e.js +1 -1
  14. package/dist/index.d.ts +3 -3
  15. package/dist/index.js +3 -3
  16. package/dist/tcp.sm.utils.d.ts +31 -42
  17. package/dist/tcp.sm.utils.js +38 -22
  18. package/dist/type.utils.d.ts +14 -0
  19. package/dist/type.utils.js +9 -0
  20. package/dist/wire/command-set.d.ts +2 -9
  21. package/dist/wire/command.utils.d.ts +18 -0
  22. package/dist/wire/command.utils.js +9 -0
  23. package/dist/wire/consumer-group/create-group.command.d.ts +13 -0
  24. package/dist/wire/consumer-group/create-group.command.js +7 -0
  25. package/dist/wire/consumer-group/delete-group.command.d.ts +13 -0
  26. package/dist/wire/consumer-group/delete-group.command.js +7 -0
  27. package/dist/wire/consumer-group/ensure-group.virtual.command.d.ts +15 -1
  28. package/dist/wire/consumer-group/ensure-group.virtual.command.js +14 -0
  29. package/dist/wire/consumer-group/get-group.command.d.ts +13 -0
  30. package/dist/wire/consumer-group/get-group.command.js +7 -0
  31. package/dist/wire/consumer-group/get-groups.command.d.ts +12 -0
  32. package/dist/wire/consumer-group/get-groups.command.js +7 -0
  33. package/dist/wire/consumer-group/group.utils.d.ts +34 -0
  34. package/dist/wire/consumer-group/group.utils.js +22 -0
  35. package/dist/wire/consumer-group/join-group.command.d.ts +13 -0
  36. package/dist/wire/consumer-group/join-group.command.js +7 -0
  37. package/dist/wire/consumer-group/leave-group.command.d.ts +13 -0
  38. package/dist/wire/consumer-group/leave-group.command.js +7 -0
  39. package/dist/wire/identifier.utils.d.ts +11 -0
  40. package/dist/wire/identifier.utils.js +23 -1
  41. package/dist/wire/message/flush-unsaved-buffers.command.d.ts +13 -0
  42. package/dist/wire/message/flush-unsaved-buffers.command.js +7 -0
  43. package/dist/wire/message/header.type.d.ts +57 -15
  44. package/dist/wire/message/header.type.js +31 -18
  45. package/dist/wire/message/header.utils.d.ts +104 -10
  46. package/dist/wire/message/header.utils.js +233 -86
  47. package/dist/wire/message/header.utils.test.js +39 -16
  48. package/dist/wire/message/iggy-header.utils.d.ts +39 -1
  49. package/dist/wire/message/iggy-header.utils.js +30 -3
  50. package/dist/wire/message/index.d.ts +5 -5
  51. package/dist/wire/message/index.js +5 -5
  52. package/dist/wire/message/message.utils.d.ts +60 -0
  53. package/dist/wire/message/message.utils.js +54 -1
  54. package/dist/wire/message/partitioning.utils.d.ts +39 -0
  55. package/dist/wire/message/partitioning.utils.js +43 -1
  56. package/dist/wire/message/poll-messages.command.d.ts +17 -0
  57. package/dist/wire/message/poll-messages.command.js +7 -0
  58. package/dist/wire/message/poll.utils.d.ts +93 -12
  59. package/dist/wire/message/poll.utils.js +92 -21
  60. package/dist/wire/message/send-messages.command.d.ts +14 -0
  61. package/dist/wire/message/send-messages.command.js +7 -0
  62. package/dist/wire/message/send-messages.command.test.js +103 -39
  63. package/dist/wire/number.utils.d.ts +79 -0
  64. package/dist/wire/number.utils.js +79 -2
  65. package/dist/wire/offset/delete-offset.command.d.ts +13 -3
  66. package/dist/wire/offset/delete-offset.command.js +7 -0
  67. package/dist/wire/offset/get-offset.command.d.ts +14 -0
  68. package/dist/wire/offset/get-offset.command.js +7 -0
  69. package/dist/wire/offset/offset.utils.d.ts +48 -0
  70. package/dist/wire/offset/offset.utils.js +33 -0
  71. package/dist/wire/offset/store-offset.command.d.ts +15 -0
  72. package/dist/wire/offset/store-offset.command.js +7 -0
  73. package/dist/wire/partition/create-partition.command.d.ts +13 -0
  74. package/dist/wire/partition/create-partition.command.js +7 -0
  75. package/dist/wire/partition/delete-partition.command.d.ts +13 -0
  76. package/dist/wire/partition/delete-partition.command.js +7 -0
  77. package/dist/wire/partition/partition.utils.d.ts +9 -0
  78. package/dist/wire/partition/partition.utils.js +9 -0
  79. package/dist/wire/serialize.utils.d.ts +20 -0
  80. package/dist/wire/serialize.utils.js +20 -0
  81. package/dist/wire/session/login-with-token.command.d.ts +11 -0
  82. package/dist/wire/session/login-with-token.command.js +7 -0
  83. package/dist/wire/session/login.command.d.ts +7 -0
  84. package/dist/wire/session/login.command.js +7 -0
  85. package/dist/wire/session/login.utils.d.ts +25 -0
  86. package/dist/wire/session/login.utils.js +14 -0
  87. package/dist/wire/session/logout.command.d.ts +7 -0
  88. package/dist/wire/session/logout.command.js +7 -0
  89. package/dist/wire/stream/create-stream.command.d.ts +12 -0
  90. package/dist/wire/stream/create-stream.command.js +7 -0
  91. package/dist/wire/stream/delete-stream.command.d.ts +11 -0
  92. package/dist/wire/stream/delete-stream.command.js +7 -0
  93. package/dist/wire/stream/ensure-stream.virtual.command.d.ts +8 -1
  94. package/dist/wire/stream/ensure-stream.virtual.command.js +7 -0
  95. package/dist/wire/stream/get-stream.command.d.ts +11 -0
  96. package/dist/wire/stream/get-stream.command.js +7 -0
  97. package/dist/wire/stream/get-streams.command.d.ts +7 -0
  98. package/dist/wire/stream/get-streams.command.js +7 -0
  99. package/dist/wire/stream/purge-stream.command.d.ts +11 -0
  100. package/dist/wire/stream/purge-stream.command.js +7 -0
  101. package/dist/wire/stream/stream.utils.d.ts +22 -0
  102. package/dist/wire/stream/stream.utils.js +8 -0
  103. package/dist/wire/stream/update-stream.command.d.ts +12 -0
  104. package/dist/wire/stream/update-stream.command.js +7 -0
  105. package/dist/wire/token/create-token.command.d.ts +12 -0
  106. package/dist/wire/token/create-token.command.js +7 -0
  107. package/dist/wire/token/delete-token.command.d.ts +11 -0
  108. package/dist/wire/token/delete-token.command.js +7 -0
  109. package/dist/wire/token/get-tokens.command.d.ts +7 -0
  110. package/dist/wire/token/get-tokens.command.js +7 -0
  111. package/dist/wire/token/token.utils.d.ts +40 -0
  112. package/dist/wire/token/token.utils.js +21 -0
  113. package/dist/wire/topic/create-topic.command.d.ts +17 -0
  114. package/dist/wire/topic/create-topic.command.js +7 -0
  115. package/dist/wire/topic/delete-topic.command.d.ts +14 -2
  116. package/dist/wire/topic/delete-topic.command.js +7 -0
  117. package/dist/wire/topic/ensure-topic.virtual.command.d.ts +9 -2
  118. package/dist/wire/topic/ensure-topic.virtual.command.js +7 -0
  119. package/dist/wire/topic/get-topic.command.d.ts +13 -2
  120. package/dist/wire/topic/get-topic.command.js +7 -0
  121. package/dist/wire/topic/get-topics.command.d.ts +11 -0
  122. package/dist/wire/topic/get-topics.command.js +7 -0
  123. package/dist/wire/topic/purge-topic.command.d.ts +12 -0
  124. package/dist/wire/topic/purge-topic.command.js +7 -0
  125. package/dist/wire/topic/topic.utils.d.ts +73 -0
  126. package/dist/wire/topic/topic.utils.js +40 -0
  127. package/dist/wire/topic/update-topic.command.d.ts +17 -0
  128. package/dist/wire/topic/update-topic.command.js +7 -0
  129. package/dist/wire/user/change-password.command.d.ts +13 -0
  130. package/dist/wire/user/change-password.command.js +7 -0
  131. package/dist/wire/user/create-user.command.d.ts +14 -0
  132. package/dist/wire/user/create-user.command.js +7 -0
  133. package/dist/wire/user/delete-user.command.d.ts +11 -0
  134. package/dist/wire/user/delete-user.command.js +7 -0
  135. package/dist/wire/user/get-user.command.d.ts +11 -0
  136. package/dist/wire/user/get-user.command.js +7 -0
  137. package/dist/wire/user/get-users.command.d.ts +7 -0
  138. package/dist/wire/user/get-users.command.js +7 -0
  139. package/dist/wire/user/permissions.utils.d.ts +108 -0
  140. package/dist/wire/user/permissions.utils.js +68 -0
  141. package/dist/wire/user/update-permissions.command.d.ts +12 -0
  142. package/dist/wire/user/update-permissions.command.js +7 -0
  143. package/dist/wire/user/update-user.command.d.ts +13 -0
  144. package/dist/wire/user/update-user.command.js +7 -0
  145. package/dist/wire/user/user.utils.d.ts +40 -0
  146. package/dist/wire/user/user.utils.js +33 -0
  147. package/dist/wire/uuid.utils.d.ts +13 -0
  148. package/dist/wire/uuid.utils.js +13 -1
  149. package/package.json +2 -2
@@ -16,13 +16,23 @@
16
16
  * specific language governing permissions and limitations
17
17
  * under the License.
18
18
  */
19
- import type { CommandResponse } from '../../client/client.type.js';
20
19
  import type { GetOffset } from './get-offset.command.js';
20
+ /**
21
+ * Parameters for the delete offset command.
22
+ * Same as GetOffset parameters.
23
+ */
21
24
  export type DeleteOffset = GetOffset;
25
+ /**
26
+ * Delete offset command definition.
27
+ * Removes a stored consumer offset.
28
+ */
22
29
  export declare const DELETE_OFFSET: {
23
30
  code: number;
24
31
  serialize: ({ streamId, topicId, consumer, partitionId }: DeleteOffset) => Buffer<ArrayBuffer>;
25
- deserialize: (r: CommandResponse) => boolean;
32
+ deserialize: (r: import("../../index.js").CommandResponse) => boolean;
26
33
  };
27
- export declare const deleteOffset: (getClient: import("../../client/client.type.js").ClientProvider) => (arg: GetOffset) => Promise<boolean>;
34
+ /**
35
+ * Executable delete offset command function.
36
+ */
37
+ export declare const deleteOffset: (getClient: import("../../index.js").ClientProvider) => (arg: GetOffset) => Promise<boolean>;
28
38
  //# sourceMappingURL=delete-offset.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 { serializeGetOffset } from './offset.utils.js';
22
22
  import { COMMAND_CODE } from '../command.code.js';
23
+ /**
24
+ * Delete offset command definition.
25
+ * Removes a stored consumer offset.
26
+ */
23
27
  export const DELETE_OFFSET = {
24
28
  code: COMMAND_CODE.DeleteConsumerOffset,
25
29
  serialize: ({ streamId, topicId, consumer, partitionId = 0 }) => {
@@ -27,5 +31,8 @@ export const DELETE_OFFSET = {
27
31
  },
28
32
  deserialize: deserializeVoidResponse
29
33
  };
34
+ /**
35
+ * Executable delete offset command function.
36
+ */
30
37
  export const deleteOffset = wrapCommand(DELETE_OFFSET);
31
38
  //# sourceMappingURL=delete-offset.command.js.map
@@ -19,12 +19,23 @@
19
19
  import type { CommandResponse } from '../../client/client.type.js';
20
20
  import type { Id } from '../identifier.utils.js';
21
21
  import { type Consumer, type OffsetResponse } from './offset.utils.js';
22
+ /**
23
+ * Parameters for the get offset command.
24
+ */
22
25
  export type GetOffset = {
26
+ /** Stream identifier (ID or name) */
23
27
  streamId: Id;
28
+ /** Topic identifier (ID or name) */
24
29
  topicId: Id;
30
+ /** Consumer identifier (single or group) */
25
31
  consumer: Consumer;
32
+ /** Partition ID (required for single consumer, null for group) */
26
33
  partitionId: number | null;
27
34
  };
35
+ /**
36
+ * Get offset command definition.
37
+ * Retrieves the current and stored offset for a consumer.
38
+ */
28
39
  export declare const GET_OFFSET: {
29
40
  code: number;
30
41
  serialize: ({ streamId, topicId, consumer, partitionId }: GetOffset) => Buffer<ArrayBuffer>;
@@ -34,5 +45,8 @@ export declare const GET_OFFSET: {
34
45
  storedOffset: bigint;
35
46
  } | null;
36
47
  };
48
+ /**
49
+ * Executable get offset command function.
50
+ */
37
51
  export declare const getOffset: (getClient: import("../../client/client.type.js").ClientProvider) => (arg: GetOffset) => Promise<OffsetResponse | null>;
38
52
  //# sourceMappingURL=get-offset.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 { serializeGetOffset } from './offset.utils.js';
22
+ /**
23
+ * Get offset command definition.
24
+ * Retrieves the current and stored offset for a consumer.
25
+ */
22
26
  export const GET_OFFSET = {
23
27
  code: COMMAND_CODE.GetOffset,
24
28
  serialize: ({ streamId, topicId, consumer, partitionId = 0 }) => {
@@ -37,5 +41,8 @@ export const GET_OFFSET = {
37
41
  };
38
42
  }
39
43
  };
44
+ /**
45
+ * Executable get offset command function.
46
+ */
40
47
  export const getOffset = wrapCommand(GET_OFFSET);
41
48
  //# sourceMappingURL=get-offset.command.js.map
@@ -18,37 +18,85 @@
18
18
  */
19
19
  import type { ValueOf } from '../../type.utils.js';
20
20
  import { type Id } from '../identifier.utils.js';
21
+ /**
22
+ * Consumer kind options for offset operations.
23
+ */
21
24
  export declare const ConsumerKind: {
25
+ /** Single consumer (not part of a group) */
22
26
  readonly Single: 1;
27
+ /** Consumer group member */
23
28
  readonly Group: 2;
24
29
  };
30
+ /** Type alias for the ConsumerKind object */
25
31
  export type ConsumerKind = typeof ConsumerKind;
32
+ /** String literal type of consumer kind names */
26
33
  export type ConsumerKindId = keyof ConsumerKind;
34
+ /** Numeric values of consumer kinds */
27
35
  export type ConsumerKindValue = ValueOf<ConsumerKind>;
36
+ /**
37
+ * Consumer identifier for offset operations.
38
+ */
28
39
  export type Consumer = {
40
+ /** Consumer kind (Single or Group) */
29
41
  kind: ConsumerKindValue;
42
+ /** Consumer or group identifier */
30
43
  id: Id;
31
44
  };
45
+ /**
46
+ * Default single consumer instance.
47
+ */
32
48
  export declare const ConsumerSingle: {
33
49
  kind: 1;
34
50
  id: number;
35
51
  };
52
+ /** Type for single consumer */
36
53
  export type ConsumerSingle = typeof ConsumerSingle;
54
+ /**
55
+ * Consumer factory for creating consumer identifiers.
56
+ */
37
57
  export declare const Consumer: {
58
+ /** Single consumer instance */
38
59
  Single: {
39
60
  kind: 1;
40
61
  id: number;
41
62
  };
63
+ /** Creates a group consumer identifier */
42
64
  Group: (groupId: Id) => {
43
65
  kind: 2;
44
66
  id: Id;
45
67
  };
46
68
  };
69
+ /**
70
+ * Response from offset operations.
71
+ */
47
72
  export type OffsetResponse = {
73
+ /** Partition ID */
48
74
  partitionId: number;
75
+ /** Current offset in the partition */
49
76
  currentOffset: bigint;
77
+ /** Stored consumer offset */
50
78
  storedOffset: bigint;
51
79
  };
80
+ /**
81
+ * Serializes parameters for get/delete offset operations.
82
+ *
83
+ * @param streamId - Stream identifier (ID or name)
84
+ * @param topicId - Topic identifier (ID or name)
85
+ * @param consumer - Consumer identifier (single or group)
86
+ * @param partitionId - Partition ID (required for single consumer, optional for group)
87
+ * @returns Buffer containing serialized offset request
88
+ * @throws Error if partitionId is null for single consumer kind
89
+ */
52
90
  export declare const serializeGetOffset: (streamId: Id, topicId: Id, consumer: Consumer, partitionId: number | null) => Buffer<ArrayBuffer>;
91
+ /**
92
+ * Serializes parameters for store offset operation.
93
+ *
94
+ * @param streamId - Stream identifier (ID or name)
95
+ * @param topicId - Topic identifier (ID or name)
96
+ * @param consumer - Consumer identifier (single or group)
97
+ * @param partitionId - Partition ID (required for single consumer, optional for group)
98
+ * @param offset - Offset value to store
99
+ * @returns Buffer containing serialized store offset request
100
+ */
53
101
  export declare const serializeStoreOffset: (streamId: Id, topicId: Id, consumer: Consumer, partitionId: number | null, offset: bigint) => Buffer<ArrayBuffer>;
54
102
  //# sourceMappingURL=offset.utils.d.ts.map
@@ -18,21 +18,44 @@
18
18
  */
19
19
  import { serializeIdentifier } from '../identifier.utils.js';
20
20
  import { uint8ToBuf } from '../number.utils.js';
21
+ /**
22
+ * Consumer kind options for offset operations.
23
+ */
21
24
  export const ConsumerKind = {
25
+ /** Single consumer (not part of a group) */
22
26
  Single: 1,
27
+ /** Consumer group member */
23
28
  Group: 2
24
29
  };
30
+ /**
31
+ * Default single consumer instance.
32
+ */
25
33
  export const ConsumerSingle = {
26
34
  kind: ConsumerKind.Single,
27
35
  id: 0
28
36
  };
37
+ /**
38
+ * Consumer factory for creating consumer identifiers.
39
+ */
29
40
  export const Consumer = {
41
+ /** Single consumer instance */
30
42
  Single: ConsumerSingle,
43
+ /** Creates a group consumer identifier */
31
44
  Group: (groupId) => ({
32
45
  kind: ConsumerKind.Group,
33
46
  id: groupId
34
47
  })
35
48
  };
49
+ /**
50
+ * Serializes parameters for get/delete offset operations.
51
+ *
52
+ * @param streamId - Stream identifier (ID or name)
53
+ * @param topicId - Topic identifier (ID or name)
54
+ * @param consumer - Consumer identifier (single or group)
55
+ * @param partitionId - Partition ID (required for single consumer, optional for group)
56
+ * @returns Buffer containing serialized offset request
57
+ * @throws Error if partitionId is null for single consumer kind
58
+ */
36
59
  export const serializeGetOffset = (streamId, topicId, consumer, partitionId) => {
37
60
  if (consumer.kind === ConsumerKind.Single && partitionId === null)
38
61
  throw new Error('getOffset error: partitionId must be provided for single consumer kind');
@@ -58,6 +81,16 @@ export const serializeGetOffset = (streamId, topicId, consumer, partitionId) =>
58
81
  b2
59
82
  ]);
60
83
  };
84
+ /**
85
+ * Serializes parameters for store offset operation.
86
+ *
87
+ * @param streamId - Stream identifier (ID or name)
88
+ * @param topicId - Topic identifier (ID or name)
89
+ * @param consumer - Consumer identifier (single or group)
90
+ * @param partitionId - Partition ID (required for single consumer, optional for group)
91
+ * @param offset - Offset value to store
92
+ * @returns Buffer containing serialized store offset request
93
+ */
61
94
  export const serializeStoreOffset = (streamId, topicId, consumer, partitionId, offset) => {
62
95
  const b = Buffer.allocUnsafe(8);
63
96
  b.writeBigUInt64LE(offset, 0);
@@ -18,17 +18,32 @@
18
18
  */
19
19
  import { type Id } from '../identifier.utils.js';
20
20
  import { type Consumer } from './offset.utils.js';
21
+ /**
22
+ * Parameters for the store offset command.
23
+ */
21
24
  export type StoreOffset = {
25
+ /** Stream identifier (ID or name) */
22
26
  streamId: Id;
27
+ /** Topic identifier (ID or name) */
23
28
  topicId: Id;
29
+ /** Consumer identifier (single or group) */
24
30
  consumer: Consumer;
31
+ /** Partition ID (required for single consumer, null for group) */
25
32
  partitionId: number | null;
33
+ /** Offset value to store */
26
34
  offset: bigint;
27
35
  };
36
+ /**
37
+ * Store offset command definition.
38
+ * Persists a consumer's offset for a partition.
39
+ */
28
40
  export declare const STORE_OFFSET: {
29
41
  code: number;
30
42
  serialize: ({ streamId, topicId, consumer, partitionId, offset }: StoreOffset) => Buffer<ArrayBuffer>;
31
43
  deserialize: (r: import("../../index.js").CommandResponse) => boolean;
32
44
  };
45
+ /**
46
+ * Executable store offset command function.
47
+ */
33
48
  export declare const storeOffset: (getClient: import("../../index.js").ClientProvider) => (arg: StoreOffset) => Promise<boolean>;
34
49
  //# sourceMappingURL=store-offset.command.d.ts.map
@@ -20,10 +20,17 @@ 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 { serializeStoreOffset } from './offset.utils.js';
23
+ /**
24
+ * Store offset command definition.
25
+ * Persists a consumer's offset for a partition.
26
+ */
23
27
  export const STORE_OFFSET = {
24
28
  code: COMMAND_CODE.StoreOffset,
25
29
  serialize: ({ streamId, topicId, consumer, partitionId, offset }) => serializeStoreOffset(streamId, topicId, consumer, partitionId, offset),
26
30
  deserialize: deserializeVoidResponse
27
31
  };
32
+ /**
33
+ * Executable store offset command function.
34
+ */
28
35
  export const storeOffset = wrapCommand(STORE_OFFSET);
29
36
  //# sourceMappingURL=store-offset.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 create partition command.
22
+ */
20
23
  export type CreatePartition = {
24
+ /** Stream identifier (ID or name) */
21
25
  streamId: Id;
26
+ /** Topic identifier (ID or name) */
22
27
  topicId: Id;
28
+ /** Number of partitions to create (1-1000, default: 1) */
23
29
  partitionCount?: number;
24
30
  };
31
+ /**
32
+ * Create partition command definition.
33
+ * Adds new partitions to a topic.
34
+ */
25
35
  export declare const CREATE_PARTITION: {
26
36
  code: number;
27
37
  serialize: ({ streamId, topicId, partitionCount }: CreatePartition) => Buffer<ArrayBuffer>;
28
38
  deserialize: (r: import("../../index.js").CommandResponse) => boolean;
29
39
  };
40
+ /**
41
+ * Executable create partition command function.
42
+ */
30
43
  export declare const createPartition: (getClient: import("../../index.js").ClientProvider) => (arg: CreatePartition) => Promise<boolean>;
31
44
  //# sourceMappingURL=create-partition.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 { deserializeVoidResponse } from '../../client/client.utils.js';
22
22
  import { serializePartitionParams } from './partition.utils.js';
23
+ /**
24
+ * Create partition command definition.
25
+ * Adds new partitions to a topic.
26
+ */
23
27
  export const CREATE_PARTITION = {
24
28
  code: COMMAND_CODE.CreatePartitions,
25
29
  serialize: ({ streamId, topicId, partitionCount = 1 }) => {
@@ -27,5 +31,8 @@ export const CREATE_PARTITION = {
27
31
  },
28
32
  deserialize: deserializeVoidResponse
29
33
  };
34
+ /**
35
+ * Executable create partition command function.
36
+ */
30
37
  export const createPartition = wrapCommand(CREATE_PARTITION);
31
38
  //# sourceMappingURL=create-partition.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 partition command.
22
+ */
20
23
  export type DeletePartition = {
24
+ /** Stream identifier (ID or name) */
21
25
  streamId: Id;
26
+ /** Topic identifier (ID or name) */
22
27
  topicId: Id;
28
+ /** Number of partitions to delete (1-1000) */
23
29
  partitionCount: number;
24
30
  };
31
+ /**
32
+ * Delete partitions command definition.
33
+ * Removes partitions from a topic.
34
+ */
25
35
  export declare const DELETE_PARTITIONS: {
26
36
  code: number;
27
37
  serialize: ({ streamId, topicId, partitionCount }: DeletePartition) => Buffer<ArrayBuffer>;
28
38
  deserialize: (r: import("../../index.js").CommandResponse) => boolean;
29
39
  };
40
+ /**
41
+ * Executable delete partition command function.
42
+ */
30
43
  export declare const deletePartition: (getClient: import("../../index.js").ClientProvider) => (arg: DeletePartition) => Promise<boolean>;
31
44
  //# sourceMappingURL=delete-partition.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 { serializePartitionParams } from './partition.utils.js';
22
22
  import { COMMAND_CODE } from '../command.code.js';
23
+ /**
24
+ * Delete partitions command definition.
25
+ * Removes partitions from a topic.
26
+ */
23
27
  export const DELETE_PARTITIONS = {
24
28
  code: COMMAND_CODE.DeletePartitions,
25
29
  serialize: ({ streamId, topicId, partitionCount }) => {
@@ -27,5 +31,8 @@ export const DELETE_PARTITIONS = {
27
31
  },
28
32
  deserialize: deserializeVoidResponse
29
33
  };
34
+ /**
35
+ * Executable delete partition command function.
36
+ */
30
37
  export const deletePartition = wrapCommand(DELETE_PARTITIONS);
31
38
  //# sourceMappingURL=delete-partition.command.js.map
@@ -17,5 +17,14 @@
17
17
  * under the License.
18
18
  */
19
19
  import { type Id } from '../identifier.utils.js';
20
+ /**
21
+ * Serializes partition parameters for create/delete operations.
22
+ *
23
+ * @param streamId - Stream identifier (ID or name)
24
+ * @param topicId - Topic identifier (ID or name)
25
+ * @param partitionCount - Number of partitions (1-1000)
26
+ * @returns Buffer containing serialized partition request
27
+ * @throws Error if partitionCount is not between 1 and 1000
28
+ */
20
29
  export declare const serializePartitionParams: (streamId: Id, topicId: Id, partitionCount?: number) => Buffer<ArrayBuffer>;
21
30
  //# sourceMappingURL=partition.utils.d.ts.map
@@ -18,6 +18,15 @@
18
18
  */
19
19
  import { serializeIdentifier } from '../identifier.utils.js';
20
20
  import { uint32ToBuf } from '../number.utils.js';
21
+ /**
22
+ * Serializes partition parameters for create/delete operations.
23
+ *
24
+ * @param streamId - Stream identifier (ID or name)
25
+ * @param topicId - Topic identifier (ID or name)
26
+ * @param partitionCount - Number of partitions (1-1000)
27
+ * @returns Buffer containing serialized partition request
28
+ * @throws Error if partitionCount is not between 1 and 1000
29
+ */
21
30
  export const serializePartitionParams = (streamId, topicId, partitionCount = 1) => {
22
31
  if (partitionCount < 1 || partitionCount > 1000)
23
32
  throw new Error('Topic partition_count must be between 1 and 1000');
@@ -16,7 +16,27 @@
16
16
  * specific language governing permissions and limitations
17
17
  * under the License.
18
18
  */
19
+ /**
20
+ * Converts a microsecond timestamp (BigInt) to a JavaScript Date object.
21
+ *
22
+ * @param n - Timestamp in microseconds as BigInt
23
+ * @returns JavaScript Date object
24
+ */
19
25
  export declare const toDate: (n: bigint) => Date;
26
+ /**
27
+ * Serializes a UUID string to a 16-byte Buffer.
28
+ * Removes dashes from the UUID and converts to binary format.
29
+ *
30
+ * @param id - UUID string (e.g., "550e8400-e29b-41d4-a716-446655440000")
31
+ * @returns 16-byte Buffer containing the UUID
32
+ */
20
33
  export declare const serializeUUID: (id: string) => Buffer<ArrayBuffer>;
34
+ /**
35
+ * Deserializes a 16-byte Buffer to a UUID string.
36
+ * Converts binary format to standard UUID string with dashes.
37
+ *
38
+ * @param p - 16-byte Buffer containing the UUID
39
+ * @returns UUID string (e.g., "550e8400-e29b-41d4-a716-446655440000")
40
+ */
21
41
  export declare const deserializeUUID: (p: Buffer) => string;
22
42
  //# sourceMappingURL=serialize.utils.d.ts.map
@@ -16,8 +16,28 @@
16
16
  * specific language governing permissions and limitations
17
17
  * under the License.
18
18
  */
19
+ /**
20
+ * Converts a microsecond timestamp (BigInt) to a JavaScript Date object.
21
+ *
22
+ * @param n - Timestamp in microseconds as BigInt
23
+ * @returns JavaScript Date object
24
+ */
19
25
  export const toDate = (n) => new Date(Number(n / BigInt(1000)));
26
+ /**
27
+ * Serializes a UUID string to a 16-byte Buffer.
28
+ * Removes dashes from the UUID and converts to binary format.
29
+ *
30
+ * @param id - UUID string (e.g., "550e8400-e29b-41d4-a716-446655440000")
31
+ * @returns 16-byte Buffer containing the UUID
32
+ */
20
33
  export const serializeUUID = (id) => Buffer.from(id.replaceAll('-', ''), 'hex');
34
+ /**
35
+ * Deserializes a 16-byte Buffer to a UUID string.
36
+ * Converts binary format to standard UUID string with dashes.
37
+ *
38
+ * @param p - 16-byte Buffer containing the UUID
39
+ * @returns UUID string (e.g., "550e8400-e29b-41d4-a716-446655440000")
40
+ */
21
41
  export const deserializeUUID = (p) => {
22
42
  const v = p.toString('hex');
23
43
  return `${v.slice(0, 8)}-` +
@@ -18,9 +18,17 @@
18
18
  */
19
19
  import type { CommandResponse } from '../../client/client.type.js';
20
20
  import { type LoginResponse } from './login.utils.js';
21
+ /**
22
+ * Parameters for the login with token command.
23
+ */
21
24
  export type LoginWithTokenParam = {
25
+ /** Access token string (1-255 bytes) */
22
26
  token: string;
23
27
  };
28
+ /**
29
+ * Login with token command definition.
30
+ * Authenticates a user with an access token.
31
+ */
24
32
  export declare const LOGIN_WITH_TOKEN: {
25
33
  code: number;
26
34
  serialize: ({ token }: LoginWithTokenParam) => Buffer<ArrayBuffer>;
@@ -28,5 +36,8 @@ export declare const LOGIN_WITH_TOKEN: {
28
36
  userId: number;
29
37
  };
30
38
  };
39
+ /**
40
+ * Executable login with token command function.
41
+ */
31
42
  export declare const loginWithToken: (getClient: import("../../client/client.type.js").ClientProvider) => (arg: LoginWithTokenParam) => Promise<LoginResponse>;
32
43
  //# sourceMappingURL=login-with-token.command.d.ts.map
@@ -19,6 +19,10 @@
19
19
  import { serializeLoginWithToken } from './login.utils.js';
20
20
  import { wrapCommand } from '../command.utils.js';
21
21
  import { COMMAND_CODE } from '../command.code.js';
22
+ /**
23
+ * Login with token command definition.
24
+ * Authenticates a user with an access token.
25
+ */
22
26
  export const LOGIN_WITH_TOKEN = {
23
27
  code: COMMAND_CODE.LoginWithAccessToken,
24
28
  serialize: ({ token }) => serializeLoginWithToken(token),
@@ -26,5 +30,8 @@ export const LOGIN_WITH_TOKEN = {
26
30
  userId: r.data.readUInt32LE(0)
27
31
  })
28
32
  };
33
+ /**
34
+ * Executable login with token command function.
35
+ */
29
36
  export const loginWithToken = wrapCommand(LOGIN_WITH_TOKEN);
30
37
  //# sourceMappingURL=login-with-token.command.js.map
@@ -18,6 +18,10 @@
18
18
  */
19
19
  import type { CommandResponse } from '../../client/client.type.js';
20
20
  import { type LoginResponse, type LoginCredentials } from './login.utils.js';
21
+ /**
22
+ * Login command definition.
23
+ * Authenticates a user with username and password.
24
+ */
21
25
  export declare const LOGIN: {
22
26
  code: number;
23
27
  serialize: ({ username, password, version, context }: LoginCredentials) => Buffer<ArrayBuffer>;
@@ -25,5 +29,8 @@ export declare const LOGIN: {
25
29
  userId: number;
26
30
  };
27
31
  };
32
+ /**
33
+ * Executable login command function.
34
+ */
28
35
  export declare const login: (getClient: import("../../client/client.type.js").ClientProvider) => (arg: LoginCredentials) => Promise<LoginResponse>;
29
36
  //# sourceMappingURL=login.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 { serializeLoginUser } from './login.utils.js';
22
+ /**
23
+ * Login command definition.
24
+ * Authenticates a user with username and password.
25
+ */
22
26
  export const LOGIN = {
23
27
  code: COMMAND_CODE.LoginUser,
24
28
  serialize: serializeLoginUser,
@@ -26,5 +30,8 @@ export const LOGIN = {
26
30
  userId: r.data.readUInt32LE(0)
27
31
  })
28
32
  };
33
+ /**
34
+ * Executable login command function.
35
+ */
29
36
  export const login = wrapCommand(LOGIN);
30
37
  //# sourceMappingURL=login.command.js.map
@@ -16,15 +16,40 @@
16
16
  * specific language governing permissions and limitations
17
17
  * under the License.
18
18
  */
19
+ /**
20
+ * Response from a successful login.
21
+ */
19
22
  export type LoginResponse = {
23
+ /** The authenticated user's ID */
20
24
  userId: number;
21
25
  };
26
+ /**
27
+ * Credentials for user login.
28
+ */
22
29
  export type LoginCredentials = {
30
+ /** Username (1-255 bytes) */
23
31
  username: string;
32
+ /** Password (1-255 bytes) */
24
33
  password: string;
34
+ /** Optional client version string */
25
35
  version?: string;
36
+ /** Optional client context string */
26
37
  context?: string;
27
38
  };
39
+ /**
40
+ * Serializes login credentials for the login command.
41
+ *
42
+ * @param credentials - Login credentials object
43
+ * @returns Buffer containing serialized login request
44
+ * @throws Error if username or password is not between 1 and 255 bytes
45
+ */
28
46
  export declare const serializeLoginUser: ({ username, password, version, context }: LoginCredentials) => Buffer<ArrayBuffer>;
47
+ /**
48
+ * Serializes a token for the login with token command.
49
+ *
50
+ * @param token - Access token string (1-255 bytes)
51
+ * @returns Buffer containing serialized token login request
52
+ * @throws Error if token is not between 1 and 255 bytes
53
+ */
29
54
  export declare const serializeLoginWithToken: (token: string) => Buffer<ArrayBuffer>;
30
55
  //# sourceMappingURL=login.utils.d.ts.map
@@ -17,6 +17,13 @@
17
17
  * under the License.
18
18
  */
19
19
  import { uint32ToBuf, uint8ToBuf } from "../number.utils.js";
20
+ /**
21
+ * Serializes login credentials for the login command.
22
+ *
23
+ * @param credentials - Login credentials object
24
+ * @returns Buffer containing serialized login request
25
+ * @throws Error if username or password is not between 1 and 255 bytes
26
+ */
20
27
  export const serializeLoginUser = ({ username, password, version, context }) => {
21
28
  const bUsername = Buffer.from(username);
22
29
  const bPassword = Buffer.from(password);
@@ -41,6 +48,13 @@ export const serializeLoginUser = ({ username, password, version, context }) =>
41
48
  bContext
42
49
  ]);
43
50
  };
51
+ /**
52
+ * Serializes a token for the login with token command.
53
+ *
54
+ * @param token - Access token string (1-255 bytes)
55
+ * @returns Buffer containing serialized token login request
56
+ * @throws Error if token is not between 1 and 255 bytes
57
+ */
44
58
  export const serializeLoginWithToken = (token) => {
45
59
  const bToken = Buffer.from(token);
46
60
  if (bToken.length < 1 || bToken.length > 255)
@@ -16,10 +16,17 @@
16
16
  * specific language governing permissions and limitations
17
17
  * under the License.
18
18
  */
19
+ /**
20
+ * Logout command definition.
21
+ * Ends the current user session.
22
+ */
19
23
  export declare const LOGOUT: {
20
24
  code: number;
21
25
  serialize: () => Buffer<ArrayBuffer>;
22
26
  deserialize: (r: import("../../index.js").CommandResponse) => boolean;
23
27
  };
28
+ /**
29
+ * Executable logout command function.
30
+ */
24
31
  export declare const logout: (getClient: import("../../index.js").ClientProvider) => (arg: void) => Promise<boolean>;
25
32
  //# sourceMappingURL=logout.command.d.ts.map