@loaders.gl/schema 4.3.1 → 4.4.0-alpha.1

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/dist/categories/category-gis.d.ts +6 -0
  2. package/dist/categories/category-gis.d.ts.map +1 -0
  3. package/dist/categories/category-image.d.ts.map +1 -0
  4. package/dist/{types → categories}/category-mesh.d.ts +2 -2
  5. package/dist/categories/category-mesh.d.ts.map +1 -0
  6. package/dist/{types → categories}/category-table.d.ts +14 -14
  7. package/dist/categories/category-table.d.ts.map +1 -0
  8. package/dist/categories/category-texture.d.ts.map +1 -0
  9. package/dist/{lib/mesh → deprecated}/mesh-utils.d.ts +4 -2
  10. package/dist/deprecated/mesh-utils.d.ts.map +1 -0
  11. package/dist/{lib/mesh → deprecated}/mesh-utils.js +2 -0
  12. package/dist/dist.dev.js +0 -1836
  13. package/dist/dist.min.js +1 -1
  14. package/dist/geometry/binary-features.d.ts +30 -0
  15. package/dist/geometry/binary-features.d.ts.map +1 -0
  16. package/dist/geometry/binary-geometries.d.ts +33 -0
  17. package/dist/geometry/binary-geometries.d.ts.map +1 -0
  18. package/dist/geometry/flat-geometries.d.ts +61 -0
  19. package/dist/geometry/flat-geometries.d.ts.map +1 -0
  20. package/dist/index.cjs +2 -1792
  21. package/dist/index.cjs.map +4 -4
  22. package/dist/index.d.ts +10 -28
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +3 -23
  25. package/dist/types/batch.d.ts +3 -1
  26. package/dist/types/batch.d.ts.map +1 -1
  27. package/package.json +5 -4
  28. package/src/{types → categories}/category-gis.ts +7 -18
  29. package/src/{types → categories}/category-mesh.ts +2 -2
  30. package/src/{types → categories}/category-table.ts +14 -17
  31. package/src/{lib/mesh → deprecated}/mesh-utils.ts +4 -2
  32. package/src/geometry/binary-features.ts +43 -0
  33. package/src/geometry/binary-geometries.ts +45 -0
  34. package/src/{types → geometry}/flat-geometries.ts +44 -14
  35. package/src/index.ts +15 -101
  36. package/src/types/batch.ts +3 -1
  37. package/dist/lib/mesh/convert-mesh.d.ts +0 -15
  38. package/dist/lib/mesh/convert-mesh.d.ts.map +0 -1
  39. package/dist/lib/mesh/convert-mesh.js +0 -37
  40. package/dist/lib/mesh/deduce-mesh-schema.d.ts +0 -24
  41. package/dist/lib/mesh/deduce-mesh-schema.d.ts.map +0 -1
  42. package/dist/lib/mesh/deduce-mesh-schema.js +0 -62
  43. package/dist/lib/mesh/mesh-to-arrow-table.d.ts +0 -1
  44. package/dist/lib/mesh/mesh-to-arrow-table.d.ts.map +0 -1
  45. package/dist/lib/mesh/mesh-to-arrow-table.js +0 -47
  46. package/dist/lib/mesh/mesh-utils.d.ts.map +0 -1
  47. package/dist/lib/table/arrow-api/arrow-like-field.d.ts +0 -19
  48. package/dist/lib/table/arrow-api/arrow-like-field.d.ts.map +0 -1
  49. package/dist/lib/table/arrow-api/arrow-like-field.js +0 -36
  50. package/dist/lib/table/arrow-api/arrow-like-interface.d.ts +0 -43
  51. package/dist/lib/table/arrow-api/arrow-like-interface.d.ts.map +0 -1
  52. package/dist/lib/table/arrow-api/arrow-like-schema.d.ts +0 -12
  53. package/dist/lib/table/arrow-api/arrow-like-schema.d.ts.map +0 -1
  54. package/dist/lib/table/arrow-api/arrow-like-schema.js +0 -81
  55. package/dist/lib/table/arrow-api/arrow-like-table.d.ts +0 -24
  56. package/dist/lib/table/arrow-api/arrow-like-table.d.ts.map +0 -1
  57. package/dist/lib/table/arrow-api/arrow-like-table.js +0 -63
  58. package/dist/lib/table/arrow-api/arrow-like-type.d.ts +0 -177
  59. package/dist/lib/table/arrow-api/arrow-like-type.d.ts.map +0 -1
  60. package/dist/lib/table/arrow-api/arrow-like-type.js +0 -442
  61. package/dist/lib/table/arrow-api/enum.d.ts +0 -92
  62. package/dist/lib/table/arrow-api/enum.d.ts.map +0 -1
  63. package/dist/lib/table/arrow-api/enum.js +0 -97
  64. package/dist/lib/table/arrow-api/get-type-info.d.ts +0 -13
  65. package/dist/lib/table/arrow-api/get-type-info.d.ts.map +0 -1
  66. package/dist/lib/table/arrow-api/get-type-info.js +0 -27
  67. package/dist/lib/table/arrow-api/index.d.ts +0 -5
  68. package/dist/lib/table/arrow-api/index.d.ts.map +0 -1
  69. package/dist/lib/table/arrow-api/index.js +0 -7
  70. package/dist/lib/table/batches/base-table-batch-aggregator.d.ts +0 -20
  71. package/dist/lib/table/batches/base-table-batch-aggregator.d.ts.map +0 -1
  72. package/dist/lib/table/batches/base-table-batch-aggregator.js +0 -63
  73. package/dist/lib/table/batches/columnar-table-batch-aggregator.d.ts +0 -23
  74. package/dist/lib/table/batches/columnar-table-batch-aggregator.d.ts.map +0 -1
  75. package/dist/lib/table/batches/columnar-table-batch-aggregator.js +0 -91
  76. package/dist/lib/table/batches/row-table-batch-aggregator.d.ts +0 -22
  77. package/dist/lib/table/batches/row-table-batch-aggregator.d.ts.map +0 -1
  78. package/dist/lib/table/batches/row-table-batch-aggregator.js +0 -85
  79. package/dist/lib/table/batches/table-batch-aggregator.d.ts +0 -25
  80. package/dist/lib/table/batches/table-batch-aggregator.d.ts.map +0 -1
  81. package/dist/lib/table/batches/table-batch-aggregator.js +0 -4
  82. package/dist/lib/table/batches/table-batch-builder.d.ts +0 -53
  83. package/dist/lib/table/batches/table-batch-builder.d.ts.map +0 -1
  84. package/dist/lib/table/batches/table-batch-builder.js +0 -151
  85. package/dist/lib/table/simple-table/convert-table.d.ts +0 -43
  86. package/dist/lib/table/simple-table/convert-table.d.ts.map +0 -1
  87. package/dist/lib/table/simple-table/convert-table.js +0 -118
  88. package/dist/lib/table/simple-table/data-type.d.ts +0 -17
  89. package/dist/lib/table/simple-table/data-type.d.ts.map +0 -1
  90. package/dist/lib/table/simple-table/data-type.js +0 -88
  91. package/dist/lib/table/simple-table/make-table-from-batches.d.ts +0 -22
  92. package/dist/lib/table/simple-table/make-table-from-batches.d.ts.map +0 -1
  93. package/dist/lib/table/simple-table/make-table-from-batches.js +0 -79
  94. package/dist/lib/table/simple-table/make-table.d.ts +0 -65
  95. package/dist/lib/table/simple-table/make-table.d.ts.map +0 -1
  96. package/dist/lib/table/simple-table/make-table.js +0 -94
  97. package/dist/lib/table/simple-table/row-utils.d.ts +0 -15
  98. package/dist/lib/table/simple-table/row-utils.d.ts.map +0 -1
  99. package/dist/lib/table/simple-table/row-utils.js +0 -49
  100. package/dist/lib/table/simple-table/table-accessors.d.ts +0 -68
  101. package/dist/lib/table/simple-table/table-accessors.d.ts.map +0 -1
  102. package/dist/lib/table/simple-table/table-accessors.js +0 -350
  103. package/dist/lib/table/simple-table/table-column.d.ts +0 -7
  104. package/dist/lib/table/simple-table/table-column.d.ts.map +0 -1
  105. package/dist/lib/table/simple-table/table-column.js +0 -39
  106. package/dist/lib/table/simple-table/table-schema.d.ts +0 -15
  107. package/dist/lib/table/simple-table/table-schema.d.ts.map +0 -1
  108. package/dist/lib/table/simple-table/table-schema.js +0 -100
  109. package/dist/lib/utils/assert.d.ts +0 -2
  110. package/dist/lib/utils/assert.d.ts.map +0 -1
  111. package/dist/lib/utils/assert.js +0 -8
  112. package/dist/lib/utils/async-queue.d.ts +0 -18
  113. package/dist/lib/utils/async-queue.d.ts.map +0 -1
  114. package/dist/lib/utils/async-queue.js +0 -90
  115. package/dist/types/binary-geometries.d.ts +0 -57
  116. package/dist/types/binary-geometries.d.ts.map +0 -1
  117. package/dist/types/category-gis.d.ts +0 -18
  118. package/dist/types/category-gis.d.ts.map +0 -1
  119. package/dist/types/category-image.d.ts.map +0 -1
  120. package/dist/types/category-mesh.d.ts.map +0 -1
  121. package/dist/types/category-table.d.ts.map +0 -1
  122. package/dist/types/category-texture.d.ts.map +0 -1
  123. package/dist/types/flat-geometries.d.ts +0 -30
  124. package/dist/types/flat-geometries.d.ts.map +0 -1
  125. package/src/lib/mesh/convert-mesh.ts +0 -51
  126. package/src/lib/mesh/deduce-mesh-schema.ts +0 -76
  127. package/src/lib/mesh/mesh-to-arrow-table.ts +0 -47
  128. package/src/lib/table/arrow-api/arrow-like-field.ts +0 -53
  129. package/src/lib/table/arrow-api/arrow-like-interface.ts +0 -84
  130. package/src/lib/table/arrow-api/arrow-like-schema.ts +0 -101
  131. package/src/lib/table/arrow-api/arrow-like-table.ts +0 -86
  132. package/src/lib/table/arrow-api/arrow-like-type.ts +0 -502
  133. package/src/lib/table/arrow-api/enum.ts +0 -99
  134. package/src/lib/table/arrow-api/get-type-info.ts +0 -38
  135. package/src/lib/table/arrow-api/index.ts +0 -8
  136. package/src/lib/table/batches/base-table-batch-aggregator.ts +0 -83
  137. package/src/lib/table/batches/columnar-table-batch-aggregator.ts +0 -112
  138. package/src/lib/table/batches/row-table-batch-aggregator.ts +0 -109
  139. package/src/lib/table/batches/table-batch-aggregator.ts +0 -29
  140. package/src/lib/table/batches/table-batch-builder.ts +0 -190
  141. package/src/lib/table/simple-table/convert-table.ts +0 -149
  142. package/src/lib/table/simple-table/data-type.ts +0 -104
  143. package/src/lib/table/simple-table/make-table-from-batches.ts +0 -98
  144. package/src/lib/table/simple-table/make-table.ts +0 -111
  145. package/src/lib/table/simple-table/row-utils.ts +0 -59
  146. package/src/lib/table/simple-table/table-accessors.ts +0 -417
  147. package/src/lib/table/simple-table/table-column.ts +0 -49
  148. package/src/lib/table/simple-table/table-schema.ts +0 -121
  149. package/src/lib/utils/assert.ts +0 -8
  150. package/src/lib/utils/async-queue.ts +0 -104
  151. package/src/types/binary-geometries.ts +0 -67
  152. /package/dist/{types → categories}/category-gis.js +0 -0
  153. /package/dist/{types → categories}/category-image.d.ts +0 -0
  154. /package/dist/{types → categories}/category-image.js +0 -0
  155. /package/dist/{types → categories}/category-mesh.js +0 -0
  156. /package/dist/{types → categories}/category-table.js +0 -0
  157. /package/dist/{types → categories}/category-texture.d.ts +0 -0
  158. /package/dist/{types → categories}/category-texture.js +0 -0
  159. /package/dist/{lib/table/arrow-api/arrow-like-interface.js → geometry/binary-features.js} +0 -0
  160. /package/dist/{types → geometry}/binary-geometries.js +0 -0
  161. /package/dist/{types → geometry}/flat-geometries.js +0 -0
  162. /package/src/{types → categories}/category-image.ts +0 -0
  163. /package/src/{types → categories}/category-texture.ts +0 -0
