@kepler.gl/processors 3.0.0-alpha.2 → 3.1.0-alpha.0

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kepler.gl/processors",
3
3
  "author": "Shan He <shan@uber.com>",
4
- "version": "3.0.0-alpha.2",
4
+ "version": "3.1.0-alpha.0",
5
5
  "description": "kepler.gl constants used by kepler.gl components, actions and reducers",
6
6
  "license": "MIT",
7
7
  "main": "dist/index.js",
@@ -31,15 +31,19 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@danmarshall/deckgl-typings": "4.9.22",
34
- "@kepler.gl/constants": "3.0.0-alpha.2",
35
- "@kepler.gl/schemas": "3.0.0-alpha.2",
36
- "@kepler.gl/types": "3.0.0-alpha.2",
37
- "@kepler.gl/utils": "3.0.0-alpha.2",
38
- "@loaders.gl/arrow": "^4.1.0-alpha.4",
39
- "@loaders.gl/core": "^4.1.0-alpha.4",
40
- "@loaders.gl/csv": "^4.1.0-alpha.4",
41
- "@loaders.gl/json": "^4.1.0-alpha.4",
42
- "@loaders.gl/loader-utils": "^4.1.0-alpha.4",
34
+ "@kepler.gl/common-utils": "3.1.0-alpha.0",
35
+ "@kepler.gl/constants": "3.1.0-alpha.0",
36
+ "@kepler.gl/schemas": "3.1.0-alpha.0",
37
+ "@kepler.gl/table": "3.1.0-alpha.0",
38
+ "@kepler.gl/types": "3.1.0-alpha.0",
39
+ "@kepler.gl/utils": "3.1.0-alpha.0",
40
+ "@loaders.gl/arrow": "^4.3.2",
41
+ "@loaders.gl/core": "^4.3.2",
42
+ "@loaders.gl/csv": "^4.3.2",
43
+ "@loaders.gl/gis": "^4.3.2",
44
+ "@loaders.gl/json": "^4.3.2",
45
+ "@loaders.gl/loader-utils": "^4.3.2",
46
+ "@loaders.gl/parquet": "^4.3.2",
43
47
  "@mapbox/geojson-normalize": "0.0.1",
44
48
  "@nebula.gl/edit-modes": "1.0.2-alpha.1",
45
49
  "@turf/helpers": "^6.1.4",
@@ -49,15 +53,16 @@
49
53
  "sourceMap": false,
50
54
  "instrument": false
51
55
  },
52
- "engines": {
53
- "node": ">=18.18.2"
54
- },
55
56
  "maintainers": [
56
57
  "Shan He <heshan0131@gmail.com>",
57
58
  "Giuseppe Macri <gmacri@uber.com>"
58
59
  ],
60
+ "engines": {
61
+ "node": ">=18"
62
+ },
59
63
  "volta": {
60
64
  "node": "18.18.2",
61
- "yarn": "1.22.17"
62
- }
65
+ "yarn": "4.4.0"
66
+ },
67
+ "packageManager": "yarn@4.4.0"
63
68
  }
