diff --git a/.gitignore b/.gitignore index 4f590c2e7..d4d3b3b90 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ .DS_Store +/app-next +/app-html /datasets /datasets2 /datasets_* diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c84b7eae..1bc191e76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Auto fetch prices from the main Satonomics instance if missing instead of only trying Kraken's and Binance's API which are limited to the last 16 hours - Merged the core of `HeightMap` and `DateMap` structs into `GenericMap` - Added `Height` struct and many others + - Reorganized outputs of both the parser and the server for ease of use and easier sync compatibility - CLI - Added an argument parser for improved UX with several options - Datasets @@ -76,7 +77,7 @@ - Run file - Only run with a watcher if `cargo watch` is available -- Added trigger folder to automatically restart when a new dataset has been added in the parser + - Removed id_to_path file in favor for only `paths.d.ts` in `app/src/types` ## v. 0.2.0 | [851286](https://mempool.space/block/0000000000000000000281ca7f1bf8c50702bfca168c7af1bdc67c977c1ac8ed) - 2024/07/08 diff --git a/app/.gitignore b/app/.gitignore index 71ed004fc..f695b26ba 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -6,4 +6,5 @@ dev-dist visualizer # Local Netlify folder .netlify -.wrangler \ No newline at end of file +.wrangler +paths.d.ts \ No newline at end of file diff --git a/app/index.html b/app/index.html index 9e7b83e58..2c8a5f98e 100644 --- a/app/index.html +++ b/app/index.html @@ -1,5 +1,5 @@ - + Satonomics @@ -363,7 +363,7 @@ /> diff --git a/app/package.json b/app/package.json index 75b120d36..3bd6124a3 100644 --- a/app/package.json +++ b/app/package.json @@ -22,26 +22,26 @@ "@solid-primitives/resize-observer": "^2.0.26", "lean-qr": "^2.3.4", "lightweight-charts": "^4.1.7", - "solid-js": "^1.8.18" + "solid-js": "^1.8.19" }, "devDependencies": { "@ianvs/prettier-plugin-sort-imports": "^4.3.1", "@iconify-json/tabler": "^1.1.118", "@tailwindcss/container-queries": "^0.1.1", "autoprefixer": "^10.4.19", - "postcss": "^8.4.39", + "postcss": "^8.4.40", "prettier": "^3.3.3", "prettier-plugin-tailwindcss": "^0.6.5", "pwa-asset-generator": "^6.3.1", "rollup-plugin-visualizer": "^5.12.0", "tailwindcss": "^3.4.6", "typescript": "^5.5.4", - "unplugin-auto-import": "^0.18.0", + "unplugin-auto-import": "^0.18.2", "unplugin-icons": "^0.19.0", - "vite": "^5.3.4", + "vite": "^5.3.5", "vite-plugin-pwa": "^0.20.0", "vite-plugin-solid": "^2.10.2", "workbox-window": "^7.1.0", - "wrangler": "^3.65.1" + "wrangler": "^3.66.0" } } diff --git a/app/pnpm-lock.yaml b/app/pnpm-lock.yaml index 1bb2b5e3f..76d94b7c3 100644 --- a/app/pnpm-lock.yaml +++ b/app/pnpm-lock.yaml @@ -10,13 +10,13 @@ dependencies: version: 1.0.14 '@solid-primitives/event-listener': specifier: ^2.3.3 - version: 2.3.3(solid-js@1.8.18) + version: 2.3.3(solid-js@1.8.19) '@solid-primitives/intersection-observer': specifier: ^2.1.6 - version: 2.1.6(solid-js@1.8.18) + version: 2.1.6(solid-js@1.8.19) '@solid-primitives/resize-observer': specifier: ^2.0.26 - version: 2.0.26(solid-js@1.8.18) + version: 2.0.26(solid-js@1.8.19) lean-qr: specifier: ^2.3.4 version: 2.3.4 @@ -24,8 +24,8 @@ dependencies: specifier: ^4.1.7 version: 4.1.7 solid-js: - specifier: ^1.8.18 - version: 1.8.18 + specifier: ^1.8.19 + version: 1.8.19 devDependencies: '@ianvs/prettier-plugin-sort-imports': @@ -39,10 +39,10 @@ devDependencies: version: 0.1.1(tailwindcss@3.4.6) autoprefixer: specifier: ^10.4.19 - version: 10.4.19(postcss@8.4.39) + version: 10.4.19(postcss@8.4.40) postcss: - specifier: ^8.4.39 - version: 8.4.39 + specifier: ^8.4.40 + version: 8.4.40 prettier: specifier: ^3.3.3 version: 3.3.3 @@ -62,26 +62,26 @@ devDependencies: specifier: ^5.5.4 version: 5.5.4 unplugin-auto-import: - specifier: ^0.18.0 - version: 0.18.0(rollup@2.79.1) + specifier: ^0.18.2 + version: 0.18.2(rollup@2.79.1) unplugin-icons: specifier: ^0.19.0 version: 0.19.0 vite: - specifier: ^5.3.4 - version: 5.3.4 + specifier: ^5.3.5 + version: 5.3.5 vite-plugin-pwa: specifier: ^0.20.0 - version: 0.20.0(vite@5.3.4)(workbox-build@7.1.1)(workbox-window@7.1.0) + version: 0.20.0(vite@5.3.5)(workbox-build@7.1.1)(workbox-window@7.1.0) vite-plugin-solid: specifier: ^2.10.2 - version: 2.10.2(solid-js@1.8.18)(vite@5.3.4) + version: 2.10.2(solid-js@1.8.19)(vite@5.3.5) workbox-window: specifier: ^7.1.0 version: 7.1.0 wrangler: - specifier: ^3.65.1 - version: 3.65.1 + specifier: ^3.66.0 + version: 3.66.0 packages: @@ -2230,60 +2230,60 @@ packages: dev: true optional: true - /@solid-primitives/event-listener@2.3.3(solid-js@1.8.18): + /@solid-primitives/event-listener@2.3.3(solid-js@1.8.19): resolution: {integrity: sha512-DAJbl+F0wrFW2xmcV8dKMBhk9QLVLuBSW+TR4JmIfTaObxd13PuL7nqaXnaYKDWOYa6otB00qcCUIGbuIhSUgQ==} peerDependencies: solid-js: ^1.6.12 dependencies: - '@solid-primitives/utils': 6.2.3(solid-js@1.8.18) - solid-js: 1.8.18 + '@solid-primitives/utils': 6.2.3(solid-js@1.8.19) + solid-js: 1.8.19 dev: false - /@solid-primitives/intersection-observer@2.1.6(solid-js@1.8.18): + /@solid-primitives/intersection-observer@2.1.6(solid-js@1.8.19): resolution: {integrity: sha512-SeiCmN/R46Z+o9+5HhIQzSor0DqVPyo4ROLQMvCI8AsGZl/5nHlWzHTTbWPeukVUXTgb04wfC3DUo9IzF/XloA==} peerDependencies: solid-js: ^1.6.12 dependencies: - '@solid-primitives/utils': 6.2.3(solid-js@1.8.18) - solid-js: 1.8.18 + '@solid-primitives/utils': 6.2.3(solid-js@1.8.19) + solid-js: 1.8.19 dev: false - /@solid-primitives/resize-observer@2.0.26(solid-js@1.8.18): + /@solid-primitives/resize-observer@2.0.26(solid-js@1.8.19): resolution: {integrity: sha512-KbPhwal6ML9OHeUTZszBbt6PYSMj89d4wVCLxlvDYL4U0+p+xlCEaqz6v9dkCwm/0Lb+Wed7W5T1dQZCP3JUUw==} peerDependencies: solid-js: ^1.6.12 dependencies: - '@solid-primitives/event-listener': 2.3.3(solid-js@1.8.18) - '@solid-primitives/rootless': 1.4.5(solid-js@1.8.18) - '@solid-primitives/static-store': 0.0.8(solid-js@1.8.18) - '@solid-primitives/utils': 6.2.3(solid-js@1.8.18) - solid-js: 1.8.18 + '@solid-primitives/event-listener': 2.3.3(solid-js@1.8.19) + '@solid-primitives/rootless': 1.4.5(solid-js@1.8.19) + '@solid-primitives/static-store': 0.0.8(solid-js@1.8.19) + '@solid-primitives/utils': 6.2.3(solid-js@1.8.19) + solid-js: 1.8.19 dev: false - /@solid-primitives/rootless@1.4.5(solid-js@1.8.18): + /@solid-primitives/rootless@1.4.5(solid-js@1.8.19): resolution: {integrity: sha512-GFJE9GC3ojx0aUKqAUZmQPyU8fOVMtnVNrkdk2yS4kd17WqVSpXpoTmo9CnOwA+PG7FTzdIkogvfLQSLs4lrww==} peerDependencies: solid-js: ^1.6.12 dependencies: - '@solid-primitives/utils': 6.2.3(solid-js@1.8.18) - solid-js: 1.8.18 + '@solid-primitives/utils': 6.2.3(solid-js@1.8.19) + solid-js: 1.8.19 dev: false - /@solid-primitives/static-store@0.0.8(solid-js@1.8.18): + /@solid-primitives/static-store@0.0.8(solid-js@1.8.19): resolution: {integrity: sha512-ZecE4BqY0oBk0YG00nzaAWO5Mjcny8Fc06CdbXadH9T9lzq/9GefqcSe/5AtdXqjvY/DtJ5C6CkcjPZO0o/eqg==} peerDependencies: solid-js: ^1.6.12 dependencies: - '@solid-primitives/utils': 6.2.3(solid-js@1.8.18) - solid-js: 1.8.18 + '@solid-primitives/utils': 6.2.3(solid-js@1.8.19) + solid-js: 1.8.19 dev: false - /@solid-primitives/utils@6.2.3(solid-js@1.8.18): + /@solid-primitives/utils@6.2.3(solid-js@1.8.19): resolution: {integrity: sha512-CqAwKb2T5Vi72+rhebSsqNZ9o67buYRdEJrIFzRXz3U59QqezuuxPsyzTSVCacwS5Pf109VRsgCJQoxKRoECZQ==} peerDependencies: solid-js: ^1.6.12 dependencies: - solid-js: 1.8.18 + solid-js: 1.8.19 dev: false /@surma/rollup-plugin-off-main-thread@2.2.3: @@ -2347,11 +2347,11 @@ packages: /@types/node-forge@1.3.11: resolution: {integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==} dependencies: - '@types/node': 20.14.11 + '@types/node': 20.14.12 dev: true - /@types/node@20.14.11: - resolution: {integrity: sha512-kprQpL8MMeszbz6ojB5/tU8PLN4kesnN8Gjzw349rDlNgsSzg90lAVj3llK99Dh7JON+t9AuscPPFW6mPbTnSA==} + /@types/node@20.14.12: + resolution: {integrity: sha512-r7wNXakLeSsGT0H1AU863vS2wa5wBOK4bWMjZz2wj+8nBx+m5PeIn0k8AloSLpRuiwdRQZwarZqHE4FNArPuJQ==} dependencies: undici-types: 5.26.5 dev: true @@ -2372,7 +2372,7 @@ packages: resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==} requiresBuild: true dependencies: - '@types/node': 20.14.11 + '@types/node': 20.14.12 dev: true optional: true @@ -2499,7 +2499,7 @@ packages: engines: {node: '>= 4.0.0'} dev: true - /autoprefixer@10.4.19(postcss@8.4.39): + /autoprefixer@10.4.19(postcss@8.4.40): resolution: {integrity: sha512-BaENR2+zBZ8xXhM4pUaKUxlVdxZ0EZhjvbopwnXmxRUfqDmwSpC2lAi/QXvx7NRdPCo1WKEcEF6mV64si1z4Ew==} engines: {node: ^10 || ^12 || >=14} hasBin: true @@ -2511,7 +2511,7 @@ packages: fraction.js: 4.3.7 normalize-range: 0.1.2 picocolors: 1.0.1 - postcss: 8.4.39 + postcss: 8.4.40 postcss-value-parser: 4.2.0 dev: true @@ -2522,8 +2522,8 @@ packages: possible-typed-array-names: 1.0.0 dev: true - /babel-plugin-jsx-dom-expressions@0.37.23(@babel/core@7.24.9): - resolution: {integrity: sha512-Y/r8LyLi/njnwPTaDuPEReWk30FJ1KplloYvcFUhHmiH1F7yVVj5mWojD7mbO/IruKyvOs9OIPUoeMi3Z++J4w==} + /babel-plugin-jsx-dom-expressions@0.38.1(@babel/core@7.24.9): + resolution: {integrity: sha512-4FD4H69Cu4jHx2uLDEvx4YC5T/fC/Dmaafhsm8hXm7SjHYzjr09gBVyHdoFza+91f/g9e6tIzjbLCMkOXwmlew==} peerDependencies: '@babel/core': ^7.20.12 dependencies: @@ -2571,13 +2571,13 @@ packages: - supports-color dev: true - /babel-preset-solid@1.8.18(@babel/core@7.24.9): - resolution: {integrity: sha512-ky0FA4cCS9dk+xYBBItHoxtbRnaDIOGpmHLFqKPaR81hpMbJBOiLOZia2hT0JBwx4zn/D2OjMRvRr6kqtRMoUw==} + /babel-preset-solid@1.8.19(@babel/core@7.24.9): + resolution: {integrity: sha512-F3MoUdx3i4znhStnXUBno+5kGSbvhpbGrPgqfRPrS8W7foVJUOSd1/F9QDyd9dgClHfr+J7V14931eu1PEDDMQ==} peerDependencies: '@babel/core': ^7.0.0 dependencies: '@babel/core': 7.24.9 - babel-plugin-jsx-dom-expressions: 0.37.23(@babel/core@7.24.9) + babel-plugin-jsx-dom-expressions: 0.38.1(@babel/core@7.24.9) dev: true /balanced-match@1.0.2: @@ -2635,7 +2635,7 @@ packages: hasBin: true dependencies: caniuse-lite: 1.0.30001643 - electron-to-chromium: 1.5.0 + electron-to-chromium: 1.5.1 node-releases: 2.0.18 update-browserslist-db: 1.1.0(browserslist@4.23.2) dev: true @@ -2772,7 +2772,7 @@ packages: engines: {node: '>=12.13.0'} hasBin: true dependencies: - '@types/node': 20.14.11 + '@types/node': 20.14.12 escape-string-regexp: 4.0.0 is-wsl: 2.2.0 lighthouse-logger: 1.4.2 @@ -3101,8 +3101,8 @@ packages: jake: 10.9.2 dev: true - /electron-to-chromium@1.5.0: - resolution: {integrity: sha512-Vb3xHHYnLseK8vlMJQKJYXJ++t4u1/qJ3vykuVrVjvdiOEhYyT1AuP4x03G8EnPmYvYOhe9T+dADTmthjRQMkA==} + /electron-to-chromium@1.5.1: + resolution: {integrity: sha512-FKbOCOQ5QRB3VlIbl1LZQefWIYwszlBloaXcY2rbfpu9ioJnNh3TK03YtIDKDo3WKBi8u+YV4+Fn2CkEozgf4w==} dev: true /emoji-regex@8.0.0: @@ -4625,29 +4625,29 @@ packages: engines: {node: '>= 0.4'} dev: true - /postcss-import@15.1.0(postcss@8.4.39): + /postcss-import@15.1.0(postcss@8.4.40): resolution: {integrity: sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==} engines: {node: '>=14.0.0'} peerDependencies: postcss: ^8.0.0 dependencies: - postcss: 8.4.39 + postcss: 8.4.40 postcss-value-parser: 4.2.0 read-cache: 1.0.0 resolve: 1.22.8 dev: true - /postcss-js@4.0.1(postcss@8.4.39): + /postcss-js@4.0.1(postcss@8.4.40): resolution: {integrity: sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw==} engines: {node: ^12 || ^14 || >= 16} peerDependencies: postcss: ^8.4.21 dependencies: camelcase-css: 2.0.1 - postcss: 8.4.39 + postcss: 8.4.40 dev: true - /postcss-load-config@4.0.2(postcss@8.4.39): + /postcss-load-config@4.0.2(postcss@8.4.40): resolution: {integrity: sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ==} engines: {node: '>= 14'} peerDependencies: @@ -4660,17 +4660,17 @@ packages: optional: true dependencies: lilconfig: 3.1.2 - postcss: 8.4.39 - yaml: 2.4.5 + postcss: 8.4.40 + yaml: 2.5.0 dev: true - /postcss-nested@6.2.0(postcss@8.4.39): + /postcss-nested@6.2.0(postcss@8.4.40): resolution: {integrity: sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ==} engines: {node: '>=12.0'} peerDependencies: postcss: ^8.2.14 dependencies: - postcss: 8.4.39 + postcss: 8.4.40 postcss-selector-parser: 6.1.1 dev: true @@ -4686,8 +4686,8 @@ packages: resolution: {integrity: sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==} dev: true - /postcss@8.4.39: - resolution: {integrity: sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw==} + /postcss@8.4.40: + resolution: {integrity: sha512-YF2kKIUzAofPMpfH6hOi2cGnv/HrUlfucspc7pDyvv7kGdqXrfj8SCl/t8owkEgKEuu8ZcRjSOxFxVLqwChZ2Q==} engines: {node: ^10 || ^12 || >=14} dependencies: nanoid: 3.3.7 @@ -5212,14 +5212,14 @@ packages: resolution: {integrity: sha512-g6T+p7QO8npa+/hNx9ohv1E5pVCmWrVCUzUXJyLdMmftX6ER0oiWY/w9knEonLpnOp6b6FenKnMfR8gqwWdwig==} dev: true - /solid-js@1.8.18: - resolution: {integrity: sha512-cpkxDPvO/AuKBugVv6xKFd1C9VC0XZMu4VtF56IlHoux8HgyW44uqNSWbozMnVcpIzHIhS3vVXPAVZYM26jpWw==} + /solid-js@1.8.19: + resolution: {integrity: sha512-h8z/TvTQYsf894LM9Iau/ZW2iAKrCzAWDwjPhMcXnonmW1OIIihc28wp82b1wwei1p81fH5+gnfNOe8RzLbDRQ==} dependencies: csstype: 3.1.3 seroval: 1.1.0 seroval-plugins: 1.1.0(seroval@1.1.0) - /solid-refresh@0.6.3(solid-js@1.8.18): + /solid-refresh@0.6.3(solid-js@1.8.19): resolution: {integrity: sha512-F3aPsX6hVw9ttm5LYlth8Q15x6MlI/J3Dn+o3EQyRTtTxidepSTwAYdozt01/YA+7ObcciagGEyXIopGZzQtbA==} peerDependencies: solid-js: ^1.3 @@ -5227,7 +5227,7 @@ packages: '@babel/generator': 7.24.10 '@babel/helper-module-imports': 7.24.7 '@babel/types': 7.24.9 - solid-js: 1.8.18 + solid-js: 1.8.19 transitivePeerDependencies: - supports-color dev: true @@ -5472,11 +5472,11 @@ packages: normalize-path: 3.0.0 object-hash: 3.0.0 picocolors: 1.0.1 - postcss: 8.4.39 - postcss-import: 15.1.0(postcss@8.4.39) - postcss-js: 4.0.1(postcss@8.4.39) - postcss-load-config: 4.0.2(postcss@8.4.39) - postcss-nested: 6.2.0(postcss@8.4.39) + postcss: 8.4.40 + postcss-import: 15.1.0(postcss@8.4.40) + postcss-js: 4.0.1(postcss@8.4.40) + postcss-load-config: 4.0.2(postcss@8.4.40) + postcss-nested: 6.2.0(postcss@8.4.40) postcss-selector-parser: 6.1.1 resolve: 1.22.8 sucrase: 3.35.0 @@ -5737,7 +5737,7 @@ packages: pkg-types: 1.1.3 scule: 1.3.0 strip-literal: 2.1.0 - unplugin: 1.11.0 + unplugin: 1.12.0 transitivePeerDependencies: - rollup dev: true @@ -5754,8 +5754,8 @@ packages: engines: {node: '>= 10.0.0'} dev: true - /unplugin-auto-import@0.18.0(rollup@2.79.1): - resolution: {integrity: sha512-DZcj8tceMpwuZgBPM9hhKd7v05WAYCUc/qYjxV7vGbeVCGsQ8SHWumCyOYBDqYzkPd4FlQkuh+OH0cWgdCjcdw==} + /unplugin-auto-import@0.18.2(rollup@2.79.1): + resolution: {integrity: sha512-Dwb3rAic75harVBrVjwiq6H24PT+nBq2dpxV5BH8NNI6sDFaTytvP+iyo4xy7prQbR3r5K6nMs4f5Wp9PE4g8A==} engines: {node: '>=14'} peerDependencies: '@nuxt/kit': ^3.2.2 @@ -5773,7 +5773,7 @@ packages: magic-string: 0.30.10 minimatch: 9.0.5 unimport: 3.9.0(rollup@2.79.1) - unplugin: 1.11.0 + unplugin: 1.12.0 transitivePeerDependencies: - rollup dev: true @@ -5804,13 +5804,13 @@ packages: debug: 4.3.5 kolorist: 1.8.0 local-pkg: 0.5.0 - unplugin: 1.11.0 + unplugin: 1.12.0 transitivePeerDependencies: - supports-color dev: true - /unplugin@1.11.0: - resolution: {integrity: sha512-3r7VWZ/webh0SGgJScpWl2/MRCZK5d3ZYFcNaeci/GQ7Teop7zf0Nl2pUuz7G21BwPd9pcUPOC5KmJ2L3WgC5g==} + /unplugin@1.12.0: + resolution: {integrity: sha512-KeczzHl2sATPQUx1gzo+EnUkmN4VmGBYRRVOZSGvGITE9rGHRDGqft6ONceP3vgXcyJ2XjX5axG5jMWUwNCYLw==} engines: {node: '>=14.0.0'} dependencies: acorn: 8.12.1 @@ -5850,7 +5850,7 @@ packages: spdx-expression-parse: 3.0.1 dev: true - /vite-plugin-pwa@0.20.0(vite@5.3.4)(workbox-build@7.1.1)(workbox-window@7.1.0): + /vite-plugin-pwa@0.20.0(vite@5.3.5)(workbox-build@7.1.1)(workbox-window@7.1.0): resolution: {integrity: sha512-/kDZyqF8KqoXRpMUQtR5Atri/7BWayW8Gp7Kz/4bfstsV6zSFTxjREbXZYL7zSuRL40HGA+o2hvUAFRmC+bL7g==} engines: {node: '>=16.0.0'} peerDependencies: @@ -5865,14 +5865,14 @@ packages: debug: 4.3.5 fast-glob: 3.3.2 pretty-bytes: 6.1.1 - vite: 5.3.4 + vite: 5.3.5 workbox-build: 7.1.1 workbox-window: 7.1.0 transitivePeerDependencies: - supports-color dev: true - /vite-plugin-solid@2.10.2(solid-js@1.8.18)(vite@5.3.4): + /vite-plugin-solid@2.10.2(solid-js@1.8.19)(vite@5.3.5): resolution: {integrity: sha512-AOEtwMe2baBSXMXdo+BUwECC8IFHcKS6WQV/1NEd+Q7vHPap5fmIhLcAzr+DUJ04/KHx/1UBU0l1/GWP+rMAPQ==} peerDependencies: '@testing-library/jest-dom': ^5.16.6 || ^5.17.0 || ^6.* @@ -5884,18 +5884,18 @@ packages: dependencies: '@babel/core': 7.24.9 '@types/babel__core': 7.20.5 - babel-preset-solid: 1.8.18(@babel/core@7.24.9) + babel-preset-solid: 1.8.19(@babel/core@7.24.9) merge-anything: 5.1.7 - solid-js: 1.8.18 - solid-refresh: 0.6.3(solid-js@1.8.18) - vite: 5.3.4 - vitefu: 0.2.5(vite@5.3.4) + solid-js: 1.8.19 + solid-refresh: 0.6.3(solid-js@1.8.19) + vite: 5.3.5 + vitefu: 0.2.5(vite@5.3.5) transitivePeerDependencies: - supports-color dev: true - /vite@5.3.4: - resolution: {integrity: sha512-Cw+7zL3ZG9/NZBB8C+8QbQZmR54GwqIz+WMI4b3JgdYJvX+ny9AjJXqkGQlDXSXRP9rP0B4tbciRMOVEKulVOA==} + /vite@5.3.5: + resolution: {integrity: sha512-MdjglKR6AQXQb9JGiS7Rc2wC6uMjcm7Go/NHNO63EwiJXfuk9PgqiP/n5IDJCziMkfw9n4Ubp7lttNwz+8ZVKA==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: @@ -5923,13 +5923,13 @@ packages: optional: true dependencies: esbuild: 0.21.5 - postcss: 8.4.39 + postcss: 8.4.40 rollup: 4.19.0 optionalDependencies: fsevents: 2.3.3 dev: true - /vitefu@0.2.5(vite@5.3.4): + /vitefu@0.2.5(vite@5.3.5): resolution: {integrity: sha512-SgHtMLoqaeeGnd2evZ849ZbACbnwQCIwRH57t18FxcXoZop0uQu0uzlIhJBlF/eWVzuce0sHeqPcDo+evVcg8Q==} peerDependencies: vite: ^3.0.0 || ^4.0.0 || ^5.0.0 @@ -5937,7 +5937,7 @@ packages: vite: optional: true dependencies: - vite: 5.3.4 + vite: 5.3.5 dev: true /webidl-conversions@3.0.1: @@ -6160,8 +6160,8 @@ packages: '@cloudflare/workerd-windows-64': 1.20240718.0 dev: true - /wrangler@3.65.1: - resolution: {integrity: sha512-Z5NyrbpGMQCpim/6VnI1im0/Weh5+CU1sdep1JbfFxHjn/Jt9K+MeUq+kCns5ubkkdRx2EYsusB/JKyX2JdJ4w==} + /wrangler@3.66.0: + resolution: {integrity: sha512-5fEyXsP8qvrUeR13kCfA3OG1z/ABx+/a8hzIA55nCUM2/tjI67ZkfeN1VdOmG6cipZDvs4HfN8rp7j+e+21nKA==} engines: {node: '>=16.17.0'} hasBin: true peerDependencies: @@ -6185,6 +6185,7 @@ packages: selfsigned: 2.4.1 source-map: 0.6.1 unenv: /unenv-nightly@1.10.0-1717606461.a117952 + workerd: 1.20240718.0 xxhash-wasm: 1.0.2 optionalDependencies: fsevents: 2.3.3 @@ -6259,8 +6260,8 @@ packages: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} dev: true - /yaml@2.4.5: - resolution: {integrity: sha512-aBx2bnqDzVOyNKfsysjA2ms5ZlnjSAW2eG3/L5G/CSujfjLJTJsEw1bGw8kCf04KodQWk1pxlGnZ56CRxiawmg==} + /yaml@2.5.0: + resolution: {integrity: sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw==} engines: {node: '>= 14'} hasBin: true dev: true diff --git a/app/src/app/components/background.tsx b/app/src/app/components/background.tsx index c07dc1455..2637f313d 100644 --- a/app/src/app/components/background.tsx +++ b/app/src/app/components/background.tsx @@ -123,7 +123,9 @@ function TextWrapper({ focused: Accessor; joined: string; }) { - const seconds = joined.length * 2; + const p = createRWS(undefined as HTMLParagraphElement | undefined); + + const seconds = createRWS(joined.length * 2); const wasOnceOn = createRWS(false); @@ -133,13 +135,18 @@ function TextWrapper({ } }); + onMount(() => { + seconds.set(Math.round(p()!.clientWidth / 20)); + }); + return (

