@loaders.gl/schema
Advanced tools
Comparing version 4.0.1 to 4.0.2
@@ -90,5 +90,7 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
makeArrayRowIterator: () => makeArrayRowIterator, | ||
makeBatchesFromTable: () => makeBatchesFromTable, | ||
makeMeshAttributeMetadata: () => makeMeshAttributeMetadata, | ||
makeObjectRowIterator: () => makeObjectRowIterator, | ||
makeRowIterator: () => makeRowIterator, | ||
makeTableFromBatches: () => makeTableFromBatches, | ||
makeTableFromData: () => makeTableFromData | ||
@@ -999,2 +1001,75 @@ }); | ||
// src/lib/table/simple-table/make-table-from-batches.ts | ||
function* makeBatchesFromTable(table) { | ||
yield { | ||
...table, | ||
length: getTableLength(table), | ||
batchType: "data" | ||
}; | ||
} | ||
async function makeTableFromBatches(batchIterator) { | ||
let arrayRows; | ||
let objectRows; | ||
let features; | ||
let shape = null; | ||
let schema; | ||
for await (const batch of batchIterator) { | ||
shape = shape || batch.shape; | ||
schema = schema || batch.schema; | ||
switch (batch.shape) { | ||
case "array-row-table": | ||
arrayRows = arrayRows || []; | ||
for (let rowIndex = 0; rowIndex < getTableLength(batch); rowIndex++) { | ||
const row = batch.data[rowIndex]; | ||
arrayRows.push(row); | ||
} | ||
break; | ||
case "object-row-table": | ||
objectRows = objectRows || []; | ||
for (let rowIndex = 0; rowIndex < getTableLength(batch); rowIndex++) { | ||
const row = batch.data[rowIndex]; | ||
objectRows.push(row); | ||
} | ||
break; | ||
case "geojson-table": | ||
features = features || []; | ||
for (let rowIndex = 0; rowIndex < getTableLength(batch); rowIndex++) { | ||
const row = batch.features[rowIndex]; | ||
features.push(row); | ||
} | ||
break; | ||
case "columnar-table": | ||
case "arrow-table": | ||
default: | ||
throw new Error("shape"); | ||
} | ||
} | ||
if (!shape) { | ||
return null; | ||
} | ||
switch (shape) { | ||
case "array-row-table": | ||
return { | ||
shape: "array-row-table", | ||
data: arrayRows, | ||
schema | ||
}; | ||
case "object-row-table": | ||
return { | ||
shape: "object-row-table", | ||
data: objectRows, | ||
schema | ||
}; | ||
case "geojson-table": | ||
return { | ||
shape: "geojson-table", | ||
type: "FeatureCollection", | ||
features, | ||
schema | ||
}; | ||
default: | ||
return null; | ||
} | ||
} | ||
// src/lib/table/simple-table/table-column.ts | ||
@@ -1022,3 +1097,3 @@ function makeColumnFromField(field, length) { | ||
function makeArrowTable(table) { | ||
const _makeArrowTable = globalThis.__luma?._makeArrowTable; | ||
const _makeArrowTable = globalThis.__loaders?._makeArrowTable; | ||
if (!_makeArrowTable) { | ||
@@ -1025,0 +1100,0 @@ throw new Error(""); |
@@ -13,2 +13,3 @@ export type { TypedArray, BigTypedArray, TypedArrayConstructor, BigTypedArrayConstructor, NumberArray, ArrayType, AnyArray } from './types/types'; | ||
export { makeTableFromData } from './lib/table/simple-table/make-table'; | ||
export { makeTableFromBatches, makeBatchesFromTable } from './lib/table/simple-table/make-table-from-batches'; | ||
export { convertTable } from './lib/table/simple-table/convert-table'; | ||
@@ -15,0 +16,0 @@ export { deduceTableSchema } from './lib/table/simple-table/table-schema'; |
@@ -7,2 +7,3 @@ export { TableBatchBuilder } from "./lib/table/batches/table-batch-builder.js"; | ||
export { makeTableFromData } from "./lib/table/simple-table/make-table.js"; | ||
export { makeTableFromBatches, makeBatchesFromTable } from "./lib/table/simple-table/make-table-from-batches.js"; | ||
export { convertTable } from "./lib/table/simple-table/convert-table.js"; | ||
@@ -9,0 +10,0 @@ export { deduceTableSchema } from "./lib/table/simple-table/table-schema.js"; |
@@ -19,4 +19,4 @@ import { getTableCell, getTableLength, getTableRowAsArray, getTableRowAsObject } from "./table-accessors.js"; | ||
export function makeArrowTable(table) { | ||
var _globalThis$__luma; | ||
const _makeArrowTable = (_globalThis$__luma = globalThis.__luma) === null || _globalThis$__luma === void 0 ? void 0 : _globalThis$__luma._makeArrowTable; | ||
var _globalThis$__loaders; | ||
const _makeArrowTable = (_globalThis$__loaders = globalThis.__loaders) === null || _globalThis$__loaders === void 0 ? void 0 : _globalThis$__loaders._makeArrowTable; | ||
if (!_makeArrowTable) { | ||
@@ -23,0 +23,0 @@ throw new Error(''); |
@@ -16,3 +16,3 @@ import { Schema } from './schema'; | ||
/** Data in this batch */ | ||
data: unknown; | ||
data?: unknown; | ||
/** If this is an arrow table. @deprecated Use `data` */ | ||
@@ -19,0 +19,0 @@ recordBatch?: ApacheRecordBatch; |
{ | ||
"name": "@loaders.gl/schema", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "Table format APIs for JSON, CSV, etc...", | ||
@@ -45,3 +45,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "765e5a26a6bf3f2cc02cabffc4a1e3665ec92a53" | ||
"gitHead": "471058d109d5652f28c32c1f296fd632f9a5c806" | ||
} |
@@ -0,1 +1,4 @@ | ||
// loaders.gl, MIT license | ||
// Copyright (c) vis.gl contributors | ||
// COMMON CATEGORY | ||
@@ -59,2 +62,6 @@ export type { | ||
export {makeTableFromData} from './lib/table/simple-table/make-table'; | ||
export { | ||
makeTableFromBatches, | ||
makeBatchesFromTable | ||
} from './lib/table/simple-table/make-table-from-batches'; | ||
export {convertTable} from './lib/table/simple-table/convert-table'; | ||
@@ -61,0 +68,0 @@ export {deduceTableSchema} from './lib/table/simple-table/table-schema'; |
@@ -0,1 +1,4 @@ | ||
// loaders.gl, MIT license | ||
// Copyright (c) vis.gl contributors | ||
/* Problem with arrow dependency... | ||
@@ -2,0 +5,0 @@ import { |
@@ -0,1 +1,4 @@ | ||
// loaders.gl, MIT license | ||
// Copyright (c) vis.gl contributors | ||
// This code is adapted from ArrowJS https://github.com/apache/arrow | ||
@@ -2,0 +5,0 @@ // under Apache license http://www.apache.org/licenses/LICENSE-2.0 |
@@ -0,1 +1,4 @@ | ||
// loaders.gl, MIT license | ||
// Copyright (c) vis.gl contributors | ||
// This code is adapted from ArrowJS https://github.com/apache/arrow | ||
@@ -2,0 +5,0 @@ // under Apache license http://www.apache.org/licenses/LICENSE-2.0 |
// loaders.gl, MIT license | ||
// Copyright (c) vis.gl contributors | ||
import { | ||
@@ -53,3 +54,3 @@ getTableCell, | ||
export function makeArrowTable(table: Table): Table { | ||
const _makeArrowTable = globalThis.__luma?._makeArrowTable; | ||
const _makeArrowTable = globalThis.__loaders?._makeArrowTable; | ||
if (!_makeArrowTable) { | ||
@@ -56,0 +57,0 @@ throw new Error(''); |
// loaders.gl, MIT license | ||
// Copyright (c) vis.gl contributors | ||
import {Table, ArrayRowTable, ObjectRowTable, ColumnarTable} from '../../../types/category-table'; | ||
@@ -4,0 +5,0 @@ import {deduceTableSchema} from './table-schema'; |
@@ -0,1 +1,4 @@ | ||
// loaders.gl, MIT license | ||
// Copyright (c) vis.gl contributors | ||
/** Convert an object row to an array row */ | ||
@@ -2,0 +5,0 @@ export function convertToObjectRow( |
@@ -0,1 +1,4 @@ | ||
// loaders.gl, MIT license | ||
// Copyright (c) vis.gl contributors | ||
// Type deduction | ||
@@ -2,0 +5,0 @@ import {Schema, Field} from '../../../types/schema'; |
@@ -22,3 +22,3 @@ // loaders.gl, MIT license | ||
/** Data in this batch */ | ||
data: unknown; | ||
data?: unknown; | ||
/** If this is an arrow table. @deprecated Use `data` */ | ||
@@ -25,0 +25,0 @@ recordBatch?: ApacheRecordBatch; |
@@ -0,1 +1,4 @@ | ||
// loaders.gl, MIT license | ||
// Copyright (c) vis.gl contributors | ||
// GIS | ||
@@ -2,0 +5,0 @@ import type {TypedArray} from './types'; |
@@ -0,1 +1,4 @@ | ||
// loaders.gl, MIT license | ||
// Copyright (c) vis.gl contributors | ||
// GIS | ||
@@ -2,0 +5,0 @@ |
@@ -0,1 +1,4 @@ | ||
// loaders.gl, MIT license | ||
// Copyright (c) vis.gl contributors | ||
/** | ||
@@ -2,0 +5,0 @@ * data images |
@@ -0,1 +1,4 @@ | ||
// loaders.gl, MIT license | ||
// Copyright (c) vis.gl contributors | ||
/** Any typed array */ | ||
@@ -2,0 +5,0 @@ export type TypedArray = |
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
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
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
498429
190
9609