From 35bae9180dec32d19f9cebda5278c49962d75c62 Mon Sep 17 00:00:00 2001 From: Georgi Durankiev Date: Wed, 25 Jun 2025 01:36:42 +0300 Subject: [PATCH] todos & basic data meteo --- package-lock.json | 365 +++++++++++++++++- package.json | 4 + .../air-quality/air-quality-generator.svelte | 3 + .../satelites/satellites-generator.svelte | 3 + .../weather/weather-generator.svelte | 3 + src/routes/on-out/+page.ts | 32 ++ 6 files changed, 409 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index b48e12b..4c9e516 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,10 @@ "": { "name": "hear-on-out", "version": "0.0.1", + "dependencies": { + "tonal": "^6.4.2", + "tone": "^15.1.22" + }, "devDependencies": { "@eslint/compat": "^1.2.5", "@eslint/js": "^9.18.0", @@ -79,7 +83,6 @@ "version": "7.27.6", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.6.tgz", "integrity": "sha512-vbavdySgbTTrmFE+EsiqUTzlOr5bzlnJtUv9PynGCAKvfQqjIXbvFdumPM/GxMDfyuGMJaJAU6TO4zc1Jf1i8Q==", - "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" @@ -1569,6 +1572,295 @@ "@testing-library/dom": ">=7.21.4" } }, + "node_modules/@tonaljs/abc-notation": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@tonaljs/abc-notation/-/abc-notation-4.9.1.tgz", + "integrity": "sha512-2fDUdPsFDdgZgyIiZCTYGKy30QiwIQxSXCSN2thGrSMXbQKCp8iTC8haStYcrA+25MPWhWlmvC/pz3tGcTNAqQ==", + "license": "MIT", + "dependencies": { + "@tonaljs/pitch-distance": "5.0.5", + "@tonaljs/pitch-note": "6.1.0" + } + }, + "node_modules/@tonaljs/array": { + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/@tonaljs/array/-/array-4.8.4.tgz", + "integrity": "sha512-97HVdpZy82PqNBDMM9PRSbO2DUrnxNg3++N4xqLpfby70fKHAHhTWrMXWZK+Dzs76HDPQLd+qhd4cq28eBZzjw==", + "license": "MIT", + "dependencies": { + "@tonaljs/pitch-note": "6.1.0" + } + }, + "node_modules/@tonaljs/chord": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@tonaljs/chord/-/chord-6.1.1.tgz", + "integrity": "sha512-gsLyGGkOt0g5L/uF4ICpYQengahW3WAMjckyvyzvqMYpvH7fokmtcymOfbltDQzaVuYuL0TsVmbfjbah2rKEww==", + "license": "MIT", + "dependencies": { + "@tonaljs/chord-detect": "4.9.1", + "@tonaljs/chord-type": "5.1.1", + "@tonaljs/collection": "4.9.0", + "@tonaljs/interval": "^5.1.0", + "@tonaljs/pcset": "4.10.1", + "@tonaljs/pitch-distance": "5.0.5", + "@tonaljs/pitch-note": "6.1.0", + "@tonaljs/scale-type": "4.9.1" + } + }, + "node_modules/@tonaljs/chord-detect": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@tonaljs/chord-detect/-/chord-detect-4.9.1.tgz", + "integrity": "sha512-rV/9+R7aZ9cQorQ3jdNMMMh63onosglYZM71Q0n7KKcWMAGrxF66MzxBG82xy+w1QDMJQslB3iHfDHUiS6wRjA==", + "license": "MIT", + "dependencies": { + "@tonaljs/chord-type": "5.1.1", + "@tonaljs/pcset": "4.10.1", + "@tonaljs/pitch-note": "6.1.0" + } + }, + "node_modules/@tonaljs/chord-type": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@tonaljs/chord-type/-/chord-type-5.1.1.tgz", + "integrity": "sha512-ti4WzRYvvjH7to0G3zlJFq7WsjHqmcqbk8Jv98aZSR5YumLdY/ua2yOPPyoPq82n6vfgjZsacnAZ3v8/SodOcw==", + "license": "MIT", + "dependencies": { + "@tonaljs/pcset": "4.10.1" + } + }, + "node_modules/@tonaljs/collection": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/@tonaljs/collection/-/collection-4.9.0.tgz", + "integrity": "sha512-Mk0h7O54nT6PgNVcUYauzxa5KOB23+0AOKudWzRH7JhJIN9vhVIC7PtwZXE+/G051UTbHSFIcN/afkgF4nB/8A==", + "license": "MIT" + }, + "node_modules/@tonaljs/core": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@tonaljs/core/-/core-5.0.2.tgz", + "integrity": "sha512-v/fIRsB+lz93/yJnDEWvjDX6nDJ/Pz3cb0znm/UD8qKpN9BhN+v93iIaZG5LX0J2JNS35TtgIhwKFO10j6zieQ==", + "license": "MIT", + "dependencies": { + "@tonaljs/pitch": "5.0.2", + "@tonaljs/pitch-distance": "5.0.5", + "@tonaljs/pitch-interval": "6.1.0", + "@tonaljs/pitch-note": "6.1.0" + } + }, + "node_modules/@tonaljs/duration-value": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/@tonaljs/duration-value/-/duration-value-4.9.0.tgz", + "integrity": "sha512-Muz54HyIe0nMYKWx6wyTa4y17ma29DtpJF4/oqJphy6A124rAVDe/SKit8JGOvDYAQj71FUXqs17sXBxO/ExVw==", + "license": "MIT" + }, + "node_modules/@tonaljs/interval": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@tonaljs/interval/-/interval-5.1.0.tgz", + "integrity": "sha512-GR9dUjn0j7yhjwjRh8HQxZYXOiVl05WfY3AFyMB9rfg807K4dSJmWfPTULPQXyHJ6NiZOPXcwRs8MxMLDxgdbg==", + "license": "MIT", + "dependencies": { + "@tonaljs/pitch": "^5.0.2", + "@tonaljs/pitch-distance": "^5.0.4", + "@tonaljs/pitch-interval": "^6.0.0" + } + }, + "node_modules/@tonaljs/key": { + "version": "4.11.2", + "resolved": "https://registry.npmjs.org/@tonaljs/key/-/key-4.11.2.tgz", + "integrity": "sha512-fc1y5+NwS4S3amirzYLLB324PxJDO00oIBbLJclAddc46UBeYnu4FNz+1nZboHCXRQ/06/ftuaWD/l7HrAoulw==", + "license": "MIT", + "dependencies": { + "@tonaljs/note": "4.12.1", + "@tonaljs/pitch-note": "6.1.0", + "@tonaljs/roman-numeral": "4.9.1" + } + }, + "node_modules/@tonaljs/midi": { + "version": "4.10.2", + "resolved": "https://registry.npmjs.org/@tonaljs/midi/-/midi-4.10.2.tgz", + "integrity": "sha512-MPamXhEwPL7L1udLfYMm3Ft8mLYtHr62Zi2w5zYHM2P7YwIvNoiX0+dvAN5is1Wvq4iVRa8AjFHerjOW/SZhGg==", + "license": "MIT", + "dependencies": { + "@tonaljs/pitch-note": "6.1.0" + } + }, + "node_modules/@tonaljs/mode": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@tonaljs/mode/-/mode-4.9.1.tgz", + "integrity": "sha512-h+K7eOUKpyX7kMRCwCew6cV1oN0sZYD5LLeKD7zEERNd/6wvGBfGCdMZECGqzpFUmjUyCY87IOntem6EPbKVCg==", + "license": "MIT", + "dependencies": { + "@tonaljs/collection": "4.9.0", + "@tonaljs/interval": "5.1.0", + "@tonaljs/pcset": "4.10.1", + "@tonaljs/pitch-distance": "5.0.5", + "@tonaljs/pitch-note": "6.1.0", + "@tonaljs/scale-type": "4.9.1" + } + }, + "node_modules/@tonaljs/note": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@tonaljs/note/-/note-4.12.1.tgz", + "integrity": "sha512-yh6cnhu21bUb0VuIQWxObSbWBVp2cHIkJj4zZ4qsNOW4jSqn74+wHpSbOTDF8q+2hl6upz7TtBRavtqwPtLUCQ==", + "license": "MIT", + "dependencies": { + "@tonaljs/midi": "4.10.2", + "@tonaljs/pitch": "5.0.2", + "@tonaljs/pitch-distance": "5.0.5", + "@tonaljs/pitch-interval": "6.1.0", + "@tonaljs/pitch-note": "6.1.0" + } + }, + "node_modules/@tonaljs/pcset": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/@tonaljs/pcset/-/pcset-4.10.1.tgz", + "integrity": "sha512-CZG1rpKc38yMfpEJsbDTvsTmQqsek9xxcuMgK64Tr6sP1lEiDuZJbQeKVWWRnreBF2FQ1cEGLmfOpvSO+40csA==", + "license": "MIT", + "dependencies": { + "@tonaljs/collection": "4.9.0", + "@tonaljs/pitch": "5.0.2", + "@tonaljs/pitch-distance": "5.0.5", + "@tonaljs/pitch-interval": "6.1.0", + "@tonaljs/pitch-note": "6.1.0" + } + }, + "node_modules/@tonaljs/pitch": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@tonaljs/pitch/-/pitch-5.0.2.tgz", + "integrity": "sha512-mxaXJPPe+LIJdjzpZEl8I8Wx3dEvlzkBbsr2Ltwc2dTAdnErAZ5R0TxVq2egF27lMvQN2QPQPWI9iDPPdVUmrg==", + "license": "MIT" + }, + "node_modules/@tonaljs/pitch-distance": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/@tonaljs/pitch-distance/-/pitch-distance-5.0.5.tgz", + "integrity": "sha512-dTfjsU0zyrj5YmiFio5prPaD5w7sBmHp4nnmlEg70nHY+SerAH0KiO9HM9usttVgRFUaXl0Gc7OI8YMGfSFmug==", + "license": "MIT", + "dependencies": { + "@tonaljs/pitch": "5.0.2", + "@tonaljs/pitch-interval": "6.1.0", + "@tonaljs/pitch-note": "6.1.0" + } + }, + "node_modules/@tonaljs/pitch-interval": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@tonaljs/pitch-interval/-/pitch-interval-6.1.0.tgz", + "integrity": "sha512-9ZMxA7V4UgySnOKPIG6HECzhDb8mbiTCIdNNIzCIfz5XpjUmohku2YZpVVWMacLHgyeQicJzNoRiPel5oSAn4A==", + "license": "MIT", + "dependencies": { + "@tonaljs/pitch": "5.0.2" + } + }, + "node_modules/@tonaljs/pitch-note": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@tonaljs/pitch-note/-/pitch-note-6.1.0.tgz", + "integrity": "sha512-A4OSLo8DjM38u73862LnDmL4YInDDRBmg0fojXcvu4cyU3oOlqndyeHOra1OVoH/WW46uNIxNs1wJDZNPWL5KQ==", + "license": "MIT", + "dependencies": { + "@tonaljs/pitch": "5.0.2" + } + }, + "node_modules/@tonaljs/progression": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@tonaljs/progression/-/progression-4.9.1.tgz", + "integrity": "sha512-jHdZUNlXRmjrvbZrvjoW6syW7dO9ilhgvyouB6YuVM5lGShwTN9dsSuQYsugso9jYHkwQBgYj5SaXTTY0/0nHw==", + "license": "MIT", + "dependencies": { + "@tonaljs/chord": "6.1.1", + "@tonaljs/pitch-distance": "5.0.5", + "@tonaljs/pitch-interval": "6.1.0", + "@tonaljs/pitch-note": "6.1.0", + "@tonaljs/roman-numeral": "4.9.1" + } + }, + "node_modules/@tonaljs/range": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/@tonaljs/range/-/range-4.9.2.tgz", + "integrity": "sha512-XhFbCJCrEEIVz3MNmdVp9QUyiJA6eqnNnQeNqto8AuT5BYuffHDoMkBmvvjPuV5Lh8zfF9D0aqglvqPbZ+neKQ==", + "license": "MIT", + "dependencies": { + "@tonaljs/collection": "4.9.0", + "@tonaljs/midi": "4.10.2" + } + }, + "node_modules/@tonaljs/rhythm-pattern": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@tonaljs/rhythm-pattern/-/rhythm-pattern-1.0.0.tgz", + "integrity": "sha512-3hp4Yw49e6BTWApRNb7arJ6HiICsHRFZYijuPE+vR93lIo9+lxcOMh0OPc4DyupTN7cvFTSB70Z7B/IeEJxhCQ==", + "license": "MIT" + }, + "node_modules/@tonaljs/roman-numeral": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@tonaljs/roman-numeral/-/roman-numeral-4.9.1.tgz", + "integrity": "sha512-dJGKBNHdPrNTE97ZDk4t6wpNmgYcpHyLkAvWkRP9I/HsDkeTFFQqNXosYIvspPWrFySlRpeqqFwcqV74MYoOag==", + "license": "MIT", + "dependencies": { + "@tonaljs/pitch": "5.0.2", + "@tonaljs/pitch-interval": "6.1.0", + "@tonaljs/pitch-note": "6.1.0" + } + }, + "node_modules/@tonaljs/scale": { + "version": "4.13.3", + "resolved": "https://registry.npmjs.org/@tonaljs/scale/-/scale-4.13.3.tgz", + "integrity": "sha512-IcPMpOm6gMQJ3A2IXZ5dN0wOhHIUonQY8abTql4BrwcVCUaItXWQfSd9t1HII+2kA6J8JCeY2BukTr6wVwAhXQ==", + "license": "MIT", + "dependencies": { + "@tonaljs/chord-type": "5.1.1", + "@tonaljs/collection": "4.9.0", + "@tonaljs/note": "4.12.1", + "@tonaljs/pcset": "4.10.1", + "@tonaljs/pitch-distance": "5.0.5", + "@tonaljs/pitch-note": "6.1.0", + "@tonaljs/scale-type": "4.9.1" + } + }, + "node_modules/@tonaljs/scale-type": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@tonaljs/scale-type/-/scale-type-4.9.1.tgz", + "integrity": "sha512-Nz2wThzz5NmWNx0vazX7MqNbF8kT1g5BEcbZcWjgkc67zhwosfZE0LEn7W9XcVDEws71b8CqQqDPKUEEybC9Rw==", + "license": "MIT", + "dependencies": { + "@tonaljs/pcset": "4.10.1" + } + }, + "node_modules/@tonaljs/time-signature": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/@tonaljs/time-signature/-/time-signature-4.9.0.tgz", + "integrity": "sha512-zRo8CBqg/2guzTlF2vxyVIuB5gmwWQaxlknJPUSDII8CTdQ/x3a1LlNoMKkvTUnqwCihe3WrNPZ5XUfOOTthYA==", + "license": "MIT" + }, + "node_modules/@tonaljs/voice-leading": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@tonaljs/voice-leading/-/voice-leading-5.1.2.tgz", + "integrity": "sha512-lV5hsDZC4ekhh465d2aVFFqyG9AOZvwKdxU1+dNB/P6ldefU1yHC10mKdY7FrdhVgKeGZG1MbJh8rETaKVg7vA==", + "license": "MIT", + "dependencies": { + "@tonaljs/note": "4.12.1" + } + }, + "node_modules/@tonaljs/voicing": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@tonaljs/voicing/-/voicing-5.1.2.tgz", + "integrity": "sha512-Zk/8yPV+POxXq7bk9DermlTF86AmVxzN1ZNzK+hNtHF29Zah+w0xz+rEzKhQtU4q9vuqB4iGQO0q76VcbIDMew==", + "license": "MIT", + "dependencies": { + "@tonaljs/chord": "6.1.1", + "@tonaljs/interval": "5.1.0", + "@tonaljs/note": "4.12.1", + "@tonaljs/range": "4.9.2", + "@tonaljs/voice-leading": "5.1.2", + "@tonaljs/voicing-dictionary": "5.1.2" + } + }, + "node_modules/@tonaljs/voicing-dictionary": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@tonaljs/voicing-dictionary/-/voicing-dictionary-5.1.2.tgz", + "integrity": "sha512-Rsfz70rAXoBB3aUUgtOwaJzPVRk6icyzVzSjUonqUsWq4jWCavv0QOO6yOODQ22SzyzWMv2vFDfIYRj7f1fXNQ==", + "license": "MIT", + "dependencies": { + "@tonaljs/chord": "6.1.1", + "@tonaljs/note": "4.12.1", + "@tonaljs/voice-leading": "5.1.2" + } + }, "node_modules/@types/aria-query": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", @@ -2115,6 +2407,19 @@ "node": ">=12" } }, + "node_modules/automation-events": { + "version": "7.1.11", + "resolved": "https://registry.npmjs.org/automation-events/-/automation-events-7.1.11.tgz", + "integrity": "sha512-TnclbJ0482ydRenzrR9FIbqalHScBBdQTIXv8tVunhYx8dq7E0Eq5v5CSAo67YmLXNbx5jCstHcLZDJ33iONDw==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.27.6", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=18.2.0" + } + }, "node_modules/axobject-query": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", @@ -4235,6 +4540,17 @@ "dev": true, "license": "MIT" }, + "node_modules/standardized-audio-context": { + "version": "25.3.77", + "resolved": "https://registry.npmjs.org/standardized-audio-context/-/standardized-audio-context-25.3.77.tgz", + "integrity": "sha512-Ki9zNz6pKcC5Pi+QPjPyVsD9GwJIJWgryji0XL9cAJXMGyn+dPOf6Qik1AHei0+UNVcc4BOCa0hWLBzlwqsW/A==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.25.6", + "automation-events": "^7.0.9", + "tslib": "^2.7.0" + } + }, "node_modules/std-env": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.9.0.tgz", @@ -4493,6 +4809,47 @@ "node": ">=8.0" } }, + "node_modules/tonal": { + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/tonal/-/tonal-6.4.2.tgz", + "integrity": "sha512-3o2ZQCZk8SsiaGGD+XQ7ntyL/06gwN4v7kbFhfkXOUPGGDMX3qEhOckWSf7SRm8nvyOGywxHlP30zO+1Y4SWgg==", + "license": "MIT", + "dependencies": { + "@tonaljs/abc-notation": "4.9.1", + "@tonaljs/array": "4.8.4", + "@tonaljs/chord": "6.1.1", + "@tonaljs/chord-type": "5.1.1", + "@tonaljs/collection": "4.9.0", + "@tonaljs/core": "5.0.2", + "@tonaljs/duration-value": "4.9.0", + "@tonaljs/interval": "5.1.0", + "@tonaljs/key": "4.11.2", + "@tonaljs/midi": "4.10.2", + "@tonaljs/mode": "4.9.1", + "@tonaljs/note": "4.12.1", + "@tonaljs/pcset": "4.10.1", + "@tonaljs/progression": "4.9.1", + "@tonaljs/range": "4.9.2", + "@tonaljs/rhythm-pattern": "1.0.0", + "@tonaljs/roman-numeral": "4.9.1", + "@tonaljs/scale": "4.13.3", + "@tonaljs/scale-type": "4.9.1", + "@tonaljs/time-signature": "4.9.0", + "@tonaljs/voice-leading": "5.1.2", + "@tonaljs/voicing": "5.1.2", + "@tonaljs/voicing-dictionary": "5.1.2" + } + }, + "node_modules/tone": { + "version": "15.1.22", + "resolved": "https://registry.npmjs.org/tone/-/tone-15.1.22.tgz", + "integrity": "sha512-TCScAGD4sLsama5DjvTUXlLDXSqPealhL64nsdV1hhr6frPWve0DeSo63AKnSJwgfg55fhvxj0iPPRwPN5o0ag==", + "license": "MIT", + "dependencies": { + "standardized-audio-context": "^25.3.70", + "tslib": "^2.3.1" + } + }, "node_modules/totalist": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", @@ -4516,6 +4873,12 @@ "typescript": ">=4.8.4" } }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", diff --git a/package.json b/package.json index 5b53a2f..7f91516 100644 --- a/package.json +++ b/package.json @@ -42,5 +42,9 @@ "vite-plugin-devtools-json": "^0.2.0", "vitest": "^3.2.3", "vitest-browser-svelte": "^0.1.0" + }, + "dependencies": { + "tonal": "^6.4.2", + "tone": "^15.1.22" } } diff --git a/src/lib/generators/air-quality/air-quality-generator.svelte b/src/lib/generators/air-quality/air-quality-generator.svelte index e69de29..8bcc860 100644 --- a/src/lib/generators/air-quality/air-quality-generator.svelte +++ b/src/lib/generators/air-quality/air-quality-generator.svelte @@ -0,0 +1,3 @@ + + + diff --git a/src/lib/generators/satelites/satellites-generator.svelte b/src/lib/generators/satelites/satellites-generator.svelte index e69de29..8bcc860 100644 --- a/src/lib/generators/satelites/satellites-generator.svelte +++ b/src/lib/generators/satelites/satellites-generator.svelte @@ -0,0 +1,3 @@ + + + diff --git a/src/lib/generators/weather/weather-generator.svelte b/src/lib/generators/weather/weather-generator.svelte index e69de29..8bcc860 100644 --- a/src/lib/generators/weather/weather-generator.svelte +++ b/src/lib/generators/weather/weather-generator.svelte @@ -0,0 +1,3 @@ + + + diff --git a/src/routes/on-out/+page.ts b/src/routes/on-out/+page.ts index e69de29..d0748e6 100644 --- a/src/routes/on-out/+page.ts +++ b/src/routes/on-out/+page.ts @@ -0,0 +1,32 @@ +//TODO: LOAD ALL API DATA FOR WEATHER, AIR QUALITY, ETC +import { fetchWeatherApi } from 'openmeteo'; + +const params = { + "latitude": 52.52, + "longitude": 13.41, + "current": ["temperature_2m", "relative_humidity_2m", "is_day", "precipitation", "cloud_cover", "pressure_msl", "wind_speed_10m"] +}; +const url = "https://api.open-meteo.com/v1/forecast"; +const responses = await fetchWeatherApi(url, params); + +// Process first location. Add a for-loop for multiple locations or weather models +const response = responses[0]; + +// Attributes for timezone and location +const utcOffsetSeconds = response.utcOffsetSeconds(); + +const current = response.current()!; + +// Note: The order of weather variables in the URL query and the indices below need to match! +const weatherData = { + current: { + time: new Date((Number(current.time()) + utcOffsetSeconds) * 1000), + temperature2m: current.variables(0)!.value(), + relativeHumidity2m: current.variables(1)!.value(), + isDay: current.variables(2)!.value(), + precipitation: current.variables(3)!.value(), + cloudCover: current.variables(4)!.value(), + pressureMsl: current.variables(5)!.value(), + windSpeed10m: current.variables(6)!.value(), + }, +}; \ No newline at end of file