@loaders.gl/schema 3.1.0-alpha.5 → 3.1.0-beta.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 (148) hide show
  1. package/dist/bundle.d.ts +1 -0
  2. package/dist/bundle.d.ts.map +1 -0
  3. package/dist/bundle.js +16159 -0
  4. package/dist/category/common.d.ts +1 -0
  5. package/dist/category/common.d.ts.map +1 -0
  6. package/dist/category/common.js +10 -0
  7. package/dist/category/gis.d.ts +1 -1
  8. package/dist/category/gis.d.ts.map +1 -0
  9. package/dist/category/gis.js +2 -0
  10. package/dist/category/mesh/convert-mesh.d.ts +1 -0
  11. package/dist/category/mesh/convert-mesh.d.ts.map +1 -0
  12. package/dist/category/mesh/convert-mesh.js +40 -0
  13. package/dist/category/mesh/deduce-mesh-schema.d.ts +2 -1
  14. package/dist/category/mesh/deduce-mesh-schema.d.ts.map +1 -0
  15. package/dist/category/mesh/deduce-mesh-schema.js +62 -0
  16. package/dist/category/mesh/mesh-to-arrow-table.d.ts +1 -0
  17. package/dist/category/mesh/mesh-to-arrow-table.d.ts.map +1 -0
  18. package/dist/category/mesh/mesh-to-arrow-table.js +34 -0
  19. package/dist/category/mesh/mesh-types.d.ts +2 -1
  20. package/dist/category/mesh/mesh-types.d.ts.map +1 -0
  21. package/dist/category/mesh/mesh-types.js +2 -0
  22. package/dist/category/mesh/mesh-utils.d.ts +1 -0
  23. package/dist/category/mesh/mesh-utils.d.ts.map +1 -0
  24. package/dist/category/mesh/mesh-utils.js +51 -0
  25. package/dist/category/table/deduce-table-schema.d.ts +2 -1
  26. package/dist/category/table/deduce-table-schema.d.ts.map +1 -0
  27. package/dist/category/table/deduce-table-schema.js +106 -0
  28. package/dist/category/table/table-types.d.ts +2 -1
  29. package/dist/category/table/table-types.d.ts.map +1 -0
  30. package/dist/category/table/table-types.js +2 -0
  31. package/dist/es5/category/mesh/deduce-mesh-schema.js +1 -1
  32. package/dist/es5/category/mesh/deduce-mesh-schema.js.map +1 -1
  33. package/dist/es5/category/table/deduce-table-schema.js.map +1 -1
  34. package/dist/es5/index.js +1 -1
  35. package/dist/es5/index.js.map +1 -1
  36. package/dist/es5/lib/arrow/arrow-like-type-utils.js +1 -1
  37. package/dist/es5/lib/arrow/arrow-like-type-utils.js.map +1 -1
  38. package/dist/es5/lib/arrow/get-type-info.js +1 -1
  39. package/dist/es5/lib/arrow/get-type-info.js.map +1 -1
  40. package/dist/es5/lib/batches/base-table-batch-aggregator.js.map +1 -1
  41. package/dist/es5/lib/batches/columnar-table-batch-aggregator.js.map +1 -1
  42. package/dist/es5/lib/batches/row-table-batch-aggregator.js.map +1 -1
  43. package/dist/es5/lib/batches/table-batch-builder.js.map +1 -1
  44. package/dist/es5/lib/schema/impl/schema.js.map +1 -1
  45. package/dist/es5/lib/schema/impl/type.js.map +1 -1
  46. package/dist/es5/lib/schema/{index.js → schema.js} +1 -1
  47. package/dist/es5/lib/schema/schema.js.map +1 -0
  48. package/dist/es5/lib/schema-utils/deduce-column-type.js.map +1 -1
  49. package/dist/es5/lib/utils/async-queue.js.map +1 -1
  50. package/dist/esm/category/mesh/deduce-mesh-schema.js +1 -1
  51. package/dist/esm/category/mesh/deduce-mesh-schema.js.map +1 -1
  52. package/dist/esm/category/table/deduce-table-schema.js.map +1 -1
  53. package/dist/esm/index.js +1 -1
  54. package/dist/esm/index.js.map +1 -1
  55. package/dist/esm/lib/arrow/arrow-like-type-utils.js +1 -1
  56. package/dist/esm/lib/arrow/arrow-like-type-utils.js.map +1 -1
  57. package/dist/esm/lib/arrow/get-type-info.js +1 -1
  58. package/dist/esm/lib/arrow/get-type-info.js.map +1 -1
  59. package/dist/esm/lib/batches/base-table-batch-aggregator.js.map +1 -1
  60. package/dist/esm/lib/batches/columnar-table-batch-aggregator.js.map +1 -1
  61. package/dist/esm/lib/batches/row-table-batch-aggregator.js.map +1 -1
  62. package/dist/esm/lib/batches/table-batch-builder.js.map +1 -1
  63. package/dist/esm/lib/schema/impl/schema.js.map +1 -1
  64. package/dist/esm/lib/schema/impl/type.js.map +1 -1
  65. package/dist/esm/lib/schema/{index.js → schema.js} +1 -1
  66. package/dist/esm/lib/schema/schema.js.map +1 -0
  67. package/dist/esm/lib/schema-utils/deduce-column-type.js.map +1 -1
  68. package/dist/esm/lib/utils/async-queue.js.map +1 -1
  69. package/dist/index.d.ts +2 -1
  70. package/dist/index.d.ts.map +1 -0
  71. package/dist/index.js +75 -0
  72. package/dist/lib/arrow/arrow-like-type-utils.d.ts +2 -1
  73. package/dist/lib/arrow/arrow-like-type-utils.d.ts.map +1 -0
  74. package/dist/lib/arrow/arrow-like-type-utils.js +27 -0
  75. package/dist/lib/arrow/arrow-type-utils.d.ts +1 -0
  76. package/dist/lib/arrow/arrow-type-utils.d.ts.map +1 -0
  77. package/dist/lib/arrow/arrow-type-utils.js +50 -0
  78. package/dist/lib/arrow/get-type-info.d.ts +2 -1
  79. package/dist/lib/arrow/get-type-info.d.ts.map +1 -0
  80. package/dist/lib/arrow/get-type-info.js +28 -0
  81. package/dist/lib/batches/base-table-batch-aggregator.d.ts +2 -1
  82. package/dist/lib/batches/base-table-batch-aggregator.d.ts.map +1 -0
  83. package/dist/lib/batches/base-table-batch-aggregator.js +58 -0
  84. package/dist/lib/batches/columnar-table-batch-aggregator.d.ts +2 -1
  85. package/dist/lib/batches/columnar-table-batch-aggregator.d.ts.map +1 -0
  86. package/dist/lib/batches/columnar-table-batch-aggregator.js +90 -0
  87. package/dist/lib/batches/row-table-batch-aggregator.d.ts +2 -1
  88. package/dist/lib/batches/row-table-batch-aggregator.d.ts.map +1 -0
  89. package/dist/lib/batches/row-table-batch-aggregator.js +79 -0
  90. package/dist/lib/batches/table-batch-aggregator.d.ts +2 -1
  91. package/dist/lib/batches/table-batch-aggregator.d.ts.map +1 -0
  92. package/dist/lib/batches/table-batch-aggregator.js +2 -0
  93. package/dist/lib/batches/table-batch-builder.d.ts +3 -2
  94. package/dist/lib/batches/table-batch-builder.d.ts.map +1 -0
  95. package/dist/lib/batches/table-batch-builder.js +153 -0
  96. package/dist/lib/schema/impl/enum.d.ts +1 -0
  97. package/dist/lib/schema/impl/enum.d.ts.map +1 -0
  98. package/dist/lib/schema/impl/enum.js +97 -0
  99. package/dist/lib/schema/impl/field.d.ts +1 -0
  100. package/dist/lib/schema/impl/field.d.ts.map +1 -0
  101. package/dist/lib/schema/impl/field.js +32 -0
  102. package/dist/lib/schema/impl/schema.d.ts +1 -0
  103. package/dist/lib/schema/impl/schema.d.ts.map +1 -0
  104. package/dist/lib/schema/impl/schema.js +83 -0
  105. package/dist/lib/schema/impl/type.d.ts +3 -2
  106. package/dist/lib/schema/impl/type.d.ts.map +1 -0
  107. package/dist/lib/schema/impl/type.js +462 -0
  108. package/dist/lib/schema/{index.d.ts → schema.d.ts} +1 -0
  109. package/dist/lib/schema/schema.d.ts.map +1 -0
  110. package/dist/lib/schema/schema.js +90 -0
  111. package/dist/lib/schema-utils/deduce-column-type.d.ts +3 -2
  112. package/dist/lib/schema-utils/deduce-column-type.d.ts.map +1 -0
  113. package/dist/lib/schema-utils/deduce-column-type.js +92 -0
  114. package/dist/lib/utils/assert.d.ts +1 -0
  115. package/dist/lib/utils/assert.d.ts.map +1 -0
  116. package/dist/lib/utils/assert.js +12 -0
  117. package/dist/lib/utils/async-queue.d.ts +1 -0
  118. package/dist/lib/utils/async-queue.d.ts.map +1 -0
  119. package/dist/lib/utils/async-queue.js +92 -0
  120. package/dist/lib/utils/row-utils.d.ts +1 -0
  121. package/dist/lib/utils/row-utils.d.ts.map +1 -0
  122. package/dist/lib/utils/row-utils.js +33 -0
  123. package/dist/types.d.ts +1 -0
  124. package/dist/types.d.ts.map +1 -0
  125. package/dist/types.js +2 -0
  126. package/package.json +3 -4
  127. package/src/category/gis.ts +0 -1
  128. package/src/category/mesh/deduce-mesh-schema.ts +1 -1
  129. package/src/category/mesh/mesh-types.ts +1 -1
  130. package/src/category/table/deduce-table-schema.ts +1 -1
  131. package/src/category/table/table-types.ts +1 -1
  132. package/src/index.ts +1 -1
  133. package/src/lib/arrow/arrow-like-type-utils.ts +11 -1
  134. package/src/lib/arrow/get-type-info.ts +1 -1
  135. package/src/lib/batches/base-table-batch-aggregator.ts +1 -1
  136. package/src/lib/batches/columnar-table-batch-aggregator.ts +1 -1
  137. package/src/lib/batches/row-table-batch-aggregator.ts +1 -1
  138. package/src/lib/batches/table-batch-aggregator.ts +1 -1
  139. package/src/lib/batches/table-batch-builder.ts +2 -2
  140. package/src/lib/schema/impl/schema.ts +2 -2
  141. package/src/lib/schema/impl/type.ts +2 -2
  142. package/src/lib/schema/{index.ts → schema.ts} +0 -0
  143. package/src/lib/schema-utils/deduce-column-type.ts +6 -2
  144. package/src/lib/utils/async-queue.ts +7 -4
  145. package/dist/dist.min.js +0 -2
  146. package/dist/dist.min.js.map +0 -1
  147. package/dist/es5/lib/schema/index.js.map +0 -1
  148. package/dist/esm/lib/schema/index.js.map +0 -1
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ // From https://github.com/rauschma/async-iter-demo/tree/master/src under MIT license
3
+ // http://2ality.com/2016/10/asynchronous-iteration.html
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.takeAsync = void 0;
6
+ class ArrayQueue extends Array {
7
+ enqueue(value) {
8
+ // Add at the end
9
+ return this.push(value);
10
+ }
11
+ dequeue() {
12
+ // Remove first element
13
+ return this.shift();
14
+ }
15
+ }
16
+ class AsyncQueue {
17
+ constructor() {
18
+ // enqueues > dequeues
19
+ this._values = new ArrayQueue();
20
+ // dequeues > enqueues
21
+ this._settlers = new ArrayQueue();
22
+ this._closed = false;
23
+ }
24
+ close() {
25
+ while (this._settlers.length > 0) {
26
+ this._settlers.dequeue().resolve({ done: true });
27
+ }
28
+ this._closed = true;
29
+ }
30
+ [Symbol.asyncIterator]() {
31
+ return this;
32
+ }
33
+ enqueue(value) {
34
+ if (this._closed) {
35
+ throw new Error('Closed');
36
+ }
37
+ if (this._settlers.length > 0) {
38
+ if (this._values.length > 0) {
39
+ throw new Error('Illegal internal state');
40
+ }
41
+ const settler = this._settlers.dequeue();
42
+ if (value instanceof Error) {
43
+ settler.reject(value);
44
+ }
45
+ else {
46
+ settler.resolve({ value });
47
+ }
48
+ }
49
+ else {
50
+ this._values.enqueue(value);
51
+ }
52
+ }
53
+ /**
54
+ * @returns a Promise for an IteratorResult
55
+ */
56
+ next() {
57
+ if (this._values.length > 0) {
58
+ const value = this._values.dequeue();
59
+ if (value instanceof Error) {
60
+ return Promise.reject(value);
61
+ }
62
+ return Promise.resolve({ value });
63
+ }
64
+ if (this._closed) {
65
+ if (this._settlers.length > 0) {
66
+ throw new Error('Illegal internal state');
67
+ }
68
+ return Promise.resolve({ done: true });
69
+ }
70
+ // Wait for new values to be enqueued
71
+ return new Promise((resolve, reject) => {
72
+ this._settlers.enqueue({ resolve, reject });
73
+ });
74
+ }
75
+ }
76
+ exports.default = AsyncQueue;
77
+ /**
78
+ * @returns a Promise for an Array with the elements in `asyncIterable`
79
+ */
80
+ async function takeAsync(asyncIterable, count = Infinity) {
81
+ const result = [];
82
+ const iterator = asyncIterable[Symbol.asyncIterator]();
83
+ while (result.length < count) {
84
+ const { value, done } = await iterator.next();
85
+ if (done) {
86
+ break;
87
+ }
88
+ result.push(value);
89
+ }
90
+ return result;
91
+ }
92
+ exports.takeAsync = takeAsync;
@@ -6,3 +6,4 @@ export declare function convertToObjectRow(arrayRow: any[], headers: string[]):
6
6
  export declare function convertToArrayRow(objectRow: {
7
7
  [columnName: string]: any;
8
8
  }, headers: string[]): any[];
