@sachitv/avro-typescript 0.4.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 (163) hide show
  1. package/esm/_dnt.polyfills.d.ts +11 -0
  2. package/esm/_dnt.polyfills.js +15 -0
  3. package/esm/avro_reader.d.ts +156 -0
  4. package/esm/avro_reader.js +201 -0
  5. package/esm/avro_writer.d.ts +75 -0
  6. package/esm/avro_writer.js +105 -0
  7. package/esm/internal/collections/array_utils.d.ts +4 -0
  8. package/esm/internal/collections/array_utils.js +18 -0
  9. package/esm/internal/collections/circular_buffer.d.ts +48 -0
  10. package/esm/internal/collections/circular_buffer.js +129 -0
  11. package/esm/internal/crypto/md5.d.ts +12 -0
  12. package/esm/internal/crypto/md5.js +158 -0
  13. package/esm/internal/varint.d.ts +6 -0
  14. package/esm/internal/varint.js +30 -0
  15. package/esm/mod.d.ts +77 -0
  16. package/esm/mod.js +73 -0
  17. package/esm/package.json +3 -0
  18. package/esm/rpc/definitions/message_definition.d.ts +34 -0
  19. package/esm/rpc/definitions/message_definition.js +105 -0
  20. package/esm/rpc/definitions/protocol_definitions.d.ts +197 -0
  21. package/esm/rpc/definitions/protocol_definitions.js +1 -0
  22. package/esm/rpc/message_endpoint/base.d.ts +43 -0
  23. package/esm/rpc/message_endpoint/base.js +81 -0
  24. package/esm/rpc/message_endpoint/emitter.d.ts +96 -0
  25. package/esm/rpc/message_endpoint/emitter.js +245 -0
  26. package/esm/rpc/message_endpoint/helpers.d.ts +37 -0
  27. package/esm/rpc/message_endpoint/helpers.js +68 -0
  28. package/esm/rpc/message_endpoint/listener.d.ts +37 -0
  29. package/esm/rpc/message_endpoint/listener.js +212 -0
  30. package/esm/rpc/protocol/frame_assembler.d.ts +11 -0
  31. package/esm/rpc/protocol/frame_assembler.js +77 -0
  32. package/esm/rpc/protocol/protocol_helpers.d.ts +59 -0
  33. package/esm/rpc/protocol/protocol_helpers.js +123 -0
  34. package/esm/rpc/protocol/transports/fetch.d.ts +9 -0
  35. package/esm/rpc/protocol/transports/fetch.js +30 -0
  36. package/esm/rpc/protocol/transports/in_memory.d.ts +27 -0
  37. package/esm/rpc/protocol/transports/in_memory.js +125 -0
  38. package/esm/rpc/protocol/transports/transport_helpers.d.ts +118 -0
  39. package/esm/rpc/protocol/transports/transport_helpers.js +112 -0
  40. package/esm/rpc/protocol/transports/websocket.d.ts +9 -0
  41. package/esm/rpc/protocol/transports/websocket.js +102 -0
  42. package/esm/rpc/protocol/wire_format/framing.d.ts +44 -0
  43. package/esm/rpc/protocol/wire_format/framing.js +74 -0
  44. package/esm/rpc/protocol/wire_format/handshake.d.ts +110 -0
  45. package/esm/rpc/protocol/wire_format/handshake.js +239 -0
  46. package/esm/rpc/protocol/wire_format/messages.d.ts +192 -0
  47. package/esm/rpc/protocol/wire_format/messages.js +175 -0
  48. package/esm/rpc/protocol/wire_format/metadata.d.ts +44 -0
  49. package/esm/rpc/protocol/wire_format/metadata.js +74 -0
  50. package/esm/rpc/protocol_core.d.ts +121 -0
  51. package/esm/rpc/protocol_core.js +285 -0
  52. package/esm/schemas/base_type.d.ts +41 -0
  53. package/esm/schemas/base_type.js +49 -0
  54. package/esm/schemas/complex/array_type.d.ts +100 -0
  55. package/esm/schemas/complex/array_type.js +299 -0
  56. package/esm/schemas/complex/enum_type.d.ts +81 -0
  57. package/esm/schemas/complex/enum_type.js +217 -0
  58. package/esm/schemas/complex/fixed_type.d.ts +99 -0
  59. package/esm/schemas/complex/fixed_type.js +208 -0
  60. package/esm/schemas/complex/map_type.d.ts +97 -0
  61. package/esm/schemas/complex/map_type.js +290 -0
  62. package/esm/schemas/complex/named_type.d.ts +30 -0
  63. package/esm/schemas/complex/named_type.js +57 -0
  64. package/esm/schemas/complex/record_type.d.ts +165 -0
  65. package/esm/schemas/complex/record_type.js +547 -0
  66. package/esm/schemas/complex/resolve_names.d.ts +32 -0
  67. package/esm/schemas/complex/resolve_names.js +85 -0
  68. package/esm/schemas/complex/union_type.d.ts +116 -0
  69. package/esm/schemas/complex/union_type.js +392 -0
  70. package/esm/schemas/error.d.ts +31 -0
  71. package/esm/schemas/error.js +67 -0
  72. package/esm/schemas/json.d.ts +6 -0
  73. package/esm/schemas/json.js +35 -0
  74. package/esm/schemas/logical/decimal_logical_type.d.ts +49 -0
  75. package/esm/schemas/logical/decimal_logical_type.js +145 -0
  76. package/esm/schemas/logical/duration_logical_type.d.ts +66 -0
  77. package/esm/schemas/logical/duration_logical_type.js +112 -0
  78. package/esm/schemas/logical/logical_type.d.ts +138 -0
  79. package/esm/schemas/logical/logical_type.js +240 -0
  80. package/esm/schemas/logical/temporal_logical_types.d.ts +215 -0
  81. package/esm/schemas/logical/temporal_logical_types.js +364 -0
  82. package/esm/schemas/logical/uuid_logical_type.d.ts +63 -0
  83. package/esm/schemas/logical/uuid_logical_type.js +146 -0
  84. package/esm/schemas/primitive/boolean_type.d.ts +49 -0
  85. package/esm/schemas/primitive/boolean_type.js +75 -0
  86. package/esm/schemas/primitive/bytes_type.d.ts +49 -0
  87. package/esm/schemas/primitive/bytes_type.js +136 -0
  88. package/esm/schemas/primitive/double_type.d.ts +38 -0
  89. package/esm/schemas/primitive/double_type.js +98 -0
  90. package/esm/schemas/primitive/fixed_size_base_type.d.ts +28 -0
  91. package/esm/schemas/primitive/fixed_size_base_type.js +33 -0
  92. package/esm/schemas/primitive/float_type.d.ts +38 -0
  93. package/esm/schemas/primitive/float_type.js +88 -0
  94. package/esm/schemas/primitive/int_type.d.ts +31 -0
  95. package/esm/schemas/primitive/int_type.js +63 -0
  96. package/esm/schemas/primitive/long_type.d.ts +36 -0
  97. package/esm/schemas/primitive/long_type.js +95 -0
  98. package/esm/schemas/primitive/null_type.d.ts +45 -0
  99. package/esm/schemas/primitive/null_type.js +71 -0
  100. package/esm/schemas/primitive/primitive_type.d.ts +17 -0
  101. package/esm/schemas/primitive/primitive_type.js +27 -0
  102. package/esm/schemas/primitive/string_type.d.ts +34 -0
  103. package/esm/schemas/primitive/string_type.js +81 -0
  104. package/esm/schemas/resolver.d.ts +25 -0
  105. package/esm/schemas/resolver.js +25 -0
  106. package/esm/schemas/type.d.ts +101 -0
  107. package/esm/schemas/type.js +6 -0
  108. package/esm/serialization/avro_constants.d.ts +13 -0
  109. package/esm/serialization/avro_constants.js +29 -0
  110. package/esm/serialization/avro_file_parser.d.ts +68 -0
  111. package/esm/serialization/avro_file_parser.js +191 -0
  112. package/esm/serialization/avro_file_writer.d.ts +63 -0
  113. package/esm/serialization/avro_file_writer.js +235 -0
  114. package/esm/serialization/buffers/blob_readable_buffer.d.ts +53 -0
  115. package/esm/serialization/buffers/blob_readable_buffer.js +80 -0
  116. package/esm/serialization/buffers/buffer.d.ts +37 -0
  117. package/esm/serialization/buffers/buffer.js +1 -0
  118. package/esm/serialization/buffers/in_memory_buffer.d.ts +121 -0
  119. package/esm/serialization/buffers/in_memory_buffer.js +206 -0
  120. package/esm/serialization/clamp.d.ts +10 -0
  121. package/esm/serialization/clamp.js +19 -0
  122. package/esm/serialization/compare_bytes.d.ts +9 -0
  123. package/esm/serialization/compare_bytes.js +45 -0
  124. package/esm/serialization/conversion.d.ts +8 -0
  125. package/esm/serialization/conversion.js +15 -0
  126. package/esm/serialization/decoders/decoder.d.ts +16 -0
  127. package/esm/serialization/decoders/decoder.js +1 -0
  128. package/esm/serialization/decoders/deflate_decoder.d.ts +15 -0
  129. package/esm/serialization/decoders/deflate_decoder.js +26 -0
  130. package/esm/serialization/decoders/null_decoder.d.ts +12 -0
  131. package/esm/serialization/decoders/null_decoder.js +13 -0
  132. package/esm/serialization/encoders/deflate_encoder.d.ts +15 -0
  133. package/esm/serialization/encoders/deflate_encoder.js +26 -0
  134. package/esm/serialization/encoders/encoder.d.ts +16 -0
  135. package/esm/serialization/encoders/encoder.js +1 -0
  136. package/esm/serialization/encoders/null_encoder.d.ts +12 -0
  137. package/esm/serialization/encoders/null_encoder.js +13 -0
  138. package/esm/serialization/manipulate_bytes.d.ts +6 -0
  139. package/esm/serialization/manipulate_bytes.js +13 -0
  140. package/esm/serialization/read_uint_le.d.ts +4 -0
  141. package/esm/serialization/read_uint_le.js +14 -0
  142. package/esm/serialization/streams/fixed_size_stream_readable_buffer_adapter.d.ts +52 -0
  143. package/esm/serialization/streams/fixed_size_stream_readable_buffer_adapter.js +129 -0
  144. package/esm/serialization/streams/forward_only_stream_readable_buffer_adapter.d.ts +36 -0
  145. package/esm/serialization/streams/forward_only_stream_readable_buffer_adapter.js +114 -0
  146. package/esm/serialization/streams/stream_readable_buffer.d.ts +41 -0
  147. package/esm/serialization/streams/stream_readable_buffer.js +64 -0
  148. package/esm/serialization/streams/stream_readable_buffer_adapter.d.ts +38 -0
  149. package/esm/serialization/streams/stream_readable_buffer_adapter.js +105 -0
  150. package/esm/serialization/streams/stream_writable_buffer.d.ts +42 -0
  151. package/esm/serialization/streams/stream_writable_buffer.js +64 -0
  152. package/esm/serialization/streams/stream_writable_buffer_adapter.d.ts +36 -0
  153. package/esm/serialization/streams/stream_writable_buffer_adapter.js +65 -0
  154. package/esm/serialization/streams/streams.d.ts +29 -0
  155. package/esm/serialization/streams/streams.js +1 -0
  156. package/esm/serialization/tap.d.ts +427 -0
  157. package/esm/serialization/tap.js +605 -0
  158. package/esm/serialization/text_encoding.d.ts +12 -0
  159. package/esm/serialization/text_encoding.js +14 -0
  160. package/esm/type/create_type.d.ts +54 -0
  161. package/esm/type/create_type.js +401 -0
  162. package/package.json +33 -0
  163. package/sachitv-avro-typescript-0.4.0.tgz +0 -0
