-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtype.d.ts
More file actions
509 lines (509 loc) · 16.5 KB
/
type.d.ts
File metadata and controls
509 lines (509 loc) · 16.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
import { Field } from './schema';
import { Vector } from './vector';
import { flatbuffers } from 'flatbuffers';
import { TypedArrayConstructor } from './interfaces';
import { Vector as VType, TypeToDataType } from './interfaces';
import Long = flatbuffers.Long;
import { Type, Precision, UnionMode, DateUnit, TimeUnit, IntervalUnit } from './enum';
/** @ignore */
export declare type TimeBitWidth = 32 | 64;
/** @ignore */
export declare type IntBitWidth = 8 | 16 | 32 | 64;
/** @ignore */
export declare type IsSigned = {
'true': true;
'false': false;
};
/** @ignore */
export declare type RowLike<T extends {
[key: string]: DataType;
}> = (Iterable<T[keyof T]['TValue'] | null>) & {
[P in keyof T]: T[P]['TValue'] | null;
} & {
get<K extends keyof T>(key: K): T[K]['TValue'] | null;
};
export interface DataType<TType extends Type = Type, TChildren extends {
[key: string]: DataType;
} = any> {
readonly TType: TType;
readonly TArray: any;
readonly TValue: any;
readonly ArrayType: any;
readonly children: Field<TChildren[keyof TChildren]>[];
}
export declare class DataType<TType extends Type = Type, TChildren extends {
[key: string]: DataType;
} = any> {
[Symbol.toStringTag]: string;
/** @nocollapse */ static isNull(x: any): x is Null;
/** @nocollapse */ static isInt(x: any): x is Int_;
/** @nocollapse */ static isFloat(x: any): x is Float;
/** @nocollapse */ static isBinary(x: any): x is Binary;
/** @nocollapse */ static isUtf8(x: any): x is Utf8;
/** @nocollapse */ static isBool(x: any): x is Bool;
/** @nocollapse */ static isDecimal(x: any): x is Decimal;
/** @nocollapse */ static isDate(x: any): x is Date_;
/** @nocollapse */ static isTime(x: any): x is Time_;
/** @nocollapse */ static isTimestamp(x: any): x is Timestamp_;
/** @nocollapse */ static isInterval(x: any): x is Interval_;
/** @nocollapse */ static isList(x: any): x is List;
/** @nocollapse */ static isStruct(x: any): x is Struct;
/** @nocollapse */ static isUnion(x: any): x is Union_;
/** @nocollapse */ static isFixedSizeBinary(x: any): x is FixedSizeBinary;
/** @nocollapse */ static isFixedSizeList(x: any): x is FixedSizeList;
/** @nocollapse */ static isMap(x: any): x is Map_;
/** @nocollapse */ static isDictionary(x: any): x is Dictionary;
readonly typeId: TType;
compareTo(other: DataType): other is TypeToDataType<TType>;
protected static [Symbol.toStringTag]: string;
}
export interface Null extends DataType<Type.Null> {
TArray: void;
TValue: null;
}
export declare class Null extends DataType<Type.Null> {
toString(): string;
readonly typeId: Type.Null;
protected static [Symbol.toStringTag]: string;
}
/** @ignore */
declare type Ints = Type.Int | Type.Int8 | Type.Int16 | Type.Int32 | Type.Int64 | Type.Uint8 | Type.Uint16 | Type.Uint32 | Type.Uint64;
/** @ignore */
declare type IType = {
[Type.Int]: {
bitWidth: IntBitWidth;
isSigned: true | false;
TArray: IntArray;
TValue: number | Int32Array | Uint32Array;
};
[Type.Int8]: {
bitWidth: 8;
isSigned: true;
TArray: Int8Array;
TValue: number;
};
[Type.Int16]: {
bitWidth: 16;
isSigned: true;
TArray: Int16Array;
TValue: number;
};
[Type.Int32]: {
bitWidth: 32;
isSigned: true;
TArray: Int32Array;
TValue: number;
};
[Type.Int64]: {
bitWidth: 64;
isSigned: true;
TArray: Int32Array;
TValue: Int32Array;
};
[Type.Uint8]: {
bitWidth: 8;
isSigned: false;
TArray: Uint8Array;
TValue: number;
};
[Type.Uint16]: {
bitWidth: 16;
isSigned: false;
TArray: Uint16Array;
TValue: number;
};
[Type.Uint32]: {
bitWidth: 32;
isSigned: false;
TArray: Uint32Array;
TValue: number;
};
[Type.Uint64]: {
bitWidth: 64;
isSigned: false;
TArray: Uint32Array;
TValue: Uint32Array;
};
};
interface Int_<T extends Ints = Ints> extends DataType<T> {
TArray: IType[T]['TArray'];
TValue: IType[T]['TValue'];
}
declare class Int_<T extends Ints = Ints> extends DataType<T> {
readonly isSigned: IType[T]['isSigned'];
readonly bitWidth: IType[T]['bitWidth'];
constructor(isSigned: IType[T]['isSigned'], bitWidth: IType[T]['bitWidth']);
readonly typeId: T;
readonly ArrayType: TypedArrayConstructor<IType[T]['TArray']>;
toString(): string;
protected static [Symbol.toStringTag]: string;
}
export { Int_ as Int };
export declare class Int8 extends Int_<Type.Int8> {
constructor();
}
export declare class Int16 extends Int_<Type.Int16> {
constructor();
}
export declare class Int32 extends Int_<Type.Int32> {
constructor();
}
export declare class Int64 extends Int_<Type.Int64> {
constructor();
}
export declare class Uint8 extends Int_<Type.Uint8> {
constructor();
}
export declare class Uint16 extends Int_<Type.Uint16> {
constructor();
}
export declare class Uint32 extends Int_<Type.Uint32> {
constructor();
}
export declare class Uint64 extends Int_<Type.Uint64> {
constructor();
}
/** @ignore */
declare type Floats = Type.Float | Type.Float16 | Type.Float32 | Type.Float64;
/** @ignore */
declare type FType = {
[Type.Float]: {
precision: Precision;
TArray: FloatArray;
TValue: number;
};
[Type.Float16]: {
precision: Precision.HALF;
TArray: Uint16Array;
TValue: number;
};
[Type.Float32]: {
precision: Precision.SINGLE;
TArray: Float32Array;
TValue: number;
};
[Type.Float64]: {
precision: Precision.DOUBLE;
TArray: Float64Array;
TValue: number;
};
};
export interface Float<T extends Floats = Floats> extends DataType<T> {
TArray: FType[T]['TArray'];
TValue: number;
}
export declare class Float<T extends Floats = Floats> extends DataType<T> {
readonly precision: Precision;
constructor(precision: Precision);
readonly typeId: T;
readonly ArrayType: TypedArrayConstructor<FType[T]['TArray']>;
toString(): string;
protected static [Symbol.toStringTag]: string;
}
export declare class Float16 extends Float<Type.Float16> {
constructor();
}
export declare class Float32 extends Float<Type.Float32> {
constructor();
}
export declare class Float64 extends Float<Type.Float64> {
constructor();
}
export interface Binary extends DataType<Type.Binary> {
TArray: Uint8Array;
TValue: Uint8Array;
}
export declare class Binary extends DataType<Type.Binary> {
constructor();
readonly typeId: Type.Binary;
toString(): string;
protected static [Symbol.toStringTag]: string;
}
export interface Utf8 extends DataType<Type.Utf8> {
TArray: Uint8Array;
TValue: string;
ArrayType: typeof Uint8Array;
}
export declare class Utf8 extends DataType<Type.Utf8> {
constructor();
readonly typeId: Type.Utf8;
toString(): string;
protected static [Symbol.toStringTag]: string;
}
export interface Bool extends DataType<Type.Bool> {
TArray: Uint8Array;
TValue: boolean;
ArrayType: typeof Uint8Array;
}
export declare class Bool extends DataType<Type.Bool> {
constructor();
readonly typeId: Type.Bool;
toString(): string;
protected static [Symbol.toStringTag]: string;
}
export interface Decimal extends DataType<Type.Decimal> {
TArray: Uint32Array;
TValue: Uint32Array;
ArrayType: typeof Uint32Array;
}
export declare class Decimal extends DataType<Type.Decimal> {
readonly scale: number;
readonly precision: number;
constructor(scale: number, precision: number);
readonly typeId: Type.Decimal;
toString(): string;
protected static [Symbol.toStringTag]: string;
}
/** @ignore */
export declare type Dates = Type.Date | Type.DateDay | Type.DateMillisecond;
export interface Date_<T extends Dates = Dates> extends DataType<T> {
TArray: Int32Array;
TValue: Date;
ArrayType: typeof Int32Array;
}
export declare class Date_<T extends Dates = Dates> extends DataType<T> {
readonly unit: DateUnit;
constructor(unit: DateUnit);
readonly typeId: T;
toString(): string;
protected static [Symbol.toStringTag]: string;
}
export declare class DateDay extends Date_<Type.DateDay> {
constructor();
}
export declare class DateMillisecond extends Date_<Type.DateMillisecond> {
constructor();
}
/** @ignore */
declare type Times = Type.Time | Type.TimeSecond | Type.TimeMillisecond | Type.TimeMicrosecond | Type.TimeNanosecond;
/** @ignore */
declare type TimesType = {
[Type.Time]: {
unit: TimeUnit;
TValue: number | Int32Array;
};
[Type.TimeSecond]: {
unit: TimeUnit.SECOND;
TValue: number;
};
[Type.TimeMillisecond]: {
unit: TimeUnit.MILLISECOND;
TValue: number;
};
[Type.TimeMicrosecond]: {
unit: TimeUnit.MICROSECOND;
TValue: Int32Array;
};
[Type.TimeNanosecond]: {
unit: TimeUnit.NANOSECOND;
TValue: Int32Array;
};
};
interface Time_<T extends Times = Times> extends DataType<T> {
TArray: Int32Array;
TValue: TimesType[T]['TValue'];
ArrayType: typeof Int32Array;
}
declare class Time_<T extends Times = Times> extends DataType<T> {
readonly unit: TimesType[T]['unit'];
readonly bitWidth: TimeBitWidth;
constructor(unit: TimesType[T]['unit'], bitWidth: TimeBitWidth);
readonly typeId: T;
toString(): string;
protected static [Symbol.toStringTag]: string;
}
export { Time_ as Time };
export declare class TimeSecond extends Time_<Type.TimeSecond> {
constructor();
}
export declare class TimeMillisecond extends Time_<Type.TimeMillisecond> {
constructor();
}
export declare class TimeMicrosecond extends Time_<Type.TimeMicrosecond> {
constructor();
}
export declare class TimeNanosecond extends Time_<Type.TimeNanosecond> {
constructor();
}
/** @ignore */
declare type Timestamps = Type.Timestamp | Type.TimestampSecond | Type.TimestampMillisecond | Type.TimestampMicrosecond | Type.TimestampNanosecond;
interface Timestamp_<T extends Timestamps = Timestamps> extends DataType<T> {
TArray: Int32Array;
TValue: number;
ArrayType: typeof Int32Array;
}
declare class Timestamp_<T extends Timestamps = Timestamps> extends DataType<T> {
readonly unit: TimeUnit;
readonly timezone?: string | null | undefined;
constructor(unit: TimeUnit, timezone?: string | null | undefined);
readonly typeId: T;
toString(): string;
protected static [Symbol.toStringTag]: string;
}
export { Timestamp_ as Timestamp };
export declare class TimestampSecond extends Timestamp_<Type.TimestampSecond> {
constructor(timezone?: string | null);
}
export declare class TimestampMillisecond extends Timestamp_<Type.TimestampMillisecond> {
constructor(timezone?: string | null);
}
export declare class TimestampMicrosecond extends Timestamp_<Type.TimestampMicrosecond> {
constructor(timezone?: string | null);
}
export declare class TimestampNanosecond extends Timestamp_<Type.TimestampNanosecond> {
constructor(timezone?: string | null);
}
/** @ignore */
declare type Intervals = Type.Interval | Type.IntervalDayTime | Type.IntervalYearMonth;
interface Interval_<T extends Intervals = Intervals> extends DataType<T> {
TArray: Int32Array;
TValue: Int32Array;
ArrayType: typeof Int32Array;
}
declare class Interval_<T extends Intervals = Intervals> extends DataType<T> {
readonly unit: IntervalUnit;
constructor(unit: IntervalUnit);
readonly typeId: T;
toString(): string;
protected static [Symbol.toStringTag]: string;
}
export { Interval_ as Interval };
export declare class IntervalDayTime extends Interval_<Type.IntervalDayTime> {
constructor();
}
export declare class IntervalYearMonth extends Interval_<Type.IntervalYearMonth> {
constructor();
}
export interface List<T extends DataType = any> extends DataType<Type.List, {
[0]: T;
}> {
TArray: IterableArrayLike<T>;
TValue: VType<T>;
}
export declare class List<T extends DataType = any> extends DataType<Type.List, {
[0]: T;
}> {
constructor(child: Field<T>);
readonly children: Field<T>[];
readonly typeId: Type.List;
toString(): string;
readonly valueType: T;
readonly valueField: Field<T>;
readonly ArrayType: T['ArrayType'];
protected static [Symbol.toStringTag]: string;
}
export interface Struct<T extends {
[key: string]: DataType;
} = any> extends DataType<Type.Struct> {
TArray: IterableArrayLike<RowLike<T>>;
TValue: RowLike<T>;
dataTypes: T;
}
export declare class Struct<T extends {
[key: string]: DataType;
} = any> extends DataType<Type.Struct, T> {
readonly children: Field<T[keyof T]>[];
constructor(children: Field<T[keyof T]>[]);
readonly typeId: Type.Struct;
toString(): string;
protected static [Symbol.toStringTag]: string;
}
/** @ignore */
declare type Unions = Type.Union | Type.DenseUnion | Type.SparseUnion;
interface Union_<T extends Unions = Unions> extends DataType<T> {
TArray: Int8Array;
TValue: any;
}
declare class Union_<T extends Unions = Unions> extends DataType<T> {
readonly mode: UnionMode;
readonly typeIds: Int32Array;
readonly children: Field<any>[];
readonly typeIdToChildIndex: {
[key: number]: number;
};
constructor(mode: UnionMode, typeIds: number[] | Int32Array, children: Field<any>[]);
readonly typeId: T;
toString(): string;
protected static [Symbol.toStringTag]: string;
}
export { Union_ as Union };
export declare class DenseUnion extends Union_<Type.DenseUnion> {
constructor(typeIds: number[] | Int32Array, children: Field[]);
}
export declare class SparseUnion extends Union_<Type.SparseUnion> {
constructor(typeIds: number[] | Int32Array, children: Field[]);
}
export interface FixedSizeBinary extends DataType<Type.FixedSizeBinary> {
TArray: Uint8Array;
TValue: Uint8Array;
ArrayType: typeof Uint8Array;
}
export declare class FixedSizeBinary extends DataType<Type.FixedSizeBinary> {
readonly byteWidth: number;
constructor(byteWidth: number);
readonly typeId: Type.FixedSizeBinary;
toString(): string;
protected static [Symbol.toStringTag]: string;
}
export interface FixedSizeList<T extends DataType = any> extends DataType<Type.FixedSizeList> {
TArray: IterableArrayLike<T['TArray']>;
TValue: VType<T>;
}
export declare class FixedSizeList<T extends DataType = any> extends DataType<Type.FixedSizeList, {
[0]: T;
}> {
readonly listSize: number;
readonly children: Field<T>[];
constructor(listSize: number, child: Field<T>);
readonly typeId: Type.FixedSizeList;
readonly valueType: T;
readonly valueField: Field<T>;
readonly ArrayType: T['ArrayType'];
toString(): string;
protected static [Symbol.toStringTag]: string;
}
export interface Map_<T extends {
[key: string]: DataType;
} = any> extends DataType<Type.Map> {
TArray: IterableArrayLike<RowLike<T>>;
TValue: RowLike<T>;
dataTypes: T;
}
export declare class Map_<T extends {
[key: string]: DataType;
} = any> extends DataType<Type.Map, T> {
readonly children: Field<T[keyof T]>[];
readonly keysSorted: boolean;
constructor(children: Field<T[keyof T]>[], keysSorted?: boolean);
readonly typeId: Type.Map;
toString(): string;
protected static [Symbol.toStringTag]: string;
}
/** @ignore */
export declare type TKeys = Int8 | Int16 | Int32 | Uint8 | Uint16 | Uint32;
export interface Dictionary<T extends DataType = any, TKey extends TKeys = TKeys> extends DataType<Type.Dictionary> {
TArray: TKey['TArray'];
TValue: T['TValue'];
}
export declare class Dictionary<T extends DataType = any, TKey extends TKeys = TKeys> extends DataType<Type.Dictionary> {
readonly id: number;
readonly indices: TKey;
readonly dictionary: T;
readonly isOrdered: boolean;
dictionaryVector: Vector<T>;
constructor(dictionary: T, indices: TKey, id?: Long | number | null, isOrdered?: boolean | null, dictionaryVector?: Vector<T>);
readonly typeId: Type.Dictionary;
readonly children: Field<any>[];
readonly valueType: T;
readonly ArrayType: T['ArrayType'];
toString(): string;
protected static [Symbol.toStringTag]: string;
}
/** @ignore */
export interface IterableArrayLike<T = any> extends ArrayLike<T>, Iterable<T> {
}
/** @ignore */
export declare type FloatArray = Uint16Array | Float32Array | Float64Array;
/** @ignore */
export declare type IntArray = Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array;
export declare function strideForType(type: DataType): number;