@@ -1,190 +0,0 @@
1
- import * as arrow from 'apache-arrow';
2
- import { ArrowTable } from '@loaders.gl/schema';
3
- import { ProcessorResult, Field } from '@kepler.gl/types';
4
- import { isPlainObject, analyzerTypeToFieldType, getFieldsFromData } from '@kepler.gl/utils';
5
- import { ParsedDataset, SavedMap, LoadedMap } from '@kepler.gl/schemas';
6
- export declare const CSV_NULLS: RegExp;
7
- declare function tryParseJsonString(str: any): any;
8
- export declare const PARSE_FIELD_VALUE_FROM_STRING: {
9
- boolean: {
10
- valid: (d: unknown) => boolean;
11
- parse: (d: unknown) => boolean;
12
- };
13
- integer: {
14
- valid: (d: unknown) => boolean;
15
- parse: (d: unknown) => number;
16
- };
17
- timestamp: {
18
- valid: (d: unknown, field: Field) => boolean;
19
- parse: (d: any, field: Field) => any;
20
- };
21
- real: {
22
- valid: (d: unknown) => boolean;
23
- parse: typeof parseFloat;
24
- };
25
- object: {
26
- valid: typeof isPlainObject;
27
- parse: typeof tryParseJsonString;
28
- };
29
- array: {
30
- valid: (arg: any) => arg is any[];
31
- parse: typeof tryParseJsonString;
32
- };
33
- };
34
- /**
35
- * Process csv data, output a data object with `{fields: [], rows: []}`.
36
- * The data object can be wrapped in a `dataset` and pass to [`addDataToMap`](../actions/actions.md#adddatatomap)
37
- * @param rawData raw csv string
38
- * @returns data object `{fields: [], rows: []}` can be passed to addDataToMaps
39
- * @public
40
- * @example
41
- * import {processCsvData} from 'kepler.gl/processors';
42
- *
43
- * const testData = `gps_data.utc_timestamp,gps_data.lat,gps_data.lng,gps_data.types,epoch,has_result,id,time,begintrip_ts_utc,begintrip_ts_local,date
44
- * 2016-09-17 00:09:55,29.9900937,31.2590542,driver_analytics,1472688000000,False,1,2016-09-23T00:00:00.000Z,2016-10-01 09:41:39+00:00,2016-10-01 09:41:39+00:00,2016-09-23
45
- * 2016-09-17 00:10:56,29.9927699,31.2461142,driver_analytics,1472688000000,False,2,2016-09-23T00:00:00.000Z,2016-10-01 09:46:37+00:00,2016-10-01 16:46:37+00:00,2016-09-23
46
- * 2016-09-17 00:11:56,29.9907261,31.2312742,driver_analytics,1472688000000,False,3,2016-09-23T00:00:00.000Z,,,2016-09-23
47
- * 2016-09-17 00:12:58,29.9870074,31.2175827,driver_analytics,1472688000000,False,4,2016-09-23T00:00:00.000Z,,,2016-09-23`
48
- *
49
- * const dataset = {
50
- * info: {id: 'test_data', label: 'My Csv'},
51
- * data: processCsvData(testData)
52
- * };
53
- *
54
- * dispatch(addDataToMap({
55
- * datasets: [dataset],
56
- * options: {centerMap: true, readOnly: true}
57
- * }));
58
- */
59
- export declare function processCsvData(rawData: unknown[][] | string, header?: string[]): ProcessorResult;
60
- /**
61
- * Parse rows of csv by analyzed field types. So that `'1'` -> `1`, `'True'` -> `true`
62
- * @param rows
63
- * @param fields
64
- */
65
- export declare function parseRowsByFields(rows: any[][], fields: Field[]): any[][];
66
- /**
67
- * Process uploaded csv file to parse value by field type
68
- *
69
- * @param rows
70
- * @param geoFieldIdx field index
71
- * @param field
72
- * @param i
73
- */
74
- export declare function parseCsvRowsByFieldType(rows: unknown[][], geoFieldIdx: number, field: Field, i: number): void;
75
- /**
76
- * Process data where each row is an object, output can be passed to [`addDataToMap`](../actions/actions.md#adddatatomap)
77
- * NOTE: This function may mutate input.
78
- * @param rawData an array of row object, each object should have the same number of keys
79
- * @returns dataset containing `fields` and `rows`
80
- * @public
81
- * @example
82
- * import {addDataToMap} from 'kepler.gl/actions';
83
- * import {processRowObject} from 'kepler.gl/processors';
84
- *
85
- * const data = [
86
- * {lat: 31.27, lng: 127.56, value: 3},
87
- * {lat: 31.22, lng: 126.26, value: 1}
88
- * ];
89
- *
90
- * dispatch(addDataToMap({
91
- * datasets: {
92
- * info: {label: 'My Data', id: 'my_data'},
93
- * data: processRowObject(data)
94
- * }
95
- * }));
96
- */
97
- export declare function processRowObject(rawData: unknown[]): ProcessorResult;
98
- /**
99
- * Process GeoJSON [`FeatureCollection`](http://wiki.geojson.org/GeoJSON_draft_version_6#FeatureCollection),
100
- * output a data object with `{fields: [], rows: []}`.
101
- * The data object can be wrapped in a `dataset` and passed to [`addDataToMap`](../actions/actions.md#adddatatomap)
102
- * NOTE: This function may mutate input.
103
- *
104
- * @param rawData raw geojson feature collection
105
- * @returns dataset containing `fields` and `rows`
106
- * @public
107
- * @example
108
- * import {addDataToMap} from 'kepler.gl/actions';
109
- * import {processGeojson} from 'kepler.gl/processors';
110
- *
111
- * const geojson = {
112
- * "type" : "FeatureCollection",
113
- * "features" : [{
114
- * "type" : "Feature",
115
- * "properties" : {
116
- * "capacity" : "10",
117
- * "type" : "U-Rack"
118
- * },
119
- * "geometry" : {
120
- * "type" : "Point",
121
- * "coordinates" : [ -71.073283, 42.417500 ]
122
- * }
123
- * }]
124
- * };
125
- *
126
- * dispatch(addDataToMap({
127
- * datasets: {
128
- * info: {
129
- * label: 'Sample Taxi Trips in New York City',
130
- * id: 'test_trip_data'
131
- * },
132
- * data: processGeojson(geojson)
133
- * }
134
- * }));
135
- */
136
- export declare function processGeojson(rawData: unknown): ProcessorResult;
137
- /**
138
- * Process saved kepler.gl json to be pass to [`addDataToMap`](../actions/actions.md#adddatatomap).
139
- * The json object should contain `datasets` and `config`.
140
- * @param rawData
141
- * @param schema
142
- * @returns datasets and config `{datasets: {}, config: {}}`
143
- * @public
144
- * @example
145
- * import {addDataToMap} from 'kepler.gl/actions';
146
- * import {processKeplerglJSON} from 'kepler.gl/processors';
147
- *
148
- * dispatch(addDataToMap(processKeplerglJSON(keplerGlJson)));
149
- */
150
- export declare function processKeplerglJSON(rawData: SavedMap, schema?: import("@kepler.gl/schemas").KeplerGLSchemaClass): LoadedMap | null;
151
- /**
152
- * Parse a single or an array of datasets saved using kepler.gl schema
153
- * @param rawData
154
- * @param schema
155
- */
156
- export declare function processKeplerglDataset(rawData: object | object[], schema?: import("@kepler.gl/schemas").KeplerGLSchemaClass): ParsedDataset | ParsedDataset[] | null;
157
- /**
158
- * Parse arrow table and return a dataset
159
- *
160
- * @param arrowTable ArrowTable to parse, see loaders.gl/schema
161
- * @returns dataset containing `fields` and `rows` or null
162
- */
163
- export declare function processArrowTable(arrowTable: ArrowTable): ProcessorResult | null;
164
- /**
165
- * Parse arrow batches returned from parseInBatches()
166
- *
167
- * @param arrowTable the arrow table to parse
168
- * @returns dataset containing `fields` and `rows` or null
169
- */
170
- export declare function processArrowBatches(arrowBatches: arrow.RecordBatch[]): ProcessorResult | null;
171
- export declare const DATASET_HANDLERS: {
172
- row: typeof processRowObject;
173
- geojson: typeof processGeojson;
174
- csv: typeof processCsvData;
175
- arrow: typeof processArrowTable;
176
- keplergl: typeof processKeplerglDataset;
177
- };
178
- export declare const Processors: {
179
- processGeojson: typeof processGeojson;
180
- processCsvData: typeof processCsvData;
181
- processArrowTable: typeof processArrowTable;
182
- processArrowBatches: typeof processArrowBatches;
183
- processRowObject: typeof processRowObject;
184
- processKeplerglJSON: typeof processKeplerglJSON;
185
- processKeplerglDataset: typeof processKeplerglDataset;
186
- analyzerTypeToFieldType: typeof analyzerTypeToFieldType;
187
- getFieldsFromData: typeof getFieldsFromData;
188
- parseCsvRowsByFieldType: typeof parseCsvRowsByFieldType;
189
- };
190
- export {};