@loaders.gl/schema 4.2.0-alpha.4 → 4.2.0-alpha.6

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.
Files changed (136) hide show
  1. package/dist/dist.dev.js +216 -147
  2. package/dist/dist.min.js +9 -0
  3. package/dist/index.cjs +128 -97
  4. package/dist/index.cjs.map +7 -0
  5. package/dist/index.d.ts +30 -30
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +9 -1
  8. package/dist/lib/mesh/convert-mesh.d.ts +2 -2
  9. package/dist/lib/mesh/convert-mesh.d.ts.map +1 -1
  10. package/dist/lib/mesh/convert-mesh.js +33 -18
  11. package/dist/lib/mesh/deduce-mesh-schema.d.ts +2 -2
  12. package/dist/lib/mesh/deduce-mesh-schema.d.ts.map +1 -1
  13. package/dist/lib/mesh/deduce-mesh-schema.js +54 -40
  14. package/dist/lib/mesh/mesh-to-arrow-table.js +46 -1
  15. package/dist/lib/mesh/mesh-utils.d.ts +2 -2
  16. package/dist/lib/mesh/mesh-utils.d.ts.map +1 -1
  17. package/dist/lib/mesh/mesh-utils.js +41 -28
  18. package/dist/lib/table/arrow-api/arrow-like-field.d.ts +1 -1
  19. package/dist/lib/table/arrow-api/arrow-like-field.d.ts.map +1 -1
  20. package/dist/lib/table/arrow-api/arrow-like-field.js +34 -25
  21. package/dist/lib/table/arrow-api/arrow-like-schema.d.ts +2 -2
  22. package/dist/lib/table/arrow-api/arrow-like-schema.d.ts.map +1 -1
  23. package/dist/lib/table/arrow-api/arrow-like-schema.js +71 -56
  24. package/dist/lib/table/arrow-api/arrow-like-table.d.ts +2 -2
  25. package/dist/lib/table/arrow-api/arrow-like-table.d.ts.map +1 -1
  26. package/dist/lib/table/arrow-api/arrow-like-table.js +57 -45
  27. package/dist/lib/table/arrow-api/arrow-like-type.d.ts +3 -3
  28. package/dist/lib/table/arrow-api/arrow-like-type.d.ts.map +1 -1
  29. package/dist/lib/table/arrow-api/arrow-like-type.js +371 -321
  30. package/dist/lib/table/arrow-api/enum.js +97 -48
  31. package/dist/lib/table/arrow-api/get-type-info.d.ts +1 -1
  32. package/dist/lib/table/arrow-api/get-type-info.d.ts.map +1 -1
  33. package/dist/lib/table/arrow-api/get-type-info.js +20 -14
  34. package/dist/lib/table/arrow-api/index.d.ts +4 -4
  35. package/dist/lib/table/arrow-api/index.d.ts.map +1 -1
  36. package/dist/lib/table/arrow-api/index.js +3 -1
  37. package/dist/lib/table/batches/base-table-batch-aggregator.d.ts +3 -3
  38. package/dist/lib/table/batches/base-table-batch-aggregator.d.ts.map +1 -1
  39. package/dist/lib/table/batches/base-table-batch-aggregator.js +56 -52
  40. package/dist/lib/table/batches/columnar-table-batch-aggregator.d.ts +3 -3
  41. package/dist/lib/table/batches/columnar-table-batch-aggregator.d.ts.map +1 -1
  42. package/dist/lib/table/batches/columnar-table-batch-aggregator.js +82 -67
  43. package/dist/lib/table/batches/row-table-batch-aggregator.d.ts +3 -3
  44. package/dist/lib/table/batches/row-table-batch-aggregator.d.ts.map +1 -1
  45. package/dist/lib/table/batches/row-table-batch-aggregator.js +76 -67
  46. package/dist/lib/table/batches/table-batch-aggregator.d.ts +2 -2
  47. package/dist/lib/table/batches/table-batch-aggregator.d.ts.map +1 -1
  48. package/dist/lib/table/batches/table-batch-aggregator.js +3 -1
  49. package/dist/lib/table/batches/table-batch-builder.d.ts +3 -3
  50. package/dist/lib/table/batches/table-batch-builder.d.ts.map +1 -1
  51. package/dist/lib/table/batches/table-batch-builder.js +131 -116
  52. package/dist/lib/table/simple-table/convert-table.d.ts +1 -1
  53. package/dist/lib/table/simple-table/convert-table.d.ts.map +1 -1
  54. package/dist/lib/table/simple-table/convert-table.js +97 -62
  55. package/dist/lib/table/simple-table/data-type.d.ts +2 -2
  56. package/dist/lib/table/simple-table/data-type.d.ts.map +1 -1
  57. package/dist/lib/table/simple-table/data-type.js +79 -76
  58. package/dist/lib/table/simple-table/make-table-from-batches.js +70 -67
  59. package/dist/lib/table/simple-table/make-table.d.ts +1 -1
  60. package/dist/lib/table/simple-table/make-table.d.ts.map +1 -1
  61. package/dist/lib/table/simple-table/make-table.js +85 -41
  62. package/dist/lib/table/simple-table/row-utils.js +38 -31
  63. package/dist/lib/table/simple-table/table-accessors.d.ts +1 -1
  64. package/dist/lib/table/simple-table/table-accessors.d.ts.map +1 -1
  65. package/dist/lib/table/simple-table/table-accessors.js +314 -270
  66. package/dist/lib/table/simple-table/table-column.d.ts +1 -1
  67. package/dist/lib/table/simple-table/table-column.d.ts.map +1 -1
  68. package/dist/lib/table/simple-table/table-column.js +36 -3
  69. package/dist/lib/table/simple-table/table-schema.d.ts +2 -2
  70. package/dist/lib/table/simple-table/table-schema.d.ts.map +1 -1
  71. package/dist/lib/table/simple-table/table-schema.js +69 -56
  72. package/dist/lib/utils/assert.js +6 -4
  73. package/dist/lib/utils/async-queue.js +79 -82
  74. package/dist/types/batch.d.ts +1 -1
  75. package/dist/types/batch.d.ts.map +1 -1
  76. package/dist/types/batch.js +3 -1
  77. package/dist/types/binary-geometries.d.ts +1 -1
  78. package/dist/types/binary-geometries.d.ts.map +1 -1
  79. package/dist/types/binary-geometries.js +3 -1
  80. package/dist/types/category-gis.d.ts +2 -2
  81. package/dist/types/category-gis.d.ts.map +1 -1
  82. package/dist/types/category-gis.js +3 -1
  83. package/dist/types/category-image.js +3 -1
  84. package/dist/types/category-mesh.d.ts +3 -3
  85. package/dist/types/category-mesh.d.ts.map +1 -1
  86. package/dist/types/category-mesh.js +3 -1
  87. package/dist/types/category-table.d.ts +3 -3
  88. package/dist/types/category-table.d.ts.map +1 -1
  89. package/dist/types/category-table.js +3 -1
  90. package/dist/types/category-texture.d.ts +1 -1
  91. package/dist/types/category-texture.d.ts.map +1 -1
  92. package/dist/types/category-texture.js +3 -1
  93. package/dist/types/flat-geometries.js +3 -1
  94. package/dist/types/schema.js +3 -1
  95. package/dist/types/types.js +3 -1
  96. package/package.json +8 -4
  97. package/src/index.ts +1 -1
  98. package/src/lib/table/arrow-api/arrow-like-field.ts +2 -2
  99. package/src/lib/table/arrow-api/arrow-like-type.ts +4 -2
  100. package/dist/index.js.map +0 -1
  101. package/dist/lib/mesh/convert-mesh.js.map +0 -1
  102. package/dist/lib/mesh/deduce-mesh-schema.js.map +0 -1
  103. package/dist/lib/mesh/mesh-to-arrow-table.js.map +0 -1
  104. package/dist/lib/mesh/mesh-utils.js.map +0 -1
  105. package/dist/lib/table/arrow-api/arrow-like-field.js.map +0 -1
  106. package/dist/lib/table/arrow-api/arrow-like-schema.js.map +0 -1
  107. package/dist/lib/table/arrow-api/arrow-like-table.js.map +0 -1
  108. package/dist/lib/table/arrow-api/arrow-like-type.js.map +0 -1
  109. package/dist/lib/table/arrow-api/enum.js.map +0 -1
  110. package/dist/lib/table/arrow-api/get-type-info.js.map +0 -1
  111. package/dist/lib/table/arrow-api/index.js.map +0 -1
  112. package/dist/lib/table/batches/base-table-batch-aggregator.js.map +0 -1
  113. package/dist/lib/table/batches/columnar-table-batch-aggregator.js.map +0 -1
  114. package/dist/lib/table/batches/row-table-batch-aggregator.js.map +0 -1
  115. package/dist/lib/table/batches/table-batch-aggregator.js.map +0 -1
  116. package/dist/lib/table/batches/table-batch-builder.js.map +0 -1
  117. package/dist/lib/table/simple-table/convert-table.js.map +0 -1
  118. package/dist/lib/table/simple-table/data-type.js.map +0 -1
  119. package/dist/lib/table/simple-table/make-table-from-batches.js.map +0 -1
  120. package/dist/lib/table/simple-table/make-table.js.map +0 -1
  121. package/dist/lib/table/simple-table/row-utils.js.map +0 -1
  122. package/dist/lib/table/simple-table/table-accessors.js.map +0 -1
  123. package/dist/lib/table/simple-table/table-column.js.map +0 -1
  124. package/dist/lib/table/simple-table/table-schema.js.map +0 -1
  125. package/dist/lib/utils/assert.js.map +0 -1
  126. package/dist/lib/utils/async-queue.js.map +0 -1
  127. package/dist/types/batch.js.map +0 -1
  128. package/dist/types/binary-geometries.js.map +0 -1
  129. package/dist/types/category-gis.js.map +0 -1
  130. package/dist/types/category-image.js.map +0 -1
  131. package/dist/types/category-mesh.js.map +0 -1
  132. package/dist/types/category-table.js.map +0 -1
  133. package/dist/types/category-texture.js.map +0 -1
  134. package/dist/types/flat-geometries.js.map +0 -1
  135. package/dist/types/schema.js.map +0 -1
  136. package/dist/types/types.js.map +0 -1