9
+ //# sourceMappingURL=row-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"row-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/row-utils.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,GAAG,EAAE,EACf,OAAO,EAAE,MAAM,EAAE,GAChB;IAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,CAY7B;AAED,4CAA4C;AAC5C,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE;IAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,EACtC,OAAO,EAAE,MAAM,EAAE,GAChB,GAAG,EAAE,CAYP"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertToArrayRow = exports.convertToObjectRow = void 0;
4
+ /** Convert an object row to an array row */
5
+ function convertToObjectRow(arrayRow, headers) {
6
+ if (!arrayRow) {
7
+ throw new Error('null row');
8
+ }
9
+ if (!headers) {
10
+ throw new Error('no headers');
11
+ }
12
+ const objectRow = {};
13
+ for (let i = 0; i < headers.length; i++) {
14
+ objectRow[headers[i]] = arrayRow[i];
15
+ }
16
+ return objectRow;
17
+ }
18
+ exports.convertToObjectRow = convertToObjectRow;
19
+ /** Convert an object row to an array row */
20
+ function convertToArrayRow(objectRow, headers) {
21
+ if (!objectRow) {
22
+ throw new Error('null row');
23
+ }
24
+ if (!headers) {
25
+ throw new Error('no headers');
26
+ }
27
+ const arrayRow = new Array(headers.length);
28
+ for (let i = 0; i < headers.length; i++) {
29
+ arrayRow[i] = objectRow[headers[i]];
30
+ }
31
+ return arrayRow;
32
+ }
33
+ exports.convertToArrayRow = convertToArrayRow;
package/dist/types.d.ts CHANGED
@@ -5,3 +5,4 @@ export declare type BigTypedArray = TypedArray | BigInt64Array | BigUint64Array;
5
5
  export declare type NumberArray = number[] | TypedArray;
