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
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { type ValueOf } from "../../type.utils.js";
|
|
20
|
+
/**
|
|
21
|
+
* Enumeration of header value types supported in message headers.
|
|
22
|
+
* Each type maps to a numeric identifier for wire protocol encoding.
|
|
23
|
+
*/
|
|
20
24
|
export declare const HeaderKind: {
|
|
21
25
|
readonly Raw: 1;
|
|
22
26
|
readonly String: 2;
|
|
@@ -34,68 +38,106 @@ export declare const HeaderKind: {
|
|
|
34
38
|
readonly Float: 14;
|
|
35
39
|
readonly Double: 15;
|
|
36
40
|
};
|
|
41
|
+
/** Type alias for the HeaderKind object */
|
|
37
42
|
export type HeaderKind = typeof HeaderKind;
|
|
43
|
+
/** String literal type of header kind names */
|
|
38
44
|
export type HeaderKindId = keyof HeaderKind;
|
|
45
|
+
/** Numeric values of header kinds */
|
|
39
46
|
export type HeaderKindValue = ValueOf<HeaderKind>;
|
|
47
|
+
/** Reverse mapping from numeric value to header kind name */
|
|
40
48
|
export declare const ReverseHeaderKind: Record<1 | 2 | 10 | 11 | 12 | 4 | 8 | 3 | 5 | 9 | 13 | 6 | 7 | 14 | 15, "Raw" | "String" | "Bool" | "Int8" | "Int16" | "Int32" | "Int64" | "Int128" | "Uint8" | "Uint16" | "Uint32" | "Uint64" | "Uint128" | "Float" | "Double">;
|
|
49
|
+
/** Returns expected byte size for a header kind, or -1 for variable-size kinds */
|
|
50
|
+
export declare const expectedSize: (kind: number) => number;
|
|
51
|
+
/** Raw binary header value */
|
|
41
52
|
export type HeaderValueRaw = {
|
|
42
|
-
kind: HeaderKind[
|
|
53
|
+
kind: HeaderKind["Raw"];
|
|
43
54
|
value: Buffer;
|
|
44
55
|
};
|
|
56
|
+
/** String header value */
|
|
45
57
|
export type HeaderValueString = {
|
|
46
|
-
kind: HeaderKind[
|
|
58
|
+
kind: HeaderKind["String"];
|
|
47
59
|
value: string;
|
|
48
60
|
};
|
|
61
|
+
/** Boolean header value */
|
|
49
62
|
export type HeaderValueBool = {
|
|
50
|
-
kind: HeaderKind[
|
|
63
|
+
kind: HeaderKind["Bool"];
|
|
51
64
|
value: boolean;
|
|
52
65
|
};
|
|
66
|
+
/** Signed 8-bit integer header value */
|
|
53
67
|
export type HeaderValueInt8 = {
|
|
54
|
-
kind: HeaderKind[
|
|
68
|
+
kind: HeaderKind["Int8"];
|
|
55
69
|
value: number;
|
|
56
70
|
};
|
|
71
|
+
/** Signed 16-bit integer header value */
|
|
57
72
|
export type HeaderValueInt16 = {
|
|
58
|
-
kind: HeaderKind[
|
|
73
|
+
kind: HeaderKind["Int16"];
|
|
59
74
|
value: number;
|
|
60
75
|
};
|
|
76
|
+
/** Signed 32-bit integer header value */
|
|
61
77
|
export type HeaderValueInt32 = {
|
|
62
|
-
kind: HeaderKind[
|
|
78
|
+
kind: HeaderKind["Int32"];
|
|
63
79
|
value: number;
|
|
64
80
|
};
|
|
81
|
+
/** Signed 64-bit integer header value */
|
|
65
82
|
export type HeaderValueInt64 = {
|
|
66
|
-
kind: HeaderKind[
|
|
83
|
+
kind: HeaderKind["Int64"];
|
|
67
84
|
value: bigint;
|
|
68
85
|
};
|
|
86
|
+
/** Signed 128-bit integer header value */
|
|
69
87
|
export type HeaderValueInt128 = {
|
|
70
|
-
kind: HeaderKind[
|
|
88
|
+
kind: HeaderKind["Int128"];
|
|
71
89
|
value: Buffer;
|
|
72
90
|
};
|
|
91
|
+
/** Unsigned 8-bit integer header value */
|
|
73
92
|
export type HeaderValueUint8 = {
|
|
74
|
-
kind: HeaderKind[
|
|
93
|
+
kind: HeaderKind["Uint8"];
|
|
75
94
|
value: number;
|
|
76
95
|
};
|
|
96
|
+
/** Unsigned 16-bit integer header value */
|
|
77
97
|
export type HeaderValueUint16 = {
|
|
78
|
-
kind: HeaderKind[
|
|
98
|
+
kind: HeaderKind["Uint16"];
|
|
79
99
|
value: number;
|
|
80
100
|
};
|
|
101
|
+
/** Unsigned 32-bit integer header value */
|
|
81
102
|
export type HeaderValueUint32 = {
|
|
82
|
-
kind: HeaderKind[
|
|
103
|
+
kind: HeaderKind["Uint32"];
|
|
83
104
|
value: number;
|
|
84
105
|
};
|
|
106
|
+
/** Unsigned 64-bit integer header value */
|
|
85
107
|
export type HeaderValueUint64 = {
|
|
86
|
-
kind: HeaderKind[
|
|
108
|
+
kind: HeaderKind["Uint64"];
|
|
87
109
|
value: bigint;
|
|
88
110
|
};
|
|
111
|
+
/** Unsigned 128-bit integer header value */
|
|
89
112
|
export type HeaderValueUint128 = {
|
|
90
|
-
kind: HeaderKind[
|
|
113
|
+
kind: HeaderKind["Uint128"];
|
|
91
114
|
value: Buffer;
|
|
92
115
|
};
|
|
116
|
+
/** 32-bit floating point header value */
|
|
93
117
|
export type HeaderValueFloat = {
|
|
94
|
-
kind: HeaderKind[
|
|
118
|
+
kind: HeaderKind["Float"];
|
|
95
119
|
value: number;
|
|
96
120
|
};
|
|
121
|
+
/** 64-bit floating point (double) header value */
|
|
97
122
|
export type HeaderValueDouble = {
|
|
98
|
-
kind: HeaderKind[
|
|
123
|
+
kind: HeaderKind["Double"];
|
|
124
|
+
value: number;
|
|
125
|
+
};
|
|
126
|
+
/** Header key with raw bytes */
|
|
127
|
+
export type HeaderKeyRaw = {
|
|
128
|
+
kind: HeaderKind["Raw"];
|
|
129
|
+
value: Buffer;
|
|
130
|
+
};
|
|
131
|
+
/** Header key with string value */
|
|
132
|
+
export type HeaderKeyString = {
|
|
133
|
+
kind: HeaderKind["String"];
|
|
134
|
+
value: string;
|
|
135
|
+
};
|
|
136
|
+
/** Header key with Int32 value */
|
|
137
|
+
export type HeaderKeyInt32 = {
|
|
138
|
+
kind: HeaderKind["Int32"];
|
|
99
139
|
value: number;
|
|
100
140
|
};
|
|
141
|
+
/** Union type of all possible header key types */
|
|
142
|
+
export type HeaderKey = HeaderKeyRaw | HeaderKeyString | HeaderKeyInt32;
|
|
101
143
|
//# sourceMappingURL=header.type.d.ts.map
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { reverseRecord } from "../../type.utils.js";
|
|
20
|
+
/**
|
|
21
|
+
* Enumeration of header value types supported in message headers.
|
|
22
|
+
* Each type maps to a numeric identifier for wire protocol encoding.
|
|
23
|
+
*/
|
|
20
24
|
export const HeaderKind = {
|
|
21
25
|
Raw: 1,
|
|
22
26
|
String: 2,
|
|
@@ -32,24 +36,33 @@ export const HeaderKind = {
|
|
|
32
36
|
Uint64: 12,
|
|
33
37
|
Uint128: 13,
|
|
34
38
|
Float: 14,
|
|
35
|
-
Double: 15
|
|
39
|
+
Double: 15,
|
|
36
40
|
};
|
|
41
|
+
/** Reverse mapping from numeric value to header kind name */
|
|
37
42
|
export const ReverseHeaderKind = reverseRecord(HeaderKind);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
/** Returns expected byte size for a header kind, or -1 for variable-size kinds */
|
|
44
|
+
export const expectedSize = (kind) => {
|
|
45
|
+
switch (kind) {
|
|
46
|
+
case HeaderKind.Bool:
|
|
47
|
+
case HeaderKind.Int8:
|
|
48
|
+
case HeaderKind.Uint8:
|
|
49
|
+
return 1;
|
|
50
|
+
case HeaderKind.Int16:
|
|
51
|
+
case HeaderKind.Uint16:
|
|
52
|
+
return 2;
|
|
53
|
+
case HeaderKind.Int32:
|
|
54
|
+
case HeaderKind.Uint32:
|
|
55
|
+
case HeaderKind.Float:
|
|
56
|
+
return 4;
|
|
57
|
+
case HeaderKind.Int64:
|
|
58
|
+
case HeaderKind.Uint64:
|
|
59
|
+
case HeaderKind.Double:
|
|
60
|
+
return 8;
|
|
61
|
+
case HeaderKind.Int128:
|
|
62
|
+
case HeaderKind.Uint128:
|
|
63
|
+
return 16;
|
|
64
|
+
default:
|
|
65
|
+
return -1;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
55
68
|
//# sourceMappingURL=header.type.js.map
|
|
@@ -16,34 +16,123 @@
|
|
|
16
16
|
* specific language governing permissions and limitations
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
|
-
import { type HeaderValueRaw, type HeaderValueString, type HeaderValueBool, type HeaderValueInt8, type HeaderValueInt16, type HeaderValueInt32, type HeaderValueInt64, type HeaderValueInt128, type HeaderValueUint8, type HeaderValueUint16, type HeaderValueUint32, type HeaderValueUint64, type HeaderValueUint128, type HeaderValueFloat, type HeaderValueDouble, type HeaderKindId } from
|
|
19
|
+
import { type HeaderValueRaw, type HeaderValueString, type HeaderValueBool, type HeaderValueInt8, type HeaderValueInt16, type HeaderValueInt32, type HeaderValueInt64, type HeaderValueInt128, type HeaderValueUint8, type HeaderValueUint16, type HeaderValueUint32, type HeaderValueUint64, type HeaderValueUint128, type HeaderValueFloat, type HeaderValueDouble, type HeaderKindId, type HeaderKey, type HeaderKeyRaw, type HeaderKeyString, type HeaderKeyInt32 } from "./header.type.js";
|
|
20
|
+
/**
|
|
21
|
+
* Union type of all possible header value types.
|
|
22
|
+
*/
|
|
20
23
|
export type HeaderValue = HeaderValueRaw | HeaderValueString | HeaderValueBool | HeaderValueInt8 | HeaderValueInt16 | HeaderValueInt32 | HeaderValueInt64 | HeaderValueInt128 | HeaderValueUint8 | HeaderValueUint16 | HeaderValueUint32 | HeaderValueUint64 | HeaderValueUint128 | HeaderValueFloat | HeaderValueDouble;
|
|
21
|
-
|
|
24
|
+
/** Header entry with key and value */
|
|
25
|
+
export type HeaderEntry = {
|
|
26
|
+
key: HeaderKey;
|
|
27
|
+
value: HeaderValue;
|
|
28
|
+
};
|
|
29
|
+
/** Array of header entries */
|
|
30
|
+
export type Headers = HeaderEntry[];
|
|
31
|
+
/**
|
|
32
|
+
* Internal representation of a header value in binary format.
|
|
33
|
+
*/
|
|
22
34
|
type BinaryHeaderValue = {
|
|
35
|
+
/** Header kind identifier */
|
|
23
36
|
kind: number;
|
|
37
|
+
/** Serialized value as Buffer */
|
|
24
38
|
value: Buffer;
|
|
25
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Serializes a header value to a Buffer based on its kind.
|
|
42
|
+
*
|
|
43
|
+
* @param header - Header value to serialize
|
|
44
|
+
* @returns Serialized value as Buffer
|
|
45
|
+
*/
|
|
26
46
|
export declare const serializeHeaderValue: (header: HeaderValue) => Buffer<ArrayBufferLike>;
|
|
27
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Serializes a header key to a Buffer based on its kind.
|
|
49
|
+
*
|
|
50
|
+
* @param key - Header key to serialize
|
|
51
|
+
* @returns Serialized key as Buffer
|
|
52
|
+
*/
|
|
53
|
+
export declare const serializeHeaderKey: (key: HeaderKey) => Buffer;
|
|
54
|
+
/**
|
|
55
|
+
* Serializes a single header key-value pair to wire format.
|
|
56
|
+
* Format: [key_kind][key_length][key][value_kind][value_length][value]
|
|
57
|
+
*
|
|
58
|
+
* @param key - Header key
|
|
59
|
+
* @param v - Binary header value
|
|
60
|
+
* @returns Serialized header as Buffer
|
|
61
|
+
*/
|
|
62
|
+
export declare const serializeHeader: (key: HeaderKey, v: BinaryHeaderValue) => Buffer<ArrayBuffer>;
|
|
63
|
+
/** Empty headers buffer constant */
|
|
28
64
|
export declare const EMPTY_HEADERS: Buffer<ArrayBuffer>;
|
|
65
|
+
/**
|
|
66
|
+
* Serializes all headers to a single buffer.
|
|
67
|
+
*
|
|
68
|
+
* @param headers - Optional headers array
|
|
69
|
+
* @returns Serialized headers buffer (empty if no headers)
|
|
70
|
+
*/
|
|
29
71
|
export declare const serializeHeaders: (headers?: Headers) => Buffer<ArrayBuffer>;
|
|
72
|
+
/** Possible JavaScript types for deserialized header values */
|
|
30
73
|
export type ParsedHeaderValue = boolean | string | number | bigint | Buffer;
|
|
31
|
-
|
|
32
|
-
|
|
74
|
+
/** Deserialized header key with kind and value */
|
|
75
|
+
export type ParsedHeaderKey = {
|
|
76
|
+
kind: number;
|
|
77
|
+
value: ParsedHeaderValue;
|
|
78
|
+
};
|
|
79
|
+
/** Deserialized header value with kind and value */
|
|
80
|
+
export type ParsedHeaderVal = {
|
|
81
|
+
kind: number;
|
|
33
82
|
value: ParsedHeaderValue;
|
|
34
83
|
};
|
|
35
|
-
|
|
36
|
-
|
|
84
|
+
/** Deserialized header entry */
|
|
85
|
+
export type ParsedHeaderEntry = {
|
|
86
|
+
key: ParsedHeaderKey;
|
|
87
|
+
value: ParsedHeaderVal;
|
|
37
88
|
};
|
|
38
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Result of deserializing a single header.
|
|
91
|
+
*/
|
|
39
92
|
type ParsedHeaderDeserialized = {
|
|
93
|
+
/** Number of bytes consumed */
|
|
40
94
|
bytesRead: number;
|
|
41
|
-
|
|
95
|
+
/** Deserialized header entry */
|
|
96
|
+
data: ParsedHeaderEntry;
|
|
42
97
|
};
|
|
98
|
+
/**
|
|
99
|
+
* Maps a numeric header kind to its string identifier.
|
|
100
|
+
*
|
|
101
|
+
* @param k - Numeric header kind value
|
|
102
|
+
* @returns Header kind identifier string
|
|
103
|
+
* @throws Error if the header kind is unknown
|
|
104
|
+
*/
|
|
43
105
|
export declare const mapHeaderKind: (k: number) => HeaderKindId;
|
|
106
|
+
/**
|
|
107
|
+
* Deserializes a header value buffer based on its kind.
|
|
108
|
+
*
|
|
109
|
+
* @param kind - Numeric header kind
|
|
110
|
+
* @param value - Raw value buffer
|
|
111
|
+
* @returns Deserialized value
|
|
112
|
+
* @throws Error if the header kind is invalid
|
|
113
|
+
*/
|
|
44
114
|
export declare const deserializeHeaderValue: (kind: number, value: Buffer) => ParsedHeaderValue;
|
|
115
|
+
/**
|
|
116
|
+
* Deserializes a single header from a buffer.
|
|
117
|
+
* Format: [key_kind][key_length][key][value_kind][value_length][value]
|
|
118
|
+
*
|
|
119
|
+
* @param p - Buffer containing serialized headers
|
|
120
|
+
* @param pos - Starting position in the buffer
|
|
121
|
+
* @returns Object with bytes read and deserialized header data
|
|
122
|
+
* @throws Error if header key or value length is invalid (must be 1-255)
|
|
123
|
+
*/
|
|
45
124
|
export declare const deserializeHeader: (p: Buffer, pos?: number) => ParsedHeaderDeserialized;
|
|
46
|
-
|
|
125
|
+
/**
|
|
126
|
+
* Deserializes all headers from a buffer.
|
|
127
|
+
*
|
|
128
|
+
* @param p - Buffer containing serialized headers
|
|
129
|
+
* @param pos - Starting position in the buffer
|
|
130
|
+
* @returns Array of parsed header entries
|
|
131
|
+
*/
|
|
132
|
+
export declare const deserializeHeaders: (p: Buffer, pos?: number) => ParsedHeaderEntry[];
|
|
133
|
+
/**
|
|
134
|
+
* HeaderValue factory object with constructors for all header types.
|
|
135
|
+
*/
|
|
47
136
|
export declare const HeaderValue: {
|
|
48
137
|
Raw: (value: Buffer) => HeaderValueRaw;
|
|
49
138
|
String: (value: string) => HeaderValueString;
|
|
@@ -63,5 +152,10 @@ export declare const HeaderValue: {
|
|
|
63
152
|
getKind: (h: HeaderValue) => "Raw" | "String" | "Bool" | "Int8" | "Int16" | "Int32" | "Int64" | "Int128" | "Uint8" | "Uint16" | "Uint32" | "Uint64" | "Uint128" | "Float" | "Double";
|
|
64
153
|
getValue: (h: HeaderValue) => string | number | bigint | boolean | Buffer<ArrayBufferLike>;
|
|
65
154
|
};
|
|
155
|
+
export declare const HeaderKeyFactory: {
|
|
156
|
+
Raw: (value: Buffer) => HeaderKeyRaw;
|
|
157
|
+
String: (value: string) => HeaderKeyString;
|
|
158
|
+
Int32: (value: number) => HeaderKeyInt32;
|
|
159
|
+
};
|
|
66
160
|
export {};
|
|
67
161
|
//# sourceMappingURL=header.utils.d.ts.map
|