Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@loaders.gl/schema

Package Overview
Dependencies
Maintainers
9
Versions
187
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loaders.gl/schema - npm Package Compare versions

Comparing version 4.0.2 to 4.0.3

23

dist/dist.dev.js

@@ -89,4 +89,5 @@ (function webpackUniversalModuleDefinition(root, factory) {

getTypeInfo: () => getTypeInfo,
isTable: () => isTable,
makeArrayRowIterator: () => makeArrayRowIterator,
makeBatchesFromTable: () => makeBatchesFromTable,
makeBatchFromTable: () => makeBatchFromTable,
makeMeshAttributeMetadata: () => makeMeshAttributeMetadata,

@@ -463,2 +464,18 @@ makeObjectRowIterator: () => makeObjectRowIterator,

// src/lib/table/simple-table/table-accessors.ts
function isTable(table) {
const shape = typeof table === "object" && table?.shape;
switch (shape) {
case "array-row-table":
case "object-row-table":
return Array.isArray(table.data);
case "geojson-table":
return Array.isArray(table.features);
case "columnar-table":
return table.data && typeof table.data === "object";
case "arrow-table":
return Boolean(table?.data?.numRows !== void 0);
default:
return false;
}
}
function getTableLength(table) {

@@ -1003,4 +1020,4 @@ switch (table.shape) {

// src/lib/table/simple-table/make-table-from-batches.ts
function* makeBatchesFromTable(table) {
yield {
function makeBatchFromTable(table) {
return {
...table,

@@ -1007,0 +1024,0 @@ length: getTableLength(table),

4

dist/index.d.ts

@@ -10,6 +10,6 @@ export type { TypedArray, BigTypedArray, TypedArrayConstructor, BigTypedArrayConstructor, NumberArray, ArrayType, AnyArray } from './types/types';

export { ColumnarTableBatchAggregator } from './lib/table/batches/columnar-table-batch-aggregator';
export { getTableLength, getTableNumCols, getTableCell, getTableRowShape, getTableColumnIndex, getTableColumnName, getTableRowAsObject, getTableRowAsArray, makeRowIterator, makeArrayRowIterator, makeObjectRowIterator } from './lib/table/simple-table/table-accessors';
export { isTable, getTableLength, getTableNumCols, getTableCell, getTableRowShape, getTableColumnIndex, getTableColumnName, getTableRowAsObject, getTableRowAsArray, makeRowIterator, makeArrayRowIterator, makeObjectRowIterator } from './lib/table/simple-table/table-accessors';
export { ArrowLikeTable } from './lib/table/arrow-api/arrow-like-table';
export { makeTableFromData } from './lib/table/simple-table/make-table';
export { makeTableFromBatches, makeBatchesFromTable } from './lib/table/simple-table/make-table-from-batches';
export { makeTableFromBatches, makeBatchFromTable } from './lib/table/simple-table/make-table-from-batches';
export { convertTable } from './lib/table/simple-table/convert-table';

@@ -16,0 +16,0 @@ export { deduceTableSchema } from './lib/table/simple-table/table-schema';

export { TableBatchBuilder } from "./lib/table/batches/table-batch-builder.js";
export { RowTableBatchAggregator } from "./lib/table/batches/row-table-batch-aggregator.js";
export { ColumnarTableBatchAggregator } from "./lib/table/batches/columnar-table-batch-aggregator.js";
export { getTableLength, getTableNumCols, getTableCell, getTableRowShape, getTableColumnIndex, getTableColumnName, getTableRowAsObject, getTableRowAsArray, makeRowIterator, makeArrayRowIterator, makeObjectRowIterator } from "./lib/table/simple-table/table-accessors.js";
export { isTable, getTableLength, getTableNumCols, getTableCell, getTableRowShape, getTableColumnIndex, getTableColumnName, getTableRowAsObject, getTableRowAsArray, makeRowIterator, makeArrayRowIterator, makeObjectRowIterator } from "./lib/table/simple-table/table-accessors.js";
export { ArrowLikeTable } from "./lib/table/arrow-api/arrow-like-table.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 { makeTableFromBatches, makeBatchFromTable } from "./lib/table/simple-table/make-table-from-batches.js";
export { convertTable } from "./lib/table/simple-table/convert-table.js";

@@ -9,0 +9,0 @@ export { deduceTableSchema } from "./lib/table/simple-table/table-schema.js";

import type { TableBatch, Table } from '@loaders.gl/schema';
/**
* Returns an async iterator that yields a single table as a sequence of batches.
* Returns an iterator that yields a single table as a sequence of batches.
* @note Currently only a single batch is yielded.
* @note All batches will have the same shape and schema as the original table.
* @param batchIterator
* @returns `null` if no batches are yielded by the async iterator
* @returns
*/
export declare function makeBatchesFromTable(table: Table): IterableIterator<TableBatch>;
/**
* Returns a table packaged as a single table batch
* @note The batch will have the same shape and schema as the original table.
* @returns `null` if no batches are yielded by the async iterator
*/
export declare function makeBatchFromTable(table: Table): TableBatch;
/**
* Assembles all batches from an async iterator into a single table.

@@ -16,3 +21,3 @@ * @note All batches must have the same shape and schema

*/
export declare function makeTableFromBatches(batchIterator: AsyncIterableIterator<TableBatch> | IterableIterator<TableBatch>): Promise<Table | null>;
export declare function makeTableFromBatches(batchIterator: AsyncIterable<TableBatch> | Iterable<TableBatch>): Promise<Table | null>;
//# sourceMappingURL=make-table-from-batches.d.ts.map
import { getTableLength } from '@loaders.gl/schema';
export function* makeBatchesFromTable(table) {
yield {
yield makeBatchFromTable(table);
}
export function makeBatchFromTable(table) {
return {
...table,

@@ -5,0 +8,0 @@ length: getTableLength(table),

import { Table, ArrayRowTable, ObjectRowTable } from '../../../types/category-table';
export declare function isTable(table: any): table is Table;
/**

@@ -3,0 +4,0 @@ * Returns the length of the table (i.e. the number of rows)

@@ -0,1 +1,18 @@

export function isTable(table) {
var _table$data;
const shape = typeof table === 'object' && (table === null || table === void 0 ? void 0 : table.shape);
switch (shape) {
case 'array-row-table':
case 'object-row-table':
return Array.isArray(table.data);
case 'geojson-table':
return Array.isArray(table.features);
case 'columnar-table':
return table.data && typeof table.data === 'object';
case 'arrow-table':
return Boolean((table === null || table === void 0 ? void 0 : (_table$data = table.data) === null || _table$data === void 0 ? void 0 : _table$data.numRows) !== undefined);
default:
return false;
}
}
export function getTableLength(table) {

@@ -2,0 +19,0 @@ switch (table.shape) {

@@ -5,2 +5,7 @@ /** For dictionary type */

export type DataType = 'null' | 'bool' | 'int' | 'int8' | 'int16' | 'int32' | 'int64' | 'uint8' | 'uint16' | 'uint32' | 'uint64' | 'float' | 'float16' | 'float32' | 'float64' | 'binary' | 'utf8' | 'date-day' | 'date-millisecond' | 'time-second' | 'time-millisecond' | 'time-microsecond' | 'time-nanosecond' | 'timestamp-second' | 'timestamp-millisecond' | 'timestamp-microsecond' | 'timestamp-nanosecond' | 'interval-daytime' | 'interval-yearmonth' | {
type: 'decimal';
bitWidth: number;
precision: number;
scale: number;
} | {
type: 'list';

@@ -7,0 +12,0 @@ children: Field[];

{
"name": "@loaders.gl/schema",
"version": "4.0.2",
"version": "4.0.3",
"description": "Table format APIs for JSON, CSV, etc...",

@@ -45,3 +45,3 @@ "license": "MIT",

},
"gitHead": "471058d109d5652f28c32c1f296fd632f9a5c806"
"gitHead": "03c871839b36c997249dabae1844df53a35d3760"
}

@@ -46,2 +46,3 @@ // loaders.gl, MIT license

export {
isTable,
getTableLength,

@@ -65,3 +66,3 @@ getTableNumCols,

makeTableFromBatches,
makeBatchesFromTable
makeBatchFromTable
} from './lib/table/simple-table/make-table-from-batches';

@@ -68,0 +69,0 @@ export {convertTable} from './lib/table/simple-table/convert-table';

@@ -15,13 +15,21 @@ // loaders.gl, MIT license

/**
* Returns an async iterator that yields a single table as a sequence of batches.
* Returns an iterator that yields a single table as a sequence of batches.
* @note Currently only a single batch is yielded.
* @note All batches will have the same shape and schema as the original table.
* @param batchIterator
* @returns `null` if no batches are yielded by the async iterator
* @returns
*/
export function* makeBatchesFromTable(table: Table): IterableIterator<TableBatch> {
yield {...table, length: getTableLength(table), batchType: 'data'};
yield makeBatchFromTable(table);
}
/**
* Returns a table packaged as a single table batch
* @note The batch will have the same shape and schema as the original table.
* @returns `null` if no batches are yielded by the async iterator
*/
export function makeBatchFromTable(table: Table): TableBatch {
return {...table, length: getTableLength(table), batchType: 'data'};
}
/**
* Assembles all batches from an async iterator into a single table.

@@ -32,4 +40,5 @@ * @note All batches must have the same shape and schema

*/
// eslint-disable-next-line complexity
export async function makeTableFromBatches(
batchIterator: AsyncIterableIterator<TableBatch> | IterableIterator<TableBatch>
batchIterator: AsyncIterable<TableBatch> | Iterable<TableBatch>
): Promise<Table | null> {

@@ -36,0 +45,0 @@ let arrayRows: ArrayRowTable['data'];

@@ -8,2 +8,23 @@ // loaders.gl, MIT license

export function isTable(table: any): table is Table {
const shape = typeof table === 'object' && table?.shape;
switch (shape) {
case 'array-row-table':
case 'object-row-table':
return Array.isArray(table.data);
case 'geojson-table':
return Array.isArray(table.features);
case 'columnar-table':
return table.data && typeof table.data === 'object';
case 'arrow-table':
return Boolean(table?.data?.numRows !== undefined);
default:
return false;
}
}
/**

@@ -10,0 +31,0 @@ * Returns the length of the table (i.e. the number of rows)

@@ -40,2 +40,3 @@ // loaders.gl, MIT license

// Composite types
| {type: 'decimal'; bitWidth: number; precision: number; scale: number}
| {type: 'list'; children: Field[]} // one child only

@@ -42,0 +43,0 @@ | {type: 'struct'; children: Field[]}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc