@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.
- package/esm/_dnt.polyfills.d.ts +11 -0
- package/esm/_dnt.polyfills.js +15 -0
- package/esm/avro_reader.d.ts +156 -0
- package/esm/avro_reader.js +201 -0
- package/esm/avro_writer.d.ts +75 -0
- package/esm/avro_writer.js +105 -0
- package/esm/internal/collections/array_utils.d.ts +4 -0
- package/esm/internal/collections/array_utils.js +18 -0
- package/esm/internal/collections/circular_buffer.d.ts +48 -0
- package/esm/internal/collections/circular_buffer.js +129 -0
- package/esm/internal/crypto/md5.d.ts +12 -0
- package/esm/internal/crypto/md5.js +158 -0
- package/esm/internal/varint.d.ts +6 -0
- package/esm/internal/varint.js +30 -0
- package/esm/mod.d.ts +77 -0
- package/esm/mod.js +73 -0
- package/esm/package.json +3 -0
- package/esm/rpc/definitions/message_definition.d.ts +34 -0
- package/esm/rpc/definitions/message_definition.js +105 -0
- package/esm/rpc/definitions/protocol_definitions.d.ts +197 -0
- package/esm/rpc/definitions/protocol_definitions.js +1 -0
- package/esm/rpc/message_endpoint/base.d.ts +43 -0
- package/esm/rpc/message_endpoint/base.js +81 -0
- package/esm/rpc/message_endpoint/emitter.d.ts +96 -0
- package/esm/rpc/message_endpoint/emitter.js +245 -0
- package/esm/rpc/message_endpoint/helpers.d.ts +37 -0
- package/esm/rpc/message_endpoint/helpers.js +68 -0
- package/esm/rpc/message_endpoint/listener.d.ts +37 -0
- package/esm/rpc/message_endpoint/listener.js +212 -0
- package/esm/rpc/protocol/frame_assembler.d.ts +11 -0
- package/esm/rpc/protocol/frame_assembler.js +77 -0
- package/esm/rpc/protocol/protocol_helpers.d.ts +59 -0
- package/esm/rpc/protocol/protocol_helpers.js +123 -0
- package/esm/rpc/protocol/transports/fetch.d.ts +9 -0
- package/esm/rpc/protocol/transports/fetch.js +30 -0
- package/esm/rpc/protocol/transports/in_memory.d.ts +27 -0
- package/esm/rpc/protocol/transports/in_memory.js +125 -0
- package/esm/rpc/protocol/transports/transport_helpers.d.ts +118 -0
- package/esm/rpc/protocol/transports/transport_helpers.js +112 -0
- package/esm/rpc/protocol/transports/websocket.d.ts +9 -0
- package/esm/rpc/protocol/transports/websocket.js +102 -0
- package/esm/rpc/protocol/wire_format/framing.d.ts +44 -0
- package/esm/rpc/protocol/wire_format/framing.js +74 -0
- package/esm/rpc/protocol/wire_format/handshake.d.ts +110 -0
- package/esm/rpc/protocol/wire_format/handshake.js +239 -0
- package/esm/rpc/protocol/wire_format/messages.d.ts +192 -0
- package/esm/rpc/protocol/wire_format/messages.js +175 -0
- package/esm/rpc/protocol/wire_format/metadata.d.ts +44 -0
- package/esm/rpc/protocol/wire_format/metadata.js +74 -0
- package/esm/rpc/protocol_core.d.ts +121 -0
- package/esm/rpc/protocol_core.js +285 -0
- package/esm/schemas/base_type.d.ts +41 -0
- package/esm/schemas/base_type.js +49 -0
- package/esm/schemas/complex/array_type.d.ts +100 -0
- package/esm/schemas/complex/array_type.js +299 -0
- package/esm/schemas/complex/enum_type.d.ts +81 -0
- package/esm/schemas/complex/enum_type.js +217 -0
- package/esm/schemas/complex/fixed_type.d.ts +99 -0
- package/esm/schemas/complex/fixed_type.js +208 -0
- package/esm/schemas/complex/map_type.d.ts +97 -0
- package/esm/schemas/complex/map_type.js +290 -0
- package/esm/schemas/complex/named_type.d.ts +30 -0
- package/esm/schemas/complex/named_type.js +57 -0
- package/esm/schemas/complex/record_type.d.ts +165 -0
- package/esm/schemas/complex/record_type.js +547 -0
- package/esm/schemas/complex/resolve_names.d.ts +32 -0
- package/esm/schemas/complex/resolve_names.js +85 -0
- package/esm/schemas/complex/union_type.d.ts +116 -0
- package/esm/schemas/complex/union_type.js +392 -0
- package/esm/schemas/error.d.ts +31 -0
- package/esm/schemas/error.js +67 -0
- package/esm/schemas/json.d.ts +6 -0
- package/esm/schemas/json.js +35 -0
- package/esm/schemas/logical/decimal_logical_type.d.ts +49 -0
- package/esm/schemas/logical/decimal_logical_type.js +145 -0
- package/esm/schemas/logical/duration_logical_type.d.ts +66 -0
- package/esm/schemas/logical/duration_logical_type.js +112 -0
- package/esm/schemas/logical/logical_type.d.ts +138 -0
- package/esm/schemas/logical/logical_type.js +240 -0
- package/esm/schemas/logical/temporal_logical_types.d.ts +215 -0
- package/esm/schemas/logical/temporal_logical_types.js +364 -0
- package/esm/schemas/logical/uuid_logical_type.d.ts +63 -0
- package/esm/schemas/logical/uuid_logical_type.js +146 -0
- package/esm/schemas/primitive/boolean_type.d.ts +49 -0
- package/esm/schemas/primitive/boolean_type.js +75 -0
- package/esm/schemas/primitive/bytes_type.d.ts +49 -0
- package/esm/schemas/primitive/bytes_type.js +136 -0
- package/esm/schemas/primitive/double_type.d.ts +38 -0
- package/esm/schemas/primitive/double_type.js +98 -0
- package/esm/schemas/primitive/fixed_size_base_type.d.ts +28 -0
- package/esm/schemas/primitive/fixed_size_base_type.js +33 -0
- package/esm/schemas/primitive/float_type.d.ts +38 -0
- package/esm/schemas/primitive/float_type.js +88 -0
- package/esm/schemas/primitive/int_type.d.ts +31 -0
- package/esm/schemas/primitive/int_type.js +63 -0
- package/esm/schemas/primitive/long_type.d.ts +36 -0
- package/esm/schemas/primitive/long_type.js +95 -0
- package/esm/schemas/primitive/null_type.d.ts +45 -0
- package/esm/schemas/primitive/null_type.js +71 -0
- package/esm/schemas/primitive/primitive_type.d.ts +17 -0
- package/esm/schemas/primitive/primitive_type.js +27 -0
- package/esm/schemas/primitive/string_type.d.ts +34 -0
- package/esm/schemas/primitive/string_type.js +81 -0
- package/esm/schemas/resolver.d.ts +25 -0
- package/esm/schemas/resolver.js +25 -0
- package/esm/schemas/type.d.ts +101 -0
- package/esm/schemas/type.js +6 -0
- package/esm/serialization/avro_constants.d.ts +13 -0
- package/esm/serialization/avro_constants.js +29 -0
- package/esm/serialization/avro_file_parser.d.ts +68 -0
- package/esm/serialization/avro_file_parser.js +191 -0
- package/esm/serialization/avro_file_writer.d.ts +63 -0
- package/esm/serialization/avro_file_writer.js +235 -0
- package/esm/serialization/buffers/blob_readable_buffer.d.ts +53 -0
- package/esm/serialization/buffers/blob_readable_buffer.js +80 -0
- package/esm/serialization/buffers/buffer.d.ts +37 -0
- package/esm/serialization/buffers/buffer.js +1 -0
- package/esm/serialization/buffers/in_memory_buffer.d.ts +121 -0
- package/esm/serialization/buffers/in_memory_buffer.js +206 -0
- package/esm/serialization/clamp.d.ts +10 -0
- package/esm/serialization/clamp.js +19 -0
- package/esm/serialization/compare_bytes.d.ts +9 -0
- package/esm/serialization/compare_bytes.js +45 -0
- package/esm/serialization/conversion.d.ts +8 -0
- package/esm/serialization/conversion.js +15 -0
- package/esm/serialization/decoders/decoder.d.ts +16 -0
- package/esm/serialization/decoders/decoder.js +1 -0
- package/esm/serialization/decoders/deflate_decoder.d.ts +15 -0
- package/esm/serialization/decoders/deflate_decoder.js +26 -0
- package/esm/serialization/decoders/null_decoder.d.ts +12 -0
- package/esm/serialization/decoders/null_decoder.js +13 -0
- package/esm/serialization/encoders/deflate_encoder.d.ts +15 -0
- package/esm/serialization/encoders/deflate_encoder.js +26 -0
- package/esm/serialization/encoders/encoder.d.ts +16 -0
- package/esm/serialization/encoders/encoder.js +1 -0
- package/esm/serialization/encoders/null_encoder.d.ts +12 -0
- package/esm/serialization/encoders/null_encoder.js +13 -0
- package/esm/serialization/manipulate_bytes.d.ts +6 -0
- package/esm/serialization/manipulate_bytes.js +13 -0
- package/esm/serialization/read_uint_le.d.ts +4 -0
- package/esm/serialization/read_uint_le.js +14 -0
- package/esm/serialization/streams/fixed_size_stream_readable_buffer_adapter.d.ts +52 -0
- package/esm/serialization/streams/fixed_size_stream_readable_buffer_adapter.js +129 -0
- package/esm/serialization/streams/forward_only_stream_readable_buffer_adapter.d.ts +36 -0
- package/esm/serialization/streams/forward_only_stream_readable_buffer_adapter.js +114 -0
- package/esm/serialization/streams/stream_readable_buffer.d.ts +41 -0
- package/esm/serialization/streams/stream_readable_buffer.js +64 -0
- package/esm/serialization/streams/stream_readable_buffer_adapter.d.ts +38 -0
- package/esm/serialization/streams/stream_readable_buffer_adapter.js +105 -0
- package/esm/serialization/streams/stream_writable_buffer.d.ts +42 -0
- package/esm/serialization/streams/stream_writable_buffer.js +64 -0
- package/esm/serialization/streams/stream_writable_buffer_adapter.d.ts +36 -0
- package/esm/serialization/streams/stream_writable_buffer_adapter.js +65 -0
- package/esm/serialization/streams/streams.d.ts +29 -0
- package/esm/serialization/streams/streams.js +1 -0
- package/esm/serialization/tap.d.ts +427 -0
- package/esm/serialization/tap.js +605 -0
- package/esm/serialization/text_encoding.d.ts +12 -0
- package/esm/serialization/text_encoding.js +14 -0
- package/esm/type/create_type.d.ts +54 -0
- package/esm/type/create_type.js +401 -0
- package/package.json +33 -0
- package/sachitv-avro-typescript-0.4.0.tgz +0 -0
|
@@ -0,0 +1,240 @@
|
|
|
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 _LogicalResolver_logicalType, _LogicalResolver_resolver;
|
|
13
|
+
import { Resolver } from "../resolver.js";
|
|
14
|
+
import { Type } from "../type.js";
|
|
15
|
+
import { throwInvalidError } from "../error.js";
|
|
16
|
+
/**
|
|
17
|
+
* Base class for Avro logical types that wrap an underlying physical type
|
|
18
|
+
* while exposing a richer TypeScript representation.
|
|
19
|
+
*/
|
|
20
|
+
export class LogicalType extends Type {
|
|
21
|
+
/**
|
|
22
|
+
* Constructs a new LogicalType.
|
|
23
|
+
* @param underlyingType - The underlying type to wrap.
|
|
24
|
+
*/
|
|
25
|
+
constructor(underlyingType) {
|
|
26
|
+
super();
|
|
27
|
+
/** The underlying type that this logical type wraps. */
|
|
28
|
+
Object.defineProperty(this, "underlyingType", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true,
|
|
31
|
+
writable: true,
|
|
32
|
+
value: void 0
|
|
33
|
+
});
|
|
34
|
+
this.underlyingType = underlyingType;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Gets the underlying type that this logical type wraps.
|
|
38
|
+
*/
|
|
39
|
+
getUnderlyingType() {
|
|
40
|
+
return this.underlyingType;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Converts a value from the underlying type to the logical type value.
|
|
44
|
+
* @param value The underlying value.
|
|
45
|
+
*/
|
|
46
|
+
convertFromUnderlying(value) {
|
|
47
|
+
return this.fromUnderlying(value);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Determines if this logical type is compatible with the writer logical type for reading.
|
|
51
|
+
*/
|
|
52
|
+
canReadFromLogical(_writer) {
|
|
53
|
+
return _writer.constructor === this.constructor;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Serializes the logical value to an ArrayBuffer.
|
|
57
|
+
* @param value The logical value to serialize.
|
|
58
|
+
*/
|
|
59
|
+
async toBuffer(value) {
|
|
60
|
+
this.ensureValid(value, []);
|
|
61
|
+
const underlying = this.toUnderlying(value);
|
|
62
|
+
return await this.underlyingType.toBuffer(underlying);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Deserializes a logical value from an ArrayBuffer.
|
|
66
|
+
* @param buffer The buffer to deserialize from.
|
|
67
|
+
*/
|
|
68
|
+
async fromBuffer(buffer) {
|
|
69
|
+
const underlying = await this.underlyingType.fromBuffer(buffer);
|
|
70
|
+
return this.fromUnderlying(underlying);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Checks if the given value is valid for this type.
|
|
74
|
+
* @param value The value to validate.
|
|
75
|
+
* @param opts Optional validation options.
|
|
76
|
+
*/
|
|
77
|
+
isValid(value, opts) {
|
|
78
|
+
return this.check(value, opts?.errorHook, []);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Validates the value against this type, reporting errors via the hook if provided.
|
|
82
|
+
* @param value The value to check.
|
|
83
|
+
* @param errorHook Optional hook for reporting validation errors.
|
|
84
|
+
* @param path The path to the value in the schema.
|
|
85
|
+
*/
|
|
86
|
+
check(value, errorHook, path = []) {
|
|
87
|
+
if (!this.isInstance(value)) {
|
|
88
|
+
if (errorHook) {
|
|
89
|
+
errorHook(path.slice(), value, this);
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
let underlying;
|
|
94
|
+
try {
|
|
95
|
+
underlying = this.toUnderlying(value);
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
if (errorHook) {
|
|
99
|
+
errorHook(path.slice(), value, this);
|
|
100
|
+
}
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
return this.underlyingType.check(underlying, errorHook, path);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Clones a value, ensuring it is valid for this type.
|
|
107
|
+
*/
|
|
108
|
+
cloneFromValue(value) {
|
|
109
|
+
this.check(value, throwInvalidError, []);
|
|
110
|
+
const typedValue = value;
|
|
111
|
+
const cloned = this.underlyingType.cloneFromValue(this.toUnderlying(typedValue));
|
|
112
|
+
return this.fromUnderlying(cloned);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Compares two values by comparing their underlying representations.
|
|
116
|
+
*/
|
|
117
|
+
compare(val1, val2) {
|
|
118
|
+
const u1 = this.toUnderlying(val1);
|
|
119
|
+
const u2 = this.toUnderlying(val2);
|
|
120
|
+
return this.underlyingType.compare(u1, u2);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Generates a random value by generating a random underlying value and converting it.
|
|
124
|
+
*/
|
|
125
|
+
random() {
|
|
126
|
+
const underlying = this.underlyingType.random();
|
|
127
|
+
return this.fromUnderlying(underlying);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Writes the value to the tap by writing the underlying value.
|
|
131
|
+
*/
|
|
132
|
+
async write(tap, value) {
|
|
133
|
+
this.ensureValid(value, []);
|
|
134
|
+
await this.underlyingType.write(tap, this.toUnderlying(value));
|
|
135
|
+
}
|
|
136
|
+
/** Reads the value from the tap. */
|
|
137
|
+
async read(tap) {
|
|
138
|
+
const underlying = await this.underlyingType.read(tap);
|
|
139
|
+
return this.fromUnderlying(underlying);
|
|
140
|
+
}
|
|
141
|
+
/** Skips the value in the tap. */
|
|
142
|
+
async skip(tap) {
|
|
143
|
+
await this.underlyingType.skip(tap);
|
|
144
|
+
}
|
|
145
|
+
/** Matches the value in the taps. */
|
|
146
|
+
async match(tap1, tap2) {
|
|
147
|
+
return await this.underlyingType.match(tap1, tap2);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Creates a resolver for reading from the writer type, handling logical types specially.
|
|
151
|
+
*/
|
|
152
|
+
createResolver(writerType) {
|
|
153
|
+
if (writerType instanceof LogicalType) {
|
|
154
|
+
if (!this.canReadFromLogical(writerType)) {
|
|
155
|
+
throw new Error("Schema evolution not supported between incompatible logical types.");
|
|
156
|
+
}
|
|
157
|
+
const resolver = this.underlyingType.createResolver(writerType.getUnderlyingType());
|
|
158
|
+
return new LogicalResolver(this, resolver);
|
|
159
|
+
}
|
|
160
|
+
const resolver = this.underlyingType.createResolver(writerType);
|
|
161
|
+
return new LogicalResolver(this, resolver);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Ensures the value is valid for this logical type.
|
|
165
|
+
* @param value The value to validate.
|
|
166
|
+
* @param path The path for error reporting.
|
|
167
|
+
*/
|
|
168
|
+
ensureValid(value, path) {
|
|
169
|
+
this.check(value, throwInvalidError, path);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
class LogicalResolver extends Resolver {
|
|
173
|
+
constructor(logicalType, resolver) {
|
|
174
|
+
super(logicalType);
|
|
175
|
+
_LogicalResolver_logicalType.set(this, void 0);
|
|
176
|
+
_LogicalResolver_resolver.set(this, void 0);
|
|
177
|
+
__classPrivateFieldSet(this, _LogicalResolver_logicalType, logicalType, "f");
|
|
178
|
+
__classPrivateFieldSet(this, _LogicalResolver_resolver, resolver, "f");
|
|
179
|
+
}
|
|
180
|
+
async read(tap) {
|
|
181
|
+
const underlying = await __classPrivateFieldGet(this, _LogicalResolver_resolver, "f").read(tap);
|
|
182
|
+
return __classPrivateFieldGet(this, _LogicalResolver_logicalType, "f").convertFromUnderlying(underlying);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
_LogicalResolver_logicalType = new WeakMap(), _LogicalResolver_resolver = new WeakMap();
|
|
186
|
+
/**
|
|
187
|
+
* Logical type variant for named Avro schemas (record, enum, fixed) that keeps
|
|
188
|
+
* track of the fully qualified name and aliases of the underlying type.
|
|
189
|
+
*/
|
|
190
|
+
/**
|
|
191
|
+
* Logical type variant for named Avro schemas (record, enum, fixed) that keeps
|
|
192
|
+
* track of the fully qualified name and aliases of the underlying type.
|
|
193
|
+
*/
|
|
194
|
+
export class NamedLogicalType extends LogicalType {
|
|
195
|
+
/**
|
|
196
|
+
* Creates a new NamedLogicalType.
|
|
197
|
+
* @param namedType The underlying named type.
|
|
198
|
+
*/
|
|
199
|
+
constructor(namedType) {
|
|
200
|
+
super(namedType);
|
|
201
|
+
/** The underlying named type. */
|
|
202
|
+
Object.defineProperty(this, "namedType", {
|
|
203
|
+
enumerable: true,
|
|
204
|
+
configurable: true,
|
|
205
|
+
writable: true,
|
|
206
|
+
value: void 0
|
|
207
|
+
});
|
|
208
|
+
this.namedType = namedType;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Gets the full name of the underlying type.
|
|
212
|
+
*/
|
|
213
|
+
getFullName() {
|
|
214
|
+
return this.namedType.getFullName();
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Gets the namespace of the underlying type.
|
|
218
|
+
*/
|
|
219
|
+
getNamespace() {
|
|
220
|
+
return this.namedType.getNamespace();
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Gets the aliases of the underlying type.
|
|
224
|
+
*/
|
|
225
|
+
getAliases() {
|
|
226
|
+
return this.namedType.getAliases();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Helper to attach a logicalType annotation to an underlying Avro schema JSON.
|
|
231
|
+
*/
|
|
232
|
+
export function withLogicalTypeJSON(underlying, logicalType, extras = {}) {
|
|
233
|
+
if (typeof underlying === "string") {
|
|
234
|
+
return { type: underlying, logicalType, ...extras };
|
|
235
|
+
}
|
|
236
|
+
if (underlying && typeof underlying === "object" && !Array.isArray(underlying)) {
|
|
237
|
+
return { ...underlying, logicalType, ...extras };
|
|
238
|
+
}
|
|
239
|
+
throw new Error("Unsupported underlying schema for logical type serialization.");
|
|
240
|
+
}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import type { IntType } from "../primitive/int_type.js";
|
|
2
|
+
import type { LongType } from "../primitive/long_type.js";
|
|
3
|
+
import { LogicalType } from "./logical_type.js";
|
|
4
|
+
import type { JSONType } from "../type.js";
|
|
5
|
+
/**
|
|
6
|
+
* Logical type for `date`.
|
|
7
|
+
* Represents the number of days since the epoch.
|
|
8
|
+
*/
|
|
9
|
+
export declare class DateLogicalType extends LogicalType<number, number> {
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new DateLogicalType.
|
|
12
|
+
* @param underlying The underlying int type.
|
|
13
|
+
*/
|
|
14
|
+
constructor(underlying: IntType);
|
|
15
|
+
/** Checks if the logical type can read from the underlying type. */
|
|
16
|
+
protected canReadFromLogical(writer: LogicalType<unknown, unknown>): boolean;
|
|
17
|
+
/** Checks if the value is a valid instance of this logical type. */
|
|
18
|
+
/** Checks if the value is a valid instance of this logical type. */
|
|
19
|
+
protected isInstance(value: unknown): value is number;
|
|
20
|
+
/** Converts the logical value to the underlying representation. */
|
|
21
|
+
protected toUnderlying(value: number): number;
|
|
22
|
+
/** Converts the underlying value to the logical representation. */
|
|
23
|
+
protected fromUnderlying(value: number): number;
|
|
24
|
+
/** Generates a random value for testing. */
|
|
25
|
+
random(): number;
|
|
26
|
+
/** Returns the JSON representation of this type. */
|
|
27
|
+
toJSON(): JSONType;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Logical type for `time-millis`.
|
|
31
|
+
* Represents the time of day in milliseconds since midnight.
|
|
32
|
+
*/
|
|
33
|
+
export declare class TimeMillisLogicalType extends LogicalType<number, number> {
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new TimeMillisLogicalType.
|
|
36
|
+
* @param underlying The underlying int type.
|
|
37
|
+
*/
|
|
38
|
+
constructor(underlying: IntType);
|
|
39
|
+
/** Checks if the logical type can read from the underlying type. */
|
|
40
|
+
protected canReadFromLogical(writer: LogicalType<unknown, unknown>): boolean;
|
|
41
|
+
/** Checks if the value is a valid instance of this logical type. */
|
|
42
|
+
protected isInstance(value: unknown): value is number;
|
|
43
|
+
/** Converts the logical value to the underlying representation. */
|
|
44
|
+
protected toUnderlying(value: number): number;
|
|
45
|
+
/** Converts the underlying value to the logical representation. */
|
|
46
|
+
protected fromUnderlying(value: number): number;
|
|
47
|
+
/** Generates a random value for testing. */
|
|
48
|
+
random(): number;
|
|
49
|
+
/** Returns the JSON representation of this type. */
|
|
50
|
+
toJSON(): JSONType;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Logical type for `time-micros`.
|
|
54
|
+
* Represents the time of day in microseconds since midnight.
|
|
55
|
+
*/
|
|
56
|
+
export declare class TimeMicrosLogicalType extends LogicalType<bigint, bigint> {
|
|
57
|
+
/**
|
|
58
|
+
* Creates a new TimeMicrosLogicalType.
|
|
59
|
+
* @param underlying The underlying long type.
|
|
60
|
+
*/
|
|
61
|
+
constructor(underlying: LongType);
|
|
62
|
+
/** Checks if the logical type can read from the underlying type. */
|
|
63
|
+
protected canReadFromLogical(writer: LogicalType<unknown, unknown>): boolean;
|
|
64
|
+
/** Checks if the value is a valid instance of this logical type. */
|
|
65
|
+
/** Checks if the value is a valid instance of this logical type. */
|
|
66
|
+
protected isInstance(value: unknown): value is bigint;
|
|
67
|
+
/** Converts the logical value to the underlying representation. */
|
|
68
|
+
protected toUnderlying(value: bigint): bigint;
|
|
69
|
+
/** Converts the underlying value to the logical representation. */
|
|
70
|
+
protected fromUnderlying(value: bigint): bigint;
|
|
71
|
+
/** Generates a random value for testing. */
|
|
72
|
+
random(): bigint;
|
|
73
|
+
/** Returns the JSON representation of this type. */
|
|
74
|
+
toJSON(): JSONType;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Logical type for `timestamp-millis`.
|
|
78
|
+
* Represents an instant in time as the number of milliseconds since the epoch.
|
|
79
|
+
*/
|
|
80
|
+
export declare class TimestampMillisLogicalType extends LogicalType<Date, bigint> {
|
|
81
|
+
/**
|
|
82
|
+
* Creates a new TimestampMillisLogicalType.
|
|
83
|
+
* @param underlying The underlying long type.
|
|
84
|
+
*/
|
|
85
|
+
constructor(underlying: LongType);
|
|
86
|
+
/** Checks if the logical type can read from the underlying type. */
|
|
87
|
+
protected canReadFromLogical(writer: LogicalType<unknown, unknown>): boolean;
|
|
88
|
+
/** Checks if the value is a valid instance of this logical type. */
|
|
89
|
+
protected isInstance(value: unknown): value is Date;
|
|
90
|
+
/** Converts the logical value to the underlying representation. */
|
|
91
|
+
protected toUnderlying(value: Date): bigint;
|
|
92
|
+
/** Converts the underlying value to the logical representation. */
|
|
93
|
+
protected fromUnderlying(value: bigint): Date;
|
|
94
|
+
/** Generates a random value for testing. */
|
|
95
|
+
random(): Date;
|
|
96
|
+
/** Compares two Date values. */
|
|
97
|
+
compare(val1: Date, val2: Date): number;
|
|
98
|
+
/** Returns the JSON representation of this type. */
|
|
99
|
+
toJSON(): JSONType;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Logical type for `timestamp-micros`.
|
|
103
|
+
* Represents an instant in time as the number of microseconds since the epoch.
|
|
104
|
+
*/
|
|
105
|
+
export declare class TimestampMicrosLogicalType extends LogicalType<bigint, bigint> {
|
|
106
|
+
/**
|
|
107
|
+
* Creates a new TimestampMicrosLogicalType.
|
|
108
|
+
* @param underlying The underlying long type.
|
|
109
|
+
*/
|
|
110
|
+
constructor(underlying: LongType);
|
|
111
|
+
/** Checks if the logical type can read from the underlying type. */
|
|
112
|
+
protected canReadFromLogical(writer: LogicalType<unknown, unknown>): boolean;
|
|
113
|
+
/** Checks if the value is a valid instance of this logical type. */
|
|
114
|
+
protected isInstance(value: unknown): value is bigint;
|
|
115
|
+
/** Converts the logical value to the underlying representation. */
|
|
116
|
+
protected toUnderlying(value: bigint): bigint;
|
|
117
|
+
/** Converts the underlying value to the logical representation. */
|
|
118
|
+
protected fromUnderlying(value: bigint): bigint;
|
|
119
|
+
/** Generates a random value for testing. */
|
|
120
|
+
random(): bigint;
|
|
121
|
+
/** Returns the JSON representation of this type. */
|
|
122
|
+
toJSON(): JSONType;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Logical type for `timestamp-nanos`.
|
|
126
|
+
* Represents an instant in time as the number of nanoseconds since the epoch.
|
|
127
|
+
*/
|
|
128
|
+
export declare class TimestampNanosLogicalType extends LogicalType<bigint, bigint> {
|
|
129
|
+
/**
|
|
130
|
+
* Creates a new TimestampNanosLogicalType.
|
|
131
|
+
* @param underlying The underlying long type.
|
|
132
|
+
*/
|
|
133
|
+
constructor(underlying: LongType);
|
|
134
|
+
/** Checks if the logical type can read from the underlying type. */
|
|
135
|
+
protected canReadFromLogical(writer: LogicalType<unknown, unknown>): boolean;
|
|
136
|
+
/** Checks if the value is a valid instance of this logical type. */
|
|
137
|
+
protected isInstance(value: unknown): value is bigint;
|
|
138
|
+
/** Converts the logical value to the underlying representation. */
|
|
139
|
+
protected toUnderlying(value: bigint): bigint;
|
|
140
|
+
/** Converts the underlying value to the logical representation. */
|
|
141
|
+
protected fromUnderlying(value: bigint): bigint;
|
|
142
|
+
/** Generates a random value for testing. */
|
|
143
|
+
random(): bigint;
|
|
144
|
+
/** Returns the JSON representation of this type. */
|
|
145
|
+
toJSON(): JSONType;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Logical type for `local-timestamp-millis`.
|
|
149
|
+
* Represents a timestamp in a local time zone, in milliseconds.
|
|
150
|
+
*/
|
|
151
|
+
export declare class LocalTimestampMillisLogicalType extends LogicalType<number, bigint> {
|
|
152
|
+
/**
|
|
153
|
+
* Creates a new LocalTimestampMillisLogicalType.
|
|
154
|
+
* @param underlying The underlying long type.
|
|
155
|
+
*/
|
|
156
|
+
constructor(underlying: LongType);
|
|
157
|
+
/** Checks if the logical type can read from the underlying type. */
|
|
158
|
+
protected canReadFromLogical(writer: LogicalType<unknown, unknown>): boolean;
|
|
159
|
+
/** Checks if the value is a valid instance of this logical type. */
|
|
160
|
+
protected isInstance(value: unknown): value is number;
|
|
161
|
+
/** Converts the logical value to the underlying representation. */
|
|
162
|
+
protected toUnderlying(value: number): bigint;
|
|
163
|
+
/** Converts the underlying value to the logical representation. */
|
|
164
|
+
protected fromUnderlying(value: bigint): number;
|
|
165
|
+
/** Generates a random value for testing. */
|
|
166
|
+
random(): number;
|
|
167
|
+
/** Returns the JSON representation of this type. */
|
|
168
|
+
toJSON(): JSONType;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Logical type for `local-timestamp-micros`.
|
|
172
|
+
* Represents a timestamp in a local time zone, in microseconds.
|
|
173
|
+
*/
|
|
174
|
+
export declare class LocalTimestampMicrosLogicalType extends LogicalType<bigint, bigint> {
|
|
175
|
+
/**
|
|
176
|
+
* Creates a new LocalTimestampMicrosLogicalType.
|
|
177
|
+
* @param underlying The underlying long type.
|
|
178
|
+
*/
|
|
179
|
+
constructor(underlying: LongType);
|
|
180
|
+
/** Checks if the logical type can read from the underlying type. */
|
|
181
|
+
protected canReadFromLogical(writer: LogicalType<unknown, unknown>): boolean;
|
|
182
|
+
/** Checks if the value is a valid instance of this logical type. */
|
|
183
|
+
protected isInstance(value: unknown): value is bigint;
|
|
184
|
+
/** Converts the logical value to the underlying representation. */
|
|
185
|
+
protected toUnderlying(value: bigint): bigint;
|
|
186
|
+
/** Converts the underlying value to the logical representation. */
|
|
187
|
+
protected fromUnderlying(value: bigint): bigint;
|
|
188
|
+
/** Generates a random value for testing. */
|
|
189
|
+
random(): bigint;
|
|
190
|
+
/** Returns the JSON representation of this type. */
|
|
191
|
+
toJSON(): JSONType;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Logical type for `local-timestamp-nanos`.
|
|
195
|
+
* Represents a timestamp in a local time zone, in nanoseconds.
|
|
196
|
+
*/
|
|
197
|
+
export declare class LocalTimestampNanosLogicalType extends LogicalType<bigint, bigint> {
|
|
198
|
+
/**
|
|
199
|
+
* Creates a new LocalTimestampNanosLogicalType.
|
|
200
|
+
* @param underlying The underlying long type.
|
|
201
|
+
*/
|
|
202
|
+
constructor(underlying: LongType);
|
|
203
|
+
/** Checks if the logical type can read from the underlying type. */
|
|
204
|
+
protected canReadFromLogical(writer: LogicalType<unknown, unknown>): boolean;
|
|
205
|
+
/** Checks if the value is a valid instance of this logical type. */
|
|
206
|
+
protected isInstance(value: unknown): value is bigint;
|
|
207
|
+
/** Converts the logical value to the underlying representation. */
|
|
208
|
+
protected toUnderlying(value: bigint): bigint;
|
|
209
|
+
/** Converts the underlying value to the logical representation. */
|
|
210
|
+
protected fromUnderlying(value: bigint): bigint;
|
|
211
|
+
/** Generates a random value for testing. */
|
|
212
|
+
random(): bigint;
|
|
213
|
+
/** Returns the JSON representation of this type. */
|
|
214
|
+
toJSON(): JSONType;
|
|
215
|
+
}
|