@loaders.gl/schema 4.2.0-alpha.3 → 4.2.0-alpha.5

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 (134) hide show
  1. package/dist/dist.dev.js +190 -161
  2. package/dist/dist.min.js +9 -0
  3. package/dist/index.cjs +64 -73
  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 +30 -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 +69 -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 +53 -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 +357 -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 +53 -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 +81 -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 +74 -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 +128 -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 +76 -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/dist/index.js.map +0 -1
  99. package/dist/lib/mesh/convert-mesh.js.map +0 -1
  100. package/dist/lib/mesh/deduce-mesh-schema.js.map +0 -1
  101. package/dist/lib/mesh/mesh-to-arrow-table.js.map +0 -1
  102. package/dist/lib/mesh/mesh-utils.js.map +0 -1
  103. package/dist/lib/table/arrow-api/arrow-like-field.js.map +0 -1
  104. package/dist/lib/table/arrow-api/arrow-like-schema.js.map +0 -1
  105. package/dist/lib/table/arrow-api/arrow-like-table.js.map +0 -1
  106. package/dist/lib/table/arrow-api/arrow-like-type.js.map +0 -1
  107. package/dist/lib/table/arrow-api/enum.js.map +0 -1
  108. package/dist/lib/table/arrow-api/get-type-info.js.map +0 -1
  109. package/dist/lib/table/arrow-api/index.js.map +0 -1
  110. package/dist/lib/table/batches/base-table-batch-aggregator.js.map +0 -1
  111. package/dist/lib/table/batches/columnar-table-batch-aggregator.js.map +0 -1
  112. package/dist/lib/table/batches/row-table-batch-aggregator.js.map +0 -1
  113. package/dist/lib/table/batches/table-batch-aggregator.js.map +0 -1
  114. package/dist/lib/table/batches/table-batch-builder.js.map +0 -1
  115. package/dist/lib/table/simple-table/convert-table.js.map +0 -1
  116. package/dist/lib/table/simple-table/data-type.js.map +0 -1
  117. package/dist/lib/table/simple-table/make-table-from-batches.js.map +0 -1
  118. package/dist/lib/table/simple-table/make-table.js.map +0 -1
  119. package/dist/lib/table/simple-table/row-utils.js.map +0 -1
  120. package/dist/lib/table/simple-table/table-accessors.js.map +0 -1
  121. package/dist/lib/table/simple-table/table-column.js.map +0 -1
  122. package/dist/lib/table/simple-table/table-schema.js.map +0 -1
  123. package/dist/lib/utils/assert.js.map +0 -1
  124. package/dist/lib/utils/async-queue.js.map +0 -1
  125. package/dist/types/batch.js.map +0 -1
  126. package/dist/types/binary-geometries.js.map +0 -1
  127. package/dist/types/category-gis.js.map +0 -1
  128. package/dist/types/category-image.js.map +0 -1
  129. package/dist/types/category-mesh.js.map +0 -1
  130. package/dist/types/category-table.js.map +0 -1
  131. package/dist/types/category-texture.js.map +0 -1
  132. package/dist/types/flat-geometries.js.map +0 -1
  133. package/dist/types/schema.js.map +0 -1
  134. 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 Xt=Object.create;var M=Object.defineProperty;var Zt=Object.getOwnPropertyDescriptor;var Kt=Object.getOwnPropertyNames;var Jt=Object.getPrototypeOf,Qt=Object.prototype.hasOwnProperty;var te=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ee=(t,e)=>{for(var r in e)M(t,r,{get:e[r],enumerable:!0})},_=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Kt(e))!Qt.call(t,a)&&a!==r&&M(t,a,{get:()=>e[a],enumerable:!(s=Zt(e,a))||s.enumerable});return t},U=(t,e,r)=>(_(t,e,"default"),r&&_(r,e,"default")),re=(t,e,r)=>(r=t!=null?Xt(Jt(t)):{},_(e||!t||!t.__esModule?M(r,"default",{value:t,enumerable:!0}):r,t)),se=t=>_(M({},"__esModule",{value:!0}),t);var Nt=te((be,Et)=>{Et.exports=globalThis.loaders});var C={};ee(C,{ArrowLikeDataType:()=>m,ArrowLikeField:()=>p,ArrowLikeSchema:()=>d,ArrowLikeTable:()=>W,AsyncQueue:()=>N,Binary:()=>st,Bool:()=>q,ColumnarTableBatchAggregator:()=>I,Date:()=>T,DateDay:()=>ot,DateMillisecond:()=>nt,FixedSizeList:()=>pt,Float:()=>A,Float16:()=>tt,Float32:()=>et,Float64:()=>rt,Int:()=>f,Int16:()=>V,Int32:()=>G,Int64:()=>X,Int8:()=>H,Interval:()=>F,IntervalDayTime:()=>dt,IntervalYearMonth:()=>ft,Null:()=>P,RowTableBatchAggregator:()=>S,Struct:()=>gt,TableBatchBuilder:()=>x,Time:()=>R,TimeMillisecond:()=>ct,TimeSecond:()=>it,Timestamp:()=>b,TimestampMicrosecond:()=>ht,TimestampMillisecond:()=>ut,TimestampNanosecond:()=>mt,TimestampSecond:()=>lt,Uint16:()=>K,Uint32:()=>J,Uint64:()=>Q,Uint8:()=>Z,Utf8:()=>at,convertTable:()=>Pt,convertToArrayRow:()=>v,convertToObjectRow:()=>L,deduceMeshField:()=>jt,deduceMeshSchema:()=>Vt,deduceTableSchema:()=>w,getDataTypeFromArray:()=>Y,getMeshBoundingBox:()=>Ht,getMeshSize:()=>qt,getTableCell:()=>j,getTableColumnIndex:()=>yt,getTableColumnName:()=>Ut,getTableLength:()=>h,getTableNumCols:()=>z,getTableRowAsArray:()=>E,getTableRowAsObject:()=>O,getTableRowShape:()=>Mt,getTypeInfo:()=>Gt,isTable:()=>_t,makeArrayRowIterator:()=>xt,makeBatchFromTable:()=>$t,makeMeshAttributeMetadata:()=>Tt,makeObjectRowIterator:()=>At,makeRowIterator:()=>kt,makeTableFromBatches:()=>Yt,makeTableFromData:()=>zt});U(C,re(Nt(),1));var k=class{constructor(e,r){if(this.length=0,this.rows=null,this.cursor=0,this._headers=[],this.options=r,this.schema=e,!Array.isArray(e)){this._headers=[];for(let s in e)this._headers[e[s].index]=e[s].name}}rowCount(){return this.length}addArrayRow(e,r){Number.isFinite(r)&&(this.cursor=r),this.shape="array-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=e,this.length++}addObjectRow(e,r){Number.isFinite(r)&&(this.cursor=r),this.shape="object-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=e,this.length++}getBatch(){let e=this.rows;return e?(e=e.slice(0,this.length),this.rows=null,{shape:this.shape||"array-row-table",batchType:"data",data:e,length:this.length,schema:this.schema,cursor:this.cursor}):null}};function L(t,e){if(!t)throw new Error("null row");let r={};if(e)for(let s=0;s<e.length;s++)r[e[s]]=t[s];else for(let s=0;s<t.length;s++){let a=`column-${s}`;r[a]=t[s]}return r}function v(t,e){if(!t)throw new Error("null row");if(e){let r=new Array(e.length);for(let s=0;s<e.length;s++)r[s]=t[e[s]];return r}return Object.values(t)}function Ct(t){let e=[];for(let r=0;r<t.length;r++){let s=`column-${r}`;e.push(s)}return e}function Dt(t){return Object.keys(t)}var Bt=100,S=class{constructor(e,r){if(this.length=0,this.objectRows=null,this.arrayRows=null,this.cursor=0,this._headers=null,this.options=r,this.schema=e,e){this._headers=[];for(let s in e)this._headers[e[s].index]=e[s].name}}rowCount(){return this.length}addArrayRow(e,r){switch(Number.isFinite(r)&&(this.cursor=r),this._headers||(this._headers=Ct(e)),this.options.shape){case"object-row-table":let s=L(e,this._headers);this.addObjectRow(s,r);break;case"array-row-table":this.arrayRows=this.arrayRows||new Array(Bt),this.arrayRows[this.length]=e,this.length++;break}}addObjectRow(e,r){switch(Number.isFinite(r)&&(this.cursor=r),this._headers||(this._headers=Dt(e)),this.options.shape){case"array-row-table":let s=v(e,this._headers);this.addArrayRow(s,r);break;case"object-row-table":this.objectRows=this.objectRows||new Array(Bt),this.objectRows[this.length]=e,this.length++;break}}getBatch(){let e=this.arrayRows||this.objectRows;return e?(e=e.slice(0,this.length),this.arrayRows=null,this.objectRows=null,{shape:this.options.shape,batchType:"data",data:e,length:this.length,schema:this.schema,cursor:this.cursor}):null}};var I=class{constructor(e,r){this.length=0,this.allocated=0,this.columns={},this.schema=e,this._reallocateColumns()}rowCount(){return this.length}addArrayRow(e){this._reallocateColumns();let r=0;for(let s in this.columns)this.columns[s][this.length]=e[r++];this.length++}addObjectRow(e){this._reallocateColumns();for(let r in e)this.columns[r][this.length]=e[r];this.length++}getBatch(){this._pruneColumns();let e=Array.isArray(this.schema)?this.columns:{};if(!Array.isArray(this.schema))for(let s in this.schema){let a=this.schema[s];e[a.name]=this.columns[a.index]}return this.columns={},{shape:"columnar-table",batchType:"data",data:e,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 e in this.schema){let r=this.schema[e],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[e,r]of Object.entries(this.columns))this.columns[e]=r.slice(0,this.length)}};var ae={shape:void 0,batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0},oe="TableBatchBuilder",x=class{constructor(e,r){this.aggregator=null,this.batchCount=0,this.bytesUsed=0,this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),this.totalLength=0,this.totalBytes=0,this.rowBytes=0,this.schema=e,this.options={...ae,...r}}limitReached(){return!!(Boolean(this.options?.limit)&&this.totalLength>=this.options.limit||Boolean(this.options?._limitMB)&&this.totalBytes/1e6>=this.options._limitMB)}addRow(e){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(e),this.totalBytes+=this.rowBytes,Array.isArray(e)?this.addArrayRow(e):this.addObjectRow(e))}addArrayRow(e){if(!this.aggregator){let r=this._getTableBatchType();this.aggregator=new r(this.schema,this.options)}this.aggregator.addArrayRow(e)}addObjectRow(e){if(!this.aggregator){let r=this._getTableBatchType();this.aggregator=new r(this.schema,this.options)}this.aggregator.addObjectRow(e)}chunkComplete(e){e instanceof ArrayBuffer&&(this.bytesUsed+=e.byteLength),typeof e=="string"&&(this.bytesUsed+=e.length),this.isChunkComplete=!0}getFullBatch(e){return this._isFull()?this._getBatch(e):null}getFinalBatch(e){return this._getBatch(e)}_estimateRowMB(e){return Array.isArray(e)?e.length*8:Object.keys(e).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(e){if(!this.aggregator)return null;e?.bytesUsed&&(this.bytesUsed=e.bytesUsed);let r=this.aggregator.getBatch();return r.count=this.batchCount,r.bytesUsed=this.bytesUsed,Object.assign(r,e),this.batchCount++,this.aggregator=null,r}_getTableBatchType(){switch(this.options.shape){case"array-row-table":case"object-row-table":return S;case"columnar-table":return I;case"arrow-table":if(!x.ArrowBatch)throw new Error(oe);return x.ArrowBatch;default:return k}}};function _t(t){switch(typeof t=="object"&&t?.shape){case"array-row-table":case"object-row-table":return Array.isArray(t.data);case"geojson-table":return Array.isArray(t.features);case"columnar-table":return t.data&&typeof t.data=="object";case"arrow-table":return Boolean(t?.data?.numRows!==void 0);default:return!1}}function h(t){switch(t.shape){case"array-row-table":case"object-row-table":return t.data.length;case"geojson-table":return t.features.length;case"arrow-table":return t.data.numRows;case"columnar-table":for(let r of Object.values(t.data))return r.length||0;return 0;default:throw new Error("table")}}function z(t){if(t.schema)return t.schema.fields.length;if(h(t)===0)throw new Error("empty table");switch(t.shape){case"array-row-table":return t.data[0].length;case"object-row-table":return Object.keys(t.data[0]).length;case"geojson-table":return Object.keys(t.features[0]).length;case"columnar-table":return Object.keys(t.data).length;case"arrow-table":return t.data.numCols;default:throw new Error("table")}}function j(t,e,r){switch(t.shape){case"array-row-table":let s=yt(t,r);return t.data[e][s];case"object-row-table":return t.data[e][r];case"geojson-table":return t.features[e][r];case"columnar-table":return t.data[r][e];case"arrow-table":let u=t.data,c=u.schema.fields.findIndex(l=>l.name===r);return u.getChildAt(c)?.get(e);default:throw new Error("todo")}}function Mt(t){switch(t.shape){case"array-row-table":case"object-row-table":return t.shape;case"geojson-table":return"object-row-table";case"columnar-table":default:throw new Error("Not a row table")}}function yt(t,e){let r=t.schema?.fields.findIndex(s=>s.name===e);if(r===void 0)throw new Error(e);return r}function Ut(t,e){let r=t.schema?.fields[e]?.name;if(!r)throw new Error(`${e}`);return r}function O(t,e,r,s){switch(t.shape){case"object-row-table":return s?Object.fromEntries(Object.entries(t.data[e])):t.data[e];case"array-row-table":if(t.schema){let o=r||{};for(let n=0;n<t.schema.fields.length;n++)o[t.schema.fields[n].name]=t.data[e][n];return o}throw new Error("no schema");case"geojson-table":if(t.schema){let o=r||{};for(let n=0;n<t.schema.fields.length;n++)o[t.schema.fields[n].name]=t.features[e][n];return o}throw new Error("no schema");case"columnar-table":if(t.schema){let o=r||{};for(let n=0;n<t.schema.fields.length;n++)o[t.schema.fields[n].name]=t.data[t.schema.fields[n].name][e];return o}else{let o=r||{};for(let[n,g]of Object.entries(t.data))o[n]=g[e];return o}case"arrow-table":let a=t.data,u=r||{},c=a.get(e),l=a.schema;for(let o=0;o<l.fields.length;o++)u[l.fields[o].name]=c?.[l.fields[o].name];return u;default:throw new Error("shape")}}function E(t,e,r,s){switch(t.shape){case"array-row-table":return s?Array.from(t.data[e]):t.data[e];case"object-row-table":if(t.schema){let o=r||[];for(let n=0;n<t.schema.fields.length;n++)o[n]=t.data[e][t.schema.fields[n].name];return o}return Object.values(t.data[e]);case"geojson-table":if(t.schema){let o=r||[];for(let n=0;n<t.schema.fields.length;n++)o[n]=t.features[e][t.schema.fields[n].name];return o}return Object.values(t.features[e]);case"columnar-table":if(t.schema){let o=r||[];for(let n=0;n<t.schema.fields.length;n++)o[n]=t.data[t.schema.fields[n].name][e];return o}else{let o=r||[],n=0;for(let g of Object.values(t.data))o[n]=g[e],n++;return o}case"arrow-table":let a=t.data,u=r||[],c=a.get(e),l=a.schema;for(let o=0;o<l.fields.length;o++)u[o]=c?.[l.fields[o].name];return u;default:throw new Error("shape")}}function*kt(t,e){switch(e){case"array-row-table":yield*xt(t);break;case"object-row-table":yield*At(t);break;default:throw new Error(`Unknown row type ${e}`)}}function*xt(t,e=[]){let r=h(t);for(let s=0;s<r;s++)yield E(t,s,e)}function*At(t,e={}){let r=h(t);for(let s=0;s<r;s++)yield O(t,s,e)}var p=class{constructor(e,r,s=!1,a=new Map){this.name=e,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(e){return this.name===e.name&&this.type===e.type&&this.nullable===e.nullable&&this.metadata===e.metadata}toString(){return`${this.type}${this.nullable?", nullable":""}${this.metadata?`, metadata: ${this.metadata}`:""}`}};var d=class{constructor(e,r=new Map){this.fields=e.map(s=>new p(s.name,s.type,s.nullable,s.metadata)),this.metadata=r instanceof Map?r:new Map(Object.entries(r))}compareTo(e){if(this.metadata!==e.metadata||this.fields.length!==e.fields.length)return!1;for(let r=0;r<this.fields.length;++r)if(!this.fields[r].compareTo(e.fields[r]))return!1;return!0}select(...e){let r=Object.create(null);for(let a of e)r[a]=!0;let s=this.fields.filter(a=>r[a.name]);return new d(s,this.metadata)}selectAt(...e){let r=e.map(s=>this.fields[s]).filter(Boolean);return new d(r,this.metadata)}assign(e){let r,s=this.metadata;if(e instanceof d){let c=e;r=c.fields,s=Lt(Lt(new Map,this.metadata),c.metadata)}else r=e;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 Lt(t,e){return new Map([...t||new Map,...e||new Map])}function $(t,e="float32"){return t instanceof Date?"date-millisecond":t instanceof Number?e:typeof t=="string"?"utf8":(t===null||t==="undefined","null")}function Y(t){let e=St(t);return e!=="null"?{type:e,nullable:!1}:t.length>0?(e=$(t[0]),{type:e,nullable:!0}):{type:"null",nullable:!0}}function St(t){switch(t.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 vt(t,e){if(!e)switch(t){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(t){switch(t.shape){case"array-row-table":case"object-row-table":return ie(t.data);case"columnar-table":return ne(t.data);case"arrow-table":default:throw new Error("Deduce schema")}}function ne(t){let e=[];for(let[r,s]of Object.entries(t)){let a=ce(s,r);e.push(a)}return{fields:e,metadata:{}}}function ie(t){if(!t.length)throw new Error("deduce from empty table");let e=[],r=t[0];for(let[s,a]of Object.entries(r))e.push(le(a,s));return{fields:e,metadata:{}}}function ce(t,e){if(ArrayBuffer.isView(t)){let r=Y(t);return{name:e,type:r.type||"null",nullable:r.nullable}}if(Array.isArray(t)&&t.length>0){let r=t[0],s=$(r);return{name:e,type:s,nullable:!0}}throw new Error("empty table")}function le(t,e){let r=$(t);return{name:e,type:r,nullable:!0}}var It=class{constructor(e,r){this.table=e,this.columnName=r}get(e){return j(this.table,e,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)}}},W=class{constructor(e){let r=e.schema||w(e);this.schema=new d(r.fields,r.metadata),this.table={...e,schema:r}}get data(){return this.table.shape==="geojson-table"?this.table.features:this.table.data}get numCols(){return z(this.table)}get length(){return h(this.table)}getChild(e){return new It(this.table,e)}};function zt(t){let e;switch(ue(t)){case"array-row-table":e={shape:"array-row-table",data:t};break;case"object-row-table":e={shape:"object-row-table",data:t};break;case"columnar-table":e={shape:"columnar-table",data:t};break;default:throw new Error("table")}let r=w(e);return{...e,schema:r}}function ue(t){if(Array.isArray(t)){if(t.length===0)throw new Error("cannot deduce type of empty table");let e=t[0];if(Array.isArray(e))return"array-row-table";if(e&&typeof e=="object")return"object-row-table"}if(t&&typeof t=="object")return"columnar-table";throw new Error("invalid table")}function $t(t){return{...t,length:h(t),batchType:"data"}}async function Yt(t){let e,r,s,a=null,u;for await(let c of t)switch(a=a||c.shape,u=u||c.schema,c.shape){case"array-row-table":e=e||[];for(let l=0;l<h(c);l++){let o=c.data[l];e.push(o)}break;case"object-row-table":r=r||[];for(let l=0;l<h(c);l++){let o=c.data[l];r.push(o)}break;case"geojson-table":s=s||[];for(let l=0;l<h(c);l++){let o=c.features[l];s.push(o)}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:e,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 Wt(t,e){let r=vt(t.type,t.nullable);return new r(e)}function Pt(t,e){switch(e){case"object-row-table":return fe(t);case"array-row-table":return de(t);case"columnar-table":return me(t);case"arrow-table":return he(t);default:throw new Error(e)}}function he(t){let e=globalThis.__loaders?._makeArrowTable;if(!e)throw new Error("");return e(t)}function me(t){let e=t.schema||w(t),r=t.schema?.fields||[];if(t.shape==="columnar-table")return{...t,schema:e};let s=h(t),a={};for(let u of r){let c=Wt(u,s);a[u.name]=c;for(let l=0;l<s;l++)c[l]=j(t,l,u.name)}return{shape:"columnar-table",schema:e,data:a}}function de(t){if(t.shape==="array-row-table")return t;let e=h(t),r=new Array(e);for(let s=0;s<e;s++)r[s]=E(t,s);return{shape:"array-row-table",schema:t.schema,data:r}}function fe(t){if(t.shape==="object-row-table")return t;let e=h(t),r=new Array(e);for(let s=0;s<e;s++)r[s]=O(t,s);return{shape:"object-row-table",schema:t.schema,data:r}}function qt(t){let e=0;for(let r in t){let s=t[r];ArrayBuffer.isView(s)&&(e+=s.byteLength*s.BYTES_PER_ELEMENT)}return e}function Ht(t){let e=1/0,r=1/0,s=1/0,a=-1/0,u=-1/0,c=-1/0,l=t.POSITION?t.POSITION.value:[],o=l&&l.length;for(let n=0;n<o;n+=3){let g=l[n],D=l[n+1],B=l[n+2];e=g<e?g:e,r=D<r?D:r,s=B<s?B:s,a=g>a?g:a,u=D>u?D:u,c=B>c?B:c}return[[e,r,s],[a,u,c]]}function Vt(t,e={}){return{fields:pe(t),metadata:e}}function jt(t,e,r){let s=St(e.value),a=r||Tt(e);return{name:t,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:s}]},nullable:!1,metadata:a}}function pe(t){let e=[];for(let r in t){let s=t[r];e.push(jt(r,s))}return e}function Tt(t){let e={};return"byteOffset"in t&&(e.byteOffset=t.byteOffset.toString(10)),"byteStride"in t&&(e.byteStride=t.byteStride.toString(10)),"normalized"in t&&(e.normalized=t.normalized.toString()),e}var i;(function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth"})(i||(i={}));var m=class{static isNull(e){return e&&e.typeId===i.Null}static isInt(e){return e&&e.typeId===i.Int}static isFloat(e){return e&&e.typeId===i.Float}static isBinary(e){return e&&e.typeId===i.Binary}static isUtf8(e){return e&&e.typeId===i.Utf8}static isBool(e){return e&&e.typeId===i.Bool}static isDecimal(e){return e&&e.typeId===i.Decimal}static isDate(e){return e&&e.typeId===i.Date}static isTime(e){return e&&e.typeId===i.Time}static isTimestamp(e){return e&&e.typeId===i.Timestamp}static isInterval(e){return e&&e.typeId===i.Interval}static isList(e){return e&&e.typeId===i.List}static isStruct(e){return e&&e.typeId===i.Struct}static isUnion(e){return e&&e.typeId===i.Union}static isFixedSizeBinary(e){return e&&e.typeId===i.FixedSizeBinary}static isFixedSizeList(e){return e&&e.typeId===i.FixedSizeList}static isMap(e){return e&&e.typeId===i.Map}static isDictionary(e){return e&&e.typeId===i.Dictionary}get typeId(){return i.NONE}compareTo(e){return this===e}},P=class extends m{get typeId(){return i.Null}get[Symbol.toStringTag](){return"Null"}toString(){return"Null"}},q=class extends m{get typeId(){return i.Bool}get[Symbol.toStringTag](){return"Bool"}toString(){return"Bool"}},f=class extends m{constructor(e,r){super(),this.isSigned=e,this.bitWidth=r}get typeId(){return i.Int}get[Symbol.toStringTag](){return"Int"}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}},H=class extends f{constructor(){super(!0,8)}},V=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)}},J=class extends f{constructor(){super(!1,32)}},Q=class extends f{constructor(){super(!1,64)}},Rt={HALF:16,SINGLE:32,DOUBLE:64},A=class extends m{constructor(e){super(),this.precision=e}get typeId(){return i.Float}get[Symbol.toStringTag](){return"Float"}toString(){return`Float${this.precision}`}},tt=class extends A{constructor(){super(Rt.HALF)}},et=class extends A{constructor(){super(Rt.SINGLE)}},rt=class extends A{constructor(){super(Rt.DOUBLE)}},st=class extends m{constructor(){super()}get typeId(){return i.Binary}toString(){return"Binary"}get[Symbol.toStringTag](){return"Binary"}},at=class extends m{get typeId(){return i.Utf8}get[Symbol.toStringTag](){return"Utf8"}toString(){return"Utf8"}},Ft={DAY:0,MILLISECOND:1},T=class extends m{constructor(e){super(),this.unit=e}get typeId(){return i.Date}get[Symbol.toStringTag](){return"Date"}toString(){return`Date${(this.unit+1)*32}<${Ft[this.unit]}>`}},ot=class extends T{constructor(){super(Ft.DAY)}},nt=class extends T{constructor(){super(Ft.MILLISECOND)}},y={SECOND:1,MILLISECOND:1e3,MICROSECOND:1e6,NANOSECOND:1e9},R=class extends m{constructor(e,r){super(),this.unit=e,this.bitWidth=r}get typeId(){return i.Time}toString(){return`Time${this.bitWidth}<${y[this.unit]}>`}get[Symbol.toStringTag](){return"Time"}},it=class extends R{constructor(){super(y.SECOND,32)}},ct=class extends R{constructor(){super(y.MILLISECOND,32)}},b=class extends m{constructor(e,r=null){super(),this.unit=e,this.timezone=r}get typeId(){return i.Timestamp}get[Symbol.toStringTag](){return"Timestamp"}toString(){return`Timestamp<${y[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}},lt=class extends b{constructor(e=null){super(y.SECOND,e)}},ut=class extends b{constructor(e=null){super(y.MILLISECOND,e)}},ht=class extends b{constructor(e=null){super(y.MICROSECOND,e)}},mt=class extends b{constructor(e=null){super(y.NANOSECOND,e)}},Ot={DAY_TIME:0,YEAR_MONTH:1},F=class extends m{constructor(e){super(),this.unit=e}get typeId(){return i.Interval}get[Symbol.toStringTag](){return"Interval"}toString(){return`Interval<${Ot[this.unit]}>`}},dt=class extends F{constructor(){super(Ot.DAY_TIME)}},ft=class extends F{constructor(){super(Ot.YEAR_MONTH)}},pt=class extends m{constructor(e,r){super(),this.listSize=e,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}]<${this.valueType}>`}},gt=class extends m{constructor(e){super(),this.children=e}get typeId(){return i.Struct}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}get[Symbol.toStringTag](){return"Struct"}};function Gt(t){return{typeId:t.typeId,ArrayType:t.ArrayType,typeName:t.toString(),typeEnumName:ge(t.typeId),precision:t.precision}}var wt=null;function ge(t){if(!wt){wt={};for(let e in i)wt[i[e]]=e}return wt[t]}var bt=class extends Array{enqueue(e){return this.push(e)}dequeue(){return this.shift()}},N=class{constructor(){this._values=new bt,this._settlers=new bt,this._closed=!1}close(){for(;this._settlers.length>0;)this._settlers.dequeue().resolve({done:!0});this._closed=!0}[Symbol.asyncIterator](){return this}enqueue(e){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();e instanceof Error?r.reject(e):r.resolve({value:e})}else this._values.enqueue(e)}next(){if(this._values.length>0){let e=this._values.dequeue();return e instanceof Error?Promise.reject(e):Promise.resolve({value:e})}if(this._closed){if(this._settlers.length>0)throw new Error("Illegal internal state");return Promise.resolve({done:!0})}return new Promise((e,r)=>{this._settlers.enqueue({resolve:e,reject:r})})}};return se(C);})();
8
+ return __exports__;
9
+ });
package/dist/index.cjs CHANGED
@@ -17,9 +17,9 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
20
+ // dist/index.js
21
+ var dist_exports = {};
22
+ __export(dist_exports, {
23
23
  ArrowLikeDataType: () => DataType,
24
24
  ArrowLikeField: () => ArrowLikeField,
25
25
  ArrowLikeSchema: () => ArrowLikeSchema,
@@ -88,9 +88,9 @@ __export(src_exports, {
88
88
  makeTableFromBatches: () => makeTableFromBatches,
89
89
  makeTableFromData: () => makeTableFromData
90
90
  });
91
- module.exports = __toCommonJS(src_exports);
91
+ module.exports = __toCommonJS(dist_exports);
92
92
 
93
- // src/lib/table/batches/base-table-batch-aggregator.ts
93
+ // dist/lib/table/batches/base-table-batch-aggregator.js
94
94
  var DEFAULT_ROW_COUNT = 100;
95
95
  var BaseTableBatchAggregator = class {
96
96
  constructor(schema, options) {
@@ -147,7 +147,7 @@ var BaseTableBatchAggregator = class {
147
147
  }
148
148
  };
149
149
 
150
- // src/lib/table/simple-table/row-utils.ts
150
+ // dist/lib/table/simple-table/row-utils.js
151
151
  function convertToObjectRow(arrayRow, headers) {
152
152
  if (!arrayRow) {
153
153
  throw new Error("null row");
@@ -190,7 +190,7 @@ function inferHeadersFromObjectRow(row) {
190
190
  return Object.keys(row);
191
191
  }
192
192
 
193
- // src/lib/table/batches/row-table-batch-aggregator.ts
193
+ // dist/lib/table/batches/row-table-batch-aggregator.js
194
194
  var DEFAULT_ROW_COUNT2 = 100;
195
195
  var RowTableBatchAggregator = class {
196
196
  constructor(schema, options) {
@@ -215,7 +215,7 @@ var RowTableBatchAggregator = class {
215
215
  if (Number.isFinite(cursor)) {
216
216
  this.cursor = cursor;
217
217
  }
218
- this._headers ||= inferHeadersFromArrayRow(row);
218
+ this._headers || (this._headers = inferHeadersFromArrayRow(row));
219
219
  switch (this.options.shape) {
220
220
  case "object-row-table":
221
221
  const rowObject = convertToObjectRow(row, this._headers);
@@ -232,7 +232,7 @@ var RowTableBatchAggregator = class {
232
232
  if (Number.isFinite(cursor)) {
233
233
  this.cursor = cursor;
234
234
  }
235
- this._headers ||= inferHeadersFromObjectRow(row);
235
+ this._headers || (this._headers = inferHeadersFromObjectRow(row));
236
236
  switch (this.options.shape) {
237
237
  case "array-row-table":
238
238
  const rowArray = convertToArrayRow(row, this._headers);
@@ -265,7 +265,7 @@ var RowTableBatchAggregator = class {
265
265
  }
266
266
  };
267
267
 
268
- // src/lib/table/batches/columnar-table-batch-aggregator.ts
268
+ // dist/lib/table/batches/columnar-table-batch-aggregator.js
269
269
  var DEFAULT_ROW_COUNT3 = 100;
270
270
  var ColumnarTableBatchAggregator = class {
271
271
  constructor(schema, options) {
@@ -342,7 +342,7 @@ var ColumnarTableBatchAggregator = class {
342
342
  }
343
343
  };
344
344
 
345
- // src/lib/table/batches/table-batch-builder.ts
345
+ // dist/lib/table/batches/table-batch-builder.js
346
346
  var DEFAULT_OPTIONS = {
347
347
  shape: void 0,
348
348
  batchSize: "auto",
@@ -478,7 +478,7 @@ var TableBatchBuilder = class {
478
478
  }
479
479
  };
480
480
 
481
- // src/lib/table/simple-table/table-accessors.ts
481
+ // dist/lib/table/simple-table/table-accessors.js
482
482
  function isTable(table) {
483
483
  var _a;
484
484
  const shape = typeof table === "object" && (table == null ? void 0 : table.shape);
@@ -553,9 +553,7 @@ function getTableCell(table, rowIndex, columnName) {
553
553
  return column[rowIndex];
554
554
  case "arrow-table":
555
555
  const arrowTable = table.data;
556
- const arrowColumnIndex = arrowTable.schema.fields.findIndex(
557
- (field) => field.name === columnName
558
- );
556
+ const arrowColumnIndex = arrowTable.schema.fields.findIndex((field) => field.name === columnName);
559
557
  return (_a = arrowTable.getChildAt(arrowColumnIndex)) == null ? void 0 : _a.get(rowIndex);
560
558
  default:
561
559
  throw new Error("todo");
@@ -714,7 +712,7 @@ function* makeObjectRowIterator(table, target = {}) {
714
712
  }
715
713
  }
716
714
 
717
- // src/lib/table/arrow-api/arrow-like-field.ts
715
+ // dist/lib/table/arrow-api/arrow-like-field.js
718
716
  var ArrowLikeField = class {
719
717
  constructor(name, type, nullable = false, metadata = /* @__PURE__ */ new Map()) {
720
718
  this.name = name;
@@ -736,12 +734,10 @@ var ArrowLikeField = class {
736
734
  }
737
735
  };
738
736
 
739
- // src/lib/table/arrow-api/arrow-like-schema.ts
737
+ // dist/lib/table/arrow-api/arrow-like-schema.js
740
738
  var ArrowLikeSchema = class {
741
739
  constructor(fields, metadata = /* @__PURE__ */ new Map()) {
742
- this.fields = fields.map(
743
- (field) => new ArrowLikeField(field.name, field.type, field.nullable, field.metadata)
744
- );
740
+ this.fields = fields.map((field) => new ArrowLikeField(field.name, field.type, field.nullable, field.metadata));
745
741
  this.metadata = metadata instanceof Map ? metadata : new Map(Object.entries(metadata));
746
742
  }
747
743
  // TODO - arrow only seems to compare fields, not metadata
@@ -796,7 +792,7 @@ function mergeMaps(m1, m2) {
796
792
  return new Map([...m1 || /* @__PURE__ */ new Map(), ...m2 || /* @__PURE__ */ new Map()]);
797
793
  }
798
794
 
799
- // src/lib/table/simple-table/data-type.ts
795
+ // dist/lib/table/simple-table/data-type.js
800
796
  function getDataTypeFromValue(value, defaultNumberType = "float32") {
801
797
  if (value instanceof Date) {
802
798
  return "date-millisecond";
@@ -872,7 +868,7 @@ function getArrayTypeFromDataType(type, nullable) {
872
868
  return Array;
873
869
  }
874
870
 
875
- // src/lib/table/simple-table/table-schema.ts
871
+ // dist/lib/table/simple-table/table-schema.js
876
872
  function deduceTableSchema(table) {
877
873
  switch (table.shape) {
878
874
  case "array-row-table":
@@ -936,7 +932,7 @@ function deduceFieldFromValue(value, name) {
936
932
  };
937
933
  }
938
934
 
939
- // src/lib/table/arrow-api/arrow-like-table.ts
935
+ // dist/lib/table/arrow-api/arrow-like-table.js
940
936
  var ArrowLikeVector = class {
941
937
  constructor(table, columnName) {
942
938
  this.table = table;
@@ -979,12 +975,9 @@ var ArrowLikeTable = class {
979
975
  getChild(columnName) {
980
976
  return new ArrowLikeVector(this.table, columnName);
981
977
  }
982
- // getChildAt(columnIndex: number): ArrowLikeVector {
983
- // return
984
- // }
985
978
  };
986
979
 
987
- // src/lib/table/simple-table/make-table.ts
980
+ // dist/lib/table/simple-table/make-table.js
988
981
  function makeTableFromData(data) {
989
982
  let table;
990
983
  switch (getTableShapeFromData(data)) {
@@ -1022,7 +1015,7 @@ function getTableShapeFromData(data) {
1022
1015
  throw new Error("invalid table");
1023
1016
  }
1024
1017
 
1025
- // src/lib/table/simple-table/make-table-from-batches.ts
1018
+ // dist/lib/table/simple-table/make-table-from-batches.js
1026
1019
  var import_schema = require("@loaders.gl/schema");
1027
1020
  function makeBatchFromTable(table) {
1028
1021
  return { ...table, length: (0, import_schema.getTableLength)(table), batchType: "data" };
@@ -1079,13 +1072,13 @@ async function makeTableFromBatches(batchIterator) {
1079
1072
  }
1080
1073
  }
1081
1074
 
1082
- // src/lib/table/simple-table/table-column.ts
1075
+ // dist/lib/table/simple-table/table-column.js
1083
1076
  function makeColumnFromField(field, length) {
1084
1077
  const ArrayType = getArrayTypeFromDataType(field.type, field.nullable);
1085
1078
  return new ArrayType(length);
1086
1079
  }
1087
1080
 
1088
- // src/lib/table/simple-table/convert-table.ts
1081
+ // dist/lib/table/simple-table/convert-table.js
1089
1082
  function convertTable(table, shape) {
1090
1083
  switch (shape) {
1091
1084
  case "object-row-table":
@@ -1161,7 +1154,7 @@ function makeObjectRowTable(table) {
1161
1154
  };
1162
1155
  }
1163
1156
 
1164
- // src/lib/mesh/mesh-utils.ts
1157
+ // dist/lib/mesh/mesh-utils.js
1165
1158
  function getMeshSize(attributes) {
1166
1159
  let size = 0;
1167
1160
  for (const attributeName in attributes) {
@@ -1198,7 +1191,7 @@ function getMeshBoundingBox(attributes) {
1198
1191
  ];
1199
1192
  }
1200
1193
 
1201
- // src/lib/mesh/deduce-mesh-schema.ts
1194
+ // dist/lib/mesh/deduce-mesh-schema.js
1202
1195
  function deduceMeshSchema(attributes, metadata = {}) {
1203
1196
  const fields = deduceMeshFields(attributes);
1204
1197
  return { fields, metadata };
@@ -1235,8 +1228,9 @@ function makeMeshAttributeMetadata(attribute) {
1235
1228
  return result;
1236
1229
  }
1237
1230
 
1238
- // src/lib/table/arrow-api/enum.ts
1239
- var Type = /* @__PURE__ */ ((Type2) => {
1231
+ // dist/lib/table/arrow-api/enum.js
1232
+ var Type;
1233
+ (function(Type2) {
1240
1234
  Type2[Type2["NONE"] = 0] = "NONE";
1241
1235
  Type2[Type2["Null"] = 1] = "Null";
1242
1236
  Type2[Type2["Int"] = 2] = "Int";
@@ -1281,67 +1275,66 @@ var Type = /* @__PURE__ */ ((Type2) => {
1281
1275
  Type2[Type2["SparseUnion"] = -24] = "SparseUnion";
1282
1276
  Type2[Type2["IntervalDayTime"] = -25] = "IntervalDayTime";
1283
1277
  Type2[Type2["IntervalYearMonth"] = -26] = "IntervalYearMonth";
1284
- return Type2;
1285
- })(Type || {});
1278
+ })(Type || (Type = {}));
1286
1279
 
1287
- // src/lib/table/arrow-api/arrow-like-type.ts
1280
+ // dist/lib/table/arrow-api/arrow-like-type.js
1288
1281
  var DataType = class {
1289
1282
  static isNull(x) {
1290
- return x && x.typeId === 1 /* Null */;
1283
+ return x && x.typeId === Type.Null;
1291
1284
  }
1292
1285
  static isInt(x) {
1293
- return x && x.typeId === 2 /* Int */;
1286
+ return x && x.typeId === Type.Int;
1294
1287
  }
1295
1288
  static isFloat(x) {
1296
- return x && x.typeId === 3 /* Float */;
1289
+ return x && x.typeId === Type.Float;
1297
1290
  }
1298
1291
  static isBinary(x) {
1299
- return x && x.typeId === 4 /* Binary */;
1292
+ return x && x.typeId === Type.Binary;
1300
1293
  }
1301
1294
  static isUtf8(x) {
1302
- return x && x.typeId === 5 /* Utf8 */;
1295
+ return x && x.typeId === Type.Utf8;
1303
1296
  }
1304
1297
  static isBool(x) {
1305
- return x && x.typeId === 6 /* Bool */;
1298
+ return x && x.typeId === Type.Bool;
1306
1299
  }
1307
1300
  static isDecimal(x) {
1308
- return x && x.typeId === 7 /* Decimal */;
1301
+ return x && x.typeId === Type.Decimal;
1309
1302
  }
1310
1303
  static isDate(x) {
1311
- return x && x.typeId === 8 /* Date */;
1304
+ return x && x.typeId === Type.Date;
1312
1305
  }
1313
1306
  static isTime(x) {
1314
- return x && x.typeId === 9 /* Time */;
1307
+ return x && x.typeId === Type.Time;
1315
1308
  }
1316
1309
  static isTimestamp(x) {
1317
- return x && x.typeId === 10 /* Timestamp */;
1310
+ return x && x.typeId === Type.Timestamp;
1318
1311
  }
1319
1312
  static isInterval(x) {
1320
- return x && x.typeId === 11 /* Interval */;
1313
+ return x && x.typeId === Type.Interval;
1321
1314
  }
1322
1315
  static isList(x) {
1323
- return x && x.typeId === 12 /* List */;
1316
+ return x && x.typeId === Type.List;
1324
1317
  }
1325
1318
  static isStruct(x) {
1326
- return x && x.typeId === 13 /* Struct */;
1319
+ return x && x.typeId === Type.Struct;
1327
1320
  }
1328
1321
  static isUnion(x) {
1329
- return x && x.typeId === 14 /* Union */;
1322
+ return x && x.typeId === Type.Union;
1330
1323
  }
1331
1324
  static isFixedSizeBinary(x) {
1332
- return x && x.typeId === 15 /* FixedSizeBinary */;
1325
+ return x && x.typeId === Type.FixedSizeBinary;
1333
1326
  }
1334
1327
  static isFixedSizeList(x) {
1335
- return x && x.typeId === 16 /* FixedSizeList */;
1328
+ return x && x.typeId === Type.FixedSizeList;
1336
1329
  }
1337
1330
  static isMap(x) {
1338
- return x && x.typeId === 17 /* Map */;
1331
+ return x && x.typeId === Type.Map;
1339
1332
  }
1340
1333
  static isDictionary(x) {
1341
- return x && x.typeId === -1 /* Dictionary */;
1334
+ return x && x.typeId === Type.Dictionary;
1342
1335
  }
1343
1336
  get typeId() {
1344
- return 0 /* NONE */;
1337
+ return Type.NONE;
1345
1338
  }
1346
1339
  // get ArrayType(): AnyArrayType {
1347
1340
  // return Int8Array;
@@ -1353,7 +1346,7 @@ var DataType = class {
1353
1346
  };
1354
1347
  var Null = class extends DataType {
1355
1348
  get typeId() {
1356
- return 1 /* Null */;
1349
+ return Type.Null;
1357
1350
  }
1358
1351
  get [Symbol.toStringTag]() {
1359
1352
  return "Null";
@@ -1364,7 +1357,7 @@ var Null = class extends DataType {
1364
1357
  };
1365
1358
  var Bool = class extends DataType {
1366
1359
  get typeId() {
1367
- return 6 /* Bool */;
1360
+ return Type.Bool;
1368
1361
  }
1369
1362
  // get ArrayType() {
1370
1363
  // return Uint8Array;
@@ -1383,7 +1376,7 @@ var Int = class extends DataType {
1383
1376
  this.bitWidth = bitWidth;
1384
1377
  }
1385
1378
  get typeId() {
1386
- return 2 /* Int */;
1379
+ return Type.Int;
1387
1380
  }
1388
1381
  // get ArrayType() {
1389
1382
  // switch (this.bitWidth) {
@@ -1457,7 +1450,7 @@ var Float = class extends DataType {
1457
1450
  this.precision = precision;
1458
1451
  }
1459
1452
  get typeId() {
1460
- return 3 /* Float */;
1453
+ return Type.Float;
1461
1454
  }
1462
1455
  // get ArrayType() {
1463
1456
  // switch (this.precision) {
@@ -1498,7 +1491,7 @@ var Binary = class extends DataType {
1498
1491
  super();
1499
1492
  }
1500
1493
  get typeId() {
1501
- return 4 /* Binary */;
1494
+ return Type.Binary;
1502
1495
  }
1503
1496
  toString() {
1504
1497
  return "Binary";
@@ -1509,7 +1502,7 @@ var Binary = class extends DataType {
1509
1502
  };
1510
1503
  var Utf8 = class extends DataType {
1511
1504
  get typeId() {
1512
- return 5 /* Utf8 */;
1505
+ return Type.Utf8;
1513
1506
  }
1514
1507
  // get ArrayType() {
1515
1508
  // return Uint8Array;
@@ -1531,7 +1524,7 @@ var Date2 = class extends DataType {
1531
1524
  this.unit = unit;
1532
1525
  }
1533
1526
  get typeId() {
1534
- return 8 /* Date */;
1527
+ return Type.Date;
1535
1528
  }
1536
1529
  // get ArrayType() {
1537
1530
  // return Int32Array;
@@ -1566,7 +1559,7 @@ var Time = class extends DataType {
1566
1559
  this.bitWidth = bitWidth;
1567
1560
  }
1568
1561
  get typeId() {
1569
- return 9 /* Time */;
1562
+ return Type.Time;
1570
1563
  }
1571
1564
  toString() {
1572
1565
  return `Time${this.bitWidth}<${TimeUnit[this.unit]}>`;
@@ -1574,9 +1567,6 @@ var Time = class extends DataType {
1574
1567
  get [Symbol.toStringTag]() {
1575
1568
  return "Time";
1576
1569
  }
1577
- // get ArrayType() {
1578
- // return Int32Array;
1579
- // }
1580
1570
  };
1581
1571
  var TimeSecond = class extends Time {
1582
1572
  constructor() {
@@ -1595,7 +1585,7 @@ var Timestamp = class extends DataType {
1595
1585
  this.timezone = timezone;
1596
1586
  }
1597
1587
  get typeId() {
1598
- return 10 /* Timestamp */;
1588
+ return Type.Timestamp;
1599
1589
  }
1600
1590
  // get ArrayType() {
1601
1591
  // return Int32Array;
@@ -1637,7 +1627,7 @@ var Interval = class extends DataType {
1637
1627
  this.unit = unit;
1638
1628
  }
1639
1629
  get typeId() {
1640
- return 11 /* Interval */;
1630
+ return Type.Interval;
1641
1631
  }
1642
1632
  // get ArrayType() {
1643
1633
  // return Int32Array;
@@ -1666,7 +1656,7 @@ var FixedSizeList = class extends DataType {
1666
1656
  this.children = [child];
1667
1657
  }
1668
1658
  get typeId() {
1669
- return 16 /* FixedSizeList */;
1659
+ return Type.FixedSizeList;
1670
1660
  }
1671
1661
  get valueType() {
1672
1662
  return this.children[0].type;
@@ -1690,7 +1680,7 @@ var Struct = class extends DataType {
1690
1680
  this.children = children;
1691
1681
  }
1692
1682
  get typeId() {
1693
- return 13 /* Struct */;
1683
+ return Type.Struct;
1694
1684
  }
1695
1685
  toString() {
1696
1686
  return `Struct<{${this.children.map((f) => `${f.name}:${f.type}`).join(", ")}}>`;
@@ -1700,7 +1690,7 @@ var Struct = class extends DataType {
1700
1690
  }
1701
1691
  };
1702
1692
 
1703
- // src/lib/table/arrow-api/get-type-info.ts
1693
+ // dist/lib/table/arrow-api/get-type-info.js
1704
1694
  function getTypeInfo(arrowTypeLike) {
1705
1695
  return {
1706
1696
  typeId: arrowTypeLike.typeId,
@@ -1721,7 +1711,7 @@ function getTypeKey(typeKey) {
1721
1711
  return ReverseType[typeKey];
1722
1712
  }
1723
1713
 
1724
- // src/lib/utils/async-queue.ts
1714
+ // dist/lib/utils/async-queue.js
1725
1715
  var ArrayQueue = class extends Array {
1726
1716
  enqueue(value) {
1727
1717
  return this.push(value);
@@ -1785,3 +1775,4 @@ var AsyncQueue = class {
1785
1775
  });
1786
1776
  }
1787
1777
  };
1778
+ //# sourceMappingURL=index.cjs.map