├── .gitignore ├── LICENSE ├── README.md ├── dist ├── browser │ ├── 1.datamodel.js │ ├── 2.datamodel.js │ ├── 8b88c9bd5247bbf5828f.worker.js │ ├── c5e4ba14b90211ccd6b7.module.wasm │ └── datamodel.js ├── esm │ ├── web │ │ └── src │ │ │ ├── constants │ │ │ ├── aggregations.d.ts │ │ │ ├── aggregations.js │ │ │ ├── context.d.ts │ │ │ ├── context.js │ │ │ ├── errorMessage.d.ts │ │ │ ├── errorMessage.js │ │ │ ├── fields.d.ts │ │ │ ├── fields.js │ │ │ ├── filtering-modes.d.ts │ │ │ ├── filtering-modes.js │ │ │ ├── invalid-data.d.ts │ │ │ ├── invalid-data.js │ │ │ ├── miscellaneous.d.ts │ │ │ ├── miscellaneous.js │ │ │ ├── selections.d.ts │ │ │ ├── selections.js │ │ │ ├── sort.d.ts │ │ │ └── sort.js │ │ │ ├── contexts │ │ │ ├── _to_do_context_registry.d.ts │ │ │ ├── _to_do_context_registry.js │ │ │ └── wasm │ │ │ │ ├── fields │ │ │ │ ├── categorical.d.ts │ │ │ │ ├── categorical.js │ │ │ │ ├── continuous.d.ts │ │ │ │ ├── continuous.js │ │ │ │ ├── field.d.ts │ │ │ │ ├── field.js │ │ │ │ ├── row_id.d.ts │ │ │ │ ├── row_id.js │ │ │ │ ├── temporal.d.ts │ │ │ │ ├── temporal.js │ │ │ │ ├── utils.d.ts │ │ │ │ └── utils.js │ │ │ │ ├── index.d.ts │ │ │ │ ├── index.js │ │ │ │ └── utils │ │ │ │ ├── index.d.ts │ │ │ │ ├── index.js │ │ │ │ ├── select-utils.d.ts │ │ │ │ └── select-utils.js │ │ │ ├── contracts │ │ │ ├── context.d.ts │ │ │ ├── context.js │ │ │ ├── data.d.ts │ │ │ ├── data.js │ │ │ ├── dataWranglers.d.ts │ │ │ ├── dataWranglers.js │ │ │ ├── datamodel.d.ts │ │ │ ├── datamodel.js │ │ │ ├── field.d.ts │ │ │ ├── field.js │ │ │ ├── query.d.ts │ │ │ ├── query.js │ │ │ ├── tasker.d.ts │ │ │ └── tasker.js │ │ │ ├── data │ │ │ ├── dataParsers │ │ │ │ ├── auto-resolver.d.ts │ │ │ │ ├── auto-resolver.js │ │ │ │ ├── dsv-arr.d.ts │ │ │ │ ├── dsv-arr.js │ │ │ │ ├── dsv-str.d.ts │ │ │ │ ├── dsv-str.js │ │ │ │ ├── flat-json.d.ts │ │ │ │ ├── flat-json.js │ │ │ │ ├── store.d.ts │ │ │ │ └── store.js │ │ │ ├── defaultConverters │ │ │ │ ├── autoConverter.d.ts │ │ │ │ ├── autoConverter.js │ │ │ │ ├── dsvArrayConverter.d.ts │ │ │ │ ├── dsvArrayConverter.js │ │ │ │ ├── dsvStringConverter.d.ts │ │ │ │ ├── dsvStringConverter.js │ │ │ │ ├── index.d.ts │ │ │ │ ├── index.js │ │ │ │ ├── jsonConverter.d.ts │ │ │ │ ├── jsonConverter.js │ │ │ │ ├── store.d.ts │ │ │ │ └── store.js │ │ │ ├── fieldParsers │ │ │ │ ├── categorical.d.ts │ │ │ │ ├── categorical.js │ │ │ │ ├── continuous.d.ts │ │ │ │ ├── continuous.js │ │ │ │ ├── field-contract.d.ts │ │ │ │ ├── field-contract.js │ │ │ │ ├── index.d.ts │ │ │ │ ├── index.js │ │ │ │ ├── temporal.d.ts │ │ │ │ └── temporal.js │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ ├── invalid │ │ │ │ ├── invalid.d.ts │ │ │ │ ├── invalid.js │ │ │ │ ├── store.d.ts │ │ │ │ └── store.js │ │ │ └── utils │ │ │ │ ├── column-major.d.ts │ │ │ │ ├── column-major.js │ │ │ │ ├── date-time-formatter.d.ts │ │ │ │ ├── date-time-formatter.js │ │ │ │ ├── helper.d.ts │ │ │ │ ├── helper.js │ │ │ │ ├── index.d.ts │ │ │ │ ├── index.js │ │ │ │ ├── transform-data.d.ts │ │ │ │ └── transform-data.js │ │ │ ├── export.d.ts │ │ │ ├── export.js │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ ├── main.d.ts │ │ │ ├── main.js │ │ │ ├── operations │ │ │ ├── derivations.d.ts │ │ │ ├── derivations.js │ │ │ ├── dispose.d.ts │ │ │ ├── dispose.js │ │ │ ├── propagation │ │ │ │ ├── index.d.ts │ │ │ │ └── index.js │ │ │ └── wranglers │ │ │ │ ├── index.d.ts │ │ │ │ └── index.js │ │ │ └── worker │ │ │ ├── create-pool.d.ts │ │ │ ├── create-pool.js │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ ├── pool-executor.d.ts │ │ │ ├── pool-executor.js │ │ │ ├── transform-data.worker.d.ts │ │ │ └── transform-data.worker.js │ └── webassembly │ │ └── pkg │ │ ├── datamodel_wasm.d.ts │ │ ├── datamodel_wasm.js │ │ └── datamodel_wasm_bg.wasm └── node │ ├── 1.datamodel.js │ ├── 2.datamodel.js │ ├── 2cf9e3dd7ff6959fdd40.worker.js │ ├── bff0e3323ebd9a29ab52.module.wasm │ └── datamodel.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | # PLATFORM 2 | # ======== 3 | # All exclusions that are specific to the NPM, GIT, IDE and Operating Systems. 4 | 5 | # Ignore scripts for automatic docs deployment 6 | am_*.sh 7 | 8 | # - Do not allow installed node modules to be committed. Doing `npm install -d` will bring them in root or other places. 9 | node_modules 10 | 11 | # - Do not commit any log file from anywhere 12 | *.log 13 | 14 | # - Prevent addition of OS specific file explorer files 15 | Thumbs.db 16 | .DS_Store 17 | 18 | 19 | # PROJECT 20 | # ======= 21 | # Configuration pertaining to project specific repository structure. 22 | 23 | # - Prevent Sublime text IDE files from being commited to repository 24 | *.sublime-* 25 | 26 | # - Prevent NetBeans IDE files from being commited to repository 27 | nbproject/ 28 | 29 | # - Allow sublime text project file to be commited in the development directory. 30 | !/develop/*.sublime-project 31 | 32 | # - We use file names with `attr-*` for chart attribute tutorial files. These files remain in the `xt-attrs` submodule, 33 | # but are copied to a temp folder for building docs along with the tutorials from `develop/docs`. They should not be 34 | # tracked in the main project 35 | develop/docs/attr-* 36 | 37 | # - Prevent extra `jshint` configuration from being committed from anywhere. Only `package.json` will be used as 38 | # accepted source of config. 39 | .jshintrc 40 | 41 | # - Prevent Modular build template files from being Added 42 | develop/template/modular 43 | 44 | # - Prevent diff backups from SourceTree from showing as commit. 45 | *.BACKUP.* 46 | *.BASE.* 47 | *.LOCAL.* 48 | *.REMOTE.* 49 | *.orig 50 | 51 | # Ignore .swp files in case vim is getting used 52 | *.swp 53 | 54 | # Ignore .tmp folder created for mocha-webpack test cases 55 | /.tmp/ 56 | 57 | # Ignore docs folder created by jsdoc 58 | /docs 59 | 60 | # Ignore coverage folder created by karma 61 | coverage 62 | 63 | jquery 64 | 65 | package-lock.json 66 | 67 | develop 68 | 69 | extras 70 | .vscode -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | End User License Agreement for Muze and DataModel (WebAssembly version) 2 | 3 | Licensor: Muze (Charts.com), InfoSoft Global (P) Ltd. 4 | Web : https://www.muzejs.org 5 | Email : muze [at] muzejs.org 6 | 7 | END-USER LICENSE AGREEMENT FOR THIS SOFTWARE 8 | 9 | This End-User License Agreement ("EULA") is a legal agreement between you ("Licensee"), either an individual or an 10 | entity, and the mentioned Licensor of this Software for the software product identified above, which includes computer 11 | software and may include associated media, printed materials, and "online" or electronic documentation ("Software"). 12 | By installing, copying, or otherwise using the Software, you agree to be bound by the terms of this EULA. If you do not 13 | agree to the terms of this EULA, do not install or use the Software. 14 | 15 | SOFTWARE LICENSE 16 | 17 | The Software is protected by copyright laws and international copyright treaties, as well as other intellectual property 18 | laws and treaties. The Software is licensed, not sold. The Software under this License is provided free of charge. 19 | Even though a license fee is not paid for the use of such software, it does not mean that there are no conditions for 20 | using such software. 21 | 22 | 1. GRANT OF LICENSE 23 | 24 | You are granted a non-exclusive License to Use the downloaded Software for any purposes 25 | for an unlimited period of time. 26 | 27 | Installation and Use: You may install and use an unlimited number of copies of the Software. 28 | 29 | Reproduction and Distribution: You may reproduce and distribute an unlimited number of copies of the Software either 30 | in whole or in part; each copy should include all copyright and trademark notices, and shall be accompanied by a 31 | copy of this EULA. Copies of the Software may be distributed as a standalone product or included with your own product. 32 | 33 | Commercial Use: You may use the Software for commercial purposes. 34 | 35 | Reverse engineering: You may not reverse engineer or disassemble the Software. 36 | 37 | 2. INTELLECTUAL PROPERTY RIGHTS 38 | 39 | This License does not transmit any intellectual rights on the Software. The Software and any copies that the Licensee is 40 | authorized by the Licensor to make are the intellectual property of and are owned by the Licensor. 41 | The Software is protected by copyright, including without limitation by Copyright Law and international treaty provisions. 42 | 43 | Any copies that the Licensee is permitted to make pursuant to this Agreement must contain the same copyright 44 | and other proprietary notices that appear on or in the Software. 45 | 46 | The structure, organization and code of the Software are the valuable trade secrets and confidential information 47 | of the Licensor. The Licensee agrees not to decompile, disassemble or otherwise attempt to discover the source code 48 | of the Software. 49 | 50 | Any attempts to reverse-engineer, copy, clone, modify or alter in any way the installer program without the 51 | Licensor’s specific approval are strictly prohibited. The Licensee is not authorized to use any plug-in or 52 | enhancement that permits to save modifications to a file with software licensed and distributed by the Licensor. 53 | 54 | Trademarks shall be used in accordance with accepted trademark practice, including identification 55 | of trademarks owners’ names. Trademarks can only be used to identify printed output produced by the Software 56 | and such use of any trademark does not give the Licensee any rights of ownership in that trademark. 57 | 58 | All title and copyrights in and to the Software (including but not limited to any images, 59 | photographs, animations, video, audio, music and text incorporated into the Software), the accompanying 60 | documentation, and any copies of the Software are owned by the Licensor of this Software. The Software is 61 | protected by copyright laws and international treaty provisions. Therefore, you must treat the Software like 62 | any other copyrighted material. 63 | 64 | LIMITED WARRANTY 65 | 66 | 1. NO WARRANTIES 67 | 68 | The Licensor of this Software expressly disclaims any warranty for the Software. 69 | The Software and any related documentation is provided "as is" without warranty of any kind, 70 | either express or implied, including, without limitation, the implied warranties or merchantability, 71 | fitness for a particular purpose, or non-infringement. The entire risk arising out of use or performance 72 | of the Software remains with you. 73 | 74 | 2. NO LIABILITY FOR DAMAGES 75 | 76 | In no event shall the Licensor of this Software be liable for any damages whatsoever 77 | (including, without limitation, damages for loss of business profits, business interruption, 78 | loss of business information, or any other pecuniary loss) arising out of the use of or inability to use 79 | this product, even if the Licensor of this Software has been advised of the possibility of such damages. 80 | Because some states/jurisdictions do not allow the exclusion or limitation of liability for consequential 81 | or incidental damages, the above limitation may not apply to you. 82 | 83 | [END OF LICENSE] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Free](https://img.shields.io/badge/cost-Free-brightgreen)](http://muzejs.org/muze-wa/eula) 2 | [![License](https://img.shields.io/badge/license-Custom-brightgreen)](http://muzejs.org/muze-wa/eula) 3 | [![NPM version](https://img.shields.io/npm/v/@chartshq/datamodel.svg)](https://www.npmjs.com/package/@chartshq/datamodel) 4 | [![Contributors](https://img.shields.io/github/contributors/chartshq/datamodel.svg)](https://github.com/chartshq/datamodel/graphs/contributors) 5 | 6 | ## What is DataModel? 7 | 8 | DataModel is an in-browser representation of tabular data. It uses WebAssembly for high performance and works seamlessly with any JavaScript library. It supports [Relational Algebra](https://en.wikipedia.org/wiki/Relational_algebra) operators which enable you to run `select`, `group`, `sort` (and many more) operations on the data. 9 | 10 | The current version performs all the data operations like `filtering`, `aggregation`, etc. on **[WebAssembly](https://webassembly.org/)** which gives a **10x performance** boost compared to the [old JavaScript version](https://github.com/chartshq/datamodel-deprecated). 11 | 12 | It is written in [Rust Language](https://www.rust-lang.org/) to handle computation intensive data operations, which is then compiled to **[WebAssembly](https://webassembly.org/)**, thereby providing a native-like performance for data operations. 13 | 14 | DataModel can be used if you need an in-browser tabular data store for data analysis, visualization or just general use of data. 15 | 16 | ## Features 17 | 18 | * 🎉 Supports [**Relational Algebra**](https://en.wikipedia.org/wiki/Relational_algebra) operators e.g. `selection`, `projection`, `group`, `calculateVariable`, `sort` etc out-of-the-box. 19 | 20 | * 💎 Every operation creates **Immutable** DataModel instance and builds a Directed Acyclic Graph (DAG) which establishes auto interactivity. 21 | 22 | * 🚀 Uses **[WebAssembly](https://webassembly.org/)** for handling huge datasets and for **better performance**. 23 | 24 | * ⛺ Also works in **Nodejs** environment out-of-the-box. 25 | 26 | ## Installation 27 | 28 | ### CDN 29 | 30 | Insert the DataModel build into the ``: 31 | 32 | ```html 33 | 34 | ``` 35 | 36 | ### NPM 37 | 38 | Install DataModel from NPM: 39 | 40 | ```bash 41 | $ npm install --save @chartshq/datamodel 42 | ``` 43 | 44 | As we're using [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker) internally, so the [worker-loader](https://www.npmjs.com/package/worker-loader) needs to be installed as follows: 45 | 46 | ```bash 47 | $ npm install worker-loader --save-dev 48 | ``` 49 | 50 | And then within your webpack configuration object, you'll need to add the `worker-loader` to the list of module rules, like so: 51 | 52 | ```js 53 | module.exports = { 54 | module: { 55 | rules: [ 56 | // Add the following object to your module `rules` list. 57 | { 58 | test: /\.worker/, 59 | include: /datamodel/, 60 | loader: 'worker-loader', 61 | options: { 62 | inline: false, // If you want to make it inline, set to true. 63 | fallback: true 64 | }, 65 | }, 66 | ], 67 | } 68 | }; 69 | ``` 70 | 71 | You also can checkout our [datamodel-app-template](https://github.com/chartshq/datamodel-app-template) to try out the `DataModel` quickly through a boilerplate app. 72 | 73 | ## Getting Started 74 | 75 | Once the installation is done, please follow the steps below: 76 | 77 | 1. Prepare the data and the corresponding schema: 78 | 79 | ```js 80 | // Prepare the schema for data. 81 | const schema = [ 82 | { 83 | name: 'Name', 84 | type: 'dimension' 85 | }, 86 | { 87 | name: 'Maker', 88 | type: 'dimension' 89 | }, 90 | { 91 | name: 'Horsepower', 92 | type: 'measure', 93 | defAggFn: 'avg' 94 | }, 95 | { 96 | name: 'Origin', 97 | type: 'dimension' 98 | } 99 | ] 100 | 101 | // Prepare the data. 102 | const data = [ 103 | { 104 | "Name": "chevrolet chevelle malibu", 105 | "Maker": "chevrolet", 106 | "Horsepower": 130, 107 | "Origin": "USA" 108 | }, 109 | { 110 | "Name": "buick skylark 320", 111 | "Maker": "buick", 112 | "Horsepower": 165, 113 | "Origin": "USA" 114 | }, 115 | { 116 | "Name": "datsun pl510", 117 | "Maker": "datsun", 118 | "Horsepower": 88, 119 | "Origin": "Japan" 120 | } 121 | ] 122 | ``` 123 | 124 | 2. Import DataModel as follows: 125 | 126 | If you are using the npm package, import the package as below: 127 | ```js 128 | import Engine from '@chartshq/datamodel'; 129 | ``` 130 | 131 | If you are using it in NodeJS, then require it as below: 132 | ```js 133 | const Engine = require('@chartshq/datamodel').default; 134 | ``` 135 | 136 | If you are using CDN, then use it as follows: 137 | ```js 138 | const Engine = window.DataModel; 139 | ``` 140 | 141 | 3. Load the DataModel engine and pass the data and schema to `DataModel` constructor and create a new `DataModel` instance: 142 | 143 | ```js 144 | // As the DataModel are asynchronous, so we need to 145 | // use async-await syntax. 146 | async function myAsyncFn() { 147 | // Load the DataModel module. 148 | const DataModel = await Engine.onReady(); 149 | 150 | // Converts the raw data into a format 151 | // which DataModel can consume. 152 | const formattedData = await DataModel.loadData(data, schema); 153 | 154 | // Create a new DataModel instance with 155 | // the formatted data. 156 | const dm = new DataModel(formattedData); 157 | 158 | console.log(dm.getData().data); 159 | // Output: 160 | // [ 161 | // ["chevrolet chevelle malibu", "chevrolet", 130, "USA"], 162 | // ["buick skylark 320", "buick", 165, "USA"], 163 | // ["datsun pl510", "datsun", 88, "Japan"] 164 | // ] 165 | 166 | // Perform the selection operation. 167 | const selectDm = dm.select({ field: 'Origin', value: 'USA', operator: DataModel.ComparisonOperators.EQUAL }); 168 | console.log(selectDm.getData().data); 169 | // Output: 170 | // [ 171 | // ["chevrolet chevelle malibu", "chevrolet", 130, "USA], 172 | // ["buick skylark 320", "buick", 165, "USA] 173 | // ] 174 | 175 | // Perform the projection operation. 176 | const projectDm = dm.project(["Origin", "Maker"]); 177 | console.log(projectDm.getData().data); 178 | // Output: 179 | // [ 180 | // ["USA", "chevrolet"], 181 | // ["USA", "buick"], 182 | // ["Japan", "datsun"] 183 | // ] 184 | 185 | console.log(projectDm.getData().schema); 186 | // Output: 187 | // [ 188 | // {"name": "Origin","type": "dimension"}, 189 | // {"name": "Maker","type": "dimension"} 190 | // ] 191 | } 192 | 193 | myAsyncFn() 194 | .catch(console.error.bind(console)); 195 | 196 | ``` 197 | 198 | 4. Now dispose the DataModel instance if it's not needed: 199 | 200 | ```js 201 | // This also disposes all the datamodels which are created from it. 202 | dm.dispose(); 203 | ``` 204 | 205 | ## Documentation 206 | 207 | Find detailed documentation and API reference from [here](https://muzejs.org/docs/wa/latest/concepts/datamodel/introducing-datamodel). 208 | 209 | ## What has changed? 210 | 211 | DataModel 3.0.0 now has the core written in [Rust language](https://www.rust-lang.org/) and has been ported to **[WebAssembly](https://webassembly.org/)** bringing in a huge performance difference w.r.t to [previous version](https://github.com/chartshq/datamodel-deprecated), in terms of both data size and computing speed. While the JavaScript version is deprecated and no active development will take place there but critical bugs if raised would be taken and released in GitHub only. 212 | 213 | You can visit the JavaScript (deprecated) version here [https://github.com/chartshq/datamodel-deprecated](https://github.com/chartshq/datamodel-deprecated) 214 | 215 | ## Migrating from previous versions of DataModel 216 | 217 | Now the DataModel became asynchronous as opposed to being synchronous in the previous JavaScript version. 218 | 219 | ```js 220 | import Engine from '@chartshq/datamodel'; 221 | 222 | (async () => { 223 | // Load the DataModel module. 224 | const DataModel = await Engine.onReady(); 225 | 226 | // Converts the raw data into a format 227 | // which DataModel can consume. 228 | const formattedData = await DataModel.loadData(data, schema); 229 | 230 | // Create a new DataModel instance with 231 | // the formatted data. 232 | const dm = new DataModel(formattedData); 233 | })(); 234 | ``` 235 | 236 | ### **Changed APIs** 237 | 238 | - **select** 239 | 240 | DataModel deprecated version: 241 | 242 | ```js 243 | dm.select((fields) => { 244 | return fields.Origin.value === 'USA'; 245 | }); 246 | ``` 247 | 248 | Latest version: 249 | 250 | ```js 251 | dm.select({ 252 | field: 'Origin', 253 | operator: DataModel.ComparisonOperators.EQUAL, 254 | value: 'USA' 255 | }); 256 | ``` 257 | 258 | - **groupBy** 259 | 260 | DataModel deprecated version: 261 | 262 | ```js 263 | dm.groupBy(['Origin'], { 264 | Acceleration: 'avg' 265 | }); 266 | ``` 267 | 268 | Latest version: 269 | 270 | ```js 271 | dm.groupBy(['Origin'], [{ 272 | aggn: DataModel.AggregationFunctions.AVG, 273 | field: 'Acceleration' 274 | }]); 275 | ``` 276 | 277 | Supported data operations: 278 | 279 | - select 280 | - project 281 | - calculateVariable 282 | - sort 283 | - groupBy 284 | 285 | Upcoming data operations: 286 | 287 | - join 288 | - bin 289 | - compose 290 | - union 291 | - difference 292 | - ... many more ... 293 | 294 | For more details on APIs visit our [docs](https://muzejs.org/docs/wa/latest/concepts/datamodel/introducing-datamodel). 295 | 296 | ## License 297 | 298 | [Custom License](https://muzejs.org/muze-wa/eula) (Free to use) 299 | -------------------------------------------------------------------------------- /dist/browser/1.datamodel.js: -------------------------------------------------------------------------------- 1 | (window.webpackJsonpDataModel=window.webpackJsonpDataModel||[]).push([[1],[,,,,function(e,t,n){(function(e){var r=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),a=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(n)?r.showHidden=n:n&&t._extend(r,n),v(r.showHidden)&&(r.showHidden=!1),v(r.depth)&&(r.depth=2),v(r.colors)&&(r.colors=!1),v(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=a),s(r,e,r.depth)}function a(e,t){var n=c.styles[t];return n?"["+c.colors[n][0]+"m"+e+"["+c.colors[n][1]+"m":e}function f(e,t){return e}function s(e,n,r){if(e.customInspect&&n&&T(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var o=n.inspect(r,e);return m(o)||(o=s(e,o,r)),o}var i=function(e,t){if(v(t))return e.stylize("undefined","undefined");if(m(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(h(t))return e.stylize(""+t,"number");if(d(t))return e.stylize(""+t,"boolean");if(g(t))return e.stylize("null","null")}(e,n);if(i)return i;var u=Object.keys(n),c=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(u);if(e.showHidden&&(u=Object.getOwnPropertyNames(n)),O(n)&&(u.indexOf("message")>=0||u.indexOf("description")>=0))return l(n);if(0===u.length){if(T(n)){var a=n.name?": "+n.name:"";return e.stylize("[Function"+a+"]","special")}if(w(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(j(n))return e.stylize(Date.prototype.toString.call(n),"date");if(O(n))return l(n)}var f,b="",E=!1,S=["{","}"];(y(n)&&(E=!0,S=["[","]"]),T(n))&&(b=" [Function"+(n.name?": "+n.name:"")+"]");return w(n)&&(b=" "+RegExp.prototype.toString.call(n)),j(n)&&(b=" "+Date.prototype.toUTCString.call(n)),O(n)&&(b=" "+l(n)),0!==u.length||E&&0!=n.length?r<0?w(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),f=E?function(e,t,n,r,o){for(var i=[],u=0,c=t.length;u=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(f,b,S)):S[0]+b+S[1]}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,n,r,o,i){var u,c,a;if((a=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?c=a.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):a.set&&(c=e.stylize("[Setter]","special")),R(r,o)||(u="["+o+"]"),c||(e.seen.indexOf(a.value)<0?(c=g(n)?s(e,a.value,null):s(e,a.value,n-1)).indexOf("\n")>-1&&(c=i?c.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+c.split("\n").map((function(e){return" "+e})).join("\n")):c=e.stylize("[Circular]","special")),v(u)){if(i&&o.match(/^\d+$/))return c;(u=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),u=e.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),u=e.stylize(u,"string"))}return u+": "+c}function y(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function g(e){return null===e}function h(e){return"number"==typeof e}function m(e){return"string"==typeof e}function v(e){return void 0===e}function w(e){return b(e)&&"[object RegExp]"===E(e)}function b(e){return"object"==typeof e&&null!==e}function j(e){return b(e)&&"[object Date]"===E(e)}function O(e){return b(e)&&("[object Error]"===E(e)||e instanceof Error)}function T(e){return"function"==typeof e}function E(e){return Object.prototype.toString.call(e)}function S(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(v(i)&&(i=e.env.NODE_DEBUG||""),n=n.toUpperCase(),!u[n])if(new RegExp("\\b"+n+"\\b","i").test(i)){var r=e.pid;u[n]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",n,r,e)}}else u[n]=function(){};return u[n]},t.inspect=c,c.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},c.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=y,t.isBoolean=d,t.isNull=g,t.isNullOrUndefined=function(e){return null==e},t.isNumber=h,t.isString=m,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=v,t.isRegExp=w,t.isObject=b,t.isDate=j,t.isError=O,t.isFunction=T,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(9);var C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function x(){var e=new Date,t=[S(e.getHours()),S(e.getMinutes()),S(e.getSeconds())].join(":");return[e.getDate(),C[e.getMonth()],t].join(" ")}function R(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",x(),t.format.apply(t,arguments))},t.inherits=n(10),t._extend=function(e,t){if(!t||!b(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var A="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function z(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(A&&e[A]){var t;if("function"!=typeof(t=e[A]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,A,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise((function(e,r){t=e,n=r})),o=[],i=0;i1)for(var n=1;n9999?"+"+c(t,6):c(t,4))+"-"+c(e.getUTCMonth()+1,2)+"-"+c(e.getUTCDate(),2)+(i?"T"+c(n,2)+":"+c(r,2)+":"+c(o,2)+"."+c(i,3)+"Z":o?"T"+c(n,2)+":"+c(r,2)+":"+c(o,2)+"Z":r||n?"T"+c(n,2)+":"+c(r,2)+"Z":"")}t.a=function(e){var t=new RegExp('["'+e+"\n\r]"),n=e.charCodeAt(0);function c(e,t){var i,u=[],c=e.length,a=0,f=0,s=c<=0,l=!1;function p(){if(s)return o;if(l)return l=!1,r;var t,i,u=a;if(34===e.charCodeAt(u)){for(;a++=c?s=!0:10===(i=e.charCodeAt(a++))?l=!0:13===i&&(l=!0,10===e.charCodeAt(a)&&++a),e.slice(u+1,t-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:0,n=(a[e[t+0]]+a[e[t+1]]+a[e[t+2]]+a[e[t+3]]+"-"+a[e[t+4]]+a[e[t+5]]+"-"+a[e[t+6]]+a[e[t+7]]+"-"+a[e[t+8]]+a[e[t+9]]+"-"+a[e[t+10]]+a[e[t+11]]+a[e[t+12]]+a[e[t+13]]+a[e[t+14]]+a[e[t+15]]).toLowerCase();if(!c(n))throw TypeError("Stringified UUID is invalid");return n};t.a=function(e,t,n){var r=(e=e||{}).random||(e.rng||i)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=r[o];return t}return s(r)}}]]); -------------------------------------------------------------------------------- /dist/browser/8b88c9bd5247bbf5828f.worker.js: -------------------------------------------------------------------------------- 1 | !function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=1)}([,function(t,r,e){"use strict";e.r(r);"undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),new Uint8Array(16);for(var n=[],o=0;o<256;++o)n.push((o+256).toString(16).substr(1));var a;new Map;!function(t){t.FLAT_JSON="FlatJSON",t.DSV_STR="DSVStr",t.DSV_ARR="DSVArr",t.AUTO="Auto"}(a||(a={}));var u={},i={};function f(t){return new Function("d","return {"+t.map((function(t,r){return JSON.stringify(t)+": d["+r+'] || ""'})).join(",")+"}")}function c(t){var r=Object.create(null),e=[];return t.forEach((function(t){for(var n in t)n in r||e.push(r[n]=n)})),e}function s(t,r){var e=t+"",n=e.length;return n9999?"+"+s(r,6):s(r,4))+"-"+s(t.getUTCMonth()+1,2)+"-"+s(t.getUTCDate(),2)+(a?"T"+s(e,2)+":"+s(n,2)+":"+s(o,2)+"."+s(a,3)+"Z":o?"T"+s(e,2)+":"+s(n,2)+":"+s(o,2)+"Z":n||e?"T"+s(e,2)+":"+s(n,2)+"Z":"")}var p=function(t){var r=new RegExp('["'+t+"\n\r]"),e=t.charCodeAt(0);function n(t,r){var n,o=[],a=t.length,f=0,c=0,s=a<=0,l=!1;function p(){if(s)return i;if(l)return l=!1,u;var r,n,o=f;if(34===t.charCodeAt(o)){for(;f++=a?s=!0:10===(n=t.charCodeAt(f++))?l=!0:13===n&&(l=!0,10===t.charCodeAt(f)&&++f),t.slice(o+1,r-1).replace(/""/g,'"')}for(;f0)&&!(n=a.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(e=a.return)&&e.call(a)}finally{if(o)throw o.error}}return u},g=function(){for(var t=[],r=0;ro.getFullYear()&&(r=""+(a-1)+n),h(r).getFullYear()},formatter:function(t){var r,e=h(t).getFullYear().toString();return e&&(r=e.length,e=e.substring(r-2,r)),e}},Y:{name:"Y",index:0,extract:function(){return"(\\d{4})"},parser:m.defaultNumberParser(),formatter:function(t){return h(t).getFullYear().toString()}}}},m.getTokenFormalNames=function(){var t=m.getTokenDefinitions();return{HOUR:t.H,HOUR_12:t.l,AMPM_UPPERCASE:t.p,AMPM_LOWERCASE:t.P,MINUTE:t.M,SECOND:t.S,SHORT_DAY:t.a,LONG_DAY:t.A,DAY_OF_MONTH:t.e,DAY_OF_MONTH_CONSTANT_WIDTH:t.d,SHORT_MONTH:t.b,LONG_MONTH:t.B,MONTH_OF_YEAR:t.m,SHORT_YEAR:t.y,LONG_YEAR:t.Y}},m.tokenResolver=function(){var t=m.getTokenDefinitions(),r=function(){for(var t=[],r=0;r=0;)e=t[r+1],-1!==a.indexOf(e)&&u.push({index:r,token:e});return u},m.formatAs=function(t,r){var e,n,o,a,u=h(t),i=m.findTokens(r),f=m.getTokenDefinitions(),c=String(r),s=m.TOKEN_PREFIX;for(o=0,a=i.length;o=0;i--)(n=l[i].index)+1!==a.length-1?(void 0===r&&(r=a.length),o=a.substring(n+2,r),a=a.substring(0,n+2)+RegExp.escape(o)+a.substring(r,a.length),r=n):r=n;for(i=0;i0)&&!(n=a.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(e=a.return)&&e.call(a)}finally{if(o)throw o.error}}return u},C=function(){for(var t=[],r=0;r0)&&!(n=a.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(e=a.return)&&e.call(a)}finally{if(o)throw o.error}}return u},I=function(){for(var t=[],r=0;r0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1] number; 12 | -------------------------------------------------------------------------------- /dist/esm/web/src/constants/aggregations.js: -------------------------------------------------------------------------------- 1 | export var AggregationType;!function(t){t.SUM="sum",t.AVG="avg",t.MIN="min",t.MAX="max",t.FIRST="first",t.LAST="last",t.COUNT="count",t.STD="std"}(AggregationType||(AggregationType={}));export var _aggregationResolver=function(t){return{sum:0,avg:1,count:3,min:4,max:5,std:6}[t]}; -------------------------------------------------------------------------------- /dist/esm/web/src/constants/context.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum ContextType { 2 | WASM = "wasm" 3 | } 4 | -------------------------------------------------------------------------------- /dist/esm/web/src/constants/context.js: -------------------------------------------------------------------------------- 1 | export var ContextType;!function(t){t.WASM="wasm"}(ContextType||(ContextType={})); -------------------------------------------------------------------------------- /dist/esm/web/src/constants/errorMessage.d.ts: -------------------------------------------------------------------------------- 1 | export declare const FIELD_NOT_FOUND_IN_MAP = "FIELD not present. Please check the input params and try again."; 2 | export declare const SELECTION_QUERY = "One or more fields in query are wrong or missing."; 3 | -------------------------------------------------------------------------------- /dist/esm/web/src/constants/errorMessage.js: -------------------------------------------------------------------------------- 1 | export var FIELD_NOT_FOUND_IN_MAP="FIELD not present. Please check the input params and try again.";export var SELECTION_QUERY="One or more fields in query are wrong or missing."; -------------------------------------------------------------------------------- /dist/esm/web/src/constants/fields.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum FieldType { 2 | MEASURE = "measure", 3 | DIMENSION = "dimension" 4 | } 5 | export declare enum FieldSubtype { 6 | CATEGORICAL = "categorical", 7 | TEMPORAL = "temporal", 8 | BINNED = "binned", 9 | CONTINUOUS = "continuous", 10 | ROWID = "__id" 11 | } 12 | export declare const ROW_ID = "__id__"; 13 | export declare const _fieldTypeResolver: (fieldType: FieldType) => number; 14 | export declare const _fieldSubtypeResolver: (fieldSubType: FieldSubtype) => number; 15 | export declare const _defaultSubtype: (fieldType: FieldType) => FieldSubtype; 16 | -------------------------------------------------------------------------------- /dist/esm/web/src/constants/fields.js: -------------------------------------------------------------------------------- 1 | export var FieldType;!function(e){e.MEASURE="measure",e.DIMENSION="dimension"}(FieldType||(FieldType={}));export var FieldSubtype;!function(e){e.CATEGORICAL="categorical",e.TEMPORAL="temporal",e.BINNED="binned",e.CONTINUOUS="continuous",e.ROWID="__id"}(FieldSubtype||(FieldSubtype={}));export var ROW_ID="__id__";export var _fieldTypeResolver=function(e){return e===FieldType.MEASURE?1:0};var _filedSubtypes={categorical:0,continuous:1,temporal:2,__id:3};export var _fieldSubtypeResolver=function(e){return _filedSubtypes[e]};export var _defaultSubtype=function(e){return e===FieldType.MEASURE?FieldSubtype.CONTINUOUS:FieldSubtype.CATEGORICAL}; -------------------------------------------------------------------------------- /dist/esm/web/src/constants/filtering-modes.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum FilteringModesType { 2 | NORMAL = "normal", 3 | INVERSE = "inverse", 4 | ALL = "all" 5 | } 6 | export declare const _modeResolver: (mode: FilteringModesType) => number; 7 | -------------------------------------------------------------------------------- /dist/esm/web/src/constants/filtering-modes.js: -------------------------------------------------------------------------------- 1 | export var FilteringModesType;!function(e){e.NORMAL="normal",e.INVERSE="inverse",e.ALL="all"}(FilteringModesType||(FilteringModesType={}));export var _modeResolver=function(e){return{normal:1,inverse:2,all:3}[e]}; -------------------------------------------------------------------------------- /dist/esm/web/src/constants/invalid-data.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum InvalidData { 2 | UNDEFINED = "" 3 | } 4 | export declare enum InvalidType { 5 | NULL = "null", 6 | UNDEFINED = "undefined", 7 | NAN = "NaN", 8 | NIL = "nil", 9 | NA = "na", 10 | EMPTY_STRING = "" 11 | } 12 | export declare const DEFAULT_INVALID_VALUE = "_invalid"; 13 | export declare const RESERVED_INVALID_VALUE = "_#-"; 14 | -------------------------------------------------------------------------------- /dist/esm/web/src/constants/invalid-data.js: -------------------------------------------------------------------------------- 1 | export var InvalidData;!function(a){a.UNDEFINED=""}(InvalidData||(InvalidData={}));export var InvalidType;!function(a){a.NULL="null",a.UNDEFINED="undefined",a.NAN="NaN",a.NIL="nil",a.NA="na",a.EMPTY_STRING=""}(InvalidType||(InvalidType={}));export var DEFAULT_INVALID_VALUE="_invalid";export var RESERVED_INVALID_VALUE="_#-"; -------------------------------------------------------------------------------- /dist/esm/web/src/constants/miscellaneous.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum Operations { 2 | SELECT = "select", 3 | GROUPBY = "groupBy", 4 | PROJECT = "project", 5 | SPLIT = "split", 6 | SORT = "sort", 7 | CALCULATE = "calculate_variable" 8 | } 9 | export declare const DEFAULT = "default"; 10 | export interface DerivationParams { 11 | operation: Operations; 12 | params: Record; 13 | } 14 | -------------------------------------------------------------------------------- /dist/esm/web/src/constants/miscellaneous.js: -------------------------------------------------------------------------------- 1 | export var Operations;!function(t){t.SELECT="select",t.GROUPBY="groupBy",t.PROJECT="project",t.SPLIT="split",t.SORT="sort",t.CALCULATE="calculate_variable"}(Operations||(Operations={}));export var DEFAULT="default"; -------------------------------------------------------------------------------- /dist/esm/web/src/constants/selections.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum ComparisonOperatorsType { 2 | EQUAL = "eq", 3 | NOT_EQUAL = "neq", 4 | GREATER_THAN = "gt", 5 | LESS_THAN = "lt", 6 | GREATER_THAN_EQUAL = "gte", 7 | LESS_THAN_EQUAL = "lte", 8 | IN = "in", 9 | NIN = "nin", 10 | EQUAL_TO = "eq", 11 | NOT_EQUAL_TO = "neq" 12 | } 13 | export declare enum LogicalOperatorsType { 14 | AND = "and", 15 | OR = "or" 16 | } 17 | export declare const _selectionOperatorResolver: (op: ComparisonOperatorsType | LogicalOperatorsType) => number; 18 | -------------------------------------------------------------------------------- /dist/esm/web/src/constants/selections.js: -------------------------------------------------------------------------------- 1 | export var ComparisonOperatorsType;!function(e){e.EQUAL="eq",e.NOT_EQUAL="neq",e.GREATER_THAN="gt",e.LESS_THAN="lt",e.GREATER_THAN_EQUAL="gte",e.LESS_THAN_EQUAL="lte",e.IN="in",e.NIN="nin",e.EQUAL_TO="eq",e.NOT_EQUAL_TO="neq"}(ComparisonOperatorsType||(ComparisonOperatorsType={}));export var LogicalOperatorsType;!function(e){e.AND="and",e.OR="or"}(LogicalOperatorsType||(LogicalOperatorsType={}));export var _selectionOperatorResolver=function(e){var r={eq:1,neq:2,gt:3,lt:4,gte:5,lte:6,in:9,nin:10,and:7,or:8}[e];return void 0!==r?r:-1}; -------------------------------------------------------------------------------- /dist/esm/web/src/constants/sort.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum SortOrder { 2 | ASC = "asc", 3 | DESC = "desc", 4 | NO_ORDER = "" 5 | } 6 | export declare const _sortOrderResolver: (order: SortOrder) => number; 7 | -------------------------------------------------------------------------------- /dist/esm/web/src/constants/sort.js: -------------------------------------------------------------------------------- 1 | export var SortOrder;!function(r){r.ASC="asc",r.DESC="desc",r.NO_ORDER=""}(SortOrder||(SortOrder={}));export var _sortOrderResolver=function(r){return r===SortOrder.DESC?1:r===SortOrder.NO_ORDER?3:0}; -------------------------------------------------------------------------------- /dist/esm/web/src/contexts/_to_do_context_registry.d.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chartshq/datamodel/c03366dd81bebc83b21cc5bbaaad40b61b68a58c/dist/esm/web/src/contexts/_to_do_context_registry.d.ts -------------------------------------------------------------------------------- /dist/esm/web/src/contexts/_to_do_context_registry.js: -------------------------------------------------------------------------------- 1 | "use strict"; -------------------------------------------------------------------------------- /dist/esm/web/src/contexts/wasm/fields/categorical.d.ts: -------------------------------------------------------------------------------- 1 | import { AbstractWasmField } from './field'; 2 | import { CategoricalFieldWrapper, WasmDataModel } from '../utils'; 3 | import { Schema } from '../../../contracts/data'; 4 | import Invalid from '../../../data/invalid/invalid'; 5 | export default class Categorical extends AbstractWasmField { 6 | private _uniqueStrings; 7 | _wasmField?: CategoricalFieldWrapper; 8 | _cachedData: (string | Invalid)[]; 9 | _cachedFormattedData: (string | Invalid)[]; 10 | _cachedDomain: string[]; 11 | constructor(schema: Schema, field?: CategoricalFieldWrapper); 12 | _setMeta(data: Array): void; 13 | _getMeta(): Array; 14 | domain(): string[]; 15 | data(): (string | Invalid)[]; 16 | formattedData(format?: Function): (string | Invalid)[]; 17 | getRowsCount(): number; 18 | dispose(): void; 19 | } 20 | export declare const categoricalFieldCreator: (data: Array, schema: Schema, dm?: WasmDataModel | undefined) => { 21 | field: Categorical; 22 | index: number; 23 | }; 24 | -------------------------------------------------------------------------------- /dist/esm/web/src/contexts/wasm/fields/categorical.js: -------------------------------------------------------------------------------- 1 | var __extends=this&&this.__extends||function(){var t=function(e,a){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var a in e)e.hasOwnProperty(a)&&(t[a]=e[a])})(e,a)};return function(e,a){function i(){this.constructor=e}t(e,a),e.prototype=null===a?Object.create(a):(i.prototype=a.prototype,new i)}}(),__read=this&&this.__read||function(t,e){var a="function"==typeof Symbol&&t[Symbol.iterator];if(!a)return t;var i,r,n=a.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(t){r={error:t}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(r)throw r.error}}return o},__spread=this&&this.__spread||function(){for(var t=[],e=0;e, schema: Schema, dm?: WasmDataModel | undefined) => { 18 | field: Continuous; 19 | index: number; 20 | }; 21 | -------------------------------------------------------------------------------- /dist/esm/web/src/contexts/wasm/fields/continuous.js: -------------------------------------------------------------------------------- 1 | var __extends=this&&this.__extends||function(){var t=function(e,a){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var a in e)e.hasOwnProperty(a)&&(t[a]=e[a])})(e,a)};return function(e,a){function i(){this.constructor=e}t(e,a),e.prototype=null===a?Object.create(a):(i.prototype=a.prototype,new i)}}();import{AbstractWasmField}from"./field";import{sanitizeNumbers,saveIndecesToMemory,saveNumbersToMemory,getIndecesFromMemory,getWasmSchema}from"./utils";import Invalid from"../../../data/invalid/invalid";var Continuous=function(t){function e(e,a){var i=t.call(this,e)||this;return i._cachedData=[],i._cachedDomain=[],i._wasmField=a,i._cachedFormattedData=[],i}return __extends(e,t),e.prototype.domain=function(){if(this._wasmField){var t=this._wasmField.get_domain();t.length&&(this._cachedDomain=[t[0],t[1]])}return this._cachedDomain},e.prototype.data=function(){var t=this;if(0===this._cachedData.length&&this._wasmField){var e=getIndecesFromMemory(this._wasmField.get_data_info(),this._wasmField.get_rows_count()).map(function(e){var a=t._wasmField.get_value_at_index(e);return Number.isFinite(a)?a:new Invalid(NaN)});this._cachedData=e}return this._cachedData},e.prototype.formattedData=function(t){if(0===this._cachedFormattedData.length||t){var e=this.data(),a=t||this._schema.format,i=[];this._cachedFormattedData=e,a instanceof Function&&(e.forEach(function(t){var e;e=t instanceof Invalid?t:a(t),i.push(e)}),this._cachedFormattedData=i)}return this._cachedFormattedData},e.prototype.getRowsCount=function(){return this._wasmField?this._wasmField.get_rows_count():0},e.prototype.dispose=function(){this._cachedDomain=[],this._cachedData=[],this._cachedFormattedData=[],this._wasmField&&this._wasmField.free()},e}(AbstractWasmField);export default Continuous;export var continuousFieldCreator=function(t,e,a){var i=sanitizeNumbers(t),o=i.indices,n=i.values,r=void 0,s=Number.MAX_VALUE;return a&&(s=a.add_field(getWasmSchema(e),[]),r=a.get_continuous_field(s),saveIndecesToMemory(r.get_data_indices(),o),saveNumbersToMemory(r.get_data_ptr(),n)),{field:new Continuous(e,r),index:s}}; -------------------------------------------------------------------------------- /dist/esm/web/src/contexts/wasm/fields/field.d.ts: -------------------------------------------------------------------------------- 1 | import { Field } from '../../../contracts/field'; 2 | import { Schema } from '../../../contracts/data'; 3 | import { FieldType, FieldSubtype } from '../../../constants/fields'; 4 | import Invalid from '../../../data/invalid/invalid'; 5 | export declare abstract class AbstractWasmField implements Field { 6 | _schema: Schema; 7 | abstract _cachedDomain: string[] | number[]; 8 | abstract _cachedData: (string | Invalid)[] | (number | Invalid)[]; 9 | constructor(schema: Schema); 10 | name(): string; 11 | type(): FieldType; 12 | schema(): Schema; 13 | displayName(): string; 14 | subtype(): FieldSubtype; 15 | abstract domain(): (string | number)[]; 16 | abstract data(): (string | Invalid)[] | (number | Invalid)[]; 17 | abstract formattedData(format?: string | Function): (string | Invalid)[] | (number | Invalid)[]; 18 | abstract getRowsCount(): number; 19 | abstract dispose(): void; 20 | } 21 | -------------------------------------------------------------------------------- /dist/esm/web/src/contexts/wasm/fields/field.js: -------------------------------------------------------------------------------- 1 | var AbstractWasmField=function(){function t(t){this._schema=t}return t.prototype.name=function(){return this._schema.name},t.prototype.type=function(){return this._schema.type},t.prototype.schema=function(){return this._schema},t.prototype.displayName=function(){return this._schema.displayName||this._schema.name},t.prototype.subtype=function(){return this._schema.subtype},t}();export{AbstractWasmField}; -------------------------------------------------------------------------------- /dist/esm/web/src/contexts/wasm/fields/row_id.d.ts: -------------------------------------------------------------------------------- 1 | import { AbstractWasmField } from './field'; 2 | import { IdFieldWrapper, WasmDataModel } from '../utils'; 3 | import { Schema } from '../../../contracts/data'; 4 | export default class RowId extends AbstractWasmField { 5 | _wasmField?: IdFieldWrapper; 6 | _cachedDomain: number[]; 7 | _cachedData: number[]; 8 | constructor(schema: Schema, field?: IdFieldWrapper); 9 | displayName(): string; 10 | domain(): number[]; 11 | formattedData(): number[]; 12 | data(): number[]; 13 | getRowsCount(): number; 14 | getValueAtIndex(index: number): number | null; 15 | dispose(): void; 16 | } 17 | export declare const idFieldCreator: (data: Array, schema: Schema, dm?: WasmDataModel | undefined) => { 18 | field: RowId; 19 | index: number; 20 | }; 21 | export declare const getIdFieldSchema: () => Schema; 22 | -------------------------------------------------------------------------------- /dist/esm/web/src/contexts/wasm/fields/row_id.js: -------------------------------------------------------------------------------- 1 | var __extends=this&&this.__extends||function(){var t=function(e,o){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(e,o)};return function(e,o){function r(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}();import{AbstractWasmField}from"./field";import{getIndecesFromMemory,getWasmSchema,saveIndecesToMemory}from"./utils";import{ROW_ID,FieldType,FieldSubtype}from"../../../constants/fields";var RowId=function(t){function e(e,o){var r=t.call(this,e)||this;return r._cachedDomain=[],r._cachedData=[],r._wasmField=o,r}return __extends(e,t),e.prototype.displayName=function(){return this._schema.name},e.prototype.domain=function(){return[]},e.prototype.formattedData=function(){return[]},e.prototype.data=function(){var t=this;if(0===this._cachedData.length&&this._wasmField){var e=getIndecesFromMemory(this._wasmField.get_data_info(),this._wasmField.get_rows_count()).map(function(e){return t._wasmField.get_value_at_index(e)});this._cachedData=e}return this._cachedData},e.prototype.getRowsCount=function(){return this._wasmField?this._wasmField.get_rows_count():0},e.prototype.getValueAtIndex=function(t){return this.data()[t]},e.prototype.dispose=function(){this._cachedDomain=[],this._cachedData=[],this._wasmField&&this._wasmField.free()},e}(AbstractWasmField);export default RowId;export var idFieldCreator=function(t,e,o){var r=void 0,n=Number.MAX_VALUE;return o&&(n=o.add_field(getWasmSchema(e),[]),r=o.get_id_field(n),saveIndecesToMemory(r.get_data_ptr(),t)),{field:new RowId(e,r),index:n}};export var getIdFieldSchema=function(){return{name:ROW_ID,format:function(t){return t},displayName:ROW_ID,type:FieldType.MEASURE,subtype:FieldSubtype.ROWID,defAggFn:"sum"}}; -------------------------------------------------------------------------------- /dist/esm/web/src/contexts/wasm/fields/temporal.d.ts: -------------------------------------------------------------------------------- 1 | import { AbstractWasmField } from './field'; 2 | import { WasmDataModel, TemporalFieldWrapper } from '../utils'; 3 | import { Schema } from '../../../contracts/data'; 4 | import Invalid from '../../../data/invalid/invalid'; 5 | export default class Temporal extends AbstractWasmField { 6 | _wasmField?: TemporalFieldWrapper; 7 | _cachedDomain: number[]; 8 | _cachedData: (number | Invalid)[]; 9 | _cachedFormattedData: (string | Invalid)[] | (number | Invalid)[]; 10 | constructor(schema: Schema, field?: TemporalFieldWrapper); 11 | domain(): number[]; 12 | data(): (number | Invalid)[]; 13 | formattedData(format?: Function | string): (string | Invalid)[] | (number | Invalid)[]; 14 | getRowsCount(): number; 15 | dispose(): void; 16 | minimumConsecutiveDifference(): number; 17 | } 18 | export declare const temporalFieldCreator: (data: Array, schema: Schema, dm?: WasmDataModel | undefined) => { 19 | field: Temporal; 20 | index: number; 21 | }; 22 | -------------------------------------------------------------------------------- /dist/esm/web/src/contexts/wasm/fields/temporal.js: -------------------------------------------------------------------------------- 1 | var __extends=this&&this.__extends||function(){var t=function(e,a){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var a in e)e.hasOwnProperty(a)&&(t[a]=e[a])})(e,a)};return function(e,a){function i(){this.constructor=e}t(e,a),e.prototype=null===a?Object.create(a):(i.prototype=a.prototype,new i)}}();import{AbstractWasmField}from"./field";import{sanitizeNumbers,saveIndecesToMemory,saveNumbersToMemory,getIndecesFromMemory,getWasmSchema}from"./utils";import DateTimeFormatter from"../../../data/utils/date-time-formatter";import Invalid from"../../../data/invalid/invalid";var Temporal=function(t){function e(e,a){var i=t.call(this,e)||this;return i._cachedDomain=[],i._cachedData=[],i._wasmField=a,i._cachedFormattedData=[],i}return __extends(e,t),e.prototype.domain=function(){if(this._wasmField){var t=this._wasmField.get_domain();t.length&&(this._cachedDomain=[t[0],t[1]])}return this._cachedDomain},e.prototype.data=function(){var t=this;if(0===this._cachedData.length&&this._wasmField){var e=getIndecesFromMemory(this._wasmField.get_data_info(),this._wasmField.get_rows_count()).map(function(e){var a=t._wasmField.get_value_at_index(e);return Number.isFinite(a)?a:new Invalid(NaN)});this._cachedData=e}return this._cachedData},e.prototype.formattedData=function(t){if(0===this._cachedFormattedData.length||t){var e=this.data(),a=t||this._schema.format;if(this._cachedFormattedData=e,a instanceof Function){var i=[];e.forEach(function(t){var e;e=t instanceof Invalid?t:a(t),i.push(e)}),this._cachedFormattedData=i}else if("string"==typeof a||a instanceof String){var r=[];e.forEach(function(t){var e;e=t instanceof Invalid?t:DateTimeFormatter.formatAs(new Date(t),a),r.push(e)}),this._cachedFormattedData=r}}return this._cachedFormattedData},e.prototype.getRowsCount=function(){return this._wasmField?this._wasmField.get_rows_count():0},e.prototype.dispose=function(){this._cachedDomain=[],this._cachedData=[],this._cachedFormattedData=[],this._wasmField&&this._wasmField.free()},e.prototype.minimumConsecutiveDifference=function(){var t=this._wasmField?this._wasmField.min_consecutive_diff():1/0;return isFinite(t)?t:NaN},e}(AbstractWasmField);export default Temporal;export var temporalFieldCreator=function(t,e,a){var i=sanitizeNumbers(t),r=i.indices,o=i.values,n=Number.MAX_VALUE,s=void 0;return a&&(n=a.add_field(getWasmSchema(e),[]),s=a.get_temporal_field(n),saveIndecesToMemory(s.get_data_indices(),r),saveNumbersToMemory(s.get_data_ptr(),o)),{field:new Temporal(e,s),index:n}}; -------------------------------------------------------------------------------- /dist/esm/web/src/contexts/wasm/fields/utils.d.ts: -------------------------------------------------------------------------------- 1 | import { Schema } from '../../../contracts/data'; 2 | export declare const saveIndecesToMemory: (pointer: number, data: Array) => void; 3 | export declare const saveNumbersToMemory: (pointer: number, data: Array) => void; 4 | export declare const sanitizeNumbers: (data?: Array) => Record; 5 | export declare const getIndecesFromMemory: (dataPtr: number, rowsCount: number) => Array; 6 | export declare const getNumbersArrayFromMemory: (dataPtr: number, rowsCount: number) => Array; 7 | export declare const isValidString: (val: undefined | null | string | number) => boolean; 8 | export declare const sanitizeStrings: (data?: Array) => { 9 | uniqueStrings: string[]; 10 | indices: number[]; 11 | }; 12 | export declare const getWasmSchema: (schema: Schema) => { 13 | name: string; 14 | type: number; 15 | subtype: number; 16 | aggregation_function: number; 17 | }; 18 | -------------------------------------------------------------------------------- /dist/esm/web/src/contexts/wasm/fields/utils.js: -------------------------------------------------------------------------------- 1 | import{WasmMemory}from"../utils";import{_fieldTypeResolver,_fieldSubtypeResolver}from"../../../constants/fields";import{_aggregationResolver}from"../../../constants/aggregations";import DataModel from"../../../main";export var saveIndecesToMemory=function(e,r){new Int32Array(WasmMemory.buffer,e,r.length).set(r)};export var saveNumbersToMemory=function(e,r){new Float64Array(WasmMemory.buffer,e,r.length).set(r)};export var sanitizeNumbers=function(e){void 0===e&&(e=[]);var r=[],t=[];return e.forEach(function(e){"number"==typeof e&&Number.isFinite(e)?(r.push(e),t.push(1)):(r.push(NaN),t.push(-1))}),{indices:t,values:r}};export var getIndecesFromMemory=function(e,r){for(var t=new Int32Array(WasmMemory.buffer,e,r),n=new Array(r),o=0;o; 14 | _fieldMap: Map; 18 | _dataMeta: DataMeta; 19 | constructor(rawData: Data | WasmContext, dataMeta?: DataMeta); 20 | private updateFieldMap; 21 | private createFields; 22 | private createField; 23 | private updateFields; 24 | private setContextInfo; 25 | private getClonedFieldMap; 26 | getField(name: string): AbstractWasmField | undefined; 27 | getData(startIndex?: number, endIndex?: number): ResultData; 28 | getSchema(): Array; 29 | getDataMeta(): DataMeta; 30 | sort(sortingDetails: [[string, SortOrder]]): WasmContext; 31 | groupBy(fields: string[], reducers?: { 32 | field: string; 33 | aggn: AggregationType; 34 | }[], options?: { 35 | createId: boolean; 36 | }): WasmContext; 37 | select(query: any, options?: { 38 | mode: FilteringModesType; 39 | }): WasmContext | WasmContext[]; 40 | project(fields: string[], options?: { 41 | mode: FilteringModesType; 42 | }): WasmContext | WasmContext[]; 43 | splitByRow(fields: string[]): WasmContext[]; 44 | clone(): WasmContext; 45 | dispose(removeFields: { 46 | disposeFields: boolean; 47 | disposePartialFields: { 48 | dispose: boolean; 49 | values: string[]; 50 | }; 51 | }): void; 52 | addIdField(ids: number[]): WasmContext; 53 | calculateVariable(fieldInfo: Schema, fields: string[], fn: (...params: (string | number | Invalid)[]) => string | number): WasmContext; 54 | getMatchingIds(dm: WasmContext): number[]; 55 | context(): WasmDataModel | undefined; 56 | } 57 | -------------------------------------------------------------------------------- /dist/esm/web/src/contexts/wasm/index.js: -------------------------------------------------------------------------------- 1 | var __read=this&&this.__read||function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var o,r,n=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(o=n.next()).done;)a.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return a},__spread=this&&this.__spread||function(){for(var e=[],t=0;t string | number | undefined | null; 4 | export declare const recursiveSanitizeQuery: (query: any, fieldMap: Map, return_query?: any) => any; 8 | -------------------------------------------------------------------------------- /dist/esm/web/src/contexts/wasm/utils/select-utils.js: -------------------------------------------------------------------------------- 1 | var _a;import{_selectionOperatorResolver}from"../../../constants/selections";import{FieldSubtype}from"../../../constants/fields";import{RESERVED_INVALID_VALUE}from"../../../constants/invalid-data";import dataParserStore from"../../../data/dataParsers/store";import{isValidString}from"../fields/utils";var subtypeParserRegister=((_a={})[FieldSubtype.TEMPORAL]=function(e,r){var t=e;if("number"!=typeof e){var i=dataParserStore.get(FieldSubtype.TEMPORAL);t=i?i.parse(e,r):e}return t},_a[FieldSubtype.CATEGORICAL]=function(e,r){var t=dataParserStore.get(FieldSubtype.CATEGORICAL),i=t?t.parse(e,r):e;return isValidString(i)?i:RESERVED_INVALID_VALUE},_a[FieldSubtype.CONTINUOUS]=function(e,r){var t=dataParserStore.get(FieldSubtype.CONTINUOUS);return null==t?void 0:t.parse(e,r)},_a);export var getRawValue=function(e,r,t){var i=subtypeParserRegister[e];return i?i(r,t):r};export var recursiveSanitizeQuery=function(e,r,t){void 0===t&&(t={});var i=e.conditions,o=e.operator;if(i&&o&&i.length>0){t.conditions=[];for(var a=0;a; 13 | sort(sortingDetails: [[string, SortOrder]]): ContextContract; 14 | groupBy(fields: string[], reducers: { 15 | field: string; 16 | aggn: AggregationType; 17 | }[], options?: any): ContextContract; 18 | select(query: any, options?: { 19 | mode: FilteringModesType; 20 | }): ContextContract | ContextContract[]; 21 | splitByRow(fields: string[]): ContextContract[]; 22 | project(fields: string[], options?: { 23 | mode: FilteringModesType; 24 | }): ContextContract | ContextContract[]; 25 | clone(dataMeta: DataMeta): ContextContract; 26 | dispose(removeFields: { 27 | disposeFields: boolean; 28 | disposePartialFields: { 29 | dispose: boolean; 30 | values: string[]; 31 | }; 32 | }): void; 33 | getDataMeta(): DataMeta; 34 | addIdField(ids: number[]): ContextContract; 35 | getMatchingIds(dm: ContextContract): number[]; 36 | calculateVariable(fieldInfo: Schema, fields: string[], fn: (...params: (string | number | Invalid)[]) => string | number): ContextContract; 37 | context(): any; 38 | } 39 | -------------------------------------------------------------------------------- /dist/esm/web/src/contracts/context.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chartshq/datamodel/c03366dd81bebc83b21cc5bbaaad40b61b68a58c/dist/esm/web/src/contracts/context.js -------------------------------------------------------------------------------- /dist/esm/web/src/contracts/data.d.ts: -------------------------------------------------------------------------------- 1 | import { FieldType, FieldSubtype } from '../constants/fields'; 2 | import { AggregationType } from '../constants/aggregations'; 3 | import Invalid from '../data/invalid/invalid'; 4 | export interface Schema { 5 | name: string; 6 | type: FieldType; 7 | subtype?: FieldSubtype; 8 | defAggFn?: AggregationType; 9 | format?: string | Function; 10 | displayName?: string; 11 | } 12 | /** 13 | * This will act as the data input during datamodel intialization. 14 | */ 15 | export interface Data { 16 | schema: Array; 17 | data: Array<(string | undefined | null)[] | number[]>; 18 | } 19 | /** 20 | * This will act as the data input during datamodel intialization. 21 | */ 22 | export interface ResultData { 23 | schema: Array; 24 | data: (string | number | Invalid)[][]; 25 | } 26 | export interface DataMeta { 27 | rows: number; 28 | columns: number; 29 | } 30 | export declare enum DataFormat { 31 | FLAT_JSON = "FlatJSON", 32 | DSV_STR = "DSVStr", 33 | DSV_ARR = "DSVArr", 34 | AUTO = "Auto" 35 | } 36 | export interface LoadDataOptions { 37 | name?: string; 38 | dataFormat?: DataFormat; 39 | firstRowHeader?: boolean; 40 | fieldSeparator?: string; 41 | useWorker?: boolean; 42 | } 43 | export declare type RawData = object[] | JSON | string | [string[] | number[]]; 44 | export interface LoadDataParams { 45 | data: RawData; 46 | schema: Schema[]; 47 | options: LoadDataOptions; 48 | } 49 | export interface DataConverter { 50 | _type: string; 51 | convert(data: object | string, schema: Schema[], options: LoadDataOptions): Data; 52 | } 53 | -------------------------------------------------------------------------------- /dist/esm/web/src/contracts/data.js: -------------------------------------------------------------------------------- 1 | export var DataFormat;!function(a){a.FLAT_JSON="FlatJSON",a.DSV_STR="DSVStr",a.DSV_ARR="DSVArr",a.AUTO="Auto"}(DataFormat||(DataFormat={})); -------------------------------------------------------------------------------- /dist/esm/web/src/contracts/dataWranglers.d.ts: -------------------------------------------------------------------------------- 1 | import AbstractDataModel from './datamodel'; 2 | import { SortOrder } from '../constants/sort'; 3 | export interface DataWranglingOperations { 4 | stackBy(dm: AbstractDataModel, splitingfield: string, colorFieldName: string, measureField: string, sortOrder: SortOrder): { 5 | y0: number[]; 6 | y1: number[]; 7 | id: number[]; 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /dist/esm/web/src/contracts/dataWranglers.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chartshq/datamodel/c03366dd81bebc83b21cc5bbaaad40b61b68a58c/dist/esm/web/src/contracts/dataWranglers.js -------------------------------------------------------------------------------- /dist/esm/web/src/contracts/datamodel.d.ts: -------------------------------------------------------------------------------- 1 | import { AggregationType } from '../constants/aggregations'; 2 | import { ComparisonOperatorsType, LogicalOperatorsType } from '../constants/selections'; 3 | import { FilteringModesType } from '../constants/filtering-modes'; 4 | import { SortOrder } from '../constants/sort'; 5 | import { Data, Schema, LoadDataOptions, RawData, ResultData, DataMeta } from './data'; 6 | import { AbstractWasmField } from '../contexts/wasm/fields/field'; 7 | import DateTimeFormatter from '../data/utils/date-time-formatter'; 8 | import { FieldType, FieldSubtype } from '../constants/fields'; 9 | import { Operations } from '../constants/miscellaneous'; 10 | import Invalid from '../data/invalid/invalid'; 11 | import { ContextContract } from './context'; 12 | declare abstract class AbstractDataModel { 13 | static AggregationFunctions: typeof AggregationType; 14 | static ComparisonOperators: typeof ComparisonOperatorsType; 15 | static FilteringModes: typeof FilteringModesType; 16 | static LogicalOperators: typeof LogicalOperatorsType; 17 | static DateTimeFormatter: typeof DateTimeFormatter; 18 | static FieldType: typeof FieldType; 19 | static FieldSubtype: typeof FieldSubtype; 20 | static DerivationOperations: typeof Operations; 21 | static SortOrder: typeof SortOrder; 22 | static Invalid: typeof Invalid; 23 | static DataWranglers: import("./dataWranglers").DataWranglingOperations; 24 | private static _taskerPool; 25 | static loadData(data: RawData, schema: Schema[], options: LoadDataOptions): Promise; 26 | static defaultAggregation: (agg?: AggregationType) => AggregationType; 27 | abstract getParent(): AbstractDataModel | undefined; 28 | abstract detachParent(): AbstractDataModel | undefined; 29 | abstract getChildren(): Array; 30 | abstract removeChild(datamodel: AbstractDataModel): void; 31 | abstract getData(): ResultData; 32 | abstract getDataMeta(): DataMeta; 33 | abstract getSchema(): Array; 34 | abstract getField(name: string): AbstractWasmField | undefined; 35 | abstract clone(): AbstractDataModel; 36 | abstract sort(sortingDetails: [[string, SortOrder]]): AbstractDataModel; 37 | abstract select(query: any, options?: { 38 | mode: FilteringModesType; 39 | }): AbstractDataModel | AbstractDataModel[]; 40 | abstract splitByRow(fields: string[]): AbstractDataModel[]; 41 | abstract project(fields: string[], options?: { 42 | mode: FilteringModesType; 43 | }): AbstractDataModel | AbstractDataModel[]; 44 | abstract groupBy(fields: string[], reducers: { 45 | field: string; 46 | aggn: AggregationType; 47 | }[], options?: {}): AbstractDataModel; 48 | abstract dispose(): void; 49 | abstract calculateVariable(fieldInfo: Schema, fields: string[], fn: (...params: (string | number | Invalid)[]) => string | number): AbstractDataModel; 50 | abstract context(): ContextContract; 51 | } 52 | export default AbstractDataModel; 53 | -------------------------------------------------------------------------------- /dist/esm/web/src/contracts/datamodel.js: -------------------------------------------------------------------------------- 1 | var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(r){for(var t,a=1,o=arguments.length;a} Returns an array of headers and column major data. 8 | */ 9 | declare function Auto(data: RawData, schema: Schema[], options: LoadDataOptions): Data; 10 | export default Auto; 11 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/dataParsers/auto-resolver.js: -------------------------------------------------------------------------------- 1 | import FlatJSON from"./flat-json";import DSVArr from"./dsv-arr";import DSVStr from"./dsv-str";import{detectDataFormat}from"../utils/index";function Auto(t,r,o){var a={FlatJSON:FlatJSON,DSVStr:DSVStr,DSVArr:DSVArr},e=detectDataFormat(t);if(!e)throw new Error("Could not detect the data format");return a[e](t,r,o)}export default Auto; -------------------------------------------------------------------------------- /dist/esm/web/src/data/dataParsers/dsv-arr.d.ts: -------------------------------------------------------------------------------- 1 | import { Schema, LoadDataOptions, Data } from '../../contracts/data'; 2 | /** 3 | * Parses and converts data formatted in DSV array to a manageable internal format. 4 | * 5 | * @param {Array.} arr - A 2D array containing of the DSV data. 6 | * @param {Object} options - Option to control the behaviour of the parsing. 7 | * @param {boolean} [options.firstRowHeader=true] - Whether the first row of the dsv data is header or not. 8 | * @return {Array} Returns an array of headers and column major data. 9 | * @example 10 | * 11 | * // Sample input data: 12 | * const data = [ 13 | * ["a", "b", "c"], 14 | * [1, 2, 3], 15 | * [4, 5, 6], 16 | * [7, 8, 9] 17 | * ]; 18 | */ 19 | declare function DSVArr(arr: (string[] | number[])[], schema: Schema[], options: LoadDataOptions): Data; 20 | export default DSVArr; 21 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/dataParsers/dsv-arr.js: -------------------------------------------------------------------------------- 1 | var __read=this&&this.__read||function(r,e){var t="function"==typeof Symbol&&r[Symbol.iterator];if(!t)return r;var a,o,n=t.call(r),i=[];try{for(;(void 0===e||e-- >0)&&!(a=n.next()).done;)i.push(a.value)}catch(r){o={error:r}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(o)throw o.error}}return i},__spread=this&&this.__spread||function(){for(var r=[],e=0;e} arr - The input data formatted in JSON. 6 | * @return {Array.} Returns an array of headers and column major data. 7 | * @example 8 | * 9 | * // Sample input data: 10 | * const data = [ 11 | * { 12 | * "a": 1, 13 | * "b": 2, 14 | * "c": 3 15 | * }, 16 | * { 17 | * "a": 4, 18 | * "b": 5, 19 | * "c": 6 20 | * }, 21 | * { 22 | * "a": 7, 23 | * "b": 8, 24 | * "c": 9 25 | * } 26 | * ]; 27 | */ 28 | declare function FlatJSON(arr: { 29 | [type: string]: string | number; 30 | }[], schema: Schema[]): Data; 31 | export default FlatJSON; 32 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/dataParsers/flat-json.js: -------------------------------------------------------------------------------- 1 | var __read=this&&this.__read||function(r,t){var a="function"==typeof Symbol&&r[Symbol.iterator];if(!a)return r;var e,o,n=a.call(r),i=[];try{for(;(void 0===t||t-- >0)&&!(e=n.next()).done;)i.push(e.value)}catch(r){o={error:r}}finally{try{e&&!e.done&&(a=n.return)&&a.call(n)}finally{if(o)throw o.error}}return i},__spread=this&&this.__spread||function(){for(var r=[],t=0;t; 4 | constructor(); 5 | private _getDefaultParsers; 6 | /** 7 | * Sets the given parsers in the store and returns the store 8 | * @param {Array} parsers : contains array of parsers instance 9 | * @return {Map} 10 | */ 11 | parsers(parsers: FieldContract[]): Map; 12 | /** 13 | * Registers a parsers 14 | * @param {DataConverter} parser : parser Instance 15 | */ 16 | register(parser: FieldContract): DataParserStore; 17 | /** 18 | * Removes a parser from store 19 | * @param {FieldContract} parser : parser Instance 20 | */ 21 | unregister(parser: FieldContract): DataParserStore; 22 | get(name: string | undefined): FieldContract | null | undefined; 23 | } 24 | declare const dataParserStore: DataParserStore; 25 | export default dataParserStore; 26 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/dataParsers/store.js: -------------------------------------------------------------------------------- 1 | import{CategoricalParser,ContinuousParser,TemporalParser}from"../fieldParsers";var DataParserStore=function(){function r(){this.store=new Map,this.parsers(this._getDefaultParsers())}return r.prototype._getDefaultParsers=function(){return[new CategoricalParser,new ContinuousParser,new TemporalParser]},r.prototype.parsers=function(r){var t=this;return r.forEach(function(r){return t.register(r)}),this.store},r.prototype.register=function(r){return this.store.set(r._type,r),this},r.prototype.unregister=function(r){return this.store.delete(r._type),this},r.prototype.get=function(r){return r&&this.store.has(r)?this.store.get(r):null},r}(),dataParserStore=function(){var r=null;return r||(r=new DataParserStore)}();export default dataParserStore; -------------------------------------------------------------------------------- /dist/esm/web/src/data/defaultConverters/autoConverter.d.ts: -------------------------------------------------------------------------------- 1 | import { DataConverter, Schema, LoadDataOptions, RawData, Data } from '../../contracts/data'; 2 | export default class AutoDataConverter implements DataConverter { 3 | _type: string; 4 | get type(): string; 5 | convert(data: RawData, schema: Schema[], options: LoadDataOptions): Data; 6 | } 7 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/defaultConverters/autoConverter.js: -------------------------------------------------------------------------------- 1 | import{DataFormat}from"../../contracts/data";import AUTO from"../dataParsers/auto-resolver";var AutoDataConverter=function(){function t(){this._type=DataFormat.AUTO}return Object.defineProperty(t.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),t.prototype.convert=function(t,r,e){return AUTO(t,r,e)},t}();export default AutoDataConverter; -------------------------------------------------------------------------------- /dist/esm/web/src/data/defaultConverters/dsvArrayConverter.d.ts: -------------------------------------------------------------------------------- 1 | import { DataConverter, Schema, LoadDataOptions, Data } from '../../contracts/data'; 2 | export default class DSVArrayConverter implements DataConverter { 3 | _type: string; 4 | get type(): string; 5 | convert(data: (string[] | number[])[], schema: Schema[], options: LoadDataOptions): Data; 6 | } 7 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/defaultConverters/dsvArrayConverter.js: -------------------------------------------------------------------------------- 1 | import{DataFormat}from"../../contracts/data";import DSVArr from"../dataParsers/dsv-arr";var DSVArrayConverter=function(){function r(){this._type=DataFormat.DSV_ARR}return Object.defineProperty(r.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),r.prototype.convert=function(r,t,e){return DSVArr(r,t,e)},r}();export default DSVArrayConverter; -------------------------------------------------------------------------------- /dist/esm/web/src/data/defaultConverters/dsvStringConverter.d.ts: -------------------------------------------------------------------------------- 1 | import { DataConverter, Schema, LoadDataOptions, Data } from '../../contracts/data'; 2 | export default class DSVStringConverter implements DataConverter { 3 | _type: string; 4 | get type(): string; 5 | convert(data: string, schema: Schema[], options: LoadDataOptions): Data; 6 | } 7 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/defaultConverters/dsvStringConverter.js: -------------------------------------------------------------------------------- 1 | import{DataFormat}from"../../contracts/data";import DSVStr from"../dataParsers/dsv-str";var DSVStringConverter=function(){function t(){this._type=DataFormat.DSV_STR}return Object.defineProperty(t.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),t.prototype.convert=function(t,r,e){return DSVStr(t,r,e)},t}();export default DSVStringConverter; -------------------------------------------------------------------------------- /dist/esm/web/src/data/defaultConverters/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default as DSVStringConverter } from './dsvStringConverter'; 2 | export { default as JSONConverter } from './jsonConverter'; 3 | export { default as DSVArrayConverter } from './dsvArrayConverter'; 4 | export { default as AutoDataConverter } from './autoConverter'; 5 | export { default as convertorStore } from './store'; 6 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/defaultConverters/index.js: -------------------------------------------------------------------------------- 1 | export{default as DSVStringConverter}from"./dsvStringConverter";export{default as JSONConverter}from"./jsonConverter";export{default as DSVArrayConverter}from"./dsvArrayConverter";export{default as AutoDataConverter}from"./autoConverter";export{default as convertorStore}from"./store"; -------------------------------------------------------------------------------- /dist/esm/web/src/data/defaultConverters/jsonConverter.d.ts: -------------------------------------------------------------------------------- 1 | import { DataConverter, Schema, Data } from '../../contracts/data'; 2 | export default class JSONConverter implements DataConverter { 3 | _type: string; 4 | get type(): string; 5 | convert(data: { 6 | [type: string]: string | number; 7 | }[], schema: Schema[]): Data; 8 | } 9 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/defaultConverters/jsonConverter.js: -------------------------------------------------------------------------------- 1 | import{DataFormat}from"../../contracts/data";import FlatJSON from"../dataParsers/flat-json";var JSONConverter=function(){function t(){this._type=DataFormat.FLAT_JSON}return Object.defineProperty(t.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),t.prototype.convert=function(t,r){return FlatJSON(t,r)},t}();export default JSONConverter; -------------------------------------------------------------------------------- /dist/esm/web/src/data/defaultConverters/store.d.ts: -------------------------------------------------------------------------------- 1 | import { DataConverter } from '../../contracts/data'; 2 | declare class DataConverterStore { 3 | store: Map; 4 | constructor(); 5 | private _getDefaultConverters; 6 | /** 7 | * Sets the given converters in the store and returns the store 8 | * @param {Array} converters : contains array of converter instance 9 | * @return { Map } 10 | */ 11 | converters(converters: DataConverter[]): Map; 12 | /** 13 | * Registers a Converter of type DataConverter 14 | * @param {DataConverter} converter : converter Instance 15 | * @returns self 16 | */ 17 | register(converter: DataConverter): this | null; 18 | /** 19 | * Removes a converter from store 20 | * @param {DataConverter} converter : converter Instance 21 | * @returns self 22 | */ 23 | unregister(converter: DataConverter): this; 24 | get(name: string | undefined): DataConverter | null | undefined; 25 | } 26 | declare const converterStore: DataConverterStore; 27 | export default converterStore; 28 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/defaultConverters/store.js: -------------------------------------------------------------------------------- 1 | import{DSVStringConverter,DSVArrayConverter,JSONConverter,AutoDataConverter}from"./index";var DataConverterStore=function(){function t(){this.store=new Map,this.converters(this._getDefaultConverters())}return t.prototype._getDefaultConverters=function(){return[new DSVStringConverter,new DSVArrayConverter,new JSONConverter,new AutoDataConverter]},t.prototype.converters=function(t){var e=this;return t.forEach(function(t){return e.store.set(t._type,t)}),this.store},t.prototype.register=function(t){return this.store.set(t._type,t),this},t.prototype.unregister=function(t){return this.store.delete(t._type),this},t.prototype.get=function(t){return t&&this.store.has(t)?this.store.get(t):null},t}(),converterStore=function(){var t=null;return t||(t=new DataConverterStore)}();export default converterStore; -------------------------------------------------------------------------------- /dist/esm/web/src/data/fieldParsers/categorical.d.ts: -------------------------------------------------------------------------------- 1 | import { FieldContract } from './index'; 2 | import { FieldSubtype } from '../../constants/fields'; 3 | declare class CategoricalParser implements FieldContract { 4 | _type: FieldSubtype.CATEGORICAL; 5 | get type(): FieldSubtype.CATEGORICAL; 6 | /** 7 | * Parses a single value to string if not already in string format 8 | * 9 | * @public 10 | * @param {string|number} val - The value of the field. 11 | * @return {string} Returns the string representation of the value. 12 | */ 13 | parse(val: number | string | null | undefined): string | null | undefined | number; 14 | } 15 | export { CategoricalParser }; 16 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/fieldParsers/categorical.js: -------------------------------------------------------------------------------- 1 | import{FieldSubtype}from"../../constants/fields";var CategoricalParser=function(){function e(){this._type=FieldSubtype.CATEGORICAL}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),e.prototype.parse=function(e){return"number"==typeof e?String(e):e},e}();export{CategoricalParser}; -------------------------------------------------------------------------------- /dist/esm/web/src/data/fieldParsers/continuous.d.ts: -------------------------------------------------------------------------------- 1 | import { FieldContract } from './index'; 2 | import { FieldSubtype } from '../../constants/fields'; 3 | declare class ContinuousParser implements FieldContract { 4 | _type: FieldSubtype.CONTINUOUS; 5 | get type(): FieldSubtype.CONTINUOUS; 6 | parse(val: number | string | null | undefined): number; 7 | } 8 | export { ContinuousParser }; 9 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/fieldParsers/continuous.js: -------------------------------------------------------------------------------- 1 | import{FieldSubtype}from"../../constants/fields";var ContinuousParser=function(){function e(){this._type=FieldSubtype.CONTINUOUS}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),e.prototype.parse=function(e){return e||0===e?Number(e):NaN},e}();export{ContinuousParser}; -------------------------------------------------------------------------------- /dist/esm/web/src/data/fieldParsers/field-contract.d.ts: -------------------------------------------------------------------------------- 1 | import { FieldSubtype } from '../../constants/fields'; 2 | interface FieldContract { 3 | _type: FieldSubtype; 4 | parse(val: string | number | undefined | null, format: string | Function): string | number | null | undefined; 5 | } 6 | export { FieldContract }; 7 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/fieldParsers/field-contract.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chartshq/datamodel/c03366dd81bebc83b21cc5bbaaad40b61b68a58c/dist/esm/web/src/data/fieldParsers/field-contract.js -------------------------------------------------------------------------------- /dist/esm/web/src/data/fieldParsers/index.d.ts: -------------------------------------------------------------------------------- 1 | export { FieldContract } from './field-contract'; 2 | export { CategoricalParser } from './categorical'; 3 | export { ContinuousParser } from './continuous'; 4 | export { TemporalParser } from './temporal'; 5 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/fieldParsers/index.js: -------------------------------------------------------------------------------- 1 | export{CategoricalParser}from"./categorical";export{ContinuousParser}from"./continuous";export{TemporalParser}from"./temporal"; -------------------------------------------------------------------------------- /dist/esm/web/src/data/fieldParsers/temporal.d.ts: -------------------------------------------------------------------------------- 1 | import { FieldContract } from './index'; 2 | import { FieldSubtype } from '../../constants/fields'; 3 | declare class TemporalParser implements FieldContract { 4 | _dtf: any; 5 | _type: FieldSubtype.TEMPORAL; 6 | get type(): FieldSubtype.TEMPORAL; 7 | /** 8 | * Parses a single value of a field and returns the millisecond value. 9 | * 10 | * @public 11 | * @param {string|number} val - The value of the field. 12 | * @return {number} Returns the millisecond value. 13 | */ 14 | parse(val: string | number | null | undefined, format: string | Function): number; 15 | } 16 | export { TemporalParser }; 17 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/fieldParsers/temporal.js: -------------------------------------------------------------------------------- 1 | import DateTimeFormatter from"../utils/date-time-formatter";import{FieldSubtype}from"../../constants/fields";import{DEFAULT}from"../../constants/miscellaneous";var TemporalParser=function(){function t(){this._type=FieldSubtype.TEMPORAL}return Object.defineProperty(t.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),t.prototype.parse=function(t,e){var r=DEFAULT;if(this._dtf={},t){var i=t;e&&"string"==typeof e?(i=String(t),r=e,this._dtf&&this._dtf[r]||(this._dtf[r]=new DateTimeFormatter(r))):(i=Number(t),this._dtf&&this._dtf.default||(this._dtf.default=new DateTimeFormatter));var a=this._dtf[r].getNativeDate(i);return a?a.getTime():NaN}return NaN},t}();export{TemporalParser}; -------------------------------------------------------------------------------- /dist/esm/web/src/data/index.d.ts: -------------------------------------------------------------------------------- 1 | import { LoadDataParams, Data } from '../contracts/data'; 2 | import { Tasker } from '../contracts/tasker'; 3 | export declare const getFormattedData: (rawData: LoadDataParams, taskerPool?: Tasker[] | undefined) => Promise; 4 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/index.js: -------------------------------------------------------------------------------- 1 | var __awaiter=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(a,o){function i(t){try{c(r.next(t))}catch(t){o(t)}}function u(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(i,u)}c((r=r.apply(t,e||[])).next())})},__generator=this&&this.__generator||function(t,e){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(a=2&o[0]?r.return:o[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]; 3 | constructor(); 4 | setInvalids(invalidMap: string[]): void; 5 | getInvalids(): Set; 6 | unsetInvalids(invalidMap: string[]): void; 7 | isInvalid(value: string): boolean; 8 | } 9 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/invalid/store.js: -------------------------------------------------------------------------------- 1 | import{InvalidType}from"../../constants/invalid-data";var InvalidStore=function(){function t(){this._defaultInvalids=new Set;var t=Object.values(InvalidType);for(var n in t){var a=t[n];this._defaultInvalids.add(a)}}return t.prototype.setInvalids=function(t){var n=this;t.forEach(function(t){return n._defaultInvalids.add(t)})},t.prototype.getInvalids=function(){return this._defaultInvalids},t.prototype.unsetInvalids=function(t){for(var n in t)this._defaultInvalids.delete(t[n])},t.prototype.isInvalid=function(t){return this._defaultInvalids.has(t)},t}();export default InvalidStore; -------------------------------------------------------------------------------- /dist/esm/web/src/data/utils/column-major.d.ts: -------------------------------------------------------------------------------- 1 | declare const _default: (store: any) => Function; 2 | /** 3 | * The utility function to calculate major column. 4 | * 5 | * @param {Object} store - The store object. 6 | * @return {Function} Returns the push function. 7 | */ 8 | export default _default; 9 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/utils/column-major.js: -------------------------------------------------------------------------------- 1 | export default function(r){var n=0;return function(){for(var t=[],f=0;f (val: any) => any; 22 | var defaultRangeParser: (range: any, defVal: any) => (val: any) => any; 23 | var getTokenDefinitions: () => { 24 | H: { 25 | name: string; 26 | index: number; 27 | extract(): string; 28 | parser: (val: any) => any; 29 | formatter(val: any): string; 30 | }; 31 | l: { 32 | name: string; 33 | index: number; 34 | extract(): string; 35 | parser: (val: any) => any; 36 | formatter(val: any): string; 37 | }; 38 | p: { 39 | name: string; 40 | index: number; 41 | extract(): string; 42 | parser: (val: any) => any; 43 | formatter: (val: any) => "AM" | "PM"; 44 | }; 45 | P: { 46 | name: string; 47 | index: number; 48 | extract(): string; 49 | parser: (val: any) => any; 50 | formatter: (val: any) => "am" | "pm"; 51 | }; 52 | M: { 53 | name: string; 54 | index: number; 55 | extract(): string; 56 | parser: (val: any) => any; 57 | formatter(val: any): any; 58 | }; 59 | S: { 60 | name: string; 61 | index: number; 62 | extract(): string; 63 | parser: (val: any) => any; 64 | formatter(val: any): any; 65 | }; 66 | K: { 67 | name: string; 68 | index: number; 69 | extract(): string; 70 | parser: (val: any) => any; 71 | formatter(val: any): string; 72 | }; 73 | a: { 74 | name: string; 75 | index: number; 76 | extract(): string; 77 | parser: (val: any) => any; 78 | formatter(val: any): string; 79 | }; 80 | A: { 81 | name: string; 82 | index: number; 83 | extract(): string; 84 | parser: (val: any) => any; 85 | formatter(val: any): string; 86 | }; 87 | e: { 88 | name: string; 89 | index: number; 90 | extract(): string; 91 | parser: (val: any) => any; 92 | formatter(val: any): string; 93 | }; 94 | d: { 95 | name: string; 96 | index: number; 97 | extract(): string; 98 | parser: (val: any) => any; 99 | formatter(val: any): any; 100 | }; 101 | b: { 102 | name: string; 103 | index: number; 104 | extract(): string; 105 | parser: (val: any) => any; 106 | formatter(val: any): string; 107 | }; 108 | B: { 109 | name: string; 110 | index: number; 111 | extract(): string; 112 | parser: (val: any) => any; 113 | formatter(val: any): string; 114 | }; 115 | m: { 116 | name: string; 117 | index: number; 118 | extract(): string; 119 | parser(val: any): number; 120 | formatter(val: any): any; 121 | }; 122 | y: { 123 | name: string; 124 | index: number; 125 | extract(): string; 126 | parser(val: any): number; 127 | formatter(val: any): string; 128 | }; 129 | Y: { 130 | name: string; 131 | index: number; 132 | extract(): string; 133 | parser: (val: any) => any; 134 | formatter(val: any): string; 135 | }; 136 | }; 137 | var getTokenFormalNames: () => { 138 | HOUR: { 139 | name: string; 140 | index: number; 141 | extract(): string; 142 | parser: (val: any) => any; 143 | formatter(val: any): string; 144 | }; 145 | HOUR_12: { 146 | name: string; 147 | index: number; 148 | extract(): string; 149 | parser: (val: any) => any; 150 | formatter(val: any): string; 151 | }; 152 | AMPM_UPPERCASE: { 153 | name: string; 154 | index: number; 155 | extract(): string; 156 | parser: (val: any) => any; 157 | formatter: (val: any) => "AM" | "PM"; 158 | }; 159 | AMPM_LOWERCASE: { 160 | name: string; 161 | index: number; 162 | extract(): string; 163 | parser: (val: any) => any; 164 | formatter: (val: any) => "am" | "pm"; 165 | }; 166 | MINUTE: { 167 | name: string; 168 | index: number; 169 | extract(): string; 170 | parser: (val: any) => any; 171 | formatter(val: any): any; 172 | }; 173 | SECOND: { 174 | name: string; 175 | index: number; 176 | extract(): string; 177 | parser: (val: any) => any; 178 | formatter(val: any): any; 179 | }; 180 | SHORT_DAY: { 181 | name: string; 182 | index: number; 183 | extract(): string; 184 | parser: (val: any) => any; 185 | formatter(val: any): string; 186 | }; 187 | LONG_DAY: { 188 | name: string; 189 | index: number; 190 | extract(): string; 191 | parser: (val: any) => any; 192 | formatter(val: any): string; 193 | }; 194 | DAY_OF_MONTH: { 195 | name: string; 196 | index: number; 197 | extract(): string; 198 | parser: (val: any) => any; 199 | formatter(val: any): string; 200 | }; 201 | DAY_OF_MONTH_CONSTANT_WIDTH: { 202 | name: string; 203 | index: number; 204 | extract(): string; 205 | parser: (val: any) => any; 206 | formatter(val: any): any; 207 | }; 208 | SHORT_MONTH: { 209 | name: string; 210 | index: number; 211 | extract(): string; 212 | parser: (val: any) => any; 213 | formatter(val: any): string; 214 | }; 215 | LONG_MONTH: { 216 | name: string; 217 | index: number; 218 | extract(): string; 219 | parser: (val: any) => any; 220 | formatter(val: any): string; 221 | }; 222 | MONTH_OF_YEAR: { 223 | name: string; 224 | index: number; 225 | extract(): string; 226 | parser(val: any): number; 227 | formatter(val: any): any; 228 | }; 229 | SHORT_YEAR: { 230 | name: string; 231 | index: number; 232 | extract(): string; 233 | parser(val: any): number; 234 | formatter(val: any): string; 235 | }; 236 | LONG_YEAR: { 237 | name: string; 238 | index: number; 239 | extract(): string; 240 | parser: (val: any) => any; 241 | formatter(val: any): string; 242 | }; 243 | }; 244 | var tokenResolver: () => { 245 | YEAR: ({ 246 | name: string; 247 | index: number; 248 | extract(): string; 249 | parser: (val: any) => any; 250 | formatter(val: any): string; 251 | } | ((...args: any[]) => any))[]; 252 | MONTH: ({ 253 | name: string; 254 | index: number; 255 | extract(): string; 256 | parser: (val: any) => any; 257 | formatter(val: any): string; 258 | } | { 259 | name: string; 260 | index: number; 261 | extract(): string; 262 | parser(val: any): number; 263 | formatter(val: any): any; 264 | } | ((...args: any[]) => any))[]; 265 | DAY: ({ 266 | name: string; 267 | index: number; 268 | extract(): string; 269 | parser: (val: any) => any; 270 | formatter(val: any): any; 271 | } | ((...args: any[]) => any))[]; 272 | HOUR: ({ 273 | name: string; 274 | index: number; 275 | extract(): string; 276 | parser: (val: any) => any; 277 | formatter(val: any): string; 278 | } | ((hourFormat24: any, hourFormat12: any, ampmLower: any, ampmUpper: any) => any))[]; 279 | MINUTE: ({ 280 | name: string; 281 | index: number; 282 | extract(): string; 283 | parser: (val: any) => any; 284 | formatter(val: any): any; 285 | } | ((...args: any[]) => any))[]; 286 | SECOND: ({ 287 | name: string; 288 | index: number; 289 | extract(): string; 290 | parser: (val: any) => any; 291 | formatter(val: any): any; 292 | } | ((...args: any[]) => any))[]; 293 | MILLISECOND: ({ 294 | name: string; 295 | index: number; 296 | extract(): string; 297 | parser: (val: any) => any; 298 | formatter(val: any): string; 299 | } | ((...args: any[]) => any))[]; 300 | }; 301 | var findTokens: (format: any) => { 302 | index: any; 303 | token: any; 304 | }[]; 305 | var formatAs: (date: any, format: any) => string; 306 | } 307 | export { DateTimeFormatter as default }; 308 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/utils/date-time-formatter.js: -------------------------------------------------------------------------------- 1 | var __read=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,a,o=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(e){a={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(a)throw a.error}}return i},__spread=this&&this.__spread||function(){for(var e=[],t=0;ta.getFullYear()&&(t=""+(o-1)+n),convertToNativeDate(t).getFullYear()},formatter:function(e){var t,r=convertToNativeDate(e).getFullYear().toString();return r&&(t=r.length,r=r.substring(t-2,t)),r}},Y:{name:"Y",index:0,extract:function(){return"(\\d{4})"},parser:DateTimeFormatter.defaultNumberParser(),formatter:function(e){return convertToNativeDate(e).getFullYear().toString()}}}},DateTimeFormatter.getTokenFormalNames=function(){var e=DateTimeFormatter.getTokenDefinitions();return{HOUR:e.H,HOUR_12:e.l,AMPM_UPPERCASE:e.p,AMPM_LOWERCASE:e.P,MINUTE:e.M,SECOND:e.S,SHORT_DAY:e.a,LONG_DAY:e.A,DAY_OF_MONTH:e.e,DAY_OF_MONTH_CONSTANT_WIDTH:e.d,SHORT_MONTH:e.b,LONG_MONTH:e.B,MONTH_OF_YEAR:e.m,SHORT_YEAR:e.y,LONG_YEAR:e.Y}},DateTimeFormatter.tokenResolver=function(){var e=DateTimeFormatter.getTokenDefinitions(),t=function(){for(var e=[],t=0;t=0;)r=e[t+1],-1!==o.indexOf(r)&&i.push({index:t,token:r});return i},DateTimeFormatter.formatAs=function(e,t){var r,n,a,o,i=convertToNativeDate(e),u=DateTimeFormatter.findTokens(t),m=DateTimeFormatter.getTokenDefinitions(),f=String(t),s=DateTimeFormatter.TOKEN_PREFIX;for(a=0,o=u.length;a=0;u--)(n=c[u].index)+1!==o.length-1?(void 0===t&&(t=o.length),a=o.substring(n+2,t),o=o.substring(0,n+2)+RegExp.escape(a)+o.substring(t,o.length),t=n):t=n;for(u=0;u string; 38 | /** 39 | * Checks Whether two arrays have same content. 40 | * 41 | * @param {Array} arr1 - The first array. 42 | * @param {Array} arr2 - The 2nd array. 43 | * @return {boolean} Returns whether two array have same content. 44 | */ 45 | export declare function isArrEqual(arr1: number[] | string[], arr2: number[] | string[]): boolean; 46 | /** 47 | * It is the default number format function for the measure field type. 48 | * 49 | * @param {any} val - The input value. 50 | * @return {number} Returns a number value. 51 | */ 52 | export declare function formatNumber(val: number): number; 53 | /** 54 | * Returns the detected data format. 55 | * 56 | * @param {any} data - The input data to be tested. 57 | * @return {string} Returns the data format name. 58 | */ 59 | export declare const detectDataFormat: (data: any) => string | null; 60 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/utils/helper.js: -------------------------------------------------------------------------------- 1 | import{DataFormat}from"../../contracts/data";export function isArray(r){return Array.isArray(r)}export function isObject(r){return r===Object(r)}export function isString(r){return"string"==typeof r}export function isCallable(r){return"function"==typeof r}export function uniqueValues(r){return Array.from(new Set(r))}export var getUniqueId=function(){return"id-"+(new Date).getTime()+Math.round(1e4*Math.random())};export function isArrEqual(r,t){if(!isArray(r)||!isArray(t))return r===t;if(r.length!==t.length)return!1;for(var n=0;n Data; 11 | declare const _default: (data: RawData, schema: Schema[], options: LoadDataOptions, taskerPool?: Tasker[] | undefined) => Promise; 12 | export default _default; 13 | -------------------------------------------------------------------------------- /dist/esm/web/src/data/utils/transform-data.js: -------------------------------------------------------------------------------- 1 | var __awaiter=this&&this.__awaiter||function(t,r,e,n){return new(e||(e=Promise))(function(a,o){function i(t){try{u(n.next(t))}catch(t){o(t)}}function c(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var r;t.done?a(t.value):(r=t.value,r instanceof e?r:new e(function(t){t(r)})).then(i,c)}u((n=n.apply(t,r||[])).next())})},__generator=this&&this.__generator||function(t,r){var e,n,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(e)throw new TypeError("Generator is already executing.");for(;i;)try{if(e=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1] Promise; 3 | }; 4 | export default engine; 5 | -------------------------------------------------------------------------------- /dist/esm/web/src/index.js: -------------------------------------------------------------------------------- 1 | var __awaiter=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(a,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function u(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,u)}c((r=r.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){var n,r,a,i,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(a=2&i[0]?r.return:i[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;switch(r=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,r=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===i[0]||2===i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]; 24 | static setContext(context?: ContextType): void; 25 | constructor(formattedData: Data | DataModel); 26 | private setWasmContext; 27 | private setContextInfo; 28 | private sanitizeSchema; 29 | private cloneFromContext; 30 | static setInvalids(value: string[]): void; 31 | static unsetInvalids(value: string[]): void; 32 | static defaultInvalidValue(value?: string): string; 33 | static defaultAggregation(agg?: AggregationType): AggregationType; 34 | static get defaults(): Record; 35 | id(): string; 36 | getField(name: string): AbstractWasmField | undefined; 37 | getParent(): DataModel | undefined; 38 | getChildren(): Array; 39 | getDerivations(): Array; 40 | removeChild(dataModel: DataModel): void; 41 | detachParent(): DataModel; 42 | getData(): ResultData; 43 | getDataMeta(): DataMeta; 44 | getSchema(): Array; 45 | clone(saveChild?: boolean): DataModel; 46 | sort(sortingDetails: [[string, SortOrder]]): DataModel; 47 | select(query: any, options?: { 48 | mode: FilteringModesType; 49 | }): DataModel | DataModel[]; 50 | splitByRow(fields: string[]): DataModel[]; 51 | project(fields: string[], options?: { 52 | mode: FilteringModesType; 53 | }): DataModel | DataModel[]; 54 | groupBy(fields: string[], reducers?: { 55 | field: string; 56 | aggn: AggregationType; 57 | }[], options?: {}): DataModel; 58 | private disposeRecursive; 59 | getPropagationCriterias(): Map; 60 | dispose(force?: boolean): DataModel; 61 | disposeResources(): DataModel; 62 | propagate(queries: any, info: any): DataModel; 63 | onPropagation(fn: Function): DataModel; 64 | unsubscribePropagationListeners(): DataModel; 65 | calculateVariable(fieldInfo: Schema, fields: string[], fn: (...params: (string | number | Invalid)[]) => string | number): DataModel; 66 | context(): ContextContract; 67 | } 68 | -------------------------------------------------------------------------------- /dist/esm/web/src/main.js: -------------------------------------------------------------------------------- 1 | var __extends=this&&this.__extends||function(){var t=function(e,o){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(e,o)};return function(e,o){function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}(),__read=this&&this.__read||function(t,e){var o="function"==typeof Symbol&&t[Symbol.iterator];if(!o)return t;var n,r,i=o.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){r={error:t}}finally{try{n&&!n.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}return a},__spread=this&&this.__spread||function(){for(var t=[],e=0;e-1&&this._children.splice(e,1)},e.prototype.detachParent=function(){return this._parent=void 0,this},e.prototype.getData=function(){return this._context.getData()},e.prototype.getDataMeta=function(){return this._context.getDataMeta()},e.prototype.getSchema=function(){return this._context.getSchema()},e.prototype.clone=function(t){void 0===t&&(t=!0);var o=new e(this);return t&&(updateRefCount(this,!0),this._children.push(o),o._parent=this),o},e.prototype.sort=function(t){var e=this._context.sort(t),o=this.cloneFromContext(e);return o._derivations.push({operation:Operations.SORT,params:t}),o},e.prototype.select=function(t,e){var o=(e||{}).mode,n=void 0===o?FilteringModesType.NORMAL:o,r=this._context.select(t,{mode:n}),i=this.cloneFromContext(r);return i instanceof Array?(i[0]._derivations.push({operation:Operations.SELECT,params:{query:t,options:{mode:FilteringModesType.NORMAL}}}),i[1]._derivations.push({operation:Operations.SELECT,params:{query:t,options:{mode:FilteringModesType.INVERSE}}})):i._derivations.push({operation:Operations.SELECT,params:{query:t,options:{mode:n}}}),i},e.prototype.splitByRow=function(t){var e=this._context.splitByRow(t),o=this.cloneFromContext(e);return o.map(function(e){var o=createSelectQuery(e,t);return e._commonDerivation={operation:Operations.SPLIT,params:{fields:t}},e._derivations.push({operation:Operations.SELECT,params:{query:o,options:{mode:FilteringModesType.NORMAL}}})}),o},e.prototype.project=function(t,e){var o=(e||{}).mode,n=void 0===o?FilteringModesType.NORMAL:o,r=this._context.project(t,{mode:n}),i=this.cloneFromContext(r);return i instanceof Array?(i[0]._derivations.push({operation:Operations.PROJECT,params:{fields:t,options:{mode:FilteringModesType.NORMAL}}}),i[1]._derivations.push({operation:Operations.PROJECT,params:{fields:t,options:{mode:FilteringModesType.INVERSE}}})):i._derivations.push({operation:Operations.PROJECT,params:{fields:t,options:e}}),i},e.prototype.groupBy=function(t,e,o){void 0===e&&(e=[]),void 0===o&&(o={});var n=this._context.groupBy(t,e,o),r=this.cloneFromContext(n);return r._derivations.push({operation:Operations.GROUPBY,params:{fields:t,reducers:e}}),r},e.prototype.disposeRecursive=function(t){(void 0===t&&(t=!0),this._refCount=Math.max(this._refCount-1,0),0===this._refCount||t)&&(this.disposeResources(),this.getChildren().forEach(function(e){e.disposeRecursive(t)}))},e.prototype.getPropagationCriterias=function(){return this._propagationInfo.propagationCriterias},e.prototype.dispose=function(t){if(void 0===t&&(t=!0),!this._disposed){var e=this.getParent();this.disposeRecursive(t),updateRefCount(e,!1),disposeZeroRefDms(e)}return this},e.prototype.disposeResources=function(){var t;if(this._disposed)return this;var e=this._derivations[this._derivations.length-1];if(e){var o=e.operation;this._context.dispose(disposeStrategies[o](e.params))}else this._context.dispose({disposeFields:!0,disposePartialFields:{dispose:!1,values:[]}});return null===(t=this._parent)||void 0===t||t.removeChild(this),this.detachParent(),this._disposed=!0,this},e.prototype.propagate=function(t,e){var o=getRootModel(this),n=t.map(function(t){return t.criteria}).filter(function(t){return null!==t}),r=n.length?{operator:e.queryOperator||"and",conditions:n}:null,i=getQueryDataModels(t,this),a=new Map;getPropagationTargetMap(o,e.targetDms,e.exclude,a);var s=[];return propagateIdentifiers(o,{query:r,info:e,targetMap:a,nonPropagationDms:s},i),s.forEach(function(t){t&&t.dispose(!1)}),this},e.prototype.onPropagation=function(t){return this._propagationInfo.listeners.push(t),this},e.prototype.unsubscribePropagationListeners=function(){return this._propagationInfo.listeners=[],this},e.prototype.calculateVariable=function(t,e,o){var n=this._context.calculateVariable(this.sanitizeSchema([t])[0],e,o),r=this.cloneFromContext(n);return r._derivations.push({operation:Operations.CALCULATE,params:{fieldInfo:t,fields:e,fn:o}}),r},e.prototype.context=function(){return this._context},e._contextType=ContextType.WASM,e}(AbstractDataModel);export default DataModel; -------------------------------------------------------------------------------- /dist/esm/web/src/operations/derivations.d.ts: -------------------------------------------------------------------------------- 1 | import DataModel from '../main'; 2 | export declare const createSelectQuery: (dm: DataModel, fields: string[]) => any; 3 | -------------------------------------------------------------------------------- /dist/esm/web/src/operations/derivations.js: -------------------------------------------------------------------------------- 1 | import DataModel from"../main";import{ComparisonOperatorsType,LogicalOperatorsType}from"../constants/selections";var createQuery=function(e,r){return{operator:ComparisonOperatorsType.EQUAL,value:e===DataModel.defaultInvalidValue()?void 0:e,field:r}};export var createSelectQuery=function(e,r){var o={},a=r.length;if(1===a){var t=e.getField(r[0]);o=t?createQuery(t.domain()[0],r[0]):{}}else a>1&&(o.conditions=[],r.forEach(function(r,a){var t=e.getField(r);t&&(o.operator=LogicalOperatorsType.AND,o.conditions[a]=createQuery(t.domain()[0],r))}));return o}; -------------------------------------------------------------------------------- /dist/esm/web/src/operations/dispose.d.ts: -------------------------------------------------------------------------------- 1 | import { Operations } from '../constants/miscellaneous'; 2 | export declare const disposeStrategies: { 3 | select: (_val: Record) => { 4 | disposeFields: boolean; 5 | disposePartialFields: { 6 | dispose: boolean; 7 | values: never[]; 8 | }; 9 | }; 10 | project: (_val: Record) => { 11 | disposeFields: boolean; 12 | disposePartialFields: { 13 | dispose: boolean; 14 | values: never[]; 15 | }; 16 | }; 17 | groupBy: (_val: Record) => { 18 | disposeFields: boolean; 19 | disposePartialFields: { 20 | dispose: boolean; 21 | values: never[]; 22 | }; 23 | }; 24 | sort: (_val: Record) => { 25 | disposeFields: boolean; 26 | disposePartialFields: { 27 | dispose: boolean; 28 | values: never[]; 29 | }; 30 | }; 31 | split: (_val: Record) => { 32 | disposeFields: boolean; 33 | disposePartialFields: { 34 | dispose: boolean; 35 | values: never[]; 36 | }; 37 | }; 38 | calculate_variable: (val: Record) => { 39 | disposeFields: boolean; 40 | disposePartialFields: { 41 | dispose: boolean; 42 | values: any[]; 43 | }; 44 | }; 45 | }; 46 | -------------------------------------------------------------------------------- /dist/esm/web/src/operations/dispose.js: -------------------------------------------------------------------------------- 1 | var _a;import{Operations}from"../constants/miscellaneous";export var disposeStrategies=(_a={},_a[Operations.SELECT]=function(s){return{disposeFields:!0,disposePartialFields:{dispose:!1,values:[]}}},_a[Operations.PROJECT]=function(s){return{disposeFields:!0,disposePartialFields:{dispose:!1,values:[]}}},_a[Operations.GROUPBY]=function(s){return{disposeFields:!0,disposePartialFields:{dispose:!0,values:[]}}},_a[Operations.SORT]=function(s){return{disposeFields:!0,disposePartialFields:{dispose:!1,values:[]}}},_a[Operations.SPLIT]=function(s){return{disposeFields:!0,disposePartialFields:{dispose:!1,values:[]}}},_a[Operations.CALCULATE]=function(s){return{disposeFields:!0,disposePartialFields:{dispose:!0,values:[s.fieldInfo.name]}}},_a); -------------------------------------------------------------------------------- /dist/esm/web/src/operations/propagation/index.d.ts: -------------------------------------------------------------------------------- 1 | import DataModel from '../../export'; 2 | export declare const updateRefCount: (dm: DataModel | undefined, increment: boolean) => void; 3 | export declare const disposeZeroRefDms: (dm: DataModel | undefined) => void; 4 | export interface PropagationInfo { 5 | listeners: Array; 6 | propagationCriterias: Map; 7 | } 8 | export declare const getRootModel: (dm: DataModel) => DataModel; 9 | export declare const getQueryDataModels: (queries: any, rootDm: DataModel) => any; 10 | export declare const propagateIdentifiers: (dm: DataModel, config: any, queryDms: any, propagationModel?: DataModel | undefined) => void; 11 | export declare const getPropagationTargetMap: (dm: DataModel, models?: Set, exclude?: boolean, map?: Map) => boolean; 12 | -------------------------------------------------------------------------------- /dist/esm/web/src/operations/propagation/index.js: -------------------------------------------------------------------------------- 1 | import{Operations}from"../../constants/miscellaneous";import{FieldType}from"../../constants/fields";var handlePropagation=function(e,r,t,a){var n=a._propagationInfo.listeners;return t&&n.forEach(function(t){t(e,r)}),!t||!n.length};export var updateRefCount=function(e,r){for(;e;)e._refCount=Math.max(e._refCount+(r?1:-1),0),e=null==e?void 0:e.getParent()};export var disposeZeroRefDms=function(e){for(;e;){var r=null==e?void 0:e.getParent();!e._refCount&&e.disposeResources(),e=r}};export var getRootModel=function(e){for(;e;){var r=null==e?void 0:e.getParent();if(!r)break;e=r}return e};export var getQueryDataModels=function(e,r){var t=new Map;return e.forEach(function(e){for(var a=e.dm,n=void 0===a?r:a,o=e.criteria,i=e.fields,d=n,s=i.slice(),f=i.some(function(e){var r;return(null===(r=n.getField(e))||void 0===r?void 0:r.type())===FieldType.MEASURE}),l=function(){var e=null==d?void 0:d.getParent(),r=d.getDerivations();if(r.length){var a=r[0].operation===Operations.GROUPBY&&f,n=s.filter(function(r){return e.getField(r)});if(a)return t.set(null==d?void 0:d.id(),o),"break";n.length Promise; 4 | -------------------------------------------------------------------------------- /dist/esm/web/src/worker/index.js: -------------------------------------------------------------------------------- 1 | import{initializePoolExecutor}from"./pool-executor";export var transformDataOnWorker=function(o,r){return initializePoolExecutor(r)(o)}; -------------------------------------------------------------------------------- /dist/esm/web/src/worker/pool-executor.d.ts: -------------------------------------------------------------------------------- 1 | import { Tasker } from '../contracts/tasker'; 2 | declare const initializePoolExecutor: (taskers: Tasker[]) => (data: unknown) => Promise; 3 | export { initializePoolExecutor }; 4 | -------------------------------------------------------------------------------- /dist/esm/web/src/worker/pool-executor.js: -------------------------------------------------------------------------------- 1 | import*as GPromise from"global-promise";import{v4 as uuidv4}from"uuid";var RETRY_INTERVAL=64,isTaskerFree=function(r){return r.isFree},initializePoolExecutor=function(r){var e=function(){return r.find(isTaskerFree)};return function(r){var i,t=uuidv4(),n=GPromise.create(t);return(i=e(),new Promise(function(r){if(null==i)var t=setInterval(function(){var i=e();null!=i&&(i.isFree=!1,clearInterval(t),r(i))},RETRY_INTERVAL);else i.isFree=!1,r(i)})).then(function(e){var i=e.worker;i.addEventListener("message",function(r){var i=r.data,t=i.reqId,n=i.data;e.isFree=!0,n.error?GPromise.reject(t,new Error(n.error)):GPromise.resolve(t,n.data)}),i.postMessage({data:r,reqId:t,type:"transform-data"})}),n}};export{initializePoolExecutor}; -------------------------------------------------------------------------------- /dist/esm/web/src/worker/transform-data.worker.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/esm/web/src/worker/transform-data.worker.js: -------------------------------------------------------------------------------- 1 | import{transformDataHelper}from"../data/utils/transform-data";var ctx=self,postResponse=function(a,t){var r;r=t instanceof Error?{error:t.message||String(t),data:null}:{error:null,data:t},ctx.postMessage({reqId:a,data:r})},onTransformData=function(a,t){try{postResponse(a,transformDataHelper(t))}catch(t){postResponse(a,t)}};ctx.addEventListener("message",function(a){var t=a.data,r=t.reqId,s=t.type,e=t.data;switch(s){case"transform-data":onTransformData(r,e)}}); -------------------------------------------------------------------------------- /dist/esm/webassembly/pkg/datamodel_wasm.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | */ 3 | export function main_js(): void; 4 | /** 5 | * @param {DataModel} dm 6 | * @param {number} spliting_field 7 | * @param {number} _color_field 8 | * @param {number} measure_field 9 | * @param {number} sort 10 | * @returns {StackData} 11 | */ 12 | export function stack_by(dm: DataModel, spliting_field: number, _color_field: number, measure_field: number, sort: number): StackData; 13 | /** 14 | */ 15 | export class CategoricalDomainMeta { 16 | static __wrap(ptr: any): any; 17 | free(): void; 18 | ptr: number | undefined; 19 | /** 20 | * @param {number} arg0 21 | */ 22 | set data_ptr(arg: number); 23 | /** 24 | * @returns {number} 25 | */ 26 | get data_ptr(): number; 27 | /** 28 | * @param {number} arg0 29 | */ 30 | set data_len(arg: number); 31 | /** 32 | * @returns {number} 33 | */ 34 | get data_len(): number; 35 | } 36 | /** 37 | */ 38 | export class CategoricalFieldWrapper { 39 | static __wrap(ptr: any): any; 40 | free(): void; 41 | ptr: number | undefined; 42 | /** 43 | * @returns {string} 44 | */ 45 | get_name(): string; 46 | /** 47 | * @returns {number} 48 | */ 49 | get_data_indices(): number; 50 | /** 51 | * @returns {number} 52 | */ 53 | get_data_info(): number; 54 | /** 55 | * @returns {number} 56 | */ 57 | get_rows_count(): number; 58 | /** 59 | * @param {number} row_index 60 | * @returns {number} 61 | */ 62 | get_value_at_index(row_index: number): number; 63 | /** 64 | * @returns {CategoricalDomainMeta} 65 | */ 66 | get_domain(): CategoricalDomainMeta; 67 | } 68 | /** 69 | */ 70 | export class ContinuousFieldWrapper { 71 | static __wrap(ptr: any): any; 72 | free(): void; 73 | ptr: number | undefined; 74 | /** 75 | * @returns {string} 76 | */ 77 | get_name(): string; 78 | /** 79 | * @returns {number} 80 | */ 81 | get_data_ptr(): number; 82 | /** 83 | * @returns {number} 84 | */ 85 | get_data_indices(): number; 86 | /** 87 | * @returns {number} 88 | */ 89 | get_data_info(): number; 90 | /** 91 | * @returns {number} 92 | */ 93 | get_rows_count(): number; 94 | /** 95 | * @param {number} row_index 96 | * @returns {number} 97 | */ 98 | get_value_at_index(row_index: number): number; 99 | /** 100 | * @returns {Float64Array} 101 | */ 102 | get_domain(): Float64Array; 103 | } 104 | /** 105 | */ 106 | export class DataModel { 107 | static __wrap(ptr: any): any; 108 | /** 109 | * Public API to create new DataModel Instance 110 | * @param {DataModelMeta} meta 111 | */ 112 | constructor(meta: DataModelMeta); 113 | free(): void; 114 | ptr: number | undefined; 115 | /** 116 | * @returns {DataModel} 117 | */ 118 | clone(): DataModel; 119 | /** 120 | * @param {any} schema 121 | * @param {any} data 122 | * @returns {number} 123 | */ 124 | add_field(schema: any, data: any): number; 125 | /** 126 | * @param {number} index 127 | * @returns {CategoricalFieldWrapper} 128 | */ 129 | get_categorical_field(index: number): CategoricalFieldWrapper; 130 | /** 131 | * @param {number} index 132 | * @returns {ContinuousFieldWrapper} 133 | */ 134 | get_continuous_field(index: number): ContinuousFieldWrapper; 135 | /** 136 | * @param {number} index 137 | * @returns {TemporalFieldWrapper} 138 | */ 139 | get_temporal_field(index: number): TemporalFieldWrapper; 140 | /** 141 | * @param {number} index 142 | * @returns {IdFieldWrapper} 143 | */ 144 | get_id_field(index: number): IdFieldWrapper; 145 | /** 146 | * @param {any} obj 147 | * @param {number} mode 148 | * @returns {ProjectDataModel} 149 | */ 150 | select(obj: any, mode: number): ProjectDataModel; 151 | /** 152 | * @param {any} details 153 | * @returns {DataModel} 154 | */ 155 | sort(details: any): DataModel; 156 | /** 157 | * @param {any} details 158 | * @returns {ProjectDataModel} 159 | */ 160 | project(details: any): ProjectDataModel; 161 | /** 162 | * @param {any} details 163 | * @param {any} options 164 | * @returns {DataModel} 165 | */ 166 | group_by(details: any, options: any): DataModel; 167 | /** 168 | * @param {any} options 169 | * @returns {SplitDataModel} 170 | */ 171 | split_by_row(options: any): SplitDataModel; 172 | /** 173 | * @param {any} fields 174 | */ 175 | dispose(fields: any): void; 176 | /** 177 | * @returns {number} 178 | */ 179 | row_count(): number; 180 | /** 181 | * @returns {number} 182 | */ 183 | column_count(): number; 184 | /** 185 | * @returns {Int32Array} 186 | */ 187 | get_eligible_rows(): Int32Array; 188 | /** 189 | * @returns {number} 190 | */ 191 | get_partial_column_count(): number; 192 | /** 193 | * @returns {number} 194 | */ 195 | get_partial_row_count(): number; 196 | /** 197 | * @param {DataModel} dm2 198 | * @returns {Uint32Array} 199 | */ 200 | get_matching_ids(dm2: DataModel): Uint32Array; 201 | } 202 | /** 203 | */ 204 | export class DataModelMeta { 205 | static __wrap(ptr: any): any; 206 | /** 207 | * @param {number} rows 208 | * @param {number} columns 209 | */ 210 | constructor(rows: number, columns: number); 211 | free(): void; 212 | ptr: number | undefined; 213 | /** 214 | * @param {number} arg0 215 | */ 216 | set rows(arg: number); 217 | /** 218 | * @returns {number} 219 | */ 220 | get rows(): number; 221 | /** 222 | * @param {number} arg0 223 | */ 224 | set columns(arg: number); 225 | /** 226 | * @returns {number} 227 | */ 228 | get columns(): number; 229 | } 230 | /** 231 | */ 232 | export class IdFieldWrapper { 233 | static __wrap(ptr: any): any; 234 | free(): void; 235 | ptr: number | undefined; 236 | /** 237 | * @returns {string} 238 | */ 239 | get_name(): string; 240 | /** 241 | * @returns {number} 242 | */ 243 | get_data_ptr(): number; 244 | /** 245 | * @returns {number} 246 | */ 247 | get_data_indices(): number; 248 | /** 249 | * @returns {number} 250 | */ 251 | get_data_info(): number; 252 | /** 253 | * @returns {number} 254 | */ 255 | get_rows_count(): number; 256 | /** 257 | * @param {number} row_index 258 | * @returns {number} 259 | */ 260 | get_value_at_index(row_index: number): number; 261 | } 262 | /** 263 | */ 264 | export class ProjectDataModel { 265 | static __wrap(ptr: any): any; 266 | free(): void; 267 | ptr: number | undefined; 268 | /** 269 | * @returns {DataModel | undefined} 270 | */ 271 | get_filtered_dm(): DataModel | undefined; 272 | /** 273 | * @returns {DataModel | undefined} 274 | */ 275 | get_unfiltered_dm(): DataModel | undefined; 276 | } 277 | /** 278 | */ 279 | export class SplitDataModel { 280 | static __wrap(ptr: any): any; 281 | free(): void; 282 | ptr: number | undefined; 283 | /** 284 | * @returns {DataModel} 285 | */ 286 | get_dm(): DataModel; 287 | /** 288 | * @returns {number} 289 | */ 290 | get_count(): number; 291 | } 292 | /** 293 | */ 294 | export class StackData { 295 | static __wrap(ptr: any): any; 296 | free(): void; 297 | ptr: number | undefined; 298 | /** 299 | * @returns {number} 300 | */ 301 | get_y_0(): number; 302 | /** 303 | * @returns {number} 304 | */ 305 | get_y_1(): number; 306 | /** 307 | * @returns {number} 308 | */ 309 | get_id(): number; 310 | /** 311 | */ 312 | free_data(): void; 313 | } 314 | /** 315 | */ 316 | export class TemporalFieldWrapper { 317 | static __wrap(ptr: any): any; 318 | free(): void; 319 | ptr: number | undefined; 320 | /** 321 | * @returns {string} 322 | */ 323 | get_name(): string; 324 | /** 325 | * @returns {number} 326 | */ 327 | get_data_ptr(): number; 328 | /** 329 | * @returns {number} 330 | */ 331 | get_data_indices(): number; 332 | /** 333 | * @returns {number} 334 | */ 335 | get_data_info(): number; 336 | /** 337 | * @returns {number} 338 | */ 339 | get_rows_count(): number; 340 | /** 341 | * @param {number} row_index 342 | * @returns {number} 343 | */ 344 | get_value_at_index(row_index: number): number; 345 | /** 346 | * @returns {number} 347 | */ 348 | min_consecutive_diff(): number; 349 | /** 350 | * @returns {Float64Array} 351 | */ 352 | get_domain(): Float64Array; 353 | } 354 | export function __wbindgen_json_serialize(arg0: any, arg1: any): void; 355 | export function __wbindgen_object_drop_ref(arg0: any): void; 356 | export function __wbindgen_throw(arg0: any, arg1: any): never; 357 | -------------------------------------------------------------------------------- /dist/esm/webassembly/pkg/datamodel_wasm.js: -------------------------------------------------------------------------------- 1 | import*as wasm from"./datamodel_wasm_bg.wasm";var heap=new Array(32).fill(void 0);function getObject(t){return heap[t]}heap.push(void 0,null,!0,!1);var WASM_VECTOR_LEN=0,cachegetUint8Memory0=null;function getUint8Memory0(){return null!==cachegetUint8Memory0&&cachegetUint8Memory0.buffer===wasm.memory.buffer||(cachegetUint8Memory0=new Uint8Array(wasm.memory.buffer)),cachegetUint8Memory0}var lTextEncoder="undefined"==typeof TextEncoder?require("util").TextEncoder:TextEncoder,cachedTextEncoder=new lTextEncoder("utf-8"),encodeString="function"==typeof cachedTextEncoder.encodeInto?function(t,e){return cachedTextEncoder.encodeInto(t,e)}:function(t,e){var r=cachedTextEncoder.encode(t);return e.set(r),{read:t.length,written:r.length}};function passStringToWasm0(t,e,r){if(void 0===r){var a=cachedTextEncoder.encode(t),o=e(a.length);return getUint8Memory0().subarray(o,o+a.length).set(a),WASM_VECTOR_LEN=a.length,o}for(var n=t.length,i=e(n),p=getUint8Memory0(),_=0;_127)break;p[i+_]=c}if(_!==n){0!==_&&(t=t.slice(_)),i=r(i,n,n=_+3*t.length);var u=getUint8Memory0().subarray(i+_,i+n);_+=encodeString(t,u).written}return WASM_VECTOR_LEN=_,i}var cachegetInt32Memory0=null;function getInt32Memory0(){return null!==cachegetInt32Memory0&&cachegetInt32Memory0.buffer===wasm.memory.buffer||(cachegetInt32Memory0=new Int32Array(wasm.memory.buffer)),cachegetInt32Memory0}var heap_next=heap.length;function dropObject(t){t<36||(heap[t]=heap_next,heap_next=t)}function takeObject(t){var e=getObject(t);return dropObject(t),e}var lTextDecoder="undefined"==typeof TextDecoder?require("util").TextDecoder:TextDecoder,cachedTextDecoder=new lTextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});function getStringFromWasm0(t,e){return cachedTextDecoder.decode(getUint8Memory0().subarray(t,t+e))}function _assertClass(t,e){if(!(t instanceof e))throw new Error("expected instance of "+e.name);return t.ptr}function addHeapObject(t){heap_next===heap.length&&heap.push(heap.length+1);var e=heap_next;return heap_next=heap[e],heap[e]=t,e}cachedTextDecoder.decode();var stack_pointer=32;function addBorrowedObject(t){if(1==stack_pointer)throw new Error("out of js stack");return heap[--stack_pointer]=t,stack_pointer}function getArrayI32FromWasm0(t,e){return getInt32Memory0().subarray(t/4,t/4+e)}var cachegetUint32Memory0=null;function getUint32Memory0(){return null!==cachegetUint32Memory0&&cachegetUint32Memory0.buffer===wasm.memory.buffer||(cachegetUint32Memory0=new Uint32Array(wasm.memory.buffer)),cachegetUint32Memory0}function getArrayU32FromWasm0(t,e){return getUint32Memory0().subarray(t/4,t/4+e)}var cachegetFloat64Memory0=null;function getFloat64Memory0(){return null!==cachegetFloat64Memory0&&cachegetFloat64Memory0.buffer===wasm.memory.buffer||(cachegetFloat64Memory0=new Float64Array(wasm.memory.buffer)),cachegetFloat64Memory0}function getArrayF64FromWasm0(t,e){return getFloat64Memory0().subarray(t/8,t/8+e)}export function main_js(){wasm.main_js()}export function stack_by(t,e,r,a,o){_assertClass(t,DataModel);var n=wasm.stack_by(t.ptr,e,r,a,o);return StackData.__wrap(n)}var CategoricalDomainMeta=function(){function t(){}return t.__wrap=function(e){var r=Object.create(t.prototype);return r.ptr=e,r},t.prototype.free=function(){var t=this.ptr;this.ptr=0,wasm.__wbg_categoricaldomainmeta_free(t)},Object.defineProperty(t.prototype,"data_ptr",{get:function(){return wasm.__wbg_get_categoricaldomainmeta_data_ptr(this.ptr)},set:function(t){wasm.__wbg_set_categoricaldomainmeta_data_ptr(this.ptr,t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data_len",{get:function(){return wasm.__wbg_get_categoricaldomainmeta_data_len(this.ptr)>>>0},set:function(t){wasm.__wbg_set_categoricaldomainmeta_data_len(this.ptr,t)},enumerable:!1,configurable:!0}),t}();export{CategoricalDomainMeta};var CategoricalFieldWrapper=function(){function t(){}return t.__wrap=function(e){var r=Object.create(t.prototype);return r.ptr=e,r},t.prototype.free=function(){var t=this.ptr;this.ptr=0,wasm.__wbg_categoricalfieldwrapper_free(t)},t.prototype.get_name=function(){try{wasm.categoricalfieldwrapper_get_name(8,this.ptr);var t=getInt32Memory0()[2],e=getInt32Memory0()[3];return getStringFromWasm0(t,e)}finally{wasm.__wbindgen_free(t,e)}},t.prototype.get_data_indices=function(){return wasm.categoricalfieldwrapper_get_data_indices(this.ptr)},t.prototype.get_data_info=function(){return wasm.categoricalfieldwrapper_get_data_info(this.ptr)},t.prototype.get_rows_count=function(){return wasm.categoricalfieldwrapper_get_rows_count(this.ptr)>>>0},t.prototype.get_value_at_index=function(t){return wasm.categoricalfieldwrapper_get_value_at_index(this.ptr,t)},t.prototype.get_domain=function(){var t=wasm.categoricalfieldwrapper_get_domain(this.ptr);return CategoricalDomainMeta.__wrap(t)},t}();export{CategoricalFieldWrapper};var ContinuousFieldWrapper=function(){function t(){}return t.__wrap=function(e){var r=Object.create(t.prototype);return r.ptr=e,r},t.prototype.free=function(){var t=this.ptr;this.ptr=0,wasm.__wbg_continuousfieldwrapper_free(t)},t.prototype.get_name=function(){try{wasm.categoricalfieldwrapper_get_name(8,this.ptr);var t=getInt32Memory0()[2],e=getInt32Memory0()[3];return getStringFromWasm0(t,e)}finally{wasm.__wbindgen_free(t,e)}},t.prototype.get_data_ptr=function(){return wasm.continuousfieldwrapper_get_data_ptr(this.ptr)},t.prototype.get_data_indices=function(){return wasm.continuousfieldwrapper_get_data_indices(this.ptr)},t.prototype.get_data_info=function(){return wasm.continuousfieldwrapper_get_data_info(this.ptr)},t.prototype.get_rows_count=function(){return wasm.continuousfieldwrapper_get_rows_count(this.ptr)>>>0},t.prototype.get_value_at_index=function(t){return wasm.continuousfieldwrapper_get_value_at_index(this.ptr,t)},t.prototype.get_domain=function(){wasm.continuousfieldwrapper_get_domain(8,this.ptr);var t=getInt32Memory0()[2],e=getInt32Memory0()[3],r=getArrayF64FromWasm0(t,e).slice();return wasm.__wbindgen_free(t,8*e),r},t}();export{ContinuousFieldWrapper};var DataModel=function(){function t(e){_assertClass(e,DataModelMeta);var r=e.ptr;e.ptr=0;var a=wasm.datamodel_new(r);return t.__wrap(a)}return t.__wrap=function(e){var r=Object.create(t.prototype);return r.ptr=e,r},t.prototype.free=function(){var t=this.ptr;this.ptr=0,wasm.__wbg_datamodel_free(t)},t.prototype.clone=function(){var e=wasm.datamodel_clone(this.ptr);return t.__wrap(e)},t.prototype.add_field=function(t,e){return wasm.datamodel_add_field(this.ptr,addHeapObject(t),addHeapObject(e))>>>0},t.prototype.get_categorical_field=function(t){var e=wasm.datamodel_get_categorical_field(this.ptr,t);return CategoricalFieldWrapper.__wrap(e)},t.prototype.get_continuous_field=function(t){var e=wasm.datamodel_get_continuous_field(this.ptr,t);return ContinuousFieldWrapper.__wrap(e)},t.prototype.get_temporal_field=function(t){var e=wasm.datamodel_get_temporal_field(this.ptr,t);return TemporalFieldWrapper.__wrap(e)},t.prototype.get_id_field=function(t){var e=wasm.datamodel_get_id_field(this.ptr,t);return IdFieldWrapper.__wrap(e)},t.prototype.select=function(t,e){var r=wasm.datamodel_select(this.ptr,addHeapObject(t),e);return ProjectDataModel.__wrap(r)},t.prototype.sort=function(e){try{var r=wasm.datamodel_sort(this.ptr,addBorrowedObject(e));return t.__wrap(r)}finally{heap[stack_pointer++]=void 0}},t.prototype.project=function(t){try{var e=wasm.datamodel_project(this.ptr,addBorrowedObject(t));return ProjectDataModel.__wrap(e)}finally{heap[stack_pointer++]=void 0}},t.prototype.group_by=function(e,r){var a=wasm.datamodel_group_by(this.ptr,addHeapObject(e),addHeapObject(r));return t.__wrap(a)},t.prototype.split_by_row=function(t){var e=wasm.datamodel_split_by_row(this.ptr,addHeapObject(t));return SplitDataModel.__wrap(e)},t.prototype.dispose=function(t){wasm.datamodel_dispose(this.ptr,addHeapObject(t))},t.prototype.row_count=function(){return wasm.datamodel_row_count(this.ptr)>>>0},t.prototype.column_count=function(){return wasm.datamodel_column_count(this.ptr)>>>0},t.prototype.get_eligible_rows=function(){wasm.datamodel_get_eligible_rows(8,this.ptr);var t=getInt32Memory0()[2],e=getInt32Memory0()[3],r=getArrayI32FromWasm0(t,e).slice();return wasm.__wbindgen_free(t,4*e),r},t.prototype.get_partial_column_count=function(){return wasm.datamodel_get_partial_column_count(this.ptr)>>>0},t.prototype.get_partial_row_count=function(){return wasm.datamodel_get_partial_row_count(this.ptr)>>>0},t.prototype.get_matching_ids=function(e){_assertClass(e,t),wasm.datamodel_get_matching_ids(8,this.ptr,e.ptr);var r=getInt32Memory0()[2],a=getInt32Memory0()[3],o=getArrayU32FromWasm0(r,a).slice();return wasm.__wbindgen_free(r,4*a),o},t}();export{DataModel};var DataModelMeta=function(){function t(e,r){var a=wasm.datamodelmeta_new(e,r);return t.__wrap(a)}return t.__wrap=function(e){var r=Object.create(t.prototype);return r.ptr=e,r},t.prototype.free=function(){var t=this.ptr;this.ptr=0,wasm.__wbg_datamodelmeta_free(t)},Object.defineProperty(t.prototype,"rows",{get:function(){return wasm.__wbg_get_datamodelmeta_rows(this.ptr)>>>0},set:function(t){wasm.__wbg_set_datamodelmeta_rows(this.ptr,t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"columns",{get:function(){return wasm.__wbg_get_datamodelmeta_columns(this.ptr)>>>0},set:function(t){wasm.__wbg_set_datamodelmeta_columns(this.ptr,t)},enumerable:!1,configurable:!0}),t}();export{DataModelMeta};var IdFieldWrapper=function(){function t(){}return t.__wrap=function(e){var r=Object.create(t.prototype);return r.ptr=e,r},t.prototype.free=function(){var t=this.ptr;this.ptr=0,wasm.__wbg_idfieldwrapper_free(t)},t.prototype.get_name=function(){try{wasm.categoricalfieldwrapper_get_name(8,this.ptr);var t=getInt32Memory0()[2],e=getInt32Memory0()[3];return getStringFromWasm0(t,e)}finally{wasm.__wbindgen_free(t,e)}},t.prototype.get_data_ptr=function(){return wasm.idfieldwrapper_get_data_ptr(this.ptr)},t.prototype.get_data_indices=function(){return wasm.idfieldwrapper_get_data_indices(this.ptr)},t.prototype.get_data_info=function(){return wasm.idfieldwrapper_get_data_info(this.ptr)},t.prototype.get_rows_count=function(){return wasm.idfieldwrapper_get_rows_count(this.ptr)>>>0},t.prototype.get_value_at_index=function(t){return wasm.idfieldwrapper_get_value_at_index(this.ptr,t)},t}();export{IdFieldWrapper};var ProjectDataModel=function(){function t(){}return t.__wrap=function(e){var r=Object.create(t.prototype);return r.ptr=e,r},t.prototype.free=function(){var t=this.ptr;this.ptr=0,wasm.__wbg_projectdatamodel_free(t)},t.prototype.get_filtered_dm=function(){var t=wasm.projectdatamodel_get_filtered_dm(this.ptr);return 0===t?void 0:DataModel.__wrap(t)},t.prototype.get_unfiltered_dm=function(){var t=wasm.projectdatamodel_get_unfiltered_dm(this.ptr);return 0===t?void 0:DataModel.__wrap(t)},t}();export{ProjectDataModel};var SplitDataModel=function(){function t(){}return t.__wrap=function(e){var r=Object.create(t.prototype);return r.ptr=e,r},t.prototype.free=function(){var t=this.ptr;this.ptr=0,wasm.__wbg_splitdatamodel_free(t)},t.prototype.get_dm=function(){var t=wasm.splitdatamodel_get_dm(this.ptr);return DataModel.__wrap(t)},t.prototype.get_count=function(){return wasm.datamodel_column_count(this.ptr)>>>0},t}();export{SplitDataModel};var StackData=function(){function t(){}return t.__wrap=function(e){var r=Object.create(t.prototype);return r.ptr=e,r},t.prototype.free=function(){var t=this.ptr;this.ptr=0,wasm.__wbg_stackdata_free(t)},t.prototype.get_y_0=function(){return wasm.stackdata_get_y_0(this.ptr)},t.prototype.get_y_1=function(){return wasm.stackdata_get_y_1(this.ptr)},t.prototype.get_id=function(){return wasm.stackdata_get_id(this.ptr)},t.prototype.free_data=function(){wasm.stackdata_free_data(this.ptr)},t}();export{StackData};var TemporalFieldWrapper=function(){function t(){}return t.__wrap=function(e){var r=Object.create(t.prototype);return r.ptr=e,r},t.prototype.free=function(){var t=this.ptr;this.ptr=0,wasm.__wbg_temporalfieldwrapper_free(t)},t.prototype.get_name=function(){try{wasm.categoricalfieldwrapper_get_name(8,this.ptr);var t=getInt32Memory0()[2],e=getInt32Memory0()[3];return getStringFromWasm0(t,e)}finally{wasm.__wbindgen_free(t,e)}},t.prototype.get_data_ptr=function(){return wasm.temporalfieldwrapper_get_data_ptr(this.ptr)},t.prototype.get_data_indices=function(){return wasm.temporalfieldwrapper_get_data_indices(this.ptr)},t.prototype.get_data_info=function(){return wasm.categoricalfieldwrapper_get_data_info(this.ptr)},t.prototype.get_rows_count=function(){return wasm.categoricalfieldwrapper_get_rows_count(this.ptr)>>>0},t.prototype.get_value_at_index=function(t){return wasm.temporalfieldwrapper_get_value_at_index(this.ptr,t)},t.prototype.min_consecutive_diff=function(){return wasm.temporalfieldwrapper_min_consecutive_diff(this.ptr)},t.prototype.get_domain=function(){wasm.temporalfieldwrapper_get_domain(8,this.ptr);var t=getInt32Memory0()[2],e=getInt32Memory0()[3],r=getArrayF64FromWasm0(t,e).slice();return wasm.__wbindgen_free(t,8*e),r},t}();export{TemporalFieldWrapper};export var __wbindgen_json_serialize=function(t,e){var r=getObject(e),a=passStringToWasm0(JSON.stringify(void 0===r?null:r),wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),o=WASM_VECTOR_LEN;getInt32Memory0()[t/4+1]=o,getInt32Memory0()[t/4+0]=a};export var __wbindgen_object_drop_ref=function(t){takeObject(t)};export var __wbindgen_throw=function(t,e){throw new Error(getStringFromWasm0(t,e))};wasm.__wbindgen_start(); -------------------------------------------------------------------------------- /dist/esm/webassembly/pkg/datamodel_wasm_bg.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chartshq/datamodel/c03366dd81bebc83b21cc5bbaaad40b61b68a58c/dist/esm/webassembly/pkg/datamodel_wasm_bg.wasm -------------------------------------------------------------------------------- /dist/node/2cf9e3dd7ff6959fdd40.worker.js: -------------------------------------------------------------------------------- 1 | !function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=2)}([function(t,r){t.exports=require("crypto")},,function(t,r,e){"use strict";e.r(r);e(0);new Uint8Array(16);const n=[];for(let t=0;t<256;++t)n.push((t+256).toString(16).substr(1));var o;new Map;!function(t){t.FLAT_JSON="FlatJSON",t.DSV_STR="DSVStr",t.DSV_ARR="DSVArr",t.AUTO="Auto"}(o||(o={}));var a={},u={};function i(t){return new Function("d","return {"+t.map((function(t,r){return JSON.stringify(t)+": d["+r+'] || ""'})).join(",")+"}")}function f(t){var r=Object.create(null),e=[];return t.forEach((function(t){for(var n in t)n in r||e.push(r[n]=n)})),e}function c(t,r){var e=t+"",n=e.length;return n9999?"+"+c(r,6):c(r,4))+"-"+c(t.getUTCMonth()+1,2)+"-"+c(t.getUTCDate(),2)+(a?"T"+c(e,2)+":"+c(n,2)+":"+c(o,2)+"."+c(a,3)+"Z":o?"T"+c(e,2)+":"+c(n,2)+":"+c(o,2)+"Z":n||e?"T"+c(e,2)+":"+c(n,2)+"Z":"")}var l=function(t){var r=new RegExp('["'+t+"\n\r]"),e=t.charCodeAt(0);function n(t,r){var n,o=[],i=t.length,f=0,c=0,s=i<=0,l=!1;function p(){if(s)return u;if(l)return l=!1,a;var r,n,o=f;if(34===t.charCodeAt(o)){for(;f++=i?s=!0:10===(n=t.charCodeAt(f++))?l=!0:13===n&&(l=!0,10===t.charCodeAt(f)&&++f),t.slice(o+1,r-1).replace(/""/g,'"')}for(;f0)&&!(n=a.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(e=a.return)&&e.call(a)}finally{if(o)throw o.error}}return u},d=function(){for(var t=[],r=0;ro.getFullYear()&&(r=""+(a-1)+n),g(r).getFullYear()},formatter:function(t){var r,e=g(t).getFullYear().toString();return e&&(r=e.length,e=e.substring(r-2,r)),e}},Y:{name:"Y",index:0,extract:function(){return"(\\d{4})"},parser:y.defaultNumberParser(),formatter:function(t){return g(t).getFullYear().toString()}}}},y.getTokenFormalNames=function(){var t=y.getTokenDefinitions();return{HOUR:t.H,HOUR_12:t.l,AMPM_UPPERCASE:t.p,AMPM_LOWERCASE:t.P,MINUTE:t.M,SECOND:t.S,SHORT_DAY:t.a,LONG_DAY:t.A,DAY_OF_MONTH:t.e,DAY_OF_MONTH_CONSTANT_WIDTH:t.d,SHORT_MONTH:t.b,LONG_MONTH:t.B,MONTH_OF_YEAR:t.m,SHORT_YEAR:t.y,LONG_YEAR:t.Y}},y.tokenResolver=function(){var t=y.getTokenDefinitions(),r=function(){for(var t=[],r=0;r=0;)e=t[r+1],-1!==a.indexOf(e)&&u.push({index:r,token:e});return u},y.formatAs=function(t,r){var e,n,o,a,u=g(t),i=y.findTokens(r),f=y.getTokenDefinitions(),c=String(r),s=y.TOKEN_PREFIX;for(o=0,a=i.length;o=0;i--)(n=l[i].index)+1!==a.length-1?(void 0===r&&(r=a.length),o=a.substring(n+2,r),a=a.substring(0,n+2)+RegExp.escape(o)+a.substring(r,a.length),r=n):r=n;for(i=0;i0)&&!(n=a.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(e=a.return)&&e.call(a)}finally{if(o)throw o.error}}return u},M=function(){for(var t=[],r=0;r0)&&!(n=a.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(e=a.return)&&e.call(a)}finally{if(o)throw o.error}}return u},j=function(){for(var t=[],r=0;rPromise.resolve(r)})}))}catch(e){t(e)}}));if(a instanceof Promise){var c=f.then((function(e){return e.arrayBuffer()}));t=Promise.all([c.then((function(e){return WebAssembly.compile(e)})),a]).then((function(e){return WebAssembly.instantiate(e[0],e[1])}))}else{t=(c=f.then((function(e){return e.arrayBuffer()}))).then((function(e){return WebAssembly.instantiate(e,a)}))}i.push(r[e]=t.then((function(n){return u.w[e]=(n.instance||n).exports})))}})),Promise.all(i)},u.m=e,u.c=n,u.d=function(e,n,t){u.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:t})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,n){if(1&n&&(e=u(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(u.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var r in e)u.d(t,r,function(n){return e[n]}.bind(null,r));return t},u.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(n,"a",n),n},u.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},u.p="",u.oe=function(e){process.nextTick((function(){throw e}))},u.w={},u(u.s=0)}([function(e,n,t){"use strict";t.r(n);var r=function(e,n,t,r){return new(t||(t=Promise))((function(o,u){function i(e){try{f(r.next(e))}catch(e){u(e)}}function a(e){try{f(r.throw(e))}catch(e){u(e)}}function f(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,a)}f((r=r.apply(e,n||[])).next())}))},o=function(e,n){var t,r,o,u,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function a(u){return function(a){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;i;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1] (https://charts.com/)", 15 | "dependencies": { 16 | "d3-dsv": "^1.2.0", 17 | "global-promise": "^1.0.4", 18 | "uuid": "^8.0.0" 19 | }, 20 | "contributors": [ 21 | { 22 | "name": "Ujjal Kumar Dutta", 23 | "email": "duttaujjal143@gmail.com", 24 | "url": "https://github.com/UD-UD" 25 | }, 26 | { 27 | "name": "Ranajit Banerjee", 28 | "email": "ranajit.113124@gmail.com", 29 | "url": "https://github.com/ranajitbanerjee" 30 | }, 31 | { 32 | "name": "Rousan Ali", 33 | "email": "hello@rousan.io", 34 | "url": "https://rousan.io" 35 | }, 36 | { 37 | "name": "Nakshatra Mukhopadhyay", 38 | "email": "nakshatra.mukhopadhyay1994@gmail.com" 39 | }, 40 | { 41 | "name": "Adarsh Lilha", 42 | "email": "adarsh@charts.com" 43 | }, 44 | { 45 | "name": "Swati Mukherjee", 46 | "email": "swati@charts.com" 47 | } 48 | ], 49 | "keywords": [ 50 | "muze", 51 | "data-visualization", 52 | "visualization", 53 | "relational", 54 | "algebra", 55 | "relation", 56 | "webassembly" 57 | ], 58 | "lint-staged": { 59 | "*.{js,ts,tsx}": [ 60 | "eslint --fix" 61 | ] 62 | } 63 | } --------------------------------------------------------------------------------