@loaders.gl/csv 4.4.0-alpha.1 → 4.4.0-alpha.10

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.
@@ -22,3 +22,4 @@ export default {
22
22
  Parser,
23
23
  ParserHandle
24
24
  };
25
+ //# sourceMappingURL=papaparse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"papaparse.js","sourceRoot":"","sources":["../../src/papaparse/papaparse.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AACpC,kCAAkC;AAElC,8DAA8D;AAC9D,qCAAqC;AAErC,gBAAgB;AAChB,sBAAsB;AACtB,wCAAwC;AACxC,6EAA6E;AAC7E,yEAAyE;AACzE,wCAAwC;AAExC,OAAO,EAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAC,yBAAsB;AAC7E,OAAO,EAAC,SAAS,EAAC,yBAAsB;AACxC,OAAO,EAAC,IAAI,EAAC,4BAAyB;AAKtC,eAAe;IACb,GAAG,IAAI;IAEP,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAElB,aAAa;IAEb,2CAA2C;IAC3C,MAAM;IACN,YAAY;CACb,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/csv",
3
- "version": "4.4.0-alpha.1",
3
+ "version": "4.4.0-alpha.10",
4
4
  "description": "Framework-independent loader for CSV and DSV table formats",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -44,12 +44,12 @@
44
44
  "build-bundle-dev": "ocular-bundle ./bundle.ts --env=dev --output=dist/dist.dev.js"
45
45
  },
46
46
  "dependencies": {
47
- "@loaders.gl/loader-utils": "4.4.0-alpha.1",
48
- "@loaders.gl/schema": "4.4.0-alpha.1",
47
+ "@loaders.gl/loader-utils": "4.4.0-alpha.10",
48
+ "@loaders.gl/schema": "4.4.0-alpha.10",
49
49
  "d3-dsv": "^1.2.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "@loaders.gl/core": "4.4.0-alpha.0"
52
+ "@loaders.gl/core": "4.4.0-alpha.1"
53
53
  },
54
- "gitHead": "f1732de45907bd500bf4eedb4803beca8bf4bfb0"
54
+ "gitHead": "7b4dc3fdbaed20a2597c70c57efdcda5c404147f"
55
55
  }
@@ -33,7 +33,9 @@ async function parseCSVToArrow(csvText: string, options?: CSVLoaderOptions): Pro
33
33
  }
34
34
 
35
35
  function parseCSVToArrowBatches(
36
- asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,
36
+ asyncIterator:
37
+ | AsyncIterable<ArrayBufferLike | ArrayBufferView>
38
+ | Iterable<ArrayBufferLike | ArrayBufferView>,
37
39
  options?: CSVArrowLoaderOptions
38
40
  ): AsyncIterable<ArrowTableBatch> {
39
41
  const tableIterator = CSVLoader.parseInBatches(asyncIterator, options);
package/src/csv-loader.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
6
6
  import type {Schema, ArrayRowTable, ObjectRowTable, TableBatch} from '@loaders.gl/schema';
7
7
 
8
- import {log} from '@loaders.gl/loader-utils';
8
+ import {log, toArrayBufferIterator} from '@loaders.gl/loader-utils';
9
9
  import {
10
10
  AsyncQueue,
11
11
  deduceTableSchema,
@@ -133,14 +133,16 @@ async function parseCSV(
133
133
 
134
134
  // TODO - support batch size 0 = no batching/single batch?
135
135
  function parseCSVInBatches(
136
- asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,
136
+ asyncIterator:
137
+ | AsyncIterable<ArrayBufferLike | ArrayBufferView>
138
+ | Iterable<ArrayBufferLike | ArrayBufferView>,
137
139
  options?: CSVLoaderOptions
138
140
  ): AsyncIterable<TableBatch> {
139
141
  // Papaparse does not support standard batch size handling
140
142
  // TODO - investigate papaparse chunks mode
141
143
  options = {...options};
142
- if (options.batchSize === 'auto') {
143
- options.batchSize = 4000;
144
+ if (options?.core?.batchSize === 'auto') {
145
+ options.core.batchSize = 4000;
144
146
  }
145
147
 
146
148
  // Apps can call the parse method directly, we so apply default options here
@@ -208,7 +210,7 @@ function parseCSVInBatches(
208
210
  row = JSON.parse(JSON.stringify(row));
209
211
  }
210
212
 
211
- const shape = csvOptions.shape || DEFAULT_CSV_SHAPE;
213
+ const shape = (options as any)?.shape || csvOptions.shape || DEFAULT_CSV_SHAPE;
212
214
 
213
215
  // Add the row
214
216
  tableBatchBuilder =
@@ -218,7 +220,7 @@ function parseCSVInBatches(
218
220
  schema,
219
221
  {
220
222
  shape,
221
- ...options
223
+ ...(options?.core || {})
222
224
  }
223
225
  );
224
226
 
@@ -251,7 +253,7 @@ function parseCSVInBatches(
251
253
  }
252
254
  };
253
255
 
254
- Papa.parse(asyncIterator, config, AsyncIteratorStreamer);
256
+ Papa.parse(toArrayBufferIterator(asyncIterator), config, AsyncIteratorStreamer);
255
257
 
256
258
  // TODO - Does it matter if we return asyncIterable or asyncIterator
257
259
  // return asyncQueue[Symbol.asyncIterator]();