@loaders.gl/schema
Advanced tools
Comparing version 4.0.0-alpha.25 to 4.0.0-alpha.26
@@ -32,6 +32,7 @@ "use strict"; | ||
value: function toArray() { | ||
var _this$table$data$getC; | ||
var _arrowTable$getChild; | ||
switch (this.table.shape) { | ||
case 'arrow-table': | ||
return (_this$table$data$getC = this.table.data.getChild(this.columnName)) === null || _this$table$data$getC === void 0 ? void 0 : _this$table$data$getC.toArray(); | ||
var arrowTable = this.table.data; | ||
return (_arrowTable$getChild = arrowTable.getChild(this.columnName)) === null || _arrowTable$getChild === void 0 ? void 0 : _arrowTable$getChild.toArray(); | ||
case 'columnar-table': | ||
@@ -38,0 +39,0 @@ return this.table.data[this.columnName]; |
@@ -34,3 +34,4 @@ "use strict"; | ||
case 'arrow-table': | ||
return table.data.numRows; | ||
var arrowTable = table.data; | ||
return arrowTable.numRows; | ||
case 'columnar-table': | ||
@@ -63,3 +64,4 @@ for (var _i = 0, _Object$values = Object.values(table.data); _i < _Object$values.length; _i++) { | ||
case 'arrow-table': | ||
return table.data.numCols; | ||
var arrowTable = table.data; | ||
return arrowTable.numCols; | ||
default: | ||
@@ -70,3 +72,3 @@ throw new Error('table'); | ||
function getTableCell(table, rowIndex, columnName) { | ||
var _table$data$getChildA; | ||
var _arrowTable$getChildA; | ||
switch (table.shape) { | ||
@@ -84,6 +86,7 @@ case 'array-row-table': | ||
case 'arrow-table': | ||
var arrowColumnIndex = table.data.schema.fields.findIndex(function (field) { | ||
var arrowTable = table.data; | ||
var arrowColumnIndex = arrowTable.schema.fields.findIndex(function (field) { | ||
return field.name === columnName; | ||
}); | ||
return (_table$data$getChildA = table.data.getChildAt(arrowColumnIndex)) === null || _table$data$getChildA === void 0 ? void 0 : _table$data$getChildA.get(rowIndex); | ||
return (_arrowTable$getChildA = arrowTable.getChildAt(arrowColumnIndex)) === null || _arrowTable$getChildA === void 0 ? void 0 : _arrowTable$getChildA.get(rowIndex); | ||
default: | ||
@@ -94,3 +97,3 @@ throw new Error('todo'); | ||
function getTableCellAt(table, rowIndex, columnIndex) { | ||
var _table$data$getChildA2; | ||
var _arrowTable$getChildA2; | ||
switch (table.shape) { | ||
@@ -110,3 +113,4 @@ case 'array-row-table': | ||
case 'arrow-table': | ||
return (_table$data$getChildA2 = table.data.getChildAt(columnIndex)) === null || _table$data$getChildA2 === void 0 ? void 0 : _table$data$getChildA2.get(rowIndex); | ||
var arrowTable = table.data; | ||
return (_arrowTable$getChildA2 = arrowTable.getChildAt(columnIndex)) === null || _arrowTable$getChildA2 === void 0 ? void 0 : _arrowTable$getChildA2.get(rowIndex); | ||
default: | ||
@@ -186,5 +190,6 @@ throw new Error('todo'); | ||
case 'arrow-table': | ||
var arrowTable = table.data; | ||
var objectRow = target || {}; | ||
var row = table.data.get(rowIndex); | ||
var schema = table.data.schema; | ||
var row = arrowTable.get(rowIndex); | ||
var schema = arrowTable.schema; | ||
for (var _i5 = 0; _i5 < schema.fields.length; _i5++) { | ||
@@ -238,5 +243,6 @@ objectRow[schema.fields[_i5].name] = row === null || row === void 0 ? void 0 : row[schema.fields[_i5].name]; | ||
case 'arrow-table': | ||
var arrowTable = table.data; | ||
var arrayRow = target || []; | ||
var row = table.data.get(rowIndex); | ||
var schema = table.data.schema; | ||
var row = arrowTable.get(rowIndex); | ||
var schema = arrowTable.schema; | ||
for (var _i10 = 0; _i10 < schema.fields.length; _i10++) { | ||
@@ -243,0 +249,0 @@ arrayRow[_i10] = row === null || row === void 0 ? void 0 : row[schema.fields[_i10].name]; |
@@ -16,6 +16,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
toArray() { | ||
var _this$table$data$getC; | ||
var _arrowTable$getChild; | ||
switch (this.table.shape) { | ||
case 'arrow-table': | ||
return (_this$table$data$getC = this.table.data.getChild(this.columnName)) === null || _this$table$data$getC === void 0 ? void 0 : _this$table$data$getC.toArray(); | ||
const arrowTable = this.table.data; | ||
return (_arrowTable$getChild = arrowTable.getChild(this.columnName)) === null || _arrowTable$getChild === void 0 ? void 0 : _arrowTable$getChild.toArray(); | ||
case 'columnar-table': | ||
@@ -22,0 +23,0 @@ return this.table.data[this.columnName]; |
@@ -9,3 +9,4 @@ export function getTableLength(table) { | ||
case 'arrow-table': | ||
return table.data.numRows; | ||
const arrowTable = table.data; | ||
return arrowTable.numRows; | ||
case 'columnar-table': | ||
@@ -37,3 +38,4 @@ for (const column of Object.values(table.data)) { | ||
case 'arrow-table': | ||
return table.data.numCols; | ||
const arrowTable = table.data; | ||
return arrowTable.numCols; | ||
default: | ||
@@ -44,3 +46,3 @@ throw new Error('table'); | ||
export function getTableCell(table, rowIndex, columnName) { | ||
var _table$data$getChildA; | ||
var _arrowTable$getChildA; | ||
switch (table.shape) { | ||
@@ -58,4 +60,5 @@ case 'array-row-table': | ||
case 'arrow-table': | ||
const arrowColumnIndex = table.data.schema.fields.findIndex(field => field.name === columnName); | ||
return (_table$data$getChildA = table.data.getChildAt(arrowColumnIndex)) === null || _table$data$getChildA === void 0 ? void 0 : _table$data$getChildA.get(rowIndex); | ||
const arrowTable = table.data; | ||
const arrowColumnIndex = arrowTable.schema.fields.findIndex(field => field.name === columnName); | ||
return (_arrowTable$getChildA = arrowTable.getChildAt(arrowColumnIndex)) === null || _arrowTable$getChildA === void 0 ? void 0 : _arrowTable$getChildA.get(rowIndex); | ||
default: | ||
@@ -66,3 +69,3 @@ throw new Error('todo'); | ||
export function getTableCellAt(table, rowIndex, columnIndex) { | ||
var _table$data$getChildA2; | ||
var _arrowTable$getChildA2; | ||
switch (table.shape) { | ||
@@ -82,3 +85,4 @@ case 'array-row-table': | ||
case 'arrow-table': | ||
return (_table$data$getChildA2 = table.data.getChildAt(columnIndex)) === null || _table$data$getChildA2 === void 0 ? void 0 : _table$data$getChildA2.get(rowIndex); | ||
const arrowTable = table.data; | ||
return (_arrowTable$getChildA2 = arrowTable.getChildAt(columnIndex)) === null || _arrowTable$getChildA2 === void 0 ? void 0 : _arrowTable$getChildA2.get(rowIndex); | ||
default: | ||
@@ -153,5 +157,6 @@ throw new Error('todo'); | ||
case 'arrow-table': | ||
const arrowTable = table.data; | ||
const objectRow = target || {}; | ||
const row = table.data.get(rowIndex); | ||
const schema = table.data.schema; | ||
const row = arrowTable.get(rowIndex); | ||
const schema = arrowTable.schema; | ||
for (let i = 0; i < schema.fields.length; i++) { | ||
@@ -204,5 +209,6 @@ objectRow[schema.fields[i].name] = row === null || row === void 0 ? void 0 : row[schema.fields[i].name]; | ||
case 'arrow-table': | ||
const arrowTable = table.data; | ||
const arrayRow = target || []; | ||
const row = table.data.get(rowIndex); | ||
const schema = table.data.schema; | ||
const row = arrowTable.get(rowIndex); | ||
const schema = arrowTable.schema; | ||
for (let i = 0; i < schema.fields.length; i++) { | ||
@@ -209,0 +215,0 @@ arrayRow[i] = row === null || row === void 0 ? void 0 : row[schema.fields[i].name]; |
@@ -18,7 +18,3 @@ import { Table } from '../../../types/category-table'; | ||
constructor(table: Table); | ||
get data(): any[][] | { | ||
[columnName: string]: any; | ||
}[] | import("geojson").Feature<import("geojson").Geometry, import("geojson").GeoJsonProperties>[] | { | ||
[columnName: string]: ArrayLike<unknown>; | ||
} | import("apache-arrow").Table<any>; | ||
get data(): unknown; | ||
get numCols(): number; | ||
@@ -25,0 +21,0 @@ get length(): number; |
@@ -1,5 +0,6 @@ | ||
import type { Table as ApacheArrowTable } from 'apache-arrow'; | ||
import type { Schema } from './schema'; | ||
import type { Batch } from './batch'; | ||
import type { Feature } from './category-gis'; | ||
type ApacheArrowTable = unknown; | ||
type ApacheRecordBatch = unknown; | ||
/** A general table */ | ||
@@ -101,5 +102,6 @@ export type Table = RowTable | ArrayRowTable | ObjectRowTable | GeoJSONTable | ColumnarTable | ArrowTable; | ||
schema?: Schema; | ||
data: ApacheArrowTable; | ||
data: ApacheRecordBatch; | ||
length: number; | ||
}; | ||
export {}; | ||
//# sourceMappingURL=category-table.d.ts.map |
{ | ||
"name": "@loaders.gl/schema", | ||
"version": "4.0.0-alpha.25", | ||
"version": "4.0.0-alpha.26", | ||
"description": "Table format APIs for JSON, CSV, etc...", | ||
@@ -37,3 +37,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "40135f391b869388dbbcd615bbe51178d0c370be" | ||
"gitHead": "91adce71f74dacc7c8bfc379f0d122f2beae70d9" | ||
} |
@@ -37,3 +37,4 @@ // loaders.gl, MIT license | ||
case 'arrow-table': | ||
return this.table.data.getChild(this.columnName)?.toArray(); | ||
const arrowTable = this.table.data as any; | ||
return arrowTable.getChild(this.columnName)?.toArray(); | ||
case 'columnar-table': | ||
@@ -40,0 +41,0 @@ return this.table.data[this.columnName]; |
@@ -20,3 +20,4 @@ // loaders.gl, MIT license | ||
case 'arrow-table': | ||
return table.data.numRows; | ||
const arrowTable = table.data as any; | ||
return arrowTable.numRows; | ||
@@ -54,3 +55,4 @@ case 'columnar-table': | ||
case 'arrow-table': | ||
return table.data.numCols; | ||
const arrowTable = table.data as any; | ||
return arrowTable.numCols; | ||
default: | ||
@@ -79,6 +81,7 @@ throw new Error('table'); | ||
case 'arrow-table': | ||
const arrowColumnIndex = table.data.schema.fields.findIndex( | ||
const arrowTable = table.data as any; | ||
const arrowColumnIndex = arrowTable.schema.fields.findIndex( | ||
(field) => field.name === columnName | ||
); | ||
return table.data.getChildAt(arrowColumnIndex)?.get(rowIndex); | ||
return arrowTable.getChildAt(arrowColumnIndex)?.get(rowIndex); | ||
@@ -110,3 +113,4 @@ default: | ||
case 'arrow-table': | ||
return table.data.getChildAt(columnIndex)?.get(rowIndex); | ||
const arrowTable = table.data as any; | ||
return arrowTable.getChildAt(columnIndex)?.get(rowIndex); | ||
@@ -208,5 +212,6 @@ default: | ||
case 'arrow-table': | ||
const arrowTable = table.data as any; | ||
const objectRow: {[columnName: string]: unknown} = target || {}; | ||
const row = table.data.get(rowIndex); | ||
const schema = table.data.schema; | ||
const row = arrowTable.get(rowIndex); | ||
const schema = arrowTable.schema; | ||
for (let i = 0; i < schema.fields.length; i++) { | ||
@@ -280,5 +285,6 @@ objectRow[schema.fields[i].name] = row?.[schema.fields[i].name]; | ||
case 'arrow-table': | ||
const arrowTable = table.data as any; | ||
const arrayRow: unknown[] = target || []; | ||
const row = table.data.get(rowIndex); | ||
const schema = table.data.schema; | ||
const row = arrowTable.get(rowIndex); | ||
const schema = arrowTable.schema; | ||
for (let i = 0; i < schema.fields.length; i++) { | ||
@@ -285,0 +291,0 @@ arrayRow[i] = row?.[schema.fields[i].name]; |
// loaders.gl, MIT license | ||
import type {Table as ApacheArrowTable} from 'apache-arrow'; | ||
import type {Schema} from './schema'; | ||
@@ -8,8 +7,8 @@ import type {Batch} from './batch'; | ||
// Idea was to just import types, but it seems | ||
// Seems this triggers more bundling and build issues than it is worth... | ||
// import type {Table as ApacheArrowTable, RecordBatch} from 'apache-arrow'; | ||
// type ApacheArrowTable = any; | ||
// type RecordBatch = any; | ||
// Avoid a big dependency, apparently even a type import can pull in a lot of code | ||
// import type {Table as ApacheArrowTable} from 'apache-arrow'; | ||
type ApacheArrowTable = unknown; | ||
type ApacheRecordBatch = unknown; | ||
/** A general table */ | ||
@@ -126,5 +125,4 @@ export type Table = | ||
schema?: Schema; | ||
data: ApacheArrowTable; | ||
// recordBatch: RecordBatch; | ||
data: ApacheRecordBatch; | ||
length: number; | ||
}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1231313
22854
0