6
6
  /** Any array: typed array or js array (`any[]`) */
7
7
  export declare type AnyArray = any[] | TypedArray;
8
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,oBAAY,UAAU,GAClB,SAAS,GACT,UAAU,GACV,UAAU,GACV,WAAW,GACX,UAAU,GACV,WAAW,GACX,iBAAiB,GACjB,YAAY,GACZ,YAAY,CAAC;AAEjB,oBAAY,aAAa,GAAG,UAAU,GAAG,aAAa,GAAG,cAAc,CAAC;AAExE,mDAAmD;AACnD,oBAAY,WAAW,GAAG,MAAM,EAAE,GAAG,UAAU,CAAC;AAEhD,mDAAmD;AACnD,oBAAY,QAAQ,GAAG,GAAG,EAAE,GAAG,UAAU,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/schema",
3
- "version": "3.1.0-alpha.5",
3
+ "version": "3.1.0-beta.1",
4
4
  "description": "Table format APIs for JSON, CSV, etc...",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -29,12 +29,11 @@
29
29
  ],
30
30
  "scripts": {
31
31
  "pre-build": "npm run build-bundle",
32
- "post-build": "tsc",
33
- "build-bundle": "webpack --display=minimal --config ../../scripts/webpack/bundle.js"
32
+ "build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/bundle.js"
34
33
  },
