@loaders.gl/schema 3.4.13 → 3.4.15

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 (36) hide show
  1. package/dist/es5/bundle.js +1 -1
  2. package/dist/es5/bundle.js.map +1 -1
  3. package/dist/es5/category/mesh/convert-mesh.js +2 -7
  4. package/dist/es5/category/mesh/convert-mesh.js.map +1 -1
  5. package/dist/es5/category/mesh/deduce-mesh-schema.js +8 -8
  6. package/dist/es5/category/mesh/deduce-mesh-schema.js.map +1 -1
  7. package/dist/es5/category/mesh/mesh-to-arrow-table.js +17 -16
  8. package/dist/es5/category/mesh/mesh-to-arrow-table.js.map +1 -1
  9. package/dist/es5/category/mesh/mesh-utils.js +15 -15
  10. package/dist/es5/category/mesh/mesh-utils.js.map +1 -1
  11. package/dist/es5/category/table/deduce-table-schema.js +9 -9
  12. package/dist/es5/category/table/deduce-table-schema.js.map +1 -1
  13. package/dist/es5/index.js +51 -51
  14. package/dist/es5/lib/arrow/get-type-info.js +3 -3
  15. package/dist/es5/lib/arrow/get-type-info.js.map +1 -1
  16. package/dist/es5/lib/batches/base-table-batch-aggregator.js +38 -51
  17. package/dist/es5/lib/batches/base-table-batch-aggregator.js.map +1 -1
  18. package/dist/es5/lib/batches/columnar-table-batch-aggregator.js +60 -81
  19. package/dist/es5/lib/batches/columnar-table-batch-aggregator.js.map +1 -1
  20. package/dist/es5/lib/batches/row-table-batch-aggregator.js +53 -66
  21. package/dist/es5/lib/batches/row-table-batch-aggregator.js.map +1 -1
  22. package/dist/es5/lib/batches/table-batch-builder.js +101 -127
  23. package/dist/es5/lib/batches/table-batch-builder.js.map +1 -1
  24. package/dist/es5/lib/schema/impl/enum.js +1 -1
  25. package/dist/es5/lib/schema/impl/field.js +17 -30
  26. package/dist/es5/lib/schema/impl/field.js.map +1 -1
  27. package/dist/es5/lib/schema/impl/schema.js +55 -105
  28. package/dist/es5/lib/schema/impl/schema.js.map +1 -1
  29. package/dist/es5/lib/schema/impl/type.js +375 -675
  30. package/dist/es5/lib/schema/impl/type.js.map +1 -1
  31. package/dist/es5/lib/schema/schema.js +37 -37
  32. package/dist/es5/lib/utils/async-queue.js +72 -138
  33. package/dist/es5/lib/utils/async-queue.js.map +1 -1
  34. package/dist/es5/lib/utils/row-utils.js +4 -4
  35. package/dist/es5/lib/utils/row-utils.js.map +1 -1
  36. package/package.json +2 -2