({ - scale, - groupedKeysToURLPath, -}: { - scale: Scale; - groupedKeysToURLPath: GroupedKeysToURLPath[Scale]; -}) { - type Key = keyof typeof groupedKeysToURLPath; - type ResourceData = ReturnType>; - - type ResourceDatasets = Record, ResourceData>; - - const datasets = groupedKeysToURLPath as any as ResourceDatasets; - - for (const key in groupedKeysToURLPath) { - if ((key as Key) !== "price") { - datasets[key as unknown as Exclude] = createResourceDataset( - { - scale, - path: groupedKeysToURLPath[key as Key] as any, - }, - ); - } - } - - const price = createResourceDataset({ - scale, - path: `/${scale}-to-price`, - }); - - Object.assign(datasets, { price }); - - return datasets; -} diff --git a/app/src/scripts/datasets/date.ts b/app/src/scripts/datasets/date.ts deleted file mode 100644 index f5f5a8382..000000000 --- a/app/src/scripts/datasets/date.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { createResourceDataset } from "./resource"; - -export { averages } from "./consts/averages"; - -export function createDateDatasets({ - groupedKeysToURLPath, -}: { - groupedKeysToURLPath: GroupedKeysToURLPath["date"]; -}) { - type Key = keyof typeof groupedKeysToURLPath; - type ResourceData = ReturnType>; - - type ResourceDatasets = Record, ResourceData>; - - const datasets = groupedKeysToURLPath as any as ResourceDatasets; - - for (const key in groupedKeysToURLPath) { - if ((key as Key) !== "price") { - datasets[key as Exclude] = createResourceDataset<"date">({ - scale: "date", - path: groupedKeysToURLPath[key as Key], - }); - } - } - - const price = createResourceDataset<"date", OHLC>({ - scale: "date", - path: "/date-to-price", - }); - - Object.assign(datasets, { price }); - - return datasets as ResourceDatasets & { - price: ResourceDataset<"date", OHLC>; - }; -} diff --git a/app/src/scripts/datasets/height.ts b/app/src/scripts/datasets/height.ts deleted file mode 100644 index 0cc38813b..000000000 --- a/app/src/scripts/datasets/height.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { createResourceDataset } from "./resource"; - -export function createHeightDatasets({ - groupedKeysToURLPath, -}: { - groupedKeysToURLPath: GroupedKeysToURLPath["height"]; -}) { - type Key = keyof typeof groupedKeysToURLPath; - type ResourceData = ReturnType>; - - type ResourceDatasets = Record, ResourceData>; - - const datasets = groupedKeysToURLPath as any as ResourceDatasets; - - for (const key in groupedKeysToURLPath) { - if ((key as Key) !== "price") { - datasets[key as Exclude] = createResourceDataset<"height">({ - scale: "height", - path: groupedKeysToURLPath[key as Key], - }); - } - } - - const price = createResourceDataset<"height", OHLC>({ - scale: "height", - path: "/height-to-price", - }); - - Object.assign(datasets, { price }); - - return datasets as ResourceDatasets & { - price: ResourceDataset<"height", OHLC>; - }; -} diff --git a/app/src/scripts/datasets/index.ts b/app/src/scripts/datasets/index.ts index abdfc1f52..6889e170d 100644 --- a/app/src/scripts/datasets/index.ts +++ b/app/src/scripts/datasets/index.ts @@ -5,8 +5,8 @@ export const scales = ["date" as const, "height" as const]; export const HEIGHT_CHUNK_SIZE = 10_000; export function createDatasets() { - const date = new Map>(); - const height = new Map>(); + const date = new Map>(); + const height = new Map>(); function getOrImport( scale: Scale, diff --git a/app/src/scripts/datasets/types.d.ts b/app/src/scripts/datasets/types.d.ts index 1a944898b..643ecf247 100644 --- a/app/src/scripts/datasets/types.d.ts +++ b/app/src/scripts/datasets/types.d.ts @@ -68,17 +68,8 @@ interface OHLC { close: number; } -type GroupedKeysToURLPath = - typeof import("/src/../../datasets/grouped_keys_to_url_path.json"); - -type DateDatasetPath = import("/src/../../datasets/paths").DatePath; - -type HeightDatasetPath = import("/src/../../datasets/paths").HeightPath; - -type LastDataPath = import("/src/../../datasets/paths").LastPath; - type DatasetPath = Scale extends "date" - ? DateDatasetPath - : HeightDatasetPath; + ? DatePath + : HeightPath; -type AnyDatasetPath = DateDatasetPath | HeightDatasetPath; +type AnyDatasetPath = DatePath | HeightPath; diff --git a/app/src/scripts/presets/hodlers/index.ts b/app/src/scripts/presets/hodlers/index.ts index d620dc55a..cccd5a318 100644 --- a/app/src/scripts/presets/hodlers/index.ts +++ b/app/src/scripts/presets/hodlers/index.ts @@ -18,7 +18,7 @@ export function createPresets(scale: ResourceScale) { title: `Hodl Supply`, description: "", icon: IconTablerRipple, - unit: "Bitcoin", + unit: "Percentage", bottom: [ { title: `24h`, diff --git a/app/src/scripts/presets/market/averages/index.ts b/app/src/scripts/presets/market/averages/index.ts index 987a7e97d..27b920b1f 100644 --- a/app/src/scripts/presets/market/averages/index.ts +++ b/app/src/scripts/presets/market/averages/index.ts @@ -1,4 +1,4 @@ -import { averages } from "/src/scripts/datasets/date"; +import { averages } from "/src/scripts/datasets/consts/averages"; import { colors } from "/src/scripts/utils/colors"; import { createRatioFolder } from "../../templates/ratio"; diff --git a/app/src/types/self.d.ts b/app/src/types/self.d.ts index 13e6b64ce..f9b9655a9 100644 --- a/app/src/types/self.d.ts +++ b/app/src/types/self.d.ts @@ -1,11 +1,3 @@ -interface Dated { - date: string; -} - -interface Heighted { - height: number; -} - interface Valued { value: number; } diff --git a/parser/.gitignore b/parser/.gitignore index 7ff0b82bf..47cec896f 100644 --- a/parser/.gitignore +++ b/parser/.gitignore @@ -8,7 +8,9 @@ flamegraph.svg /profile.json /inputs*/ +/in /outputs*/ +/out /snapshots*/ /exports*/ /imports*/ diff --git a/parser/src/actions/iter_blocks.rs b/parser/src/actions/iter_blocks.rs index 41279f207..cb39c76d6 100644 --- a/parser/src/actions/iter_blocks.rs +++ b/parser/src/actions/iter_blocks.rs @@ -73,26 +73,6 @@ pub fn iter_blocks(bitcoin_db: &BitcoinDB, block_count: usize) -> color_eyre::Re let current_block_date = Date::from_timestamp(timestamp); let current_block_height = height + blocks_loop_i; - if states.address_cohorts_durable_states.is_none() - && datasets - .address - .needs_durable_states(current_block_height, current_block_date) - { - states.address_cohorts_durable_states = - Some(AddressCohortsDurableStates::init( - &mut databases.address_index_to_address_data, - )); - } - - if states.utxo_cohorts_durable_states.is_none() - && datasets - .utxo - .needs_durable_states(current_block_height, current_block_date) - { - states.utxo_cohorts_durable_states = - Some(UTXOCohortsDurableStates::init(&states.date_data_vec)); - } - let next_block_date = next_block_opt .as_ref() .map(|next_block| Date::from_timestamp(next_block.header.time)); @@ -137,6 +117,27 @@ pub fn iter_blocks(bitcoin_db: &BitcoinDB, block_count: usize) -> color_eyre::Re blocks_loop_date, ); + if states.address_cohorts_durable_states.is_none() + && (compute_addresses + || datasets + .address + .needs_durable_states(current_block_height, current_block_date)) + { + states.address_cohorts_durable_states = + Some(AddressCohortsDurableStates::init( + &mut databases.address_index_to_address_data, + )); + } + + if states.utxo_cohorts_durable_states.is_none() + && datasets + .utxo + .needs_durable_states(current_block_height, current_block_date) + { + states.utxo_cohorts_durable_states = + Some(UTXOCohortsDurableStates::init(&states.date_data_vec)); + } + parse(ParseData { bitcoin_db, block: current_block, diff --git a/parser/src/datasets/mod.rs b/parser/src/datasets/mod.rs index 93f6750aa..eaa8f5f1b 100644 --- a/parser/src/datasets/mod.rs +++ b/parser/src/datasets/mod.rs @@ -277,13 +277,16 @@ impl AllDatasets { let datasets_len = path_to_type.len(); - Json::export("../datasets/disk_path_to_type.json", &path_to_type)?; + let server_inputs_path = "../server/in"; - let server_trigger_path = "../server/.trigger"; + fs::create_dir_all(server_inputs_path)?; - fs::create_dir_all(server_trigger_path)?; + Json::export( + &format!("{server_inputs_path}/disk_path_to_type.json"), + &path_to_type, + )?; - let datasets_len_path = format!("{server_trigger_path}/datasets_len.txt"); + let datasets_len_path = format!("{server_inputs_path}/datasets_len.txt"); if let Ok(len) = fs::read_to_string(&datasets_len_path) { if let Ok(len) = len.parse::() { diff --git a/parser/src/datasets/price/mod.rs b/parser/src/datasets/price/mod.rs index d8fbf1249..c171128a2 100644 --- a/parser/src/datasets/price/mod.rs +++ b/parser/src/datasets/price/mod.rs @@ -26,6 +26,7 @@ pub struct PriceDatasets { kraken_daily: Option>, kraken_1mn: Option>, binance_1mn: Option>, + binance_daily: Option>, binance_har: Option>, satonomics_by_height: BTreeMap>, satonomics_by_date: BTreeMap>, @@ -89,6 +90,7 @@ impl PriceDatasets { min_initial_states: MinInitialStates::default(), binance_1mn: None, + binance_daily: None, binance_har: None, kraken_1mn: None, kraken_daily: None, @@ -310,8 +312,9 @@ impl PriceDatasets { Ok(self.ohlcs.date.get(&date).unwrap().to_owned()) } else { let ohlc = self - .get_from_date_satonomics(&date) - .or_else(|_| self.get_from_daily_kraken(&date))?; + .get_from_daily_kraken(&date) + .or_else(|_| self.get_from_daily_binance(&date)) + .or_else(|_| self.get_from_date_satonomics(&date))?; self.ohlcs.date.insert(date, ohlc); @@ -323,7 +326,16 @@ impl PriceDatasets { let chunk_id = date.to_chunk_id(); #[allow(clippy::map_entry)] - if !self.satonomics_by_date.contains_key(&chunk_id) { + if !self.satonomics_by_date.contains_key(&chunk_id) + || self + .satonomics_by_date + .get(&chunk_id) + .unwrap() + .last_key_value() + .unwrap() + .0 + <= date + { self.satonomics_by_date .insert(chunk_id, Satonomics::fetch_date_prices(chunk_id)?); } @@ -337,9 +349,17 @@ impl PriceDatasets { } fn get_from_daily_kraken(&mut self, date: &Date) -> color_eyre::Result { - if self.kraken_daily.is_none() { - self.kraken_daily - .replace(Kraken::fetch_daily_prices().or_else(|_| Binance::fetch_daily_prices())?); + if self.kraken_daily.is_none() + || self + .kraken_daily + .as_ref() + .unwrap() + .last_key_value() + .unwrap() + .0 + <= date + { + self.kraken_daily.replace(Kraken::fetch_daily_prices()?); } self.kraken_daily @@ -350,6 +370,28 @@ impl PriceDatasets { .ok_or(Error::msg("Couldn't find date")) } + fn get_from_daily_binance(&mut self, date: &Date) -> color_eyre::Result { + if self.binance_daily.is_none() + || self + .binance_daily + .as_ref() + .unwrap() + .last_key_value() + .unwrap() + .0 + <= date + { + self.binance_daily.replace(Binance::fetch_daily_prices()?); + } + + self.binance_daily + .as_ref() + .unwrap() + .get(date) + .cloned() + .ok_or(Error::msg("Couldn't find date")) + } + pub fn get_height_ohlc( &mut self, height: Height, @@ -380,13 +422,13 @@ impl PriceDatasets { let previous_timestamp = previous_timestamp.map(clean_timestamp); let ohlc = self - .get_from_height_satonomics(&height) + .get_from_1mn_kraken(timestamp, previous_timestamp) .unwrap_or_else(|_| { - self.get_from_1mn_kraken(timestamp, previous_timestamp) + self.get_from_1mn_binance(timestamp, previous_timestamp) .unwrap_or_else(|_| { - self.get_from_1mn_binance(timestamp, previous_timestamp) + self.get_from_har_binance(timestamp, previous_timestamp) .unwrap_or_else(|_| { - self.get_from_har_binance(timestamp, previous_timestamp) + self.get_from_height_satonomics(&height) .unwrap_or_else(|_| { let date = Date::from_timestamp(timestamp); @@ -419,7 +461,10 @@ How to fix this: let chunk_id = height.to_chunk_id(); #[allow(clippy::map_entry)] - if !self.satonomics_by_height.contains_key(&chunk_id) { + if !self.satonomics_by_height.contains_key(&chunk_id) + || ((chunk_id.to_usize() + self.satonomics_by_height.get(&chunk_id).unwrap().len()) + <= height.to_usize()) + { self.satonomics_by_height .insert(chunk_id, Satonomics::fetch_height_prices(chunk_id)?); } @@ -437,7 +482,16 @@ How to fix this: timestamp: u32, previous_timestamp: Option, ) -> color_eyre::Result { - if self.kraken_1mn.is_none() { + if self.kraken_1mn.is_none() + || self + .kraken_1mn + .as_ref() + .unwrap() + .last_key_value() + .unwrap() + .0 + <= ×tamp + { self.kraken_1mn.replace(Kraken::fetch_1mn_prices()?); } @@ -449,7 +503,16 @@ How to fix this: timestamp: u32, previous_timestamp: Option, ) -> color_eyre::Result { - if self.binance_1mn.is_none() { + if self.binance_1mn.is_none() + || self + .binance_1mn + .as_ref() + .unwrap() + .last_key_value() + .unwrap() + .0 + <= ×tamp + { self.binance_1mn.replace(Binance::fetch_1mn_prices()?); } diff --git a/parser/src/io/consts.rs b/parser/src/io/consts.rs index 293a07581..62a50ceb6 100644 --- a/parser/src/io/consts.rs +++ b/parser/src/io/consts.rs @@ -1,2 +1,2 @@ -pub const IMPORTS_FOLDER_PATH: &str = "./imports"; +pub const INPUTS_FOLDER_PATH: &str = "./in"; pub const OUTPUTS_FOLDER_PATH: &str = "./target/outputs"; diff --git a/parser/src/price/binance.rs b/parser/src/price/binance.rs index 6c8934f2b..4ef3e9e80 100644 --- a/parser/src/price/binance.rs +++ b/parser/src/price/binance.rs @@ -1,6 +1,6 @@ #![allow(dead_code)] -use std::{collections::BTreeMap, path::Path}; +use std::{collections::BTreeMap, fs, path::Path}; use color_eyre::eyre::ContextCompat; use itertools::Itertools; @@ -8,7 +8,7 @@ use serde_json::Value; use crate::{ datasets::OHLC, - io::{Json, IMPORTS_FOLDER_PATH}, + io::{Json, INPUTS_FOLDER_PATH}, structs::Date, utils::{log, retry}, }; @@ -19,7 +19,9 @@ impl Binance { pub fn read_har_file() -> color_eyre::Result> { log("binance: read har file"); - let path_binance_har = Path::new(IMPORTS_FOLDER_PATH).join("binance.har"); + fs::create_dir_all(INPUTS_FOLDER_PATH)?; + + let path_binance_har = Path::new(INPUTS_FOLDER_PATH).join("binance.har"); let json: BTreeMap = Json::import(path_binance_har.to_str().unwrap()).unwrap_or_default(); @@ -195,7 +197,7 @@ impl Binance { .collect::>()) }, 10, - 5, + 10, ) } } diff --git a/parser/src/price/kraken.rs b/parser/src/price/kraken.rs index cd29a8e5b..da51face3 100644 --- a/parser/src/price/kraken.rs +++ b/parser/src/price/kraken.rs @@ -62,7 +62,7 @@ impl Kraken { .collect::>()) }, 10, - 5, + 10, ) } @@ -117,7 +117,7 @@ impl Kraken { .collect::>()) }, 10, - 5, + 10, ) } } diff --git a/parser/src/price/satonomics.rs b/parser/src/price/satonomics.rs index 2453b9481..4a02a1011 100644 --- a/parser/src/price/satonomics.rs +++ b/parser/src/price/satonomics.rs @@ -21,11 +21,11 @@ const RETRIES: usize = 10; impl Satonomics { fn get_base_url(try_index: usize) -> &'static str { - if try_index < RETRIES / 2 { - SATONOMICS_OFFICIAL_URL - } else { - SATONOMICS_OFFICIAL_BACKUP_URL - } + // if try_index < RETRIES / 2 { + SATONOMICS_OFFICIAL_URL + // } else { + // SATONOMICS_OFFICIAL_BACKUP_URL + // } } pub fn fetch_height_prices(chunk_id: HeightMapChunkId) -> color_eyre::Result> { diff --git a/server/.gitignore b/server/.gitignore index 12c3a4b28..9788728f4 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -1,4 +1,4 @@ /target .DS_Store /parser.log -.trigger +/in diff --git a/server/run.sh b/server/run.sh index 4f525d71b..754d9c1b1 100755 --- a/server/run.sh +++ b/server/run.sh @@ -1,5 +1,5 @@ if cargo watch --help &> /dev/null; then - cargo watch --no-vcs-ignores -w "./src" -w "./run.sh" -w ".trigger" -x "run -r" + cargo watch --no-vcs-ignores -w "./src" -w "./run.sh" -w "./in/datasets_len.txt" -x "run -r" else cargo run -r fi diff --git a/server/src/main.rs b/server/src/main.rs index da6916a19..f9d217790 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -38,7 +38,7 @@ async fn main() -> color_eyre::Result<()> { let routes = Routes::build(); - routes.generate_front_end_files(); + routes.generate_dts_file(); let state = AppState { routes: Arc::new(routes), diff --git a/server/src/routes.rs b/server/src/routes.rs index 466a46203..6d5b76dd5 100644 --- a/server/src/routes.rs +++ b/server/src/routes.rs @@ -20,12 +20,13 @@ pub struct Route { #[derive(Clone, Default, Deref, DerefMut)] pub struct Routes(pub Grouped>); -const DATASETS_PATH: &str = "../datasets"; +const INPUTS_PATH: &str = "./in"; +const APP_TYPES_PATH: &str = "../app/src/types"; impl Routes { pub fn build() -> Self { let path_to_type: BTreeMap = - Json::import(&format!("{DATASETS_PATH}/disk_path_to_type.json")).unwrap(); + Json::import(&format!("{INPUTS_PATH}/disk_path_to_type.json")).unwrap(); let mut routes = Routes::default(); @@ -99,42 +100,14 @@ impl Routes { routes } - pub fn generate_front_end_files(&self) { - self.generate_json_group_files(); - self.generate_definition_files(); - } - - fn generate_json_group_files(&self) { - let map_to_group = |map: &HashMap| -> BTreeMap { - map.iter() - .map(|(key, route)| (key.to_owned(), route.url_path.to_owned())) - .collect() - }; - - let date_group = map_to_group(&self.date); - let height_group = map_to_group(&self.height); - let last_group = map_to_group(&self.last); - - let groups = Paths(Grouped { - date: date_group, - height: height_group, - last: last_group, - }); - - let _ = Json::export( - &format!("{DATASETS_PATH}/grouped_keys_to_url_path.json"), - &groups, - ); - } - - fn generate_definition_files(&self) { + pub fn generate_dts_file(&self) { let map_to_type = |name: &str, map: &HashMap| -> String { let paths = map .values() .map(|route| format!("\"{}\"", route.url_path)) .join(" | "); - format!("export type {}Path = {};\n", name, paths) + format!("type {}Path = {};\n", name, paths) }; let date_type = map_to_type("Date", &self.date); @@ -144,7 +117,7 @@ impl Routes { let last_type = map_to_type("Last", &self.last); fs::write( - format!("{DATASETS_PATH}/paths.d.ts"), + format!("{APP_TYPES_PATH}/paths.d.ts"), format!("{date_type}\n{height_type}\n{last_type}"), ) .unwrap();