@loaders.gl/csv 4.0.0-alpha.21 → 4.0.0-alpha.23
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/dist/dist.min.js +28 -26
- package/dist/es5/csv-loader.js +33 -30
- package/dist/es5/csv-loader.js.map +1 -1
- package/dist/esm/csv-loader.js +28 -28
- package/dist/esm/csv-loader.js.map +1 -1
- package/dist/src/bundle.d.ts.map +1 -0
- package/dist/{csv-loader.d.ts → src/csv-loader.d.ts} +1 -1
- package/dist/src/csv-loader.d.ts.map +1 -0
- package/dist/{csv-loader.js → src/csv-loader.js} +32 -42
- package/dist/src/csv-writer.d.ts.map +1 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/lib/encoders/encode-csv.d.ts.map +1 -0
- package/dist/src/papaparse/async-iterator-streamer.d.ts.map +1 -0
- package/dist/src/papaparse/papaparse.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +4 -4
- package/src/csv-loader.ts +44 -53
- package/dist/bundle.d.ts.map +0 -1
- package/dist/csv-loader.d.ts.map +0 -1
- package/dist/csv-writer.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/encoders/encode-csv.d.ts.map +0 -1
- package/dist/papaparse/async-iterator-streamer.d.ts.map +0 -1
- package/dist/papaparse/papaparse.d.ts.map +0 -1
- /package/dist/{bundle.d.ts → src/bundle.d.ts} +0 -0
- /package/dist/{bundle.js → src/bundle.js} +0 -0
- /package/dist/{csv-writer.d.ts → src/csv-writer.d.ts} +0 -0
- /package/dist/{csv-writer.js → src/csv-writer.js} +0 -0
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{index.js → src/index.js} +0 -0
- /package/dist/{lib → src/lib}/encoders/encode-csv.d.ts +0 -0
- /package/dist/{lib → src/lib}/encoders/encode-csv.js +0 -0
- /package/dist/{papaparse → src/papaparse}/async-iterator-streamer.d.ts +0 -0
- /package/dist/{papaparse → src/papaparse}/async-iterator-streamer.js +0 -0
- /package/dist/{papaparse → src/papaparse}/papaparse.d.ts +0 -0
- /package/dist/{papaparse → src/papaparse}/papaparse.js +0 -0
package/dist/dist.min.js
CHANGED
|
@@ -1382,7 +1382,7 @@
|
|
|
1382
1382
|
|
|
1383
1383
|
// src/csv-loader.ts
|
|
1384
1384
|
async function parseCSV(csvText, options) {
|
|
1385
|
-
const csvOptions = { ...
|
|
1385
|
+
const csvOptions = { ...CSVLoader.options.csv, ...options?.csv };
|
|
1386
1386
|
const firstRow = readFirstRow(csvText);
|
|
1387
1387
|
const header = csvOptions.header === "auto" ? isHeaderRow(firstRow) : Boolean(csvOptions.header);
|
|
1388
1388
|
const parseWithHeader = header;
|
|
@@ -1396,25 +1396,28 @@
|
|
|
1396
1396
|
}
|
|
1397
1397
|
};
|
|
1398
1398
|
const result = papaparse_default.parse(csvText, papaparseConfig);
|
|
1399
|
-
|
|
1399
|
+
const rows = result.data;
|
|
1400
1400
|
const headerRow = result.meta.fields || generateHeader(csvOptions.columnPrefix, firstRow.length);
|
|
1401
|
-
switch (csvOptions.shape) {
|
|
1401
|
+
switch (csvOptions.shape || "object-row-table") {
|
|
1402
1402
|
case "object-row-table":
|
|
1403
|
-
|
|
1404
|
-
|
|
1403
|
+
return {
|
|
1404
|
+
shape: "object-row-table",
|
|
1405
|
+
data: rows.map((row) => Array.isArray(row) ? convertToObjectRow(row, headerRow) : row)
|
|
1406
|
+
};
|
|
1405
1407
|
case "array-row-table":
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1408
|
+
return {
|
|
1409
|
+
shape: "array-row-table",
|
|
1410
|
+
data: rows.map((row) => Array.isArray(row) ? row : convertToArrayRow(row, headerRow))
|
|
1411
|
+
};
|
|
1409
1412
|
}
|
|
1410
|
-
|
|
1413
|
+
throw new Error(csvOptions.shape);
|
|
1411
1414
|
}
|
|
1412
1415
|
function parseCSVInBatches(asyncIterator, options) {
|
|
1413
1416
|
options = { ...options };
|
|
1414
1417
|
if (options.batchSize === "auto") {
|
|
1415
1418
|
options.batchSize = 4e3;
|
|
1416
1419
|
}
|
|
1417
|
-
const csvOptions = { ...
|
|
1420
|
+
const csvOptions = { ...CSVLoader.options.csv, ...options?.csv };
|
|
1418
1421
|
const asyncQueue = new AsyncQueue();
|
|
1419
1422
|
let isFirstRow = true;
|
|
1420
1423
|
let headerRow = null;
|
|
@@ -1530,27 +1533,13 @@
|
|
|
1530
1533
|
}
|
|
1531
1534
|
return schema;
|
|
1532
1535
|
}
|
|
1533
|
-
var VERSION,
|
|
1536
|
+
var VERSION, CSVLoader;
|
|
1534
1537
|
var init_csv_loader = __esm({
|
|
1535
1538
|
"src/csv-loader.ts"() {
|
|
1536
1539
|
init_src();
|
|
1537
1540
|
init_papaparse();
|
|
1538
1541
|
init_async_iterator_streamer();
|
|
1539
1542
|
VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
1540
|
-
DEFAULT_CSV_LOADER_OPTIONS = {
|
|
1541
|
-
csv: {
|
|
1542
|
-
shape: "object-row-table",
|
|
1543
|
-
optimizeMemoryUsage: false,
|
|
1544
|
-
header: "auto",
|
|
1545
|
-
columnPrefix: "column",
|
|
1546
|
-
quoteChar: '"',
|
|
1547
|
-
escapeChar: '"',
|
|
1548
|
-
dynamicTyping: true,
|
|
1549
|
-
comments: false,
|
|
1550
|
-
skipEmptyLines: true,
|
|
1551
|
-
delimitersToGuess: [",", " ", "|", ";"]
|
|
1552
|
-
}
|
|
1553
|
-
};
|
|
1554
1543
|
CSVLoader = {
|
|
1555
1544
|
id: "csv",
|
|
1556
1545
|
module: "csv",
|
|
@@ -1562,7 +1551,20 @@
|
|
|
1562
1551
|
parse: async (arrayBuffer, options) => parseCSV(new TextDecoder().decode(arrayBuffer), options),
|
|
1563
1552
|
parseText: (text, options) => parseCSV(text, options),
|
|
1564
1553
|
parseInBatches: parseCSVInBatches,
|
|
1565
|
-
options:
|
|
1554
|
+
options: {
|
|
1555
|
+
csv: {
|
|
1556
|
+
shape: "object-row-table",
|
|
1557
|
+
optimizeMemoryUsage: false,
|
|
1558
|
+
header: "auto",
|
|
1559
|
+
columnPrefix: "column",
|
|
1560
|
+
quoteChar: '"',
|
|
1561
|
+
escapeChar: '"',
|
|
1562
|
+
dynamicTyping: true,
|
|
1563
|
+
comments: false,
|
|
1564
|
+
skipEmptyLines: true,
|
|
1565
|
+
delimitersToGuess: [",", " ", "|", ";"]
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1566
1568
|
};
|
|
1567
1569
|
}
|
|
1568
1570
|
});
|
package/dist/es5/csv-loader.js
CHANGED
|
@@ -14,21 +14,7 @@ var _papaparse = _interopRequireDefault(require("./papaparse/papaparse"));
|
|
|
14
14
|
var _asyncIteratorStreamer = _interopRequireDefault(require("./papaparse/async-iterator-streamer"));
|
|
15
15
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
16
|
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; }
|
|
17
|
-
var VERSION = typeof "4.0.0-alpha.
|
|
18
|
-
var DEFAULT_CSV_LOADER_OPTIONS = {
|
|
19
|
-
csv: {
|
|
20
|
-
shape: 'object-row-table',
|
|
21
|
-
optimizeMemoryUsage: false,
|
|
22
|
-
header: 'auto',
|
|
23
|
-
columnPrefix: 'column',
|
|
24
|
-
quoteChar: '"',
|
|
25
|
-
escapeChar: '"',
|
|
26
|
-
dynamicTyping: true,
|
|
27
|
-
comments: false,
|
|
28
|
-
skipEmptyLines: true,
|
|
29
|
-
delimitersToGuess: [',', '\t', '|', ';']
|
|
30
|
-
}
|
|
31
|
-
};
|
|
17
|
+
var VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
|
|
32
18
|
var CSVLoader = {
|
|
33
19
|
id: 'csv',
|
|
34
20
|
module: 'csv',
|
|
@@ -58,7 +44,20 @@ var CSVLoader = {
|
|
|
58
44
|
return parseCSV(text, options);
|
|
59
45
|
},
|
|
60
46
|
parseInBatches: parseCSVInBatches,
|
|
61
|
-
options:
|
|
47
|
+
options: {
|
|
48
|
+
csv: {
|
|
49
|
+
shape: 'object-row-table',
|
|
50
|
+
optimizeMemoryUsage: false,
|
|
51
|
+
header: 'auto',
|
|
52
|
+
columnPrefix: 'column',
|
|
53
|
+
quoteChar: '"',
|
|
54
|
+
escapeChar: '"',
|
|
55
|
+
dynamicTyping: true,
|
|
56
|
+
comments: false,
|
|
57
|
+
skipEmptyLines: true,
|
|
58
|
+
delimitersToGuess: [',', '\t', '|', ';']
|
|
59
|
+
}
|
|
60
|
+
}
|
|
62
61
|
};
|
|
63
62
|
exports.CSVLoader = CSVLoader;
|
|
64
63
|
function parseCSV(_x3, _x4) {
|
|
@@ -70,7 +69,7 @@ function _parseCSV() {
|
|
|
70
69
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
71
70
|
while (1) switch (_context2.prev = _context2.next) {
|
|
72
71
|
case 0:
|
|
73
|
-
csvOptions = _objectSpread(_objectSpread({},
|
|
72
|
+
csvOptions = _objectSpread(_objectSpread({}, CSVLoader.options.csv), options === null || options === void 0 ? void 0 : options.csv);
|
|
74
73
|
firstRow = readFirstRow(csvText);
|
|
75
74
|
header = csvOptions.header === 'auto' ? isHeaderRow(firstRow) : Boolean(csvOptions.header);
|
|
76
75
|
parseWithHeader = header;
|
|
@@ -85,22 +84,26 @@ function _parseCSV() {
|
|
|
85
84
|
result = _papaparse.default.parse(csvText, papaparseConfig);
|
|
86
85
|
rows = result.data;
|
|
87
86
|
headerRow = result.meta.fields || generateHeader(csvOptions.columnPrefix, firstRow.length);
|
|
88
|
-
_context2.t0 = csvOptions.shape;
|
|
89
|
-
_context2.next = _context2.t0 === 'object-row-table' ? 11 : _context2.t0 === 'array-row-table' ?
|
|
87
|
+
_context2.t0 = csvOptions.shape || 'object-row-table';
|
|
88
|
+
_context2.next = _context2.t0 === 'object-row-table' ? 11 : _context2.t0 === 'array-row-table' ? 12 : 13;
|
|
90
89
|
break;
|
|
91
90
|
case 11:
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
return _context2.abrupt("return", {
|
|
92
|
+
shape: 'object-row-table',
|
|
93
|
+
data: rows.map(function (row) {
|
|
94
|
+
return Array.isArray(row) ? (0, _schema.convertToObjectRow)(row, headerRow) : row;
|
|
95
|
+
})
|
|
94
96
|
});
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
case 12:
|
|
98
|
+
return _context2.abrupt("return", {
|
|
99
|
+
shape: 'array-row-table',
|
|
100
|
+
data: rows.map(function (row) {
|
|
101
|
+
return Array.isArray(row) ? row : (0, _schema.convertToArrayRow)(row, headerRow);
|
|
102
|
+
})
|
|
99
103
|
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
case 16:
|
|
104
|
+
case 13:
|
|
105
|
+
throw new Error(csvOptions.shape);
|
|
106
|
+
case 14:
|
|
104
107
|
case "end":
|
|
105
108
|
return _context2.stop();
|
|
106
109
|
}
|
|
@@ -114,7 +117,7 @@ function parseCSVInBatches(asyncIterator, options) {
|
|
|
114
117
|
if (options.batchSize === 'auto') {
|
|
115
118
|
options.batchSize = 4000;
|
|
116
119
|
}
|
|
117
|
-
var csvOptions = _objectSpread(_objectSpread({},
|
|
120
|
+
var csvOptions = _objectSpread(_objectSpread({}, CSVLoader.options.csv), (_options = options) === null || _options === void 0 ? void 0 : _options.csv);
|
|
118
121
|
var asyncQueue = new _schema.AsyncQueue();
|
|
119
122
|
var isFirstRow = true;
|
|
120
123
|
var headerRow = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csv-loader.js","names":["_schema","require","_papaparse","_interopRequireDefault","_asyncIteratorStreamer","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","VERSION","DEFAULT_CSV_LOADER_OPTIONS","csv","shape","optimizeMemoryUsage","header","columnPrefix","quoteChar","escapeChar","dynamicTyping","comments","skipEmptyLines","delimitersToGuess","CSVLoader","id","module","name","version","extensions","mimeTypes","category","parse","_parse","_asyncToGenerator2","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseCSV","TextDecoder","decode","stop","_x","_x2","parseText","text","parseInBatches","parseCSVInBatches","exports","_x3","_x4","_parseCSV","_callee2","csvText","csvOptions","firstRow","parseWithHeader","papaparseConfig","result","rows","headerRow","_callee2$","_context2","readFirstRow","isHeaderRow","Boolean","download","transformHeader","duplicateColumnTransformer","undefined","error","e","Error","Papa","data","meta","fields","generateHeader","t0","map","row","Array","isArray","convertToObjectRow","convertToArrayRow","asyncIterator","_options","batchSize","asyncQueue","AsyncQueue","isFirstRow","tableBatchBuilder","schema","config","chunkSize","step","results","collapsedRow","flat","join","trim","bytesUsed","cursor","deduceSchema","JSON","stringify","TableBatchBuilder","addRow","batch","getFullBatch","enqueue","complete","getFinalBatch","close","AsyncIteratorStreamer","every","value","preview","observedColumns","Set","col","colName","counter","has","concat","add","count","headers","columnName","_typeof2","String","index","type","Float32Array"],"sources":["../../src/csv-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {Batch, TableBatch} from '@loaders.gl/schema';\n\nimport {\n AsyncQueue,\n Table,\n TableBatchBuilder,\n convertToArrayRow,\n convertToObjectRow\n} from '@loaders.gl/schema';\nimport Papa from './papaparse/papaparse';\nimport AsyncIteratorStreamer from './papaparse/async-iterator-streamer';\n\ntype ObjectField = {name: string; index: number; type: any};\ntype ObjectSchema = {[key: string]: ObjectField} | ObjectField[];\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type CSVLoaderOptions = LoaderOptions & {\n csv?: {\n // loaders.gl options\n shape?: 'array-row-table' | 'object-row-table' | 'columnar-table';\n /** optimizes memory usage but increases parsing time. */\n optimizeMemoryUsage?: boolean;\n columnPrefix?: string;\n header?: 'auto';\n\n // CSV options (papaparse)\n // delimiter: auto\n // newline: auto\n quoteChar?: string;\n escapeChar?: string;\n // Convert numbers and boolean values in rows from strings\n dynamicTyping?: boolean;\n comments?: boolean;\n skipEmptyLines?: boolean | 'greedy';\n // transform: null?\n delimitersToGuess?: string[];\n // fastMode: auto\n };\n};\n\nconst DEFAULT_CSV_LOADER_OPTIONS = {\n csv: {\n shape: 'object-row-table',\n optimizeMemoryUsage: false,\n // CSV options\n header: 'auto',\n columnPrefix: 'column',\n // delimiter: auto\n // newline: auto\n quoteChar: '\"',\n escapeChar: '\"',\n dynamicTyping: true,\n comments: false,\n skipEmptyLines: true,\n // transform: null?\n delimitersToGuess: [',', '\\t', '|', ';']\n // fastMode: auto\n }\n};\n\nexport const CSVLoader: LoaderWithParser<Table, TableBatch, CSVLoaderOptions> = {\n id: 'csv',\n module: 'csv',\n name: 'CSV',\n version: VERSION,\n extensions: ['csv', 'tsv', 'dsv'],\n mimeTypes: ['text/csv', 'text/tab-separated-values', 'text/dsv'],\n category: 'table',\n parse: async (arrayBuffer: ArrayBuffer, options?: CSVLoaderOptions) =>\n parseCSV(new TextDecoder().decode(arrayBuffer), options),\n parseText: (text: string, options?: CSVLoaderOptions) => parseCSV(text, options),\n parseInBatches: parseCSVInBatches,\n // @ts-ignore\n // testText: null,\n options: DEFAULT_CSV_LOADER_OPTIONS as CSVLoaderOptions\n};\n\nasync function parseCSV(csvText: string, options?: CSVLoaderOptions) {\n // Apps can call the parse method directly, we so apply default options here\n const csvOptions = {...DEFAULT_CSV_LOADER_OPTIONS.csv, ...options?.csv};\n\n const firstRow = readFirstRow(csvText);\n const header: boolean =\n csvOptions.header === 'auto' ? isHeaderRow(firstRow) : Boolean(csvOptions.header);\n\n const parseWithHeader = header;\n\n const papaparseConfig = {\n // dynamicTyping: true,\n ...csvOptions,\n header: parseWithHeader,\n download: false, // We handle loading, no need for papaparse to do it for us\n transformHeader: parseWithHeader ? duplicateColumnTransformer() : undefined,\n error: (e) => {\n throw new Error(e);\n }\n };\n\n const result = Papa.parse(csvText, papaparseConfig);\n let {data: rows} = result;\n\n const headerRow = result.meta.fields || generateHeader(csvOptions.columnPrefix, firstRow.length);\n\n switch (csvOptions.shape) {\n case 'object-row-table':\n rows = rows.map((row) => (Array.isArray(row) ? convertToObjectRow(row, headerRow) : row));\n break;\n case 'array-row-table':\n rows = rows.map((row) => (Array.isArray(row) ? row : convertToArrayRow(row, headerRow)));\n break;\n default:\n }\n\n /*\n if (!header && shape === 'object-row-table') {\n // If the dataset has no header, transform the array result into an object shape with an\n // autogenerated header\n return result.data.map((row) =>\n row.reduce((acc, value, i) => {\n acc[headerRow[i]] = value;\n return acc;\n }, {})\n );\n }\n */\n return rows;\n}\n\n// TODO - support batch size 0 = no batching/single batch?\nfunction parseCSVInBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: CSVLoaderOptions\n): AsyncIterable<Batch> {\n // Papaparse does not support standard batch size handling\n // TODO - investigate papaparse chunks mode\n options = {...options};\n if (options.batchSize === 'auto') {\n options.batchSize = 4000;\n }\n\n // Apps can call the parse method directly, we so apply default options here\n const csvOptions = {...DEFAULT_CSV_LOADER_OPTIONS.csv, ...options?.csv};\n\n const asyncQueue = new AsyncQueue<Batch>();\n\n let isFirstRow: boolean = true;\n let headerRow: string[] | null = null;\n let tableBatchBuilder: TableBatchBuilder | null = null;\n let schema: ObjectSchema | null = null;\n\n const config = {\n // dynamicTyping: true, // Convert numbers and boolean values in rows from strings,\n ...csvOptions,\n header: false, // Unfortunately, header detection is not automatic and does not infer shapes\n download: false, // We handle loading, no need for papaparse to do it for us\n // chunkSize is set to 5MB explicitly (same as Papaparse default) due to a bug where the\n // streaming parser gets stuck if skipEmptyLines and a step callback are both supplied.\n // See https://github.com/mholt/PapaParse/issues/465\n chunkSize: 1024 * 1024 * 5,\n // skipEmptyLines is set to a boolean value if supplied. Greedy is set to true\n // skipEmptyLines is handled manually given two bugs where the streaming parser gets stuck if\n // both of the skipEmptyLines and step callback options are provided:\n // - true doesn't work unless chunkSize is set: https://github.com/mholt/PapaParse/issues/465\n // - greedy doesn't work: https://github.com/mholt/PapaParse/issues/825\n skipEmptyLines: false,\n\n // step is called on every row\n // eslint-disable-next-line complexity\n step(results) {\n let row = results.data;\n\n if (csvOptions.skipEmptyLines) {\n // Manually reject lines that are empty\n const collapsedRow = row.flat().join('').trim();\n if (collapsedRow === '') {\n return;\n }\n }\n const bytesUsed = results.meta.cursor;\n\n // Check if we need to save a header row\n if (isFirstRow && !headerRow) {\n // Auto detects or can be forced with csvOptions.header\n const header = csvOptions.header === 'auto' ? isHeaderRow(row) : Boolean(csvOptions.header);\n if (header) {\n headerRow = row.map(duplicateColumnTransformer());\n return;\n }\n }\n\n // If first data row, we can deduce the schema\n if (isFirstRow) {\n isFirstRow = false;\n if (!headerRow) {\n headerRow = generateHeader(csvOptions.columnPrefix, row.length);\n }\n schema = deduceSchema(row, headerRow);\n }\n\n if (csvOptions.optimizeMemoryUsage) {\n // A workaround to allocate new strings and don't retain pointers to original strings.\n // https://bugs.chromium.org/p/v8/issues/detail?id=2869\n row = JSON.parse(JSON.stringify(row));\n }\n\n // Add the row\n tableBatchBuilder =\n tableBatchBuilder ||\n new TableBatchBuilder(\n // @ts-expect-error TODO this is not a proper schema\n schema,\n {\n shape: csvOptions.shape || 'array-row-table',\n ...options\n }\n );\n\n try {\n tableBatchBuilder.addRow(row);\n // If a batch has been completed, emit it\n const batch = tableBatchBuilder && tableBatchBuilder.getFullBatch({bytesUsed});\n if (batch) {\n asyncQueue.enqueue(batch);\n }\n } catch (error) {\n asyncQueue.enqueue(error as Error);\n }\n },\n\n // complete is called when all rows have been read\n complete(results) {\n try {\n const bytesUsed = results.meta.cursor;\n // Ensure any final (partial) batch gets emitted\n const batch = tableBatchBuilder && tableBatchBuilder.getFinalBatch({bytesUsed});\n if (batch) {\n asyncQueue.enqueue(batch);\n }\n } catch (error) {\n asyncQueue.enqueue(error as Error);\n }\n\n asyncQueue.close();\n }\n };\n\n Papa.parse(asyncIterator, config, AsyncIteratorStreamer);\n\n // TODO - Does it matter if we return asyncIterable or asyncIterator\n // return asyncQueue[Symbol.asyncIterator]();\n return asyncQueue;\n}\n\n/**\n * Checks if a certain row is a header row\n * @param row the row to check\n * @returns true if the row looks like a header\n */\nfunction isHeaderRow(row: string[]): boolean {\n return row && row.every((value) => typeof value === 'string');\n}\n\n/**\n * Reads, parses, and returns the first row of a CSV text\n * @param csvText the csv text to parse\n * @returns the first row\n */\nfunction readFirstRow(csvText: string): any[] {\n const result = Papa.parse(csvText, {\n download: false,\n dynamicTyping: true,\n preview: 1\n });\n return result.data[0];\n}\n\n/**\n * Creates a transformer that renames duplicate columns. This is needed as Papaparse doesn't handle\n * duplicate header columns and would use the latest occurrence by default.\n * See the header option in https://www.papaparse.com/docs#config\n * @returns a transform function that returns sanitized names for duplicate fields\n */\nfunction duplicateColumnTransformer() {\n const observedColumns = new Set();\n return (col) => {\n let colName = col;\n let counter = 1;\n while (observedColumns.has(colName)) {\n colName = `${col}.${counter}`;\n counter++;\n }\n observedColumns.add(colName);\n return colName;\n };\n}\n\n/**\n * Generates the header of a CSV given a prefix and a column count\n * @param columnPrefix the columnPrefix to use\n * @param count the count of column names to generate\n * @returns an array of column names\n */\nfunction generateHeader(columnPrefix: string, count: number = 0): string[] {\n const headers: string[] = [];\n for (let i = 0; i < count; i++) {\n headers.push(`${columnPrefix}${i + 1}`);\n }\n return headers;\n}\n\nfunction deduceSchema(row, headerRow): ObjectSchema {\n const schema: ObjectSchema = headerRow ? {} : [];\n for (let i = 0; i < row.length; i++) {\n const columnName = (headerRow && headerRow[i]) || i;\n const value = row[i];\n switch (typeof value) {\n case 'number':\n case 'boolean':\n // TODO - booleans could be handled differently...\n schema[columnName] = {name: String(columnName), index: i, type: Float32Array};\n break;\n case 'string':\n default:\n schema[columnName] = {name: String(columnName), index: i, type: Array};\n // We currently only handle numeric rows\n // TODO we could offer a function to map strings to numbers?\n }\n }\n return schema;\n}\n"],"mappings":";;;;;;;;;;;AAKA,IAAAA,OAAA,GAAAC,OAAA;AAOA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,sBAAA,GAAAD,sBAAA,CAAAF,OAAA;AAAwE,SAAAI,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAA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,CAACpE,CAAC,CAAC,IAAKA,CAAC;IACnD,IAAM4H,KAAK,GAAGpC,GAAG,CAACxF,CAAC,CAAC;IACpB,YAAAyI,QAAA,CAAAlI,OAAA,EAAeqH,KAAK;MAClB,KAAK,QAAQ;MACb,KAAK,SAAS;QAEZxB,MAAM,CAACoC,UAAU,CAAC,GAAG;UAAC7G,IAAI,EAAE+G,MAAM,CAACF,UAAU,CAAC;UAAEG,KAAK,EAAE3I,CAAC;UAAE4I,IAAI,EAAEC;QAAY,CAAC;QAC7E;MACF,KAAK,QAAQ;MACb;QACEzC,MAAM,CAACoC,UAAU,CAAC,GAAG;UAAC7G,IAAI,EAAE+G,MAAM,CAACF,UAAU,CAAC;UAAEG,KAAK,EAAE3I,CAAC;UAAE4I,IAAI,EAAEnD;QAAK,CAAC;IAG1E;EACF;EACA,OAAOW,MAAM;AACf"}
|
|
1
|
+
{"version":3,"file":"csv-loader.js","names":["_schema","require","_papaparse","_interopRequireDefault","_asyncIteratorStreamer","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","VERSION","CSVLoader","id","module","name","version","extensions","mimeTypes","category","parse","_parse","_asyncToGenerator2","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseCSV","TextDecoder","decode","stop","_x","_x2","parseText","text","parseInBatches","parseCSVInBatches","csv","shape","optimizeMemoryUsage","header","columnPrefix","quoteChar","escapeChar","dynamicTyping","comments","skipEmptyLines","delimitersToGuess","exports","_x3","_x4","_parseCSV","_callee2","csvText","csvOptions","firstRow","parseWithHeader","papaparseConfig","result","rows","headerRow","_callee2$","_context2","readFirstRow","isHeaderRow","Boolean","download","transformHeader","duplicateColumnTransformer","undefined","error","e","Error","Papa","data","meta","fields","generateHeader","t0","map","row","Array","isArray","convertToObjectRow","convertToArrayRow","asyncIterator","_options","batchSize","asyncQueue","AsyncQueue","isFirstRow","tableBatchBuilder","schema","config","chunkSize","step","results","collapsedRow","flat","join","trim","bytesUsed","cursor","deduceSchema","JSON","stringify","TableBatchBuilder","addRow","batch","getFullBatch","enqueue","complete","getFinalBatch","close","AsyncIteratorStreamer","every","value","preview","observedColumns","Set","col","colName","counter","has","concat","add","count","headers","columnName","_typeof2","String","index","type","Float32Array"],"sources":["../../src/csv-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {ArrayRowTable, ObjectRowTable, TableBatch} from '@loaders.gl/schema';\n\nimport {\n AsyncQueue,\n Table,\n TableBatchBuilder,\n convertToArrayRow,\n convertToObjectRow\n} from '@loaders.gl/schema';\nimport Papa from './papaparse/papaparse';\nimport AsyncIteratorStreamer from './papaparse/async-iterator-streamer';\n\ntype ObjectField = {name: string; index: number; type: any};\ntype ObjectSchema = {[key: string]: ObjectField} | ObjectField[];\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type CSVLoaderOptions = LoaderOptions & {\n csv?: {\n // loaders.gl options\n shape?: 'array-row-table' | 'object-row-table';\n /** optimizes memory usage but increases parsing time. */\n optimizeMemoryUsage?: boolean;\n columnPrefix?: string;\n header?: 'auto';\n\n // CSV options (papaparse)\n // delimiter: auto\n // newline: auto\n quoteChar?: string;\n escapeChar?: string;\n // Convert numbers and boolean values in rows from strings\n dynamicTyping?: boolean;\n comments?: boolean;\n skipEmptyLines?: boolean | 'greedy';\n // transform: null?\n delimitersToGuess?: string[];\n // fastMode: auto\n };\n};\n\nexport const CSVLoader: LoaderWithParser<Table, TableBatch, CSVLoaderOptions> = {\n id: 'csv',\n module: 'csv',\n name: 'CSV',\n version: VERSION,\n extensions: ['csv', 'tsv', 'dsv'],\n mimeTypes: ['text/csv', 'text/tab-separated-values', 'text/dsv'],\n category: 'table',\n parse: async (arrayBuffer: ArrayBuffer, options?: CSVLoaderOptions) =>\n parseCSV(new TextDecoder().decode(arrayBuffer), options),\n parseText: (text: string, options?: CSVLoaderOptions) => parseCSV(text, options),\n parseInBatches: parseCSVInBatches,\n // @ts-ignore\n // testText: null,\n options: {\n csv: {\n shape: 'object-row-table',\n optimizeMemoryUsage: false,\n // CSV options\n header: 'auto',\n columnPrefix: 'column',\n // delimiter: auto\n // newline: auto\n quoteChar: '\"',\n escapeChar: '\"',\n dynamicTyping: true,\n comments: false,\n skipEmptyLines: true,\n // transform: null?\n delimitersToGuess: [',', '\\t', '|', ';']\n // fastMode: auto\n }\n }\n};\n\nasync function parseCSV(\n csvText: string,\n options?: CSVLoaderOptions\n): Promise<ObjectRowTable | ArrayRowTable> {\n // Apps can call the parse method directly, we so apply default options here\n const csvOptions = {...CSVLoader.options.csv, ...options?.csv};\n\n const firstRow = readFirstRow(csvText);\n const header: boolean =\n csvOptions.header === 'auto' ? isHeaderRow(firstRow) : Boolean(csvOptions.header);\n\n const parseWithHeader = header;\n\n const papaparseConfig = {\n // dynamicTyping: true,\n ...csvOptions,\n header: parseWithHeader,\n download: false, // We handle loading, no need for papaparse to do it for us\n transformHeader: parseWithHeader ? duplicateColumnTransformer() : undefined,\n error: (e) => {\n throw new Error(e);\n }\n };\n\n const result = Papa.parse(csvText, papaparseConfig);\n const rows = result.data as any[];\n\n const headerRow = result.meta.fields || generateHeader(csvOptions.columnPrefix!, firstRow.length);\n\n switch (csvOptions.shape || 'object-row-table') {\n case 'object-row-table':\n return {\n shape: 'object-row-table',\n data: rows.map((row) => (Array.isArray(row) ? convertToObjectRow(row, headerRow) : row))\n };\n case 'array-row-table':\n return {\n shape: 'array-row-table',\n data: rows.map((row) => (Array.isArray(row) ? row : convertToArrayRow(row, headerRow)))\n };\n }\n throw new Error(csvOptions.shape);\n}\n\n// TODO - support batch size 0 = no batching/single batch?\nfunction parseCSVInBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: CSVLoaderOptions\n): AsyncIterable<TableBatch> {\n // Papaparse does not support standard batch size handling\n // TODO - investigate papaparse chunks mode\n options = {...options};\n if (options.batchSize === 'auto') {\n options.batchSize = 4000;\n }\n\n // Apps can call the parse method directly, we so apply default options here\n const csvOptions = {...CSVLoader.options.csv, ...options?.csv};\n\n const asyncQueue = new AsyncQueue<TableBatch>();\n\n let isFirstRow: boolean = true;\n let headerRow: string[] | null = null;\n let tableBatchBuilder: TableBatchBuilder | null = null;\n let schema: ObjectSchema | null = null;\n\n const config = {\n // dynamicTyping: true, // Convert numbers and boolean values in rows from strings,\n ...csvOptions,\n header: false, // Unfortunately, header detection is not automatic and does not infer shapes\n download: false, // We handle loading, no need for papaparse to do it for us\n // chunkSize is set to 5MB explicitly (same as Papaparse default) due to a bug where the\n // streaming parser gets stuck if skipEmptyLines and a step callback are both supplied.\n // See https://github.com/mholt/PapaParse/issues/465\n chunkSize: 1024 * 1024 * 5,\n // skipEmptyLines is set to a boolean value if supplied. Greedy is set to true\n // skipEmptyLines is handled manually given two bugs where the streaming parser gets stuck if\n // both of the skipEmptyLines and step callback options are provided:\n // - true doesn't work unless chunkSize is set: https://github.com/mholt/PapaParse/issues/465\n // - greedy doesn't work: https://github.com/mholt/PapaParse/issues/825\n skipEmptyLines: false,\n\n // step is called on every row\n // eslint-disable-next-line complexity\n step(results) {\n let row = results.data;\n\n if (csvOptions.skipEmptyLines) {\n // Manually reject lines that are empty\n const collapsedRow = row.flat().join('').trim();\n if (collapsedRow === '') {\n return;\n }\n }\n const bytesUsed = results.meta.cursor;\n\n // Check if we need to save a header row\n if (isFirstRow && !headerRow) {\n // Auto detects or can be forced with csvOptions.header\n const header = csvOptions.header === 'auto' ? isHeaderRow(row) : Boolean(csvOptions.header);\n if (header) {\n headerRow = row.map(duplicateColumnTransformer());\n return;\n }\n }\n\n // If first data row, we can deduce the schema\n if (isFirstRow) {\n isFirstRow = false;\n if (!headerRow) {\n headerRow = generateHeader(csvOptions.columnPrefix!, row.length);\n }\n schema = deduceSchema(row, headerRow);\n }\n\n if (csvOptions.optimizeMemoryUsage) {\n // A workaround to allocate new strings and don't retain pointers to original strings.\n // https://bugs.chromium.org/p/v8/issues/detail?id=2869\n row = JSON.parse(JSON.stringify(row));\n }\n\n // Add the row\n tableBatchBuilder =\n tableBatchBuilder ||\n new TableBatchBuilder(\n // @ts-expect-error TODO this is not a proper schema\n schema,\n {\n shape: csvOptions.shape || 'array-row-table',\n ...options\n }\n );\n\n try {\n tableBatchBuilder.addRow(row);\n // If a batch has been completed, emit it\n const batch = tableBatchBuilder && tableBatchBuilder.getFullBatch({bytesUsed});\n if (batch) {\n asyncQueue.enqueue(batch);\n }\n } catch (error) {\n asyncQueue.enqueue(error as Error);\n }\n },\n\n // complete is called when all rows have been read\n complete(results) {\n try {\n const bytesUsed = results.meta.cursor;\n // Ensure any final (partial) batch gets emitted\n const batch = tableBatchBuilder && tableBatchBuilder.getFinalBatch({bytesUsed});\n if (batch) {\n asyncQueue.enqueue(batch);\n }\n } catch (error) {\n asyncQueue.enqueue(error as Error);\n }\n\n asyncQueue.close();\n }\n };\n\n Papa.parse(asyncIterator, config, AsyncIteratorStreamer);\n\n // TODO - Does it matter if we return asyncIterable or asyncIterator\n // return asyncQueue[Symbol.asyncIterator]();\n return asyncQueue;\n}\n\n/**\n * Checks if a certain row is a header row\n * @param row the row to check\n * @returns true if the row looks like a header\n */\nfunction isHeaderRow(row: string[]): boolean {\n return row && row.every((value) => typeof value === 'string');\n}\n\n/**\n * Reads, parses, and returns the first row of a CSV text\n * @param csvText the csv text to parse\n * @returns the first row\n */\nfunction readFirstRow(csvText: string): any[] {\n const result = Papa.parse(csvText, {\n download: false,\n dynamicTyping: true,\n preview: 1\n });\n return result.data[0];\n}\n\n/**\n * Creates a transformer that renames duplicate columns. This is needed as Papaparse doesn't handle\n * duplicate header columns and would use the latest occurrence by default.\n * See the header option in https://www.papaparse.com/docs#config\n * @returns a transform function that returns sanitized names for duplicate fields\n */\nfunction duplicateColumnTransformer(): (column: string) => string {\n const observedColumns = new Set<string>();\n return (col) => {\n let colName = col;\n let counter = 1;\n while (observedColumns.has(colName)) {\n colName = `${col}.${counter}`;\n counter++;\n }\n observedColumns.add(colName);\n return colName;\n };\n}\n\n/**\n * Generates the header of a CSV given a prefix and a column count\n * @param columnPrefix the columnPrefix to use\n * @param count the count of column names to generate\n * @returns an array of column names\n */\nfunction generateHeader(columnPrefix: string, count: number = 0): string[] {\n const headers: string[] = [];\n for (let i = 0; i < count; i++) {\n headers.push(`${columnPrefix}${i + 1}`);\n }\n return headers;\n}\n\nfunction deduceSchema(row, headerRow): ObjectSchema {\n const schema: ObjectSchema = headerRow ? {} : [];\n for (let i = 0; i < row.length; i++) {\n const columnName = (headerRow && headerRow[i]) || i;\n const value = row[i];\n switch (typeof value) {\n case 'number':\n case 'boolean':\n // TODO - booleans could be handled differently...\n schema[columnName] = {name: String(columnName), index: i, type: Float32Array};\n break;\n case 'string':\n default:\n schema[columnName] = {name: String(columnName), index: i, type: Array};\n // We currently only handle numeric rows\n // TODO we could offer a function to map strings to numbers?\n }\n }\n return schema;\n}\n"],"mappings":";;;;;;;;;;;AAKA,IAAAA,OAAA,GAAAC,OAAA;AAOA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,sBAAA,GAAAD,sBAAA,CAAAF,OAAA;AAAwE,SAAAI,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,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,SAASxB,YAAYA,CAACvB,GAAG,EAAEpB,SAAS,EAAgB;EAClD,IAAMgC,MAAoB,GAAGhC,SAAS,GAAG,CAAC,CAAC,GAAG,EAAE;EAChD,KAAK,IAAInE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGuF,GAAG,CAACrF,MAAM,EAAEF,CAAC,EAAE,EAAE;IACnC,IAAMuI,UAAU,GAAIpE,SAAS,IAAIA,SAAS,CAACnE,CAAC,CAAC,IAAKA,CAAC;IACnD,IAAM2H,KAAK,GAAGpC,GAAG,CAACvF,CAAC,CAAC;IACpB,YAAAwI,QAAA,CAAAjI,OAAA,EAAeoH,KAAK;MAClB,KAAK,QAAQ;MACb,KAAK,SAAS;QAEZxB,MAAM,CAACoC,UAAU,CAAC,GAAG;UAACxH,IAAI,EAAE0H,MAAM,CAACF,UAAU,CAAC;UAAEG,KAAK,EAAE1I,CAAC;UAAE2I,IAAI,EAAEC;QAAY,CAAC;QAC7E;MACF,KAAK,QAAQ;MACb;QACEzC,MAAM,CAACoC,UAAU,CAAC,GAAG;UAACxH,IAAI,EAAE0H,MAAM,CAACF,UAAU,CAAC;UAAEG,KAAK,EAAE1I,CAAC;UAAE2I,IAAI,EAAEnD;QAAK,CAAC;IAG1E;EACF;EACA,OAAOW,MAAM;AACf"}
|
package/dist/esm/csv-loader.js
CHANGED
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
import { AsyncQueue, TableBatchBuilder, convertToArrayRow, convertToObjectRow } from '@loaders.gl/schema';
|
|
2
2
|
import Papa from './papaparse/papaparse';
|
|
3
3
|
import AsyncIteratorStreamer from './papaparse/async-iterator-streamer';
|
|
4
|
-
const VERSION = typeof "4.0.0-alpha.
|
|
5
|
-
const DEFAULT_CSV_LOADER_OPTIONS = {
|
|
6
|
-
csv: {
|
|
7
|
-
shape: 'object-row-table',
|
|
8
|
-
optimizeMemoryUsage: false,
|
|
9
|
-
header: 'auto',
|
|
10
|
-
columnPrefix: 'column',
|
|
11
|
-
quoteChar: '"',
|
|
12
|
-
escapeChar: '"',
|
|
13
|
-
dynamicTyping: true,
|
|
14
|
-
comments: false,
|
|
15
|
-
skipEmptyLines: true,
|
|
16
|
-
delimitersToGuess: [',', '\t', '|', ';']
|
|
17
|
-
}
|
|
18
|
-
};
|
|
4
|
+
const VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
|
|
19
5
|
export const CSVLoader = {
|
|
20
6
|
id: 'csv',
|
|
21
7
|
module: 'csv',
|
|
@@ -27,11 +13,24 @@ export const CSVLoader = {
|
|
|
27
13
|
parse: async (arrayBuffer, options) => parseCSV(new TextDecoder().decode(arrayBuffer), options),
|
|
28
14
|
parseText: (text, options) => parseCSV(text, options),
|
|
29
15
|
parseInBatches: parseCSVInBatches,
|
|
30
|
-
options:
|
|
16
|
+
options: {
|
|
17
|
+
csv: {
|
|
18
|
+
shape: 'object-row-table',
|
|
19
|
+
optimizeMemoryUsage: false,
|
|
20
|
+
header: 'auto',
|
|
21
|
+
columnPrefix: 'column',
|
|
22
|
+
quoteChar: '"',
|
|
23
|
+
escapeChar: '"',
|
|
24
|
+
dynamicTyping: true,
|
|
25
|
+
comments: false,
|
|
26
|
+
skipEmptyLines: true,
|
|
27
|
+
delimitersToGuess: [',', '\t', '|', ';']
|
|
28
|
+
}
|
|
29
|
+
}
|
|
31
30
|
};
|
|
32
31
|
async function parseCSV(csvText, options) {
|
|
33
32
|
const csvOptions = {
|
|
34
|
-
...
|
|
33
|
+
...CSVLoader.options.csv,
|
|
35
34
|
...(options === null || options === void 0 ? void 0 : options.csv)
|
|
36
35
|
};
|
|
37
36
|
const firstRow = readFirstRow(csvText);
|
|
@@ -47,20 +46,21 @@ async function parseCSV(csvText, options) {
|
|
|
47
46
|
}
|
|
48
47
|
};
|
|
49
48
|
const result = Papa.parse(csvText, papaparseConfig);
|
|
50
|
-
|
|
51
|
-
data: rows
|
|
52
|
-
} = result;
|
|
49
|
+
const rows = result.data;
|
|
53
50
|
const headerRow = result.meta.fields || generateHeader(csvOptions.columnPrefix, firstRow.length);
|
|
54
|
-
switch (csvOptions.shape) {
|
|
51
|
+
switch (csvOptions.shape || 'object-row-table') {
|
|
55
52
|
case 'object-row-table':
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
return {
|
|
54
|
+
shape: 'object-row-table',
|
|
55
|
+
data: rows.map(row => Array.isArray(row) ? convertToObjectRow(row, headerRow) : row)
|
|
56
|
+
};
|
|
58
57
|
case 'array-row-table':
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
return {
|
|
59
|
+
shape: 'array-row-table',
|
|
60
|
+
data: rows.map(row => Array.isArray(row) ? row : convertToArrayRow(row, headerRow))
|
|
61
|
+
};
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
throw new Error(csvOptions.shape);
|
|
64
64
|
}
|
|
65
65
|
function parseCSVInBatches(asyncIterator, options) {
|
|
66
66
|
var _options;
|
|
@@ -71,7 +71,7 @@ function parseCSVInBatches(asyncIterator, options) {
|
|
|
71
71
|
options.batchSize = 4000;
|
|
72
72
|
}
|
|
73
73
|
const csvOptions = {
|
|
74
|
-
...
|
|
74
|
+
...CSVLoader.options.csv,
|
|
75
75
|
...((_options = options) === null || _options === void 0 ? void 0 : _options.csv)
|
|
76
76
|
};
|
|
77
77
|
const asyncQueue = new AsyncQueue();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csv-loader.js","names":["AsyncQueue","TableBatchBuilder","convertToArrayRow","convertToObjectRow","Papa","AsyncIteratorStreamer","VERSION","DEFAULT_CSV_LOADER_OPTIONS","csv","shape","optimizeMemoryUsage","header","columnPrefix","quoteChar","escapeChar","dynamicTyping","comments","skipEmptyLines","delimitersToGuess","CSVLoader","id","module","name","version","extensions","mimeTypes","category","parse","arrayBuffer","options","parseCSV","TextDecoder","decode","parseText","text","parseInBatches","parseCSVInBatches","csvText","csvOptions","firstRow","readFirstRow","isHeaderRow","Boolean","parseWithHeader","papaparseConfig","download","transformHeader","duplicateColumnTransformer","undefined","error","e","Error","result","data","rows","headerRow","meta","fields","generateHeader","length","map","row","Array","isArray","asyncIterator","_options","batchSize","asyncQueue","isFirstRow","tableBatchBuilder","schema","config","chunkSize","step","results","collapsedRow","flat","join","trim","bytesUsed","cursor","deduceSchema","JSON","stringify","addRow","batch","getFullBatch","enqueue","complete","getFinalBatch","close","every","value","preview","observedColumns","Set","col","colName","counter","has","concat","add","count","arguments","headers","i","push","columnName","String","index","type","Float32Array"],"sources":["../../src/csv-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {Batch, TableBatch} from '@loaders.gl/schema';\n\nimport {\n AsyncQueue,\n Table,\n TableBatchBuilder,\n convertToArrayRow,\n convertToObjectRow\n} from '@loaders.gl/schema';\nimport Papa from './papaparse/papaparse';\nimport AsyncIteratorStreamer from './papaparse/async-iterator-streamer';\n\ntype ObjectField = {name: string; index: number; type: any};\ntype ObjectSchema = {[key: string]: ObjectField} | ObjectField[];\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type CSVLoaderOptions = LoaderOptions & {\n csv?: {\n // loaders.gl options\n shape?: 'array-row-table' | 'object-row-table' | 'columnar-table';\n /** optimizes memory usage but increases parsing time. */\n optimizeMemoryUsage?: boolean;\n columnPrefix?: string;\n header?: 'auto';\n\n // CSV options (papaparse)\n // delimiter: auto\n // newline: auto\n quoteChar?: string;\n escapeChar?: string;\n // Convert numbers and boolean values in rows from strings\n dynamicTyping?: boolean;\n comments?: boolean;\n skipEmptyLines?: boolean | 'greedy';\n // transform: null?\n delimitersToGuess?: string[];\n // fastMode: auto\n };\n};\n\nconst DEFAULT_CSV_LOADER_OPTIONS = {\n csv: {\n shape: 'object-row-table',\n optimizeMemoryUsage: false,\n // CSV options\n header: 'auto',\n columnPrefix: 'column',\n // delimiter: auto\n // newline: auto\n quoteChar: '\"',\n escapeChar: '\"',\n dynamicTyping: true,\n comments: false,\n skipEmptyLines: true,\n // transform: null?\n delimitersToGuess: [',', '\\t', '|', ';']\n // fastMode: auto\n }\n};\n\nexport const CSVLoader: LoaderWithParser<Table, TableBatch, CSVLoaderOptions> = {\n id: 'csv',\n module: 'csv',\n name: 'CSV',\n version: VERSION,\n extensions: ['csv', 'tsv', 'dsv'],\n mimeTypes: ['text/csv', 'text/tab-separated-values', 'text/dsv'],\n category: 'table',\n parse: async (arrayBuffer: ArrayBuffer, options?: CSVLoaderOptions) =>\n parseCSV(new TextDecoder().decode(arrayBuffer), options),\n parseText: (text: string, options?: CSVLoaderOptions) => parseCSV(text, options),\n parseInBatches: parseCSVInBatches,\n // @ts-ignore\n // testText: null,\n options: DEFAULT_CSV_LOADER_OPTIONS as CSVLoaderOptions\n};\n\nasync function parseCSV(csvText: string, options?: CSVLoaderOptions) {\n // Apps can call the parse method directly, we so apply default options here\n const csvOptions = {...DEFAULT_CSV_LOADER_OPTIONS.csv, ...options?.csv};\n\n const firstRow = readFirstRow(csvText);\n const header: boolean =\n csvOptions.header === 'auto' ? isHeaderRow(firstRow) : Boolean(csvOptions.header);\n\n const parseWithHeader = header;\n\n const papaparseConfig = {\n // dynamicTyping: true,\n ...csvOptions,\n header: parseWithHeader,\n download: false, // We handle loading, no need for papaparse to do it for us\n transformHeader: parseWithHeader ? duplicateColumnTransformer() : undefined,\n error: (e) => {\n throw new Error(e);\n }\n };\n\n const result = Papa.parse(csvText, papaparseConfig);\n let {data: rows} = result;\n\n const headerRow = result.meta.fields || generateHeader(csvOptions.columnPrefix, firstRow.length);\n\n switch (csvOptions.shape) {\n case 'object-row-table':\n rows = rows.map((row) => (Array.isArray(row) ? convertToObjectRow(row, headerRow) : row));\n break;\n case 'array-row-table':\n rows = rows.map((row) => (Array.isArray(row) ? row : convertToArrayRow(row, headerRow)));\n break;\n default:\n }\n\n /*\n if (!header && shape === 'object-row-table') {\n // If the dataset has no header, transform the array result into an object shape with an\n // autogenerated header\n return result.data.map((row) =>\n row.reduce((acc, value, i) => {\n acc[headerRow[i]] = value;\n return acc;\n }, {})\n );\n }\n */\n return rows;\n}\n\n// TODO - support batch size 0 = no batching/single batch?\nfunction parseCSVInBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: CSVLoaderOptions\n): AsyncIterable<Batch> {\n // Papaparse does not support standard batch size handling\n // TODO - investigate papaparse chunks mode\n options = {...options};\n if (options.batchSize === 'auto') {\n options.batchSize = 4000;\n }\n\n // Apps can call the parse method directly, we so apply default options here\n const csvOptions = {...DEFAULT_CSV_LOADER_OPTIONS.csv, ...options?.csv};\n\n const asyncQueue = new AsyncQueue<Batch>();\n\n let isFirstRow: boolean = true;\n let headerRow: string[] | null = null;\n let tableBatchBuilder: TableBatchBuilder | null = null;\n let schema: ObjectSchema | null = null;\n\n const config = {\n // dynamicTyping: true, // Convert numbers and boolean values in rows from strings,\n ...csvOptions,\n header: false, // Unfortunately, header detection is not automatic and does not infer shapes\n download: false, // We handle loading, no need for papaparse to do it for us\n // chunkSize is set to 5MB explicitly (same as Papaparse default) due to a bug where the\n // streaming parser gets stuck if skipEmptyLines and a step callback are both supplied.\n // See https://github.com/mholt/PapaParse/issues/465\n chunkSize: 1024 * 1024 * 5,\n // skipEmptyLines is set to a boolean value if supplied. Greedy is set to true\n // skipEmptyLines is handled manually given two bugs where the streaming parser gets stuck if\n // both of the skipEmptyLines and step callback options are provided:\n // - true doesn't work unless chunkSize is set: https://github.com/mholt/PapaParse/issues/465\n // - greedy doesn't work: https://github.com/mholt/PapaParse/issues/825\n skipEmptyLines: false,\n\n // step is called on every row\n // eslint-disable-next-line complexity\n step(results) {\n let row = results.data;\n\n if (csvOptions.skipEmptyLines) {\n // Manually reject lines that are empty\n const collapsedRow = row.flat().join('').trim();\n if (collapsedRow === '') {\n return;\n }\n }\n const bytesUsed = results.meta.cursor;\n\n // Check if we need to save a header row\n if (isFirstRow && !headerRow) {\n // Auto detects or can be forced with csvOptions.header\n const header = csvOptions.header === 'auto' ? isHeaderRow(row) : Boolean(csvOptions.header);\n if (header) {\n headerRow = row.map(duplicateColumnTransformer());\n return;\n }\n }\n\n // If first data row, we can deduce the schema\n if (isFirstRow) {\n isFirstRow = false;\n if (!headerRow) {\n headerRow = generateHeader(csvOptions.columnPrefix, row.length);\n }\n schema = deduceSchema(row, headerRow);\n }\n\n if (csvOptions.optimizeMemoryUsage) {\n // A workaround to allocate new strings and don't retain pointers to original strings.\n // https://bugs.chromium.org/p/v8/issues/detail?id=2869\n row = JSON.parse(JSON.stringify(row));\n }\n\n // Add the row\n tableBatchBuilder =\n tableBatchBuilder ||\n new TableBatchBuilder(\n // @ts-expect-error TODO this is not a proper schema\n schema,\n {\n shape: csvOptions.shape || 'array-row-table',\n ...options\n }\n );\n\n try {\n tableBatchBuilder.addRow(row);\n // If a batch has been completed, emit it\n const batch = tableBatchBuilder && tableBatchBuilder.getFullBatch({bytesUsed});\n if (batch) {\n asyncQueue.enqueue(batch);\n }\n } catch (error) {\n asyncQueue.enqueue(error as Error);\n }\n },\n\n // complete is called when all rows have been read\n complete(results) {\n try {\n const bytesUsed = results.meta.cursor;\n // Ensure any final (partial) batch gets emitted\n const batch = tableBatchBuilder && tableBatchBuilder.getFinalBatch({bytesUsed});\n if (batch) {\n asyncQueue.enqueue(batch);\n }\n } catch (error) {\n asyncQueue.enqueue(error as Error);\n }\n\n asyncQueue.close();\n }\n };\n\n Papa.parse(asyncIterator, config, AsyncIteratorStreamer);\n\n // TODO - Does it matter if we return asyncIterable or asyncIterator\n // return asyncQueue[Symbol.asyncIterator]();\n return asyncQueue;\n}\n\n/**\n * Checks if a certain row is a header row\n * @param row the row to check\n * @returns true if the row looks like a header\n */\nfunction isHeaderRow(row: string[]): boolean {\n return row && row.every((value) => typeof value === 'string');\n}\n\n/**\n * Reads, parses, and returns the first row of a CSV text\n * @param csvText the csv text to parse\n * @returns the first row\n */\nfunction readFirstRow(csvText: string): any[] {\n const result = Papa.parse(csvText, {\n download: false,\n dynamicTyping: true,\n preview: 1\n });\n return result.data[0];\n}\n\n/**\n * Creates a transformer that renames duplicate columns. This is needed as Papaparse doesn't handle\n * duplicate header columns and would use the latest occurrence by default.\n * See the header option in https://www.papaparse.com/docs#config\n * @returns a transform function that returns sanitized names for duplicate fields\n */\nfunction duplicateColumnTransformer() {\n const observedColumns = new Set();\n return (col) => {\n let colName = col;\n let counter = 1;\n while (observedColumns.has(colName)) {\n colName = `${col}.${counter}`;\n counter++;\n }\n observedColumns.add(colName);\n return colName;\n };\n}\n\n/**\n * Generates the header of a CSV given a prefix and a column count\n * @param columnPrefix the columnPrefix to use\n * @param count the count of column names to generate\n * @returns an array of column names\n */\nfunction generateHeader(columnPrefix: string, count: number = 0): string[] {\n const headers: string[] = [];\n for (let i = 0; i < count; i++) {\n headers.push(`${columnPrefix}${i + 1}`);\n }\n return headers;\n}\n\nfunction deduceSchema(row, headerRow): ObjectSchema {\n const schema: ObjectSchema = headerRow ? {} : [];\n for (let i = 0; i < row.length; i++) {\n const columnName = (headerRow && headerRow[i]) || i;\n const value = row[i];\n switch (typeof value) {\n case 'number':\n case 'boolean':\n // TODO - booleans could be handled differently...\n schema[columnName] = {name: String(columnName), index: i, type: Float32Array};\n break;\n case 'string':\n default:\n schema[columnName] = {name: String(columnName), index: i, type: Array};\n // We currently only handle numeric rows\n // TODO we could offer a function to map strings to numbers?\n }\n }\n return schema;\n}\n"],"mappings":"AAKA,SACEA,UAAU,EAEVC,iBAAiB,EACjBC,iBAAiB,EACjBC,kBAAkB,QACb,oBAAoB;AAC3B,OAAOC,IAAI,MAAM,uBAAuB;AACxC,OAAOC,qBAAqB,MAAM,qCAAqC;AAOvE,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AA0B3E,MAAMC,0BAA0B,GAAG;EACjCC,GAAG,EAAE;IACHC,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AAC,EAAE,EAAE;IAC9BD,OAAO,CAACE,IAAI,IAAAN,MAAA,CAAIxF,YAAY,EAAAwF,MAAA,CAAGK,CAAC,GAAG,CAAC,CAAE,CAAC;EACzC;EACA,OAAOD,OAAO;AAChB;AAEA,SAASvB,YAAYA,CAACpB,GAAG,EAAEN,SAAS,EAAgB;EAClD,MAAMe,MAAoB,GAAGf,SAAS,GAAG,CAAC,CAAC,GAAG,EAAE;EAChD,KAAK,IAAIkD,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG5C,GAAG,CAACF,MAAM,EAAE8C,CAAC,EAAE,EAAE;IACnC,MAAME,UAAU,GAAIpD,SAAS,IAAIA,SAAS,CAACkD,CAAC,CAAC,IAAKA,CAAC;IACnD,MAAMb,KAAK,GAAG/B,GAAG,CAAC4C,CAAC,CAAC;IACpB,QAAQ,OAAOb,KAAK;MAClB,KAAK,QAAQ;MACb,KAAK,SAAS;QAEZtB,MAAM,CAACqC,UAAU,CAAC,GAAG;UAACrF,IAAI,EAAEsF,MAAM,CAACD,UAAU,CAAC;UAAEE,KAAK,EAAEJ,CAAC;UAAEK,IAAI,EAAEC;QAAY,CAAC;QAC7E;MACF,KAAK,QAAQ;MACb;QACEzC,MAAM,CAACqC,UAAU,CAAC,GAAG;UAACrF,IAAI,EAAEsF,MAAM,CAACD,UAAU,CAAC;UAAEE,KAAK,EAAEJ,CAAC;UAAEK,IAAI,EAAEhD;QAAK,CAAC;IAG1E;EACF;EACA,OAAOQ,MAAM;AACf"}
|
|
1
|
+
{"version":3,"file":"csv-loader.js","names":["AsyncQueue","TableBatchBuilder","convertToArrayRow","convertToObjectRow","Papa","AsyncIteratorStreamer","VERSION","CSVLoader","id","module","name","version","extensions","mimeTypes","category","parse","arrayBuffer","options","parseCSV","TextDecoder","decode","parseText","text","parseInBatches","parseCSVInBatches","csv","shape","optimizeMemoryUsage","header","columnPrefix","quoteChar","escapeChar","dynamicTyping","comments","skipEmptyLines","delimitersToGuess","csvText","csvOptions","firstRow","readFirstRow","isHeaderRow","Boolean","parseWithHeader","papaparseConfig","download","transformHeader","duplicateColumnTransformer","undefined","error","e","Error","result","rows","data","headerRow","meta","fields","generateHeader","length","map","row","Array","isArray","asyncIterator","_options","batchSize","asyncQueue","isFirstRow","tableBatchBuilder","schema","config","chunkSize","step","results","collapsedRow","flat","join","trim","bytesUsed","cursor","deduceSchema","JSON","stringify","addRow","batch","getFullBatch","enqueue","complete","getFinalBatch","close","every","value","preview","observedColumns","Set","col","colName","counter","has","concat","add","count","arguments","headers","i","push","columnName","String","index","type","Float32Array"],"sources":["../../src/csv-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {ArrayRowTable, ObjectRowTable, TableBatch} from '@loaders.gl/schema';\n\nimport {\n AsyncQueue,\n Table,\n TableBatchBuilder,\n convertToArrayRow,\n convertToObjectRow\n} from '@loaders.gl/schema';\nimport Papa from './papaparse/papaparse';\nimport AsyncIteratorStreamer from './papaparse/async-iterator-streamer';\n\ntype ObjectField = {name: string; index: number; type: any};\ntype ObjectSchema = {[key: string]: ObjectField} | ObjectField[];\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type CSVLoaderOptions = LoaderOptions & {\n csv?: {\n // loaders.gl options\n shape?: 'array-row-table' | 'object-row-table';\n /** optimizes memory usage but increases parsing time. */\n optimizeMemoryUsage?: boolean;\n columnPrefix?: string;\n header?: 'auto';\n\n // CSV options (papaparse)\n // delimiter: auto\n // newline: auto\n quoteChar?: string;\n escapeChar?: string;\n // Convert numbers and boolean values in rows from strings\n dynamicTyping?: boolean;\n comments?: boolean;\n skipEmptyLines?: boolean | 'greedy';\n // transform: null?\n delimitersToGuess?: string[];\n // fastMode: auto\n };\n};\n\nexport const CSVLoader: LoaderWithParser<Table, TableBatch, CSVLoaderOptions> = {\n id: 'csv',\n module: 'csv',\n name: 'CSV',\n version: VERSION,\n extensions: ['csv', 'tsv', 'dsv'],\n mimeTypes: ['text/csv', 'text/tab-separated-values', 'text/dsv'],\n category: 'table',\n parse: async (arrayBuffer: ArrayBuffer, options?: CSVLoaderOptions) =>\n parseCSV(new TextDecoder().decode(arrayBuffer), options),\n parseText: (text: string, options?: CSVLoaderOptions) => parseCSV(text, options),\n parseInBatches: parseCSVInBatches,\n // @ts-ignore\n // testText: null,\n options: {\n csv: {\n shape: 'object-row-table',\n optimizeMemoryUsage: false,\n // CSV options\n header: 'auto',\n columnPrefix: 'column',\n // delimiter: auto\n // newline: auto\n quoteChar: '\"',\n escapeChar: '\"',\n dynamicTyping: true,\n comments: false,\n skipEmptyLines: true,\n // transform: null?\n delimitersToGuess: [',', '\\t', '|', ';']\n // fastMode: auto\n }\n }\n};\n\nasync function parseCSV(\n csvText: string,\n options?: CSVLoaderOptions\n): Promise<ObjectRowTable | ArrayRowTable> {\n // Apps can call the parse method directly, we so apply default options here\n const csvOptions = {...CSVLoader.options.csv, ...options?.csv};\n\n const firstRow = readFirstRow(csvText);\n const header: boolean =\n csvOptions.header === 'auto' ? isHeaderRow(firstRow) : Boolean(csvOptions.header);\n\n const parseWithHeader = header;\n\n const papaparseConfig = {\n // dynamicTyping: true,\n ...csvOptions,\n header: parseWithHeader,\n download: false, // We handle loading, no need for papaparse to do it for us\n transformHeader: parseWithHeader ? duplicateColumnTransformer() : undefined,\n error: (e) => {\n throw new Error(e);\n }\n };\n\n const result = Papa.parse(csvText, papaparseConfig);\n const rows = result.data as any[];\n\n const headerRow = result.meta.fields || generateHeader(csvOptions.columnPrefix!, firstRow.length);\n\n switch (csvOptions.shape || 'object-row-table') {\n case 'object-row-table':\n return {\n shape: 'object-row-table',\n data: rows.map((row) => (Array.isArray(row) ? convertToObjectRow(row, headerRow) : row))\n };\n case 'array-row-table':\n return {\n shape: 'array-row-table',\n data: rows.map((row) => (Array.isArray(row) ? row : convertToArrayRow(row, headerRow)))\n };\n }\n throw new Error(csvOptions.shape);\n}\n\n// TODO - support batch size 0 = no batching/single batch?\nfunction parseCSVInBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: CSVLoaderOptions\n): AsyncIterable<TableBatch> {\n // Papaparse does not support standard batch size handling\n // TODO - investigate papaparse chunks mode\n options = {...options};\n if (options.batchSize === 'auto') {\n options.batchSize = 4000;\n }\n\n // Apps can call the parse method directly, we so apply default options here\n const csvOptions = {...CSVLoader.options.csv, ...options?.csv};\n\n const asyncQueue = new AsyncQueue<TableBatch>();\n\n let isFirstRow: boolean = true;\n let headerRow: string[] | null = null;\n let tableBatchBuilder: TableBatchBuilder | null = null;\n let schema: ObjectSchema | null = null;\n\n const config = {\n // dynamicTyping: true, // Convert numbers and boolean values in rows from strings,\n ...csvOptions,\n header: false, // Unfortunately, header detection is not automatic and does not infer shapes\n download: false, // We handle loading, no need for papaparse to do it for us\n // chunkSize is set to 5MB explicitly (same as Papaparse default) due to a bug where the\n // streaming parser gets stuck if skipEmptyLines and a step callback are both supplied.\n // See https://github.com/mholt/PapaParse/issues/465\n chunkSize: 1024 * 1024 * 5,\n // skipEmptyLines is set to a boolean value if supplied. Greedy is set to true\n // skipEmptyLines is handled manually given two bugs where the streaming parser gets stuck if\n // both of the skipEmptyLines and step callback options are provided:\n // - true doesn't work unless chunkSize is set: https://github.com/mholt/PapaParse/issues/465\n // - greedy doesn't work: https://github.com/mholt/PapaParse/issues/825\n skipEmptyLines: false,\n\n // step is called on every row\n // eslint-disable-next-line complexity\n step(results) {\n let row = results.data;\n\n if (csvOptions.skipEmptyLines) {\n // Manually reject lines that are empty\n const collapsedRow = row.flat().join('').trim();\n if (collapsedRow === '') {\n return;\n }\n }\n const bytesUsed = results.meta.cursor;\n\n // Check if we need to save a header row\n if (isFirstRow && !headerRow) {\n // Auto detects or can be forced with csvOptions.header\n const header = csvOptions.header === 'auto' ? isHeaderRow(row) : Boolean(csvOptions.header);\n if (header) {\n headerRow = row.map(duplicateColumnTransformer());\n return;\n }\n }\n\n // If first data row, we can deduce the schema\n if (isFirstRow) {\n isFirstRow = false;\n if (!headerRow) {\n headerRow = generateHeader(csvOptions.columnPrefix!, row.length);\n }\n schema = deduceSchema(row, headerRow);\n }\n\n if (csvOptions.optimizeMemoryUsage) {\n // A workaround to allocate new strings and don't retain pointers to original strings.\n // https://bugs.chromium.org/p/v8/issues/detail?id=2869\n row = JSON.parse(JSON.stringify(row));\n }\n\n // Add the row\n tableBatchBuilder =\n tableBatchBuilder ||\n new TableBatchBuilder(\n // @ts-expect-error TODO this is not a proper schema\n schema,\n {\n shape: csvOptions.shape || 'array-row-table',\n ...options\n }\n );\n\n try {\n tableBatchBuilder.addRow(row);\n // If a batch has been completed, emit it\n const batch = tableBatchBuilder && tableBatchBuilder.getFullBatch({bytesUsed});\n if (batch) {\n asyncQueue.enqueue(batch);\n }\n } catch (error) {\n asyncQueue.enqueue(error as Error);\n }\n },\n\n // complete is called when all rows have been read\n complete(results) {\n try {\n const bytesUsed = results.meta.cursor;\n // Ensure any final (partial) batch gets emitted\n const batch = tableBatchBuilder && tableBatchBuilder.getFinalBatch({bytesUsed});\n if (batch) {\n asyncQueue.enqueue(batch);\n }\n } catch (error) {\n asyncQueue.enqueue(error as Error);\n }\n\n asyncQueue.close();\n }\n };\n\n Papa.parse(asyncIterator, config, AsyncIteratorStreamer);\n\n // TODO - Does it matter if we return asyncIterable or asyncIterator\n // return asyncQueue[Symbol.asyncIterator]();\n return asyncQueue;\n}\n\n/**\n * Checks if a certain row is a header row\n * @param row the row to check\n * @returns true if the row looks like a header\n */\nfunction isHeaderRow(row: string[]): boolean {\n return row && row.every((value) => typeof value === 'string');\n}\n\n/**\n * Reads, parses, and returns the first row of a CSV text\n * @param csvText the csv text to parse\n * @returns the first row\n */\nfunction readFirstRow(csvText: string): any[] {\n const result = Papa.parse(csvText, {\n download: false,\n dynamicTyping: true,\n preview: 1\n });\n return result.data[0];\n}\n\n/**\n * Creates a transformer that renames duplicate columns. This is needed as Papaparse doesn't handle\n * duplicate header columns and would use the latest occurrence by default.\n * See the header option in https://www.papaparse.com/docs#config\n * @returns a transform function that returns sanitized names for duplicate fields\n */\nfunction duplicateColumnTransformer(): (column: string) => string {\n const observedColumns = new Set<string>();\n return (col) => {\n let colName = col;\n let counter = 1;\n while (observedColumns.has(colName)) {\n colName = `${col}.${counter}`;\n counter++;\n }\n observedColumns.add(colName);\n return colName;\n };\n}\n\n/**\n * Generates the header of a CSV given a prefix and a column count\n * @param columnPrefix the columnPrefix to use\n * @param count the count of column names to generate\n * @returns an array of column names\n */\nfunction generateHeader(columnPrefix: string, count: number = 0): string[] {\n const headers: string[] = [];\n for (let i = 0; i < count; i++) {\n headers.push(`${columnPrefix}${i + 1}`);\n }\n return headers;\n}\n\nfunction deduceSchema(row, headerRow): ObjectSchema {\n const schema: ObjectSchema = headerRow ? {} : [];\n for (let i = 0; i < row.length; i++) {\n const columnName = (headerRow && headerRow[i]) || i;\n const value = row[i];\n switch (typeof value) {\n case 'number':\n case 'boolean':\n // TODO - booleans could be handled differently...\n schema[columnName] = {name: String(columnName), index: i, type: Float32Array};\n break;\n case 'string':\n default:\n schema[columnName] = {name: String(columnName), index: i, type: Array};\n // We currently only handle numeric rows\n // TODO we could offer a function to map strings to numbers?\n }\n }\n return schema;\n}\n"],"mappings":"AAKA,SACEA,UAAU,EAEVC,iBAAiB,EACjBC,iBAAiB,EACjBC,kBAAkB,QACb,oBAAoB;AAC3B,OAAOC,IAAI,MAAM,uBAAuB;AACxC,OAAOC,qBAAqB,MAAM,qCAAqC;AAOvE,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AA0B3E,OAAO,MAAMC,SAAgE,GAAG;EAC9EC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE,KAAK;EACXC,OAAO,EAAEL,OAAO;EAChBM,UAAU,EAAE,CAAC,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MAAA,CAAItE,YAAY,EAAAsE,MAAA,CAAGK,CAAC,GAAG,CAAC,CAAE,CAAC;EACzC;EACA,OAAOD,OAAO;AAChB;AAEA,SAASvB,YAAYA,CAACpB,GAAG,EAAEN,SAAS,EAAgB;EAClD,MAAMe,MAAoB,GAAGf,SAAS,GAAG,CAAC,CAAC,GAAG,EAAE;EAChD,KAAK,IAAIkD,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG5C,GAAG,CAACF,MAAM,EAAE8C,CAAC,EAAE,EAAE;IACnC,MAAME,UAAU,GAAIpD,SAAS,IAAIA,SAAS,CAACkD,CAAC,CAAC,IAAKA,CAAC;IACnD,MAAMb,KAAK,GAAG/B,GAAG,CAAC4C,CAAC,CAAC;IACpB,QAAQ,OAAOb,KAAK;MAClB,KAAK,QAAQ;MACb,KAAK,SAAS;QAEZtB,MAAM,CAACqC,UAAU,CAAC,GAAG;UAAChG,IAAI,EAAEiG,MAAM,CAACD,UAAU,CAAC;UAAEE,KAAK,EAAEJ,CAAC;UAAEK,IAAI,EAAEC;QAAY,CAAC;QAC7E;MACF,KAAK,QAAQ;MACb;QACEzC,MAAM,CAACqC,UAAU,CAAC,GAAG;UAAChG,IAAI,EAAEiG,MAAM,CAACD,UAAU,CAAC;UAAEE,KAAK,EAAEJ,CAAC;UAAEK,IAAI,EAAEhD;QAAK,CAAC;IAG1E;EACF;EACA,OAAOQ,MAAM;AACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/bundle.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,aAAa,KAAqB,CAAC"}
|
|
@@ -3,7 +3,7 @@ import type { TableBatch } from '@loaders.gl/schema';
|
|
|
3
3
|
import { Table } from '@loaders.gl/schema';
|
|
4
4
|
export type CSVLoaderOptions = LoaderOptions & {
|
|
5
5
|
csv?: {
|
|
6
|
-
shape?: 'array-row-table' | 'object-row-table'
|
|
6
|
+
shape?: 'array-row-table' | 'object-row-table';
|
|
7
7
|
/** optimizes memory usage but increases parsing time. */
|
|
8
8
|
optimizeMemoryUsage?: boolean;
|
|
9
9
|
columnPrefix?: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csv-loader.d.ts","sourceRoot":"","sources":["../../src/csv-loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EAAgC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAElF,OAAO,EAEL,KAAK,EAIN,MAAM,oBAAoB,CAAC;AAW5B,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QAEJ,KAAK,CAAC,EAAE,iBAAiB,GAAG,kBAAkB,CAAC;QAC/C,yDAAyD;QACzD,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,MAAM,CAAC,EAAE,MAAM,CAAC;QAKhB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QAEpB,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,cAAc,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;QAEpC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;KAE9B,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,gBAAgB,CAiC3E,CAAC"}
|
|
@@ -11,25 +11,6 @@ const async_iterator_streamer_1 = __importDefault(require("./papaparse/async-ite
|
|
|
11
11
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
12
12
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
13
13
|
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
14
|
-
const DEFAULT_CSV_LOADER_OPTIONS = {
|
|
15
|
-
csv: {
|
|
16
|
-
shape: 'object-row-table',
|
|
17
|
-
optimizeMemoryUsage: false,
|
|
18
|
-
// CSV options
|
|
19
|
-
header: 'auto',
|
|
20
|
-
columnPrefix: 'column',
|
|
21
|
-
// delimiter: auto
|
|
22
|
-
// newline: auto
|
|
23
|
-
quoteChar: '"',
|
|
24
|
-
escapeChar: '"',
|
|
25
|
-
dynamicTyping: true,
|
|
26
|
-
comments: false,
|
|
27
|
-
skipEmptyLines: true,
|
|
28
|
-
// transform: null?
|
|
29
|
-
delimitersToGuess: [',', '\t', '|', ';']
|
|
30
|
-
// fastMode: auto
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
14
|
exports.CSVLoader = {
|
|
34
15
|
id: 'csv',
|
|
35
16
|
module: 'csv',
|
|
@@ -43,11 +24,29 @@ exports.CSVLoader = {
|
|
|
43
24
|
parseInBatches: parseCSVInBatches,
|
|
44
25
|
// @ts-ignore
|
|
45
26
|
// testText: null,
|
|
46
|
-
options:
|
|
27
|
+
options: {
|
|
28
|
+
csv: {
|
|
29
|
+
shape: 'object-row-table',
|
|
30
|
+
optimizeMemoryUsage: false,
|
|
31
|
+
// CSV options
|
|
32
|
+
header: 'auto',
|
|
33
|
+
columnPrefix: 'column',
|
|
34
|
+
// delimiter: auto
|
|
35
|
+
// newline: auto
|
|
36
|
+
quoteChar: '"',
|
|
37
|
+
escapeChar: '"',
|
|
38
|
+
dynamicTyping: true,
|
|
39
|
+
comments: false,
|
|
40
|
+
skipEmptyLines: true,
|
|
41
|
+
// transform: null?
|
|
42
|
+
delimitersToGuess: [',', '\t', '|', ';']
|
|
43
|
+
// fastMode: auto
|
|
44
|
+
}
|
|
45
|
+
}
|
|
47
46
|
};
|
|
48
47
|
async function parseCSV(csvText, options) {
|
|
49
48
|
// Apps can call the parse method directly, we so apply default options here
|
|
50
|
-
const csvOptions = { ...
|
|
49
|
+
const csvOptions = { ...exports.CSVLoader.options.csv, ...options?.csv };
|
|
51
50
|
const firstRow = readFirstRow(csvText);
|
|
52
51
|
const header = csvOptions.header === 'auto' ? isHeaderRow(firstRow) : Boolean(csvOptions.header);
|
|
53
52
|
const parseWithHeader = header;
|
|
@@ -62,30 +61,21 @@ async function parseCSV(csvText, options) {
|
|
|
62
61
|
}
|
|
63
62
|
};
|
|
64
63
|
const result = papaparse_1.default.parse(csvText, papaparseConfig);
|
|
65
|
-
|
|
64
|
+
const rows = result.data;
|
|
66
65
|
const headerRow = result.meta.fields || generateHeader(csvOptions.columnPrefix, firstRow.length);
|
|
67
|
-
switch (csvOptions.shape) {
|
|
66
|
+
switch (csvOptions.shape || 'object-row-table') {
|
|
68
67
|
case 'object-row-table':
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
return {
|
|
69
|
+
shape: 'object-row-table',
|
|
70
|
+
data: rows.map((row) => (Array.isArray(row) ? (0, schema_1.convertToObjectRow)(row, headerRow) : row))
|
|
71
|
+
};
|
|
71
72
|
case 'array-row-table':
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
/*
|
|
77
|
-
if (!header && shape === 'object-row-table') {
|
|
78
|
-
// If the dataset has no header, transform the array result into an object shape with an
|
|
79
|
-
// autogenerated header
|
|
80
|
-
return result.data.map((row) =>
|
|
81
|
-
row.reduce((acc, value, i) => {
|
|
82
|
-
acc[headerRow[i]] = value;
|
|
83
|
-
return acc;
|
|
84
|
-
}, {})
|
|
85
|
-
);
|
|
73
|
+
return {
|
|
74
|
+
shape: 'array-row-table',
|
|
75
|
+
data: rows.map((row) => (Array.isArray(row) ? row : (0, schema_1.convertToArrayRow)(row, headerRow)))
|
|
76
|
+
};
|
|
86
77
|
}
|
|
87
|
-
|
|
88
|
-
return rows;
|
|
78
|
+
throw new Error(csvOptions.shape);
|
|
89
79
|
}
|
|
90
80
|
// TODO - support batch size 0 = no batching/single batch?
|
|
91
81
|
function parseCSVInBatches(asyncIterator, options) {
|
|
@@ -96,7 +86,7 @@ function parseCSVInBatches(asyncIterator, options) {
|
|
|
96
86
|
options.batchSize = 4000;
|
|
97
87
|
}
|
|
98
88
|
// Apps can call the parse method directly, we so apply default options here
|
|
99
|
-
const csvOptions = { ...
|
|
89
|
+
const csvOptions = { ...exports.CSVLoader.options.csv, ...options?.csv };
|
|
100
90
|
const asyncQueue = new schema_1.AsyncQueue();
|
|
101
91
|
let isFirstRow = true;
|
|
102
92
|
let headerRow = null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csv-writer.d.ts","sourceRoot":"","sources":["../../src/csv-writer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAC,KAAK,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAGhE,YAAY,EAAC,gBAAgB,EAAC,CAAC;AAS/B,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,gBAAgB,CAYjE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAEvC,YAAY,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encode-csv.d.ts","sourceRoot":"","sources":["../../../../src/lib/encoders/encode-csv.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,KAAK,EAAwC,MAAM,oBAAoB,CAAC;AAKhF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,CAAC,EAAE;QACJ,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,CAAC;IACF,kBAAkB;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,OAAO,GAAE,gBAAiD,GACzD,MAAM,CAsBR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-iterator-streamer.d.ts","sourceRoot":"","sources":["../../../src/papaparse/async-iterator-streamer.ts"],"names":[],"mappings":"AAWA,iBAAwB,qBAAqB,CAAC,MAAM,KAAA,QAwDnD;kBAxDuB,qBAAqB;;;eAArB,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"papaparse.d.ts","sourceRoot":"","sources":["../../../src/papaparse/papaparse.ts"],"names":[],"mappings":"AAmBA,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;CAuBT,CAAC;AACF,eAAe,IAAI,CAAC;AAepB,iBAAS,SAAS,CAChB,MAAM,KAAA,EACN,OAAO,KAAA,EACP,mBAAmB,CAAC,KAAA,OAiErB;AAED,iBAAS,SAAS,CAAC,MAAM,KAAA,EAAE,OAAO,KAAA,UA+KjC;AAED,gFAAgF;AAChF,iBAAS,aAAa,CAAC,MAAM,KAAA,QAuF5B;AACD,iBAAS,cAAc,CAAC,MAAM,KAAA,QAiB7B;kBAjBQ,cAAc;;;AAsBvB,iBAAS,YAAY,CAAC,OAAO,KAAA,QA8T5B;AAOD,gEAAgE;AAChE,iBAAS,MAAM,CAAC,MAAM,KAAA,QA8TrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../node_modules/typescript/lib/lib.scripthost.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/typescript/lib/lib.es2020.full.d.ts","../src/bundle.ts","../../loader-utils/dist/types.d.ts","../../loader-utils/dist/loader-types.d.ts","../../loader-utils/dist/writer-types.d.ts","../../loader-utils/dist/lib/env-utils/assert.d.ts","../../loader-utils/dist/lib/env-utils/globals.d.ts","../../loader-utils/dist/lib/option-utils/merge-loader-options.d.ts","../../loader-utils/dist/lib/worker-loader-utils/create-loader-worker.d.ts","../../loader-utils/dist/lib/worker-loader-utils/parse-with-worker.d.ts","../../loader-utils/dist/lib/worker-loader-utils/encode-with-worker.d.ts","../../loader-utils/dist/lib/parser-utils/parse-json.d.ts","../../loader-utils/dist/lib/binary-utils/array-buffer-utils.d.ts","../../loader-utils/dist/lib/binary-utils/memory-copy-utils.d.ts","../../loader-utils/dist/lib/binary-utils/dataview-copy-utils.d.ts","../../loader-utils/dist/lib/binary-utils/get-first-characters.d.ts","../../loader-utils/dist/lib/iterators/text-iterators.d.ts","../../loader-utils/dist/lib/iterators/async-iteration.d.ts","../../loader-utils/node_modules/@probe.gl/stats/dist/lib/stat.d.ts","../../loader-utils/node_modules/@probe.gl/stats/dist/lib/stats.d.ts","../../loader-utils/node_modules/@probe.gl/stats/dist/utils/hi-res-timestamp.d.ts","../../loader-utils/node_modules/@probe.gl/stats/dist/index.d.ts","../../loader-utils/dist/lib/request-utils/request-scheduler.d.ts","../../loader-utils/dist/lib/path-utils/file-aliases.d.ts","../../schema/dist/types/types.d.ts","../../../node_modules/apache-arrow/node_modules/flatbuffers/js/constants.d.ts","../../../node_modules/apache-arrow/node_modules/flatbuffers/js/long.d.ts","../../../node_modules/apache-arrow/node_modules/flatbuffers/js/encoding.d.ts","../../../node_modules/apache-arrow/node_modules/flatbuffers/js/byte-buffer.d.ts","../../../node_modules/apache-arrow/node_modules/flatbuffers/js/builder.d.ts","../../../node_modules/apache-arrow/node_modules/flatbuffers/js/types.d.ts","../../../node_modules/apache-arrow/node_modules/flatbuffers/js/utils.d.ts","../../../node_modules/apache-arrow/node_modules/flatbuffers/js/flatbuffers.d.ts","../../../node_modules/apache-arrow/fb/body-compression-method.d.ts","../../../node_modules/apache-arrow/fb/compression-type.d.ts","../../../node_modules/apache-arrow/fb/body-compression.d.ts","../../../node_modules/apache-arrow/fb/buffer.d.ts","../../../node_modules/apache-arrow/fb/field-node.d.ts","../../../node_modules/apache-arrow/fb/record-batch.d.ts","../../../node_modules/apache-arrow/fb/dictionary-batch.d.ts","../../../node_modules/apache-arrow/fb/endianness.d.ts","../../../node_modules/apache-arrow/fb/dictionary-kind.d.ts","../../../node_modules/apache-arrow/fb/int.d.ts","../../../node_modules/apache-arrow/fb/dictionary-encoding.d.ts","../../../node_modules/apache-arrow/fb/key-value.d.ts","../../../node_modules/apache-arrow/fb/binary.d.ts","../../../node_modules/apache-arrow/fb/bool.d.ts","../../../node_modules/apache-arrow/fb/date-unit.d.ts","../../../node_modules/apache-arrow/fb/date.d.ts","../../../node_modules/apache-arrow/fb/decimal.d.ts","../../../node_modules/apache-arrow/fb/time-unit.d.ts","../../../node_modules/apache-arrow/fb/duration.d.ts","../../../node_modules/apache-arrow/fb/fixed-size-binary.d.ts","../../../node_modules/apache-arrow/fb/fixed-size-list.d.ts","../../../node_modules/apache-arrow/fb/precision.d.ts","../../../node_modules/apache-arrow/fb/floating-point.d.ts","../../../node_modules/apache-arrow/fb/interval-unit.d.ts","../../../node_modules/apache-arrow/fb/interval.d.ts","../../../node_modules/apache-arrow/fb/large-binary.d.ts","../../../node_modules/apache-arrow/fb/large-list.d.ts","../../../node_modules/apache-arrow/fb/large-utf8.d.ts","../../../node_modules/apache-arrow/fb/list.d.ts","../../../node_modules/apache-arrow/fb/map.d.ts","../../../node_modules/apache-arrow/fb/null.d.ts","../../../node_modules/apache-arrow/fb/struct_.d.ts","../../../node_modules/apache-arrow/fb/time.d.ts","../../../node_modules/apache-arrow/fb/timestamp.d.ts","../../../node_modules/apache-arrow/fb/union-mode.d.ts","../../../node_modules/apache-arrow/fb/union.d.ts","../../../node_modules/apache-arrow/fb/utf8.d.ts","../../../node_modules/apache-arrow/fb/type.d.ts","../../../node_modules/apache-arrow/fb/field.d.ts","../../../node_modules/apache-arrow/fb/schema.d.ts","../../../node_modules/apache-arrow/fb/sparse-matrix-compressed-axis.d.ts","../../../node_modules/apache-arrow/fb/sparse-matrix-index-c-s-x.d.ts","../../../node_modules/apache-arrow/fb/sparse-tensor-index-c-o-o.d.ts","../../../node_modules/apache-arrow/fb/sparse-tensor-index-c-s-f.d.ts","../../../node_modules/apache-arrow/fb/sparse-tensor-index.d.ts","../../../node_modules/apache-arrow/fb/tensor-dim.d.ts","../../../node_modules/apache-arrow/fb/sparse-tensor.d.ts","../../../node_modules/apache-arrow/fb/tensor.d.ts","../../../node_modules/apache-arrow/fb/message-header.d.ts","../../../node_modules/apache-arrow/enum.d.ts","../../../node_modules/apache-arrow/schema.d.ts","../../../node_modules/apache-arrow/row/map.d.ts","../../../node_modules/apache-arrow/row/struct.d.ts","../../../node_modules/apache-arrow/builder/buffer.d.ts","../../../node_modules/@types/node/assert.d.ts","../../../node_modules/@types/node/assert/strict.d.ts","../../../node_modules/@types/node/globals.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/dom-events.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/readline/promises.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/test.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/globals.global.d.ts","../../../node_modules/@types/node/index.d.ts","../../../node_modules/apache-arrow/io/node/builder.d.ts","../../../node_modules/apache-arrow/io/whatwg/builder.d.ts","../../../node_modules/apache-arrow/builder.d.ts","../../../node_modules/apache-arrow/builder/bool.d.ts","../../../node_modules/apache-arrow/builder/null.d.ts","../../../node_modules/apache-arrow/builder/date.d.ts","../../../node_modules/apache-arrow/builder/decimal.d.ts","../../../node_modules/apache-arrow/builder/int.d.ts","../../../node_modules/apache-arrow/builder/dictionary.d.ts","../../../node_modules/apache-arrow/builder/fixedsizebinary.d.ts","../../../node_modules/apache-arrow/builder/float.d.ts","../../../node_modules/apache-arrow/builder/time.d.ts","../../../node_modules/apache-arrow/builder/timestamp.d.ts","../../../node_modules/apache-arrow/builder/interval.d.ts","../../../node_modules/apache-arrow/builder/utf8.d.ts","../../../node_modules/apache-arrow/builder/binary.d.ts","../../../node_modules/apache-arrow/builder/list.d.ts","../../../node_modules/apache-arrow/builder/fixedsizelist.d.ts","../../../node_modules/apache-arrow/builder/map.d.ts","../../../node_modules/apache-arrow/builder/struct.d.ts","../../../node_modules/apache-arrow/builder/union.d.ts","../../../node_modules/apache-arrow/interfaces.d.ts","../../../node_modules/apache-arrow/type.d.ts","../../../node_modules/apache-arrow/vector.d.ts","../../../node_modules/apache-arrow/data.d.ts","../../../node_modules/apache-arrow/recordbatch.d.ts","../../../node_modules/apache-arrow/table.d.ts","../../../node_modules/apache-arrow/visitor.d.ts","../../../node_modules/apache-arrow/factories.d.ts","../../../node_modules/apache-arrow/io/interfaces.d.ts","../../../node_modules/apache-arrow/util/buffer.d.ts","../../../node_modules/apache-arrow/io/stream.d.ts","../../../node_modules/apache-arrow/fb/block.d.ts","../../../node_modules/apache-arrow/ipc/metadata/file.d.ts","../../../node_modules/apache-arrow/ipc/metadata/json.d.ts","../../../node_modules/apache-arrow/ipc/metadata/message.d.ts","../../../node_modules/apache-arrow/io/file.d.ts","../../../node_modules/apache-arrow/ipc/message.d.ts","../../../node_modules/apache-arrow/ipc/reader.d.ts","../../../node_modules/apache-arrow/ipc/writer.d.ts","../../../node_modules/apache-arrow/ipc/serialization.d.ts","../../../node_modules/apache-arrow/util/bn.d.ts","../../../node_modules/apache-arrow/util/int.d.ts","../../../node_modules/apache-arrow/util/bit.d.ts","../../../node_modules/apache-arrow/visitor/typecomparator.d.ts","../../../node_modules/apache-arrow/Arrow.d.ts","../../../node_modules/apache-arrow/Arrow.dom.d.ts","../../../node_modules/apache-arrow/Arrow.node.d.ts","../../schema/dist/types/schema.d.ts","../../../node_modules/@types/geojson/index.d.ts","../../schema/dist/types/flat-geometries.d.ts","../../schema/dist/types/binary-geometries.d.ts","../../schema/dist/types/category-gis.d.ts","../../schema/dist/types/category-table.d.ts","../../schema/dist/lib/table/batches/table-batch-aggregator.d.ts","../../schema/dist/lib/table/batches/table-batch-builder.d.ts","../../schema/dist/lib/table/batches/row-table-batch-aggregator.d.ts","../../schema/dist/lib/table/batches/columnar-table-batch-aggregator.d.ts","../../schema/dist/lib/table/simple-table/table-accessors.d.ts","../../schema/dist/lib/table/arrow-api/enum.d.ts","../../schema/dist/lib/table/arrow-api/arrow-like-type.d.ts","../../schema/dist/lib/table/arrow-api/arrow-like-field.d.ts","../../schema/dist/lib/table/arrow-api/arrow-like-schema.d.ts","../../schema/dist/lib/table/arrow-api/arrow-like-table.d.ts","../../schema/dist/lib/table/simple-table/make-table.d.ts","../../schema/dist/lib/table/simple-table/table-schema.d.ts","../../schema/dist/lib/table/simple-table/row-utils.d.ts","../../schema/dist/lib/table/simple-table/data-type.d.ts","../../schema/dist/types/category-mesh.d.ts","../../schema/dist/lib/mesh/mesh-utils.d.ts","../../schema/dist/lib/mesh/deduce-mesh-schema.d.ts","../../schema/dist/types/category-image.d.ts","../../schema/dist/types/category-texture.d.ts","../../schema/dist/lib/table/arrow-api/index.d.ts","../../schema/dist/lib/table/arrow-api/get-type-info.d.ts","../../schema/dist/lib/table/arrow/arrow-type-utils.d.ts","../../schema/dist/lib/utils/async-queue.d.ts","../../schema/dist/index.d.ts","../../loader-utils/dist/json-loader.d.ts","../../loader-utils/dist/lib/binary-utils/memory-conversion-utils.d.ts","../../loader-utils/dist/lib/node/promisify.d.ts","../../loader-utils/dist/lib/path-utils/path.d.ts","../../loader-utils/dist/lib/node/fs.d.ts","../../loader-utils/dist/lib/node/stream.d.ts","../../loader-utils/dist/lib/filesystems/filesystem.d.ts","../../loader-utils/dist/lib/filesystems/node-filesystem.d.ts","../../loader-utils/dist/lib/file-provider/file-provider.d.ts","../../loader-utils/dist/lib/file-provider/file-handle.d.ts","../../loader-utils/dist/lib/file-provider/file-handle-file.d.ts","../../loader-utils/dist/lib/file-provider/data-view-file.d.ts","../../loader-utils/dist/lib/filesystems/readable-file.d.ts","../../loader-utils/dist/lib/filesystems/writable-file.d.ts","../../loader-utils/dist/index.d.ts","../src/papaparse/papaparse.ts","../src/papaparse/async-iterator-streamer.ts","../src/csv-loader.ts","../src/lib/encoders/encode-csv.ts","../src/csv-writer.ts","../src/index.ts","../../../node_modules/@types/connect/index.d.ts","../../../node_modules/@types/body-parser/index.d.ts","../../../node_modules/@types/brotli/compress.d.ts","../../../node_modules/@types/brotli/decompress.d.ts","../../../node_modules/@types/brotli/index.d.ts","../../../node_modules/@types/command-line-args/index.d.ts","../../../node_modules/@types/command-line-usage/index.d.ts","../../../node_modules/@types/crypto-js/index.d.ts","../../../node_modules/@types/emscripten/index.d.ts","../../../node_modules/@types/send/node_modules/@types/mime/index.d.ts","../../../node_modules/@types/send/index.d.ts","../../../node_modules/@types/range-parser/index.d.ts","../../../node_modules/@types/qs/index.d.ts","../../../node_modules/@types/express-serve-static-core/index.d.ts","../../../node_modules/@types/mime/Mime.d.ts","../../../node_modules/@types/mime/index.d.ts","../../../node_modules/@types/http-errors/index.d.ts","../../../node_modules/@types/serve-static/index.d.ts","../../../node_modules/@types/express/index.d.ts","../../../node_modules/@types/flatbuffers/index.d.ts","../../../node_modules/@types/ndarray/index.d.ts","../../../node_modules/@types/get-pixels/index.d.ts","../../../node_modules/@types/minimatch/index.d.ts","../../../node_modules/@types/glob/index.d.ts","../../../node_modules/@types/hammerjs/index.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/json5/index.d.ts","../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/mdast/index.d.ts","../../../node_modules/@types/minimist/index.d.ts","../../../node_modules/@types/node-int64/index.d.ts","../../../node_modules/@types/normalize-package-data/index.d.ts","../../../node_modules/@types/offscreencanvas/index.d.ts","../../../node_modules/@types/pad-left/index.d.ts","../../../node_modules/@types/pako/index.d.ts","../../../node_modules/@types/pbf/index.d.ts","../../../node_modules/@types/pngjs/index.d.ts","../../../node_modules/@types/proj4/index.d.ts","../../../node_modules/@types/q/index.d.ts","../../../node_modules/@types/sql.js/index.d.ts","../../../node_modules/@types/through/index.d.ts","../../../node_modules/@types/tape/index.d.ts","../../../node_modules/@types/tape-promise/index.d.ts","../../../node_modules/@types/thrift/index.d.ts","../../../node_modules/@types/varint/index.d.ts","../../../node_modules/@types/yauzl/index.d.ts"],"fileInfos":[{"version":"f59215c5f1d886b05395ee7aca73e0ac69ddfad2843aa88530e797879d511bad","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","dc48272d7c333ccf58034c0026162576b7d50ea0e69c3b9292f803fc20720fd5","27147504487dc1159369da4f4da8a26406364624fa9bc3db632f7d94a5bae2c3","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4",{"version":"3dda5344576193a4ae48b8d03f105c86f20b2f2aff0a1d1fd7935f5d68649654","affectsGlobalScope":true},{"version":"35299ae4a62086698444a5aaee27fc7aa377c68cbb90b441c9ace246ffd05c97","affectsGlobalScope":true},{"version":"c5c5565225fce2ede835725a92a28ece149f83542aa4866cfb10290bff7b8996","affectsGlobalScope":true},{"version":"7d2dbc2a0250400af0809b0ad5f84686e84c73526de931f84560e483eb16b03c","affectsGlobalScope":true},{"version":"9d9885c728913c1d16e0d2831b40341d6ad9a0ceecaabc55209b306ad9c736a5","affectsGlobalScope":true},{"version":"17bea081b9c0541f39dd1ae9bc8c78bdd561879a682e60e2f25f688c0ecab248","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"ab22100fdd0d24cfc2cc59d0a00fc8cf449830d9c4030dc54390a46bd562e929","affectsGlobalScope":true},{"version":"f7bd636ae3a4623c503359ada74510c4005df5b36de7f23e1db8a5c543fd176b","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"0c20f4d2358eb679e4ae8a4432bdd96c857a2960fd6800b21ec4008ec59d60ea","affectsGlobalScope":true},{"version":"36ae84ccc0633f7c0787bc6108386c8b773e95d3b052d9464a99cd9b8795fbec","affectsGlobalScope":true},{"version":"82d0d8e269b9eeac02c3bd1c9e884e85d483fcb2cd168bccd6bc54df663da031","affectsGlobalScope":true},{"version":"b8deab98702588840be73d67f02412a2d45a417a3c097b2e96f7f3a42ac483d1","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"376d554d042fb409cb55b5cbaf0b2b4b7e669619493c5d18d5fa8bd67273f82a","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"c4138a3dd7cd6cf1f363ca0f905554e8d81b45844feea17786cdf1626cb8ea06","affectsGlobalScope":true},{"version":"6ff3e2452b055d8f0ec026511c6582b55d935675af67cdb67dd1dc671e8065df","affectsGlobalScope":true},{"version":"03de17b810f426a2f47396b0b99b53a82c1b60e9cba7a7edda47f9bb077882f4","affectsGlobalScope":true},{"version":"8184c6ddf48f0c98429326b428478ecc6143c27f79b79e85740f17e6feb090f1","affectsGlobalScope":true},{"version":"261c4d2cf86ac5a89ad3fb3fafed74cbb6f2f7c1d139b0540933df567d64a6ca","affectsGlobalScope":true},{"version":"6af1425e9973f4924fca986636ac19a0cf9909a7e0d9d3009c349e6244e957b6","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"15a630d6817718a2ddd7088c4f83e4673fde19fa992d2eae2cf51132a302a5d3","affectsGlobalScope":true},{"version":"f06948deb2a51aae25184561c9640fb66afeddb34531a9212d011792b1d19e0a","affectsGlobalScope":true},{"version":"01e0ee7e1f661acedb08b51f8a9b7d7f959e9cdb6441360f06522cc3aea1bf2e","affectsGlobalScope":true},{"version":"ac17a97f816d53d9dd79b0d235e1c0ed54a8cc6a0677e9a3d61efb480b2a3e4e","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"ec0104fee478075cb5171e5f4e3f23add8e02d845ae0165bfa3f1099241fa2aa","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"9cc66b0513ad41cb5f5372cca86ef83a0d37d1c1017580b7dace3ea5661836df","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"307c8b7ebbd7f23a92b73a4c6c0a697beca05b06b036c23a34553e5fe65e4fdc","affectsGlobalScope":true},{"version":"189c0703923150aa30673fa3de411346d727cc44a11c75d05d7cf9ef095daa22","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},"322cc0ca9c311414642c0d7ef3b57beedbac198ca074e3e109a4be4c366dcb81",{"version":"9d3c44c5662654459def646b30ff930d4198e5b77d57cf1d21d5de5f7b30dc07","signature":"1160f1801f74994542376d565e986ec3e49c83b662019fe09e2b5107e75977fb","affectsGlobalScope":true},"33e032e02fe1909039aba738d93c54a3552ee2347f47c811c0decd0b8f5b2f3e","82a1ba203c0b96773921865b58e9b391d659eddec725fe5e7489c53f3e36eae8","ff59cc4c292f20c9a088fae5d3b9e3cb04d46cfa07c6ee873a03b0e4e52dd0ec","27939d01f8d6be041c1d5c1816b428b3e8229829233e073f7b45b6af3b660ebe","7c4dd44256edda6b1e653ade809a4834ea1672557c32740e7018a89082e67f98","50cccf12df778f241ed7bc0924507debdc3ea0aab99bd8567f4f62ec66ce1e71","16945fb857d0467c9990ab40c66ee4b548b9aac85fdb1dee0a51d7dc93962c57","394462987ac0b4c19b7c59b4eb984f9e5db86af93a96e752918d945197e22982","d20beb3b34cb36fa1a97972df3321ec8e4462a842544c81877f2150bc9c2ddf9","e0f7c61f78b9d64f5c05de758086d992bea83dbdf0c6cace9c5df02534cd0bb2","8312a4d6aa569fc57d9f564678e5817483feb50fedebe84e50cc9c1cf0c33459","65e0b1ad130fc07161f051c2a5e5c3c4a5d3fc9ae70806b87aa3d91e21f25fb4","2ad4364f8229359d8d87035a32a6a4adf4ae17ae417c3020e5051177856f0d6c","d1c7ce4be3ae34ad0b2ea4a685f2521701a36382808d049ac5e2d259025479ed","ab844b5925c28e479fc12a62d863d475404134f4d5c55f9287666ea94aa30d1f","2da34af5c8cf099add4be5774fd504f802e6e0711820b0cddd76da9182c90f19","8432aee1c4d9e7490d0276956afb4945285aa54ca0ef2ea33c94a1362ad40656","289c93fe295277a33119aaee688863eee6d7ec57111f428a12f77ab6af9790a9","476cc782a34c53072c7b585184fab1da9cc381337ce8c7562e2d50d1a16ef5ad","6dd764e36d98ddf0b22e042d5a693a3e7664accff7029a75492e061d763febed","8b789c97d89d9a45ac1005dd50350aecc2c4e9d9ec56efacc3edf41171324ef4","1d6736f895b28f9db177573a41c4b33566a0764b149f0e0dc92116786ae375a2","49e837668d4c989f90c458286cef8ba31dff74baa3101b7246cb4bb0d1401cfe","a96f95bf153b531cba331af0764a6724eddc0c57d14511ea8394c83c1d69577d","313578886546ee7e397556403825f5e4124522b34968a0e42b564ef94b37cd39","b5886bd56bbee8b881eb7398c46394b5594492024b1bf08f3e9f7fb2b3edc65f","f76db0c25ec33da4e02f263974667125c34588e40ba6e27dac432d881424c478","706219d7b861f7d47420f7e0631033789b8267c4839069d57a017a4cca60225d","144aa0e0b009959b4f754f1e67c9f5832f7969fb81a6e1c04405ebca6bcbb163","790871f1d754ff95770a34437ddd8ca19585c09ceab97f862a8318bb3822b018","8fd0d2460c0eb46708266a03cb5670070b068fe1e87293c4e04c3a8bae812345","cb31fbd38e527e01368c338daa15c472c9dacb72a0a6e483d7f338d2a2b88d92","9a056e9b9acc76b8320976d9fe6cd87c53bc1f4e2919613bcceebcff6b539cfa","a8f09ab4bfbaf32009c5ceb09f267c45d3e9fad63a9640c3dfc824480522eb1c","f3773a4fcb8370396b23f3e440b1e4eccfa3da0d8492b05c05298cfda8716b8f","3745bc77c41b187a6818bac292a99063e3df119e3188f52b5c746bcded657aa9","2aa505c0f8f9a37a0f428647a55bd7163dab80495e447ce2ee7278da70d326aa","794f93641f5ac427d32c1f5bfb62c74b423bba9cd31b70fef930a5a1f6b47012","9fa2d338f2c6e4fb5a2cf20bc83f24102f177c9996a9550ab9cb295afc443322","b6b354bd57b44849015d119134a2adf6136dd459fb38f3625fbb35c844343362","831e08bc1e0e0fed9f34180a42bcffa15437283b3a90c453f98fd82f639784c0","de1574ecbc9f43c31ae1f5d11433be7f371a03a9e380475b91f808d625ef5c99","6210058f2ce3e9052681f3d2df475d6bda1cee4584dd3a5ef1ef0e60959522d7","7a04ce0e85d6db683f63ec9f2699fac3e2d9fdd6a9313dda42e25761a3c83a2c","2b9c4aed45c33a93dc6de1e5894094090363aaee045921a0e6ef245657c5315d","b9c7f144f9051934bba76cb051d806377a0676ed488ae5764daa9bf7a198fbad","dd36b72841bc2a5edbe39640abc5d0175f06b9de32d6b767615c62c460330382","de06c3051539ddd64044947bf5a804005e98b09613699b19de1c09ef8e8df95f","681c8a82369365bef1360957b467844e8bb3e9626df2162d904c8bbfc92863f8","8585b7a7cc1cb48171fd9e168ca0126a921189c6643cc4dd5dac43de6d3b61e4","7eb739af12059b8c368641641776937254b381ba298e43820b78696d4e12d3c9","f85ef2b6b6243d398b2146de3186f12c825a18295d3913aee1d7ad237856c6c3","e83218020bb0bc9a527cf10bca9f3afe489900c60dee03e8398fe135054c81ae","d30f3ae4c835c4006e1676170181461e7e97b4e1d2fa0c96a4d0a355cd97fd8f","989b02e98599537eccb0e89c3c737b75159fc64299bcee5ecf495535a4096efd","b0cfe92f5a41d98256df17702e2e30afbcbc5d33fcde330b20dcac2df26b393e","7de22e2447797056c5bbf57153d8e7d7106bab19b2bb8111cf9c9776935b81e9","74ecda5bfdd35b1b365b3069acb0224303c20b458e92dbacf6954eef4d9f30db","7e1862fcb5a27f449515e7ad569afb738896183889a3dfbf09f125d2ad1effaa","c3bc001ab25d65e716b576b0c607d413802122e85fedf847629227fdbf73298e","e0644b2e6e5f5709fd5b0377e801ae12fbd1a9d612312ed86b823159421e29fd","1dfa53faf0395d8e6714329b001659009171d5268f7231ad05fefeb19b7dd0a2","6d0e0c26cd26694ef8f4776443fdd846add0a327244424b5be1eb3320a770486","77df8e8553d35e13728f6d0a37ca982520046645694ec1edab9df2df4e905dc2","387575cfe4ed66a1e3b066d2b6923c41be68d39905d62a8fa00e95cee9d4e719","03c9cee66774b18d3c20119b5fd25b3a94f95757aa82cb5bfe9cf7cb91400bd9","0c7aadf8379300a1dba35b087663c682f440aa5923ea96a8ff9ff483b891766c","70f8da676faa53028982803fb3b389b98119fb0b41df9020a3130b008ac6dc74","16ed663fa7a4d8d76059b7e0ca6992ff0ad6c336530f8b092c3dfcea4da1b618","072c2a38de7622770d6ae7cd005c96eae02f7c3440bfa9ee440d02e81e0e115e","1300af6aeb3b492a0f627ab4d849aad3b7dd22c2a48fd178b50b82761a436572","959e21dddaa3d50c7a9573c033371f8a8eb75e1da2e4f0d2ffc2e44862a7939f","5c5150c7774dcedeaf599b1372b8158b3f8a0e665d602a35e34470822da59f59","552670d32b9320e00dab0cc8efe8db05d4e306b5a3a5c67bed9c31dd6ef473e4","07cf01ae7f286d5c1390bec1fc2cad285c2cd96b3778b61eddfadd2305786040","f0b817f2b42aef16e14c95bebcca42cf9c4e70107dcd68b87d400211ef89d947","41e408897869a45961f091612c1fc02f4c22927ed371d64f4547188e2fa68186","dd300e39502e1fca30e17340f46dcddfaa7388ca5ef0a203c2d3eb12c26fd24c","cf3c4e264eb6b1733ef8b189cf9c65e4a9fb90d386a800e60256f128cf976217","5ffe14c99d9130074d6bbc1edeabe4b4ef9168a05986ac7aff84ac5735c4d77b","e5fdfb44e69cc7ddaf28db39288c24b1116f33539aee0b0fc7b7a436c73cb727","980826c7be8addf3ca7bb0c238d26a682442dfbe0abe8103e63fbba13b942a2c","7f9371e6554e4e48793a31a353d00fa92dd92a0b8fa8ae00e480036e3a4d2776","079452c7960403adefa14c8317f813b1a4f3693c84a15fb3d48bd405428665ff","33ee5e3453dc5ce5e646a0903558ab33ef4da71f55f7419fc93a18cf74070e29","7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"f749812878fecfa53cfc13b36e5d35086fb6377983a9df44175da83ccc23af1f","affectsGlobalScope":true},"7d2e3fea24c712c99c03ad8f556abedbfe105f87f1be10b95dbd409d24bc05a3",{"version":"211e3f15fbced4ab4be19f49ffa990b9ff20d749d33b65ff753be691e7616239","affectsGlobalScope":true},"374ca798f244e464346f14301dc2a8b4b111af1a83b49fffef5906c338a1f922","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","e596c9bb2f29a2699fdd4ae89139612652245192f67f45617c5a4b20832aaae9","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","1cdcfc1f624d6c08aa12c73935f6e13f095919cd99edf95752951796eb225729","216717f17c095cde1dc19375e1ab3af0a4a485355860c077a4f9d6ea59fab5b5","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"00dee7cdca8b8420c47ea4a31a34b8e8294013ebc4f463fd941e867e7bf05029","affectsGlobalScope":true},"80473bd0dd90ca1e166514c2dfead9d5803f9c51418864ca35abbeec6e6847e1","1c84b46267610a34028edfd0d035509341751262bac1062857f3c8df7aff7153","3bd1b21f21d18995315d232c5c7e868651e109396f3ca48fa8ab15f57a20d911","a3d541d303ee505053f5dcbf9fafb65cac3d5631037501cd616195863a6c5740","8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e630e5528e899219ae319e83bef54bf3bcb91b01d76861ecf881e8e614b167f0","affectsGlobalScope":true},"bcebb922784739bdb34c18ee51095d25a92b560c78ccd2eaacd6bd00f7443d83","7ee6ed878c4528215c82b664fe0cfe80e8b4da6c0d4cc80869367868774db8b1","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"0715e4cd28ad471b2a93f3e552ff51a3ae423417a01a10aa1d3bc7c6b95059d6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","4f3fdeba4e28e21aa719c081b8dc8f91d47e12e773389b9d35679c08151c9d37","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","f69ff39996a61a0dd10f4bce73272b52e8024a4d58b13ab32bf4712909d0a2b7",{"version":"3c4ba1dd9b12ffa284b565063108f2f031d150ea15b8fafbdc17f5d2a07251f3","affectsGlobalScope":true},"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","1422cd9e705adcc09088fda85a900c2b70e3ad36ea85846f68bd1a884cdf4e2b","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"a73ae8c0e62103bb9e21bb6538700881bf135b9a8b125b857ec68edfa0da4ed3","affectsGlobalScope":true},{"version":"e1c1b2fbe236bf7ee3e342eeae7e20efb8988a0ac7da1cbbfa2c1f66b76c3423","affectsGlobalScope":true},"868831cab82b65dfe1d68180e898af1f2101e89ba9b754d1db6fb8cc2fac1921","0fe8985a28f82c450a04a6edf1279d7181c0893f37da7d2a27f8efd4fd5edb03","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"52120bb7e4583612225bdf08e7c12559548170f11e660d33a33623bae9bbdbba","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"a6dd3dba8e665ac43d279e0fdf5219edda0eed69b5e9a5061f46cd6a65c4f7a1","24e0c721af74e910871feef872c9a1ce232e8cace0b2080ff73224200ad039a8","dd1f84835041fb21fbcb6d213290cfdb07fbd7551c5b9340db3f5a8906d403c9","d1cf164102945309b279ff06bc2d121ac737e5487a2408914655f689ecc2be1f","fd2d5cc8041746b1cc71ab247163982c68b4fad0522b2a8f555368d57f1aa134","7f56883fceba869ca2e3bab049cf33272bac1a6937c235c652e0bbd9aef67624","af1f132f95a4a56d9304f8dfe68f116d2324b0368411574932c55cbe2fafa214","4e0a5de3811fcb44426b7f6bea3458d1c794591d0b4a715c51c3ad5d70f08ab4","68b735874e866f37d072bf674535a9f33965132ed9e1e4164a6fbc494d590604","ae00f389de90b675f2047b79712e9844c74fbdc46269fcb2903af02688f1f747","94d41a754d3dda0f2517d49d181f1ba1d812b85e7bc2c822c40be945328edc33","842ffda229092b37ce0bc6748b09a38aaedc8490a69b3a10ec48ebf47baa3224","0449afb9de90d153878437b4004c6c5ce1e2f8f33e93ace383d387b683bac845","358999876ec96fa23597d354ed2fe6ae495d7c654e720ab3be349179133ed14d","8daf1c92a5955e61e5f82160f1d3db34beb4b60657a20ed91e450b32c4d09350","74e3a9065b290394d3ee7fb111bb4523d846663d898aa21bb76c8e9af979ffa2","e19b2a73885f75f29b2adcf1077c8dde7d69137af24c065b5ae7d7fa9bd3b820","0e720e8c78a3398bb6fe498919c4e21ce991c093a93235d7641891b65d0cad54","207e465a5c27537cd6c987739a0ccdd2bd0b13dc69511d11bfe979e19fcbbbbd","89d7ce9f057c91a287f92b0c74f8a82c049015c33aef66b4e8eba22ca1a99d3c","27551a71453552cdb14453753b2808fb405e6b1495f53b1de318953ac4ac73b5","0bb991b7c106b013ccd1b236bca252a34d8cfd2a61387409c1c407e8e07acada","100d90feee460e8a37361e70daddfc02a5bd10e7533b3b665a99c9209ffedd41","b13ebf46be89227ecdce6890e2cc34ce4f0466d841b725c33d0391024da3f7ae","44954550db029d8e4f439fadeb9007941907b0a5fcda1cdf53498cb83a125a8e","3c2331000a4e2411c1d01654ca175328cf92969bae5ad0b118f718c6ab76c29c","fe47866cf57ede76bc97ddce7d33933ec21a4ffda175a10841e8fba45de7330f","ffe308a8dca440f45388b685bd7bee2a61d9d40624fcd0d6383844d90843bb68","3b7f2318cf351fcf9883a2c87ca85ce4dd3027dfbf6931fc034c9d3f23a2b6c3","a92b669c214619cb45f1bd61371e7f2e283038526a25bc7b5639a3d54a2c564b","61844067a95e4def7ee2acc6e3f23020ec7c39878875b4fbf2a7ce690d7317e9","7329ef228ebef4fd465e5e0b758e4b5b8e6f2101c1adb225e909c9b23f47ab65","1aef8ff26344677a25aada37ca21c2c4010b253ee12e17994cc5f600e08ff23c","267c04c2f42aefe9873b676b2c53f6ad4568ffe5aca8bafb3feed85de589421b","50983e4e38a9e49f13cd6872f3f792cf3862bcda2b27da1cbcd77115fa2ea576","414e31d3a66f5c79cb49e82c3960a6983f1c031df82de1008bd255bf7aee58ae","1fd690a1508978bd1b9bbfba93bf6d2427844a9d843a0fec8ec403245f7c17ed","87b5a7dce771abfa0ea41eca3935c98f98148b9f563a62c582f0b456a63d951a","5d176ae3b4b1d9b4fd09dd2181d8822dbdfda2975efbe688289e7799e4acc3f1","ed5f6bfd7c5940d499a0643a7123e6bbe189e14b81e5c2212e9ec17d8098803b","26f5cc01fbfc3491b155f37a4972de5df84e9f732ec20c3279992004a695b5aa","1f85b7ae56ec956006aaca89e7062d946159c745667f6a606e1fdedb05d16125","6d99a02b5485acf43be901107e3234eb40899ed0750effef618ef58c8bed8fe1","87fd703309f6f640f2a0a6ce79c0b14c02cbbfdbd3913d6af601be883ab8cf18","9bb021b1303e52cdc159ad2a254e449c68b9b5157ae26b9d918f19e2c8d94223","ce3e8890c187fdab18aa9c41aeadd0bb3fb13875dea5ea03e1d3c07e8446ee79","b805d0d71ff06989066a17d8e1f75467657087390934abaec216b83b2f1754bb","1a90db26f4f4dee02b8bd2a7d470bb08162c644185630c5d71436592d9331536","b01d9cda99bd4a3363a6605f0e20de677fb6942eadd642991fb05a27abbba73e","7fe51705b1a1b94c66bf99e48c3467806682aa57523df8f680437effe8d1b2a8","a3b6c93a9838b8c94c6998e85646d6f2d07c20ecfe1e235dba62158b29451391","0fa5fb053d5976cfc833eac924af0e4d12bcc148a22d2bc05eb4a56dcdfe5c0d","f67688a1036ab364fdd25ef3f462ee5684990a869dcb8b5a1eea5457573cd0ea","2c7aaac1e4b6892518905afa509968facd5a48fe9505750b33c66d938c9beb5e","2c6fe74cdc9a1416f603a95917b5212b37d786de20b4ca0716c9d27a26b7c65e","9ebdf3e2e4de01b5761d7863c61e0d7fa690637d92393ef31790a580c5e2f5a9","907a7f4a2f1e385ac53af2c6543acac6b9adab1ef1f827ef2663e4e7f1a98aa4","4e9c0fd9c626ceed22d9ed37087b7c263fc77b9d64ebbd70c0b718f2cd741105","f89f5c94352802530fb3801545d83ffa8ce8f9d6d996ce82aa24ddc019e97e47","63c917bca35d28e15479dc2b1b6e572881ba4ee2495390ea8eb91374e43745e3","31fa6e8452bef01da6aa5ad57e621e240c87bc3175ce2d2de552c85d710db746","3014b762a92a846346ae6f1e44164ec30ef6e41e9290fbde51802ae472c7379e","5329a5972c3953a19a37ce65ac539a47de96e36ff87e7eda90d68760e9ed2a5e","cce4acd479fa79d1662ce4fd3b1bc098b3b43d347e4f7c563ea9c5bb38182a8c","379c23bff093a237d2f63c994f3e4ca0f95456c6f0548d0023eab60c61a00fbf","f21309ea38bcb63431532d4c139c235c1d5c5bc4ce15eb8c5cf2055b6b4f1d82","5283047c95c3895b54471261aada51dd47b4e7c6fb00d58f8a8b4034bd0be517","e29e9bad6fb8e05f3ce22b495ed839301dd8d057484fbd4f4c7218d360f941af","406134b920a681373ceba80dda358a015b0379d752b82b4a4430367196a6f4b5","99ee232ec78662869c921fee90c3809fec53e0e9fcdb0f225b63365a799bc38b","d1ada1111c2d8c6f20f940b0185fcd6f20562c0045d25433d5e2af37bee85fc1","7de5231dae45cbe3be9061a3da7ad310a7b0ee69a485926cb19e9914d3903659","7ca3915472a9f35c88a2661918ce99e1f791c3c04b4d5b25e03a0de99311ec6d","d9c400c03120bd59a0f8c61ca675a92d17679980ec3fd03c8fd566c2962f8cc8","8f1a5455aeff08cbc457dd6779a1ad32dfbb45f8e19075d2a99cbbbb8d519937","dd743ab18dd99672635b11dfc9c6a4ec2e586a018878b6b7d2b6456fabb1c493","6eeeac9646fd4c561c7aa730b9c4a1475eb31a13b0bb682a370cac5faa3feaba","9ee3277aa530d275d666fb69afbb6282c480e7aa5fdd3acede75afda7518abe0","a76f8efa22d36eab95eb744a2d0bd0d4c2dce4935a9f4d809f4ce1fee37a1679","417723bcd93ea77a71730d4326b2e9eb3f29ddcf3c217a307dd23fba6921f05b","b3b44303e3858ca1299d6d90165d9e9ef8f9a3a6a430edb31e3001fdc7dc0c68","0eb0ddc4a3111b0e63e4580d71017c73e63bc07e340ca0bcc6635573b3fdde7a","74607de7ffe82d5cea87b084f47bd689e5b32866a79434a2153377cf148dce66","48bca3494f7c494d8dd3a1ccef35c668962a5ba893473cfe7a2656bfe43d78c6","06732f81db08b51b42ea4568107b0ec3617dcd1c3f5f5ea38372915e7b749341","79164ddc2de91e0a0c78af06520321715e9853916d43d2a041d5b220c3b73841","ada3113b7522f77fa0d7ed6d55d6bb71de8fefbd9c56a93b686bd254a77ca4fb","cc452d7aee67d7c81a107da08d17d36bf5e89a13c3819dff8441deee3d4be005","215cefbd18c46475da0703e924a3568f2fec19548653dd3d34cb12ab732764b5","5387fd5eb366c494db9bc2c5f1f5fa6c41d363757fd7231e4d8f38fdd0a4bf41","e62d41c984ae275aa3676b2ec6fee1d8ea5148f641a017f9bd6f8944f0b5686a","a814321be049bf59256278f68dce5bd5199c521394b3032b74fde53265c3d492","aedd3163c1b62854300b573c8245a7ac347fdb5ffc27c92a00bb6db9e1871e30","b525390947ad39dbfa3a9c5b19e549b9760e729e4e4d62aa72c7aa1ac5debada",{"version":"8f2869cc655b12580adec567b745e567de74b417e4eab8628ba5ecd23ef5e5ff","signature":"8820074b3a54efa1de40568042869cff26f44887f0fa76c2ed14a302ef95c803"},{"version":"f71038a5cd16db3b8c0589d932af619436578e2f773f575590d66f69795dce66","signature":"589a00baf40c4fbd6f99457f626951617e39f3402179a2c5a705a3992e334fb8"},{"version":"3a6b6541f2f5a77c22f83124b9244421b4b891f996c5ccbd16c11f2f56ebe153","signature":"7bf018741694e71ceae7a6fadb6d2f41aa774b61f4558e4ce9d11859b71ff5b0"},{"version":"beacd95c840c7141472b2490d55d780594fdcaa03fc331d78fd3eb86c90b3e13","signature":"74172818c239004baab501623f2f85f66bc94f4fbaae5072ceca54165abed2d9"},{"version":"b181bf31b7ce0a4eb0eef4505bb0a8b4c5f33685c0d61e4ebd5a88aa15db2da2","signature":"03d434d8fe265b9c7390096575424d9439ad1fe3d914987de8d42adc75d55bc7"},{"version":"f7368e68b2ff356ff5c27cc635fcb50ad45f6e281d382f2649a354f756511ddf","signature":"2b5ff11e59fb01d503155bf670b2c07dc18a5c37bedc54f2e880ceea186279c0"},"6d829824ead8999f87b6df21200df3c6150391b894b4e80662caa462bd48d073","afc559c1b93df37c25aef6b3dfa2d64325b0e112e887ee18bf7e6f4ec383fc90","39c18ea70fa2449cb00c97e73b3b8f96983e423678cfede0fbcb9319cbefa67c","a6f0218395ecb8e0d736e0a19524223ab7a8a7ed217c4a99c165df2532e1beec","287bb1a9e0f935417f8e753687737d3c90c35a56d07448773fc3ec8f0f97a6be","629766229f541d92210f30a92b6038568ec165fab14b7ee53bdf13667da37ca3","29193c018378ca9c8033eaa974c02c1f503e8fcd8a2bf406057c53f7d3fa17a8",{"version":"4f9362850bb427525ba05c0e861dae06d9918bd16ccb38d504cb7294f69e8496","affectsGlobalScope":true},{"version":"82fcf338bc21711d93d65f981a7182f9942d3ac1f268c4480537c9b62c89d10d","affectsGlobalScope":true},"84e3bbd6f80983d468260fdbfeeb431cc81f7ea98d284d836e4d168e36875e86","aad5ffa61406b8e19524738fcf0e6fda8b3485bba98626268fdf252d1b2b630a","16d51f964ec125ad2024cf03f0af444b3bc3ec3614d9345cc54d09bab45c9a4c","ba601641fac98c229ccd4a303f747de376d761babb33229bb7153bed9356c9cc",{"version":"352fc8497a30bc806d7defa0043d85802e5f35a7688731ee9a21456f5cb32a94","affectsGlobalScope":true},"5b9ecf7da4d71cf3832dbb8336150fa924631811f488ad4690c2dfec2b4fb1d7","951c85f75aac041dddbedfedf565886a7b494e29ec1532e2a9b4a6180560b50e","f463d61cf39c3a6a5f96cdf7adfdb72a0b1d663f7b5d5b6dd042adba835430c2","f7a9cb83c8fbc081a8b605880d191e0d0527cde2c1b2b2b623beca8f0203a2cd","43cdd474c5aa3340da4816bb8f1ae7f3b1bcf9e70d997afc36a0f2c432378c84",{"version":"eeac4d06039327f81377b1eef141f2717055c7e73e074ab1a1bada6bcca40104","affectsGlobalScope":true},"23790f2da8d5370068bf8ba250786babee91f619ba9f8e067957c7166c824432","9226af9c56e77e2de484e3778a33a53a1dfb11ead282a7bdc55c2ffd84136837","963d59066dd6742da1918a6213a209bcc205b8ee53b1876ee2b4e6d80f97c85e","fd326577c62145816fe1acc306c734c2396487f76719d3785d4e825b34540b33",{"version":"3e947c8dc536e569ceb62a7cb0255e4866fd54dd5d35d21e49c7e755f5c134a6","affectsGlobalScope":true},"f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","cddf5c26907c0b8378bc05543161c11637b830da9fadf59e02a11e675d11e180","5774751340e987a6a9e4a5dcc03ff68a6515adc2b91423e1af2f660fc8f30e81","209e814e8e71aec74f69686a9506dd7610b97ab59dcee9446266446f72a76d05","86889bc3e5323b1e92f5d23d41395ccee3dc91c37b5a5dbf115ea40fc13edd28","6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a",{"version":"86cc8969b76067ccf25e02c62b7df6ccdb419481fbce594b5ae9da21e9015e39","affectsGlobalScope":true},"b92ae8263cac4e5a79f55fe6cb63c030b096679b98f603fbc13963c30ab7da5e","4e9d375d05a75efefcdae0a6a7be76861b5c96683acd31d1c8b120f60c0f6194","2a856615ecd0af49997dfbb38cf94fd787d529062a2e96ce26b84432e61d785d","0b6a0b628776a3e3a4aeeba090438a26e7ffa15373ce658452c78c1f2254665d","5764c1db026d0f1070ff009879d8f90dec70cebc3d1b27ca20f7beeac2afcae2","62b931417104c7cb35d0725e1869f51d52d7b18462fd58f32f846a314a42ba10","77b89017a4f1a1e5497efbbb0b742506b6c5c725d7d6855e793a12a97c7ace61","656424ca784760c679bf2677d8aaf55d1cb8452cd0ac04bbe1c0f659f45f8c11","bed28de34a5dd2b08d47b584da338e5fba92de84ce8727dd153d9ec16bc0f2e4","6745e41d07e777a049bb25425bb1c6c1a9b437bc2568ca8eef03daa8e8913ac0","032667dd4a981d2b58dfaf5840f5a2ea76160ab18658fdd5abd0a0bba1565af1","7382cbf0d8a841a91d7ae2217897bd53bcb9584ca6fbe123771167a7f641c157","65dfa4bc49ccd1355789abb6ae215b302a5b050fdee9651124fe7e826f33113c"],"root":[49,[282,287]],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationMap":true,"esModuleInterop":true,"jsx":2,"module":1,"noImplicitAny":false,"noUnusedLocals":true,"outDir":"./","skipLibCheck":true,"strict":true,"target":7},"fileIdsList":[[181],[181,266,281,282,283],[181,266,281,285],[181,284,286],[181,266],[181,282],[50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,70,71,181,267,268,269,270,271,272,273,274,275,276,277,278,279,280],[51,181,266],[50,181],[181,188],[181,275],[152,181,188],[181,188,271,273],[169,181,188],[152,181],[169,181],[51,181],[69,181],[52,181],[66,67,68,181],[66,181],[72,181,237,241,242,243,244,245,246,247,252,253,254,255,256,257,258,259,260,261,262,263,264,265],[181,237,257],[72,181,257],[181,249],[181,237,250],[181,236,238,242,251],[181,248,250],[181,249,250,251,252],[72,181,236],[181,237,242,243],[181,237,242],[72,181,237],[181,242],[72,181],[181,238,239,240],[72,181,237,242],[181,236,237,241],[181,260],[181,238],[181,236],[154,181,188,288],[181,188,290,291],[154,181,188],[151,154,181,188,298,299,300],[181,289,300,301,305],[181,188,308],[151,152,181,188,310],[181,315],[181,303],[181,302],[135,181],[138,181],[139,144,172,181],[140,151,152,159,169,180,181],[140,141,151,159,181],[142,181],[143,144,152,160,181],[144,169,177,181],[145,147,151,159,181],[146,181],[147,148,181],[151,181],[149,151,181],[151,152,153,169,180,181],[151,152,153,166,169,172,181],[181,185],[147,154,159,169,180,181],[151,152,154,155,159,169,177,180,181],[154,156,169,177,180,181],[135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187],[151,157,181],[158,180,181],[147,151,159,169,181],[160,181],[161,181],[138,162,181],[163,179,181,185],[164,181],[165,181],[151,166,167,181],[166,168,181,183],[139,151,169,170,171,172,181],[139,169,171,181],[169,170,181],[172,181],[173,181],[151,175,176,181],[175,176,181],[144,159,169,177,181],[178,181],[159,179,181],[139,154,165,180,181],[144,181],[169,181,182],[181,183],[181,184],[139,144,151,153,162,169,180,181,183,185],[169,181,186],[169,181,186,188],[152,169,181,188,297],[154,181,188,303,304],[181,188,296],[181,329],[181,188,328],[151,154,156,159,177,181,188,318,326],[151,169,181,188],[129,130,131,132,133,181,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,224,226,227,228,229,230,231,232,233],[181,234],[181,235],[134,169,181,189,190,211,212,213],[181,191,211],[181,210],[181,191,196,211,212,213],[134,181,191,211],[130,181,211,212],[181,191,210,211,212,213,215],[80,181],[80,81,82,181],[80,95,181],[80,86,181],[80,89,90,181],[80,98,181],[80,91,92,118,181],[80,102,181],[80,104,181],[86,87,120,127,128,181],[80,83,84,85,181],[80,88,92,119,181],[80,84,90,121,181],[80,84,90,181],[122,123,124,181],[80,84,118,125,126,181],[80,84,118,126,181],[90,93,94,96,97,99,100,101,103,105,106,107,108,109,110,111,112,113,114,116,117,181],[80,115,181],[130,181,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,211],[181,218,219,220],[152,169,181,188],[169,181,188,191,211],[181,188,218,219],[181,191,211,212],[130,131,181,218,219,220,224],[80,130,131,181,219,221,224],[131,181,211,224],[80,84,85,86,87,119,120,130,131,181,211,219,223,224],[130,131,169,181,188,211,212,213,214,218,219,220,222,224,225,226],[181,211,215,227],[130,131,169,181,188,211,213,214,215,218,219,220,222,224],[74,76,78,181],[74,75,78,181],[73,74,75,76,77,78,79,181],[76,77,181],[131,181,211,212,213,215,224,234],[181,211,212,213],[181,211,213],[130,181,211],[131,181,210,211,212,213,214,224],[80,130,131,132,133,181,210,212,224],[181,210,219],[80,181,210],[181,210,211,213],[130,181],[131,181,211,212,213,216,224],[266,281],[266,281,285],[284,286],[266]],"referencedMap":[[49,1],[284,2],[286,3],[287,4],[285,5],[283,6],[282,1],[281,7],[267,8],[60,1],[62,9],[63,1],[268,10],[61,1],[53,1],[54,1],[278,11],[277,11],[276,12],[275,1],[273,10],[274,13],[279,10],[280,14],[65,1],[64,1],[271,15],[269,1],[272,16],[55,17],[59,1],[71,1],[270,1],[70,18],[56,17],[58,19],[57,17],[51,9],[50,1],[52,1],[69,20],[66,1],[67,21],[68,1],[266,22],[259,23],[258,24],[250,25],[251,26],[252,27],[249,28],[248,1],[263,25],[262,29],[264,30],[246,31],[245,31],[243,32],[244,31],[256,33],[253,34],[255,1],[247,34],[254,32],[265,1],[240,35],[241,36],[260,1],[257,37],[242,38],[261,39],[239,40],[237,41],[72,1],[289,42],[290,1],[291,1],[292,43],[293,1],[294,1],[288,44],[295,1],[296,1],[301,45],[306,46],[307,1],[238,1],[309,47],[311,48],[312,1],[304,1],[313,1],[314,1],[316,49],[302,50],[303,51],[310,1],[317,1],[308,1],[318,10],[135,52],[136,52],[138,53],[139,54],[140,55],[141,56],[142,57],[143,58],[144,59],[145,60],[146,61],[147,62],[148,62],[150,63],[149,64],[151,63],[152,65],[153,66],[137,67],[187,1],[154,68],[155,69],[156,70],[188,71],[157,72],[158,73],[159,74],[160,75],[161,76],[162,77],[163,78],[164,79],[165,80],[166,81],[167,81],[168,82],[169,83],[171,84],[170,85],[172,86],[173,87],[174,1],[175,88],[176,89],[177,90],[178,91],[179,92],[180,93],[181,94],[182,95],[183,96],[184,97],[185,98],[186,99],[319,1],[320,1],[321,1],[322,1],[323,1],[324,100],[325,1],[326,1],[300,1],[299,1],[298,101],[297,1],[305,102],[327,103],[330,104],[329,105],[331,106],[328,14],[315,1],[332,10],[333,107],[234,108],[235,109],[236,110],[191,111],[204,112],[192,112],[134,113],[194,112],[195,112],[197,114],[198,112],[206,112],[199,112],[196,112],[202,112],[205,115],[207,112],[193,112],[208,112],[200,112],[201,112],[209,115],[203,112],[213,116],[130,1],[217,117],[93,118],[221,118],[81,1],[83,119],[94,118],[84,118],[82,1],[95,1],[96,120],[97,118],[87,121],[91,122],[89,1],[99,123],[88,1],[85,118],[119,124],[100,118],[101,118],[103,125],[90,118],[104,1],[105,126],[92,118],[106,118],[107,118],[108,118],[109,118],[110,118],[129,127],[111,118],[102,1],[86,128],[120,129],[121,1],[122,130],[123,131],[124,131],[125,132],[127,133],[112,118],[126,118],[128,134],[98,1],[113,123],[114,123],[118,135],[115,1],[116,136],[117,118],[210,137],[225,138],[218,139],[189,140],[220,141],[190,142],[226,143],[222,144],[223,145],[224,146],[227,147],[229,148],[228,149],[77,150],[76,151],[73,1],[75,1],[80,152],[74,1],[78,153],[79,1],[214,154],[132,155],[133,156],[131,157],[215,158],[211,159],[232,1],[230,160],[219,161],[231,1],[212,162],[216,163],[233,164],[46,1],[47,1],[8,1],[9,1],[13,1],[12,1],[2,1],[14,1],[15,1],[16,1],[17,1],[18,1],[19,1],[20,1],[21,1],[3,1],[4,1],[25,1],[22,1],[23,1],[24,1],[26,1],[27,1],[28,1],[5,1],[29,1],[30,1],[31,1],[32,1],[6,1],[36,1],[33,1],[34,1],[35,1],[37,1],[7,1],[38,1],[48,1],[43,1],[44,1],[39,1],[40,1],[41,1],[42,1],[1,1],[45,1],[11,1],[10,1]],"exportedModulesMap":[[284,165],[286,166],[287,167],[285,168],[281,7],[267,8],[60,1],[62,9],[63,1],[268,10],[61,1],[53,1],[54,1],[278,11],[277,11],[276,12],[275,1],[273,10],[274,13],[279,10],[280,14],[65,1],[64,1],[271,15],[269,1],[272,16],[55,17],[59,1],[71,1],[270,1],[70,18],[56,17],[58,19],[57,17],[51,9],[50,1],[52,1],[69,20],[66,1],[67,21],[68,1],[266,22],[259,23],[258,24],[250,25],[251,26],[252,27],[249,28],[248,1],[263,25],[262,29],[264,30],[246,31],[245,31],[243,32],[244,31],[256,33],[253,34],[255,1],[247,34],[254,32],[265,1],[240,35],[241,36],[260,1],[257,37],[242,38],[261,39],[239,40],[237,41],[72,1],[289,42],[290,1],[291,1],[292,43],[293,1],[294,1],[288,44],[295,1],[296,1],[301,45],[306,46],[307,1],[238,1],[309,47],[311,48],[312,1],[304,1],[313,1],[314,1],[316,49],[302,50],[303,51],[310,1],[317,1],[308,1],[318,10],[135,52],[136,52],[138,53],[139,54],[140,55],[141,56],[142,57],[143,58],[144,59],[145,60],[146,61],[147,62],[148,62],[150,63],[149,64],[151,63],[152,65],[153,66],[137,67],[187,1],[154,68],[155,69],[156,70],[188,71],[157,72],[158,73],[159,74],[160,75],[161,76],[162,77],[163,78],[164,79],[165,80],[166,81],[167,81],[168,82],[169,83],[171,84],[170,85],[172,86],[173,87],[174,1],[175,88],[176,89],[177,90],[178,91],[179,92],[180,93],[181,94],[182,95],[183,96],[184,97],[185,98],[186,99],[319,1],[320,1],[321,1],[322,1],[323,1],[324,100],[325,1],[326,1],[300,1],[299,1],[298,101],[297,1],[305,102],[327,103],[330,104],[329,105],[331,106],[328,14],[315,1],[332,10],[333,107],[234,108],[235,109],[236,110],[191,111],[204,112],[192,112],[134,113],[194,112],[195,112],[197,114],[198,112],[206,112],[199,112],[196,112],[202,112],[205,115],[207,112],[193,112],[208,112],[200,112],[201,112],[209,115],[203,112],[213,116],[130,1],[217,117],[93,118],[221,118],[81,1],[83,119],[94,118],[84,118],[82,1],[95,1],[96,120],[97,118],[87,121],[91,122],[89,1],[99,123],[88,1],[85,118],[119,124],[100,118],[101,118],[103,125],[90,118],[104,1],[105,126],[92,118],[106,118],[107,118],[108,118],[109,118],[110,118],[129,127],[111,118],[102,1],[86,128],[120,129],[121,1],[122,130],[123,131],[124,131],[125,132],[127,133],[112,118],[126,118],[128,134],[98,1],[113,123],[114,123],[118,135],[115,1],[116,136],[117,118],[210,137],[225,138],[218,139],[189,140],[220,141],[190,142],[226,143],[222,144],[223,145],[224,146],[227,147],[229,148],[228,149],[77,150],[76,151],[73,1],[75,1],[80,152],[74,1],[78,153],[79,1],[214,154],[132,155],[133,156],[131,157],[215,158],[211,159],[232,1],[230,160],[219,161],[231,1],[212,162],[216,163],[233,164],[46,1],[47,1],[8,1],[9,1],[13,1],[12,1],[2,1],[14,1],[15,1],[16,1],[17,1],[18,1],[19,1],[20,1],[21,1],[3,1],[4,1],[25,1],[22,1],[23,1],[24,1],[26,1],[27,1],[28,1],[5,1],[29,1],[30,1],[31,1],[32,1],[6,1],[36,1],[33,1],[34,1],[35,1],[37,1],[7,1],[38,1],[48,1],[43,1],[44,1],[39,1],[40,1],[41,1],[42,1],[1,1],[45,1],[11,1],[10,1]],"semanticDiagnosticsPerFile":[49,284,286,287,285,283,282,281,267,60,62,63,268,61,53,54,278,277,276,275,273,274,279,280,65,64,271,269,272,55,59,71,270,70,56,58,57,51,50,52,69,66,67,68,266,259,258,250,251,252,249,248,263,262,264,246,245,243,244,256,253,255,247,254,265,240,241,260,257,242,261,239,237,72,289,290,291,292,293,294,288,295,296,301,306,307,238,309,311,312,304,313,314,316,302,303,310,317,308,318,135,136,138,139,140,141,142,143,144,145,146,147,148,150,149,151,152,153,137,187,154,155,156,188,157,158,159,160,161,162,163,164,165,166,167,168,169,171,170,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,319,320,321,322,323,324,325,326,300,299,298,297,305,327,330,329,331,328,315,332,333,234,235,236,191,204,192,134,194,195,197,198,206,199,196,202,205,207,193,208,200,201,209,203,213,130,217,93,221,81,83,94,84,82,95,96,97,87,91,89,99,88,85,119,100,101,103,90,104,105,92,106,107,108,109,110,129,111,102,86,120,121,122,123,124,125,127,112,126,128,98,113,114,118,115,116,117,210,225,218,189,220,190,226,222,223,224,227,229,228,77,76,73,75,80,74,78,79,214,132,133,131,215,211,232,230,219,231,212,216,233,46,47,8,9,13,12,2,14,15,16,17,18,19,20,21,3,4,25,22,23,24,26,27,28,5,29,30,31,32,6,36,33,34,35,37,7,38,48,43,44,39,40,41,42,1,45,11,10],"latestChangedDtsFile":"./src/index.d.ts"},"version":"5.1.6"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/csv",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.23",
|
|
4
4
|
"description": "Framework-independent loader for CSV and DSV table formats",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@loaders.gl/loader-utils": "4.0.0-alpha.
|
|
34
|
-
"@loaders.gl/schema": "4.0.0-alpha.
|
|
33
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.23",
|
|
34
|
+
"@loaders.gl/schema": "4.0.0-alpha.23"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"d3-dsv": "^1.2.0"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "e212f2a0c0e342f7cb65ce84fa2ff39f64b7d94b"
|
|
40
40
|
}
|
package/src/csv-loader.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// loaders.gl, MIT license
|
|
2
2
|
|
|
3
3
|
import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
|
|
4
|
-
import type {
|
|
4
|
+
import type {ArrayRowTable, ObjectRowTable, TableBatch} from '@loaders.gl/schema';
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
AsyncQueue,
|
|
@@ -23,7 +23,7 @@ const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
|
23
23
|
export type CSVLoaderOptions = LoaderOptions & {
|
|
24
24
|
csv?: {
|
|
25
25
|
// loaders.gl options
|
|
26
|
-
shape?: 'array-row-table' | 'object-row-table'
|
|
26
|
+
shape?: 'array-row-table' | 'object-row-table';
|
|
27
27
|
/** optimizes memory usage but increases parsing time. */
|
|
28
28
|
optimizeMemoryUsage?: boolean;
|
|
29
29
|
columnPrefix?: string;
|
|
@@ -44,26 +44,6 @@ export type CSVLoaderOptions = LoaderOptions & {
|
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
const DEFAULT_CSV_LOADER_OPTIONS = {
|
|
48
|
-
csv: {
|
|
49
|
-
shape: 'object-row-table',
|
|
50
|
-
optimizeMemoryUsage: false,
|
|
51
|
-
// CSV options
|
|
52
|
-
header: 'auto',
|
|
53
|
-
columnPrefix: 'column',
|
|
54
|
-
// delimiter: auto
|
|
55
|
-
// newline: auto
|
|
56
|
-
quoteChar: '"',
|
|
57
|
-
escapeChar: '"',
|
|
58
|
-
dynamicTyping: true,
|
|
59
|
-
comments: false,
|
|
60
|
-
skipEmptyLines: true,
|
|
61
|
-
// transform: null?
|
|
62
|
-
delimitersToGuess: [',', '\t', '|', ';']
|
|
63
|
-
// fastMode: auto
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
47
|
export const CSVLoader: LoaderWithParser<Table, TableBatch, CSVLoaderOptions> = {
|
|
68
48
|
id: 'csv',
|
|
69
49
|
module: 'csv',
|
|
@@ -78,12 +58,33 @@ export const CSVLoader: LoaderWithParser<Table, TableBatch, CSVLoaderOptions> =
|
|
|
78
58
|
parseInBatches: parseCSVInBatches,
|
|
79
59
|
// @ts-ignore
|
|
80
60
|
// testText: null,
|
|
81
|
-
options:
|
|
61
|
+
options: {
|
|
62
|
+
csv: {
|
|
63
|
+
shape: 'object-row-table',
|
|
64
|
+
optimizeMemoryUsage: false,
|
|
65
|
+
// CSV options
|
|
66
|
+
header: 'auto',
|
|
67
|
+
columnPrefix: 'column',
|
|
68
|
+
// delimiter: auto
|
|
69
|
+
// newline: auto
|
|
70
|
+
quoteChar: '"',
|
|
71
|
+
escapeChar: '"',
|
|
72
|
+
dynamicTyping: true,
|
|
73
|
+
comments: false,
|
|
74
|
+
skipEmptyLines: true,
|
|
75
|
+
// transform: null?
|
|
76
|
+
delimitersToGuess: [',', '\t', '|', ';']
|
|
77
|
+
// fastMode: auto
|
|
78
|
+
}
|
|
79
|
+
}
|
|
82
80
|
};
|
|
83
81
|
|
|
84
|
-
async function parseCSV(
|
|
82
|
+
async function parseCSV(
|
|
83
|
+
csvText: string,
|
|
84
|
+
options?: CSVLoaderOptions
|
|
85
|
+
): Promise<ObjectRowTable | ArrayRowTable> {
|
|
85
86
|
// Apps can call the parse method directly, we so apply default options here
|
|
86
|
-
const csvOptions = {...
|
|
87
|
+
const csvOptions = {...CSVLoader.options.csv, ...options?.csv};
|
|
87
88
|
|
|
88
89
|
const firstRow = readFirstRow(csvText);
|
|
89
90
|
const header: boolean =
|
|
@@ -103,40 +104,30 @@ async function parseCSV(csvText: string, options?: CSVLoaderOptions) {
|
|
|
103
104
|
};
|
|
104
105
|
|
|
105
106
|
const result = Papa.parse(csvText, papaparseConfig);
|
|
106
|
-
|
|
107
|
+
const rows = result.data as any[];
|
|
107
108
|
|
|
108
|
-
const headerRow = result.meta.fields || generateHeader(csvOptions.columnPrefix
|
|
109
|
+
const headerRow = result.meta.fields || generateHeader(csvOptions.columnPrefix!, firstRow.length);
|
|
109
110
|
|
|
110
|
-
switch (csvOptions.shape) {
|
|
111
|
+
switch (csvOptions.shape || 'object-row-table') {
|
|
111
112
|
case 'object-row-table':
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
return {
|
|
114
|
+
shape: 'object-row-table',
|
|
115
|
+
data: rows.map((row) => (Array.isArray(row) ? convertToObjectRow(row, headerRow) : row))
|
|
116
|
+
};
|
|
114
117
|
case 'array-row-table':
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
/*
|
|
121
|
-
if (!header && shape === 'object-row-table') {
|
|
122
|
-
// If the dataset has no header, transform the array result into an object shape with an
|
|
123
|
-
// autogenerated header
|
|
124
|
-
return result.data.map((row) =>
|
|
125
|
-
row.reduce((acc, value, i) => {
|
|
126
|
-
acc[headerRow[i]] = value;
|
|
127
|
-
return acc;
|
|
128
|
-
}, {})
|
|
129
|
-
);
|
|
118
|
+
return {
|
|
119
|
+
shape: 'array-row-table',
|
|
120
|
+
data: rows.map((row) => (Array.isArray(row) ? row : convertToArrayRow(row, headerRow)))
|
|
121
|
+
};
|
|
130
122
|
}
|
|
131
|
-
|
|
132
|
-
return rows;
|
|
123
|
+
throw new Error(csvOptions.shape);
|
|
133
124
|
}
|
|
134
125
|
|
|
135
126
|
// TODO - support batch size 0 = no batching/single batch?
|
|
136
127
|
function parseCSVInBatches(
|
|
137
128
|
asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,
|
|
138
129
|
options?: CSVLoaderOptions
|
|
139
|
-
): AsyncIterable<
|
|
130
|
+
): AsyncIterable<TableBatch> {
|
|
140
131
|
// Papaparse does not support standard batch size handling
|
|
141
132
|
// TODO - investigate papaparse chunks mode
|
|
142
133
|
options = {...options};
|
|
@@ -145,9 +136,9 @@ function parseCSVInBatches(
|
|
|
145
136
|
}
|
|
146
137
|
|
|
147
138
|
// Apps can call the parse method directly, we so apply default options here
|
|
148
|
-
const csvOptions = {...
|
|
139
|
+
const csvOptions = {...CSVLoader.options.csv, ...options?.csv};
|
|
149
140
|
|
|
150
|
-
const asyncQueue = new AsyncQueue<
|
|
141
|
+
const asyncQueue = new AsyncQueue<TableBatch>();
|
|
151
142
|
|
|
152
143
|
let isFirstRow: boolean = true;
|
|
153
144
|
let headerRow: string[] | null = null;
|
|
@@ -198,7 +189,7 @@ function parseCSVInBatches(
|
|
|
198
189
|
if (isFirstRow) {
|
|
199
190
|
isFirstRow = false;
|
|
200
191
|
if (!headerRow) {
|
|
201
|
-
headerRow = generateHeader(csvOptions.columnPrefix
|
|
192
|
+
headerRow = generateHeader(csvOptions.columnPrefix!, row.length);
|
|
202
193
|
}
|
|
203
194
|
schema = deduceSchema(row, headerRow);
|
|
204
195
|
}
|
|
@@ -286,8 +277,8 @@ function readFirstRow(csvText: string): any[] {
|
|
|
286
277
|
* See the header option in https://www.papaparse.com/docs#config
|
|
287
278
|
* @returns a transform function that returns sanitized names for duplicate fields
|
|
288
279
|
*/
|
|
289
|
-
function duplicateColumnTransformer() {
|
|
290
|
-
const observedColumns = new Set();
|
|
280
|
+
function duplicateColumnTransformer(): (column: string) => string {
|
|
281
|
+
const observedColumns = new Set<string>();
|
|
291
282
|
return (col) => {
|
|
292
283
|
let colName = col;
|
|
293
284
|
let counter = 1;
|
package/dist/bundle.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,aAAa,KAAqB,CAAC"}
|
package/dist/csv-loader.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"csv-loader.d.ts","sourceRoot":"","sources":["../src/csv-loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EAAQ,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAEL,KAAK,EAIN,MAAM,oBAAoB,CAAC;AAW5B,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QAEJ,KAAK,CAAC,EAAE,iBAAiB,GAAG,kBAAkB,GAAG,gBAAgB,CAAC;QAClE,yDAAyD;QACzD,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,MAAM,CAAC,EAAE,MAAM,CAAC;QAKhB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QAEpB,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,cAAc,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;QAEpC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;KAE9B,CAAC;CACH,CAAC;AAsBF,eAAO,MAAM,SAAS,EAAE,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,gBAAgB,CAe3E,CAAC"}
|
package/dist/csv-writer.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"csv-writer.d.ts","sourceRoot":"","sources":["../src/csv-writer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAC,KAAK,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAGhE,YAAY,EAAC,gBAAgB,EAAC,CAAC;AAS/B,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,gBAAgB,CAYjE,CAAC"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAEvC,YAAY,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encode-csv.d.ts","sourceRoot":"","sources":["../../../src/lib/encoders/encode-csv.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,KAAK,EAAwC,MAAM,oBAAoB,CAAC;AAKhF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,CAAC,EAAE;QACJ,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,CAAC;IACF,kBAAkB;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,OAAO,GAAE,gBAAiD,GACzD,MAAM,CAsBR"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async-iterator-streamer.d.ts","sourceRoot":"","sources":["../../src/papaparse/async-iterator-streamer.ts"],"names":[],"mappings":"AAWA,iBAAwB,qBAAqB,CAAC,MAAM,KAAA,QAwDnD;kBAxDuB,qBAAqB;;;eAArB,qBAAqB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"papaparse.d.ts","sourceRoot":"","sources":["../../src/papaparse/papaparse.ts"],"names":[],"mappings":"AAmBA,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;CAuBT,CAAC;AACF,eAAe,IAAI,CAAC;AAepB,iBAAS,SAAS,CAChB,MAAM,KAAA,EACN,OAAO,KAAA,EACP,mBAAmB,CAAC,KAAA,OAiErB;AAED,iBAAS,SAAS,CAAC,MAAM,KAAA,EAAE,OAAO,KAAA,UA+KjC;AAED,gFAAgF;AAChF,iBAAS,aAAa,CAAC,MAAM,KAAA,QAuF5B;AACD,iBAAS,cAAc,CAAC,MAAM,KAAA,QAiB7B;kBAjBQ,cAAc;;;AAsBvB,iBAAS,YAAY,CAAC,OAAO,KAAA,QA8T5B;AAOD,gEAAgE;AAChE,iBAAS,MAAM,CAAC,MAAM,KAAA,QA8TrB"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|