35
34
  "dependencies": {
36
35
  "@types/geojson": "^7946.0.7",
37
36
  "apache-arrow": "^4.0.0"
38
37
  },
39
- "gitHead": "352241dd910a8c6307a235dadbe154ca915b885b"
38
+ "gitHead": "980cdefb4e8ec9ef9c951d20c78cf77777707f49"
40
39
  }
@@ -55,7 +55,6 @@ export type BinaryPolygonFeatures = BinaryPolygonGeometry & BinaryProperties;
55
55
  * Represent a collection of Features, similar to a GeoJSON FeatureCollection
56
56
  */
57
57
  export type BinaryFeatures = {
58
- type?: BinaryGeometryType;
59
58
  points?: BinaryPointFeatures;
60
59
  lines?: BinaryLineFeatures;
61
60
  polygons?: BinaryPolygonFeatures;
@@ -1,5 +1,5 @@
1
1
  import {MeshAttribute, MeshAttributes} from './mesh-types';
2
- import {Schema, Field, FixedSizeList} from '../../lib/schema';
2
+ import {Schema, Field, FixedSizeList} from '../../lib/schema/schema';
3
3
  import {getArrowTypeFromTypedArray} from '../../lib/arrow/arrow-like-type-utils';
4
4
 
5
5
  /**
@@ -1,4 +1,4 @@
1
- import type {Schema} from '../../lib/schema';
1
+ import type {Schema} from '../../lib/schema/schema';
2
2
  import type {TypedArray} from '../../types';
3
3
  import type {ColumnarTable, ArrowTable} from '../table/table-types';
4
4
 
@@ -14,7 +14,7 @@ import {
14
14
  // Utf8,
15
15
  // TimestampMillisecond,
16
16
  // Null
17
- } from '../../lib/schema';
17
+ } from '../../lib/schema/schema';
18
18
 
19
19
  // const TYPED_ARRAY_TO_TYPE = {
20
20
  // Int8Array: new Int8(),
@@ -1,4 +1,4 @@
1
- import type {Schema} from '../../lib/schema';
1
+ import type {Schema} from '../../lib/schema/schema';
2
2
  import type {Table as ApacheArrowTable, RecordBatch} from 'apache-arrow/Arrow.dom';
3
3
  import type {AnyArray} from '../../types';
4
4
  import type {Batch} from '../common';
package/src/index.ts CHANGED
@@ -112,7 +112,7 @@ export {
112
112
  IntervalYearMonth,
113
113
  FixedSizeList,
114
114
  Struct
115
- } from './lib/schema';
115
+ } from './lib/schema/schema';
116
116
 
117
117
  // EXPERIMENTAL APIs
118
118
 
@@ -1,5 +1,15 @@
1
1
  import type {TypedArray} from '../../types';
2
- import {DataType, Float32, Float64, Int16, Int32, Int8, Uint16, Uint32, Uint8} from '../schema';
2
+ import {
3
+ DataType,
4
+ Float32,
5
+ Float64,
6
+ Int16,
7
+ Int32,
8
+ Int8,
9
+ Uint16,
10
+ Uint32,
11
+ Uint8
12
+ } from '../schema/schema';
3
13
 
4
14
  export function getArrowTypeFromTypedArray(array: TypedArray): DataType {
5
15
  switch (array.constructor) {
@@ -1,4 +1,4 @@
1
- import {Type} from '../schema';
1
+ import {Type} from '../schema/schema';
2
2
  import {AnyArray} from '../../types';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type {Schema} from '../schema';
1
+ import type {Schema} from '../schema/schema';
2
2
  import type {TableBatch} from '../../category/table/table-types';
3
3
  import {TableBatchAggregator, TableBatchOptions} from './table-batch-aggregator';
4
4
 
@@ -1,4 +1,4 @@
1
- import type {Schema} from '../schema';
1
+ import type {Schema} from '../schema/schema';
2
2
  import type {ColumnarTableBatch, ArrowTableBatch} from '../../category/table/table-types';
3
3
  import {TableBatchAggregator} from './table-batch-aggregator';
4
4
 
@@ -1,4 +1,4 @@
1
- import type {Schema} from '../schema';
1
+ import type {Schema} from '../schema/schema';
2
2
  import type {TableBatch} from '../../category/table/table-types';
3
3
  // import type {ArrayRowTableBatch, ObjectRowTableBatch} from '../../category/table';
4
4
  import {convertToArrayRow, convertToObjectRow} from '../utils/row-utils';
@@ -1,4 +1,4 @@
1
- import type {Schema} from '../schema';
1
+ import type {Schema} from '../schema/schema';
2
2
  import type {TableBatch} from '../../category/table/table-types';
3
3
 
4
4
  export interface TableBatchOptions {
@@ -1,4 +1,4 @@
1
- import type {Schema} from '../schema';
1
+ import type {Schema} from '../schema/schema';
2
2
  import type {TableBatch} from '../../category/table/table-types';
3
3
  import type {TableBatchAggregator, TableBatchConstructor} from './table-batch-aggregator';
4
4
  import BaseTableBatchAggregator from './base-table-batch-aggregator';
@@ -114,7 +114,7 @@ export default class TableBatchBuilder {
114
114
 
115
115
  // INTERNAL
116
116
 
117
- _estimateRowMB(row) {
117
+ _estimateRowMB(row: any[] | object): number {
118
118
  return Array.isArray(row) ? row.length * 8 : Object.keys(row).length * 8;
119
119
  }
120
120
 
@@ -82,8 +82,8 @@ export default class Schema {
82
82
  }
83
83
 
84
84
  // Warn if any duplicated field names
85
- function checkNames(fields) {
86
- const usedNames = {};
85
+ function checkNames(fields: Field[]): void {
86
+ const usedNames: Record<string, boolean> = {};
87
87
  for (const field of fields) {
88
88
  if (usedNames[field.name]) {
89
89
  // eslint-disable-next-line
@@ -333,10 +333,10 @@ const TimeUnit = {
333
333
  };
334
334
 
335
335
  export class Time extends DataType {
336
- readonly unit: number;
336
+ readonly unit: any;
337
337
  readonly bitWidth: number;
338
338
 
339
- constructor(unit, bitWidth) {
339
+ constructor(unit: any, bitWidth: number) {
340
340
  super();
341
341
  this.unit = unit;
342
342
  this.bitWidth = bitWidth;
File without changes
@@ -33,7 +33,9 @@
33
33
  // TYPED_ARRAY_TO_TYPE.BigUint64Array = new Uint64();
34
34
  // }
35
35
 
36
- export function deduceTypeFromColumn(value) {
36
+ export function deduceTypeFromColumn(
37
+ value: unknown
38
+ ): StringConstructor | DateConstructor | Float32ArrayConstructor | null {
37
39
  if (value instanceof Date) {
38
40
  return Date;
39
41
  } else if (value instanceof Number) {
@@ -44,7 +46,9 @@ export function deduceTypeFromColumn(value) {
44
46
  return null;
45
47
  }
46
48
 
47
- export function deduceTypeFromValue(value) {
49
+ export function deduceTypeFromValue(
50
+ value: unknown
51
+ ): StringConstructor | DateConstructor | Float32ArrayConstructor | null {
48
52
  if (value instanceof Date) {
49
53
  return Date;
50
54
  } else if (value instanceof Number) {
@@ -2,7 +2,7 @@
2
2
  // http://2ality.com/2016/10/asynchronous-iteration.html
3
3
 
4
4
  class ArrayQueue<T> extends Array<T> {
5
- enqueue(value) {
5
+ enqueue(value: T) {
6
6
  // Add at the end
7
7
  return this.push(value);
8
8
  }
@@ -13,15 +13,18 @@ class ArrayQueue<T> extends Array<T> {
13
13
  }
14
14
 
15
15
  export default class AsyncQueue<T> {
16
- private _values: ArrayQueue<T>;
17
- private _settlers: ArrayQueue<{resolve; reject}>;
16
+ private _values: ArrayQueue<T | Error>;
17
+ private _settlers: ArrayQueue<{resolve: (value: any) => void; reject: (reason?: any) => void}>;
18
18
  private _closed: boolean;
19
19
 
20
20
  constructor() {
21
21
  // enqueues > dequeues
22
22
  this._values = new ArrayQueue<T>();
23
23
  // dequeues > enqueues
24
- this._settlers = new ArrayQueue<{resolve; reject}>();
24
+ this._settlers = new ArrayQueue<{
25
+ resolve: (value: any) => void;
26
+ reject: (reason?: any) => void;
27
+ }>();
25
28
  this._closed = false;
26
29
  }
27
30