@@ -0,0 +1,64 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _StreamWritableBuffer_writer;
13
+ /**
14
+ * A writable buffer implementation that writes data sequentially to a WritableStream.
15
+ * This provides streaming write capabilities for large data outputs.
16
+ *
17
+ * Key features:
18
+ * - Stream-backed: Writes data sequentially to a WritableStream.
19
+ * - Memory efficient: Processes data in chunks without buffering everything in memory.
20
+ * - Web standard: Uses the Web Streams API for broad compatibility.
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const stream = new WritableStream({
25
+ * write(chunk) {
26
+ * // Handle chunk
27
+ * }
28
+ * });
29
+ * const buffer = new StreamWritableBuffer(stream);
30
+ *
31
+ * await buffer.writeBytes(new Uint8Array([1, 2, 3, 4]));
32
+ * await buffer.close();
33
+ * ```
34
+ */
35
+ export class StreamWritableBuffer {
36
+ /**
37
+ * Creates a new StreamWritableBuffer from the provided WritableStream.
38
+ *
39
+ * @param stream The WritableStream to write data to.
40
+ */
41
+ constructor(stream) {
42
+ _StreamWritableBuffer_writer.set(this, void 0);
43
+ __classPrivateFieldSet(this, _StreamWritableBuffer_writer, stream.getWriter(), "f");
44
+ }
45
+ /**
46
+ * Writes bytes to the stream.
47
+ *
48
+ * @param data The bytes to write.
49
+ */
50
+ async writeBytes(data) {
51
+ if (data.length === 0) {
52
+ return;
53
+ }
54
+ await __classPrivateFieldGet(this, _StreamWritableBuffer_writer, "f").write(data);
55
+ }
56
+ /**
57
+ * Closes the stream and releases the writer lock.
58
+ */
59
+ async close() {
60
+ await __classPrivateFieldGet(this, _StreamWritableBuffer_writer, "f").close();
61
+ __classPrivateFieldGet(this, _StreamWritableBuffer_writer, "f").releaseLock();
62
+ }
63
+ }
64
+ _StreamWritableBuffer_writer = new WeakMap();
@@ -0,0 +1,36 @@
1
+ import type { IWritableBuffer } from "../buffers/buffer.js";
2
+ import type { IStreamWritableBuffer } from "./streams.js";
3
+ /**
4
+ * Adapter that wraps an IStreamWritableBuffer to provide IWritableBuffer interface.
5
+ * This collects writes and forwards them to the stream buffer.
6
+ */
7
+ export declare class StreamWritableBufferAdapter implements IWritableBuffer {
8
+ #private;
9
+ /**
10
+ * Creates a new adapter from a stream writable buffer.
11
+ *
12
+ * @param streamBuffer The stream buffer to adapt.
13
+ */
14
+ constructor(streamBuffer: IStreamWritableBuffer);
15
+ /**
16
+ * Appends bytes to the buffer, advancing its internal write cursor when the
17
+ * operation succeeds.
18
+ */
19
+ appendBytes(data: Uint8Array): Promise<void>;
20
+ /**
21
+ * Returns whether the buffer can continue accepting writes.
22
+ * Stream buffers can always accept writes until explicitly closed.
23
+ */
24
+ isValid(): Promise<boolean>;
25
+ /**
26
+ * Checks if the buffer can accept appending the given number of bytes.
27
+ * @param size The number of bytes to check.
28
+ * @returns True if the buffer can accept the append.
29
+ */
30
+ canAppendMore(_size: number): Promise<boolean>;
31
+ /**
32
+ * Closes the underlying stream buffer.
33
+ * After calling this, further writes will be ignored.
34
+ */
35
+ close(): Promise<void>;
36
+ }
@@ -0,0 +1,65 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _StreamWritableBufferAdapter_streamBuffer, _StreamWritableBufferAdapter_isClosed;
13
+ /**
14
+ * Adapter that wraps an IStreamWritableBuffer to provide IWritableBuffer interface.
15
+ * This collects writes and forwards them to the stream buffer.
16
+ */
17
+ export class StreamWritableBufferAdapter {
18
+ /**
19
+ * Creates a new adapter from a stream writable buffer.
20
+ *
21
+ * @param streamBuffer The stream buffer to adapt.
22
+ */
23
+ constructor(streamBuffer) {
24
+ _StreamWritableBufferAdapter_streamBuffer.set(this, void 0);
25
+ _StreamWritableBufferAdapter_isClosed.set(this, false);
26
+ __classPrivateFieldSet(this, _StreamWritableBufferAdapter_streamBuffer, streamBuffer, "f");
27
+ }
28
+ /**
29
+ * Appends bytes to the buffer, advancing its internal write cursor when the
30
+ * operation succeeds.
31
+ */
32
+ async appendBytes(data) {
33
+ if (__classPrivateFieldGet(this, _StreamWritableBufferAdapter_isClosed, "f")) {
34
+ return;
35
+ }
36
+ await __classPrivateFieldGet(this, _StreamWritableBufferAdapter_streamBuffer, "f").writeBytes(data);
37
+ }
38
+ /**
39
+ * Returns whether the buffer can continue accepting writes.
40
+ * Stream buffers can always accept writes until explicitly closed.
41
+ */
42
+ // deno-lint-ignore require-await
43
+ async isValid() {
44
+ return !__classPrivateFieldGet(this, _StreamWritableBufferAdapter_isClosed, "f");
45
+ }
46
+ /**
47
+ * Checks if the buffer can accept appending the given number of bytes.
48
+ * @param size The number of bytes to check.
49
+ * @returns True if the buffer can accept the append.
50
+ */
51
+ async canAppendMore(_size) {
52
+ return await this.isValid();
53
+ }
54
+ /**
55
+ * Closes the underlying stream buffer.
56
+ * After calling this, further writes will be ignored.
57
+ */
58
+ async close() {
59
+ if (!__classPrivateFieldGet(this, _StreamWritableBufferAdapter_isClosed, "f")) {
60
+ __classPrivateFieldSet(this, _StreamWritableBufferAdapter_isClosed, true, "f");
61
+ await __classPrivateFieldGet(this, _StreamWritableBufferAdapter_streamBuffer, "f").close();
62
+ }
63
+ }
64
+ }
65
+ _StreamWritableBufferAdapter_streamBuffer = new WeakMap(), _StreamWritableBufferAdapter_isClosed = new WeakMap();
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Interface describing a readable buffer backed by a ReadableStream.
3
+ * This provides sequential reading capabilities.
4
+ */
5
+ export interface IStreamReadableBuffer {
6
+ /**
7
+ * Reads the next chunk of data from the stream.
8
+ * @returns A Promise that resolves to the next Uint8Array chunk, or undefined if the stream is exhausted.
9
+ */
10
+ readNext(): Promise<Uint8Array | undefined>;
11
+ /**
12
+ * Closes the stream and releases the reader lock.
13
+ */
14
+ close(): Promise<void>;
15
+ }
16
+ /**
17
+ * Interface describing a writable buffer backed by a WritableStream.
18
+ * This provides sequential writing capabilities.
19
+ */
20
+ export interface IStreamWritableBuffer {
21
+ /**
22
+ * Writes bytes to the stream.
23
+ */
24
+ writeBytes(data: Uint8Array): Promise<void>;
25
+ /**
26
+ * Closes the stream.
27
+ */
28
+ close(): Promise<void>;
29
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,427 @@
1
+ import type { IReadableBuffer, IWritableBuffer } from "./buffers/buffer.js";
2
+ /**
3
+ * Interface for readable tap operations in Avro serialization.
4
+ */
5
+ export interface ReadableTapLike {
6
+ /**
7
+ * Returns whether the cursor is positioned within the buffer bounds.
8
+ */
9
+ isValid(): Promise<boolean>;
10
+ /**
11
+ * Returns whether more data can be read from the current position without advancing the cursor.
12
+ */
13
+ canReadMore(): Promise<boolean>;
14
+ /**
15
+ * Returns the buffer contents from the start up to the current cursor.
16
+ * @throws RangeError if the cursor has advanced past the buffer length.
17
+ */
18
+ getValue(): Promise<Uint8Array>;
19
+ /**
20
+ * Reads the next byte as a boolean value and advances the cursor by one byte.
21
+ */
22
+ readBoolean(): Promise<boolean>;
23
+ /**
24
+ * Skips a boolean value by advancing the cursor by one byte.
25
+ */
26
+ skipBoolean(): void;
27
+ /**
28
+ * Reads a variable-length zig-zag encoded 32-bit signed integer.
29
+ */
30
+ readInt(): Promise<number>;
31
+ /**
32
+ * Reads a variable-length zig-zag encoded 64-bit signed integer as bigint.
33
+ */
34
+ readLong(): Promise<bigint>;
35
+ /**
36
+ * Skips a zig-zag encoded 32-bit integer by delegating to `skipLong`.
37
+ */
38
+ skipInt(): Promise<void>;
39
+ /**
40
+ * Skips a zig-zag encoded 64-bit integer, advancing past continuation bytes.
41
+ */
42
+ skipLong(): Promise<void>;
43
+ /**
44
+ * Reads a 32-bit little-endian floating point number.
45
+ * @throws RangeError if the read would exceed the buffer.
46
+ */
47
+ readFloat(): Promise<number>;
48
+ /**
49
+ * Skips a 32-bit floating point value by advancing four bytes.
50
+ */
51
+ skipFloat(): void;
52
+ /**
53
+ * Reads a 64-bit little-endian floating point number.
54
+ * @throws RangeError if the read would exceed the buffer.
55
+ */
56
+ readDouble(): Promise<number>;
57
+ /**
58
+ * Skips a 64-bit floating point value by advancing eight bytes.
59
+ */
60
+ skipDouble(): void;
61
+ /**
62
+ * Reads a fixed-length byte sequence into a new buffer.
63
+ * @param len Number of bytes to read.
64
+ * @throws RangeError if the read exceeds the buffer.
65
+ */
66
+ readFixed(len: number): Promise<Uint8Array>;
67
+ /**
68
+ * Skips a fixed-length byte sequence.
69
+ * @param len Number of bytes to skip.
70
+ */
71
+ skipFixed(len: number): void;
72
+ /**
73
+ * Reads a length-prefixed byte sequence.
74
+ * @throws RangeError if insufficient data remains.
75
+ */
76
+ readBytes(): Promise<Uint8Array>;
77
+ /**
78
+ * Skips a length-prefixed byte sequence.
79
+ */
80
+ skipBytes(): Promise<void>;
81
+ /**
82
+ * Reads a length-prefixed UTF-8 string.
83
+ * @throws RangeError when the buffer is exhausted prematurely.
84
+ */
85
+ readString(): Promise<string>;
86
+ /**
87
+ * Skips a length-prefixed UTF-8 string.
88
+ */
89
+ skipString(): Promise<void>;
90
+ /**
91
+ * Compares the next boolean value with the one from another tap.
92
+ * @param tap Tap to compare against; both cursors advance.
93
+ * @returns 0 when equal, negative when this tap's value is false and the other true, positive otherwise.
94
+ */
95
+ matchBoolean(tap: ReadableTapLike): Promise<number>;
96
+ /**
97
+ * Compares the next zig-zag encoded 32-bit integer with another tap.
98
+ * @returns Comparison result using -1/0/1 semantics.
99
+ */
100
+ matchInt(tap: ReadableTapLike): Promise<number>;
101
+ /**
102
+ * Compares the next zig-zag encoded 64-bit integer with another tap.
103
+ * @returns Comparison result using -1/0/1 semantics.
104
+ */
105
+ matchLong(tap: ReadableTapLike): Promise<number>;
106
+ /**
107
+ * Compares the next 32-bit float value with another tap.
108
+ * @returns Comparison result using -1/0/1 semantics.
109
+ */
110
+ matchFloat(tap: ReadableTapLike): Promise<number>;
111
+ /**
112
+ * Compares the next 64-bit float value with another tap.
113
+ * @returns Comparison result using -1/0/1 semantics.
114
+ */
115
+ matchDouble(tap: ReadableTapLike): Promise<number>;
116
+ /**
117
+ * Compares fixed-length byte sequences from this tap and another tap.
118
+ * @param tap Tap to compare against; both cursors advance by `len`.
119
+ * @param len Number of bytes to compare.
120
+ * @returns Comparison result using -1/0/1 semantics.
121
+ */
122
+ matchFixed(tap: ReadableTapLike, len: number): Promise<number>;
123
+ /**
124
+ * Compares length-prefixed byte sequences from this tap and another tap.
125
+ * @returns Comparison result using -1/0/1 semantics.
126
+ */
127
+ matchBytes(tap: ReadableTapLike): Promise<number>;
128
+ /** Matches a string value. */
129
+ matchString(tap: ReadableTapLike): Promise<number>;
130
+ /** Unpacks a long-encoded byte array. */
131
+ unpackLongBytes(): Promise<Uint8Array>;
132
+ }
133
+ /**
134
+ * Interface for writable tap operations compatible with Avro binary serialization.
135
+ */
136
+ export interface WritableTapLike {
137
+ /**
138
+ * Returns whether the tap is valid for writing.
139
+ */
140
+ isValid(): Promise<boolean>;
141
+ /**
142
+ * Writes a boolean value as a single byte.
143
+ * @param value The boolean value to write.
144
+ */
145
+ writeBoolean(value: boolean): Promise<void>;
146
+ /**
147
+ * Writes a zig-zag encoded 32-bit signed integer.
148
+ * @param value The integer value to write.
149
+ */
150
+ writeInt(value: number): Promise<void>;
151
+ /**
152
+ * Writes a zig-zag encoded 64-bit signed integer.
153
+ * @param value The bigint value to write.
154
+ */
155
+ writeLong(value: bigint): Promise<void>;
156
+ /**
157
+ * Writes a 32-bit little-endian floating point number.
158
+ * @param value The float value to write.
159
+ */
160
+ writeFloat(value: number): Promise<void>;
161
+ /**
162
+ * Writes a 64-bit little-endian floating point number.
163
+ * @param value The double value to write.
164
+ */
165
+ writeDouble(value: number): Promise<void>;
166
+ /**
167
+ * Writes a fixed-length byte sequence from the provided buffer.
168
+ * @param buf Source buffer to copy from.
169
+ * @param len Optional number of bytes to write; defaults to the buffer length.
170
+ */
171
+ writeFixed(buf: Uint8Array, len?: number): Promise<void>;
172
+ /**
173
+ * Writes a length-prefixed byte sequence backed by the provided buffer.
174
+ * @param buf The bytes to write.
175
+ */
176
+ writeBytes(buf: Uint8Array): Promise<void>;
177
+ /**
178
+ * Writes a length-prefixed UTF-8 string.
179
+ * @param str The string to encode and write.
180
+ */
181
+ writeString(str: string): Promise<void>;
182
+ /**
183
+ * Writes a binary string as raw bytes without a length prefix.
184
+ * @param str Source string containing binary data.
185
+ * @param len Number of bytes from the string to write.
186
+ */
187
+ writeBinary(str: string, len: number): Promise<void>;
188
+ /**
189
+ * Encodes an 8-byte two's complement integer into zig-zag encoded varint bytes.
190
+ * @param arr Buffer containing the 8-byte value to encode; reused during processing.
191
+ */
192
+ packLongBytes(arr: Uint8Array): Promise<void>;
193
+ }
194
+ /** Abstract base class for tap implementations that manage buffer position. */
195
+ export declare abstract class TapBase {
196
+ /** The current position in the buffer. */
197
+ protected pos: number;
198
+ /** Initializes the tap with the given position. */
199
+ protected constructor(pos: number);
200
+ /**
201
+ * Returns the current cursor position within the buffer.
202
+ */
203
+ getPos(): number;
204
+ /**
205
+ * Resets the cursor to the beginning of the buffer.
206
+ */
207
+ _testOnlyResetPos(): void;
208
+ }
209
+ /**
210
+ * Binary tap that exposes Avro-compatible read helpers on top of a readable buffer.
211
+ */
212
+ export declare class ReadableTap extends TapBase implements ReadableTapLike {
213
+ #private;
214
+ /** The readable buffer backing this tap. */
215
+ protected readonly buffer: IReadableBuffer;
216
+ /** Creates a new ReadableTap with the given buffer and initial position. */
217
+ constructor(buf: ArrayBuffer | IReadableBuffer, pos?: number);
218
+ /**
219
+ * Returns whether the cursor is positioned within the buffer bounds.
220
+ */
221
+ isValid(): Promise<boolean>;
222
+ /**
223
+ * Returns whether more data can be read from the current position without advancing the cursor.
224
+ */
225
+ canReadMore(): Promise<boolean>;
226
+ /**
227
+ * Returns a defensive copy of the current buffer for testing purposes.
228
+ */
229
+ _testOnlyBuf(): Promise<Uint8Array>;
230
+ /**
231
+ * Returns the buffer contents from the start up to the current cursor.
232
+ * @throws RangeError if the cursor has advanced past the buffer length.
233
+ */
234
+ getValue(): Promise<Uint8Array>;
235
+ /** Retrieves the byte at the specified position in the buffer. */
236
+ private getByteAt;
237
+ /**
238
+ * Reads the next byte as a boolean value and advances the cursor by one byte.
239
+ */
240
+ readBoolean(): Promise<boolean>;
241
+ /**
242
+ * Skips a boolean value by advancing the cursor by one byte.
243
+ */
244
+ skipBoolean(): void;
245
+ /**
246
+ * Reads a variable-length zig-zag encoded 32-bit signed integer.
247
+ */
248
+ readInt(): Promise<number>;
249
+ /**
250
+ * Reads a variable-length zig-zag encoded 64-bit signed integer as bigint.
251
+ */
252
+ readLong(): Promise<bigint>;
253
+ /**
254
+ * Skips a zig-zag encoded 32-bit integer by delegating to `skipLong`.
255
+ */
256
+ skipInt(): Promise<void>;
257
+ /**
258
+ * Skips a zig-zag encoded 64-bit integer, advancing past continuation bytes.
259
+ */
260
+ skipLong(): Promise<void>;
261
+ /**
262
+ * Reads a 32-bit little-endian floating point number.
263
+ * @throws RangeError if the read would exceed the buffer.
264
+ */
265
+ readFloat(): Promise<number>;
266
+ /**
267
+ * Skips a 32-bit floating point value by advancing four bytes.
268
+ */
269
+ skipFloat(): void;
270
+ /**
271
+ * Reads a 64-bit little-endian floating point number.
272
+ * @throws RangeError if the read would exceed the buffer.
273
+ */
274
+ readDouble(): Promise<number>;
275
+ /**
276
+ * Skips a 64-bit floating point value by advancing eight bytes.
277
+ */
278
+ skipDouble(): void;
279
+ /**
280
+ * Reads a fixed-length byte sequence into a new buffer.
281
+ * @param len Number of bytes to read.
282
+ * @throws RangeError if the read exceeds the buffer.
283
+ */
284
+ readFixed(len: number): Promise<Uint8Array>;
285
+ /**
286
+ * Skips a fixed-length byte sequence.
287
+ * @param len Number of bytes to skip.
288
+ */
289
+ skipFixed(len: number): void;
290
+ /**
291
+ * Reads a length-prefixed byte sequence.
292
+ * @throws RangeError if insufficient data remains.
293
+ */
294
+ readBytes(): Promise<Uint8Array>;
295
+ /**
296
+ * Skips a length-prefixed byte sequence.
297
+ */
298
+ skipBytes(): Promise<void>;
299
+ /**
300
+ * Skips a length-prefixed UTF-8 string.
301
+ */
302
+ skipString(): Promise<void>;
303
+ /**
304
+ * Reads a length-prefixed UTF-8 string.
305
+ * @throws RangeError when the buffer is exhausted prematurely.
306
+ */
307
+ readString(): Promise<string>;
308
+ /**
309
+ * Compares the next boolean value with the one from another tap.
310
+ * @param tap Tap to compare against; both cursors advance.
311
+ * @returns 0 when equal, negative when this tap's value is false and the other true, positive otherwise.
312
+ */
313
+ matchBoolean(tap: ReadableTapLike): Promise<number>;
314
+ /**
315
+ * Compares the next zig-zag encoded 32-bit integer with another tap.
316
+ * @returns Comparison result using -1/0/1 semantics.
317
+ */
318
+ matchInt(tap: ReadableTapLike): Promise<number>;
319
+ /**
320
+ * Compares the next zig-zag encoded 64-bit integer with another tap.
321
+ * @returns Comparison result using -1/0/1 semantics.
322
+ */
323
+ matchLong(tap: ReadableTapLike): Promise<number>;
324
+ /**
325
+ * Compares the next 32-bit float value with another tap.
326
+ * @returns Comparison result using -1/0/1 semantics.
327
+ */
328
+ matchFloat(tap: ReadableTapLike): Promise<number>;
329
+ /**
330
+ * Compares the next 64-bit float value with another tap.
331
+ * @returns Comparison result using -1/0/1 semantics.
332
+ */
333
+ matchDouble(tap: ReadableTapLike): Promise<number>;
334
+ /**
335
+ * Compares fixed-length byte sequences from this tap and another tap.
336
+ * @param tap Tap to compare against; both cursors advance by `len`.
337
+ * @param len Number of bytes to compare.
338
+ * @returns Comparison result using -1/0/1 semantics.
339
+ */
340
+ matchFixed(tap: ReadableTapLike, len: number): Promise<number>;
341
+ /**
342
+ * Compares length-prefixed byte sequences from this tap and another tap.
343
+ * @returns Comparison result using -1/0/1 semantics.
344
+ */
345
+ matchBytes(tap: ReadableTapLike): Promise<number>;
346
+ /**
347
+ * Compares length-prefixed UTF-8 strings read from this tap and another tap.
348
+ * @returns Comparison result using -1/0/1 semantics.
349
+ */
350
+ matchString(tap: ReadableTapLike): Promise<number>;
351
+ /**
352
+ * Decodes the next zig-zag encoded long into an 8-byte two's complement buffer.
353
+ */
354
+ unpackLongBytes(): Promise<Uint8Array>;
355
+ }
356
+ /**
357
+ * Binary tap that exposes Avro-compatible write helpers on top of a writable buffer.
358
+ */
359
+ export declare class WritableTap extends TapBase implements WritableTapLike {
360
+ /** The writable buffer backing this tap. */
361
+ private readonly buffer;
362
+ /**
363
+ * Creates a new WritableTap instance.
364
+ * @param buf The buffer to write to, either an ArrayBuffer or IWritableBuffer.
365
+ * @param pos The initial position in the buffer (default 0).
366
+ */
367
+ constructor(buf: ArrayBuffer | IWritableBuffer, pos?: number);
368
+ /**
369
+ * Appends raw bytes to the buffer and advances the cursor.
370
+ * @param bytes The bytes to append.
371
+ */
372
+ private appendRawBytes;
373
+ /** Checks if the buffer is valid. */
374
+ isValid(): Promise<boolean>;
375
+ /**
376
+ * Writes a boolean value as a single byte and advances the cursor.
377
+ * @param value Boolean value to write.
378
+ */
379
+ writeBoolean(value: boolean): Promise<void>;
380
+ /**
381
+ * Writes a zig-zag encoded 32-bit signed integer.
382
+ * @param n Integer value to write.
383
+ */
384
+ writeInt(n: number): Promise<void>;
385
+ /**
386
+ * Writes a zig-zag encoded 64-bit signed integer.
387
+ * @param value BigInt value to write.
388
+ */
389
+ writeLong(value: bigint): Promise<void>;
390
+ /**
391
+ * Writes a 32-bit little-endian floating point number.
392
+ * @param value Float to write.
393
+ */
394
+ writeFloat(value: number): Promise<void>;
395
+ /**
396
+ * Writes a 64-bit little-endian floating point number.
397
+ * @param value Double precision value to write.
398
+ */
399
+ writeDouble(value: number): Promise<void>;
400
+ /**
401
+ * Writes a fixed-length byte sequence from the provided buffer.
402
+ * @param buf Source buffer to copy from.
403
+ * @param len Optional number of bytes to write; defaults to the buffer length.
404
+ */
405
+ writeFixed(buf: Uint8Array, len?: number): Promise<void>;
406
+ /**
407
+ * Writes a length-prefixed byte sequence backed by the provided buffer.
408
+ * @param buf Bytes to write.
409
+ */
410
+ writeBytes(buf: Uint8Array): Promise<void>;
411
+ /**
412
+ * Writes a length-prefixed UTF-8 string.
413
+ * @param str String to encode and write.
414
+ */
415
+ writeString(str: string): Promise<void>;
416
+ /**
417
+ * Writes a binary string as raw bytes without a length prefix.
418
+ * @param str Source string containing binary data.
419
+ * @param len Number of bytes from the string to write.
420
+ */
421
+ writeBinary(str: string, len: number): Promise<void>;
422
+ /**
423
+ * Encodes an 8-byte two's complement integer into zig-zag encoded varint bytes.
424
+ * @param arr Buffer containing the 8-byte value to encode; reused during processing.
425
+ */
426
+ packLongBytes(arr: Uint8Array): Promise<void>;
427
+ }