package/dist/es5/index.js CHANGED
@@ -6,307 +6,307 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  Object.defineProperty(exports, "AsyncQueue", {
8
8
  enumerable: true,
9
- get: function get() {
9
+ get: function () {
10
10
  return _asyncQueue.default;
11
11
  }
12
12
  });
13
13
  Object.defineProperty(exports, "Binary", {
14
14
  enumerable: true,
15
- get: function get() {
15
+ get: function () {
16
16
  return _schema.Binary;
17
17
  }
18
18
  });
19
19
  Object.defineProperty(exports, "Bool", {
20
20
  enumerable: true,
21
- get: function get() {
21
+ get: function () {
22
22
  return _schema.Bool;
23
23
  }
24
24
  });
25
25
  Object.defineProperty(exports, "ColumnarTableBatchAggregator", {
26
26
  enumerable: true,
27
- get: function get() {
27
+ get: function () {
28
28
  return _columnarTableBatchAggregator.default;
29
29
  }
30
30
  });
31
31
  Object.defineProperty(exports, "DataType", {
32
32
  enumerable: true,
33
- get: function get() {
33
+ get: function () {
34
34
  return _schema.DataType;
35
35
  }
36
36
  });
37
37
  Object.defineProperty(exports, "Date", {
38
38
  enumerable: true,
39
- get: function get() {
39
+ get: function () {
40
40
  return _schema.Date;
41
41
  }
42
42
  });
43
43
  Object.defineProperty(exports, "DateDay", {
44
44
  enumerable: true,
45
- get: function get() {
45
+ get: function () {
46
46
  return _schema.DateDay;
47
47
  }
48
48
  });
49
49
  Object.defineProperty(exports, "DateMillisecond", {
50
50
  enumerable: true,
51
- get: function get() {
51
+ get: function () {
52
52
  return _schema.DateMillisecond;
53
53
  }
54
54
  });
55
55
  Object.defineProperty(exports, "Field", {
56
56
  enumerable: true,
57
- get: function get() {
57
+ get: function () {
58
58
  return _schema.Field;
59
59
  }
60
60
  });
61
61
  Object.defineProperty(exports, "FixedSizeList", {
62
62
  enumerable: true,
63
- get: function get() {
63
+ get: function () {
64
64
  return _schema.FixedSizeList;
65
65
  }
66
66
  });
67
67
  Object.defineProperty(exports, "Float", {
68
68
  enumerable: true,
69
- get: function get() {
69
+ get: function () {
70
70
  return _schema.Float;
71
71
  }
72
72
  });
73
73
  Object.defineProperty(exports, "Float16", {
74
74
  enumerable: true,
75
- get: function get() {
75
+ get: function () {
76
76
  return _schema.Float16;
77
77
  }
78
78
  });
79
79
  Object.defineProperty(exports, "Float32", {
80
80
  enumerable: true,
81
- get: function get() {
81
+ get: function () {
82
82
  return _schema.Float32;
83
83
  }
84
84
  });
85
85
  Object.defineProperty(exports, "Float64", {
86
86
  enumerable: true,
87
- get: function get() {
87
+ get: function () {
88
88
  return _schema.Float64;
89
89
  }
90
90
  });
91
91
  Object.defineProperty(exports, "Int", {
92
92
  enumerable: true,
93
- get: function get() {
93
+ get: function () {
94
94
  return _schema.Int;
95
95
  }
96
96
  });
97
97
  Object.defineProperty(exports, "Int16", {
98
98
  enumerable: true,
99
- get: function get() {
99
+ get: function () {
100
100
  return _schema.Int16;
101
101
  }
102
102
  });
103
103
  Object.defineProperty(exports, "Int32", {
104
104
  enumerable: true,
105
- get: function get() {
105
+ get: function () {
106
106
  return _schema.Int32;
107
107
  }
108
108
  });
109
109
  Object.defineProperty(exports, "Int64", {
110
110
  enumerable: true,
111
- get: function get() {
111
+ get: function () {
112
112
  return _schema.Int64;
113
113
  }
114
114
  });
115
115
  Object.defineProperty(exports, "Int8", {
116
116
  enumerable: true,
117
- get: function get() {
117
+ get: function () {
118
118
  return _schema.Int8;
119
119
  }
120
120
  });
121
121
  Object.defineProperty(exports, "Interval", {
122
122
  enumerable: true,
123
- get: function get() {
123
+ get: function () {
124
124
  return _schema.Interval;
125
125
  }
126
126
  });
127
127
  Object.defineProperty(exports, "IntervalDayTime", {
128
128
  enumerable: true,
129
- get: function get() {
129
+ get: function () {
130
130
  return _schema.IntervalDayTime;
131
131
  }
132
132
  });
133
133
  Object.defineProperty(exports, "IntervalYearMonth", {
134
134
  enumerable: true,
135
- get: function get() {
135
+ get: function () {
136
136
  return _schema.IntervalYearMonth;
137
137
  }
138
138
  });
139
139
  Object.defineProperty(exports, "Null", {
140
140
  enumerable: true,
141
- get: function get() {
141
+ get: function () {
142
142
  return _schema.Null;
143
143
  }
144
144
  });
145
145
  Object.defineProperty(exports, "RowTableBatchAggregator", {
146
146
  enumerable: true,
147
- get: function get() {
147
+ get: function () {
148
148
  return _rowTableBatchAggregator.default;
149
149
  }
150
150
  });
151
151
  Object.defineProperty(exports, "Schema", {
152
152
  enumerable: true,
153
- get: function get() {
153
+ get: function () {
154
154
  return _schema.Schema;
155
155
  }
156
156
  });
157
157
  Object.defineProperty(exports, "Struct", {
158
158
  enumerable: true,
159
- get: function get() {
159
+ get: function () {
160
160
  return _schema.Struct;
161
161
  }
162
162
  });
163
163
  Object.defineProperty(exports, "TableBatchBuilder", {
164
164
  enumerable: true,
165
- get: function get() {
165
+ get: function () {
166
166
  return _tableBatchBuilder.default;
167
167
  }
168
168
  });
169
169
  Object.defineProperty(exports, "Time", {
170
170
  enumerable: true,
171
- get: function get() {
171
+ get: function () {
172
172
  return _schema.Time;
173
173
  }
174
174
  });
175
175
  Object.defineProperty(exports, "TimeMillisecond", {
176
176
  enumerable: true,
177
- get: function get() {
177
+ get: function () {
178
178
  return _schema.TimeMillisecond;
179
179
  }
180
180
  });
181
181
  Object.defineProperty(exports, "TimeSecond", {
182
182
  enumerable: true,
183
- get: function get() {
183
+ get: function () {
184
184
  return _schema.TimeSecond;
185
185
  }
186
186
  });
187
187
  Object.defineProperty(exports, "Timestamp", {
188
188
  enumerable: true,
189
- get: function get() {
189
+ get: function () {
190
190
  return _schema.Timestamp;
191
191
  }
192
192
  });
193
193
  Object.defineProperty(exports, "TimestampMicrosecond", {
194
194
  enumerable: true,
195
- get: function get() {
195
+ get: function () {
196
196
  return _schema.TimestampMicrosecond;
197
197
  }
198
198
  });
199
199
  Object.defineProperty(exports, "TimestampMillisecond", {
200
200
  enumerable: true,
201
- get: function get() {
201
+ get: function () {
202
202
  return _schema.TimestampMillisecond;
203
203
  }
204
204
  });
205
205
  Object.defineProperty(exports, "TimestampNanosecond", {
206
206
  enumerable: true,
207
- get: function get() {
207
+ get: function () {
208
208
  return _schema.TimestampNanosecond;
209
209
  }
210
210
  });
211
211
  Object.defineProperty(exports, "TimestampSecond", {
212
212
  enumerable: true,
213
- get: function get() {
213
+ get: function () {
214
214
  return _schema.TimestampSecond;
215
215
  }
216
216
  });
217
217
  Object.defineProperty(exports, "Uint16", {
218
218
  enumerable: true,
219
- get: function get() {
219
+ get: function () {
220
220
  return _schema.Uint16;
221
221
  }
222
222
  });
223
223
  Object.defineProperty(exports, "Uint32", {
224
224
  enumerable: true,
225
- get: function get() {
225
+ get: function () {
226
226
  return _schema.Uint32;
227
227
  }
228
228
  });
229
229
  Object.defineProperty(exports, "Uint64", {
230
230
  enumerable: true,
231
- get: function get() {
231
+ get: function () {
232
232
  return _schema.Uint64;
233
233
  }
234
234
  });
235
235
  Object.defineProperty(exports, "Uint8", {
236
236
  enumerable: true,
237
- get: function get() {
237
+ get: function () {
238
238
  return _schema.Uint8;
239
239
  }
240
240
  });
241
241
  Object.defineProperty(exports, "Utf8", {
242
242
  enumerable: true,
243
- get: function get() {
243
+ get: function () {
244
244
  return _schema.Utf8;
245
245
  }
246
246
  });
247
247
  Object.defineProperty(exports, "convertToArrayRow", {
248
248
  enumerable: true,
249
- get: function get() {
249
+ get: function () {
250
250
  return _rowUtils.convertToArrayRow;
251
251
  }
252
252
  });
253
253
  Object.defineProperty(exports, "convertToObjectRow", {
254
254
  enumerable: true,
255
- get: function get() {
255
+ get: function () {
256
256
  return _rowUtils.convertToObjectRow;
257
257
  }
258
258
  });
259
259
  Object.defineProperty(exports, "deduceMeshField", {
260
260
  enumerable: true,
261
- get: function get() {
261
+ get: function () {
262
262
  return _deduceMeshSchema.deduceMeshField;
263
263
  }
264
264
  });
265
265
  Object.defineProperty(exports, "deduceMeshSchema", {
266
266
  enumerable: true,
267
- get: function get() {
267
+ get: function () {
268
268
  return _deduceMeshSchema.deduceMeshSchema;
269
269
  }
270
270
  });
271
271
  Object.defineProperty(exports, "deduceTypeFromColumn", {
272
272
  enumerable: true,
273
- get: function get() {
273
+ get: function () {
274
274
  return _deduceColumnType.deduceTypeFromColumn;
275
275
  }
276
276
  });
277
277
  Object.defineProperty(exports, "deduceTypeFromValue", {
278
278
  enumerable: true,
279
- get: function get() {
279
+ get: function () {
280
280
  return _deduceColumnType.deduceTypeFromValue;
281
281
  }
282
282
  });
283
283
  Object.defineProperty(exports, "getArrowTypeFromTypedArray", {
284
284
  enumerable: true,
285
- get: function get() {
285
+ get: function () {
286
286
  return _arrowLikeTypeUtils.getArrowTypeFromTypedArray;
287
287
  }
288
288
  });
289
289
  Object.defineProperty(exports, "getMeshBoundingBox", {
290
290
  enumerable: true,
291
- get: function get() {
291
+ get: function () {
292
292
  return _meshUtils.getMeshBoundingBox;
293
293
  }
294
294
  });
295
295
  Object.defineProperty(exports, "getMeshSize", {
296
296
  enumerable: true,
297
- get: function get() {
297
+ get: function () {
298
298
  return _meshUtils.getMeshSize;
299
299
  }
300
300
  });
301
301
  Object.defineProperty(exports, "getTypeInfo", {
302
302
  enumerable: true,
303
- get: function get() {
303
+ get: function () {
304
304
  return _getTypeInfo.getTypeInfo;
305
305
  }
306
306
  });
307
307
  Object.defineProperty(exports, "makeMeshAttributeMetadata", {
308
308
  enumerable: true,
309
- get: function get() {
309
+ get: function () {
310
310
  return _deduceMeshSchema.makeMeshAttributeMetadata;
311
311
  }
312
312
  });
@@ -14,12 +14,12 @@ function getTypeInfo(arrowTypeLike) {
14
14
  precision: arrowTypeLike.precision
15
15
  };
16
16
  }
17
- var ReverseType = null;
17
+ let ReverseType = null;
18
18
  function getTypeKey(typeKey) {
19
19
  if (!ReverseType) {
20
20
  ReverseType = {};
21
- for (var _key in _schema.Type) {
22
- ReverseType[_schema.Type[_key]] = _key;
21
+ for (const key in _schema.Type) {
22
+ ReverseType[_schema.Type[key]] = key;
23
23
  }
24
24
  }
25
25
  return ReverseType[typeKey];
@@ -1 +1 @@
1
- {"version":3,"file":"get-type-info.js","names":["_schema","require","getTypeInfo","arrowTypeLike","typeId","ArrayType","typeName","toString","typeEnumName","getTypeKey","precision","ReverseType","typeKey","key","Type"],"sources":["../../../../src/lib/arrow/get-type-info.ts"],"sourcesContent":["import {Type} from '../schema/schema';\nimport {AnyArray} from '../../types';\n\n/**\n * Gets type information from an Arrow type object or \"mock\" Arrow type object\n * @param arrowTypeLike Arrow Type or type object of similar shape\n */\nexport function getTypeInfo(arrowTypeLike: any): {\n typeId: Type;\n ArrayType: AnyArray;\n typeName: string;\n typeEnumName?: string;\n precision?: number;\n} {\n return {\n typeId: arrowTypeLike.typeId,\n ArrayType: arrowTypeLike.ArrayType,\n typeName: arrowTypeLike.toString(),\n typeEnumName: getTypeKey(arrowTypeLike.typeId),\n precision: arrowTypeLike.precision\n };\n}\n\nlet ReverseType: {[key: string]: string} | null = null;\n\nfunction getTypeKey(typeKey) {\n if (!ReverseType) {\n ReverseType = {};\n for (const key in Type) {\n ReverseType[Type[key]] = key;\n }\n }\n\n return ReverseType[typeKey];\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAOO,SAASC,WAAWA,CAACC,aAAkB,EAM5C;EACA,OAAO;IACLC,MAAM,EAAED,aAAa,CAACC,MAAM;IAC5BC,SAAS,EAAEF,aAAa,CAACE,SAAS;IAClCC,QAAQ,EAAEH,aAAa,CAACI,QAAQ,CAAC,CAAC;IAClCC,YAAY,EAAEC,UAAU,CAACN,aAAa,CAACC,MAAM,CAAC;IAC9CM,SAAS,EAAEP,aAAa,CAACO;EAC3B,CAAC;AACH;AAEA,IAAIC,WAA2C,GAAG,IAAI;AAEtD,SAASF,UAAUA,CAACG,OAAO,EAAE;EAC3B,IAAI,CAACD,WAAW,EAAE;IAChBA,WAAW,GAAG,CAAC,CAAC;IAChB,KAAK,IAAME,IAAG,IAAIC,YAAI,EAAE;MACtBH,WAAW,CAACG,YAAI,CAACD,IAAG,CAAC,CAAC,GAAGA,IAAG;IAC9B;EACF;EAEA,OAAOF,WAAW,CAACC,OAAO,CAAC;AAC7B"}
1
+ {"version":3,"file":"get-type-info.js","names":["_schema","require","getTypeInfo","arrowTypeLike","typeId","ArrayType","typeName","toString","typeEnumName","getTypeKey","precision","ReverseType","typeKey","key","Type"],"sources":["../../../../src/lib/arrow/get-type-info.ts"],"sourcesContent":["import {Type} from '../schema/schema';\nimport {AnyArray} from '../../types';\n\n/**\n * Gets type information from an Arrow type object or \"mock\" Arrow type object\n * @param arrowTypeLike Arrow Type or type object of similar shape\n */\nexport function getTypeInfo(arrowTypeLike: any): {\n typeId: Type;\n ArrayType: AnyArray;\n typeName: string;\n typeEnumName?: string;\n precision?: number;\n} {\n return {\n typeId: arrowTypeLike.typeId,\n ArrayType: arrowTypeLike.ArrayType,\n typeName: arrowTypeLike.toString(),\n typeEnumName: getTypeKey(arrowTypeLike.typeId),\n precision: arrowTypeLike.precision\n };\n}\n\nlet ReverseType: {[key: string]: string} | null = null;\n\nfunction getTypeKey(typeKey) {\n if (!ReverseType) {\n ReverseType = {};\n for (const key in Type) {\n ReverseType[Type[key]] = key;\n }\n }\n\n return ReverseType[typeKey];\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAOO,SAASC,WAAWA,CAACC,aAAkB,EAM5C;EACA,OAAO;IACLC,MAAM,EAAED,aAAa,CAACC,MAAM;IAC5BC,SAAS,EAAEF,aAAa,CAACE,SAAS;IAClCC,QAAQ,EAAEH,aAAa,CAACI,QAAQ,CAAC,CAAC;IAClCC,YAAY,EAAEC,UAAU,CAACN,aAAa,CAACC,MAAM,CAAC;IAC9CM,SAAS,EAAEP,aAAa,CAACO;EAC3B,CAAC;AACH;AAEA,IAAIC,WAA2C,GAAG,IAAI;AAEtD,SAASF,UAAUA,CAACG,OAAO,EAAE;EAC3B,IAAI,CAACD,WAAW,EAAE;IAChBA,WAAW,GAAG,CAAC,CAAC;IAChB,KAAK,MAAME,GAAG,IAAIC,YAAI,EAAE;MACtBH,WAAW,CAACG,YAAI,CAACD,GAAG,CAAC,CAAC,GAAGA,GAAG;IAC9B;EACF;EAEA,OAAOF,WAAW,CAACC,OAAO,CAAC;AAC7B"}
@@ -5,13 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
- var DEFAULT_ROW_COUNT = 100;
12
- var RowTableBatchAggregator = function () {
13
- function RowTableBatchAggregator(schema, options) {
14
- (0, _classCallCheck2.default)(this, RowTableBatchAggregator);
9
+ const DEFAULT_ROW_COUNT = 100;
10
+ class RowTableBatchAggregator {
11
+ constructor(schema, options) {
15
12
  (0, _defineProperty2.default)(this, "schema", void 0);
16
13
  (0, _defineProperty2.default)(this, "options", void 0);
17
14
  (0, _defineProperty2.default)(this, "length", 0);
@@ -22,57 +19,47 @@ var RowTableBatchAggregator = function () {
22
19
  this.schema = schema;
23
20
  if (!Array.isArray(schema)) {
24
21
  this._headers = [];
25
- for (var key in schema) {
22
+ for (const key in schema) {
26
23
  this._headers[schema[key].index] = schema[key].name;
27
24
  }
28
25
  }
29
26
  }
30
- (0, _createClass2.default)(RowTableBatchAggregator, [{
31
- key: "rowCount",
32
- value: function rowCount() {
33
- return this.length;
34
- }
35
- }, {
36
- key: "addArrayRow",
37
- value: function addArrayRow(row, cursor) {
38
- if (Number.isFinite(cursor)) {
39
- this.cursor = cursor;
40
- }
41
- this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
42
- this.rows[this.length] = row;
43
- this.length++;
27
+ rowCount() {
28
+ return this.length;
29
+ }
30
+ addArrayRow(row, cursor) {
31
+ if (Number.isFinite(cursor)) {
32
+ this.cursor = cursor;
44
33
  }
45
- }, {
46
- key: "addObjectRow",
47
- value: function addObjectRow(row, cursor) {
48
- if (Number.isFinite(cursor)) {
49
- this.cursor = cursor;
50
- }
51
- this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
52
- this.rows[this.length] = row;
53
- this.length++;
34
+ this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
35
+ this.rows[this.length] = row;
36
+ this.length++;
37
+ }
38
+ addObjectRow(row, cursor) {
39
+ if (Number.isFinite(cursor)) {
40
+ this.cursor = cursor;
54
41
  }
55
- }, {
56
- key: "getBatch",
57
- value: function getBatch() {
58
- var rows = this.rows;
59
- if (!rows) {
60
- return null;
61
- }
62
- rows = rows.slice(0, this.length);
63
- this.rows = null;
64
- var batch = {
65
- shape: this.options.shape,
66
- batchType: 'data',
67
- data: rows,
68
- length: this.length,
69
- schema: this.schema,
70
- cursor: this.cursor
71
- };
72
- return batch;
42
+ this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
43
+ this.rows[this.length] = row;
44
+ this.length++;
45
+ }
46
+ getBatch() {
47
+ let rows = this.rows;
48
+ if (!rows) {
49
+ return null;
73
50
  }
74
- }]);
75
- return RowTableBatchAggregator;
76
- }();
51
+ rows = rows.slice(0, this.length);
52
+ this.rows = null;
53
+ const batch = {
54
+ shape: this.options.shape,
55
+ batchType: 'data',
56
+ data: rows,
57
+ length: this.length,
58
+ schema: this.schema,
59
+ cursor: this.cursor
60
+ };
61
+ return batch;
62
+ }
63
+ }
77
64
  exports.default = RowTableBatchAggregator;
78
65
  //# sourceMappingURL=base-table-batch-aggregator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-table-batch-aggregator.js","names":["DEFAULT_ROW_COUNT","RowTableBatchAggregator","schema","options","_classCallCheck2","default","_defineProperty2","Array","isArray","_headers","key","index","name","_createClass2","value","rowCount","length","addArrayRow","row","cursor","Number","isFinite","rows","addObjectRow","getBatch","slice","batch","shape","batchType","data","exports"],"sources":["../../../../src/lib/batches/base-table-batch-aggregator.ts"],"sourcesContent":["import type {Schema} from '../schema/schema';\nimport type {TableBatch} from '../../category/table/table-types';\nimport {TableBatchAggregator, TableBatchOptions} from './table-batch-aggregator';\n\nconst DEFAULT_ROW_COUNT = 100;\n\nexport default class RowTableBatchAggregator implements TableBatchAggregator {\n schema: Schema;\n options: TableBatchOptions;\n\n length: number = 0;\n rows: any[] | null = null;\n cursor: number = 0;\n private _headers: string[] = [];\n\n constructor(schema: Schema, options: TableBatchOptions) {\n this.options = options;\n this.schema = schema;\n\n // schema is an array if there're no headers\n // object if there are headers\n if (!Array.isArray(schema)) {\n this._headers = [];\n for (const key in schema) {\n this._headers[schema[key].index] = schema[key].name;\n }\n }\n }\n\n rowCount(): number {\n return this.length;\n }\n\n addArrayRow(row: any[], cursor?: number): void {\n if (Number.isFinite(cursor)) {\n this.cursor = cursor as number;\n }\n\n this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);\n this.rows[this.length] = row;\n this.length++;\n }\n\n addObjectRow(row: {[columnName: string]: any}, cursor?: number): void {\n if (Number.isFinite(cursor)) {\n this.cursor = cursor as number;\n }\n\n this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);\n this.rows[this.length] = row;\n this.length++;\n }\n\n getBatch(): TableBatch | null {\n let rows = this.rows;\n if (!rows) {\n return null;\n }\n\n rows = rows.slice(0, this.length);\n this.rows = null;\n\n const batch: TableBatch = {\n shape: this.options.shape,\n batchType: 'data',\n data: rows,\n length: this.length,\n schema: this.schema,\n cursor: this.cursor\n };\n\n return batch;\n }\n}\n"],"mappings":";;;;;;;;;;AAIA,IAAMA,iBAAiB,GAAG,GAAG;AAAC,IAETC,uBAAuB;EAS1C,SAAAA,wBAAYC,MAAc,EAAE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,GAAgC,EAAEC,MAAe,EAAQ;MACpE,IAAIC,MAAM,CAACC,QAAQ,CAACF,MAAM,CAAC,EAAE;QAC3B,IAAI,CAACA,MAAM,GAAGA,MAAgB;MAChC;MAEA,IAAI,CAACG,IAAI,GAAG,IAAI,CAACA,IAAI,IAAI,IAAIf,KAAK,CAACP,iBAAiB,CAAC;MACrD,IAAI,CAACsB,IAAI,CAAC,IAAI,CAACN,MAAM,CAAC,GAAGE,GAAG;MAC5B,IAAI,CAACF,MAAM,EAAE;IACf;EAAC;IAAAN,GAAA;IAAAI,KAAA,EAED,SAAAU,SAAA,EAA8B;MAC5B,IAAIF,IAAI,GAAG,IAAI,CAACA,IAAI;MACpB,IAAI,CAACA,IAAI,EAAE;QACT,OAAO,IAAI;MACb;MAEAA,IAAI,GAAGA,IAAI,CAACG,KAAK,CAAC,CAAC,EAAE,IAAI,CAACT,MAAM,CAAC;MACjC,IAAI,CAACM,IAAI,GAAG,IAAI;MAEhB,IAAMI,KAAiB,GAAG;QACxBC,KAAK,EAAE,IAAI,CAACxB,OAAO,CAACwB,KAAK;QACzBC,SAAS,EAAE,MAAM;QACjBC,IAAI,EAAEP,IAAI;QACVN,MAAM,EAAE,IAAI,CAACA,MAAM;QACnBd,MAAM,EAAE,IAAI,CAACA,MAAM;QACnBiB,MAAM,EAAE,IAAI,CAACA;MACf,CAAC;MAED,OAAOO,KAAK;IACd;EAAC;EAAA,OAAAzB,uBAAA;AAAA;AAAA6B,OAAA,CAAAzB,OAAA,GAAAJ,uBAAA"}
1
+ {"version":3,"file":"base-table-batch-aggregator.js","names":["DEFAULT_ROW_COUNT","RowTableBatchAggregator","constructor","schema","options","_defineProperty2","default","Array","isArray","_headers","key","index","name","rowCount","length","addArrayRow","row","cursor","Number","isFinite","rows","addObjectRow","getBatch","slice","batch","shape","batchType","data","exports"],"sources":["../../../../src/lib/batches/base-table-batch-aggregator.ts"],"sourcesContent":["import type {Schema} from '../schema/schema';\nimport type {TableBatch} from '../../category/table/table-types';\nimport {TableBatchAggregator, TableBatchOptions} from './table-batch-aggregator';\n\nconst DEFAULT_ROW_COUNT = 100;\n\nexport default class RowTableBatchAggregator implements TableBatchAggregator {\n schema: Schema;\n options: TableBatchOptions;\n\n length: number = 0;\n rows: any[] | null = null;\n cursor: number = 0;\n private _headers: string[] = [];\n\n constructor(schema: Schema, options: TableBatchOptions) {\n this.options = options;\n this.schema = schema;\n\n // schema is an array if there're no headers\n // object if there are headers\n if (!Array.isArray(schema)) {\n this._headers = [];\n for (const key in schema) {\n this._headers[schema[key].index] = schema[key].name;\n }\n }\n }\n\n rowCount(): number {\n return this.length;\n }\n\n addArrayRow(row: any[], cursor?: number): void {\n if (Number.isFinite(cursor)) {\n this.cursor = cursor as number;\n }\n\n this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);\n this.rows[this.length] = row;\n this.length++;\n }\n\n addObjectRow(row: {[columnName: string]: any}, cursor?: number): void {\n if (Number.isFinite(cursor)) {\n this.cursor = cursor as number;\n }\n\n this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);\n this.rows[this.length] = row;\n this.length++;\n }\n\n getBatch(): TableBatch | null {\n let rows = this.rows;\n if (!rows) {\n return null;\n }\n\n rows = rows.slice(0, this.length);\n this.rows = null;\n\n const batch: TableBatch = {\n shape: this.options.shape,\n batchType: 'data',\n data: rows,\n length: this.length,\n schema: this.schema,\n cursor: this.cursor\n };\n\n return batch;\n }\n}\n"],"mappings":";;;;;;;;AAIA,MAAMA,iBAAiB,GAAG,GAAG;AAEd,MAAMC,uBAAuB,CAAiC;EAS3EC,WAAWA,CAACC,MAAc,EAAEC,OAA0B,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA,kBALvC,CAAC;IAAA,IAAAD,gBAAA,CAAAC,OAAA,gBACG,IAAI;IAAA,IAAAD,gBAAA,CAAAC,OAAA,kBACR,CAAC;IAAA,IAAAD,g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