diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 0ecbfc08..00000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,31 +0,0 @@ -/** @type { import("eslint").Linter.Config } */ -module.exports = { - root: true, - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:svelte/recommended', - 'prettier', - ], - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], - parserOptions: { - sourceType: 'module', - ecmaVersion: 2020, - extraFileExtensions: ['.svelte'], - }, - env: { - browser: true, - es2017: true, - node: true, - }, - overrides: [ - { - files: ['*.svelte'], - parser: 'svelte-eslint-parser', - parserOptions: { - parser: '@typescript-eslint/parser', - }, - }, - ], -}; diff --git a/.gitignore b/.gitignore index d4dede2d..5999e9d0 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ node_modules vite.config.js.timestamp-* vite.config.ts.timestamp-* package-lock.json + +# Test files +/test-results diff --git a/tests/test.ts b/e2e/indexpage.test.ts similarity index 100% rename from tests/test.ts rename to e2e/indexpage.test.ts diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..cc3bf082 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,34 @@ +import prettier from "eslint-config-prettier"; +import js from '@eslint/js'; +import svelte from 'eslint-plugin-svelte'; +import globals from 'globals'; +import ts from 'typescript-eslint'; + +export default ts.config( + js.configs.recommended, + ...ts.configs.recommended, + ...svelte.configs["flat/recommended"], + prettier, + ...svelte.configs['flat/prettier'], + { + languageOptions: { + globals: { + ...globals.browser, + ...globals.node + } + } + }, + { + files: ["**/*.svelte"], + + languageOptions: { + parserOptions: { + parser: ts.parser, + ecmaVersion: 2020 + } + } + }, + { + ignores: ["build/", ".svelte-kit/", "dist/"] + } +); diff --git a/package.json b/package.json index ef57e52c..eb291472 100644 --- a/package.json +++ b/package.json @@ -21,19 +21,19 @@ "@openapitools/openapi-generator-cli": "^2.15.0", "@playwright/test": "^1.48.2", "@sentry/svelte": "^8.35.0", - "@skeletonlabs/skeleton": "2.10.3", + "@skeletonlabs/skeleton": "^2.10.3", "@skeletonlabs/tw-plugin": "0.4.0", "@sveltejs/adapter-cloudflare": "^4.7.4", "@sveltejs/adapter-node": "^5.2.9", "@sveltejs/kit": "^2.7.3", - "@sveltejs/vite-plugin-svelte": "^3.1.2", + "@sveltejs/vite-plugin-svelte": "^4.0.0", "@tailwindcss/forms": "0.5.9", "@tailwindcss/typography": "0.5.15", "@types/crypto-js": "^4.2.2", "@types/eslint": "^9.6.1", - "@types/node": "22.8.1", + "@types/node": "22.8.2", "@types/w3c-web-serial": "^1.0.7", - "@vincjo/datatables": "^1.14.10", + "@vincjo/datatables": "^2.0.5", "autoprefixer": "10.4.20", "bowser": "^2.11.0", "crypto-js": "^4.2.0", @@ -41,20 +41,22 @@ "eslint": "^9.13.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-svelte": "^2.46.0", + "globals": "^15.11.0", "highlight.js": "^11.10.0", "js-sha1": "^0.7.0", "postcss": "8.4.47", "prettier": "^3.3.3", "prettier-plugin-svelte": "^3.2.7", - "svelte": "^4.2.19", + "svelte": "^5.1.4", "svelte-check": "^4.0.5", "tailwindcss": "3.4.14", "tslib": "^2.8.0", "typescript": "^5.6.3", + "typescript-eslint": "^8.12.1", "ua-parser-js": "^2.0.0-beta.3", "vite-plugin-mkcert": "^1.17.6", "vite-plugin-tailwind-purgecss": "0.3.3", - "vitest": "^2.1.3" + "vitest": "^2.1.4" }, "dependencies": { "esptool-js": "^0.4.6", diff --git a/playwright.config.ts b/playwright.config.ts index 6a56e37c..db8f8c68 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,12 +1,10 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; +import { defineConfig } from '@playwright/test'; -const config: PlaywrightTestConfig = { +export default defineConfig({ webServer: { - command: 'pnpm run build && pnpm run preview', + command: 'npm run build && npm run preview', port: 4173 }, - testDir: 'tests', - testMatch: /(.+\.)?(test|spec)\.[jt]s/ -}; -export default config; + testDir: 'e2e' +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5f667f13..9ffcc3ad 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,7 +18,7 @@ importers: version: 0.4.6(patch_hash=3a3x37scxxjnnesy2e5ida6v34) vite: specifier: ^5.4.10 - version: 5.4.10(@types/node@22.8.1) + version: 5.4.10(@types/node@22.8.2) devDependencies: '@floating-ui/dom': specifier: ^1.6.11 @@ -34,25 +34,25 @@ importers: version: 1.48.2 '@sentry/svelte': specifier: ^8.35.0 - version: 8.35.0(svelte@4.2.19) + version: 8.35.0(svelte@5.1.4) '@skeletonlabs/skeleton': - specifier: 2.10.3 - version: 2.10.3(svelte@4.2.19) + specifier: ^2.10.3 + version: 2.10.3(svelte@5.1.4) '@skeletonlabs/tw-plugin': specifier: 0.4.0 version: 0.4.0(tailwindcss@3.4.14) '@sveltejs/adapter-cloudflare': specifier: ^4.7.4 - version: 4.7.4(@sveltejs/kit@2.7.3(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)))(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)))(wrangler@3.80.5(@cloudflare/workers-types@4.20241022.0)) + version: 4.7.4(@sveltejs/kit@2.7.3(@sveltejs/vite-plugin-svelte@4.0.0(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)))(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)))(wrangler@3.80.5(@cloudflare/workers-types@4.20241022.0)) '@sveltejs/adapter-node': specifier: ^5.2.9 - version: 5.2.9(@sveltejs/kit@2.7.3(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)))(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1))) + version: 5.2.9(@sveltejs/kit@2.7.3(@sveltejs/vite-plugin-svelte@4.0.0(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)))(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2))) '@sveltejs/kit': specifier: ^2.7.3 - version: 2.7.3(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)))(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)) + version: 2.7.3(@sveltejs/vite-plugin-svelte@4.0.0(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)))(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)) '@sveltejs/vite-plugin-svelte': - specifier: ^3.1.2 - version: 3.1.2(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)) + specifier: ^4.0.0 + version: 4.0.0(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)) '@tailwindcss/forms': specifier: 0.5.9 version: 0.5.9(tailwindcss@3.4.14) @@ -66,14 +66,14 @@ importers: specifier: ^9.6.1 version: 9.6.1 '@types/node': - specifier: 22.8.1 - version: 22.8.1 + specifier: 22.8.2 + version: 22.8.2 '@types/w3c-web-serial': specifier: ^1.0.7 version: 1.0.7 '@vincjo/datatables': - specifier: ^1.14.10 - version: 1.14.10(svelte@4.2.19) + specifier: ^2.0.5 + version: 2.0.5(svelte@5.1.4) autoprefixer: specifier: 10.4.20 version: 10.4.20(postcss@8.4.47) @@ -94,7 +94,10 @@ importers: version: 9.1.0(eslint@9.13.0(jiti@1.21.6)) eslint-plugin-svelte: specifier: ^2.46.0 - version: 2.46.0(eslint@9.13.0(jiti@1.21.6))(svelte@4.2.19) + version: 2.46.0(eslint@9.13.0(jiti@1.21.6))(svelte@5.1.4) + globals: + specifier: ^15.11.0 + version: 15.11.0 highlight.js: specifier: ^11.10.0 version: 11.10.0 @@ -109,13 +112,13 @@ importers: version: 3.3.3 prettier-plugin-svelte: specifier: ^3.2.7 - version: 3.2.7(prettier@3.3.3)(svelte@4.2.19) + version: 3.2.7(prettier@3.3.3)(svelte@5.1.4) svelte: - specifier: ^4.2.19 - version: 4.2.19 + specifier: ^5.1.4 + version: 5.1.4 svelte-check: specifier: ^4.0.5 - version: 4.0.5(picomatch@4.0.2)(svelte@4.2.19)(typescript@5.6.3) + version: 4.0.5(picomatch@4.0.2)(svelte@5.1.4)(typescript@5.6.3) tailwindcss: specifier: 3.4.14 version: 3.4.14 @@ -125,18 +128,21 @@ importers: typescript: specifier: ^5.6.3 version: 5.6.3 + typescript-eslint: + specifier: ^8.12.1 + version: 8.12.1(eslint@9.13.0(jiti@1.21.6))(typescript@5.6.3) ua-parser-js: specifier: ^2.0.0-beta.3 version: 2.0.0-beta.3 vite-plugin-mkcert: specifier: ^1.17.6 - version: 1.17.6(vite@5.4.10(@types/node@22.8.1)) + version: 1.17.6(vite@5.4.10(@types/node@22.8.2)) vite-plugin-tailwind-purgecss: specifier: 0.3.3 - version: 0.3.3(tailwindcss@3.4.14)(vite@5.4.10(@types/node@22.8.1)) + version: 0.3.3(tailwindcss@3.4.14)(vite@5.4.10(@types/node@22.8.2)) vitest: - specifier: ^2.1.3 - version: 2.1.3(@types/node@22.8.1) + specifier: ^2.1.4 + version: 2.1.4(@types/node@22.8.2) packages: @@ -889,19 +895,19 @@ packages: svelte: ^4.0.0 || ^5.0.0-next.0 vite: ^5.0.3 - '@sveltejs/vite-plugin-svelte-inspector@2.1.0': - resolution: {integrity: sha512-9QX28IymvBlSCqsCll5t0kQVxipsfhFFL+L2t3nTWfXnddYwxBuAEtTtlaVQpRz9c37BhJjltSeY4AJSC03SSg==} - engines: {node: ^18.0.0 || >=20} + '@sveltejs/vite-plugin-svelte-inspector@3.0.0-next.4': + resolution: {integrity: sha512-Ct653z5kHM9goDyuOMfA1s9aPWffJUiKb80pOW6gVZt6+YAEesGj93uzhYtpFtVIN9PqkA7k2szqQbBrir+3oQ==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22} peerDependencies: - '@sveltejs/vite-plugin-svelte': ^3.0.0 - svelte: ^4.0.0 || ^5.0.0-next.0 + '@sveltejs/vite-plugin-svelte': ^4.0.0-next.0||^4.0.0 + svelte: ^5.0.0-next.96 || ^5.0.0 vite: ^5.0.0 - '@sveltejs/vite-plugin-svelte@3.1.2': - resolution: {integrity: sha512-Txsm1tJvtiYeLUVRNqxZGKR/mI+CzuIQuc2gn+YCs9rMTowpNZ2Nqt53JdL8KF9bLhAf2ruR/dr9eZCwdTriRA==} - engines: {node: ^18.0.0 || >=20} + '@sveltejs/vite-plugin-svelte@4.0.0': + resolution: {integrity: sha512-kpVJwF+gNiMEsoHaw+FJL76IYiwBikkxYU83+BpqQLdVMff19KeRKLd2wisS8niNBMJ2omv5gG+iGDDwd8jzag==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22} peerDependencies: - svelte: ^4.0.0 || ^5.0.0-next.0 + svelte: ^5.0.0-next.96 || ^5.0.0 vite: ^5.0.0 '@tailwindcss/forms@0.5.9': @@ -935,8 +941,8 @@ packages: '@types/node-forge@1.3.11': resolution: {integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==} - '@types/node@22.8.1': - resolution: {integrity: sha512-k6Gi8Yyo8EtrNtkHXutUu2corfDf9su95VYVP10aGYMMROM6SAItZi0w1XszA6RtWTHSVp5OeFof37w0IEqCQg==} + '@types/node@22.8.2': + resolution: {integrity: sha512-NzaRNFV+FZkvK/KLCsNdTvID0SThyrs5SHB6tsD/lajr22FGC73N2QeDPM2wHtVde8mgcXuSsHQkH5cX1pbPLw==} '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} @@ -944,19 +950,75 @@ packages: '@types/w3c-web-serial@1.0.7': resolution: {integrity: sha512-jzcwm//EZ0Z306L1/O1GXC3GthRd//9eaNB4/Yagm98UjEQViTzDS8bYvL+y+rTk1r9OFt9Yhp5pprUQFzSiiQ==} - '@vincjo/datatables@1.14.10': - resolution: {integrity: sha512-gtojSC/LKDHbh2ZGZeaAQ+lLltcmcSDDLkecgb9WpG7lHmd4b/1HUTtFWAJt43TnaK8SrciGugh9VRRZN53bpw==} + '@typescript-eslint/eslint-plugin@8.12.1': + resolution: {integrity: sha512-gNg/inLRcPoBsKKIe4Vv38SVSOhk4BKWNO0T56sVff33gRqtTpOsrhHtiOKD1lmIOmCtZMPaW2x/h2FlM+sCEg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 + eslint: ^8.57.0 || ^9.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + '@typescript-eslint/parser@8.12.1': + resolution: {integrity: sha512-I/I9Bg7qFa8rOgBnUUHIWTgzbB5wVkSLX+04xGUzTcJUtdq/I2uHWR9mbW6qUYJG/UmkuDcTax5JHvoEWOAHOQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + '@typescript-eslint/scope-manager@8.12.1': + resolution: {integrity: sha512-bma6sD1iViTt+y9MAwDlBdPTMCqoH/BNdcQk4rKhIZWv3eM0xHmzeSrPJA663PAqFqfpOmtdugycpr0E1mZDVA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@typescript-eslint/type-utils@8.12.1': + resolution: {integrity: sha512-zJzrvbDVjIzVKV2TGHcjembEhws8RWXJhmqfO9hS2gRXBN0gDwGhRPEdJ6AZglzfJ+YA1q09EWpSLSXjBJpIMQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + '@typescript-eslint/types@8.12.1': + resolution: {integrity: sha512-anMS4es5lxBe4UVcDXOkcDb3csnm5BvaNIbOFfvy/pJEohorsggdVB8MFbl5EZiEuBnZZ0ei1z7W5b6FdFiV1Q==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@typescript-eslint/typescript-estree@8.12.1': + resolution: {integrity: sha512-k/o9khHOckPeDXilFTIPsP9iAYhhdMh3OsOL3i2072PNpFqhqzRHx472/0DeC8H/WZee3bZG0z2ddGRSPgeOKw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + '@typescript-eslint/utils@8.12.1': + resolution: {integrity: sha512-sDv9yFHrhKe1WN8EYuzfhKCh/sFRupe9P+m/lZ5YgVvPoCUGHNN50IO4llSu7JAbftUM/QcCh+GeCortXPrBYQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - svelte: ^3.56.0 || ^4.0.0 || ^5.0.0-next.120 + eslint: ^8.57.0 || ^9.0.0 - '@vitest/expect@2.1.3': - resolution: {integrity: sha512-SNBoPubeCJhZ48agjXruCI57DvxcsivVDdWz+SSsmjTT4QN/DfHk3zB/xKsJqMs26bLZ/pNRLnCf0j679i0uWQ==} + '@typescript-eslint/visitor-keys@8.12.1': + resolution: {integrity: sha512-2RwdwnNGuOQKdGjuhujQHUqBZhEuodg2sLVPvOfWktvA9sOXOVqARjOyHSyhN2LiJGKxV6c8oOcmOtRcAnEeFw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@vitest/mocker@2.1.3': - resolution: {integrity: sha512-eSpdY/eJDuOvuTA3ASzCjdithHa+GIF1L4PqtEELl6Qa3XafdMLBpBlZCIUCX2J+Q6sNmjmxtosAG62fK4BlqQ==} + '@vincjo/datatables@2.0.5': + resolution: {integrity: sha512-ZD5Y5Tp1jlVSJhKEZqwhaUTUpTi+voz2Hx+Yr2HQ1JoCisYKk4T+MbJNmB6fN/Mra/hjrlEm5j/Ap5Ud0qydLw==} peerDependencies: - '@vitest/spy': 2.1.3 - msw: ^2.3.5 + svelte: ^5.0.0 + + '@vitest/expect@2.1.4': + resolution: {integrity: sha512-DOETT0Oh1avie/D/o2sgMHGrzYUFFo3zqESB2Hn70z6QB1HrS2IQ9z5DfyTqU8sg4Bpu13zZe9V4+UTNQlUeQA==} + + '@vitest/mocker@2.1.4': + resolution: {integrity: sha512-Ky/O1Lc0QBbutJdW0rqLeFNbuLEyS+mIPiNdlVlp2/yhJ0SbyYqObS5IHdhferJud8MbbwMnexg4jordE5cCoQ==} + peerDependencies: + msw: ^2.4.9 vite: ^5.0.0 peerDependenciesMeta: msw: @@ -964,20 +1026,20 @@ packages: vite: optional: true - '@vitest/pretty-format@2.1.3': - resolution: {integrity: sha512-XH1XdtoLZCpqV59KRbPrIhFCOO0hErxrQCMcvnQete3Vibb9UeIOX02uFPfVn3Z9ZXsq78etlfyhnkmIZSzIwQ==} + '@vitest/pretty-format@2.1.4': + resolution: {integrity: sha512-L95zIAkEuTDbUX1IsjRl+vyBSLh3PwLLgKpghl37aCK9Jvw0iP+wKwIFhfjdUtA2myLgjrG6VU6JCFLv8q/3Ww==} - '@vitest/runner@2.1.3': - resolution: {integrity: sha512-JGzpWqmFJ4fq5ZKHtVO3Xuy1iF2rHGV4d/pdzgkYHm1+gOzNZtqjvyiaDGJytRyMU54qkxpNzCx+PErzJ1/JqQ==} + '@vitest/runner@2.1.4': + resolution: {integrity: sha512-sKRautINI9XICAMl2bjxQM8VfCMTB0EbsBc/EDFA57V6UQevEKY/TOPOF5nzcvCALltiLfXWbq4MaAwWx/YxIA==} - '@vitest/snapshot@2.1.3': - resolution: {integrity: sha512-qWC2mWc7VAXmjAkEKxrScWHWFyCQx/cmiZtuGqMi+WwqQJ2iURsVY4ZfAK6dVo6K2smKRU6l3BPwqEBvhnpQGg==} + '@vitest/snapshot@2.1.4': + resolution: {integrity: sha512-3Kab14fn/5QZRog5BPj6Rs8dc4B+mim27XaKWFWHWA87R56AKjHTGcBFKpvZKDzC4u5Wd0w/qKsUIio3KzWW4Q==} - '@vitest/spy@2.1.3': - resolution: {integrity: sha512-Nb2UzbcUswzeSP7JksMDaqsI43Sj5+Kry6ry6jQJT4b5gAK+NS9NED6mDb8FlMRCX8m5guaHCDZmqYMMWRy5nQ==} + '@vitest/spy@2.1.4': + resolution: {integrity: sha512-4JOxa+UAizJgpZfaCPKK2smq9d8mmjZVPMt2kOsg/R8QkoRzydHH1qHxIYNvr1zlEaFj4SXiaaJWxq/LPLKaLg==} - '@vitest/utils@2.1.3': - resolution: {integrity: sha512-xpiVfDSg1RrYT0tX6czgerkpcKFmFOF/gCr30+Mve5V2kewCy4Prn1/NDMSRwaSmT7PRaOF83wu+bEtsY1wrvA==} + '@vitest/utils@2.1.4': + resolution: {integrity: sha512-MXDnZn0Awl2S86PSNIim5PWXgIAx8CIkzu35mBdSApUip6RFOGXBCf3YFyeEu8n1IHk4bWD46DeYFu9mQlFIRg==} abort-controller@3.0.0: resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} @@ -988,6 +1050,11 @@ packages: peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 + acorn-typescript@1.4.13: + resolution: {integrity: sha512-xsc9Xv0xlVfwp2o7sQ+GCQ1PgbkdcpWdTzrwXxO3xDMTAywVS3oXVOcOHuRjAPkS4P9b+yc/qNF15460v+jp4Q==} + peerDependencies: + acorn: '>=8.9.0' + acorn-walk@8.3.4: resolution: {integrity: sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==} engines: {node: '>=0.4.0'} @@ -1134,8 +1201,8 @@ packages: capnp-ts@0.7.0: resolution: {integrity: sha512-XKxXAC3HVPv7r674zP0VC3RTXz+/JKhfyw94ljvF80yynK6VkTnqE3jMuN8b3dUVmmc43TjyxjW4KTsmB3c86g==} - chai@5.1.1: - resolution: {integrity: sha512-pT1ZgP8rPNqUgieVaEY+ryQr6Q4HXNg8Ei9UnLUrjN4IA7dvQC5JB+/kxVcPNDHyBcc/26CXPkbNzq3qwrOEKA==} + chai@5.1.2: + resolution: {integrity: sha512-aGtmf24DW6MLHHG5gCx4zaI3uBq3KRtxeVs0DjFH6Z0rDNbsvTxFASFvdj79pxjxZ8/5u3PIiN3IwEIQkiiuPw==} engines: {node: '>=12'} chalk@4.1.2: @@ -1180,9 +1247,6 @@ packages: resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==} engines: {node: '>=0.8'} - code-red@1.0.4: - resolution: {integrity: sha512-7qJWqItLA8/VPVlKJlFXU+NBlo/qyfs39aJcuMT/2ere32ZqvF5OSxgdM5xOfJJ7O429gg2HM47y8v9P+9wrNw==} - color-convert@2.0.1: resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} engines: {node: '>=7.0.0'} @@ -1436,6 +1500,9 @@ packages: resolution: {integrity: sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==} engines: {node: '>=0.10'} + esrap@1.2.2: + resolution: {integrity: sha512-F2pSJklxx1BlQIQgooczXCPHmcWpn6EsP5oo73LQfonG9fIlIENQ8vMmfGXeojP9MrkzUNAfyU5vdFlR9shHAw==} + esrecurse@4.3.0: resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} engines: {node: '>=4.0'} @@ -1469,6 +1536,10 @@ packages: resolution: {integrity: sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw==} engines: {node: '>=6'} + expect-type@1.1.0: + resolution: {integrity: sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA==} + engines: {node: '>=12.0.0'} + external-editor@3.1.0: resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==} engines: {node: '>=4'} @@ -1604,6 +1675,10 @@ packages: resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} engines: {node: '>=18'} + globals@15.11.0: + resolution: {integrity: sha512-yeyNSjdbyVaWurlwCpcA6XNBrHTMIeDdj0/hnvX/OLJ9ekOXYbLsLinH/MucQyGvNnXhidTdNhTtJaffL2sMfw==} + engines: {node: '>=18'} + globalyzer@0.1.0: resolution: {integrity: sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==} @@ -1613,6 +1688,9 @@ packages: graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + graphemer@1.4.0: + resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + has-flag@4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} @@ -2010,9 +2088,6 @@ packages: resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} engines: {node: '>= 14.16'} - periscopic@3.1.0: - resolution: {integrity: sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==} - picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} @@ -2384,15 +2459,9 @@ packages: svelte: optional: true - svelte-hmr@0.16.0: - resolution: {integrity: sha512-Gyc7cOS3VJzLlfj7wKS0ZnzDVdv3Pn2IuVeJPk9m2skfhcu5bq3wtIZyQGggr7/Iim5rH5cncyQft/kRLupcnA==} - engines: {node: ^12.20 || ^14.13.1 || >= 16} - peerDependencies: - svelte: ^3.19.0 || ^4.0.0 - - svelte@4.2.19: - resolution: {integrity: sha512-IY1rnGr6izd10B0A8LqsBfmlT5OILVuZ7XsI0vdGPEvuonFV7NYEUK4dAkm9Zg2q0Um92kYjTpS1CAP3Nh/KWw==} - engines: {node: '>=16'} + svelte@5.1.4: + resolution: {integrity: sha512-qgHDV7AyvBZa2pbf+V0tnvWrN1LKD8LdUsBkR/SSYVVN6zXexiXnOy5Pjcjft2y/2NJJVa8ORUHFVn3oiWCLVQ==} + engines: {node: '>=18'} tailwindcss@3.4.14: resolution: {integrity: sha512-IcSvOcTRcUtQQ7ILQL5quRDg7Xs93PdJEk1ZLbhhvJc7uj/OAhYOnruEiwnGgBvUtaUAJ8/mhSw1o8L2jCiENA==} @@ -2456,6 +2525,12 @@ packages: resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} hasBin: true + ts-api-utils@1.3.0: + resolution: {integrity: sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==} + engines: {node: '>=16'} + peerDependencies: + typescript: '>=4.2.0' + ts-interface-checker@0.1.13: resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} @@ -2476,6 +2551,15 @@ packages: resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==} engines: {node: '>=10'} + typescript-eslint@8.12.1: + resolution: {integrity: sha512-SsKedZnq4TStkrpqnk+OqTnmkC9CkYBRNKjQ965CLpFruGcRkPF5UhKxbcbF6c/m2r6YAgKw/UtQxdlMjh3mug==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + typescript@5.6.3: resolution: {integrity: sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==} engines: {node: '>=14.17'} @@ -2528,8 +2612,8 @@ packages: util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - vite-node@2.1.3: - resolution: {integrity: sha512-I1JadzO+xYX887S39Do+paRePCKoiDrWRRjp9kkG5he0t7RXNvPAJPCQSJqbGN4uCrFFeS3Kj3sLqY8NMYBEdA==} + vite-node@2.1.4: + resolution: {integrity: sha512-kqa9v+oi4HwkG6g8ufRnb5AeplcRw8jUF6/7/Qz1qRQOXHImG8YnLbB+LLszENwFnoBl9xIf9nVdCFzNd7GQEg==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true @@ -2576,23 +2660,23 @@ packages: terser: optional: true - vitefu@0.2.5: - resolution: {integrity: sha512-SgHtMLoqaeeGnd2evZ849ZbACbnwQCIwRH57t18FxcXoZop0uQu0uzlIhJBlF/eWVzuce0sHeqPcDo+evVcg8Q==} + vitefu@1.0.3: + resolution: {integrity: sha512-iKKfOMBHob2WxEJbqbJjHAkmYgvFDPhuqrO82om83S8RLk+17FtyMBfcyeH8GqD0ihShtkMW/zzJgiA51hCNCQ==} peerDependencies: - vite: ^3.0.0 || ^4.0.0 || ^5.0.0 + vite: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0-beta.0 peerDependenciesMeta: vite: optional: true - vitest@2.1.3: - resolution: {integrity: sha512-Zrxbg/WiIvUP2uEzelDNTXmEMJXuzJ1kCpbDvaKByFA9MNeO95V+7r/3ti0qzJzrxdyuUw5VduN7k+D3VmVOSA==} + vitest@2.1.4: + resolution: {integrity: sha512-eDjxbVAJw1UJJCHr5xr/xM86Zx+YxIEXGAR+bmnEID7z9qWfoxpHw0zdobz+TQAFOLT+nEXz3+gx6nUJ7RgmlQ==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: '@edge-runtime/vm': '*' '@types/node': ^18.0.0 || >=20.0.0 - '@vitest/browser': 2.1.3 - '@vitest/ui': 2.1.3 + '@vitest/browser': 2.1.4 + '@vitest/ui': 2.1.4 happy-dom: '*' jsdom: '*' peerDependenciesMeta: @@ -2721,6 +2805,9 @@ packages: youch@3.3.4: resolution: {integrity: sha512-UeVBXie8cA35DS6+nBkls68xaBBXCye0CNznrhszZjTbRVnJKQuNsyLKBTTL4ln1o1rh2PKtv35twV7irj5SEg==} + zimmerframe@1.1.2: + resolution: {integrity: sha512-rAbqEGa8ovJy4pyBxZM70hg4pE6gDgaQ0Sl9M3enG3I0d6H4XSAM3GeNGLKnsBpuijUow064sf7ww1nutC5/3w==} + zod@3.23.8: resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} @@ -3301,14 +3388,14 @@ snapshots: '@sentry/types': 8.35.0 '@sentry/utils': 8.35.0 - '@sentry/svelte@8.35.0(svelte@4.2.19)': + '@sentry/svelte@8.35.0(svelte@5.1.4)': dependencies: '@sentry/browser': 8.35.0 '@sentry/core': 8.35.0 '@sentry/types': 8.35.0 '@sentry/utils': 8.35.0 magic-string: 0.30.12 - svelte: 4.2.19 + svelte: 5.1.4 '@sentry/types@8.35.0': {} @@ -3316,34 +3403,34 @@ snapshots: dependencies: '@sentry/types': 8.35.0 - '@skeletonlabs/skeleton@2.10.3(svelte@4.2.19)': + '@skeletonlabs/skeleton@2.10.3(svelte@5.1.4)': dependencies: esm-env: 1.0.0 - svelte: 4.2.19 + svelte: 5.1.4 '@skeletonlabs/tw-plugin@0.4.0(tailwindcss@3.4.14)': dependencies: tailwindcss: 3.4.14 - '@sveltejs/adapter-cloudflare@4.7.4(@sveltejs/kit@2.7.3(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)))(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)))(wrangler@3.80.5(@cloudflare/workers-types@4.20241022.0))': + '@sveltejs/adapter-cloudflare@4.7.4(@sveltejs/kit@2.7.3(@sveltejs/vite-plugin-svelte@4.0.0(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)))(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)))(wrangler@3.80.5(@cloudflare/workers-types@4.20241022.0))': dependencies: '@cloudflare/workers-types': 4.20241022.0 - '@sveltejs/kit': 2.7.3(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)))(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)) + '@sveltejs/kit': 2.7.3(@sveltejs/vite-plugin-svelte@4.0.0(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)))(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)) esbuild: 0.21.5 worktop: 0.8.0-next.18 wrangler: 3.80.5(@cloudflare/workers-types@4.20241022.0) - '@sveltejs/adapter-node@5.2.9(@sveltejs/kit@2.7.3(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)))(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)))': + '@sveltejs/adapter-node@5.2.9(@sveltejs/kit@2.7.3(@sveltejs/vite-plugin-svelte@4.0.0(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)))(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)))': dependencies: '@rollup/plugin-commonjs': 28.0.1(rollup@4.24.2) '@rollup/plugin-json': 6.1.0(rollup@4.24.2) '@rollup/plugin-node-resolve': 15.3.0(rollup@4.24.2) - '@sveltejs/kit': 2.7.3(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)))(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)) + '@sveltejs/kit': 2.7.3(@sveltejs/vite-plugin-svelte@4.0.0(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)))(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)) rollup: 4.24.2 - '@sveltejs/kit@2.7.3(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)))(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1))': + '@sveltejs/kit@2.7.3(@sveltejs/vite-plugin-svelte@4.0.0(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)))(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2))': dependencies: - '@sveltejs/vite-plugin-svelte': 3.1.2(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)) + '@sveltejs/vite-plugin-svelte': 4.0.0(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)) '@types/cookie': 0.6.0 cookie: 0.6.0 devalue: 5.1.1 @@ -3355,30 +3442,29 @@ snapshots: sade: 1.8.1 set-cookie-parser: 2.7.1 sirv: 3.0.0 - svelte: 4.2.19 + svelte: 5.1.4 tiny-glob: 0.2.9 - vite: 5.4.10(@types/node@22.8.1) + vite: 5.4.10(@types/node@22.8.2) - '@sveltejs/vite-plugin-svelte-inspector@2.1.0(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)))(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1))': + '@sveltejs/vite-plugin-svelte-inspector@3.0.0-next.4(@sveltejs/vite-plugin-svelte@4.0.0(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)))(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2))': dependencies: - '@sveltejs/vite-plugin-svelte': 3.1.2(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)) + '@sveltejs/vite-plugin-svelte': 4.0.0(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)) debug: 4.3.7 - svelte: 4.2.19 - vite: 5.4.10(@types/node@22.8.1) + svelte: 5.1.4 + vite: 5.4.10(@types/node@22.8.2) transitivePeerDependencies: - supports-color - '@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1))': + '@sveltejs/vite-plugin-svelte@4.0.0(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2))': dependencies: - '@sveltejs/vite-plugin-svelte-inspector': 2.1.0(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)))(svelte@4.2.19)(vite@5.4.10(@types/node@22.8.1)) + '@sveltejs/vite-plugin-svelte-inspector': 3.0.0-next.4(@sveltejs/vite-plugin-svelte@4.0.0(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)))(svelte@5.1.4)(vite@5.4.10(@types/node@22.8.2)) debug: 4.3.7 deepmerge: 4.3.1 kleur: 4.1.5 magic-string: 0.30.12 - svelte: 4.2.19 - svelte-hmr: 0.16.0(svelte@4.2.19) - vite: 5.4.10(@types/node@22.8.1) - vitefu: 0.2.5(vite@5.4.10(@types/node@22.8.1)) + svelte: 5.1.4 + vite: 5.4.10(@types/node@22.8.2) + vitefu: 1.0.3(vite@5.4.10(@types/node@22.8.2)) transitivePeerDependencies: - supports-color @@ -3412,9 +3498,9 @@ snapshots: '@types/node-forge@1.3.11': dependencies: - '@types/node': 22.8.1 + '@types/node': 22.8.2 - '@types/node@22.8.1': + '@types/node@22.8.2': dependencies: undici-types: 6.19.8 @@ -3422,47 +3508,128 @@ snapshots: '@types/w3c-web-serial@1.0.7': {} - '@vincjo/datatables@1.14.10(svelte@4.2.19)': + '@typescript-eslint/eslint-plugin@8.12.1(@typescript-eslint/parser@8.12.1(eslint@9.13.0(jiti@1.21.6))(typescript@5.6.3))(eslint@9.13.0(jiti@1.21.6))(typescript@5.6.3)': + dependencies: + '@eslint-community/regexpp': 4.11.1 + '@typescript-eslint/parser': 8.12.1(eslint@9.13.0(jiti@1.21.6))(typescript@5.6.3) + '@typescript-eslint/scope-manager': 8.12.1 + '@typescript-eslint/type-utils': 8.12.1(eslint@9.13.0(jiti@1.21.6))(typescript@5.6.3) + '@typescript-eslint/utils': 8.12.1(eslint@9.13.0(jiti@1.21.6))(typescript@5.6.3) + '@typescript-eslint/visitor-keys': 8.12.1 + eslint: 9.13.0(jiti@1.21.6) + graphemer: 1.4.0 + ignore: 5.3.2 + natural-compare: 1.4.0 + ts-api-utils: 1.3.0(typescript@5.6.3) + optionalDependencies: + typescript: 5.6.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/parser@8.12.1(eslint@9.13.0(jiti@1.21.6))(typescript@5.6.3)': + dependencies: + '@typescript-eslint/scope-manager': 8.12.1 + '@typescript-eslint/types': 8.12.1 + '@typescript-eslint/typescript-estree': 8.12.1(typescript@5.6.3) + '@typescript-eslint/visitor-keys': 8.12.1 + debug: 4.3.7 + eslint: 9.13.0(jiti@1.21.6) + optionalDependencies: + typescript: 5.6.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/scope-manager@8.12.1': + dependencies: + '@typescript-eslint/types': 8.12.1 + '@typescript-eslint/visitor-keys': 8.12.1 + + '@typescript-eslint/type-utils@8.12.1(eslint@9.13.0(jiti@1.21.6))(typescript@5.6.3)': + dependencies: + '@typescript-eslint/typescript-estree': 8.12.1(typescript@5.6.3) + '@typescript-eslint/utils': 8.12.1(eslint@9.13.0(jiti@1.21.6))(typescript@5.6.3) + debug: 4.3.7 + ts-api-utils: 1.3.0(typescript@5.6.3) + optionalDependencies: + typescript: 5.6.3 + transitivePeerDependencies: + - eslint + - supports-color + + '@typescript-eslint/types@8.12.1': {} + + '@typescript-eslint/typescript-estree@8.12.1(typescript@5.6.3)': + dependencies: + '@typescript-eslint/types': 8.12.1 + '@typescript-eslint/visitor-keys': 8.12.1 + debug: 4.3.7 + fast-glob: 3.3.2 + is-glob: 4.0.3 + minimatch: 9.0.5 + semver: 7.6.3 + ts-api-utils: 1.3.0(typescript@5.6.3) + optionalDependencies: + typescript: 5.6.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/utils@8.12.1(eslint@9.13.0(jiti@1.21.6))(typescript@5.6.3)': + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@9.13.0(jiti@1.21.6)) + '@typescript-eslint/scope-manager': 8.12.1 + '@typescript-eslint/types': 8.12.1 + '@typescript-eslint/typescript-estree': 8.12.1(typescript@5.6.3) + eslint: 9.13.0(jiti@1.21.6) + transitivePeerDependencies: + - supports-color + - typescript + + '@typescript-eslint/visitor-keys@8.12.1': dependencies: - svelte: 4.2.19 + '@typescript-eslint/types': 8.12.1 + eslint-visitor-keys: 3.4.3 + + '@vincjo/datatables@2.0.5(svelte@5.1.4)': + dependencies: + svelte: 5.1.4 - '@vitest/expect@2.1.3': + '@vitest/expect@2.1.4': dependencies: - '@vitest/spy': 2.1.3 - '@vitest/utils': 2.1.3 - chai: 5.1.1 + '@vitest/spy': 2.1.4 + '@vitest/utils': 2.1.4 + chai: 5.1.2 tinyrainbow: 1.2.0 - '@vitest/mocker@2.1.3(@vitest/spy@2.1.3)(vite@5.4.10(@types/node@22.8.1))': + '@vitest/mocker@2.1.4(vite@5.4.10(@types/node@22.8.2))': dependencies: - '@vitest/spy': 2.1.3 + '@vitest/spy': 2.1.4 estree-walker: 3.0.3 magic-string: 0.30.12 optionalDependencies: - vite: 5.4.10(@types/node@22.8.1) + vite: 5.4.10(@types/node@22.8.2) - '@vitest/pretty-format@2.1.3': + '@vitest/pretty-format@2.1.4': dependencies: tinyrainbow: 1.2.0 - '@vitest/runner@2.1.3': + '@vitest/runner@2.1.4': dependencies: - '@vitest/utils': 2.1.3 + '@vitest/utils': 2.1.4 pathe: 1.1.2 - '@vitest/snapshot@2.1.3': + '@vitest/snapshot@2.1.4': dependencies: - '@vitest/pretty-format': 2.1.3 + '@vitest/pretty-format': 2.1.4 magic-string: 0.30.12 pathe: 1.1.2 - '@vitest/spy@2.1.3': + '@vitest/spy@2.1.4': dependencies: tinyspy: 3.0.2 - '@vitest/utils@2.1.3': + '@vitest/utils@2.1.4': dependencies: - '@vitest/pretty-format': 2.1.3 + '@vitest/pretty-format': 2.1.4 loupe: 3.1.2 tinyrainbow: 1.2.0 @@ -3474,6 +3641,10 @@ snapshots: dependencies: acorn: 8.14.0 + acorn-typescript@1.4.13(acorn@8.14.0): + dependencies: + acorn: 8.14.0 + acorn-walk@8.3.4: dependencies: acorn: 8.14.0 @@ -3614,7 +3785,7 @@ snapshots: transitivePeerDependencies: - supports-color - chai@5.1.1: + chai@5.1.2: dependencies: assertion-error: 2.0.1 check-error: 2.1.1 @@ -3665,14 +3836,6 @@ snapshots: clone@1.0.4: {} - code-red@1.0.4: - dependencies: - '@jridgewell/sourcemap-codec': 1.5.0 - '@types/estree': 1.0.6 - acorn: 8.14.0 - estree-walker: 3.0.3 - periscopic: 3.1.0 - color-convert@2.0.1: dependencies: color-name: 1.1.4 @@ -3867,7 +4030,7 @@ snapshots: dependencies: eslint: 9.13.0(jiti@1.21.6) - eslint-plugin-svelte@2.46.0(eslint@9.13.0(jiti@1.21.6))(svelte@4.2.19): + eslint-plugin-svelte@2.46.0(eslint@9.13.0(jiti@1.21.6))(svelte@5.1.4): dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@9.13.0(jiti@1.21.6)) '@jridgewell/sourcemap-codec': 1.5.0 @@ -3880,9 +4043,9 @@ snapshots: postcss-safe-parser: 6.0.0(postcss@8.4.47) postcss-selector-parser: 6.1.2 semver: 7.6.3 - svelte-eslint-parser: 0.43.0(svelte@4.2.19) + svelte-eslint-parser: 0.43.0(svelte@5.1.4) optionalDependencies: - svelte: 4.2.19 + svelte: 5.1.4 transitivePeerDependencies: - ts-node @@ -3968,6 +4131,11 @@ snapshots: dependencies: estraverse: 5.3.0 + esrap@1.2.2: + dependencies: + '@jridgewell/sourcemap-codec': 1.5.0 + '@types/estree': 1.0.6 + esrecurse@4.3.0: dependencies: estraverse: 5.3.0 @@ -3990,6 +4158,8 @@ snapshots: exit-hook@2.2.1: {} + expect-type@1.1.0: {} + external-editor@3.1.0: dependencies: chardet: 0.7.0 @@ -4132,12 +4302,16 @@ snapshots: globals@14.0.0: {} + globals@15.11.0: {} + globalyzer@0.1.0: {} globrex@0.1.2: {} graceful-fs@4.2.11: {} + graphemer@1.4.0: {} + has-flag@4.0.0: {} hasown@2.0.2: @@ -4507,12 +4681,6 @@ snapshots: pathval@2.0.0: {} - periscopic@3.1.0: - dependencies: - '@types/estree': 1.0.6 - estree-walker: 3.0.3 - is-reference: 3.0.2 - picocolors@1.1.1: {} picomatch@2.3.1: {} @@ -4590,10 +4758,10 @@ snapshots: prelude-ls@1.2.1: {} - prettier-plugin-svelte@3.2.7(prettier@3.3.3)(svelte@4.2.19): + prettier-plugin-svelte@3.2.7(prettier@3.3.3)(svelte@5.1.4): dependencies: prettier: 3.3.3 - svelte: 4.2.19 + svelte: 5.1.4 prettier@3.3.3: {} @@ -4848,19 +5016,19 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} - svelte-check@4.0.5(picomatch@4.0.2)(svelte@4.2.19)(typescript@5.6.3): + svelte-check@4.0.5(picomatch@4.0.2)(svelte@5.1.4)(typescript@5.6.3): dependencies: '@jridgewell/trace-mapping': 0.3.25 chokidar: 4.0.1 fdir: 6.4.2(picomatch@4.0.2) picocolors: 1.1.1 sade: 1.8.1 - svelte: 4.2.19 + svelte: 5.1.4 typescript: 5.6.3 transitivePeerDependencies: - picomatch - svelte-eslint-parser@0.43.0(svelte@4.2.19): + svelte-eslint-parser@0.43.0(svelte@5.1.4): dependencies: eslint-scope: 7.2.2 eslint-visitor-keys: 3.4.3 @@ -4868,28 +5036,23 @@ snapshots: postcss: 8.4.47 postcss-scss: 4.0.9(postcss@8.4.47) optionalDependencies: - svelte: 4.2.19 + svelte: 5.1.4 - svelte-hmr@0.16.0(svelte@4.2.19): - dependencies: - svelte: 4.2.19 - - svelte@4.2.19: + svelte@5.1.4: dependencies: '@ampproject/remapping': 2.3.0 '@jridgewell/sourcemap-codec': 1.5.0 - '@jridgewell/trace-mapping': 0.3.25 '@types/estree': 1.0.6 acorn: 8.14.0 + acorn-typescript: 1.4.13(acorn@8.14.0) aria-query: 5.3.2 axobject-query: 4.1.0 - code-red: 1.0.4 - css-tree: 2.3.1 - estree-walker: 3.0.3 + esm-env: 1.0.0 + esrap: 1.2.2 is-reference: 3.0.2 locate-character: 3.0.0 magic-string: 0.30.12 - periscopic: 3.1.0 + zimmerframe: 1.1.2 tailwindcss@3.4.14: dependencies: @@ -4966,6 +5129,10 @@ snapshots: tree-kill@1.2.2: {} + ts-api-utils@1.3.0(typescript@5.6.3): + dependencies: + typescript: 5.6.3 + ts-interface-checker@0.1.13: {} tslib@1.14.1: {} @@ -4980,6 +5147,17 @@ snapshots: type-fest@0.21.3: {} + typescript-eslint@8.12.1(eslint@9.13.0(jiti@1.21.6))(typescript@5.6.3): + dependencies: + '@typescript-eslint/eslint-plugin': 8.12.1(@typescript-eslint/parser@8.12.1(eslint@9.13.0(jiti@1.21.6))(typescript@5.6.3))(eslint@9.13.0(jiti@1.21.6))(typescript@5.6.3) + '@typescript-eslint/parser': 8.12.1(eslint@9.13.0(jiti@1.21.6))(typescript@5.6.3) + '@typescript-eslint/utils': 8.12.1(eslint@9.13.0(jiti@1.21.6))(typescript@5.6.3) + optionalDependencies: + typescript: 5.6.3 + transitivePeerDependencies: + - eslint + - supports-color + typescript@5.6.3: {} ua-parser-js@2.0.0-beta.3: {} @@ -5026,12 +5204,12 @@ snapshots: util-deprecate@1.0.2: {} - vite-node@2.1.3(@types/node@22.8.1): + vite-node@2.1.4(@types/node@22.8.2): dependencies: cac: 6.7.14 debug: 4.3.7 pathe: 1.1.2 - vite: 5.4.10(@types/node@22.8.1) + vite: 5.4.10(@types/node@22.8.2) transitivePeerDependencies: - '@types/node' - less @@ -5043,17 +5221,17 @@ snapshots: - supports-color - terser - vite-plugin-mkcert@1.17.6(vite@5.4.10(@types/node@22.8.1)): + vite-plugin-mkcert@1.17.6(vite@5.4.10(@types/node@22.8.2)): dependencies: '@octokit/rest': 20.1.1 axios: 1.7.7(debug@4.3.7) debug: 4.3.7 picocolors: 1.1.1 - vite: 5.4.10(@types/node@22.8.1) + vite: 5.4.10(@types/node@22.8.2) transitivePeerDependencies: - supports-color - vite-plugin-tailwind-purgecss@0.3.3(tailwindcss@3.4.14)(vite@5.4.10(@types/node@22.8.1)): + vite-plugin-tailwind-purgecss@0.3.3(tailwindcss@3.4.14)(vite@5.4.10(@types/node@22.8.2)): dependencies: chalk: 5.3.0 css-tree: 2.3.1 @@ -5061,32 +5239,33 @@ snapshots: purgecss: 6.0.0 purgecss-from-html: 6.0.0 tailwindcss: 3.4.14 - vite: 5.4.10(@types/node@22.8.1) + vite: 5.4.10(@types/node@22.8.2) - vite@5.4.10(@types/node@22.8.1): + vite@5.4.10(@types/node@22.8.2): dependencies: esbuild: 0.21.5 postcss: 8.4.47 rollup: 4.24.2 optionalDependencies: - '@types/node': 22.8.1 + '@types/node': 22.8.2 fsevents: 2.3.3 - vitefu@0.2.5(vite@5.4.10(@types/node@22.8.1)): + vitefu@1.0.3(vite@5.4.10(@types/node@22.8.2)): optionalDependencies: - vite: 5.4.10(@types/node@22.8.1) - - vitest@2.1.3(@types/node@22.8.1): - dependencies: - '@vitest/expect': 2.1.3 - '@vitest/mocker': 2.1.3(@vitest/spy@2.1.3)(vite@5.4.10(@types/node@22.8.1)) - '@vitest/pretty-format': 2.1.3 - '@vitest/runner': 2.1.3 - '@vitest/snapshot': 2.1.3 - '@vitest/spy': 2.1.3 - '@vitest/utils': 2.1.3 - chai: 5.1.1 + vite: 5.4.10(@types/node@22.8.2) + + vitest@2.1.4(@types/node@22.8.2): + dependencies: + '@vitest/expect': 2.1.4 + '@vitest/mocker': 2.1.4(vite@5.4.10(@types/node@22.8.2)) + '@vitest/pretty-format': 2.1.4 + '@vitest/runner': 2.1.4 + '@vitest/snapshot': 2.1.4 + '@vitest/spy': 2.1.4 + '@vitest/utils': 2.1.4 + chai: 5.1.2 debug: 4.3.7 + expect-type: 1.1.0 magic-string: 0.30.12 pathe: 1.1.2 std-env: 3.7.0 @@ -5094,11 +5273,11 @@ snapshots: tinyexec: 0.3.1 tinypool: 1.0.1 tinyrainbow: 1.2.0 - vite: 5.4.10(@types/node@22.8.1) - vite-node: 2.1.3(@types/node@22.8.1) + vite: 5.4.10(@types/node@22.8.2) + vite-node: 2.1.4(@types/node@22.8.2) why-is-node-running: 2.3.0 optionalDependencies: - '@types/node': 22.8.1 + '@types/node': 22.8.2 transitivePeerDependencies: - less - lightningcss @@ -5224,4 +5403,6 @@ snapshots: mustache: 4.2.0 stacktracey: 2.1.8 + zimmerframe@1.1.2: {} + zod@3.23.8: {} diff --git a/postcss.config.cjs b/postcss.config.js similarity index 77% rename from postcss.config.cjs rename to postcss.config.js index 12a703d9..2aa7205d 100644 --- a/postcss.config.cjs +++ b/postcss.config.js @@ -1,4 +1,4 @@ -module.exports = { +export default { plugins: { tailwindcss: {}, autoprefixer: {}, diff --git a/src/lib/api/internal/v1/.openapi-generator/FILES b/src/lib/api/internal/v1/.openapi-generator/FILES index 254762e6..684e9686 100644 --- a/src/lib/api/internal/v1/.openapi-generator/FILES +++ b/src/lib/api/internal/v1/.openapi-generator/FILES @@ -15,6 +15,9 @@ apis/index.ts index.ts models/AdminOnlineDeviceResponse.ts models/AdminOnlineDeviceResponseIEnumerableBaseResponse.ts +models/AdminUserCountsResponse.ts +models/AdminUserResponse.ts +models/AdminUserResponsePaginated.ts models/BooleanNullableBaseResponse.ts models/ChangeEmailRequest.ts models/ChangePasswordRequest.ts @@ -24,12 +27,12 @@ models/ControlLogSenderLight.ts models/ControlType.ts models/CreateShareCode.ts models/CreateTokenRequest.ts -models/DeviceEdit.ts models/DeviceSelfResponse.ts models/DeviceSelfResponseBaseResponse.ts models/EditTokenRequest.ts models/GenericIni.ts models/GuidBaseResponse.ts +models/HubEditRequest.ts models/LcgNodeResponse.ts models/LcgNodeResponseBaseResponse.ts models/LcgResponse.ts @@ -47,6 +50,7 @@ models/OtaItemIReadOnlyCollectionBaseResponse.ts models/OtaUpdateStatus.ts models/OwnerShockerResponse.ts models/OwnerShockerResponseIEnumerableIEnumerableBaseResponse.ts +models/PasswordHashingAlgorithm.ts models/PasswordResetProcessData.ts models/PauseReasonBaseResponse.ts models/PauseRequest.ts diff --git a/src/lib/api/internal/v1/apis/AdminApi.ts b/src/lib/api/internal/v1/apis/AdminApi.ts index 3813acb9..042febad 100644 --- a/src/lib/api/internal/v1/apis/AdminApi.ts +++ b/src/lib/api/internal/v1/apis/AdminApi.ts @@ -16,12 +16,24 @@ import * as runtime from '../runtime'; import type { AdminOnlineDeviceResponseIEnumerableBaseResponse, + AdminUserResponsePaginated, } from '../models/index'; import { AdminOnlineDeviceResponseIEnumerableBaseResponseFromJSON, AdminOnlineDeviceResponseIEnumerableBaseResponseToJSON, + AdminUserResponsePaginatedFromJSON, + AdminUserResponsePaginatedToJSON, } from '../models/index'; +export interface AdminDeleteUserRequest { + userId: string; +} + +export interface AdminGetUsersRequest { + limit?: number; + offset?: number; +} + /** * AdminApi - interface * @@ -29,6 +41,21 @@ import { * @interface AdminApiInterface */ export interface AdminApiInterface { + /** + * + * @summary Deletes a user + * @param {string} userId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AdminApiInterface + */ + adminDeleteUserRaw(requestParameters: AdminDeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; + + /** + * Deletes a user + */ + adminDeleteUser(userId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + /** * * @summary Gets all online devices @@ -43,6 +70,22 @@ export interface AdminApiInterface { */ adminGetOnlineDevices(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + /** + * + * @summary Gets all users, paginated + * @param {number} [limit] + * @param {number} [offset] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AdminApiInterface + */ + adminGetUsersRaw(requestParameters: AdminGetUsersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; + + /** + * Gets all users, paginated + */ + adminGetUsers(limit?: number, offset?: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + } /** @@ -50,6 +93,47 @@ export interface AdminApiInterface { */ export class AdminApi extends runtime.BaseAPI implements AdminApiInterface { + /** + * Deletes a user + */ + async adminDeleteUserRaw(requestParameters: AdminDeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['userId'] == null) { + throw new runtime.RequiredError( + 'userId', + 'Required parameter "userId" was null or undefined when calling adminDeleteUser().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["OpenShockToken"] = await this.configuration.apiKey("OpenShockToken"); // OpenShockToken authentication + } + + const response = await this.request({ + path: `/1/admin/users/{userId}`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters['userId']))), + method: 'DELETE', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + if (this.isJsonMime(response.headers.get('content-type'))) { + return new runtime.JSONApiResponse(response); + } else { + return new runtime.TextApiResponse(response) as any; + } + } + + /** + * Deletes a user + */ + async adminDeleteUser(userId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.adminDeleteUserRaw({ userId: userId }, initOverrides); + return await response.value(); + } + /** * Gets all online devices */ @@ -80,4 +164,42 @@ export class AdminApi extends runtime.BaseAPI implements AdminApiInterface { return await response.value(); } + /** + * Gets all users, paginated + */ + async adminGetUsersRaw(requestParameters: AdminGetUsersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; + } + + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["OpenShockToken"] = await this.configuration.apiKey("OpenShockToken"); // OpenShockToken authentication + } + + const response = await this.request({ + path: `/1/admin/users`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => AdminUserResponsePaginatedFromJSON(jsonValue)); + } + + /** + * Gets all users, paginated + */ + async adminGetUsers(limit?: number, offset?: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.adminGetUsersRaw({ limit: limit, offset: offset }, initOverrides); + return await response.value(); + } + } diff --git a/src/lib/api/internal/v1/apis/DevicesApi.ts b/src/lib/api/internal/v1/apis/DevicesApi.ts index abf925cf..f103f4d3 100644 --- a/src/lib/api/internal/v1/apis/DevicesApi.ts +++ b/src/lib/api/internal/v1/apis/DevicesApi.ts @@ -15,10 +15,8 @@ import * as runtime from '../runtime'; import type { - DeviceEdit, - GuidBaseResponse, + HubEditRequest, LcgResponseBaseResponse, - ObjectBaseResponse, OpenShockProblem, OtaItemIReadOnlyCollectionBaseResponse, ResponseDeviceIEnumerableBaseResponse, @@ -27,14 +25,10 @@ import type { StringBaseResponse, } from '../models/index'; import { - DeviceEditFromJSON, - DeviceEditToJSON, - GuidBaseResponseFromJSON, - GuidBaseResponseToJSON, + HubEditRequestFromJSON, + HubEditRequestToJSON, LcgResponseBaseResponseFromJSON, LcgResponseBaseResponseToJSON, - ObjectBaseResponseFromJSON, - ObjectBaseResponseToJSON, OpenShockProblemFromJSON, OpenShockProblemToJSON, OtaItemIReadOnlyCollectionBaseResponseFromJSON, @@ -51,7 +45,7 @@ import { export interface DevicesEditDeviceRequest { deviceId: string; - deviceEdit?: DeviceEdit; + hubEditRequest?: HubEditRequest; } export interface DevicesGetDeviceByIdRequest { @@ -96,28 +90,28 @@ export interface DevicesApiInterface { * @throws {RequiredError} * @memberof DevicesApiInterface */ - devicesCreateDeviceRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; + devicesCreateDeviceRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Create a new device for the current user */ - devicesCreateDevice(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + devicesCreateDevice(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * * @summary Edit a device * @param {string} deviceId - * @param {DeviceEdit} [deviceEdit] + * @param {HubEditRequest} [hubEditRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DevicesApiInterface */ - devicesEditDeviceRaw(requestParameters: DevicesEditDeviceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; + devicesEditDeviceRaw(requestParameters: DevicesEditDeviceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Edit a device */ - devicesEditDevice(deviceId: string, deviceEdit?: DeviceEdit, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + devicesEditDevice(deviceId: string, hubEditRequest?: HubEditRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * @@ -216,12 +210,12 @@ export interface DevicesApiInterface { * @throws {RequiredError} * @memberof DevicesApiInterface */ - devicesRegenerateDeviceTokenRaw(requestParameters: DevicesRegenerateDeviceTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; + devicesRegenerateDeviceTokenRaw(requestParameters: DevicesRegenerateDeviceTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Regenerate a device token */ - devicesRegenerateDeviceToken(deviceId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + devicesRegenerateDeviceToken(deviceId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * @@ -231,12 +225,12 @@ export interface DevicesApiInterface { * @throws {RequiredError} * @memberof DevicesApiInterface */ - devicesRemoveDeviceRaw(requestParameters: DevicesRemoveDeviceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; + devicesRemoveDeviceRaw(requestParameters: DevicesRemoveDeviceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Remove a device from current user\'s account */ - devicesRemoveDevice(deviceId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + devicesRemoveDevice(deviceId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } @@ -248,7 +242,7 @@ export class DevicesApi extends runtime.BaseAPI implements DevicesApiInterface { /** * Create a new device for the current user */ - async devicesCreateDeviceRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async devicesCreateDeviceRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -264,13 +258,17 @@ export class DevicesApi extends runtime.BaseAPI implements DevicesApiInterface { query: queryParameters, }, initOverrides); - return new runtime.JSONApiResponse(response, (jsonValue) => GuidBaseResponseFromJSON(jsonValue)); + if (this.isJsonMime(response.headers.get('content-type'))) { + return new runtime.JSONApiResponse(response); + } else { + return new runtime.TextApiResponse(response) as any; + } } /** * Create a new device for the current user */ - async devicesCreateDevice(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + async devicesCreateDevice(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.devicesCreateDeviceRaw(initOverrides); return await response.value(); } @@ -278,7 +276,7 @@ export class DevicesApi extends runtime.BaseAPI implements DevicesApiInterface { /** * Edit a device */ - async devicesEditDeviceRaw(requestParameters: DevicesEditDeviceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async devicesEditDeviceRaw(requestParameters: DevicesEditDeviceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['deviceId'] == null) { throw new runtime.RequiredError( 'deviceId', @@ -301,17 +299,21 @@ export class DevicesApi extends runtime.BaseAPI implements DevicesApiInterface { method: 'PATCH', headers: headerParameters, query: queryParameters, - body: DeviceEditToJSON(requestParameters['deviceEdit']), + body: HubEditRequestToJSON(requestParameters['hubEditRequest']), }, initOverrides); - return new runtime.JSONApiResponse(response, (jsonValue) => ObjectBaseResponseFromJSON(jsonValue)); + if (this.isJsonMime(response.headers.get('content-type'))) { + return new runtime.JSONApiResponse(response); + } else { + return new runtime.TextApiResponse(response) as any; + } } /** * Edit a device */ - async devicesEditDevice(deviceId: string, deviceEdit?: DeviceEdit, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.devicesEditDeviceRaw({ deviceId: deviceId, deviceEdit: deviceEdit }, initOverrides); + async devicesEditDevice(deviceId: string, hubEditRequest?: HubEditRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.devicesEditDeviceRaw({ deviceId: deviceId, hubEditRequest: hubEditRequest }, initOverrides); return await response.value(); } @@ -533,7 +535,7 @@ export class DevicesApi extends runtime.BaseAPI implements DevicesApiInterface { /** * Regenerate a device token */ - async devicesRegenerateDeviceTokenRaw(requestParameters: DevicesRegenerateDeviceTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async devicesRegenerateDeviceTokenRaw(requestParameters: DevicesRegenerateDeviceTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['deviceId'] == null) { throw new runtime.RequiredError( 'deviceId', @@ -556,13 +558,17 @@ export class DevicesApi extends runtime.BaseAPI implements DevicesApiInterface { query: queryParameters, }, initOverrides); - return new runtime.JSONApiResponse(response, (jsonValue) => ObjectBaseResponseFromJSON(jsonValue)); + if (this.isJsonMime(response.headers.get('content-type'))) { + return new runtime.JSONApiResponse(response); + } else { + return new runtime.TextApiResponse(response) as any; + } } /** * Regenerate a device token */ - async devicesRegenerateDeviceToken(deviceId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + async devicesRegenerateDeviceToken(deviceId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.devicesRegenerateDeviceTokenRaw({ deviceId: deviceId }, initOverrides); return await response.value(); } @@ -570,7 +576,7 @@ export class DevicesApi extends runtime.BaseAPI implements DevicesApiInterface { /** * Remove a device from current user\'s account */ - async devicesRemoveDeviceRaw(requestParameters: DevicesRemoveDeviceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async devicesRemoveDeviceRaw(requestParameters: DevicesRemoveDeviceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['deviceId'] == null) { throw new runtime.RequiredError( 'deviceId', @@ -593,13 +599,17 @@ export class DevicesApi extends runtime.BaseAPI implements DevicesApiInterface { query: queryParameters, }, initOverrides); - return new runtime.JSONApiResponse(response, (jsonValue) => ObjectBaseResponseFromJSON(jsonValue)); + if (this.isJsonMime(response.headers.get('content-type'))) { + return new runtime.JSONApiResponse(response); + } else { + return new runtime.TextApiResponse(response) as any; + } } /** * Remove a device from current user\'s account */ - async devicesRemoveDevice(deviceId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + async devicesRemoveDevice(deviceId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.devicesRemoveDeviceRaw({ deviceId: deviceId }, initOverrides); return await response.value(); } diff --git a/src/lib/api/internal/v1/models/AdminUserCountsResponse.ts b/src/lib/api/internal/v1/models/AdminUserCountsResponse.ts new file mode 100644 index 00000000..8d805ceb --- /dev/null +++ b/src/lib/api/internal/v1/models/AdminUserCountsResponse.ts @@ -0,0 +1,147 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenShock.API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface AdminUserCountsResponse + */ +export interface AdminUserCountsResponse { + /** + * + * @type {number} + * @memberof AdminUserCountsResponse + */ + devices: number; + /** + * + * @type {number} + * @memberof AdminUserCountsResponse + */ + shockers: number; + /** + * + * @type {number} + * @memberof AdminUserCountsResponse + */ + apiTokens: number; + /** + * + * @type {number} + * @memberof AdminUserCountsResponse + */ + passwordResetRequests: number; + /** + * + * @type {number} + * @memberof AdminUserCountsResponse + */ + shockerControlLogs: number; + /** + * + * @type {number} + * @memberof AdminUserCountsResponse + */ + shockerShares: number; + /** + * + * @type {number} + * @memberof AdminUserCountsResponse + */ + shockerShareLinks: number; + /** + * + * @type {number} + * @memberof AdminUserCountsResponse + */ + changeNameRequests: number; + /** + * + * @type {number} + * @memberof AdminUserCountsResponse + */ + changeEmailRequests: number; + /** + * + * @type {number} + * @memberof AdminUserCountsResponse + */ + createUserRequests: number; +} + +/** + * Check if a given object implements the AdminUserCountsResponse interface. + */ +export function instanceOfAdminUserCountsResponse(value: object): value is AdminUserCountsResponse { + if (!('devices' in value) || value['devices'] === undefined) return false; + if (!('shockers' in value) || value['shockers'] === undefined) return false; + if (!('apiTokens' in value) || value['apiTokens'] === undefined) return false; + if (!('passwordResetRequests' in value) || value['passwordResetRequests'] === undefined) return false; + if (!('shockerControlLogs' in value) || value['shockerControlLogs'] === undefined) return false; + if (!('shockerShares' in value) || value['shockerShares'] === undefined) return false; + if (!('shockerShareLinks' in value) || value['shockerShareLinks'] === undefined) return false; + if (!('changeNameRequests' in value) || value['changeNameRequests'] === undefined) return false; + if (!('changeEmailRequests' in value) || value['changeEmailRequests'] === undefined) return false; + if (!('createUserRequests' in value) || value['createUserRequests'] === undefined) return false; + return true; +} + +export function AdminUserCountsResponseFromJSON(json: any): AdminUserCountsResponse { + return AdminUserCountsResponseFromJSONTyped(json, false); +} + +export function AdminUserCountsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): AdminUserCountsResponse { + if (json == null) { + return json; + } + return { + + 'devices': json['devices'], + 'shockers': json['shockers'], + 'apiTokens': json['apiTokens'], + 'passwordResetRequests': json['passwordResetRequests'], + 'shockerControlLogs': json['shockerControlLogs'], + 'shockerShares': json['shockerShares'], + 'shockerShareLinks': json['shockerShareLinks'], + 'changeNameRequests': json['changeNameRequests'], + 'changeEmailRequests': json['changeEmailRequests'], + 'createUserRequests': json['createUserRequests'], + }; +} + + export function AdminUserCountsResponseToJSON(json: any): AdminUserCountsResponse { + return AdminUserCountsResponseToJSONTyped(json, false); + } + + export function AdminUserCountsResponseToJSONTyped(value?: AdminUserCountsResponse | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'devices': value['devices'], + 'shockers': value['shockers'], + 'apiTokens': value['apiTokens'], + 'passwordResetRequests': value['passwordResetRequests'], + 'shockerControlLogs': value['shockerControlLogs'], + 'shockerShares': value['shockerShares'], + 'shockerShareLinks': value['shockerShareLinks'], + 'changeNameRequests': value['changeNameRequests'], + 'changeEmailRequests': value['changeEmailRequests'], + 'createUserRequests': value['createUserRequests'], + }; +} + diff --git a/src/lib/api/internal/v1/models/AdminUserResponse.ts b/src/lib/api/internal/v1/models/AdminUserResponse.ts new file mode 100644 index 00000000..c0ffe635 --- /dev/null +++ b/src/lib/api/internal/v1/models/AdminUserResponse.ts @@ -0,0 +1,153 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenShock.API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { PasswordHashingAlgorithm } from './PasswordHashingAlgorithm'; +import { + PasswordHashingAlgorithmFromJSON, + PasswordHashingAlgorithmFromJSONTyped, + PasswordHashingAlgorithmToJSON, + PasswordHashingAlgorithmToJSONTyped, +} from './PasswordHashingAlgorithm'; +import type { AdminUserCountsResponse } from './AdminUserCountsResponse'; +import { + AdminUserCountsResponseFromJSON, + AdminUserCountsResponseFromJSONTyped, + AdminUserCountsResponseToJSON, + AdminUserCountsResponseToJSONTyped, +} from './AdminUserCountsResponse'; +import type { RankType } from './RankType'; +import { + RankTypeFromJSON, + RankTypeFromJSONTyped, + RankTypeToJSON, + RankTypeToJSONTyped, +} from './RankType'; + +/** + * + * @export + * @interface AdminUserResponse + */ +export interface AdminUserResponse { + /** + * + * @type {string} + * @memberof AdminUserResponse + */ + id: string; + /** + * + * @type {string} + * @memberof AdminUserResponse + */ + name: string | null; + /** + * + * @type {string} + * @memberof AdminUserResponse + */ + email: string | null; + /** + * + * @type {PasswordHashingAlgorithm} + * @memberof AdminUserResponse + */ + passwordHashType: PasswordHashingAlgorithm; + /** + * + * @type {Date} + * @memberof AdminUserResponse + */ + createdAt: Date; + /** + * + * @type {boolean} + * @memberof AdminUserResponse + */ + emailActivated: boolean; + /** + * + * @type {RankType} + * @memberof AdminUserResponse + */ + rank: RankType; + /** + * + * @type {AdminUserCountsResponse} + * @memberof AdminUserResponse + */ + counts: AdminUserCountsResponse; +} + + + +/** + * Check if a given object implements the AdminUserResponse interface. + */ +export function instanceOfAdminUserResponse(value: object): value is AdminUserResponse { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('name' in value) || value['name'] === undefined) return false; + if (!('email' in value) || value['email'] === undefined) return false; + if (!('passwordHashType' in value) || value['passwordHashType'] === undefined) return false; + if (!('createdAt' in value) || value['createdAt'] === undefined) return false; + if (!('emailActivated' in value) || value['emailActivated'] === undefined) return false; + if (!('rank' in value) || value['rank'] === undefined) return false; + if (!('counts' in value) || value['counts'] === undefined) return false; + return true; +} + +export function AdminUserResponseFromJSON(json: any): AdminUserResponse { + return AdminUserResponseFromJSONTyped(json, false); +} + +export function AdminUserResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): AdminUserResponse { + if (json == null) { + return json; + } + return { + + 'id': json['id'], + 'name': json['name'], + 'email': json['email'], + 'passwordHashType': PasswordHashingAlgorithmFromJSON(json['passwordHashType']), + 'createdAt': (new Date(json['createdAt'])), + 'emailActivated': json['emailActivated'], + 'rank': RankTypeFromJSON(json['rank']), + 'counts': AdminUserCountsResponseFromJSON(json['counts']), + }; +} + + export function AdminUserResponseToJSON(json: any): AdminUserResponse { + return AdminUserResponseToJSONTyped(json, false); + } + + export function AdminUserResponseToJSONTyped(value?: AdminUserResponse | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'id': value['id'], + 'name': value['name'], + 'email': value['email'], + 'passwordHashType': PasswordHashingAlgorithmToJSON(value['passwordHashType']), + 'createdAt': ((value['createdAt']).toISOString()), + 'emailActivated': value['emailActivated'], + 'rank': RankTypeToJSON(value['rank']), + 'counts': AdminUserCountsResponseToJSON(value['counts']), + }; +} + diff --git a/src/lib/api/internal/v1/models/AdminUserResponsePaginated.ts b/src/lib/api/internal/v1/models/AdminUserResponsePaginated.ts new file mode 100644 index 00000000..5e0405d4 --- /dev/null +++ b/src/lib/api/internal/v1/models/AdminUserResponsePaginated.ts @@ -0,0 +1,97 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenShock.API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { AdminUserResponse } from './AdminUserResponse'; +import { + AdminUserResponseFromJSON, + AdminUserResponseFromJSONTyped, + AdminUserResponseToJSON, + AdminUserResponseToJSONTyped, +} from './AdminUserResponse'; + +/** + * + * @export + * @interface AdminUserResponsePaginated + */ +export interface AdminUserResponsePaginated { + /** + * + * @type {number} + * @memberof AdminUserResponsePaginated + */ + offset?: number; + /** + * + * @type {number} + * @memberof AdminUserResponsePaginated + */ + limit?: number; + /** + * + * @type {number} + * @memberof AdminUserResponsePaginated + */ + total?: number; + /** + * + * @type {Array} + * @memberof AdminUserResponsePaginated + */ + data?: Array | null; +} + +/** + * Check if a given object implements the AdminUserResponsePaginated interface. + */ +export function instanceOfAdminUserResponsePaginated(value: object): value is AdminUserResponsePaginated { + return true; +} + +export function AdminUserResponsePaginatedFromJSON(json: any): AdminUserResponsePaginated { + return AdminUserResponsePaginatedFromJSONTyped(json, false); +} + +export function AdminUserResponsePaginatedFromJSONTyped(json: any, ignoreDiscriminator: boolean): AdminUserResponsePaginated { + if (json == null) { + return json; + } + return { + + 'offset': json['offset'] == null ? undefined : json['offset'], + 'limit': json['limit'] == null ? undefined : json['limit'], + 'total': json['total'] == null ? undefined : json['total'], + 'data': json['data'] == null ? undefined : ((json['data'] as Array).map(AdminUserResponseFromJSON)), + }; +} + + export function AdminUserResponsePaginatedToJSON(json: any): AdminUserResponsePaginated { + return AdminUserResponsePaginatedToJSONTyped(json, false); + } + + export function AdminUserResponsePaginatedToJSONTyped(value?: AdminUserResponsePaginated | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'offset': value['offset'], + 'limit': value['limit'], + 'total': value['total'], + 'data': value['data'] == null ? undefined : ((value['data'] as Array).map(AdminUserResponseToJSON)), + }; +} + diff --git a/src/lib/api/internal/v1/models/HubEditRequest.ts b/src/lib/api/internal/v1/models/HubEditRequest.ts new file mode 100644 index 00000000..efb43e65 --- /dev/null +++ b/src/lib/api/internal/v1/models/HubEditRequest.ts @@ -0,0 +1,66 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenShock.API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface HubEditRequest + */ +export interface HubEditRequest { + /** + * + * @type {string} + * @memberof HubEditRequest + */ + name: string; +} + +/** + * Check if a given object implements the HubEditRequest interface. + */ +export function instanceOfHubEditRequest(value: object): value is HubEditRequest { + if (!('name' in value) || value['name'] === undefined) return false; + return true; +} + +export function HubEditRequestFromJSON(json: any): HubEditRequest { + return HubEditRequestFromJSONTyped(json, false); +} + +export function HubEditRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): HubEditRequest { + if (json == null) { + return json; + } + return { + + 'name': json['name'], + }; +} + + export function HubEditRequestToJSON(json: any): HubEditRequest { + return HubEditRequestToJSONTyped(json, false); + } + + export function HubEditRequestToJSONTyped(value?: HubEditRequest | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'name': value['name'], + }; +} + diff --git a/src/lib/api/internal/v1/models/PasswordHashingAlgorithm.ts b/src/lib/api/internal/v1/models/PasswordHashingAlgorithm.ts new file mode 100644 index 00000000..9a021ac6 --- /dev/null +++ b/src/lib/api/internal/v1/models/PasswordHashingAlgorithm.ts @@ -0,0 +1,54 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenShock.API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/** + * + * @export + * @enum {string} + */ +export enum PasswordHashingAlgorithm { + bCrypt = 'BCrypt', + pbkdf2 = 'PBKDF2', + unknown = 'Unknown', + unknownDefaultOpenApi = '11184809' +} + + +export function instanceOfPasswordHashingAlgorithm(value: any): boolean { + for (const key in PasswordHashingAlgorithm) { + if (Object.prototype.hasOwnProperty.call(PasswordHashingAlgorithm, key)) { + if (PasswordHashingAlgorithm[key as keyof typeof PasswordHashingAlgorithm] === value) { + return true; + } + } + } + return false; +} + +export function PasswordHashingAlgorithmFromJSON(json: any): PasswordHashingAlgorithm { + return PasswordHashingAlgorithmFromJSONTyped(json, false); +} + +export function PasswordHashingAlgorithmFromJSONTyped(json: any, ignoreDiscriminator: boolean): PasswordHashingAlgorithm { + return json as PasswordHashingAlgorithm; +} + +export function PasswordHashingAlgorithmToJSON(value?: PasswordHashingAlgorithm | null): any { + return value as any; +} + +export function PasswordHashingAlgorithmToJSONTyped(value: any, ignoreDiscriminator: boolean): PasswordHashingAlgorithm { + return value as PasswordHashingAlgorithm; +} + diff --git a/src/lib/api/internal/v1/models/index.ts b/src/lib/api/internal/v1/models/index.ts index 51f2e3f4..c00e24fa 100644 --- a/src/lib/api/internal/v1/models/index.ts +++ b/src/lib/api/internal/v1/models/index.ts @@ -2,6 +2,9 @@ /* eslint-disable */ export * from './AdminOnlineDeviceResponse'; export * from './AdminOnlineDeviceResponseIEnumerableBaseResponse'; +export * from './AdminUserCountsResponse'; +export * from './AdminUserResponse'; +export * from './AdminUserResponsePaginated'; export * from './BooleanNullableBaseResponse'; export * from './ChangeEmailRequest'; export * from './ChangePasswordRequest'; @@ -11,12 +14,12 @@ export * from './ControlLogSenderLight'; export * from './ControlType'; export * from './CreateShareCode'; export * from './CreateTokenRequest'; -export * from './DeviceEdit'; export * from './DeviceSelfResponse'; export * from './DeviceSelfResponseBaseResponse'; export * from './EditTokenRequest'; export * from './GenericIni'; export * from './GuidBaseResponse'; +export * from './HubEditRequest'; export * from './LcgNodeResponse'; export * from './LcgNodeResponseBaseResponse'; export * from './LcgResponse'; @@ -34,6 +37,7 @@ export * from './OtaItemIReadOnlyCollectionBaseResponse'; export * from './OtaUpdateStatus'; export * from './OwnerShockerResponse'; export * from './OwnerShockerResponseIEnumerableIEnumerableBaseResponse'; +export * from './PasswordHashingAlgorithm'; export * from './PasswordResetProcessData'; export * from './PauseReasonBaseResponse'; export * from './PauseRequest'; diff --git a/src/lib/api/internal/v2/.openapi-generator/FILES b/src/lib/api/internal/v2/.openapi-generator/FILES index de560379..9897d2af 100644 --- a/src/lib/api/internal/v2/.openapi-generator/FILES +++ b/src/lib/api/internal/v2/.openapi-generator/FILES @@ -1,4 +1,5 @@ apis/AccountApi.ts +apis/DevicesApi.ts apis/ShockerApi.ts apis/index.ts index.ts @@ -6,6 +7,7 @@ models/ChangeUsernameRequest.ts models/Control.ts models/ControlRequest.ts models/ControlType.ts +models/HubCreateRequest.ts models/LoginV2.ts models/ObjectBaseResponse.ts models/OpenShockProblem.ts diff --git a/src/lib/api/internal/v2/apis/DevicesApi.ts b/src/lib/api/internal/v2/apis/DevicesApi.ts new file mode 100644 index 00000000..c53c72b7 --- /dev/null +++ b/src/lib/api/internal/v2/apis/DevicesApi.ts @@ -0,0 +1,95 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenShock.API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import type { + HubCreateRequest, +} from '../models/index'; +import { + HubCreateRequestFromJSON, + HubCreateRequestToJSON, +} from '../models/index'; + +export interface DevicesCreateDeviceV2Request { + hubCreateRequest?: HubCreateRequest; +} + +/** + * DevicesApi - interface + * + * @export + * @interface DevicesApiInterface + */ +export interface DevicesApiInterface { + /** + * + * @summary Create a new device for the current user + * @param {HubCreateRequest} [hubCreateRequest] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DevicesApiInterface + */ + devicesCreateDeviceV2Raw(requestParameters: DevicesCreateDeviceV2Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; + + /** + * Create a new device for the current user + */ + devicesCreateDeviceV2(hubCreateRequest?: HubCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + +} + +/** + * + */ +export class DevicesApi extends runtime.BaseAPI implements DevicesApiInterface { + + /** + * Create a new device for the current user + */ + async devicesCreateDeviceV2Raw(requestParameters: DevicesCreateDeviceV2Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["OpenShockToken"] = await this.configuration.apiKey("OpenShockToken"); // OpenShockToken authentication + } + + const response = await this.request({ + path: `/2/devices`, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: HubCreateRequestToJSON(requestParameters['hubCreateRequest']), + }, initOverrides); + + if (this.isJsonMime(response.headers.get('content-type'))) { + return new runtime.JSONApiResponse(response); + } else { + return new runtime.TextApiResponse(response) as any; + } + } + + /** + * Create a new device for the current user + */ + async devicesCreateDeviceV2(hubCreateRequest?: HubCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.devicesCreateDeviceV2Raw({ hubCreateRequest: hubCreateRequest }, initOverrides); + return await response.value(); + } + +} diff --git a/src/lib/api/internal/v2/apis/index.ts b/src/lib/api/internal/v2/apis/index.ts index 57a1cf5e..27f411de 100644 --- a/src/lib/api/internal/v2/apis/index.ts +++ b/src/lib/api/internal/v2/apis/index.ts @@ -1,4 +1,5 @@ /* tslint:disable */ /* eslint-disable */ export * from './AccountApi'; +export * from './DevicesApi'; export * from './ShockerApi'; diff --git a/src/lib/api/internal/v2/models/ControlRequest.ts b/src/lib/api/internal/v2/models/ControlRequest.ts index 2ac25d61..17a0cec5 100644 --- a/src/lib/api/internal/v2/models/ControlRequest.ts +++ b/src/lib/api/internal/v2/models/ControlRequest.ts @@ -38,7 +38,7 @@ export interface ControlRequest { * @type {string} * @memberof ControlRequest */ - customName: string | null; + customName?: string | null; } /** @@ -46,7 +46,6 @@ export interface ControlRequest { */ export function instanceOfControlRequest(value: object): value is ControlRequest { if (!('shocks' in value) || value['shocks'] === undefined) return false; - if (!('customName' in value) || value['customName'] === undefined) return false; return true; } @@ -61,7 +60,7 @@ export function ControlRequestFromJSONTyped(json: any, ignoreDiscriminator: bool return { 'shocks': (json['shocks'] == null ? null : (json['shocks'] as Array).map(ControlFromJSON)), - 'customName': json['customName'], + 'customName': json['customName'] == null ? undefined : json['customName'], }; } diff --git a/src/lib/api/internal/v2/models/HubCreateRequest.ts b/src/lib/api/internal/v2/models/HubCreateRequest.ts new file mode 100644 index 00000000..1609fc36 --- /dev/null +++ b/src/lib/api/internal/v2/models/HubCreateRequest.ts @@ -0,0 +1,66 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenShock.API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface HubCreateRequest + */ +export interface HubCreateRequest { + /** + * + * @type {string} + * @memberof HubCreateRequest + */ + name: string; +} + +/** + * Check if a given object implements the HubCreateRequest interface. + */ +export function instanceOfHubCreateRequest(value: object): value is HubCreateRequest { + if (!('name' in value) || value['name'] === undefined) return false; + return true; +} + +export function HubCreateRequestFromJSON(json: any): HubCreateRequest { + return HubCreateRequestFromJSONTyped(json, false); +} + +export function HubCreateRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): HubCreateRequest { + if (json == null) { + return json; + } + return { + + 'name': json['name'], + }; +} + + export function HubCreateRequestToJSON(json: any): HubCreateRequest { + return HubCreateRequestToJSONTyped(json, false); + } + + export function HubCreateRequestToJSONTyped(value?: HubCreateRequest | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'name': value['name'], + }; +} + diff --git a/src/lib/api/internal/v2/models/index.ts b/src/lib/api/internal/v2/models/index.ts index 7dc4bf84..8035809e 100644 --- a/src/lib/api/internal/v2/models/index.ts +++ b/src/lib/api/internal/v2/models/index.ts @@ -4,6 +4,7 @@ export * from './ChangeUsernameRequest'; export * from './Control'; export * from './ControlRequest'; export * from './ControlType'; +export * from './HubCreateRequest'; export * from './LoginV2'; export * from './ObjectBaseResponse'; export * from './OpenShockProblem'; diff --git a/src/lib/components/ControlModules/ClassicControlModule.svelte b/src/lib/components/ControlModules/ClassicControlModule.svelte index a856e7ae..c4eb68ce 100644 --- a/src/lib/components/ControlModules/ClassicControlModule.svelte +++ b/src/lib/components/ControlModules/ClassicControlModule.svelte @@ -3,10 +3,14 @@ import CircleSlider from './Internal/CircleSlider.svelte'; import type { ShockerResponse } from '$lib/api/internal/v1'; - export let shocker: ShockerResponse; + interface Props { + shocker: ShockerResponse; + } + + let { shocker }: Props = $props(); - let intensity: number = 25; - let duration: number = 1; + let intensity: number = $state(25); + let duration: number = $state(1); const dispatch = createEventDispatcher(); @@ -28,16 +32,28 @@
- - -
diff --git a/src/lib/components/ControlModules/Internal/CircleSlider.svelte b/src/lib/components/ControlModules/Internal/CircleSlider.svelte index 04149b85..9c30d281 100644 --- a/src/lib/components/ControlModules/Internal/CircleSlider.svelte +++ b/src/lib/components/ControlModules/Internal/CircleSlider.svelte @@ -18,21 +18,25 @@ const labelId = id + '-label'; const guageId = id + '-guage'; - export let name: string; - export let value: number; - export let min: number; - export let max: number; - export let step: number; - export let tabindex: number | null | undefined = undefined; + interface Props { + name: string; + value: number; + min: number; + max: number; + step: number; + tabindex?: number | null | undefined; + } + + let { name, value = $bindable(), min, max, step, tabindex = undefined }: Props = $props(); - let canvasHandle: HTMLDivElement; - let sliderHandle: HTMLDivElement; + let canvasHandle: HTMLDivElement | undefined = $state(); + let sliderHandle: HTMLDivElement | undefined = $state(); function stupidUnfloatHack(value: number) { // This is a stupid hack to avoid floating point errors, needed to make UI not look like shit return Math.round((value + Number.EPSILON) * 100) / 100; } - function updateValueFromSlider(event: MouseEvent | TouchEvent) { + function trackingUpdated(event: MouseEvent | TouchEvent) { if (!canvasHandle) return; const rect = canvasHandle.getBoundingClientRect(); @@ -48,9 +52,6 @@ value = lerp(min, max, fraction); } - function trackingUpdated(event: MouseEvent | TouchEvent) { - updateValueFromSlider(event); - } function trackingStopped() { window.removeEventListener('touchmove', trackingUpdated); window.removeEventListener('touchend', trackingStopped); @@ -70,11 +71,9 @@ window.addEventListener('mouseup', trackingStopped); } - updateValueFromSlider(event); + trackingUpdated(event); } - onDestroy(() => { - trackingStopped(); - }); + onDestroy(trackingStopped); // Smooth animation const animatedValue = tweened(value, { @@ -83,25 +82,23 @@ }); // Sanitize and update value - $: { + $effect(() => { if (value < min) value = min; if (value > max) value = max; value = stupidUnfloatHack(Math.round(value / step) * step); animatedValue.set(value); - } + }); // Update visual progress - let progressProps = {}; - $: { - let degrees = angleStart + invLerp(min, max, $animatedValue) * angleRange; + let degrees = $derived(angleStart + invLerp(min, max, $animatedValue) * angleRange); + let progressProps = $derived(calcSvgArcProps(center, angleStart, degrees, radius, 10)); - progressProps = calcSvgArcProps(center, angleStart, degrees, radius, 10); + $effect(() => { + if (!sliderHandle) return; - if (sliderHandle) { - sliderHandle.style.left = `${60 + getCircleX(60, degrees)}px`; // TODO: Avoid using pixel values - sliderHandle.style.top = `${60 + getCircleY(60, degrees)}px`; // TODO: Avoid using pixel values - } - } + sliderHandle.style.left = `${60 + getCircleX(60, degrees)}px`; // TODO: Avoid using pixel values + sliderHandle.style.top = `${60 + getCircleY(60, degrees)}px`; // TODO: Avoid using pixel values + });
@@ -112,8 +109,8 @@ fill="none" stroke-linecap="round" style="stroke: rgb(27, 29, 30)" - on:touchstart={trackingStarted} - on:mousedown={trackingStarted} + ontouchstart={trackingStarted} + onmousedown={trackingStarted} aria-hidden="true" />
diff --git a/src/lib/components/ControlModules/SimpleControlHeader.svelte b/src/lib/components/ControlModules/SimpleControlHeader.svelte index f63b85bd..ac7ab68c 100644 --- a/src/lib/components/ControlModules/SimpleControlHeader.svelte +++ b/src/lib/components/ControlModules/SimpleControlHeader.svelte @@ -1,9 +1,9 @@
- +

{shockIntensity}%

- +

{vibrationIntensity}%

- +

{duration}s

diff --git a/src/lib/components/ControlModules/SimpleControlModule.svelte b/src/lib/components/ControlModules/SimpleControlModule.svelte index b7e2be39..6af0b180 100644 --- a/src/lib/components/ControlModules/SimpleControlModule.svelte +++ b/src/lib/components/ControlModules/SimpleControlModule.svelte @@ -2,7 +2,11 @@ import type { ShockerResponse } from '$lib/api/internal/v1'; import { createEventDispatcher } from 'svelte'; - export let shocker: ShockerResponse; + interface Props { + shocker: ShockerResponse; + } + + let { shocker }: Props = $props(); const dispatch = createEventDispatcher(); @@ -19,16 +23,28 @@
- - -
diff --git a/src/lib/components/EspTool/FirmwareFlasher.svelte b/src/lib/components/EspTool/FirmwareFlasher.svelte index 85b92cea..9d05ad8e 100644 --- a/src/lib/components/EspTool/FirmwareFlasher.svelte +++ b/src/lib/components/EspTool/FirmwareFlasher.svelte @@ -5,15 +5,24 @@ import { DownloadFirmwareBinary, GetFirmwareBinaryHash } from './CDN'; import { ProgressBar } from '@skeletonlabs/skeleton'; - export let version: string; - export let board: string; - export let manager: FlashManager; - export let isFlashing: boolean = false; + interface Props { + version: string; + board: string; + manager: FlashManager; + isFlashing?: boolean; + } + + let { + version, + board, + manager, + isFlashing = $bindable(false) + }: Props = $props(); - let eraseFlash: boolean = false; - let progressName: string | null = null; - let progressPercent: number | undefined = undefined; - let error: string | null = null; + let eraseFlash: boolean = $state(false); + let progressName: string | null = $state(null); + let progressPercent: number | undefined = $state(undefined); + let error: string | null = $state(null); async function FlashDeviceImpl() { if (!version || !board || !manager) { @@ -93,7 +102,7 @@ - {#each $pages as page} - - {/each} - - - - -
- - -
diff --git a/src/lib/components/table/RowCount.svelte b/src/lib/components/table/RowCount.svelte deleted file mode 100644 index 8100ac51..00000000 --- a/src/lib/components/table/RowCount.svelte +++ /dev/null @@ -1,15 +0,0 @@ - - - diff --git a/src/lib/components/table/RowsPerPage.svelte b/src/lib/components/table/RowsPerPage.svelte deleted file mode 100644 index c18fb38b..00000000 --- a/src/lib/components/table/RowsPerPage.svelte +++ /dev/null @@ -1,17 +0,0 @@ - - - diff --git a/src/lib/components/table/Search.svelte b/src/lib/components/table/Search.svelte deleted file mode 100644 index 8618b671..00000000 --- a/src/lib/components/table/Search.svelte +++ /dev/null @@ -1,13 +0,0 @@ - - - handler.search(value)} -/> diff --git a/src/lib/components/table/ThFilter.svelte b/src/lib/components/table/ThFilter.svelte deleted file mode 100644 index 6bb768c6..00000000 --- a/src/lib/components/table/ThFilter.svelte +++ /dev/null @@ -1,18 +0,0 @@ - - - - { - if (filterBy) handler.filter(value, filterBy); - }} - /> - diff --git a/src/lib/components/table/ThSort.svelte b/src/lib/components/table/ThSort.svelte deleted file mode 100644 index d5b4c12d..00000000 --- a/src/lib/components/table/ThSort.svelte +++ /dev/null @@ -1,23 +0,0 @@ - - - handler.sort(orderBy)} class="cursor-pointer select-none"> -
- - {#if $sorted.identifier === orderBy} - {#if $sorted.direction === 'asc'} - ↓ - {:else if $sorted.direction === 'desc'} - ↑ - {/if} - {:else} - ↕ - {/if} -
- diff --git a/src/lib/components/toasts/ToastStore.ts b/src/lib/components/toasts/ToastStore.ts new file mode 100644 index 00000000..e69de29b diff --git a/src/lib/components/toasts/Toaster.svelte b/src/lib/components/toasts/Toaster.svelte new file mode 100644 index 00000000..e69de29b diff --git a/src/lib/modals/ApiTokenDisplayGeneratedModal.svelte b/src/lib/modals/ApiTokenDisplayGeneratedModal.svelte index 235f9879..bf9cff93 100644 --- a/src/lib/modals/ApiTokenDisplayGeneratedModal.svelte +++ b/src/lib/modals/ApiTokenDisplayGeneratedModal.svelte @@ -2,10 +2,14 @@ import type { SvelteComponent } from 'svelte'; import { getModalStore } from '@skeletonlabs/skeleton'; - export let parent: SvelteComponent; + interface Props { + parent: SvelteComponent; + } + + let { parent }: Props = $props(); const modalStore = getModalStore(); - let token: string = 'error'; + let token: string = $state('error'); function copyToken() { navigator.clipboard.writeText(token); @@ -23,12 +27,12 @@ token = $modalStore[0].meta.token;
- +
+ + disabled={!nameValidationResult.valid} onclick={onFormSubmit}>Save Changes diff --git a/src/lib/modals/ApiTokenGenerateModal.svelte b/src/lib/modals/ApiTokenGenerateModal.svelte index 59d56af1..0d7f5aaa 100644 --- a/src/lib/modals/ApiTokenGenerateModal.svelte +++ b/src/lib/modals/ApiTokenGenerateModal.svelte @@ -6,13 +6,17 @@ import { getModalStore } from '@skeletonlabs/skeleton'; import type { SvelteComponent } from 'svelte'; - export let parent: SvelteComponent; + interface Props { + parent: SvelteComponent; + } + + let { parent }: Props = $props(); const modalStore = getModalStore(); - let name = ''; - let expire = 'never'; - let expireCustom: Date | null = null; - let permissionsActually: PermissionType[] = [PermissionType.shockersUse]; + let name = $state(''); + let expire = $state('never'); + let expireCustom: Date | null = $state(null); + let permissionsActually: PermissionType[] = $state([PermissionType.shockersUse]); function getExpireDate(expireType: string, customExpireDate: Date | null): Date | null { switch (expireType) { @@ -103,8 +107,8 @@ return string.charAt(0).toUpperCase() + string.slice(1); } - $: nameValidationResult = nameValidation(name); - $: expireValidationResult = expireValidation(expire, expireCustom); + let nameValidationResult = $derived(nameValidation(name)); + let expireValidationResult = $derived(expireValidation(expire, expireCustom));
@@ -169,8 +173,8 @@
- + + disabled={!nameValidationResult.valid || !expireValidationResult.valid} onclick={onFormSubmit}>Generate
diff --git a/src/lib/modals/SignUpSuccessModal.svelte b/src/lib/modals/SignUpSuccessModal.svelte index 3e10ae49..64741751 100644 --- a/src/lib/modals/SignUpSuccessModal.svelte +++ b/src/lib/modals/SignUpSuccessModal.svelte @@ -1,7 +1,11 @@
@@ -10,7 +14,7 @@

Your account has been created. Please check your email to verify your account.

{:else} - + {@render children?.()} {/if} diff --git a/src/routes/(authenticated)/admin/online-hubs/+page.svelte b/src/routes/(authenticated)/admin/online-hubs/+page.svelte index 09148653..5a610c21 100644 --- a/src/routes/(authenticated)/admin/online-hubs/+page.svelte +++ b/src/routes/(authenticated)/admin/online-hubs/+page.svelte @@ -2,28 +2,33 @@ import { adminApi } from '$lib/api'; import { RankType, type AdminOnlineDeviceResponse } from '$lib/api/internal/v1'; import { UserStore } from '$lib/stores/UserStore'; + import { onMount } from 'svelte'; import AdminDeviceList from './AdminDeviceList.svelte'; - $: isAdmin = $UserStore.self?.rank === RankType.admin; + let isAdmin = $derived($UserStore.self?.rank === RankType.admin); - type FlatDevice = AdminOnlineDeviceResponse & { ownerName: string | null | undefined }; + type FlatDevice = AdminOnlineDeviceResponse & { ownerName: string | null }; - let devices: FlatDevice[] | null = null; + let devices: FlatDevice[] | null = $state(null); + + function fetchOnlineDevices() { + if (!isAdmin) return; // TODO: Display toast - $: if (isAdmin && !devices) { adminApi .adminGetOnlineDevices() .then((res) => { devices = res.data?.map((device) => ({ ...device, - ownerName: device.owner?.name, + ownerName: device.owner ? device.owner.name : null, })) ?? []; }) .catch((err) => { console.error(err); }); } + + onMount(fetchOnlineDevices);
@@ -32,8 +37,8 @@ Go Home {:else}
-

Admin Panel

- @@ -41,10 +46,7 @@ {#if devices} -
-

Online Users

- -
+ {/if} {/if}
diff --git a/src/routes/(authenticated)/admin/online-hubs/AdminDeviceList.svelte b/src/routes/(authenticated)/admin/online-hubs/AdminDeviceList.svelte index 5fc2e3f6..04050055 100644 --- a/src/routes/(authenticated)/admin/online-hubs/AdminDeviceList.svelte +++ b/src/routes/(authenticated)/admin/online-hubs/AdminDeviceList.svelte @@ -1,71 +1,56 @@ -
-
- - -
- - - - Device ID - Device Name - Firmware Version - Uptime - Gateway - Owner - - - - - - - - - - - - {#each $rows as row (row.id)} +
+ +
+ - - - - - - + Device ID + Device Name + Firmware Version + Uptime + Gateway + Owner - {/each} - -
{row.id}{row.name}{row.firmwareVersion} - {row.connectedAt ? durationToString(since - row.connectedAt.getTime()) : 'N/A'} - {row.gateway} - User Avatar -

{row.ownerName}

-
-
- - -
+ + + {#each table.rows as row} + + {row.id} + {row.name} + {row.firmwareVersion} + + {row.connectedAt ? durationToString(since - row.connectedAt.getTime()) : 'N/A'} + + {row.gateway} + +
+ User Avatar +

{row.ownerName}

+
+ + + {/each} + + +
diff --git a/src/routes/(authenticated)/hubs/+page.svelte b/src/routes/(authenticated)/hubs/+page.svelte index 67d2b499..8e938435 100644 --- a/src/routes/(authenticated)/hubs/+page.svelte +++ b/src/routes/(authenticated)/hubs/+page.svelte @@ -9,17 +9,21 @@ createdAt: Date; } - let devices: Device[] = []; + let devices: Device[] = $state([]); + + $effect(() => { + if (!$OwnDevicesStore) return; - $: if ($OwnDevicesStore != null) { const deviceStates = $OwnDeviceStatesStore?.map((state) => ({ id: state.device, online: state.online, firmwareVersion: state.firmwareVersion, })); + if (!deviceStates) return; + devices = $OwnDevicesStore.map((device) => { - const state = deviceStates?.find((state) => state.id === device.id); + const state = deviceStates.find((state) => state.id === device.id); return { id: device.id, name: device.name, @@ -28,7 +32,7 @@ createdAt: device.createdOn, }; }); - } + });
diff --git a/src/routes/(authenticated)/settings/account/+page.svelte b/src/routes/(authenticated)/settings/account/+page.svelte index f8927bfe..7b005020 100644 --- a/src/routes/(authenticated)/settings/account/+page.svelte +++ b/src/routes/(authenticated)/settings/account/+page.svelte @@ -11,22 +11,20 @@ const toastStore = getToastStore(); - let username: string = ''; - let email: string = ''; + let username: string = $state(''); + let email: string = $state(''); - let currentPassword: string = ''; - $: currentPasswordValid = currentPassword.length > 0; + let currentPassword: string = $state(''); + let currentPasswordValid = $derived(currentPassword.length > 0); - let password: string = ''; - let passwordValid: boolean = false; + let password: string = $state(''); + let passwordValid: boolean = $state(false); - let passwordConfirm: string = ''; + let passwordConfirm: string = $state(''); async function submitUsername() { try { - const response = await authenticatedAccountApi.authenticatedAccountChangeUsername({ - username: username, - }); + await authenticatedAccountApi.authenticatedAccountChangeUsername({ username }); toastStore.trigger({ background: 'variant-filled-success', @@ -58,7 +56,7 @@ console.log('Submitting password'); } - $: canSubmitPassword = currentPasswordValid && passwordValid && password == passwordConfirm; + let canSubmitPassword = $derived(currentPasswordValid && passwordValid && password == passwordConfirm); {#if $UserStore.self} @@ -87,9 +85,13 @@ - - Change your password - + {#snippet lead()} + + {/snippet} + {#snippet summary()} + Change your password + {/snippet} + {#snippet content()}
Change Password
-
+ {/snippet}
diff --git a/src/routes/(authenticated)/settings/api-tokens/+page.svelte b/src/routes/(authenticated)/settings/api-tokens/+page.svelte index c5d1fabe..4251b0ce 100644 --- a/src/routes/(authenticated)/settings/api-tokens/+page.svelte +++ b/src/routes/(authenticated)/settings/api-tokens/+page.svelte @@ -1,77 +1,75 @@
@@ -95,33 +93,37 @@ - {#each tokens as row (row.id)} + {#each tokens as token (token.id)} - {row.name} - {row.createdOn.toLocaleDateString()} - {#if row.validUntil} - - {elapsedToString(row.validUntil.getTime() - since)} + {token.name} + {token.createdOn.toLocaleDateString()} + {#if token.validUntil} + + {elapsedToString(token.validUntil.getTime() - since)} {:else} Never {/if} - {#if row.lastUsed.getTime() < 0} + {#if token.lastUsed.getTime() < 0} Never {:else} - - {elapsedToString(row.lastUsed.getTime() - since)} + + {elapsedToString(token.lastUsed.getTime() - since)} {/if} @@ -130,6 +132,8 @@
- +
diff --git a/src/routes/(authenticated)/settings/sessions/+page.svelte b/src/routes/(authenticated)/settings/sessions/+page.svelte index 3daec5dd..ea4ebd78 100644 --- a/src/routes/(authenticated)/settings/sessions/+page.svelte +++ b/src/routes/(authenticated)/settings/sessions/+page.svelte @@ -2,52 +2,50 @@ import { sessionApi } from '$lib/api'; import type { LoginSessionResponse } from '$lib/api/internal/v1'; import { handleApiError } from '$lib/errorhandling/apiErrorHandling'; - import { getToastStore } from '@skeletonlabs/skeleton'; import { elapsedToString } from '$lib/utils/time'; import { escapeHtml } from '$lib/utils/encoding'; - import { getModalStore } from '@skeletonlabs/skeleton'; + import { getModalStore, getToastStore } from '@skeletonlabs/skeleton'; + import { onMount } from 'svelte'; import { UAParser } from 'ua-parser-js'; const modalStore = getModalStore(); const toastStore = getToastStore(); - let sessions: LoginSessionResponse[] = []; - - let since: number = Date.now(); - setInterval(() => { - since = Date.now(); - }, 1000); + let sessions: LoginSessionResponse[] = $state([]); + + function refreshSessions() { + sessionApi + .sessionsListSessions() + .then((s) => { + sessions = s; + }) + .catch((e) => { + handleApiError(e, toastStore); + }); + } - async function listSessions() { - try { - sessions = await sessionApi.sessionsListSessions(); - console.log(sessions); - console.log(typeof sessions[0].expires); - } catch (e) { - await handleApiError(e, toastStore); - } + function deleteSession(sessionId: string) { + sessionApi + .sessionsDeleteSession(sessionId) + .then(() => { + sessions = sessions.filter((s) => s.id !== sessionId); + }) + .catch((e) => { + handleApiError(e, toastStore); + }); } - async function deleteSession(session: LoginSessionResponse) { + function showDeleteSessionModal(session: LoginSessionResponse) { modalStore.trigger({ type: 'confirm', title: 'Please Confirm', - body: `Are you sure you want to log out from ${escapeHtml(session.userAgent)}?`, - response: async (r: boolean) => { - if (r) await deleteSessionActually(session.id); + body: `Are you sure you want to log out from ${escapeHtml(session.userAgent)}?`, + response: (r: boolean) => { + if (r) deleteSession(session.id); }, }); } - async function deleteSessionActually(sessionId: string) { - try { - await sessionApi.sessionsDeleteSession(sessionId); - sessions = sessions.filter((session) => session.id !== sessionId); - } catch (e) { - await handleApiError(e, toastStore); - } - } - function getReadableName(userAgent: string | null): string { if (!userAgent) return 'Unknown'; @@ -65,7 +63,12 @@ return name; } - listSessions(); + onMount(refreshSessions); + + let since: number = $state(Date.now()); + setInterval(() => { + since = Date.now(); + }, 1000);
@@ -90,10 +93,14 @@ - {#each sessions as row (row.id)} + {#each sessions as session (session.id)} - {getReadableName(row.userAgent)} - {row.created.toLocaleDateString()} + + {getReadableName(session.userAgent)} + + + {session.created.toLocaleDateString()} + Not Implemented - {#if since < row.expires.getTime()} - - {elapsedToString(row.expires.getTime() - since)} + {#if since < session.expires.getTime()} + + {elapsedToString(session.expires.getTime() - since)} {:else} - Already expired + + Already expired + {/if} - {row.ip} + {session.ip} diff --git a/src/routes/(authenticated)/shockers/+page.svelte b/src/routes/(authenticated)/shockers/+page.svelte index c0b34596..2cd3755d 100644 --- a/src/routes/(authenticated)/shockers/+page.svelte +++ b/src/routes/(authenticated)/shockers/+page.svelte @@ -10,10 +10,11 @@ import { OwnDevicesStore } from '$lib/stores/DevicesStore'; import { popup, type PopupSettings } from '@skeletonlabs/skeleton'; - $: shockers = - $OwnDevicesStore?.flatMap((device) => device.shockers)?.filter((shocker) => !!shocker) ?? []; + let shockers = $derived( + $OwnDevicesStore?.flatMap((device) => device.shockers)?.filter((shocker) => !!shocker) ?? [] + ); - let moduleType: ModuleType = ModuleType.ClassicControlModule; + let moduleType: ModuleType = $state(ModuleType.ClassicControlModule); const modeClick: PopupSettings = { event: 'click', @@ -55,25 +56,25 @@
@@ -91,7 +92,7 @@ {/if} {#if moduleType === ModuleType.MapControlModule} - + {:else}
{#each shockers ?? [] as shocker (shocker.id)} diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte index e5ef365e..78544cee 100644 --- a/src/routes/+error.svelte +++ b/src/routes/+error.svelte @@ -6,20 +6,20 @@ import OpenGraphTags from '$lib/components/metadata/OpenGraphTags.svelte'; import TwitterSummaryTags from '$lib/components/metadata/Twitter/TwitterSummaryTags.svelte'; - let previousPage: string = base; + let previousPage: string = $state(base); afterNavigate(({ from }) => { previousPage = from?.url.pathname || previousPage; }); - $: meta = { + let meta = $derived({ title: 'Service Unavailable', description: 'OpenShock is currently unavailable', image: { src: '/logo.svg', alt: 'OpenShock Logo', }, - }; + }); diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 63e36517..23dac358 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -10,6 +10,12 @@ import { modalRegistry } from '$lib/modals'; import { page } from '$app/stores'; import { buildMetaData } from '$lib/metadata'; + + interface Props { + children?: import('svelte').Snippet; + } + + let { children }: Props = $props(); storePopup.set({ computePosition, autoUpdate, flip, shift, offset, arrow }); initializeStores(); @@ -24,9 +30,15 @@ -
- - + {#snippet header()} +
+ {/snippet} + {#snippet sidebarLeft()} + + {/snippet} + {@render children?.()} -