From 56f5bed4ad7d915e9b683a0d79807a930c4d9926 Mon Sep 17 00:00:00 2001 From: Jasen Qin Date: Wed, 24 Apr 2024 16:23:43 +1000 Subject: [PATCH] ad --- pos-frontend/.eslintrc.json | 3 +- pos-frontend/__test__/db.test.jsx | 10 +++ pos-frontend/__test__/rocksdb.test.jsx | 20 +++--- pos-frontend/app/database.ts | 6 ++ pos-frontend/package.json | 1 + pos-frontend/pnpm-lock.yaml | 89 ++++++++++++++++++++++++++ 6 files changed, 118 insertions(+), 11 deletions(-) create mode 100644 pos-frontend/__test__/db.test.jsx create mode 100644 pos-frontend/app/database.ts diff --git a/pos-frontend/.eslintrc.json b/pos-frontend/.eslintrc.json index 73601b7..15871e5 100644 --- a/pos-frontend/.eslintrc.json +++ b/pos-frontend/.eslintrc.json @@ -1,5 +1,6 @@ { "extends": [ - "next" + "next/babel", + "next/core-web-vitals" ] } \ No newline at end of file diff --git a/pos-frontend/__test__/db.test.jsx b/pos-frontend/__test__/db.test.jsx new file mode 100644 index 0000000..c0cf28b --- /dev/null +++ b/pos-frontend/__test__/db.test.jsx @@ -0,0 +1,10 @@ +import '@testing-library/jest-dom' +import pl from 'nodejs-polars' + +describe('DATABASE', () => { + it('DATA', () => { + const fooSeries = pl.Series("foo", [1, 2, 3]) + let res = fooSeries.sum() + console.log(res) + }) +}) diff --git a/pos-frontend/__test__/rocksdb.test.jsx b/pos-frontend/__test__/rocksdb.test.jsx index 110a792..4d48895 100644 --- a/pos-frontend/__test__/rocksdb.test.jsx +++ b/pos-frontend/__test__/rocksdb.test.jsx @@ -4,20 +4,20 @@ describe('Database', () => { it('DB WORKS', () => { // 1) Create our database, supply location and options. // This will create or open the underlying RocksDB store. - const db = level('./mydb') + // const db = level('./mydb') // 2) Put a key & value // isnt this synchronous? - db.put('name', 'Level', function (err) { - if (err) return console.log('Ooops!', err) // some kind of I/O error + // db.put('name', 'Level', function (err) { + // if (err) return console.log('Ooops!', err) // some kind of I/O error - // 3) Fetch by key - db.get('name', function (err, value) { - if (err) return console.log('Ooops!', err) // likely the key was not found + // // 3) Fetch by key + // db.get('name', function (err, value) { + // if (err) return console.log('Ooops!', err) // likely the key was not found - // Ta da! - console.log('name=' + value) - }) - }) + // // Ta da! + // console.log('name=' + value) + // }) + // }) }) }) diff --git a/pos-frontend/app/database.ts b/pos-frontend/app/database.ts new file mode 100644 index 0000000..9ed5f3e --- /dev/null +++ b/pos-frontend/app/database.ts @@ -0,0 +1,6 @@ +import pl from 'nodejs-polars' +const fooSeries = pl.Series("foo", [1, 2, 3]) + +let res = fooSeries.sum() + +console.log(res) diff --git a/pos-frontend/package.json b/pos-frontend/package.json index 4d12812..099c388 100644 --- a/pos-frontend/package.json +++ b/pos-frontend/package.json @@ -18,6 +18,7 @@ "framer-motion": "^11.0.25", "level-rocksdb": "^5.0.0", "next": "^14.1.4", + "nodejs-polars": "^0.11.0", "react": "^18", "react-dom": "^18", "rocksdb": "^5.2.1" diff --git a/pos-frontend/pnpm-lock.yaml b/pos-frontend/pnpm-lock.yaml index 95d7867..be4662b 100644 --- a/pos-frontend/pnpm-lock.yaml +++ b/pos-frontend/pnpm-lock.yaml @@ -26,6 +26,9 @@ dependencies: next: specifier: ^14.1.4 version: 14.1.4(@babel/core@7.24.4)(react-dom@18.2.0)(react@18.2.0) + nodejs-polars: + specifier: ^0.11.0 + version: 0.11.0 react: specifier: ^18 version: 18.2.0 @@ -5587,6 +5590,92 @@ packages: /node-releases@2.0.14: resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} + /nodejs-polars-android-arm64@0.11.0: + resolution: {integrity: sha512-AuwmFvhrOELkfqmhV2ZArxV66XLlHNP/1vZqUgbPqG4nmvKi9J4RGRnKXNW+BjDgNzV/PF2OoJekEwe/Nh+whA==} + engines: {node: '>= 16'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: false + optional: true + + /nodejs-polars-darwin-arm64@0.11.0: + resolution: {integrity: sha512-4VuRbWV0s5KlP8Zdw0GY2SGRXS25Ih/3qo0F3VVObDDxu60sU0m32z3fGMziphQw0Dl7Ldk1cloYyu72gnfKCQ==} + engines: {node: '>= 16'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: false + optional: true + + /nodejs-polars-darwin-x64@0.11.0: + resolution: {integrity: sha512-SAjq47Mk1cSBpf0czTxSbHMM5vTCwKdnsSFQTtUYyjqN+22l8h5oTDPOppMQ6coq0DxLugnSvmrIOeZ0HY213A==} + engines: {node: '>= 16'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: false + optional: true + + /nodejs-polars-linux-arm64-gnu@0.11.0: + resolution: {integrity: sha512-BH9ePSHYDlG5ggg/YM/kvLuv8TbctRAUUEhCnpgaJeBPnrtRJC+hzbWKpTcGc+pOwvunfGS+/FG9BzLtFb9POg==} + engines: {node: '>= 16'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /nodejs-polars-linux-arm64-musl@0.11.0: + resolution: {integrity: sha512-IYZ/xIACiedX4gjklyKzD1/gOOOSvCeINEB3Vc6Ene0cQI52PZtJNwfIo44ofM3Jqx0YDrLW88y5Myu+NdwmOw==} + engines: {node: '>= 16'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /nodejs-polars-linux-x64-gnu@0.11.0: + resolution: {integrity: sha512-SnJdhVAGPAxQ5ZB3QVacCF6SnzWI7/2qp1X4AEvaVFoAaZp3ahdE+1K9qYS3EZZM5y1DdVbok1cJzQs8UlM9VA==} + engines: {node: '>= 16'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /nodejs-polars-linux-x64-musl@0.11.0: + resolution: {integrity: sha512-ug8f34akvrrHDU8UvObU45VswwVJYN85AUF+K5vZGh7zGUoZlwqG4PfWr2vKjSz41XrfgqkeMwoFZlTCrrMNoA==} + engines: {node: '>= 16'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /nodejs-polars-win32-x64-msvc@0.11.0: + resolution: {integrity: sha512-MF3rVxabCAy6GJ+ohaeCsGUn3pjOlHwjj0iCgjHxdJDvmXpNl2TTFqGMijicDqsRbv/TKt90o6QUrBZl94MQJQ==} + engines: {node: '>= 16'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: false + optional: true + + /nodejs-polars@0.11.0: + resolution: {integrity: sha512-rLhYkhcMCGrRXSUOVt+wskNiqaSapEWpo7hPlhQvEFkjcn4NPO/0RPHswGezOdIgQ3h778jpNkIXQjxdD5bXdA==} + engines: {node: '>= 18'} + optionalDependencies: + nodejs-polars-android-arm64: 0.11.0 + nodejs-polars-darwin-arm64: 0.11.0 + nodejs-polars-darwin-x64: 0.11.0 + nodejs-polars-linux-arm64-gnu: 0.11.0 + nodejs-polars-linux-arm64-musl: 0.11.0 + nodejs-polars-linux-x64-gnu: 0.11.0 + nodejs-polars-linux-x64-musl: 0.11.0 + nodejs-polars-win32-x64-msvc: 0.11.0 + dev: false + /normalize-path@3.0.0: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'}