@loaders.gl/json 4.1.0-alpha.9 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.dev.js CHANGED
@@ -800,6 +800,9 @@ var __exports__ = (() => {
800
800
 
801
801
  // ../loader-utils/src/lib/binary-utils/array-buffer-utils.ts
802
802
  function concatenateArrayBuffers(...sources) {
803
+ return concatenateArrayBuffersFromArray(sources);
804
+ }
805
+ function concatenateArrayBuffersFromArray(sources) {
803
806
  const sourceArrays = sources.map((source2) => source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2);
804
807
  const byteLength = sourceArrays.reduce((length, typedArray) => length + typedArray.byteLength, 0);
805
808
  const result = new Uint8Array(byteLength);
@@ -1717,7 +1720,7 @@ Char: ${this.c}`;
1717
1720
  }
1718
1721
 
1719
1722
  // src/json-loader.ts
1720
- var VERSION = true ? "4.1.0-alpha.9" : "latest";
1723
+ var VERSION = true ? "4.1.0" : "latest";
1721
1724
  var JSONLoader = {
1722
1725
  name: "JSON",
1723
1726
  id: "json",
@@ -1809,7 +1812,7 @@ Char: ${this.c}`;
1809
1812
  }
1810
1813
 
1811
1814
  // src/ndjson-loader.ts
1812
- var VERSION2 = true ? "4.1.0-alpha.9" : "latest";
1815
+ var VERSION2 = true ? "4.1.0" : "latest";
1813
1816
  var NDJSONLoader = {
1814
1817
  name: "NDJSON",
1815
1818
  id: "ndjson",
@@ -2878,7 +2881,7 @@ Char: ${this.c}`;
2878
2881
  }
2879
2882
 
2880
2883
  // src/geojson-loader.ts
2881
- var VERSION3 = true ? "4.1.0-alpha.9" : "latest";
2884
+ var VERSION3 = true ? "4.1.0" : "latest";
2882
2885
  var GeoJSONWorkerLoader = {
2883
2886
  name: "GeoJSON",
2884
2887
  id: "geojson",
@@ -1,6 +1,6 @@
1
1
  import { geojsonToBinary } from '@loaders.gl/gis';
2
2
  import { parseJSONInBatches } from "./lib/parsers/parse-json-in-batches.js";
3
- const VERSION = typeof "4.1.0-alpha.9" !== 'undefined' ? "4.1.0-alpha.9" : 'latest';
3
+ const VERSION = typeof "4.1.0" !== 'undefined' ? "4.1.0" : 'latest';
4
4
  export const GeoJSONWorkerLoader = {
5
5
  name: 'GeoJSON',
6
6
  id: 'geojson',
@@ -1 +1 @@
1
- {"version":3,"file":"geojson-loader.js","names":["geojsonToBinary","parseJSONInBatches","VERSION","GeoJSONWorkerLoader","name","id","module","version","worker","extensions","mimeTypes","category","text","options","geojson","shape","json","jsonpaths","gis","format","GeoJSONLoader","parse","parseTextSync","parseInBatches","arrayBuffer","TextDecoder","decode","_geojson","JSON","table","type","features","asyncIterator","geojsonIterator","makeBinaryGeometryIterator","batch","data"],"sources":["../src/geojson-loader.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {GeoJSON, GeoJSONTable, TableBatch} from '@loaders.gl/schema';\nimport type {JSONLoaderOptions} from './json-loader';\nimport {geojsonToBinary} from '@loaders.gl/gis';\n// import {parseJSONSync} from './lib/parsers/parse-json';\nimport {parseJSONInBatches} from './lib/parsers/parse-json-in-batches';\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 GeoJSONLoaderOptions = JSONLoaderOptions & {\n geojson?: {\n shape?: 'object-row-table';\n };\n gis?: {\n format?: 'geojson' | 'binary';\n };\n};\n\n/**\n * GeoJSON loader\n */\nexport const GeoJSONWorkerLoader: Loader<GeoJSON, TableBatch, GeoJSONLoaderOptions> = {\n name: 'GeoJSON',\n id: 'geojson',\n module: 'geojson',\n version: VERSION,\n worker: true,\n extensions: ['geojson'],\n mimeTypes: ['application/geo+json'],\n category: 'geometry',\n text: true,\n options: {\n geojson: {\n shape: 'object-row-table'\n },\n json: {\n shape: 'object-row-table',\n jsonpaths: ['$', '$.features']\n },\n gis: {\n format: 'geojson'\n }\n }\n};\n\nexport const GeoJSONLoader: LoaderWithParser<GeoJSON, TableBatch, GeoJSONLoaderOptions> = {\n ...GeoJSONWorkerLoader,\n // @ts-expect-error\n parse,\n // @ts-expect-error\n parseTextSync,\n parseInBatches\n};\n\nasync function parse(arrayBuffer: ArrayBuffer, options?: GeoJSONLoaderOptions) {\n return parseTextSync(new TextDecoder().decode(arrayBuffer), options);\n}\n\nfunction parseTextSync(text: string, options?: GeoJSONLoaderOptions) {\n // Apps can call the parse method directly, we so apply default options here\n options = {...GeoJSONLoader.options, ...options};\n options.geojson = {...GeoJSONLoader.options.geojson, ...options.geojson};\n options.gis = options.gis || {};\n\n let geojson;\n try {\n geojson = JSON.parse(text);\n } catch {\n geojson = {};\n }\n\n const table: GeoJSONTable = {\n shape: 'geojson-table',\n // TODO - deduce schema from geojson\n // TODO check that parsed data is of type FeatureCollection\n type: 'FeatureCollection',\n features: geojson?.features || []\n };\n\n switch (options.gis.format) {\n case 'binary':\n return geojsonToBinary(table.features);\n default:\n return table;\n }\n}\n\nfunction parseInBatches(asyncIterator, options): AsyncIterable<TableBatch> {\n // Apps can call the parse method directly, we so apply default options here\n options = {...GeoJSONLoader.options, ...options};\n options.json = {...GeoJSONLoader.options.geojson, ...options.geojson};\n\n const geojsonIterator = parseJSONInBatches(asyncIterator, options);\n\n switch (options.gis.format) {\n case 'binary':\n return makeBinaryGeometryIterator(geojsonIterator);\n default:\n return geojsonIterator as AsyncIterable<TableBatch>;\n }\n}\n\nasync function* makeBinaryGeometryIterator(geojsonIterator) {\n for await (const batch of geojsonIterator) {\n batch.data = geojsonToBinary(batch.data);\n yield batch;\n }\n}\n"],"mappings":"AAOA,SAAQA,eAAe,QAAO,iBAAiB;AAAC,SAExCC,kBAAkB;AAI1B,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAc3E,OAAO,MAAMC,mBAAsE,GAAG;E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G;IAC1Bd,KAAK,EAAE,eAAe;IAGtBe,IAAI,EAAE,mBAAmB;IACzBC,QAAQ,EAAE,EAAAJ,QAAA,GAAAb,OAAO,cAAAa,QAAA,uBAAPA,QAAA,CAASI,QAAQ,KAAI;EACjC,CAAC;EAED,QAAQlB,OAAO,CAACK,GAAG,CAACC,MAAM;IACxB,KAAK,QAAQ;MACX,OAAOnB,eAAe,CAAC6B,KAAK,CAACE,QAAQ,CAAC;IACxC;MACE,OAAOF,KAAK;EAChB;AACF;AAEA,SAASN,cAAcA,CAACS,aAAa,EAAEnB,OAAO,EAA6B;EAEzEA,OAAO,GAAG;IAAC,GAAGO,aAAa,CAACP,OAAO;IAAE,GAAGA;EAAO,CAAC;EAChDA,OAAO,CAACG,IAAI,GAAG;IAAC,GAAGI,aAAa,CAACP,OAAO,CAACC,OAAO;IAAE,GAAGD,OAAO,CAACC;EAAO,CAAC;EAErE,MAAMmB,eAAe,GAAGhC,kBAAkB,CAAC+B,aAAa,EAAEnB,OAAO,CAAC;EAElE,QAAQA,OAAO,CAACK,GAAG,CAACC,MAAM;IACxB,KAAK,QAAQ;MACX,OAAOe,0BAA0B,CAACD,eAAe,CAAC;IACpD;MACE,OAAOA,eAAe;EAC1B;AACF;AAEA,gBAAgBC,0BAA0BA,CAACD,eAAe,EAAE;EAC1D,WAAW,MAAME,KAAK,IAAIF,eAAe,EAAE;IACzCE,KAAK,CAACC,IAAI,GAAGpC,eAAe,CAACmC,KAAK,CAACC,IAAI,CAAC;IACxC,MAAMD,KAAK;EACb;AACF"}
1
+ {"version":3,"file":"geojson-loader.js","names":["geojsonToBinary","parseJSONInBatches","VERSION","GeoJSONWorkerLoader","name","id","module","version","worker","extensions","mimeTypes","category","text","options","geojson","shape","json","jsonpaths","gis","format","GeoJSONLoader","parse","parseTextSync","parseInBatches","arrayBuffer","TextDecoder","decode","_geojson","JSON","table","type","features","asyncIterator","geojsonIterator","makeBinaryGeometryIterator","batch","data"],"sources":["../src/geojson-loader.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {GeoJSON, GeoJSONTable, TableBatch} from '@loaders.gl/schema';\nimport type {JSONLoaderOptions} from './json-loader';\nimport {geojsonToBinary} from '@loaders.gl/gis';\n// import {parseJSONSync} from './lib/parsers/parse-json';\nimport {parseJSONInBatches} from './lib/parsers/parse-json-in-batches';\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 GeoJSONLoaderOptions = JSONLoaderOptions & {\n geojson?: {\n shape?: 'object-row-table';\n };\n gis?: {\n format?: 'geojson' | 'binary';\n };\n};\n\n/**\n * GeoJSON loader\n */\nexport const GeoJSONWorkerLoader: Loader<GeoJSON, TableBatch, GeoJSONLoaderOptions> = {\n name: 'GeoJSON',\n id: 'geojson',\n module: 'geojson',\n version: VERSION,\n worker: true,\n extensions: ['geojson'],\n mimeTypes: ['application/geo+json'],\n category: 'geometry',\n text: true,\n options: {\n geojson: {\n shape: 'object-row-table'\n },\n json: {\n shape: 'object-row-table',\n jsonpaths: ['$', '$.features']\n },\n gis: {\n format: 'geojson'\n }\n }\n};\n\nexport const GeoJSONLoader: LoaderWithParser<GeoJSON, TableBatch, GeoJSONLoaderOptions> = {\n ...GeoJSONWorkerLoader,\n // @ts-expect-error\n parse,\n // @ts-expect-error\n parseTextSync,\n parseInBatches\n};\n\nasync function parse(arrayBuffer: ArrayBuffer, options?: GeoJSONLoaderOptions) {\n return parseTextSync(new TextDecoder().decode(arrayBuffer), options);\n}\n\nfunction parseTextSync(text: string, options?: GeoJSONLoaderOptions) {\n // Apps can call the parse method directly, we so apply default options here\n options = {...GeoJSONLoader.options, ...options};\n options.geojson = {...GeoJSONLoader.options.geojson, ...options.geojson};\n options.gis = options.gis || {};\n\n let geojson;\n try {\n geojson = JSON.parse(text);\n } catch {\n geojson = {};\n }\n\n const table: GeoJSONTable = {\n shape: 'geojson-table',\n // TODO - deduce schema from geojson\n // TODO check that parsed data is of type FeatureCollection\n type: 'FeatureCollection',\n features: geojson?.features || []\n };\n\n switch (options.gis.format) {\n case 'binary':\n return geojsonToBinary(table.features);\n default:\n return table;\n }\n}\n\nfunction parseInBatches(asyncIterator, options): AsyncIterable<TableBatch> {\n // Apps can call the parse method directly, we so apply default options here\n options = {...GeoJSONLoader.options, ...options};\n options.json = {...GeoJSONLoader.options.geojson, ...options.geojson};\n\n const geojsonIterator = parseJSONInBatches(asyncIterator, options);\n\n switch (options.gis.format) {\n case 'binary':\n return makeBinaryGeometryIterator(geojsonIterator);\n default:\n return geojsonIterator as AsyncIterable<TableBatch>;\n }\n}\n\nasync function* makeBinaryGeometryIterator(geojsonIterator) {\n for await (const batch of geojsonIterator) {\n batch.data = geojsonToBinary(batch.data);\n yield batch;\n }\n}\n"],"mappings":"AAOA,SAAQA,eAAe,QAAO,iBAAiB;AAAC,SAExCC,kBAAkB;AAI1B,MAAMC,OAAO,GAAG,cAAkB,KAAK,WAAW,aAAiB,QAAQ;AAc3E,OAAO,MAAMC,mBAAsE,GAAG;EACpFC,IAAI,EAAE,SAAS;EACfC,EAAE,EAAE,SAAS;EACbC,MAAM,EAAE,SAAS;EACjBC,OAAO,EAAEL,OAAO;EAChBM,MAAM,EAAE,IAAI;EACZC,UAAU,EAAE,CAAC,SAAS,CAAC;EACvBC,SAAS,EAAE,CAAC,sBAAsB,CAAC;EACnCC,QAAQ,EAAE,UAAU;EACpBC,IAAI,EAAE,IAAI;EACVC,OAAO,EAAE;IACPC,OAAO,EAAE;MACPC,KAAK,EAAE;IACT,CAAC;IACDC,IAAI,EAAE;MACJD,KAAK,EAAE,kBAAkB;MACzBE,SAAS,EAAE,CAAC,GAAG,EAAE,YAAY;IAC/B,CAAC;IACDC,GAAG,EAAE;MACHC,MAAM,EAAE;IACV;EACF;AAC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IAAI,GAAG;IAAC,GAAGI,aAAa,CAACP,OAAO,CAACC,OAAO;IAAE,GAAGD,OAAO,CAACC;EAAO,CAAC;EAErE,MAAMmB,eAAe,GAAGhC,kBAAkB,CAAC+B,aAAa,EAAEnB,OAAO,CAAC;EAElE,QAAQA,OAAO,CAACK,GAAG,CAACC,MAAM;IACxB,KAAK,QAAQ;MACX,OAAOe,0BAA0B,CAACD,eAAe,CAAC;IACpD;MACE,OAAOA,eAAe;EAC1B;AACF;AAEA,gBAAgBC,0BAA0BA,CAACD,eAAe,EAAE;EAC1D,WAAW,MAAME,KAAK,IAAIF,eAAe,EAAE;IACzCE,KAAK,CAACC,IAAI,GAAGpC,eAAe,CAACmC,KAAK,CAACC,IAAI,CAAC;IACxC,MAAMD,KAAK;EACb;AACF"}
@@ -2430,7 +2430,7 @@ Char: ${this.c}`;
2430
2430
  }
2431
2431
 
2432
2432
  // src/geojson-loader.ts
2433
- var VERSION = true ? "4.1.0-alpha.9" : "latest";
2433
+ var VERSION = true ? "4.1.0" : "latest";
2434
2434
  var GeoJSONWorkerLoader = {
2435
2435
  name: "GeoJSON",
2436
2436
  id: "geojson",
@@ -1,6 +1,6 @@
1
1
  import { parseJSONSync } from "./lib/parsers/parse-json.js";
2
2
  import { parseJSONInBatches } from "./lib/parsers/parse-json-in-batches.js";
3
- const VERSION = typeof "4.1.0-alpha.9" !== 'undefined' ? "4.1.0-alpha.9" : 'latest';
3
+ const VERSION = typeof "4.1.0" !== 'undefined' ? "4.1.0" : 'latest';
4
4
  export const JSONLoader = {
5
5
  name: 'JSON',
6
6
  id: 'json',
@@ -1 +1 @@
1
- {"version":3,"file":"json-loader.js","names":["parseJSONSync","parseJSONInBatches","VERSION","JSONLoader","name","id","module","version","extensions","mimeTypes","category","text","options","json","shape","undefined","table","jsonpaths","parse","parseTextSync","parseInBatches","arrayBuffer","TextDecoder","decode","jsonOptions","asyncIterator"],"sources":["../src/json-loader.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Table, TableBatch, Batch} from '@loaders.gl/schema';\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {parseJSONSync} from './lib/parsers/parse-json';\nimport {parseJSONInBatches} from './lib/parsers/parse-json-in-batches';\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 MetadataBatch = Batch & {\n shape: 'metadata';\n};\n\nexport type JSONBatch = Batch & {\n shape: 'json';\n /** JSON data */\n container: any;\n};\n\n/**\n * @param table -\n * @param jsonpaths -\n */\nexport type JSONLoaderOptions = LoaderOptions & {\n json?: {\n /** Not specifying shape leaves avoids changes */\n shape?: 'object-row-table' | 'array-row-table';\n table?: boolean;\n jsonpaths?: string[];\n };\n};\n\nexport const JSONLoader: LoaderWithParser<\n Table,\n TableBatch | MetadataBatch | JSONBatch,\n JSONLoaderOptions\n> = {\n name: 'JSON',\n id: 'json',\n module: 'json',\n version: VERSION,\n extensions: ['json', 'geojson'],\n mimeTypes: ['application/json'],\n category: 'table',\n text: true,\n options: {\n json: {\n shape: undefined,\n table: false,\n jsonpaths: []\n // batchSize: 'auto'\n }\n },\n parse,\n parseTextSync,\n parseInBatches\n};\n\nasync function parse(arrayBuffer: ArrayBuffer, options?: JSONLoaderOptions) {\n return parseTextSync(new TextDecoder().decode(arrayBuffer), options);\n}\n\nfunction parseTextSync(text: string, options?: JSONLoaderOptions) {\n const jsonOptions = {...options, json: {...JSONLoader.options.json, ...options?.json}};\n return parseJSONSync(text, jsonOptions as JSONLoaderOptions);\n}\n\nfunction parseInBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: JSONLoaderOptions\n): AsyncIterable<TableBatch | MetadataBatch | JSONBatch> {\n const jsonOptions = {...options, json: {...JSONLoader.options.json, ...options?.json}};\n return parseJ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A,OAAO,uBAAPA,OAAO,CAAEC,IAAI;IAAA;EAAC,CAAC;EACtF,OAAOZ,kBAAkB,CAACwB,aAAa,EAAED,WAAgC,CAAC;AAC5E"}
1
+ {"version":3,"file":"json-loader.js","names":["parseJSONSync","parseJSONInBatches","VERSION","JSONLoader","name","id","module","version","extensions","mimeTypes","category","text","options","json","shape","undefined","table","jsonpaths","parse","parseTextSync","parseInBatches","arrayBuffer","TextDecoder","decode","jsonOptions","asyncIterator"],"sources":["../src/json-loader.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Table, TableBatch, Batch} from '@loaders.gl/schema';\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {parseJSONSync} from './lib/parsers/parse-json';\nimport {parseJSONInBatches} from './lib/parsers/parse-json-in-batches';\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 MetadataBatch = Batch & {\n shape: 'metadata';\n};\n\nexport type JSONBatch = Batch & {\n shape: 'json';\n /** JSON data */\n container: any;\n};\n\n/**\n * @param table -\n * @param jsonpaths -\n */\nexport type JSONLoaderOptions = LoaderOptions & {\n json?: {\n /** Not specifying shape leaves avoids changes */\n shape?: 'object-row-table' | 'array-row-table';\n table?: boolean;\n jsonpaths?: string[];\n };\n};\n\nexport const JSONLoader: LoaderWithParser<\n Table,\n TableBatch | MetadataBatch | JSONBatch,\n JSONLoaderOptions\n> = {\n name: 'JSON',\n id: 'json',\n module: 'json',\n version: VERSION,\n extensions: ['json', 'geojson'],\n mimeTypes: ['application/json'],\n category: 'table',\n text: true,\n options: {\n json: {\n shape: undefined,\n table: false,\n jsonpaths: []\n // batchSize: 'auto'\n }\n },\n parse,\n parseTextSync,\n parseInBatches\n};\n\nasync function parse(arrayBuffer: ArrayBuffer, options?: JSONLoaderOptions) {\n return parseTextSync(new TextDecoder().decode(arrayBuffer), options);\n}\n\nfunction parseTextSync(text: string, options?: JSONLoaderOptions) {\n const jsonOptions = {...options, json: {...JSONLoader.options.json, ...options?.json}};\n return parseJSONSync(text, jsonOptions as JSONLoaderOptions);\n}\n\nfunction parseInBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: JSONLoaderOptions\n): AsyncIterable<TableBatch | MetadataBatch | JSONBatch> {\n const jsonOptions = {...options, json: {...JSONLoader.options.json, ...options?.json}};\n return parseJSONInBatches(asyncIterator, jsonOptions as JSONLoaderOptions);\n}\n"],"mappings":"SAMQA,aAAa;AAAA,SACbC,kBAAkB;AAI1B,MAAMC,OAAO,GAAG,cAAkB,KAAK,WAAW,aAAiB,QAAQ;AAyB3E,OAAO,MAAMC,UAIZ,GAAG;EACFC,IAAI,EAAE,MAAM;EACZC,EAAE,EAAE,MAAM;EACVC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEL,OAAO;EAChBM,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC;EAC/BC,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,QAAQ,EAAE,OAAO;EACjBC,IAAI,EAAE,IAAI;EACVC,OAAO,EAAE;IACPC,IAAI,EAAE;MACJC,KAAK,EAAEC,SAAS;MAChBC,KAAK,EAAE,KAAK;MACZC,SAAS,EAAE;IAEb;EACF,CAAC;EACDC,KAAK;EACLC,aAAa;EACbC;AACF,CAAC;AAED,eAAeF,KAAKA,CAACG,WAAwB,EAAET,OAA2B,EAAE;EAC1E,OAAOO,aAAa,CAAC,IAAIG,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,WAAW,CAAC,EAAET,OAAO,CAAC;AACtE;AAEA,SAASO,aAAaA,CAACR,IAAY,EAAEC,OAA2B,EAAE;EAChE,MAAMY,WAAW,GAAG;IAAC,GAAGZ,OAAO;IAAEC,IAAI,EAAE;MAAC,GAAGV,UAAU,CAACS,OAAO,CAACC,IAAI;MAAE,IAAGD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,IAAI;IAAA;EAAC,CAAC;EACtF,OAAOb,aAAa,CAACW,IAAI,EAAEa,WAAgC,CAAC;AAC9D;AAEA,SAASJ,cAAcA,CACrBK,aAAiE,EACjEb,OAA2B,EAC4B;EACvD,MAAMY,WAAW,GAAG;IAAC,GAAGZ,OAAO;IAAEC,IAAI,EAAE;MAAC,GAAGV,UAAU,CAACS,OAAO,CAACC,IAAI;MAAE,IAAGD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,IAAI;IAAA;EAAC,CAAC;EACtF,OAAOZ,kBAAkB,CAACwB,aAAa,EAAED,WAAgC,CAAC;AAC5E"}
@@ -1 +1 @@
1
- {"version":3,"file":"parse-json-in-batches.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-json-in-batches.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAC,iBAAiB,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAQnF,wBAAuB,kBAAkB,CACvC,mBAAmB,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,EACvE,OAAO,EAAE,iBAAiB,GACzB,aAAa,CAAC,UAAU,GAAG,aAAa,GAAG,SAAS,CAAC,CA2EvD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,KAAA,EAAE,IAAI,KAAA,OAmB5C"}
1
+ {"version":3,"file":"parse-json-in-batches.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-json-in-batches.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAC,iBAAiB,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAQnF,wBAAuB,kBAAkB,CACvC,mBAAmB,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,EACvE,OAAO,EAAE,iBAAiB,GACzB,aAAa,CAAC,UAAU,GAAG,aAAa,GAAG,SAAS,CAAC,CA2EvD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,KAAA,EAAE,IAAI,KAAA,OAmB5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"parse-json-in-batches.js","names":["TableBatchBuilder","assert","makeTextDecoderIterator","StreamingJSONParser","JSONPath","parseJSONInBatches","binaryAsyncIterator","options","asyncIterator","metadata","jsonpaths","json","isFirstChunk","schema","tableBatchBuilder","parser","chunk","rows","write","jsonpath","length","getStreamingJsonPathAsString","_options$json","initialBatch","shape","batchType","data","bytesUsed","container","getPartialResult","row","addRow","batch","getFullBatch","chunkComplete","getFinalBatch","finalBatch","rebuildJsonObject","topLevelObject","streamingPath","setFieldAtPath"],"sources":["../../../src/lib/parsers/parse-json-in-batches.ts"],"sourcesContent":["import type {TableBatch} from '@loaders.gl/schema';\nimport type {JSONLoaderOptions, MetadataBatch, JSONBatch} from '../../json-loader';\nimport {TableBatchBuilder} from '@loaders.gl/schema';\nimport {assert, makeTextDecoderIterator} from '@loaders.gl/loader-utils';\nimport StreamingJSONParser from '../json-parser/streaming-json-parser';\nimport JSONPath from '../jsonpath/jsonpath';\n\n// TODO - support batch size 0 = no batching/single batch?\n// eslint-disable-next-line max-statements, complexity\nexport async function* parseJSONInBatches(\n binaryAsyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options: JSONLoaderOptions\n): AsyncIterable<TableBatch | MetadataBatch | JSONBatch> {\n const asyncIterator = makeTextDecoderIterator(binaryAsyncIterator);\n\n const {metadata} = options;\n const {jsonpaths} = options.json || {};\n\n let isFirstChunk: boolean = true;\n\n // @ts-expect-error TODO fix Schema deduction\n const schema: Schema = null;\n const tableBatchBuilder = new TableBatchBuilder(schema, options);\n\n const parser = new StreamingJSONParser({jsonpaths});\n\n for await (const chunk of asyncIterator) {\n const rows = parser.write(chunk);\n\n const jsonpath = rows.length > 0 && parser.getStreamingJsonPathAsString();\n\n if (rows.length > 0 && isFirstChunk) {\n if (metadata) {\n const initialBatch: TableBatch = {\n // Common fields\n shape: options?.json?.shape || 'array-row-table',\n batchType: 'partial-result',\n data: [],\n length: 0,\n bytesUsed: 0,\n // JSON additions\n container: parser.getPartialResult(),\n jsonpath\n };\n yield initialBatch;\n }\n isFirstChunk = false;\n // schema = deduceSchema(rows);\n }\n\n // Add the row\n for (const row of rows) {\n tableBatchBuilder.addRow(row);\n // If a batch has been completed, emit it\n const batch = tableBatchBuilder.getFullBatch({jsonpath});\n if (batch) {\n yield batch;\n }\n }\n\n tableBatchBuilder.chunkComplete(chunk);\n const batch = tableBatchBuilder.getFullBatch({jsonpath});\n if (batch) {\n yield batch;\n }\n }\n\n // yield final batch\n const jsonpath = parser.getStreamingJsonPathAsString();\n const batch = tableBatchBuilder.getFinalBatch({jsonpath});\n if (batch) {\n yield batch;\n }\n\n if (metadata) {\n const finalBatch: JSONBatch = {\n shape: 'json',\n batchType: 'final-result',\n container: parser.getPartialResult(),\n jsonpath: parser.getStreamingJsonPathAsString(),\n /** Data Just to avoid crashing? */\n data: [],\n length: 0\n // schema: null\n };\n yield finalBatch;\n }\n}\n\nexport function rebuildJsonObject(batch, data) {\n // Last batch will have this special type and will provide all the root object of the parsed file\n assert(batch.batchType === 'final-result');\n\n // The streamed JSON data is a top level array (jsonpath = '$'), just return the array of row objects\n if (batch.jsonpath === '$') {\n return data;\n }\n\n // (jsonpath !== '$') The streamed data is not a top level array, so stitch it back in to the top-level object\n if (batch.jsonpath && batch.jsonpath.length > 1) {\n const topLevelObject = batch.container;\n const streamingPath = new JSONPath(batch.jsonpath);\n streamingPath.setFieldAtPath(topLevelObject, data);\n return topLevelObject;\n }\n\n // No jsonpath, in this case nothing was streamed.\n return batch.container;\n}\n"],"mappings":"AAEA,SAAQA,iBAAiB,QAAO,oBA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/C,MAAMkB,cAAc,GAAGN,KAAK,CAACJ,SAAS;IACtC,MAAMW,aAAa,GAAG,IAAInC,QAAQ,CAAC4B,KAAK,CAACb,QAAQ,CAAC;IAClDoB,aAAa,CAACC,cAAc,CAACF,cAAc,EAAEZ,IAAI,CAAC;IAClD,OAAOY,cAAc;EACvB;EAGA,OAAON,KAAK,CAACJ,SAAS;AACxB"}
1
+ {"version":3,"file":"parse-json-in-batches.js","names":["TableBatchBuilder","assert","makeTextDecoderIterator","StreamingJSONParser","JSONPath","parseJSONInBatches","binaryAsyncIterator","options","asyncIterator","metadata","jsonpaths","json","isFirstChunk","schema","tableBatchBuilder","parser","chunk","rows","write","jsonpath","length","getStreamingJsonPathAsString","_options$json","initialBatch","shape","batchType","data","bytesUsed","container","getPartialResult","row","addRow","batch","getFullBatch","chunkComplete","getFinalBatch","finalBatch","rebuildJsonObject","topLevelObject","streamingPath","setFieldAtPath"],"sources":["../../../src/lib/parsers/parse-json-in-batches.ts"],"sourcesContent":["import type {Schema, TableBatch} from '@loaders.gl/schema';\nimport type {JSONLoaderOptions, MetadataBatch, JSONBatch} from '../../json-loader';\nimport {TableBatchBuilder} from '@loaders.gl/schema';\nimport {assert, makeTextDecoderIterator} from '@loaders.gl/loader-utils';\nimport StreamingJSONParser from '../json-parser/streaming-json-parser';\nimport JSONPath from '../jsonpath/jsonpath';\n\n// TODO - support batch size 0 = no batching/single batch?\n// eslint-disable-next-line max-statements, complexity\nexport async function* parseJSONInBatches(\n binaryAsyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options: JSONLoaderOptions\n): AsyncIterable<TableBatch | MetadataBatch | JSONBatch> {\n const asyncIterator = makeTextDecoderIterator(binaryAsyncIterator);\n\n const {metadata} = options;\n const {jsonpaths} = options.json || {};\n\n let isFirstChunk: boolean = true;\n\n // @ts-expect-error TODO fix Schema deduction\n const schema: Schema = null;\n const tableBatchBuilder = new TableBatchBuilder(schema, options);\n\n const parser = new StreamingJSONParser({jsonpaths});\n\n for await (const chunk of asyncIterator) {\n const rows = parser.write(chunk);\n\n const jsonpath = rows.length > 0 && parser.getStreamingJsonPathAsString();\n\n if (rows.length > 0 && isFirstChunk) {\n if (metadata) {\n const initialBatch: TableBatch = {\n // Common fields\n shape: options?.json?.shape || 'array-row-table',\n batchType: 'partial-result',\n data: [],\n length: 0,\n bytesUsed: 0,\n // JSON additions\n container: parser.getPartialResult(),\n jsonpath\n };\n yield initialBatch;\n }\n isFirstChunk = false;\n // schema = deduceSchema(rows);\n }\n\n // Add the row\n for (const row of rows) {\n tableBatchBuilder.addRow(row);\n // If a batch has been completed, emit it\n const batch = tableBatchBuilder.getFullBatch({jsonpath});\n if (batch) {\n yield batch;\n }\n }\n\n tableBatchBuilder.chunkComplete(chunk);\n const batch = tableBatchBuilder.getFullBatch({jsonpath});\n if (batch) {\n yield batch;\n }\n }\n\n // yield final batch\n const jsonpath = parser.getStreamingJsonPathAsString();\n const batch = tableBatchBuilder.getFinalBatch({jsonpath});\n if (batch) {\n yield batch;\n }\n\n if (metadata) {\n const finalBatch: JSONBatch = {\n shape: 'json',\n batchType: 'final-result',\n container: parser.getPartialResult(),\n jsonpath: parser.getStreamingJsonPathAsString(),\n /** Data Just to avoid crashing? */\n data: [],\n length: 0\n // schema: null\n };\n yield finalBatch;\n }\n}\n\nexport function rebuildJsonObject(batch, data) {\n // Last batch will have this special type and will provide all the root object of the parsed file\n assert(batch.batchType === 'final-result');\n\n // The streamed JSON data is a top level array (jsonpath = '$'), just return the array of row objects\n if (batch.jsonpath === '$') {\n return data;\n }\n\n // (jsonpath !== '$') The streamed data is not a top level array, so stitch it back in to the top-level object\n if (batch.jsonpath && batch.jsonpath.length > 1) {\n const topLevelObject = batch.container;\n const streamingPath = new JSONPath(batch.jsonpath);\n streamingPath.setFieldAtPath(topLevelObject, data);\n return topLevelObject;\n }\n\n // No jsonpath, in this case nothing was streamed.\n return batch.container;\n}\n"],"mappings":"AAEA,SAAQA,iBAAiB,QAAO,oB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C/C,MAAMkB,cAAc,GAAGN,KAAK,CAACJ,SAAS;IACtC,MAAMW,aAAa,GAAG,IAAInC,QAAQ,CAAC4B,KAAK,CAACb,QAAQ,CAAC;IAClDoB,aAAa,CAACC,cAAc,CAACF,cAAc,EAAEZ,IAAI,CAAC;IAClD,OAAOY,cAAc;EACvB;EAGA,OAAON,KAAK,CAACJ,SAAS;AACxB"}
@@ -1,6 +1,6 @@
1
1
  import { parseNDJSONSync } from "./lib/parsers/parse-ndjson.js";
2
2
  import { parseNDJSONInBatches } from "./lib/parsers/parse-ndjson-in-batches.js";
3
- const VERSION = typeof "4.1.0-alpha.9" !== 'undefined' ? "4.1.0-alpha.9" : 'latest';
3
+ const VERSION = typeof "4.1.0" !== 'undefined' ? "4.1.0" : 'latest';
4
4
  export const NDJSONLoader = {
5
5
  name: 'NDJSON',
6
6
  id: 'ndjson',
@@ -1 +1 @@
1
- {"version":3,"file":"ndgeoson-loader.js","names":["parseNDJSONSync","parseNDJSONInBatches","VERSION","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","arrayBuffer","TextDecoder","decode","parseTextSync","parseInBatches","options","geojson","shape","gis","format"],"sources":["../src/ndgeoson-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {parseNDJSONSync} from './lib/parsers/parse-ndjson';\nimport {parseNDJSONInBatches} from './lib/parsers/parse-ndjson-in-batches';\nimport {ArrayRowTable, ObjectRowTable, Batch} from '@loaders.gl/schema';\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\n/** Options for NDGeoJSONLoader */\nexport type NDGeoJSONLoaderOptions = LoaderOptions & {\n geojson?: {\n shape?: 'object-row-table';\n };\n gis?: {\n format: 'geojson';\n };\n};\n\n/** NDGeoJSONLoader */\nexport const NDJSONLoader: LoaderWithParser<\n ArrayRowTable | ObjectRowTable,\n Batch,\n NDGeoJSONLoaderOptions\n> = {\n name: 'NDJSON',\n id: 'ndjson',\n module: 'json',\n version: VERSION,\n extensions: ['ndjson', 'ndgeojson'],\n mimeTypes: [\n 'application/geo+x-ndjson',\n 'application/geo+x-ldjson',\n 'application/jsonlines', // https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html#cm-batch\n 'application/geo+json-seq',\n 'application/x-ndjson'\n ],\n category: 'table',\n text: true,\n parse: async (arrayBuffer: ArrayBuffer) => parseNDJSONSync(new TextDecoder().decode(arrayBuffer)),\n parseTextSync: parseNDJSONSync,\n parseInBatches: parseNDJSONInBatches,\n options: {\n geojson: {\n shape: 'object-row-table'\n },\n gis: {\n format: 'geojson'\n }\n }\n};\n"],"mappings":"SACQA,eAAe;AAAA,SACfC,oBAAoB;AAK5B,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAa3E,OAAO,MAAMC,YAIZ,GAAG;EACFC,IAAI,EAAE,QAAQ;EACdC,EAAE,EAAE,QAAQ;EACZC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEL,OAAO;EAChBM,UAAU,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;EACnCC,SAAS,EAAE,CACT,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,CACvB;EACDC,QAAQ,EAAE,OAAO;EACjBC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,MAAOC,WAAwB,IAAKb,eAAe,CAAC,IAAIc,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,WAAW,CAAC,CAAC;EACjGG,aAAa,EAAEhB,eAAe;EAC9BiB,cAAc,EAAEhB,oBAAoB;EACpCiB,OAAO,EAAE;IACPC,OAAO,EAAE;MACPC,KAAK,EAAE;IACT,CAAC;IACDC,GAAG,EAAE;MACHC,MAAM,EAAE;IACV;EACF;AACF,CAAC"}
1
+ {"version":3,"file":"ndgeoson-loader.js","names":["parseNDJSONSync","parseNDJSONInBatches","VERSION","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","arrayBuffer","TextDecoder","decode","parseTextSync","parseInBatches","options","geojson","shape","gis","format"],"sources":["../src/ndgeoson-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {parseNDJSONSync} from './lib/parsers/parse-ndjson';\nimport {parseNDJSONInBatches} from './lib/parsers/parse-ndjson-in-batches';\nimport {ArrayRowTable, ObjectRowTable, Batch} from '@loaders.gl/schema';\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\n/** Options for NDGeoJSONLoader */\nexport type NDGeoJSONLoaderOptions = LoaderOptions & {\n geojson?: {\n shape?: 'object-row-table';\n };\n gis?: {\n format: 'geojson';\n };\n};\n\n/** NDGeoJSONLoader */\nexport const NDJSONLoader: LoaderWithParser<\n ArrayRowTable | ObjectRowTable,\n Batch,\n NDGeoJSONLoaderOptions\n> = {\n name: 'NDJSON',\n id: 'ndjson',\n module: 'json',\n version: VERSION,\n extensions: ['ndjson', 'ndgeojson'],\n mimeTypes: [\n 'application/geo+x-ndjson',\n 'application/geo+x-ldjson',\n 'application/jsonlines', // https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html#cm-batch\n 'application/geo+json-seq',\n 'application/x-ndjson'\n ],\n category: 'table',\n text: true,\n parse: async (arrayBuffer: ArrayBuffer) => parseNDJSONSync(new TextDecoder().decode(arrayBuffer)),\n parseTextSync: parseNDJSONSync,\n parseInBatches: parseNDJSONInBatches,\n options: {\n geojson: {\n shape: 'object-row-table'\n },\n gis: {\n format: 'geojson'\n }\n }\n};\n"],"mappings":"SACQA,eAAe;AAAA,SACfC,oBAAoB;AAK5B,MAAMC,OAAO,GAAG,cAAkB,KAAK,WAAW,aAAiB,QAAQ;AAa3E,OAAO,MAAMC,YAIZ,GAAG;EACFC,IAAI,EAAE,QAAQ;EACdC,EAAE,EAAE,QAAQ;EACZC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEL,OAAO;EAChBM,UAAU,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;EACnCC,SAAS,EAAE,CACT,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,CACvB;EACDC,QAAQ,EAAE,OAAO;EACjBC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,MAAOC,WAAwB,IAAKb,eAAe,CAAC,IAAIc,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,WAAW,CAAC,CAAC;EACjGG,aAAa,EAAEhB,eAAe;EAC9BiB,cAAc,EAAEhB,oBAAoB;EACpCiB,OAAO,EAAE;IACPC,OAAO,EAAE;MACPC,KAAK,EAAE;IACT,CAAC;IACDC,GAAG,EAAE;MACHC,MAAM,EAAE;IACV;EACF;AACF,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { parseNDJSONSync } from "./lib/parsers/parse-ndjson.js";
2
2
  import { parseNDJSONInBatches } from "./lib/parsers/parse-ndjson-in-batches.js";
3
- const VERSION = typeof "4.1.0-alpha.9" !== 'undefined' ? "4.1.0-alpha.9" : 'latest';
3
+ const VERSION = typeof "4.1.0" !== 'undefined' ? "4.1.0" : 'latest';
4
4
  export const NDJSONLoader = {
5
5
  name: 'NDJSON',
6
6
  id: 'ndjson',
@@ -1 +1 @@
1
- {"version":3,"file":"ndjson-loader.js","names":["parseNDJSONSync","parseNDJSONInBatches","VERSION","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","arrayBuffer","TextDecoder","decode","parseTextSync","parseInBatches","options"],"sources":["../src/ndjson-loader.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {ObjectRowTable, ArrayRowTable, TableBatch} from '@loaders.gl/schema';\nimport {parseNDJSONSync} from './lib/parsers/parse-ndjson';\nimport {parseNDJSONInBatches} from './lib/parsers/parse-ndjson-in-batches';\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 const NDJSONLoader: LoaderWithParser<\n ObjectRowTable | ArrayRowTable,\n TableBatch,\n LoaderOptions\n> = {\n name: 'NDJSON',\n id: 'ndjson',\n module: 'json',\n version: VERSION,\n extensions: ['ndjson', 'jsonl'],\n mimeTypes: [\n 'application/x-ndjson',\n 'application/jsonlines', // https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html#cm-batch\n 'application/json-seq'\n ],\n category: 'table',\n text: true,\n parse: async (arrayBuffer: ArrayBuffer) => parseNDJSONSync(new TextDecoder().decode(arrayBuffer)),\n parseTextSync: parseNDJSONSync,\n parseInBatches: parseNDJSONInBatches,\n options: {}\n};\n"],"mappings":"SAMQA,eAAe;AAAA,SACfC,oBAAoB;AAI5B,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAE3E,OAAO,MAAMC,YAIZ,GAAG;EACFC,IAAI,EAAE,QAAQ;EACdC,EAAE,EAAE,QAAQ;EACZC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEL,OAAO;EAChBM,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;EAC/BC,SAAS,EAAE,CACT,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,CACvB;EACDC,QAAQ,EAAE,OAAO;EACjBC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,MAAOC,WAAwB,IAAKb,eAAe,CAAC,IAAIc,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,WAAW,CAAC,CAAC;EACjGG,aAAa,EAAEhB,eAAe;EAC9BiB,cAAc,EAAEhB,oBAAoB;EACpCiB,OAAO,EAAE,CAAC;AACZ,CAAC"}
1
+ {"version":3,"file":"ndjson-loader.js","names":["parseNDJSONSync","parseNDJSONInBatches","VERSION","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","arrayBuffer","TextDecoder","decode","parseTextSync","parseInBatches","options"],"sources":["../src/ndjson-loader.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {ObjectRowTable, ArrayRowTable, TableBatch} from '@loaders.gl/schema';\nimport {parseNDJSONSync} from './lib/parsers/parse-ndjson';\nimport {parseNDJSONInBatches} from './lib/parsers/parse-ndjson-in-batches';\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 const NDJSONLoader: LoaderWithParser<\n ObjectRowTable | ArrayRowTable,\n TableBatch,\n LoaderOptions\n> = {\n name: 'NDJSON',\n id: 'ndjson',\n module: 'json',\n version: VERSION,\n extensions: ['ndjson', 'jsonl'],\n mimeTypes: [\n 'application/x-ndjson',\n 'application/jsonlines', // https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html#cm-batch\n 'application/json-seq'\n ],\n category: 'table',\n text: true,\n parse: async (arrayBuffer: ArrayBuffer) => parseNDJSONSync(new TextDecoder().decode(arrayBuffer)),\n parseTextSync: parseNDJSONSync,\n parseInBatches: parseNDJSONInBatches,\n options: {}\n};\n"],"mappings":"SAMQA,eAAe;AAAA,SACfC,oBAAoB;AAI5B,MAAMC,OAAO,GAAG,cAAkB,KAAK,WAAW,aAAiB,QAAQ;AAE3E,OAAO,MAAMC,YAIZ,GAAG;EACFC,IAAI,EAAE,QAAQ;EACdC,EAAE,EAAE,QAAQ;EACZC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEL,OAAO;EAChBM,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;EAC/BC,SAAS,EAAE,CACT,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,CACvB;EACDC,QAAQ,EAAE,OAAO;EACjBC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,MAAOC,WAAwB,IAAKb,eAAe,CAAC,IAAIc,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,WAAW,CAAC,CAAC;EACjGG,aAAa,EAAEhB,eAAe;EAC9BiB,cAAc,EAAEhB,oBAAoB;EACpCiB,OAAO,EAAE,CAAC;AACZ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/json",
3
- "version": "4.1.0-alpha.9",
3
+ "version": "4.1.0",
4
4
  "description": "Framework-independent loader for JSON and streaming JSON formats",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -26,9 +26,9 @@
26
26
  "module": "dist/index.js",
27
27
  "exports": {
28
28
  ".": {
29
+ "types": "./dist/index.d.ts",
29
30
  "import": "./dist/index.js",
30
- "require": "./dist/index.cjs",
31
- "types": "./dist/index.d.ts"
31
+ "require": "./dist/index.cjs"
32
32
  }
33
33
  },
34
34
  "sideEffects": false,
@@ -43,9 +43,9 @@
43
43
  "build-worker": "esbuild src/workers/geojson-worker.ts --bundle --outfile=dist/geojson-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
44
44
  },
45
45
  "dependencies": {
46
- "@loaders.gl/gis": "4.1.0-alpha.9",
47
- "@loaders.gl/loader-utils": "4.1.0-alpha.9",
48
- "@loaders.gl/schema": "4.1.0-alpha.9"
46
+ "@loaders.gl/gis": "4.1.0",
47
+ "@loaders.gl/loader-utils": "4.1.0",
48
+ "@loaders.gl/schema": "4.1.0"
49
49
  },
50
- "gitHead": "0291d4d78d71202385d0368942f84778d6aafa82"
50
+ "gitHead": "75961cc7a6ed6679018c0e3fb6eb5c3c74d97bdb"
51
51
  }
@@ -1,4 +1,4 @@
1
- import type {TableBatch} from '@loaders.gl/schema';
1
+ import type {Schema, TableBatch} from '@loaders.gl/schema';
2
2
  import type {JSONLoaderOptions, MetadataBatch, JSONBatch} from '../../json-loader';
3
3
  import {TableBatchBuilder} from '@loaders.gl/schema';
4
4
  import {assert, makeTextDecoderIterator} from '@loaders.gl/loader-utils';