@@ -0,0 +1,9 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if (typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory();
4
+ else if (typeof define === 'function' && define.amd) define([], factory);
5
+ else if (typeof exports === 'object') exports['loaders'] = factory();
6
+ else root['loaders'] = factory();})(globalThis, function () {
7
+ "use strict";var __exports__=(()=>{var Zt=Object.create;var R=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var Qt=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty;var re=(e,t,r)=>t in e?R(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var se=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ae=(e,t)=>{for(var r in t)R(e,r,{get:t[r],enumerable:!0})},M=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Qt(t))!ee.call(e,a)&&a!==r&&R(e,a,{get:()=>t[a],enumerable:!(s=Kt(t,a))||s.enumerable});return e},U=(e,t,r)=>(M(e,t,"default"),r&&M(r,t,"default")),ne=(e,t,r)=>(r=e!=null?Zt(te(e)):{},M(t||!e||!e.__esModule?R(r,"default",{value:e,enumerable:!0}):r,e)),oe=e=>M(R({},"__esModule",{value:!0}),e);var Et=(e,t,r)=>(re(e,typeof t!="symbol"?t+"":t,r),r);var Ct=se((Ae,Bt)=>{Bt.exports=globalThis.loaders});var C={};ae(C,{ArrowLikeDataType:()=>m,ArrowLikeField:()=>p,ArrowLikeSchema:()=>d,ArrowLikeTable:()=>P,AsyncQueue:()=>B,Binary:()=>at,Bool:()=>H,ColumnarTableBatchAggregator:()=>S,Date:()=>j,DateDay:()=>ot,DateMillisecond:()=>it,FixedSizeList:()=>gt,Float:()=>x,Float16:()=>et,Float32:()=>rt,Float64:()=>st,Int:()=>f,Int16:()=>J,Int32:()=>G,Int64:()=>X,Int8:()=>V,Interval:()=>O,IntervalDayTime:()=>ft,IntervalYearMonth:()=>pt,Null:()=>q,RowTableBatchAggregator:()=>A,Struct:()=>wt,TableBatchBuilder:()=>F,Time:()=>T,TimeMillisecond:()=>lt,TimeSecond:()=>ct,Timestamp:()=>b,TimestampMicrosecond:()=>mt,TimestampMillisecond:()=>ht,TimestampNanosecond:()=>dt,TimestampSecond:()=>ut,Uint16:()=>K,Uint32:()=>Q,Uint64:()=>tt,Uint8:()=>Z,Utf8:()=>nt,convertTable:()=>Ht,convertToArrayRow:()=>L,convertToObjectRow:()=>v,deduceMeshField:()=>Tt,deduceMeshSchema:()=>Gt,deduceTableSchema:()=>w,getDataTypeFromArray:()=>Y,getMeshBoundingBox:()=>Jt,getMeshSize:()=>Vt,getTableCell:()=>I,getTableColumnIndex:()=>xt,getTableColumnName:()=>vt,getTableLength:()=>h,getTableNumCols:()=>$,getTableRowAsArray:()=>E,getTableRowAsObject:()=>N,getTableRowShape:()=>kt,getTypeInfo:()=>Xt,isTable:()=>Ut,makeArrayRowIterator:()=>At,makeBatchFromTable:()=>Yt,makeMeshAttributeMetadata:()=>Ot,makeObjectRowIterator:()=>St,makeRowIterator:()=>Lt,makeTableFromBatches:()=>Pt,makeTableFromData:()=>Wt});U(C,ne(Ct(),1));var k=class{schema;options;shape;length=0;rows=null;cursor=0;_headers=[];constructor(t,r){if(this.options=r,this.schema=t,!Array.isArray(t)){this._headers=[];for(let s in t)this._headers[t[s].index]=t[s].name}}rowCount(){return this.length}addArrayRow(t,r){Number.isFinite(r)&&(this.cursor=r),this.shape="array-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}addObjectRow(t,r){Number.isFinite(r)&&(this.cursor=r),this.shape="object-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}getBatch(){let t=this.rows;return t?(t=t.slice(0,this.length),this.rows=null,{shape:this.shape||"array-row-table",batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}):null}};function v(e,t){if(!e)throw new Error("null row");let r={};if(t)for(let s=0;s<t.length;s++)r[t[s]]=e[s];else for(let s=0;s<e.length;s++){let a=`column-${s}`;r[a]=e[s]}return r}function L(e,t){if(!e)throw new Error("null row");if(t){let r=new Array(t.length);for(let s=0;s<t.length;s++)r[s]=e[t[s]];return r}return Object.values(e)}function Dt(e){let t=[];for(let r=0;r<e.length;r++){let s=`column-${r}`;t.push(s)}return t}function _t(e){return Object.keys(e)}var Mt=100,A=class{schema;options;length=0;objectRows=null;arrayRows=null;cursor=0;_headers=null;constructor(t,r){if(this.options=r,this.schema=t,t){this._headers=[];for(let s in t)this._headers[t[s].index]=t[s].name}}rowCount(){return this.length}addArrayRow(t,r){switch(Number.isFinite(r)&&(this.cursor=r),this._headers||=Dt(t),this.options.shape){case"object-row-table":let s=v(t,this._headers);this.addObjectRow(s,r);break;case"array-row-table":this.arrayRows=this.arrayRows||new Array(Mt),this.arrayRows[this.length]=t,this.length++;break}}addObjectRow(t,r){switch(Number.isFinite(r)&&(this.cursor=r),this._headers||=_t(t),this.options.shape){case"array-row-table":let s=L(t,this._headers);this.addArrayRow(s,r);break;case"object-row-table":this.objectRows=this.objectRows||new Array(Mt),this.objectRows[this.length]=t,this.length++;break}}getBatch(){let t=this.arrayRows||this.objectRows;return t?(t=t.slice(0,this.length),this.arrayRows=null,this.objectRows=null,{shape:this.options.shape,batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}):null}};var S=class{schema;length=0;allocated=0;columns={};constructor(t,r){this.schema=t,this._reallocateColumns()}rowCount(){return this.length}addArrayRow(t){this._reallocateColumns();let r=0;for(let s in this.columns)this.columns[s][this.length]=t[r++];this.length++}addObjectRow(t){this._reallocateColumns();for(let r in t)this.columns[r][this.length]=t[r];this.length++}getBatch(){this._pruneColumns();let t=Array.isArray(this.schema)?this.columns:{};if(!Array.isArray(this.schema))for(let s in this.schema){let a=this.schema[s];t[a.name]=this.columns[a.index]}return this.columns={},{shape:"columnar-table",batchType:"data",data:t,schema:this.schema,length:this.length}}_reallocateColumns(){if(!(this.length<this.allocated)){this.allocated=this.allocated>0?this.allocated*=2:100,this.columns={};for(let t in this.schema){let r=this.schema[t],s=r.type||Float32Array,a=this.columns[r.index];if(a&&ArrayBuffer.isView(a)){let u=new s(this.allocated);u.set(a),this.columns[r.index]=u}else a?(a.length=this.allocated,this.columns[r.index]=a):this.columns[r.index]=new s(this.allocated)}}}_pruneColumns(){for(let[t,r]of Object.entries(this.columns))this.columns[t]=r.slice(0,this.length)}};var ie={shape:void 0,batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0},ce="TableBatchBuilder",z=class{schema;options;aggregator=null;batchCount=0;bytesUsed=0;isChunkComplete=!1;lastBatchEmittedMs=Date.now();totalLength=0;totalBytes=0;rowBytes=0;constructor(t,r){this.schema=t,this.options={...ie,...r}}limitReached(){return!!(Boolean(this.options?.limit)&&this.totalLength>=this.options.limit||Boolean(this.options?._limitMB)&&this.totalBytes/1e6>=this.options._limitMB)}addRow(t){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(t),this.totalBytes+=this.rowBytes,Array.isArray(t)?this.addArrayRow(t):this.addObjectRow(t))}addArrayRow(t){if(!this.aggregator){let r=this._getTableBatchType();this.aggregator=new r(this.schema,this.options)}this.aggregator.addArrayRow(t)}addObjectRow(t){if(!this.aggregator){let r=this._getTableBatchType();this.aggregator=new r(this.schema,this.options)}this.aggregator.addObjectRow(t)}chunkComplete(t){t instanceof ArrayBuffer&&(this.bytesUsed+=t.byteLength),typeof t=="string"&&(this.bytesUsed+=t.length),this.isChunkComplete=!0}getFullBatch(t){return this._isFull()?this._getBatch(t):null}getFinalBatch(t){return this._getBatch(t)}_estimateRowMB(t){return Array.isArray(t)?t.length*8:Object.keys(t).length*8}_isFull(){if(!this.aggregator||this.aggregator.rowCount()===0)return!1;if(this.options.batchSize==="auto"){if(!this.isChunkComplete)return!1}else if(this.options.batchSize>this.aggregator.rowCount())return!1;return this.options.batchDebounceMs>Date.now()-this.lastBatchEmittedMs?!1:(this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),!0)}_getBatch(t){if(!this.aggregator)return null;t?.bytesUsed&&(this.bytesUsed=t.bytesUsed);let r=this.aggregator.getBatch();return r.count=this.batchCount,r.bytesUsed=this.bytesUsed,Object.assign(r,t),this.batchCount++,this.aggregator=null,r}_getTableBatchType(){switch(this.options.shape){case"array-row-table":case"object-row-table":return A;case"columnar-table":return S;case"arrow-table":if(!z.ArrowBatch)throw new Error(ce);return z.ArrowBatch;default:return k}}},F=z;Et(F,"ArrowBatch");function Ut(e){switch(typeof e=="object"&&e?.shape){case"array-row-table":case"object-row-table":return Array.isArray(e.data);case"geojson-table":return Array.isArray(e.features);case"columnar-table":return e.data&&typeof e.data=="object";case"arrow-table":return Boolean(e?.data?.numRows!==void 0);default:return!1}}function h(e){switch(e.shape){case"array-row-table":case"object-row-table":return e.data.length;case"geojson-table":return e.features.length;case"arrow-table":return e.data.numRows;case"columnar-table":for(let r of Object.values(e.data))return r.length||0;return 0;default:throw new Error("table")}}function $(e){if(e.schema)return e.schema.fields.length;if(h(e)===0)throw new Error("empty table");switch(e.shape){case"array-row-table":return e.data[0].length;case"object-row-table":return Object.keys(e.data[0]).length;case"geojson-table":return Object.keys(e.features[0]).length;case"columnar-table":return Object.keys(e.data).length;case"arrow-table":return e.data.numCols;default:throw new Error("table")}}function I(e,t,r){switch(e.shape){case"array-row-table":let s=xt(e,r);return e.data[t][s];case"object-row-table":return e.data[t][r];case"geojson-table":return e.features[t][r];case"columnar-table":return e.data[r][t];case"arrow-table":let u=e.data,c=u.schema.fields.findIndex(l=>l.name===r);return u.getChildAt(c)?.get(t);default:throw new Error("todo")}}function kt(e){switch(e.shape){case"array-row-table":case"object-row-table":return e.shape;case"geojson-table":return"object-row-table";case"columnar-table":default:throw new Error("Not a row table")}}function xt(e,t){let r=e.schema?.fields.findIndex(s=>s.name===t);if(r===void 0)throw new Error(t);return r}function vt(e,t){let r=e.schema?.fields[t]?.name;if(!r)throw new Error(`${t}`);return r}function N(e,t,r,s){switch(e.shape){case"object-row-table":return s?Object.fromEntries(Object.entries(e.data[t])):e.data[t];case"array-row-table":if(e.schema){let n=r||{};for(let o=0;o<e.schema.fields.length;o++)n[e.schema.fields[o].name]=e.data[t][o];return n}throw new Error("no schema");case"geojson-table":if(e.schema){let n=r||{};for(let o=0;o<e.schema.fields.length;o++)n[e.schema.fields[o].name]=e.features[t][o];return n}throw new Error("no schema");case"columnar-table":if(e.schema){let n=r||{};for(let o=0;o<e.schema.fields.length;o++)n[e.schema.fields[o].name]=e.data[e.schema.fields[o].name][t];return n}else{let n=r||{};for(let[o,g]of Object.entries(e.data))n[o]=g[t];return n}case"arrow-table":let a=e.data,u=r||{},c=a.get(t),l=a.schema;for(let n=0;n<l.fields.length;n++)u[l.fields[n].name]=c?.[l.fields[n].name];return u;default:throw new Error("shape")}}function E(e,t,r,s){switch(e.shape){case"array-row-table":return s?Array.from(e.data[t]):e.data[t];case"object-row-table":if(e.schema){let n=r||[];for(let o=0;o<e.schema.fields.length;o++)n[o]=e.data[t][e.schema.fields[o].name];return n}return Object.values(e.data[t]);case"geojson-table":if(e.schema){let n=r||[];for(let o=0;o<e.schema.fields.length;o++)n[o]=e.features[t][e.schema.fields[o].name];return n}return Object.values(e.features[t]);case"columnar-table":if(e.schema){let n=r||[];for(let o=0;o<e.schema.fields.length;o++)n[o]=e.data[e.schema.fields[o].name][t];return n}else{let n=r||[],o=0;for(let g of Object.values(e.data))n[o]=g[t],o++;return n}case"arrow-table":let a=e.data,u=r||[],c=a.get(t),l=a.schema;for(let n=0;n<l.fields.length;n++)u[n]=c?.[l.fields[n].name];return u;default:throw new Error("shape")}}function*Lt(e,t){switch(t){case"array-row-table":yield*At(e);break;case"object-row-table":yield*St(e);break;default:throw new Error(`Unknown row type ${t}`)}}function*At(e,t=[]){let r=h(e);for(let s=0;s<r;s++)yield E(e,s,t)}function*St(e,t={}){let r=h(e);for(let s=0;s<r;s++)yield N(e,s,t)}var p=class{name;type;nullable;metadata;constructor(t,r,s=!1,a=new Map){this.name=t,this.type=r,this.nullable=s,this.metadata=a}get typeId(){return this.type&&this.type.typeId}clone(){return new p(this.name,this.type,this.nullable,this.metadata)}compareTo(t){return this.name===t.name&&this.type===t.type&&this.nullable===t.nullable&&this.metadata===t.metadata}toString(){return`${JSON.stringify(this.type)}${this.nullable?", nullable":""}${this.metadata?`, metadata: ${JSON.stringify(this.metadata)}`:""}`}};var d=class{fields;metadata;constructor(t,r=new Map){this.fields=t.map(s=>new p(s.name,s.type,s.nullable,s.metadata)),this.metadata=r instanceof Map?r:new Map(Object.entries(r))}compareTo(t){if(this.metadata!==t.metadata||this.fields.length!==t.fields.length)return!1;for(let r=0;r<this.fields.length;++r)if(!this.fields[r].compareTo(t.fields[r]))return!1;return!0}select(...t){let r=Object.create(null);for(let a of t)r[a]=!0;let s=this.fields.filter(a=>r[a.name]);return new d(s,this.metadata)}selectAt(...t){let r=t.map(s=>this.fields[s]).filter(Boolean);return new d(r,this.metadata)}assign(t){let r,s=this.metadata;if(t instanceof d){let c=t;r=c.fields,s=zt(zt(new Map,this.metadata),c.metadata)}else r=t;let a=Object.create(null);for(let c of this.fields)a[c.name]=c;for(let c of r)a[c.name]=c;let u=Object.values(a);return new d(u,s)}};function zt(e,t){return new Map([...e||new Map,...t||new Map])}function W(e,t="float32"){return e instanceof Date?"date-millisecond":e instanceof Number?t:typeof e=="string"?"utf8":(e===null||e==="undefined","null")}function Y(e){let t=It(e);return t!=="null"?{type:t,nullable:!1}:e.length>0?(t=W(e[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function It(e){switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function $t(e,t){if(!t)switch(e){case"int8":return Int8Array;case"uint8":return Uint8Array;case"int16":return Int16Array;case"uint16":return Uint16Array;case"int32":return Int32Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;default:break}return Array}function w(e){switch(e.shape){case"array-row-table":case"object-row-table":return ue(e.data);case"columnar-table":return le(e.data);case"arrow-table":default:throw new Error("Deduce schema")}}function le(e){let t=[];for(let[r,s]of Object.entries(e)){let a=he(s,r);t.push(a)}return{fields:t,metadata:{}}}function ue(e){if(!e.length)throw new Error("deduce from empty table");let t=[],r=e[0];for(let[s,a]of Object.entries(r))t.push(me(a,s));return{fields:t,metadata:{}}}function he(e,t){if(ArrayBuffer.isView(e)){let r=Y(e);return{name:t,type:r.type||"null",nullable:r.nullable}}if(Array.isArray(e)&&e.length>0){let r=e[0],s=W(r);return{name:t,type:s,nullable:!0}}throw new Error("empty table")}function me(e,t){let r=W(e);return{name:t,type:r,nullable:!0}}var jt=class{table;columnName;constructor(t,r){this.table=t,this.columnName=r}get(t){return I(this.table,t,this.columnName)}toArray(){switch(this.table.shape){case"arrow-table":return this.table.data.getChild(this.columnName)?.toArray();case"columnar-table":return this.table.data[this.columnName];default:throw new Error(this.table.shape)}}},P=class{schema;table;constructor(t){let r=t.schema||w(t);this.schema=new d(r.fields,r.metadata),this.table={...t,schema:r}}get data(){return this.table.shape==="geojson-table"?this.table.features:this.table.data}get numCols(){return $(this.table)}get length(){return h(this.table)}getChild(t){return new jt(this.table,t)}};function Wt(e){let t;switch(de(e)){case"array-row-table":t={shape:"array-row-table",data:e};break;case"object-row-table":t={shape:"object-row-table",data:e};break;case"columnar-table":t={shape:"columnar-table",data:e};break;default:throw new Error("table")}let r=w(t);return{...t,schema:r}}function de(e){if(Array.isArray(e)){if(e.length===0)throw new Error("cannot deduce type of empty table");let t=e[0];if(Array.isArray(t))return"array-row-table";if(t&&typeof t=="object")return"object-row-table"}if(e&&typeof e=="object")return"columnar-table";throw new Error("invalid table")}function Yt(e){return{...e,length:h(e),batchType:"data"}}async function Pt(e){let t,r,s,a=null,u;for await(let c of e)switch(a=a||c.shape,u=u||c.schema,c.shape){case"array-row-table":t=t||[];for(let l=0;l<h(c);l++){let n=c.data[l];t.push(n)}break;case"object-row-table":r=r||[];for(let l=0;l<h(c);l++){let n=c.data[l];r.push(n)}break;case"geojson-table":s=s||[];for(let l=0;l<h(c);l++){let n=c.features[l];s.push(n)}break;case"columnar-table":case"arrow-table":default:throw new Error("shape")}if(!a)return null;switch(a){case"array-row-table":return{shape:"array-row-table",data:t,schema:u};case"object-row-table":return{shape:"object-row-table",data:r,schema:u};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:s,schema:u};default:return null}}function qt(e,t){let r=$t(e.type,e.nullable);return new r(t)}function Ht(e,t){switch(t){case"object-row-table":return we(e);case"array-row-table":return ge(e);case"columnar-table":return pe(e);case"arrow-table":return fe(e);default:throw new Error(t)}}function fe(e){let t=globalThis.__loaders?._makeArrowTable;if(!t)throw new Error("");return t(e)}function pe(e){let t=e.schema||w(e),r=e.schema?.fields||[];if(e.shape==="columnar-table")return{...e,schema:t};let s=h(e),a={};for(let u of r){let c=qt(u,s);a[u.name]=c;for(let l=0;l<s;l++)c[l]=I(e,l,u.name)}return{shape:"columnar-table",schema:t,data:a}}function ge(e){if(e.shape==="array-row-table")return e;let t=h(e),r=new Array(t);for(let s=0;s<t;s++)r[s]=E(e,s);return{shape:"array-row-table",schema:e.schema,data:r}}function we(e){if(e.shape==="object-row-table")return e;let t=h(e),r=new Array(t);for(let s=0;s<t;s++)r[s]=N(e,s);return{shape:"object-row-table",schema:e.schema,data:r}}function Vt(e){let t=0;for(let r in e){let s=e[r];ArrayBuffer.isView(s)&&(t+=s.byteLength*s.BYTES_PER_ELEMENT)}return t}function Jt(e){let t=1/0,r=1/0,s=1/0,a=-1/0,u=-1/0,c=-1/0,l=e.POSITION?e.POSITION.value:[],n=l&&l.length;for(let o=0;o<n;o+=3){let g=l[o],D=l[o+1],_=l[o+2];t=g<t?g:t,r=D<r?D:r,s=_<s?_:s,a=g>a?g:a,u=D>u?D:u,c=_>c?_:c}return[[t,r,s],[a,u,c]]}function Gt(e,t={}){return{fields:be(e),metadata:t}}function Tt(e,t,r){let s=It(t.value),a=r||Ot(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:s}]},nullable:!1,metadata:a}}function be(e){let t=[];for(let r in e){let s=e[r];t.push(Tt(r,s))}return t}function Ot(e){let t={};return"byteOffset"in e&&(t.byteOffset=e.byteOffset.toString(10)),"byteStride"in e&&(t.byteStride=e.byteStride.toString(10)),"normalized"in e&&(t.normalized=e.normalized.toString()),t}var i;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth"})(i||(i={}));var m=class{static isNull(t){return t&&t.typeId===i.Null}static isInt(t){return t&&t.typeId===i.Int}static isFloat(t){return t&&t.typeId===i.Float}static isBinary(t){return t&&t.typeId===i.Binary}static isUtf8(t){return t&&t.typeId===i.Utf8}static isBool(t){return t&&t.typeId===i.Bool}static isDecimal(t){return t&&t.typeId===i.Decimal}static isDate(t){return t&&t.typeId===i.Date}static isTime(t){return t&&t.typeId===i.Time}static isTimestamp(t){return t&&t.typeId===i.Timestamp}static isInterval(t){return t&&t.typeId===i.Interval}static isList(t){return t&&t.typeId===i.List}static isStruct(t){return t&&t.typeId===i.Struct}static isUnion(t){return t&&t.typeId===i.Union}static isFixedSizeBinary(t){return t&&t.typeId===i.FixedSizeBinary}static isFixedSizeList(t){return t&&t.typeId===i.FixedSizeList}static isMap(t){return t&&t.typeId===i.Map}static isDictionary(t){return t&&t.typeId===i.Dictionary}get typeId(){return i.NONE}compareTo(t){return this===t}},q=class extends m{get typeId(){return i.Null}get[Symbol.toStringTag](){return"Null"}toString(){return"Null"}},H=class extends m{get typeId(){return i.Bool}get[Symbol.toStringTag](){return"Bool"}toString(){return"Bool"}},f=class extends m{isSigned;bitWidth;constructor(t,r){super(),this.isSigned=t,this.bitWidth=r}get typeId(){return i.Int}get[Symbol.toStringTag](){return"Int"}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}},V=class extends f{constructor(){super(!0,8)}},J=class extends f{constructor(){super(!0,16)}},G=class extends f{constructor(){super(!0,32)}},X=class extends f{constructor(){super(!0,64)}},Z=class extends f{constructor(){super(!1,8)}},K=class extends f{constructor(){super(!1,16)}},Q=class extends f{constructor(){super(!1,32)}},tt=class extends f{constructor(){super(!1,64)}},Rt={HALF:16,SINGLE:32,DOUBLE:64},x=class extends m{precision;constructor(t){super(),this.precision=t}get typeId(){return i.Float}get[Symbol.toStringTag](){return"Float"}toString(){return`Float${this.precision}`}},et=class extends x{constructor(){super(Rt.HALF)}},rt=class extends x{constructor(){super(Rt.SINGLE)}},st=class extends x{constructor(){super(Rt.DOUBLE)}},at=class extends m{constructor(){super()}get typeId(){return i.Binary}toString(){return"Binary"}get[Symbol.toStringTag](){return"Binary"}},nt=class extends m{get typeId(){return i.Utf8}get[Symbol.toStringTag](){return"Utf8"}toString(){return"Utf8"}},Ft={DAY:0,MILLISECOND:1},j=class extends m{unit;constructor(t){super(),this.unit=t}get typeId(){return i.Date}get[Symbol.toStringTag](){return"Date"}toString(){return`Date${(this.unit+1)*32}<${Ft[this.unit]}>`}},ot=class extends j{constructor(){super(Ft.DAY)}},it=class extends j{constructor(){super(Ft.MILLISECOND)}},y={SECOND:1,MILLISECOND:1e3,MICROSECOND:1e6,NANOSECOND:1e9},T=class extends m{unit;bitWidth;constructor(t,r){super(),this.unit=t,this.bitWidth=r}get typeId(){return i.Time}toString(){return`Time${this.bitWidth}<${y[this.unit]}>`}get[Symbol.toStringTag](){return"Time"}},ct=class extends T{constructor(){super(y.SECOND,32)}},lt=class extends T{constructor(){super(y.MILLISECOND,32)}},b=class extends m{unit;timezone;constructor(t,r=null){super(),this.unit=t,this.timezone=r}get typeId(){return i.Timestamp}get[Symbol.toStringTag](){return"Timestamp"}toString(){return`Timestamp<${y[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}},ut=class extends b{constructor(t=null){super(y.SECOND,t)}},ht=class extends b{constructor(t=null){super(y.MILLISECOND,t)}},mt=class extends b{constructor(t=null){super(y.MICROSECOND,t)}},dt=class extends b{constructor(t=null){super(y.NANOSECOND,t)}},Nt={DAY_TIME:0,YEAR_MONTH:1},O=class extends m{unit;constructor(t){super(),this.unit=t}get typeId(){return i.Interval}get[Symbol.toStringTag](){return"Interval"}toString(){return`Interval<${Nt[this.unit]}>`}},ft=class extends O{constructor(){super(Nt.DAY_TIME)}},pt=class extends O{constructor(){super(Nt.YEAR_MONTH)}},gt=class extends m{listSize;children;constructor(t,r){super(),this.listSize=t,this.children=[r]}get typeId(){return i.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[Symbol.toStringTag](){return"FixedSizeList"}toString(){return`FixedSizeList[${this.listSize}]<${JSON.stringify(this.valueType)}>`}},wt=class extends m{children;constructor(t){super(),this.children=t}get typeId(){return i.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${JSON.stringify(t.type)}`).join(", ")}}>`}get[Symbol.toStringTag](){return"Struct"}};function Xt(e){return{typeId:e.typeId,ArrayType:e.ArrayType,typeName:e.toString(),typeEnumName:ye(e.typeId),precision:e.precision}}var bt=null;function ye(e){if(!bt){bt={};for(let t in i)bt[i[t]]=t}return bt[e]}var yt=class extends Array{enqueue(t){return this.push(t)}dequeue(){return this.shift()}},B=class{_values;_settlers;_closed;constructor(){this._values=new yt,this._settlers=new yt,this._closed=!1}close(){for(;this._settlers.length>0;)this._settlers.dequeue().resolve({done:!0});this._closed=!0}[Symbol.asyncIterator](){return this}enqueue(t){if(this._closed)throw new Error("Closed");if(this._settlers.length>0){if(this._values.length>0)throw new Error("Illegal internal state");let r=this._settlers.dequeue();t instanceof Error?r.reject(t):r.resolve({value:t})}else this._values.enqueue(t)}next(){if(this._values.length>0){let t=this._values.dequeue();return t instanceof Error?Promise.reject(t):Promise.resolve({value:t})}if(this._closed){if(this._settlers.length>0)throw new Error("Illegal internal state");return Promise.resolve({done:!0})}return new Promise((t,r)=>{this._settlers.enqueue({resolve:t,reject:r})})}};return oe(C);})();
8
+ return __exports__;
9
+ });
package/dist/index.cjs CHANGED
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
7
  var __export = (target, all) => {
7
8
  for (var name in all)
8
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -16,10 +17,14 @@ var __copyProps = (to, from, except, desc) => {
16
17
  return to;
17
18
  };
18
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var __publicField = (obj, key, value) => {
21
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
22
+ return value;
23
+ };
19
24
 
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
25
+ // dist/index.js
26
+ var dist_exports = {};
27
+ __export(dist_exports, {
23
28
  ArrowLikeDataType: () => DataType,
24
29
  ArrowLikeField: () => ArrowLikeField,
25
30
  ArrowLikeSchema: () => ArrowLikeSchema,
@@ -88,16 +93,19 @@ __export(src_exports, {
88
93
  makeTableFromBatches: () => makeTableFromBatches,
89
94
  makeTableFromData: () => makeTableFromData
90
95
  });
91
- module.exports = __toCommonJS(src_exports);
96
+ module.exports = __toCommonJS(dist_exports);
92
97
 
93
- // src/lib/table/batches/base-table-batch-aggregator.ts
98
+ // dist/lib/table/batches/base-table-batch-aggregator.js
94
99
  var DEFAULT_ROW_COUNT = 100;
95
100
  var BaseTableBatchAggregator = class {
101
+ schema;
102
+ options;
103
+ shape;
104
+ length = 0;
105
+ rows = null;
106
+ cursor = 0;
107
+ _headers = [];
96
108
  constructor(schema, options) {
97
- this.length = 0;
98
- this.rows = null;
99
- this.cursor = 0;
100
- this._headers = [];
101
109
  this.options = options;
102
110
  this.schema = schema;
103
111
  if (!Array.isArray(schema)) {
@@ -147,7 +155,7 @@ var BaseTableBatchAggregator = class {
147
155
  }
148
156
  };
149
157
 
150
- // src/lib/table/simple-table/row-utils.ts
158
+ // dist/lib/table/simple-table/row-utils.js
151
159
  function convertToObjectRow(arrayRow, headers) {
152
160
  if (!arrayRow) {
153
161
  throw new Error("null row");
@@ -190,15 +198,17 @@ function inferHeadersFromObjectRow(row) {
190
198
  return Object.keys(row);
191
199
  }
192
200
 
193
- // src/lib/table/batches/row-table-batch-aggregator.ts
201
+ // dist/lib/table/batches/row-table-batch-aggregator.js
194
202
  var DEFAULT_ROW_COUNT2 = 100;
195
203
  var RowTableBatchAggregator = class {
204
+ schema;
205
+ options;
206
+ length = 0;
207
+ objectRows = null;
208
+ arrayRows = null;
209
+ cursor = 0;
210
+ _headers = null;
196
211
  constructor(schema, options) {
197
- this.length = 0;
198
- this.objectRows = null;
199
- this.arrayRows = null;
200
- this.cursor = 0;
201
- this._headers = null;
202
212
  this.options = options;
203
213
  this.schema = schema;
204
214
  if (schema) {
@@ -265,13 +275,14 @@ var RowTableBatchAggregator = class {
265
275
  }
266
276
  };
267
277
 
268
- // src/lib/table/batches/columnar-table-batch-aggregator.ts
278
+ // dist/lib/table/batches/columnar-table-batch-aggregator.js
269
279
  var DEFAULT_ROW_COUNT3 = 100;
270
280
  var ColumnarTableBatchAggregator = class {
281
+ schema;
282
+ length = 0;
283
+ allocated = 0;
284
+ columns = {};
271
285
  constructor(schema, options) {
272
- this.length = 0;
273
- this.allocated = 0;
274
- this.columns = {};
275
286
  this.schema = schema;
276
287
  this._reallocateColumns();
277
288
  }
@@ -342,7 +353,7 @@ var ColumnarTableBatchAggregator = class {
342
353
  }
343
354
  };
344
355
 
345
- // src/lib/table/batches/table-batch-builder.ts
356
+ // dist/lib/table/batches/table-batch-builder.js
346
357
  var DEFAULT_OPTIONS = {
347
358
  shape: void 0,
348
359
  batchSize: "auto",
@@ -351,16 +362,18 @@ var DEFAULT_OPTIONS = {
351
362
  _limitMB: 0
352
363
  };
353
364
  var ERR_MESSAGE = "TableBatchBuilder";
354
- var TableBatchBuilder = class {
365
+ var _TableBatchBuilder = class {
366
+ schema;
367
+ options;
368
+ aggregator = null;
369
+ batchCount = 0;
370
+ bytesUsed = 0;
371
+ isChunkComplete = false;
372
+ lastBatchEmittedMs = Date.now();
373
+ totalLength = 0;
374
+ totalBytes = 0;
375
+ rowBytes = 0;
355
376
  constructor(schema, options) {
356
- this.aggregator = null;
357
- this.batchCount = 0;
358
- this.bytesUsed = 0;
359
- this.isChunkComplete = false;
360
- this.lastBatchEmittedMs = Date.now();
361
- this.totalLength = 0;
362
- this.totalBytes = 0;
363
- this.rowBytes = 0;
364
377
  this.schema = schema;
365
378
  this.options = { ...DEFAULT_OPTIONS, ...options };
366
379
  }
@@ -468,17 +481,19 @@ var TableBatchBuilder = class {
468
481
  case "columnar-table":
469
482
  return ColumnarTableBatchAggregator;
470
483
  case "arrow-table":
471
- if (!TableBatchBuilder.ArrowBatch) {
484
+ if (!_TableBatchBuilder.ArrowBatch) {
472
485
  throw new Error(ERR_MESSAGE);
473
486
  }
474
- return TableBatchBuilder.ArrowBatch;
487
+ return _TableBatchBuilder.ArrowBatch;
475
488
  default:
476
489
  return BaseTableBatchAggregator;
477
490
  }
478
491
  }
479
492
  };
493
+ var TableBatchBuilder = _TableBatchBuilder;
494
+ __publicField(TableBatchBuilder, "ArrowBatch");
480
495
 
481
- // src/lib/table/simple-table/table-accessors.ts
496
+ // dist/lib/table/simple-table/table-accessors.js
482
497
  function isTable(table) {
483
498
  var _a;
484
499
  const shape = typeof table === "object" && (table == null ? void 0 : table.shape);
@@ -553,9 +568,7 @@ function getTableCell(table, rowIndex, columnName) {
553
568
  return column[rowIndex];
554
569
  case "arrow-table":
555
570
  const arrowTable = table.data;
556
- const arrowColumnIndex = arrowTable.schema.fields.findIndex(
557
- (field) => field.name === columnName
558
- );
571
+ const arrowColumnIndex = arrowTable.schema.fields.findIndex((field) => field.name === columnName);
559
572
  return (_a = arrowTable.getChildAt(arrowColumnIndex)) == null ? void 0 : _a.get(rowIndex);
560
573
  default:
561
574
  throw new Error("todo");
@@ -714,8 +727,12 @@ function* makeObjectRowIterator(table, target = {}) {
714
727
  }
715
728
  }
716
729
 
717
- // src/lib/table/arrow-api/arrow-like-field.ts
730
+ // dist/lib/table/arrow-api/arrow-like-field.js
718
731
  var ArrowLikeField = class {
732
+ name;
733
+ type;
734
+ nullable;
735
+ metadata;
719
736
  constructor(name, type, nullable = false, metadata = /* @__PURE__ */ new Map()) {
720
737
  this.name = name;
721
738
  this.type = type;
@@ -732,16 +749,16 @@ var ArrowLikeField = class {
732
749
  return this.name === other.name && this.type === other.type && this.nullable === other.nullable && this.metadata === other.metadata;
733
750
  }
734
751
  toString() {
735
- return `${this.type}${this.nullable ? ", nullable" : ""}${this.metadata ? `, metadata: ${this.metadata}` : ""}`;
752
+ return `${JSON.stringify(this.type)}${this.nullable ? ", nullable" : ""}${this.metadata ? `, metadata: ${JSON.stringify(this.metadata)}` : ""}`;
736
753
  }
737
754
  };
738
755
 
739
- // src/lib/table/arrow-api/arrow-like-schema.ts
756
+ // dist/lib/table/arrow-api/arrow-like-schema.js
740
757
  var ArrowLikeSchema = class {
758
+ fields;
759
+ metadata;
741
760
  constructor(fields, metadata = /* @__PURE__ */ new Map()) {
742
- this.fields = fields.map(
743
- (field) => new ArrowLikeField(field.name, field.type, field.nullable, field.metadata)
744
- );
761
+ this.fields = fields.map((field) => new ArrowLikeField(field.name, field.type, field.nullable, field.metadata));
745
762
  this.metadata = metadata instanceof Map ? metadata : new Map(Object.entries(metadata));
746
763
  }
747
764
  // TODO - arrow only seems to compare fields, not metadata
@@ -796,7 +813,7 @@ function mergeMaps(m1, m2) {
796
813
  return new Map([...m1 || /* @__PURE__ */ new Map(), ...m2 || /* @__PURE__ */ new Map()]);
797
814
  }
798
815
 
799
- // src/lib/table/simple-table/data-type.ts
816
+ // dist/lib/table/simple-table/data-type.js
800
817
  function getDataTypeFromValue(value, defaultNumberType = "float32") {
801
818
  if (value instanceof Date) {
802
819
  return "date-millisecond";
@@ -872,7 +889,7 @@ function getArrayTypeFromDataType(type, nullable) {
872
889
  return Array;
873
890
  }
874
891
 
875
- // src/lib/table/simple-table/table-schema.ts
892
+ // dist/lib/table/simple-table/table-schema.js
876
893
  function deduceTableSchema(table) {
877
894
  switch (table.shape) {
878
895
  case "array-row-table":
@@ -936,8 +953,10 @@ function deduceFieldFromValue(value, name) {
936
953
  };
937
954
  }
938
955
 
939
- // src/lib/table/arrow-api/arrow-like-table.ts
956
+ // dist/lib/table/arrow-api/arrow-like-table.js
940
957
  var ArrowLikeVector = class {
958
+ table;
959
+ columnName;
941
960
  constructor(table, columnName) {
942
961
  this.table = table;
943
962
  this.columnName = columnName;
@@ -959,6 +978,8 @@ var ArrowLikeVector = class {
959
978
  }
960
979
  };
961
980
  var ArrowLikeTable = class {
981
+ schema;
982
+ table;
962
983
  constructor(table) {
963
984
  const schema = table.schema || deduceTableSchema(table);
964
985
  this.schema = new ArrowLikeSchema(schema.fields, schema.metadata);
@@ -979,12 +1000,9 @@ var ArrowLikeTable = class {
979
1000
  getChild(columnName) {
980
1001
  return new ArrowLikeVector(this.table, columnName);
981
1002
  }
982
- // getChildAt(columnIndex: number): ArrowLikeVector {
983
- // return
984
- // }
985
1003
  };
986
1004
 
987
- // src/lib/table/simple-table/make-table.ts
1005
+ // dist/lib/table/simple-table/make-table.js
988
1006
  function makeTableFromData(data) {
989
1007
  let table;
990
1008
  switch (getTableShapeFromData(data)) {
@@ -1022,7 +1040,7 @@ function getTableShapeFromData(data) {
1022
1040
  throw new Error("invalid table");
1023
1041
  }
1024
1042
 
1025
- // src/lib/table/simple-table/make-table-from-batches.ts
1043
+ // dist/lib/table/simple-table/make-table-from-batches.js
1026
1044
  var import_schema = require("@loaders.gl/schema");
1027
1045
  function makeBatchFromTable(table) {
1028
1046
  return { ...table, length: (0, import_schema.getTableLength)(table), batchType: "data" };
@@ -1079,13 +1097,13 @@ async function makeTableFromBatches(batchIterator) {
1079
1097
  }
1080
1098
  }
1081
1099
 
1082
- // src/lib/table/simple-table/table-column.ts
1100
+ // dist/lib/table/simple-table/table-column.js
1083
1101
  function makeColumnFromField(field, length) {
1084
1102
  const ArrayType = getArrayTypeFromDataType(field.type, field.nullable);
1085
1103
  return new ArrayType(length);
1086
1104
  }
1087
1105
 
1088
- // src/lib/table/simple-table/convert-table.ts
1106
+ // dist/lib/table/simple-table/convert-table.js
1089
1107
  function convertTable(table, shape) {
1090
1108
  switch (shape) {
1091
1109
  case "object-row-table":
@@ -1161,7 +1179,7 @@ function makeObjectRowTable(table) {
1161
1179
  };
1162
1180
  }
1163
1181
 
1164
- // src/lib/mesh/mesh-utils.ts
1182
+ // dist/lib/mesh/mesh-utils.js
1165
1183
  function getMeshSize(attributes) {
1166
1184
  let size = 0;
1167
1185
  for (const attributeName in attributes) {
@@ -1198,7 +1216,7 @@ function getMeshBoundingBox(attributes) {
1198
1216
  ];
1199
1217
  }
1200
1218
 
1201
- // src/lib/mesh/deduce-mesh-schema.ts
1219
+ // dist/lib/mesh/deduce-mesh-schema.js
1202
1220
  function deduceMeshSchema(attributes, metadata = {}) {
1203
1221
  const fields = deduceMeshFields(attributes);
1204
1222
  return { fields, metadata };
@@ -1235,8 +1253,9 @@ function makeMeshAttributeMetadata(attribute) {
1235
1253
  return result;
1236
1254
  }
1237
1255
 
1238
- // src/lib/table/arrow-api/enum.ts
1239
- var Type = /* @__PURE__ */ ((Type2) => {
1256
+ // dist/lib/table/arrow-api/enum.js
1257
+ var Type;
1258
+ (function(Type2) {
1240
1259
  Type2[Type2["NONE"] = 0] = "NONE";
1241
1260
  Type2[Type2["Null"] = 1] = "Null";
1242
1261
  Type2[Type2["Int"] = 2] = "Int";
@@ -1281,67 +1300,66 @@ var Type = /* @__PURE__ */ ((Type2) => {
1281
1300
  Type2[Type2["SparseUnion"] = -24] = "SparseUnion";
1282
1301
  Type2[Type2["IntervalDayTime"] = -25] = "IntervalDayTime";
1283
1302
  Type2[Type2["IntervalYearMonth"] = -26] = "IntervalYearMonth";
1284
- return Type2;
1285
- })(Type || {});
1303
+ })(Type || (Type = {}));
1286
1304
 
1287
- // src/lib/table/arrow-api/arrow-like-type.ts
1305
+ // dist/lib/table/arrow-api/arrow-like-type.js
1288
1306
  var DataType = class {
1289
1307
  static isNull(x) {
1290
- return x && x.typeId === 1 /* Null */;
1308
+ return x && x.typeId === Type.Null;
1291
1309
  }
1292
1310
  static isInt(x) {
1293
- return x && x.typeId === 2 /* Int */;
1311
+ return x && x.typeId === Type.Int;
1294
1312
  }
1295
1313
  static isFloat(x) {
1296
- return x && x.typeId === 3 /* Float */;
1314
+ return x && x.typeId === Type.Float;
1297
1315
  }
1298
1316
  static isBinary(x) {
1299
- return x && x.typeId === 4 /* Binary */;
1317
+ return x && x.typeId === Type.Binary;
1300
1318
  }
1301
1319
  static isUtf8(x) {
1302
- return x && x.typeId === 5 /* Utf8 */;
1320
+ return x && x.typeId === Type.Utf8;
1303
1321
  }
1304
1322
  static isBool(x) {
1305
- return x && x.typeId === 6 /* Bool */;
1323
+ return x && x.typeId === Type.Bool;
1306
1324
  }
1307
1325
  static isDecimal(x) {
1308
- return x && x.typeId === 7 /* Decimal */;
1326
+ return x && x.typeId === Type.Decimal;
1309
1327
  }
1310
1328
  static isDate(x) {
1311
- return x && x.typeId === 8 /* Date */;
1329
+ return x && x.typeId === Type.Date;
1312
1330
  }
1313
1331
  static isTime(x) {
1314
- return x && x.typeId === 9 /* Time */;
1332
+ return x && x.typeId === Type.Time;
1315
1333
  }
1316
1334
  static isTimestamp(x) {
1317
- return x && x.typeId === 10 /* Timestamp */;
1335
+ return x && x.typeId === Type.Timestamp;
1318
1336
  }
1319
1337
  static isInterval(x) {
1320
- return x && x.typeId === 11 /* Interval */;
1338
+ return x && x.typeId === Type.Interval;
1321
1339
  }
1322
1340
  static isList(x) {
1323
- return x && x.typeId === 12 /* List */;
1341
+ return x && x.typeId === Type.List;
1324
1342
  }
1325
1343
  static isStruct(x) {
1326
- return x && x.typeId === 13 /* Struct */;
1344
+ return x && x.typeId === Type.Struct;
1327
1345
  }
1328
1346
  static isUnion(x) {
1329
- return x && x.typeId === 14 /* Union */;
1347
+ return x && x.typeId === Type.Union;
1330
1348
  }
1331
1349
  static isFixedSizeBinary(x) {
1332
- return x && x.typeId === 15 /* FixedSizeBinary */;
1350
+ return x && x.typeId === Type.FixedSizeBinary;
1333
1351
  }
1334
1352
  static isFixedSizeList(x) {
1335
- return x && x.typeId === 16 /* FixedSizeList */;
1353
+ return x && x.typeId === Type.FixedSizeList;
1336
1354
  }
1337
1355
  static isMap(x) {
1338
- return x && x.typeId === 17 /* Map */;
1356
+ return x && x.typeId === Type.Map;
1339
1357
  }
1340
1358
  static isDictionary(x) {
1341
- return x && x.typeId === -1 /* Dictionary */;
1359
+ return x && x.typeId === Type.Dictionary;
1342
1360
  }
1343
1361
  get typeId() {
1344
- return 0 /* NONE */;
1362
+ return Type.NONE;
1345
1363
  }
1346
1364
  // get ArrayType(): AnyArrayType {
1347
1365
  // return Int8Array;
@@ -1353,7 +1371,7 @@ var DataType = class {
1353
1371
  };
1354
1372
  var Null = class extends DataType {
1355
1373
  get typeId() {
1356
- return 1 /* Null */;
1374
+ return Type.Null;
1357
1375
  }
1358
1376
  get [Symbol.toStringTag]() {
1359
1377
  return "Null";
@@ -1364,7 +1382,7 @@ var Null = class extends DataType {
1364
1382
  };
1365
1383
  var Bool = class extends DataType {
1366
1384
  get typeId() {
1367
- return 6 /* Bool */;
1385
+ return Type.Bool;
1368
1386
  }
1369
1387
  // get ArrayType() {
1370
1388
  // return Uint8Array;
@@ -1377,13 +1395,15 @@ var Bool = class extends DataType {
1377
1395
  }
1378
1396
  };
1379
1397
  var Int = class extends DataType {
1398
+ isSigned;
1399
+ bitWidth;
1380
1400
  constructor(isSigned, bitWidth) {
1381
1401
  super();
1382
1402
  this.isSigned = isSigned;
1383
1403
  this.bitWidth = bitWidth;
1384
1404
  }
1385
1405
  get typeId() {
1386
- return 2 /* Int */;
1406
+ return Type.Int;
1387
1407
  }
1388
1408
  // get ArrayType() {
1389
1409
  // switch (this.bitWidth) {
@@ -1452,12 +1472,13 @@ var Precision = {
1452
1472
  DOUBLE: 64
1453
1473
  };
1454
1474
  var Float = class extends DataType {
1475
+ precision;
1455
1476
  constructor(precision) {
1456
1477
  super();
1457
1478
  this.precision = precision;
1458
1479
  }
1459
1480
  get typeId() {
1460
- return 3 /* Float */;
1481
+ return Type.Float;
1461
1482
  }
1462
1483
  // get ArrayType() {
1463
1484
  // switch (this.precision) {
@@ -1498,7 +1519,7 @@ var Binary = class extends DataType {
1498
1519
  super();
1499
1520
  }
1500
1521
  get typeId() {
1501
- return 4 /* Binary */;
1522
+ return Type.Binary;
1502
1523
  }
1503
1524
  toString() {
1504
1525
  return "Binary";
@@ -1509,7 +1530,7 @@ var Binary = class extends DataType {
1509
1530
  };
1510
1531
  var Utf8 = class extends DataType {
1511
1532
  get typeId() {
1512
- return 5 /* Utf8 */;
1533
+ return Type.Utf8;
1513
1534
  }
1514
1535
  // get ArrayType() {
1515
1536
  // return Uint8Array;
@@ -1526,12 +1547,13 @@ var DateUnit = {
1526
1547
  MILLISECOND: 1
1527
1548
  };
1528
1549
  var Date2 = class extends DataType {
1550
+ unit;
1529
1551
  constructor(unit) {
1530
1552
  super();
1531
1553
  this.unit = unit;
1532
1554
  }
1533
1555
  get typeId() {
1534
- return 8 /* Date */;
1556
+ return Type.Date;
1535
1557
  }
1536
1558
  // get ArrayType() {
1537
1559
  // return Int32Array;
@@ -1560,13 +1582,15 @@ var TimeUnit = {
1560
1582
  NANOSECOND: 1e9
1561
1583
  };
1562
1584
  var Time = class extends DataType {
1585
+ unit;
1586
+ bitWidth;
1563
1587
  constructor(unit, bitWidth) {
1564
1588
  super();
1565
1589
  this.unit = unit;
1566
1590
  this.bitWidth = bitWidth;
1567
1591
  }
1568
1592
  get typeId() {
1569
- return 9 /* Time */;
1593
+ return Type.Time;
1570
1594
  }
1571
1595
  toString() {
1572
1596
  return `Time${this.bitWidth}<${TimeUnit[this.unit]}>`;
@@ -1574,9 +1598,6 @@ var Time = class extends DataType {
1574
1598
  get [Symbol.toStringTag]() {
1575
1599
  return "Time";
1576
1600
  }
1577
- // get ArrayType() {
1578
- // return Int32Array;
1579
- // }
1580
1601
  };
1581
1602
  var TimeSecond = class extends Time {
1582
1603
  constructor() {
@@ -1589,13 +1610,15 @@ var TimeMillisecond = class extends Time {
1589
1610
  }
1590
1611
  };
1591
1612
  var Timestamp = class extends DataType {
1613
+ unit;
1614
+ timezone;
1592
1615
  constructor(unit, timezone = null) {
1593
1616
  super();
1594
1617
  this.unit = unit;
1595
1618
  this.timezone = timezone;
1596
1619
  }
1597
1620
  get typeId() {
1598
- return 10 /* Timestamp */;
1621
+ return Type.Timestamp;
1599
1622
  }
1600
1623
  // get ArrayType() {
1601
1624
  // return Int32Array;
@@ -1632,12 +1655,13 @@ var IntervalUnit = {
1632
1655
  YEAR_MONTH: 1
1633
1656
  };
1634
1657
  var Interval = class extends DataType {
1658
+ unit;
1635
1659
  constructor(unit) {
1636
1660
  super();
1637
1661
  this.unit = unit;
1638
1662
  }
1639
1663
  get typeId() {
1640
- return 11 /* Interval */;
1664
+ return Type.Interval;
1641
1665
  }
1642
1666
  // get ArrayType() {
1643
1667
  // return Int32Array;
@@ -1660,13 +1684,15 @@ var IntervalYearMonth = class extends Interval {
1660
1684
  }
1661
1685
  };
1662
1686
  var FixedSizeList = class extends DataType {
1687
+ listSize;
1688
+ children;
1663
1689
  constructor(listSize, child) {
1664
1690
  super();
1665
1691
  this.listSize = listSize;
1666
1692
  this.children = [child];
1667
1693
  }
1668
1694
  get typeId() {
1669
- return 16 /* FixedSizeList */;
1695
+ return Type.FixedSizeList;
1670
1696
  }
1671
1697
  get valueType() {
1672
1698
  return this.children[0].type;
@@ -1681,26 +1707,27 @@ var FixedSizeList = class extends DataType {
1681
1707
  return "FixedSizeList";
1682
1708
  }
1683
1709
  toString() {
1684
- return `FixedSizeList[${this.listSize}]<${this.valueType}>`;
1710
+ return `FixedSizeList[${this.listSize}]<${JSON.stringify(this.valueType)}>`;
1685
1711
  }
1686
1712
  };
1687
1713
  var Struct = class extends DataType {
1714
+ children;
1688
1715
  constructor(children) {
1689
1716
  super();
1690
1717
  this.children = children;
1691
1718
  }
1692
1719
  get typeId() {
1693
- return 13 /* Struct */;
1720
+ return Type.Struct;
1694
1721
  }
1695
1722
  toString() {
1696
- return `Struct<{${this.children.map((f) => `${f.name}:${f.type}`).join(", ")}}>`;
1723
+ return `Struct<{${this.children.map((f) => `${f.name}:${JSON.stringify(f.type)}`).join(", ")}}>`;
1697
1724
  }
1698
1725
  get [Symbol.toStringTag]() {
1699
1726
  return "Struct";
1700
1727
  }
1701
1728
  };
1702
1729
 
1703
- // src/lib/table/arrow-api/get-type-info.ts
1730
+ // dist/lib/table/arrow-api/get-type-info.js
1704
1731
  function getTypeInfo(arrowTypeLike) {
1705
1732
  return {
1706
1733
  typeId: arrowTypeLike.typeId,
@@ -1721,7 +1748,7 @@ function getTypeKey(typeKey) {
1721
1748
  return ReverseType[typeKey];
1722
1749
  }
1723
1750
 
1724
- // src/lib/utils/async-queue.ts
1751
+ // dist/lib/utils/async-queue.js
1725
1752
  var ArrayQueue = class extends Array {
1726
1753
  enqueue(value) {
1727
1754
  return this.push(value);
@@ -1731,6 +1758,9 @@ var ArrayQueue = class extends Array {
1731
1758
  }
1732
1759
  };
1733
1760
  var AsyncQueue = class {
1761
+ _values;
1762
+ _settlers;
1763
+ _closed;
1734
1764
  constructor() {
1735
1765
  this._values = new ArrayQueue();
1736
1766
  this._settlers = new ArrayQueue();
@@ -1785,3 +1815,4 @@ var AsyncQueue = class {
1785
1815
  });
1786
1816
  }
1787
1817
  };
1818
+ //# sourceMappingURL=index.cjs.map