@@ -1,502 +0,0 @@
1
- // loaders.gl
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
-
5
- // This code is adapted from ArrowJS https://github.com/apache/arrow
6
- // under Apache license http://www.apache.org/licenses/LICENSE-2.0
7
-
8
- import {Type} from './enum';
9
-
10
- import {ArrowLikeField as Field} from './arrow-like-field';
11
-
12
- export {Type} from './enum';
13
-
14
- export type TypedIntArray =
15
- | Int8Array
16
- | Uint8Array
17
- | Int16Array
18
- | Uint16Array
19
- | Int32Array
20
- | Uint32Array
21
- | Uint8ClampedArray;
22
-
23
- export type TypedFloatArray = Float32Array | Float64Array;
24
-
25
- export type TypedArray = TypedIntArray | TypedFloatArray;
26
-
27
- export type AnyArrayType = Array<any> | TypedIntArray | TypedFloatArray;
28
-
29
- /** ArrowLike DataType class */
30
- export class DataType {
31
- static isNull(x: any): boolean {
32
- return x && x.typeId === Type.Null;
33
- }
34
- static isInt(x: any): boolean {
35
- return x && x.typeId === Type.Int;
36
- }
37
- static isFloat(x: any): boolean {
38
- return x && x.typeId === Type.Float;
39
- }
40
- static isBinary(x: any): boolean {
41
- return x && x.typeId === Type.Binary;
42
- }
43
- static isUtf8(x: any): boolean {
44
- return x && x.typeId === Type.Utf8;
45
- }
46
- static isBool(x: any): boolean {
47
- return x && x.typeId === Type.Bool;
48
- }
49
- static isDecimal(x: any): boolean {
50
- return x && x.typeId === Type.Decimal;
51
- }
52
- static isDate(x: any): boolean {
53
- return x && x.typeId === Type.Date;
54
- }
55
- static isTime(x: any): boolean {
56
- return x && x.typeId === Type.Time;
57
- }
58
- static isTimestamp(x: any): boolean {
59
- return x && x.typeId === Type.Timestamp;
60
- }
61
- static isInterval(x: any): boolean {
62
- return x && x.typeId === Type.Interval;
63
- }
64
- static isList(x: any): boolean {
65
- return x && x.typeId === Type.List;
66
- }
67
- static isStruct(x: any): boolean {
68
- return x && x.typeId === Type.Struct;
69
- }
70
- static isUnion(x: any): boolean {
71
- return x && x.typeId === Type.Union;
72
- }
73
- static isFixedSizeBinary(x: any): boolean {
74
- return x && x.typeId === Type.FixedSizeBinary;
75
- }
76
- static isFixedSizeList(x: any): boolean {
77
- return x && x.typeId === Type.FixedSizeList;
78
- }
79
- static isMap(x: any): boolean {
80
- return x && x.typeId === Type.Map;
81
- }
82
- static isDictionary(x: any): boolean {
83
- return x && x.typeId === Type.Dictionary;
84
- }
85
-
86
- get typeId(): Type {
87
- return Type.NONE;
88
- }
89
-
90
- // get ArrayType(): AnyArrayType {
91
- // return Int8Array;
92
- // }
93
-
94
- // get ArrayType() { return Array; }
95
- compareTo(other: DataType): boolean {
96
- // TODO
97
- return this === other; // comparer.visit(this, other);
98
- }
99
- }
100
-
101
- // NULL
102
-
103
- export class Null extends DataType {
104
- get typeId(): Type {
105
- return Type.Null;
106
- }
107
- get [Symbol.toStringTag](): string {
108
- return 'Null';
109
- }
110
- toString(): string {
111
- return 'Null';
112
- }
113
- }
114
-
115
- // BOOLEANS
116
-
117
- export class Bool extends DataType {
118
- get typeId(): Type {
119
- return Type.Bool;
120
- }
121
- // get ArrayType() {
122
- // return Uint8Array;
123
- // }
124
- get [Symbol.toStringTag](): string {
125
- return 'Bool';
126
- }
127
- toString(): string {
128
- return 'Bool';
129
- }
130
- }
131
-
132
- // INTS
133
-
134
- export class Int extends DataType {
135
- readonly isSigned: boolean;
136
- readonly bitWidth: number;
137
- constructor(isSigned, bitWidth) {
138
- super();
139
- this.isSigned = isSigned;
140
- this.bitWidth = bitWidth;
141
- }
142
- get typeId(): Type {
143
- return Type.Int;
144
- }
145
- // get ArrayType() {
146
- // switch (this.bitWidth) {
147
- // case 8:
148
- // return this.isSigned ? Int8Array : Uint8Array;
149
- // case 16:
150
- // return this.isSigned ? Int16Array : Uint16Array;
151
- // case 32:
152
- // return this.isSigned ? Int32Array : Uint32Array;
153
- // case 64:
154
- // return this.isSigned ? Int32Array : Uint32Array;
155
- // default:
156
- // throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);
157
- // }
158
- // }
159
- get [Symbol.toStringTag](): string {
160
- return 'Int';
161
- }
162
- toString(): string {
163
- return `${this.isSigned ? 'I' : 'Ui'}nt${this.bitWidth}`;
164
- }
165
- }
166
-
167
- export class Int8 extends Int {
168
- constructor() {
169
- super(true, 8);
170
- }
171
- }
172
- export class Int16 extends Int {
173
- constructor() {
174
- super(true, 16);
175
- }
176
- }
177
- export class Int32 extends Int {
178
- constructor() {
179
- super(true, 32);
180
- }
181
- }
182
- export class Int64 extends Int {
183
- constructor() {
184
- super(true, 64);
185
- }
186
- }
187
- export class Uint8 extends Int {
188
- constructor() {
189
- super(false, 8);
190
- }
191
- }
192
- export class Uint16 extends Int {
193
- constructor() {
194
- super(false, 16);
195
- }
196
- }
197
- export class Uint32 extends Int {
198
- constructor() {
199
- super(false, 32);
200
- }
201
- }
202
- export class Uint64 extends Int {
203
- constructor() {
204
- super(false, 64);
205
- }
206
- }
207
-
208
- // FLOATS
209
-
210
- const Precision = {
211
- HALF: 16,
212
- SINGLE: 32,
213
- DOUBLE: 64
214
- };
215
-
216
- export class Float extends DataType {
217
- readonly precision: number;
218
- constructor(precision) {
219
- super();
220
- this.precision = precision;
221
- }
222
- get typeId(): Type {
223
- return Type.Float;
224
- }
225
- // get ArrayType() {
226
- // switch (this.precision) {
227
- // case Precision.HALF:
228
- // return Uint16Array;
229
- // case Precision.SINGLE:
230
- // return Float32Array;
231
- // case Precision.DOUBLE:
232
- // return Float64Array;
233
- // default:
234
- // throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);
235
- // }
236
- // }
237
- get [Symbol.toStringTag](): string {
238
- return 'Float';
239
- }
240
- toString(): string {
241
- return `Float${this.precision}`;
242
- }
243
- }
244
-
245
- export class Float16 extends Float {
246
- constructor() {
247
- super(Precision.HALF);
248
- }
249
- }
250
- export class Float32 extends Float {
251
- constructor() {
252
- super(Precision.SINGLE);
253
- }
254
- }
255
- export class Float64 extends Float {
256
- constructor() {
257
- super(Precision.DOUBLE);
258
- }
259
- }
260
-
261
- export class Binary extends DataType {
262
- constructor() {
263
- super();
264
- }
265
- get typeId() {
266
- return Type.Binary;
267
- }
268
- toString() {
269
- return 'Binary';
270
- }
271
- get [Symbol.toStringTag]() {
272
- return 'Binary';
273
- }
274
- }
275
-
276
- // STRINGS
277
-
278
- export class Utf8 extends DataType {
279
- get typeId(): Type {
280
- return Type.Utf8;
281
- }
282
- // get ArrayType() {
283
- // return Uint8Array;
284
- // }
285
- get [Symbol.toStringTag](): string {
286
- return 'Utf8';
287
- }
288
- toString(): string {
289
- return 'Utf8';
290
- }
291
- }
292
-
293
- // DATES, TIMES AND INTERVALS
294
-
295
- const DateUnit = {
296
- DAY: 0,
297
- MILLISECOND: 1
298
- };
299
-
300
- export class Date extends DataType {
301
- readonly unit: number;
302
- constructor(unit) {
303
- super();
304
- this.unit = unit;
305
- }
306
- get typeId(): Type {
307
- return Type.Date;
308
- }
309
- // get ArrayType() {
310
- // return Int32Array;
311
- // }
312
- get [Symbol.toStringTag](): string {
313
- return 'Date';
314
- }
315
- toString(): string {
316
- return `Date${(this.unit + 1) * 32}<${DateUnit[this.unit]}>`;
317
- }
318
- }
319
-
320
- export class DateDay extends Date {
321
- constructor() {
322
- super(DateUnit.DAY);
323
- }
324
- }
325
- export class DateMillisecond extends Date {
326
- constructor() {
327
- super(DateUnit.MILLISECOND);
328
- }
329
- }
330
-
331
- const TimeUnit = {
332
- SECOND: 1,
333
- MILLISECOND: 1e3,
334
- MICROSECOND: 1e6,
335
- NANOSECOND: 1e9
336
- };
337
-
338
- export class Time extends DataType {
339
- readonly unit: any;
340
- readonly bitWidth: number;
341
-
342
- constructor(unit: any, bitWidth: number) {
343
- super();
344
- this.unit = unit;
345
- this.bitWidth = bitWidth;
346
- }
347
- get typeId(): Type {
348
- return Type.Time;
349
- }
350
- toString(): string {
351
- return `Time${this.bitWidth}<${TimeUnit[this.unit]}>`;
352
- }
353
- get [Symbol.toStringTag](): string {
354
- return 'Time';
355
- }
356
- // get ArrayType() {
357
- // return Int32Array;
358
- // }
359
- }
360
-
361
- export class TimeSecond extends Time {
362
- constructor() {
363
- super(TimeUnit.SECOND, 32);
364
- }
365
- }
366
- export class TimeMillisecond extends Time {
367
- constructor() {
368
- super(TimeUnit.MILLISECOND, 32);
369
- }
370
- }
371
- // export class TimeMicrosecond extends Time { constructor() { super(TimeUnit.MICROSECOND, 64); } }
372
- // export class TimeNanosecond extends Time { constructor() { super(TimeUnit.NANOSECOND, 64); } }
373
-
374
- export class Timestamp extends DataType {
375
- readonly unit: any;
376
- readonly timezone: any;
377
-
378
- constructor(unit: any, timezone = null) {
379
- super();
380
- this.unit = unit;
381
- this.timezone = timezone;
382
- }
383
- get typeId(): Type {
384
- return Type.Timestamp;
385
- }
386
- // get ArrayType() {
387
- // return Int32Array;
388
- // }
389
- get [Symbol.toStringTag](): string {
390
- return 'Timestamp';
391
- }
392
- toString(): string {
393
- return `Timestamp<${TimeUnit[this.unit]}${this.timezone ? `, ${this.timezone}` : ''}>`;
394
- }
395
- }
396
-
397
- export class TimestampSecond extends Timestamp {
398
- constructor(timezone = null) {
399
- super(TimeUnit.SECOND, timezone);
400
- }
401
- }
402
- export class TimestampMillisecond extends Timestamp {
403
- constructor(timezone = null) {
404
- super(TimeUnit.MILLISECOND, timezone);
405
- }
406
- }
407
- export class TimestampMicrosecond extends Timestamp {
408
- constructor(timezone = null) {
409
- super(TimeUnit.MICROSECOND, timezone);
410
- }
411
- }
412
- export class TimestampNanosecond extends Timestamp {
413
- constructor(timezone = null) {
414
- super(TimeUnit.NANOSECOND, timezone);
415
- }
416
- }
417
-
418
- const IntervalUnit = {
419
- DAY_TIME: 0,
420
- YEAR_MONTH: 1
421
- };
422
-
423
- export class Interval extends DataType {
424
- readonly unit: number;
425
- constructor(unit: number) {
426
- super();
427
- this.unit = unit;
428
- }
429
- get typeId(): Type {
430
- return Type.Interval;
431
- }
432
- // get ArrayType() {
433
- // return Int32Array;
434
- // }
435
- get [Symbol.toStringTag](): string {
436
- return 'Interval';
437
- }
438
- toString(): string {
439
- return `Interval<${IntervalUnit[this.unit]}>`;
440
- }
441
- }
442
-
443
- export class IntervalDayTime extends Interval {
444
- constructor() {
445
- super(IntervalUnit.DAY_TIME);
446
- }
447
- }
448
- export class IntervalYearMonth extends Interval {
449
- constructor() {
450
- super(IntervalUnit.YEAR_MONTH);
451
- }
452
- }
453
-
454
- export class FixedSizeList extends DataType {
455
- readonly listSize: number;
456
- readonly children: Field[];
457
-
458
- constructor(listSize: number, child: Field) {
459
- super();
460
- this.listSize = listSize;
461
- this.children = [child];
462
- }
463
- get typeId(): Type {
464
- return Type.FixedSizeList;
465
- }
466
- get valueType() {
467
- return this.children[0].type;
468
- }
469
- get valueField() {
470
- return this.children[0];
471
- }
472
- // get ArrayType() {
473
- // return this.valueType.ArrayType;
474
- // }
475
- get [Symbol.toStringTag](): string {
476
- return 'FixedSizeList';
477
- }
478
- toString(): string {
479
- return `FixedSizeList[${this.listSize}]<${JSON.stringify(this.valueType)}>`;
480
- }
481
- }
482
-
483
- export class Struct extends DataType {
484
- public readonly children: Field[];
485
-
486
- constructor(children: Field[]) {
487
- super();
488
- this.children = children;
489
- }
490
-
491
- public get typeId() {
492
- return Type.Struct;
493
- }
494
- public toString() {
495
- return `Struct<{${this.children
496
- .map((f) => `${f.name}:${JSON.stringify(f.type)}`)
497
- .join(', ')}}>`;
498
- }
499
- get [Symbol.toStringTag](): string {
500
- return 'Struct';
501
- }
502
- }
@@ -1,99 +0,0 @@
1
- // loaders.gl
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
-
5
- // This code is adapted from ArrowJS https://github.com/apache/arrow
6
- // under Apache license http://www.apache.org/licenses/LICENSE-2.0
7
-
8
- /**
9
- * Main data type enumeration.
10
- *
11
- * Data types in this library are all *logical*. They can be expressed as
12
- * either a primitive physical type (bytes or bits of some fixed size), a
13
- * nested type consisting of other data types, or another data type (e.g. a
14
- * timestamp encoded as an int64).
15
- *
16
- * **Note**: Only enum values 0-17 (NONE through Map) are written to an Arrow
17
- * IPC payload.
18
- *
19
- * The rest of the values are specified here so TypeScript can narrow the type
20
- * signatures further beyond the base Arrow Types. The Arrow DataTypes include
21
- * metadata like `bitWidth` that impact the type signatures of the values we
22
- * accept and return.
23
- *
24
- * For example, the `Int8Vector` reads 1-byte numbers from an `Int8Array`, an
25
- * `Int32Vector` reads a 4-byte number from an `Int32Array`, and an `Int64Vector`
26
- * reads a pair of 4-byte lo, hi 32-bit integers as a zero-copy slice from the
27
- * underlying `Int32Array`.
28
- *
29
- * Library consumers benefit by knowing the narrowest type, since we can ensure
30
- * the types across all public methods are propagated, and never bail to `any`.
31
- * These values are _never_ used at runtime, and they will _never_ be written
32
- * to the flatbuffers metadata of serialized Arrow IPC payloads.
33
- */
34
- export enum Type {
35
- /** The default placeholder type */
36
- NONE = 0,
37
- /** A NULL type having no physical storage */
38
- Null = 1,
39
- /** Signed or unsigned 8, 16, 32, or 64-bit little-endian integer */
40
- Int = 2,
41
- /** 2, 4, or 8-byte floating point value */
42
- Float = 3,
43
- /** Variable-length bytes (no guarantee of UTF8-ness) */
44
- Binary = 4,
45
- /** UTF8 variable-length string as List<Char> */
46
- Utf8 = 5,
47
- /** Boolean as 1 bit, LSB bit-packed ordering */
48
- Bool = 6,
49
- /** Precision-and-scale-based decimal type. Storage type depends on the parameters. */
50
- Decimal = 7,
51
- /** int32_t days or int64_t milliseconds since the UNIX epoch */
52
- Date = 8,
53
- /** Time as signed 32 or 64-bit integer, representing either seconds, milliseconds, microseconds, or nanoseconds since midnight since midnight */
54
- Time = 9,
55
- /** Exact timestamp encoded with int64 since UNIX epoch (Default unit millisecond) */
56
- Timestamp = 10,
57
- /** YEAR_MONTH or DAY_TIME interval in SQL style */
58
- Interval = 11,
59
- /** A list of some logical data type */
60
- List = 12,
61
- /** Struct of logical types */
62
- Struct = 13,
63
- /** Union of logical types */
64
- Union = 14,
65
- /** Fixed-size binary. Each value occupies the same number of bytes */
66
- FixedSizeBinary = 15,
67
- /** Fixed-size list. Each value occupies the same number of bytes */
68
- FixedSizeList = 16,
69
- /** Map of named logical types */
70
- Map = 17,
71
-
72
- /** Dictionary aka Category type */
73
- Dictionary = -1,
74
- Int8 = -2,
75
- Int16 = -3,
76
- Int32 = -4,
77
- Int64 = -5,
78
- Uint8 = -6,
79
- Uint16 = -7,
80
- Uint32 = -8,
81
- Uint64 = -9,
82
- Float16 = -10,
83
- Float32 = -11,
84
- Float64 = -12,
85
- DateDay = -13,
86
- DateMillisecond = -14,
87
- TimestampSecond = -15,
88
- TimestampMillisecond = -16,
89
- TimestampMicrosecond = -17,
90
- TimestampNanosecond = -18,
91
- TimeSecond = -19,
92
- TimeMillisecond = -20,
93
- TimeMicrosecond = -21,
94
- TimeNanosecond = -22,
95
- DenseUnion = -23,
96
- SparseUnion = -24,
97
- IntervalDayTime = -25,
98
- IntervalYearMonth = -26
99
- }
@@ -1,38 +0,0 @@
1
- // loaders.gl
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
-
5
- import {Type} from './arrow-like-type';
6
-
7
- /**
8
- * Gets type information from an Arrow type object or "mock" Arrow type object
9
- * @param arrowTypeLike Arrow Type or type object of similar shape
10
- */
11
- export function getTypeInfo(arrowTypeLike: any): {
12
- typeId: Type;
13
- ArrayType: ArrayLike<unknown>;
14
- typeName: string;
15
- typeEnumName?: string;
16
- precision?: number;
17
- } {
18
- return {
19
- typeId: arrowTypeLike.typeId,
20
- ArrayType: arrowTypeLike.ArrayType,
21
- typeName: arrowTypeLike.toString(),
22
- typeEnumName: getTypeKey(arrowTypeLike.typeId),
23
- precision: arrowTypeLike.precision
24
- };
25
- }
26
-
27
- let ReverseType: {[key: string]: string} | null = null;
28
-
29
- function getTypeKey(typeKey) {
30
- if (!ReverseType) {
31
- ReverseType = {};
32
- for (const key in Type) {
33
- ReverseType[Type[key]] = key;
34
- }
35
- }
36
-
37
- return ReverseType[typeKey];
38
- }
@@ -1,8 +0,0 @@
1
- // loaders.gl
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
-
5
- export {ArrowLikeField as Field} from './arrow-like-field';
6
- export {ArrowLikeSchema as Schema} from './arrow-like-schema';
7
- export {ArrowLikeTable as Table} from './arrow-like-table';
8
- export * from './arrow-like-type';