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.0-alpha.23 to 4.0.0-alpha.24

7

dist/es5/index.js

@@ -253,2 +253,8 @@ "use strict";

});
Object.defineProperty(exports, "convertTable", {
enumerable: true,
get: function get() {
return _convertTable.convertTable;
}
});
Object.defineProperty(exports, "convertToArrayRow", {

@@ -398,2 +404,3 @@ enumerable: true,

var _makeTable = require("./lib/table/simple-table/make-table");
var _convertTable = require("./lib/table/simple-table/convert-table");
var _tableSchema = require("./lib/table/simple-table/table-schema");

@@ -400,0 +407,0 @@ var _rowUtils = require("./lib/table/simple-table/row-utils");

@@ -7,3 +7,5 @@ "use strict";

});
exports.convertTable = convertTable;
exports.makeArrayRowTable = makeArrayRowTable;
exports.makeArrowTable = makeArrowTable;
exports.makeColumnarTable = makeColumnarTable;

@@ -20,2 +22,24 @@ exports.makeObjectRowTable = makeObjectRowTable;

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function convertTable(table, shape) {
switch (shape) {
case 'object-row-table':
return makeObjectRowTable(table);
case 'array-row-table':
return makeArrayRowTable(table);
case 'columnar-table':
return makeColumnarTable(table);
case 'arrow-table':
return makeArrowTable(table);
default:
throw new Error(shape);
}
}
function makeArrowTable(table) {
var _globalThis$__luma;
var _makeArrowTable = (_globalThis$__luma = globalThis.__luma) === null || _globalThis$__luma === void 0 ? void 0 : _globalThis$__luma._makeArrowTable;
if (!_makeArrowTable) {
throw new Error('');
}
return _makeArrowTable(table);
}
function makeColumnarTable(table) {

@@ -22,0 +46,0 @@ var _table$schema;

1

dist/esm/index.js

@@ -7,2 +7,3 @@ export { TableBatchBuilder } from './lib/table/batches/table-batch-builder';

export { makeTableFromData } from './lib/table/simple-table/make-table';
export { convertTable } from './lib/table/simple-table/convert-table';
export { deduceTableSchema } from './lib/table/simple-table/table-schema';

@@ -9,0 +10,0 @@ export { convertToObjectRow, convertToArrayRow } from './lib/table/simple-table/row-utils';

import { getTableCell, getTableLength, getTableRowAsArray, getTableRowAsObject } from './table-accessors';
import { deduceTableSchema } from './table-schema';
import { makeColumnFromField } from './table-column';
export function convertTable(table, shape) {
switch (shape) {
case 'object-row-table':
return makeObjectRowTable(table);
case 'array-row-table':
return makeArrayRowTable(table);
case 'columnar-table':
return makeColumnarTable(table);
case 'arrow-table':
return makeArrowTable(table);
default:
throw new Error(shape);
}
}
export function makeArrowTable(table) {
var _globalThis$__luma;
const _makeArrowTable = (_globalThis$__luma = globalThis.__luma) === null || _globalThis$__luma === void 0 ? void 0 : _globalThis$__luma._makeArrowTable;
if (!_makeArrowTable) {
throw new Error('');
}
return _makeArrowTable(table);
}
export function makeColumnarTable(table) {

@@ -5,0 +27,0 @@ var _table$schema;

5

dist/index.d.ts

@@ -1,2 +0,2 @@

export type { TypedArray, TypedArrayConstructor, NumberArray, ArrayType, AnyArray } from './types/types';
export type { TypedArray, BigTypedArray, TypedArrayConstructor, BigTypedArrayConstructor, NumberArray, ArrayType, AnyArray } from './types/types';
export type { Schema, Field, DataType, Batch, SchemaMetadata, FieldMetadata } from './types/schema';

@@ -12,2 +12,3 @@ export type { Table, RowTable, ArrayRowTable, ObjectRowTable, GeoJSONRowTable, ColumnarTable, ArrowTable, Tables } from './types/category-table';

export { makeTableFromData } from './lib/table/simple-table/make-table';
export { convertTable } from './lib/table/simple-table/convert-table';
export { deduceTableSchema } from './lib/table/simple-table/table-schema';

@@ -25,3 +26,3 @@ export { convertToObjectRow, convertToArrayRow } from './lib/table/simple-table/row-utils';

export type { BinaryGeometryType, BinaryGeometry, BinaryPointGeometry, BinaryLineGeometry, BinaryPolygonGeometry, BinaryAttribute } from './types/category-gis';
export type { BinaryFeatures, BinaryPointFeatures, BinaryLineFeatures, BinaryPolygonFeatures } from './types/category-gis';
export type { BinaryFeatureCollection, BinaryFeature, BinaryPointFeature, BinaryLineFeature, BinaryPolygonFeature } from './types/category-gis';
export { Schema as ArrowLikeSchema, Field as ArrowLikeField, DataType as ArrowLikeDataType, Null, Binary, Bool, Int, Int8, Int16, Int32, Int64, Uint8, Uint16, Uint32, Uint64, Float, Float16, Float32, Float64, Utf8, Date, DateDay, DateMillisecond, Time, TimeMillisecond, TimeSecond, Timestamp, TimestampSecond, TimestampMillisecond, TimestampMicrosecond, TimestampNanosecond, Interval, IntervalDayTime, IntervalYearMonth, FixedSizeList, Struct } from './lib/table/arrow-api';

@@ -28,0 +29,0 @@ export { getTypeInfo } from './lib/table/arrow-api/get-type-info';

@@ -1,2 +0,11 @@

import { Table, ArrayRowTable, ObjectRowTable, ColumnarTable } from '../../../types/category-table';
import { Table, ArrayRowTable, ObjectRowTable, ColumnarTable, ArrowTable } from '../../../types/category-table';
export declare function convertTable(table: Table, shape: 'object-row-table'): ObjectRowTable;
export declare function convertTable(table: Table, shape: 'array-row-table'): ArrayRowTable;
export declare function convertTable(table: Table, shape: 'columnar-table'): ColumnarTable;
export declare function convertTable(table: Table, shape: 'arrow-table'): ArrowTable;
/**
* Convert a table to apache arrow format
* @note this depends on the `@loaders.gl/arrow module being imported
*/
export declare function makeArrowTable(table: Table): Table;
/** Convert any simple table into columnar format */

@@ -8,2 +17,26 @@ export declare function makeColumnarTable(table: Table): ColumnarTable;

export declare function makeObjectRowTable(table: Table): ObjectRowTable;
/**
/**
*
* @note - should be part of schema module
export function convertColumnarToRowFormatTable(columnarTable: ColumnarTable): ObjectRowTable {
const tableKeys = ;
const tableRowsCount = columnarTable[tableKeys[0]].length;
const objectRows: ObjectRowTable['data'] = [];
for (let index = 0; index < tableRowsCount; index++) {
const objectRow = {};
for (const fieldName of Object.keys(columnarTable.data)) {
objectRow[fieldName] = columnarTable[fieldName][index];
}
objectRows.push(objectRow);
}
return {
shape: 'object-row-table',
data: objectRows
};
}
*/
//# sourceMappingURL=convert-table.d.ts.map

@@ -42,14 +42,16 @@ import type { TypedArray } from './types';

};
export type BinaryPointFeatures = BinaryPointGeometry & BinaryProperties;
export type BinaryLineFeatures = BinaryLineGeometry & BinaryProperties;
export type BinaryPolygonFeatures = BinaryPolygonGeometry & BinaryProperties;
/** Binary feature + binary attributes */
export type BinaryFeature = BinaryPointFeature | BinaryLineFeature | BinaryPolygonFeature;
export type BinaryPointFeature = BinaryPointGeometry & BinaryProperties;
export type BinaryLineFeature = BinaryLineGeometry & BinaryProperties;
export type BinaryPolygonFeature = BinaryPolygonGeometry & BinaryProperties;
/**
* Represent a collection of Features, similar to a GeoJSON FeatureCollection
*/
export type BinaryFeatures = {
points?: BinaryPointFeatures;
lines?: BinaryLineFeatures;
polygons?: BinaryPolygonFeatures;
export type BinaryFeatureCollection = {
points?: BinaryPointFeature;
lines?: BinaryLineFeature;
polygons?: BinaryPolygonFeature;
};
export {};
//# sourceMappingURL=binary-geometries.d.ts.map
export type { GeoJSON, Feature, FeatureCollection, Geometry, Position, GeoJsonProperties } from 'geojson';
export type { Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection } from 'geojson';
export type { FlatGeometryType, FlatIndexedGeometry, FlatPoint, FlatLineString, FlatPolygon, FlatGeometry, FlatFeature } from './flat-geometries';
export type { BinaryAttribute, BinaryGeometryType, BinaryGeometry, BinaryPointGeometry, BinaryLineGeometry, BinaryPolygonGeometry, BinaryProperties, BinaryFeatures, BinaryPointFeatures, BinaryLineFeatures, BinaryPolygonFeatures } from './binary-geometries';
export type { BinaryAttribute, BinaryGeometryType, BinaryGeometry, BinaryPointGeometry, BinaryLineGeometry, BinaryPolygonGeometry, BinaryProperties, BinaryFeatureCollection, BinaryFeature, BinaryPointFeature, BinaryLineFeature, BinaryPolygonFeature } from './binary-geometries';
/** Aggregate information for converting GeoJSON into other formats */

@@ -6,0 +6,0 @@ export type GeojsonGeometryInfo = {

{
"name": "@loaders.gl/schema",
"version": "4.0.0-alpha.23",
"version": "4.0.0-alpha.24",
"description": "Table format APIs for JSON, CSV, etc...",

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

},
"gitHead": "e212f2a0c0e342f7cb65ce84fa2ff39f64b7d94b"
"gitHead": "97a8990595c132fb14e3445a8768d9f4cb98ff05"
}
// COMMON CATEGORY
export type {
TypedArray,
BigTypedArray,
TypedArrayConstructor,
BigTypedArrayConstructor,
NumberArray,

@@ -55,2 +57,3 @@ ArrayType,

export {makeTableFromData} from './lib/table/simple-table/make-table';
export {convertTable} from './lib/table/simple-table/convert-table';
export {deduceTableSchema} from './lib/table/simple-table/table-schema';

@@ -126,6 +129,7 @@ export {convertToObjectRow, convertToArrayRow} from './lib/table/simple-table/row-utils';

export type {
BinaryFeatures,
BinaryPointFeatures,
BinaryLineFeatures,
BinaryPolygonFeatures
BinaryFeatureCollection,
BinaryFeature,
BinaryPointFeature,
BinaryLineFeature,
BinaryPolygonFeature
} from './types/category-gis';

@@ -132,0 +136,0 @@

@@ -8,6 +8,53 @@ // loaders.gl, MIT license

} from './table-accessors';
import {Table, ArrayRowTable, ObjectRowTable, ColumnarTable} from '../../../types/category-table';
import {
Table,
ArrayRowTable,
ObjectRowTable,
ColumnarTable,
ArrowTable
} from '../../../types/category-table';
import {deduceTableSchema} from './table-schema';
import {makeColumnFromField} from './table-column';
export function convertTable(table: Table, shape: 'object-row-table'): ObjectRowTable;
export function convertTable(table: Table, shape: 'array-row-table'): ArrayRowTable;
export function convertTable(table: Table, shape: 'columnar-table'): ColumnarTable;
export function convertTable(table: Table, shape: 'arrow-table'): ArrowTable;
/**
* Convert a table to a different shape
* @param table
* @param shape
* @returns
*/
export function convertTable(
table: Table,
shape: 'object-row-table' | 'array-row-table' | 'columnar-table' | 'arrow-table'
) {
switch (shape) {
case 'object-row-table':
return makeObjectRowTable(table);
case 'array-row-table':
return makeArrayRowTable(table);
case 'columnar-table':
return makeColumnarTable(table);
case 'arrow-table':
return makeArrowTable(table);
default:
throw new Error(shape);
}
}
/**
* Convert a table to apache arrow format
* @note this depends on the `@loaders.gl/arrow module being imported
*/
export function makeArrowTable(table: Table): Table {
const _makeArrowTable = globalThis.__luma?._makeArrowTable;
if (!_makeArrowTable) {
throw new Error('');
}
return _makeArrowTable(table);
}
/** Convert any simple table into columnar format */

@@ -74,1 +121,26 @@ export function makeColumnarTable(table: Table): ColumnarTable {

}
/**
/**
*
* @note - should be part of schema module
export function convertColumnarToRowFormatTable(columnarTable: ColumnarTable): ObjectRowTable {
const tableKeys = ;
const tableRowsCount = columnarTable[tableKeys[0]].length;
const objectRows: ObjectRowTable['data'] = [];
for (let index = 0; index < tableRowsCount; index++) {
const objectRow = {};
for (const fieldName of Object.keys(columnarTable.data)) {
objectRow[fieldName] = columnarTable[fieldName][index];
}
objectRows.push(objectRow);
}
return {
shape: 'object-row-table',
data: objectRows
};
}
*/

@@ -48,13 +48,16 @@ // GIS

export type BinaryPointFeatures = BinaryPointGeometry & BinaryProperties;
export type BinaryLineFeatures = BinaryLineGeometry & BinaryProperties;
export type BinaryPolygonFeatures = BinaryPolygonGeometry & BinaryProperties;
/** Binary feature + binary attributes */
export type BinaryFeature = BinaryPointFeature | BinaryLineFeature | BinaryPolygonFeature;
export type BinaryPointFeature = BinaryPointGeometry & BinaryProperties;
export type BinaryLineFeature = BinaryLineGeometry & BinaryProperties;
export type BinaryPolygonFeature = BinaryPolygonGeometry & BinaryProperties;
/**
* Represent a collection of Features, similar to a GeoJSON FeatureCollection
*/
export type BinaryFeatures = {
points?: BinaryPointFeatures;
lines?: BinaryLineFeatures;
polygons?: BinaryPolygonFeatures;
export type BinaryFeatureCollection = {
points?: BinaryPointFeature;
lines?: BinaryLineFeature;
polygons?: BinaryPolygonFeature;
};

@@ -43,6 +43,7 @@ // GIS

BinaryProperties,
BinaryFeatures,
BinaryPointFeatures,
BinaryLineFeatures,
BinaryPolygonFeatures
BinaryFeatureCollection,
BinaryFeature,
BinaryPointFeature,
BinaryLineFeature,
BinaryPolygonFeature
} from './binary-geometries';

@@ -49,0 +50,0 @@

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

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