diff --git a/bun.lock b/bun.lock index 63ddae7..fbdee63 100644 --- a/bun.lock +++ b/bun.lock @@ -1,5 +1,6 @@ { "lockfileVersion": 1, + "configVersion": 0, "workspaces": { "": { "name": "hristudio", @@ -7,6 +8,7 @@ "@auth/drizzle-adapter": "^1.11.1", "@aws-sdk/client-s3": "^3.989.0", "@aws-sdk/s3-request-presigner": "^3.989.0", + "@better-auth/drizzle-adapter": "^1.5.5", "@dnd-kit/core": "^6.3.1", "@dnd-kit/sortable": "^10.0.0", "@dnd-kit/utilities": "^3.2.2", @@ -48,6 +50,7 @@ "@types/js-cookie": "^3.0.6", "@types/ws": "^8.18.1", "bcryptjs": "^3.0.3", + "better-auth": "^1.5.5", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "cmdk": "^1.1.1", @@ -207,6 +210,24 @@ "@babel/runtime": ["@babel/runtime@7.28.6", "", {}, "sha512-05WQkdpL9COIMz4LjTxGpPNCdlpyimKppYNoJ5Di5EUObifl8t4tuLuUBBZEpoLYOmfvIWrsp9fCl0HoPRVTdA=="], + "@better-auth/core": ["@better-auth/core@1.5.5", "", { "dependencies": { "@standard-schema/spec": "^1.1.0", "zod": "^4.3.6" }, "peerDependencies": { "@better-auth/utils": "0.3.1", "@better-fetch/fetch": "1.1.21", "@cloudflare/workers-types": ">=4", "better-call": "1.3.2", "jose": "^6.1.0", "kysely": "^0.28.5", "nanostores": "^1.0.1" }, "optionalPeers": ["@cloudflare/workers-types"] }, "sha512-1oR/2jAp821Dcf67kQYHUoyNcdc1TcShfw4QMK0YTVntuRES5mUOyvEJql5T6eIuLfaqaN4LOF78l0FtF66HXA=="], + + "@better-auth/drizzle-adapter": ["@better-auth/drizzle-adapter@1.5.5", "", { "peerDependencies": { "@better-auth/core": "1.5.5", "@better-auth/utils": "^0.3.0", "drizzle-orm": ">=0.41.0" }, "optionalPeers": ["drizzle-orm"] }, "sha512-HAi9xAP40oDt48QZeYBFTcmg3vt1Jik90GwoRIfangd7VGbxesIIDBJSnvwMbZ52GBIc6+V4FRw9lasNiNrPfw=="], + + "@better-auth/kysely-adapter": ["@better-auth/kysely-adapter@1.5.5", "", { "peerDependencies": { "@better-auth/core": "1.5.5", "@better-auth/utils": "^0.3.0", "kysely": "^0.27.0 || ^0.28.0" } }, "sha512-LmHffIVnqbfsxcxckMOoE8MwibWrbVFch+kwPKJ5OFDFv6lin75ufN7ZZ7twH0IMPLT/FcgzaRjP8jRrXRef9g=="], + + "@better-auth/memory-adapter": ["@better-auth/memory-adapter@1.5.5", "", { "peerDependencies": { "@better-auth/core": "1.5.5", "@better-auth/utils": "^0.3.0" } }, "sha512-4X0j1/2L+nsgmObjmy9xEGUFWUv38Qjthp558fwS3DAp6ueWWyCaxaD6VJZ7m5qPNMrsBStO5WGP8CmJTEWm7g=="], + + "@better-auth/mongo-adapter": ["@better-auth/mongo-adapter@1.5.5", "", { "peerDependencies": { "@better-auth/core": "1.5.5", "@better-auth/utils": "^0.3.0", "mongodb": "^6.0.0 || ^7.0.0" } }, "sha512-P1J9ljL5X5k740I8Rx1esPWNgWYPdJR5hf2CY7BwDSrQFPUHuzeCg0YhtEEP55niNateTXhBqGAcy0fVOeamZg=="], + + "@better-auth/prisma-adapter": ["@better-auth/prisma-adapter@1.5.5", "", { "peerDependencies": { "@better-auth/core": "1.5.5", "@better-auth/utils": "^0.3.0", "@prisma/client": "^5.0.0 || ^6.0.0 || ^7.0.0", "prisma": "^5.0.0 || ^6.0.0 || ^7.0.0" }, "optionalPeers": ["@prisma/client", "prisma"] }, "sha512-CliDd78CXHzzwQIXhCdwGr5Ml53i6JdCHWV7PYwTIJz9EAm6qb2RVBdpP3nqEfNjINGM22A6gfleCgCdZkTIZg=="], + + "@better-auth/telemetry": ["@better-auth/telemetry@1.5.5", "", { "dependencies": { "@better-auth/utils": "0.3.1", "@better-fetch/fetch": "1.1.21" }, "peerDependencies": { "@better-auth/core": "1.5.5" } }, "sha512-1+lklxArn4IMHuU503RcPdXrSG2tlXt4jnGG3omolmspQ7tktg/Y9XO/yAkYDurtvMn1xJ8X1Ov01Ji/r5s9BQ=="], + + "@better-auth/utils": ["@better-auth/utils@0.3.1", "", {}, "sha512-+CGp4UmZSUrHHnpHhLPYu6cV+wSUSvVbZbNykxhUDocpVNTo9uFFxw/NqJlh1iC4wQ9HKKWGCKuZ5wUgS0v6Kg=="], + + "@better-fetch/fetch": ["@better-fetch/fetch@1.1.21", "", {}, "sha512-/ImESw0sskqlVR94jB+5+Pxjf+xBwDZF/N5+y2/q4EqD7IARUTSpPfIo8uf39SYpCxyOCtbyYpUrZ3F/k0zT4A=="], + "@date-fns/tz": ["@date-fns/tz@1.4.1", "", {}, "sha512-P5LUNhtbj6YfI3iJjw5EL9eUAG6OitD0W3fWQcpQjDRc/QIsL0tRNuO1PcDvPccWL1fSTXXdE1ds+l95DV/OFA=="], "@dnd-kit/accessibility": ["@dnd-kit/accessibility@3.1.1", "", { "dependencies": { "tslib": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0" } }, "sha512-2P+YgaXF+gRsIihwwY1gCsQSYnu9Zyj2py8kY5fFvUM1qm2WA2u639R6YNVfU4GWr+ZM5mqEsfHZZLoRONbemw=="], @@ -377,6 +398,8 @@ "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.29", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ=="], + "@mongodb-js/saslprep": ["@mongodb-js/saslprep@1.4.6", "", { "dependencies": { "sparse-bitfield": "^3.0.3" } }, "sha512-y+x3H1xBZd38n10NZF/rEBlvDOOMQ6LKUTHqr8R9VkJ+mmQOYtJFxIlkkK8fZrtOiL6VixbOBWMbZGBdal3Z1g=="], + "@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@0.2.12", "", { "dependencies": { "@emnapi/core": "^1.4.3", "@emnapi/runtime": "^1.4.3", "@tybys/wasm-util": "^0.10.0" } }, "sha512-ZVWUcfwY4E/yPitQJl481FjFo3K22D6qF0DuFH6Y/nbnE11GY5uguDxZMGXPQ8WQ0128MXQD7TnfHyK4oWoIJQ=="], "@next/env": ["@next/env@16.1.6", "", {}, "sha512-N1ySLuZjnAtN3kFnwhAwPvZah8RJxKasD7x1f8shFqhncnWZn4JMfg37diLNuoHsLAlrDfM3g4mawVdtAG8XLQ=="], @@ -399,6 +422,10 @@ "@next/swc-win32-x64-msvc": ["@next/swc-win32-x64-msvc@16.1.6", "", { "os": "win32", "cpu": "x64" }, "sha512-NRfO39AIrzBnixKbjuo2YiYhB6o9d8v/ymU9m/Xk8cyVk+k7XylniXkHwjs4s70wedVffc6bQNbufk5v0xEm0A=="], + "@noble/ciphers": ["@noble/ciphers@2.1.1", "", {}, "sha512-bysYuiVfhxNJuldNXlFEitTVdNnYUc+XNJZd7Qm2a5j1vZHgY+fazadNFWFaMK/2vye0JVlxV3gHmC0WDfAOQw=="], + + "@noble/hashes": ["@noble/hashes@2.0.1", "", {}, "sha512-XlOlEbQcE9fmuXxrVTXCTlG2nlRXa9Rj3rr5Ue/+tX+nmkgbX720YHh0VR3hBF9xDvwnb8D2shVGOwNx+ulArw=="], + "@nodelib/fs.scandir": ["@nodelib/fs.scandir@2.1.5", "", { "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" } }, "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g=="], "@nodelib/fs.stat": ["@nodelib/fs.stat@2.0.5", "", {}, "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A=="], @@ -855,6 +882,10 @@ "@types/uuid": ["@types/uuid@11.0.0", "", { "dependencies": { "uuid": "*" } }, "sha512-HVyk8nj2m+jcFRNazzqyVKiZezyhDKrGUA3jlEcg/nZ6Ms+qHwocba1Y/AaVaznJTAM9xpdFSh+ptbNrhOGvZA=="], + "@types/webidl-conversions": ["@types/webidl-conversions@7.0.3", "", {}, "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA=="], + + "@types/whatwg-url": ["@types/whatwg-url@13.0.0", "", { "dependencies": { "@types/webidl-conversions": "*" } }, "sha512-N8WXpbE6Wgri7KUSvrmQcqrMllKZ9uxkYWMt+mCSGwNc0Hsw9VQTW7ApqI4XNrx6/SaM2QQJCzMPDEXE058s+Q=="], + "@types/ws": ["@types/ws@8.18.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="], "@typescript-eslint/eslint-plugin": ["@typescript-eslint/eslint-plugin@8.55.0", "", { "dependencies": { "@eslint-community/regexpp": "^4.12.2", "@typescript-eslint/scope-manager": "8.55.0", "@typescript-eslint/type-utils": "8.55.0", "@typescript-eslint/utils": "8.55.0", "@typescript-eslint/visitor-keys": "8.55.0", "ignore": "^7.0.5", "natural-compare": "^1.4.0", "ts-api-utils": "^2.4.0" }, "peerDependencies": { "@typescript-eslint/parser": "^8.55.0", "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-1y/MVSz0NglV1ijHC8OT49mPJ4qhPYjiK08YUQVbIOyu+5k862LKUHFkpKHWu//zmr7hDR2rhwUm6gnCGNmGBQ=="], @@ -987,6 +1018,10 @@ "bcryptjs": ["bcryptjs@3.0.3", "", { "bin": { "bcrypt": "bin/bcrypt" } }, "sha512-GlF5wPWnSa/X5LKM1o0wz0suXIINz1iHRLvTS+sLyi7XPbe5ycmYI3DlZqVGZZtDgl4DmasFg7gOB3JYbphV5g=="], + "better-auth": ["better-auth@1.5.5", "", { "dependencies": { "@better-auth/core": "1.5.5", "@better-auth/drizzle-adapter": "1.5.5", "@better-auth/kysely-adapter": "1.5.5", "@better-auth/memory-adapter": "1.5.5", "@better-auth/mongo-adapter": "1.5.5", "@better-auth/prisma-adapter": "1.5.5", "@better-auth/telemetry": "1.5.5", "@better-auth/utils": "0.3.1", "@better-fetch/fetch": "1.1.21", "@noble/ciphers": "^2.1.1", "@noble/hashes": "^2.0.1", "better-call": "1.3.2", "defu": "^6.1.4", "jose": "^6.1.3", "kysely": "^0.28.11", "nanostores": "^1.1.1", "zod": "^4.3.6" }, "peerDependencies": { "@lynx-js/react": "*", "@prisma/client": "^5.0.0 || ^6.0.0 || ^7.0.0", "@sveltejs/kit": "^2.0.0", "@tanstack/react-start": "^1.0.0", "@tanstack/solid-start": "^1.0.0", "better-sqlite3": "^12.0.0", "drizzle-kit": ">=0.31.4", "drizzle-orm": ">=0.41.0", "mongodb": "^6.0.0 || ^7.0.0", "mysql2": "^3.0.0", "next": "^14.0.0 || ^15.0.0 || ^16.0.0", "pg": "^8.0.0", "prisma": "^5.0.0 || ^6.0.0 || ^7.0.0", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0", "solid-js": "^1.0.0", "svelte": "^4.0.0 || ^5.0.0", "vitest": "^2.0.0 || ^3.0.0 || ^4.0.0", "vue": "^3.0.0" }, "optionalPeers": ["@lynx-js/react", "@prisma/client", "@sveltejs/kit", "@tanstack/react-start", "@tanstack/solid-start", "better-sqlite3", "drizzle-kit", "drizzle-orm", "mongodb", "mysql2", "next", "pg", "prisma", "react", "react-dom", "solid-js", "svelte", "vitest", "vue"] }, "sha512-GpVPaV1eqr3mOovKfghJXXk6QvlcVeFbS3z+n+FPDid5rK/2PchnDtiaVCzWyXA9jH2KkirOfl+JhAUvnja0Eg=="], + + "better-call": ["better-call@1.3.2", "", { "dependencies": { "@better-auth/utils": "^0.3.1", "@better-fetch/fetch": "^1.1.21", "rou3": "^0.7.12", "set-cookie-parser": "^3.0.1" }, "peerDependencies": { "zod": "^4.0.0" }, "optionalPeers": ["zod"] }, "sha512-4cZIfrerDsNTn3cm+MhLbUePN0gdwkhSXEuG7r/zuQ8c/H7iU0/jSK5TD3FW7U0MgKHce/8jGpPYNO4Ve+4NBw=="], + "bl": ["bl@5.1.0", "", { "dependencies": { "buffer": "^6.0.3", "inherits": "^2.0.4", "readable-stream": "^3.4.0" } }, "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ=="], "block-stream2": ["block-stream2@2.1.0", "", { "dependencies": { "readable-stream": "^3.4.0" } }, "sha512-suhjmLI57Ewpmq00qaygS8UgEq2ly2PCItenIyhMqVjo4t4pGzqMvfgJuX8iWTeSDdfSSqS6j38fL4ToNL7Pfg=="], @@ -999,6 +1034,8 @@ "browser-or-node": ["browser-or-node@2.1.1", "", {}, "sha512-8CVjaLJGuSKMVTxJ2DpBl5XnlNDiT4cQFeuCJJrvJmts9YrTZDizTX7PjC2s6W4x+MBGZeEY6dGMrF04/6Hgqg=="], + "bson": ["bson@7.2.0", "", {}, "sha512-YCEo7KjMlbNlyHhz7zAZNDpIpQbd+wOEHJYezv0nMYTn4x31eIUM2yomNNubclAt63dObUzKHWsBLJ9QcZNSnQ=="], + "buffer": ["buffer@6.0.3", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.2.1" } }, "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA=="], "buffer-crc32": ["buffer-crc32@1.0.0", "", {}, "sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w=="], @@ -1085,6 +1122,8 @@ "define-properties": ["define-properties@1.2.1", "", { "dependencies": { "define-data-property": "^1.0.1", "has-property-descriptors": "^1.0.0", "object-keys": "^1.1.1" } }, "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg=="], + "defu": ["defu@6.1.4", "", {}, "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg=="], + "detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="], "detect-node-es": ["detect-node-es@1.1.0", "", {}, "sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ=="], @@ -1353,7 +1392,7 @@ "jiti": ["jiti@2.6.1", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ=="], - "jose": ["jose@6.0.12", "", {}, "sha512-T8xypXs8CpmiIi78k0E+Lk7T2zlK4zDyg+o1CZ4AkOHgDg98ogdP2BeZ61lTFKFyoEwJ9RgAgN+SdM3iPgNonQ=="], + "jose": ["jose@6.2.2", "", {}, "sha512-d7kPDd34KO/YnzaDOlikGpOurfF0ByC2sEV4cANCtdqLlTfBlw2p14O/5d/zv40gJPbIQxfES3nSx1/oYNyuZQ=="], "js-cookie": ["js-cookie@3.0.5", "", {}, "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw=="], @@ -1379,6 +1418,8 @@ "kleur": ["kleur@3.0.3", "", {}, "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w=="], + "kysely": ["kysely@0.28.14", "", {}, "sha512-SU3lgh0rPvq7upc6vvdVrCsSMUG1h3ChvHVOY7wJ2fw4C9QEB7X3d5eyYEyULUX7UQtxZJtZXGuT6U2US72UYA=="], + "language-subtag-registry": ["language-subtag-registry@0.3.23", "", {}, "sha512-0K65Lea881pHotoGEa5gDlMxt3pctLi2RplBb7Ezh4rRdLEOtgi7n4EwK9lamnUCkKBqaeKRVebTq6BAxSkpXQ=="], "language-tags": ["language-tags@1.0.9", "", { "dependencies": { "language-subtag-registry": "^0.3.20" } }, "sha512-MbjN408fEndfiQXbFQ1vnd+1NoLDsnQW41410oQBXiyXDMYH5z505juWa4KUE1LqxRC7DgOgZDbKLxHIwm27hA=="], @@ -1435,6 +1476,8 @@ "mdurl": ["mdurl@2.0.0", "", {}, "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w=="], + "memory-pager": ["memory-pager@1.5.0", "", {}, "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg=="], + "merge-stream": ["merge-stream@2.0.0", "", {}, "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w=="], "merge2": ["merge2@1.4.1", "", {}, "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg=="], @@ -1453,10 +1496,16 @@ "minio": ["minio@8.0.6", "", { "dependencies": { "async": "^3.2.4", "block-stream2": "^2.1.0", "browser-or-node": "^2.1.1", "buffer-crc32": "^1.0.0", "eventemitter3": "^5.0.1", "fast-xml-parser": "^4.4.1", "ipaddr.js": "^2.0.1", "lodash": "^4.17.21", "mime-types": "^2.1.35", "query-string": "^7.1.3", "stream-json": "^1.8.0", "through2": "^4.0.2", "web-encoding": "^1.1.5", "xml2js": "^0.5.0 || ^0.6.2" } }, "sha512-sOeh2/b/XprRmEtYsnNRFtOqNRTPDvYtMWh+spWlfsuCV/+IdxNeKVUMKLqI7b5Dr07ZqCPuaRGU/rB9pZYVdQ=="], + "mongodb": ["mongodb@7.1.0", "", { "dependencies": { "@mongodb-js/saslprep": "^1.3.0", "bson": "^7.1.1", "mongodb-connection-string-url": "^7.0.0" }, "peerDependencies": { "@aws-sdk/credential-providers": "^3.806.0", "@mongodb-js/zstd": "^7.0.0", "gcp-metadata": "^7.0.1", "kerberos": "^7.0.0", "mongodb-client-encryption": ">=7.0.0 <7.1.0", "snappy": "^7.3.2", "socks": "^2.8.6" }, "optionalPeers": ["@aws-sdk/credential-providers", "@mongodb-js/zstd", "gcp-metadata", "kerberos", "mongodb-client-encryption", "snappy", "socks"] }, "sha512-kMfnKunbolQYwCIyrkxNJFB4Ypy91pYqua5NargS/f8ODNSJxT03ZU3n1JqL4mCzbSih8tvmMEMLpKTT7x5gCg=="], + + "mongodb-connection-string-url": ["mongodb-connection-string-url@7.0.1", "", { "dependencies": { "@types/whatwg-url": "^13.0.0", "whatwg-url": "^14.1.0" } }, "sha512-h0AZ9A7IDVwwHyMxmdMXKy+9oNlF0zFoahHiX3vQ8e3KFcSP3VmsmfvtRSuLPxmyv2vjIDxqty8smTgie/SNRQ=="], + "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], "nanoid": ["nanoid@3.3.11", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w=="], + "nanostores": ["nanostores@1.2.0", "", {}, "sha512-F0wCzbsH80G7XXo0Jd9/AVQC7ouWY6idUCTnMwW5t/Rv9W8qmO6endavDwg7TNp5GbugwSukFMVZqzPSrSMndg=="], + "napi-postinstall": ["napi-postinstall@0.3.2", "", { "bin": { "napi-postinstall": "lib/cli.js" } }, "sha512-tWVJxJHmBWLy69PvO96TZMZDrzmw5KeiZBz3RHmiM2XZ9grBJ2WgMAFVVg25nqp3ZjTFUs2Ftw1JhscL3Teliw=="], "natural-compare": ["natural-compare@1.4.0", "", {}, "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw=="], @@ -1641,6 +1690,8 @@ "rope-sequence": ["rope-sequence@1.3.4", "", {}, "sha512-UT5EDe2cu2E/6O4igUr5PSFs23nvvukicWHx6GnOPlHAiiYbzNuCRQCuiUdHJQcqKalLKlrYJnjY0ySGsXNQXQ=="], + "rou3": ["rou3@0.7.12", "", {}, "sha512-iFE4hLDuloSWcD7mjdCDhx2bKcIsYbtOTpfH5MHHLSKMOUyjqQXTeZVa289uuwEGEKFoE/BAPbhaU4B774nceg=="], + "run-parallel": ["run-parallel@1.2.0", "", { "dependencies": { "queue-microtask": "^1.2.2" } }, "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA=="], "safe-array-concat": ["safe-array-concat@1.1.3", "", { "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.2", "get-intrinsic": "^1.2.6", "has-symbols": "^1.1.0", "isarray": "^2.0.5" } }, "sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q=="], @@ -1659,6 +1710,8 @@ "server-only": ["server-only@0.0.1", "", {}, "sha512-qepMx2JxAa5jjfzxG79yPPq+8BuFToHd1hm7kI+Z4zAq1ftQiP7HcxMhDDItrbtwVeLg/cY2JnKnrcFkmiswNA=="], + "set-cookie-parser": ["set-cookie-parser@3.1.0", "", {}, "sha512-kjnC1DXBHcxaOaOXBHBeRtltsDG2nUiUni+jP92M9gYdW12rsmx92UsfpH7o5tDRs7I1ZZPSQJQGv3UaRfCiuw=="], + "set-function-length": ["set-function-length@1.2.2", "", { "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", "function-bind": "^1.1.2", "get-intrinsic": "^1.2.4", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.2" } }, "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg=="], "set-function-name": ["set-function-name@2.0.2", "", { "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", "functions-have-names": "^1.2.3", "has-property-descriptors": "^1.0.2" } }, "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ=="], @@ -1697,6 +1750,8 @@ "source-map-support": ["source-map-support@0.5.21", "", { "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w=="], + "sparse-bitfield": ["sparse-bitfield@3.0.3", "", { "dependencies": { "memory-pager": "^1.0.2" } }, "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ=="], + "split-on-first": ["split-on-first@1.1.0", "", {}, "sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw=="], "stable-hash": ["stable-hash@0.0.5", "", {}, "sha512-+L3ccpzibovGXFK+Ap/f8LOS0ahMrHTf3xu7mMLSpEGU0EO9ucaysSylKo9eRDFNhWve/y275iPmIZ4z39a9iA=="], @@ -1773,6 +1828,8 @@ "to-regex-range": ["to-regex-range@5.0.1", "", { "dependencies": { "is-number": "^7.0.0" } }, "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ=="], + "tr46": ["tr46@5.1.1", "", { "dependencies": { "punycode": "^2.3.1" } }, "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw=="], + "trim-canvas": ["trim-canvas@0.1.2", "", {}, "sha512-nd4Ga3iLFV94mdhW9JFMLpQbHUyCQuhFOD71PEAt1NjtMD5wbZctzhX8c3agHNybMR5zXD1XTGoIEWk995E6pQ=="], "ts-api-utils": ["ts-api-utils@2.4.0", "", { "peerDependencies": { "typescript": ">=4.8.4" } }, "sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA=="], @@ -1837,6 +1894,10 @@ "web-streams-polyfill": ["web-streams-polyfill@3.3.3", "", {}, "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw=="], + "webidl-conversions": ["webidl-conversions@7.0.0", "", {}, "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g=="], + + "whatwg-url": ["whatwg-url@14.2.0", "", { "dependencies": { "tr46": "^5.1.0", "webidl-conversions": "^7.0.0" } }, "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw=="], + "which": ["which@4.0.0", "", { "dependencies": { "isexe": "^3.1.1" }, "bin": { "node-which": "bin/which.js" } }, "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg=="], "which-boxed-primitive": ["which-boxed-primitive@1.1.1", "", { "dependencies": { "is-bigint": "^1.1.0", "is-boolean-object": "^1.2.1", "is-number-object": "^1.1.1", "is-string": "^1.1.1", "is-symbol": "^1.1.1" } }, "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA=="], @@ -1863,6 +1924,8 @@ "zustand": ["zustand@4.5.7", "", { "dependencies": { "use-sync-external-store": "^1.2.2" }, "peerDependencies": { "@types/react": ">=16.8", "immer": ">=9.0.6", "react": ">=16.8" }, "optionalPeers": ["@types/react", "immer", "react"] }, "sha512-CHOUy7mu3lbD6o6LJLfllpjkzhHXSBlX8B9+qPddUsIfeF5S/UZ5q0kmCsnRqT1UHFQZchNFDDzMbQsuesHWlw=="], + "@auth/core/jose": ["jose@6.0.12", "", {}, "sha512-T8xypXs8CpmiIi78k0E+Lk7T2zlK4zDyg+o1CZ4AkOHgDg98ogdP2BeZ61lTFKFyoEwJ9RgAgN+SdM3iPgNonQ=="], + "@aws-crypto/crc32/@aws-sdk/types": ["@aws-sdk/types@3.840.0", "", { "dependencies": { "@smithy/types": "^4.3.1", "tslib": "^2.6.2" } }, "sha512-xliuHaUFZxEx1NSXeLLZ9Dyu6+EJVQKEoD+yM+zqUo3YDZ7medKJWY6fIOKiPX/N7XbLdBYwajb15Q7IL8KkeA=="], "@aws-crypto/crc32c/@aws-sdk/types": ["@aws-sdk/types@3.840.0", "", { "dependencies": { "@smithy/types": "^4.3.1", "tslib": "^2.6.2" } }, "sha512-xliuHaUFZxEx1NSXeLLZ9Dyu6+EJVQKEoD+yM+zqUo3YDZ7medKJWY6fIOKiPX/N7XbLdBYwajb15Q7IL8KkeA=="], @@ -2097,6 +2160,8 @@ "eslint-import-resolver-typescript/tinyglobby/fdir": ["fdir@6.4.6", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w=="], + "next-auth/@auth/core/jose": ["jose@6.0.12", "", {}, "sha512-T8xypXs8CpmiIi78k0E+Lk7T2zlK4zDyg+o1CZ4AkOHgDg98ogdP2BeZ61lTFKFyoEwJ9RgAgN+SdM3iPgNonQ=="], + "prosemirror-markdown/@types/markdown-it/@types/linkify-it": ["@types/linkify-it@5.0.0", "", {}, "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q=="], "prosemirror-markdown/@types/markdown-it/@types/mdurl": ["@types/mdurl@2.0.0", "", {}, "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg=="], diff --git a/drizzle/0000_old_tattoo.sql b/drizzle/0000_old_tattoo.sql deleted file mode 100644 index a160b1c..0000000 --- a/drizzle/0000_old_tattoo.sql +++ /dev/null @@ -1,553 +0,0 @@ -CREATE TYPE "public"."block_category" AS ENUM('wizard', 'robot', 'control', 'sensor', 'logic', 'event');--> statement-breakpoint -CREATE TYPE "public"."block_shape" AS ENUM('action', 'control', 'value', 'boolean', 'hat', 'cap');--> statement-breakpoint -CREATE TYPE "public"."communication_protocol" AS ENUM('rest', 'ros2', 'custom');--> statement-breakpoint -CREATE TYPE "public"."experiment_status" AS ENUM('draft', 'testing', 'ready', 'deprecated');--> statement-breakpoint -CREATE TYPE "public"."export_status" AS ENUM('pending', 'processing', 'completed', 'failed');--> statement-breakpoint -CREATE TYPE "public"."media_type" AS ENUM('video', 'audio', 'image');--> statement-breakpoint -CREATE TYPE "public"."plugin_status" AS ENUM('active', 'deprecated', 'disabled');--> statement-breakpoint -CREATE TYPE "public"."step_type" AS ENUM('wizard', 'robot', 'parallel', 'conditional');--> statement-breakpoint -CREATE TYPE "public"."study_member_role" AS ENUM('owner', 'researcher', 'wizard', 'observer');--> statement-breakpoint -CREATE TYPE "public"."study_status" AS ENUM('draft', 'active', 'completed', 'archived');--> statement-breakpoint -CREATE TYPE "public"."system_role" AS ENUM('administrator', 'researcher', 'wizard', 'observer');--> statement-breakpoint -CREATE TYPE "public"."trial_status" AS ENUM('scheduled', 'in_progress', 'completed', 'aborted', 'failed');--> statement-breakpoint -CREATE TYPE "public"."trust_level" AS ENUM('official', 'verified', 'community');--> statement-breakpoint -CREATE TABLE "hs_account" ( - "user_id" uuid NOT NULL, - "type" varchar(255) NOT NULL, - "provider" varchar(255) NOT NULL, - "provider_account_id" varchar(255) NOT NULL, - "refresh_token" text, - "access_token" text, - "expires_at" integer, - "token_type" varchar(255), - "scope" varchar(255), - "id_token" text, - "session_state" varchar(255), - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "updated_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - CONSTRAINT "hs_account_provider_provider_account_id_pk" PRIMARY KEY("provider","provider_account_id") -); ---> statement-breakpoint -CREATE TABLE "hs_action" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "step_id" uuid NOT NULL, - "name" varchar(255) NOT NULL, - "description" text, - "type" varchar(100) NOT NULL, - "order_index" integer NOT NULL, - "parameters" jsonb DEFAULT '{}'::jsonb, - "validation_schema" jsonb, - "timeout" integer, - "retry_count" integer DEFAULT 0 NOT NULL, - "source_kind" varchar(20), - "plugin_id" varchar(255), - "plugin_version" varchar(50), - "robot_id" varchar(255), - "base_action_id" varchar(255), - "category" varchar(50), - "transport" varchar(20), - "ros2_config" jsonb, - "rest_config" jsonb, - "retryable" boolean, - "parameter_schema_raw" jsonb, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "updated_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - CONSTRAINT "hs_action_step_id_order_index_unique" UNIQUE("step_id","order_index") -); ---> statement-breakpoint -CREATE TABLE "hs_activity_log" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "study_id" uuid, - "user_id" uuid, - "action" varchar(100) NOT NULL, - "resource_type" varchar(50), - "resource_id" uuid, - "description" text, - "ip_address" "inet", - "user_agent" text, - "metadata" jsonb DEFAULT '{}'::jsonb, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL -); ---> statement-breakpoint -CREATE TABLE "hs_annotation" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "trial_id" uuid NOT NULL, - "annotator_id" uuid NOT NULL, - "timestamp_start" timestamp with time zone NOT NULL, - "timestamp_end" timestamp with time zone, - "category" varchar(100), - "label" varchar(100), - "description" text, - "tags" jsonb DEFAULT '[]'::jsonb, - "metadata" jsonb DEFAULT '{}'::jsonb, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "updated_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL -); ---> statement-breakpoint -CREATE TABLE "hs_attachment" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "resource_type" varchar(50) NOT NULL, - "resource_id" uuid NOT NULL, - "file_name" varchar(255) NOT NULL, - "file_size" bigint NOT NULL, - "file_path" text NOT NULL, - "content_type" varchar(100), - "description" text, - "uploaded_by" uuid NOT NULL, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL -); ---> statement-breakpoint -CREATE TABLE "hs_audit_log" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "user_id" uuid, - "action" varchar(100) NOT NULL, - "resource_type" varchar(50), - "resource_id" uuid, - "changes" jsonb DEFAULT '{}'::jsonb, - "ip_address" "inet", - "user_agent" text, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL -); ---> statement-breakpoint -CREATE TABLE "hs_block_registry" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "block_type" varchar(100) NOT NULL, - "plugin_id" uuid, - "shape" "block_shape" NOT NULL, - "category" "block_category" NOT NULL, - "display_name" varchar(255) NOT NULL, - "description" text, - "icon" varchar(100), - "color" varchar(50), - "config" jsonb NOT NULL, - "parameter_schema" jsonb NOT NULL, - "execution_handler" varchar(100), - "timeout" integer, - "retry_policy" jsonb, - "requires_connection" boolean DEFAULT false, - "preview_mode" boolean DEFAULT true, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "updated_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - CONSTRAINT "hs_block_registry_block_type_plugin_id_unique" UNIQUE("block_type","plugin_id") -); ---> statement-breakpoint -CREATE TABLE "hs_comment" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "parent_id" uuid, - "resource_type" varchar(50) NOT NULL, - "resource_id" uuid NOT NULL, - "author_id" uuid NOT NULL, - "content" text NOT NULL, - "metadata" jsonb, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "updated_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL -); ---> statement-breakpoint -CREATE TABLE "hs_consent_form" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "study_id" uuid NOT NULL, - "version" integer DEFAULT 1 NOT NULL, - "title" varchar(255) NOT NULL, - "content" text NOT NULL, - "active" boolean DEFAULT true NOT NULL, - "created_by" uuid NOT NULL, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "storage_path" text, - CONSTRAINT "hs_consent_form_study_id_version_unique" UNIQUE("study_id","version") -); ---> statement-breakpoint -CREATE TABLE "hs_experiment" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "study_id" uuid NOT NULL, - "name" varchar(255) NOT NULL, - "description" text, - "version" integer DEFAULT 1 NOT NULL, - "robot_id" uuid, - "status" "experiment_status" DEFAULT 'draft' NOT NULL, - "estimated_duration" integer, - "created_by" uuid NOT NULL, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "updated_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "metadata" jsonb DEFAULT '{}'::jsonb, - "visual_design" jsonb, - "execution_graph" jsonb, - "plugin_dependencies" text[], - "integrity_hash" varchar(128), - "deleted_at" timestamp with time zone, - CONSTRAINT "hs_experiment_study_id_name_version_unique" UNIQUE("study_id","name","version") -); ---> statement-breakpoint -CREATE TABLE "hs_export_job" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "study_id" uuid NOT NULL, - "requested_by" uuid NOT NULL, - "export_type" varchar(50) NOT NULL, - "format" varchar(20) NOT NULL, - "filters" jsonb DEFAULT '{}'::jsonb, - "status" "export_status" DEFAULT 'pending' NOT NULL, - "storage_path" text, - "expires_at" timestamp with time zone, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "completed_at" timestamp with time zone, - "error_message" text -); ---> statement-breakpoint -CREATE TABLE "hs_media_capture" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "trial_id" uuid NOT NULL, - "media_type" "media_type", - "storage_path" text NOT NULL, - "file_size" bigint, - "duration" integer, - "format" varchar(20), - "resolution" varchar(20), - "start_timestamp" timestamp with time zone, - "end_timestamp" timestamp with time zone, - "metadata" jsonb DEFAULT '{}'::jsonb, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL -); ---> statement-breakpoint -CREATE TABLE "hs_participant_consent" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "participant_id" uuid NOT NULL, - "consent_form_id" uuid NOT NULL, - "signed_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "signature_data" text, - "ip_address" "inet", - "storage_path" text, - CONSTRAINT "hs_participant_consent_participant_id_consent_form_id_unique" UNIQUE("participant_id","consent_form_id") -); ---> statement-breakpoint -CREATE TABLE "hs_participant_document" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "participant_id" uuid NOT NULL, - "name" varchar(255) NOT NULL, - "type" varchar(100), - "storage_path" text NOT NULL, - "file_size" integer, - "uploaded_by" uuid, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL -); ---> statement-breakpoint -CREATE TABLE "hs_participant" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "study_id" uuid NOT NULL, - "participant_code" varchar(50) NOT NULL, - "email" varchar(255), - "name" varchar(255), - "demographics" jsonb DEFAULT '{}'::jsonb, - "consent_given" boolean DEFAULT false NOT NULL, - "consent_date" timestamp with time zone, - "notes" text, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "updated_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - CONSTRAINT "hs_participant_study_id_participant_code_unique" UNIQUE("study_id","participant_code") -); ---> statement-breakpoint -CREATE TABLE "hs_permission" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "name" varchar(100) NOT NULL, - "description" text, - "resource" varchar(50) NOT NULL, - "action" varchar(50) NOT NULL, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - CONSTRAINT "hs_permission_name_unique" UNIQUE("name") -); ---> statement-breakpoint -CREATE TABLE "hs_plugin_repository" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "name" varchar(255) NOT NULL, - "url" text NOT NULL, - "description" text, - "trust_level" "trust_level" DEFAULT 'community' NOT NULL, - "is_enabled" boolean DEFAULT true NOT NULL, - "is_official" boolean DEFAULT false NOT NULL, - "last_sync_at" timestamp with time zone, - "sync_status" varchar(50) DEFAULT 'pending', - "sync_error" text, - "metadata" jsonb DEFAULT '{}'::jsonb, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "updated_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "created_by" uuid NOT NULL, - CONSTRAINT "hs_plugin_repository_url_unique" UNIQUE("url") -); ---> statement-breakpoint -CREATE TABLE "hs_plugin" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "robot_id" uuid, - "identifier" varchar(100) NOT NULL, - "name" varchar(255) NOT NULL, - "version" varchar(50) NOT NULL, - "description" text, - "author" varchar(255), - "repository_url" text, - "trust_level" "trust_level", - "status" "plugin_status" DEFAULT 'active' NOT NULL, - "configuration_schema" jsonb, - "action_definitions" jsonb DEFAULT '[]'::jsonb, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "updated_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "metadata" jsonb DEFAULT '{}'::jsonb, - CONSTRAINT "hs_plugin_identifier_unique" UNIQUE("identifier"), - CONSTRAINT "hs_plugin_name_version_unique" UNIQUE("name","version") -); ---> statement-breakpoint -CREATE TABLE "hs_robot_plugin" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "name" varchar(255) NOT NULL, - "version" varchar(50) NOT NULL, - "manufacturer" varchar(255), - "description" text, - "robot_id" uuid, - "communication_protocol" "communication_protocol", - "status" "plugin_status" DEFAULT 'active' NOT NULL, - "config_schema" jsonb, - "capabilities" jsonb DEFAULT '[]'::jsonb, - "trust_level" "trust_level" DEFAULT 'community' NOT NULL, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "updated_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL -); ---> statement-breakpoint -CREATE TABLE "hs_robot" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "name" varchar(255) NOT NULL, - "manufacturer" varchar(255), - "model" varchar(255), - "description" text, - "capabilities" jsonb DEFAULT '[]'::jsonb, - "communication_protocol" "communication_protocol", - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "updated_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL -); ---> statement-breakpoint -CREATE TABLE "hs_role_permission" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "role" "system_role" NOT NULL, - "permission_id" uuid NOT NULL, - CONSTRAINT "hs_role_permission_role_permission_id_unique" UNIQUE("role","permission_id") -); ---> statement-breakpoint -CREATE TABLE "hs_sensor_data" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "trial_id" uuid NOT NULL, - "sensor_type" varchar(50) NOT NULL, - "timestamp" timestamp with time zone NOT NULL, - "data" jsonb NOT NULL, - "robot_state" jsonb DEFAULT '{}'::jsonb, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL -); ---> statement-breakpoint -CREATE TABLE "hs_session" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "session_token" varchar(255) NOT NULL, - "user_id" uuid NOT NULL, - "expires" timestamp with time zone NOT NULL, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "updated_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - CONSTRAINT "hs_session_session_token_unique" UNIQUE("session_token") -); ---> statement-breakpoint -CREATE TABLE "hs_shared_resource" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "study_id" uuid NOT NULL, - "resource_type" varchar(50) NOT NULL, - "resource_id" uuid NOT NULL, - "shared_by" uuid NOT NULL, - "share_token" varchar(255), - "permissions" jsonb DEFAULT '["read"]'::jsonb, - "expires_at" timestamp with time zone, - "access_count" integer DEFAULT 0 NOT NULL, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - CONSTRAINT "hs_shared_resource_share_token_unique" UNIQUE("share_token") -); ---> statement-breakpoint -CREATE TABLE "hs_step" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "experiment_id" uuid NOT NULL, - "name" varchar(255) NOT NULL, - "description" text, - "type" "step_type" NOT NULL, - "order_index" integer NOT NULL, - "duration_estimate" integer, - "required" boolean DEFAULT true NOT NULL, - "conditions" jsonb DEFAULT '{}'::jsonb, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "updated_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - CONSTRAINT "hs_step_experiment_id_order_index_unique" UNIQUE("experiment_id","order_index") -); ---> statement-breakpoint -CREATE TABLE "hs_study" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "name" varchar(255) NOT NULL, - "description" text, - "institution" varchar(255), - "irb_protocol" varchar(100), - "status" "study_status" DEFAULT 'draft' NOT NULL, - "created_by" uuid NOT NULL, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "updated_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "metadata" jsonb DEFAULT '{}'::jsonb, - "settings" jsonb DEFAULT '{}'::jsonb, - "deleted_at" timestamp with time zone -); ---> statement-breakpoint -CREATE TABLE "hs_study_member" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "study_id" uuid NOT NULL, - "user_id" uuid NOT NULL, - "role" "study_member_role" NOT NULL, - "permissions" jsonb DEFAULT '[]'::jsonb, - "joined_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "invited_by" uuid, - CONSTRAINT "hs_study_member_study_id_user_id_unique" UNIQUE("study_id","user_id") -); ---> statement-breakpoint -CREATE TABLE "hs_study_plugin" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "study_id" uuid NOT NULL, - "plugin_id" uuid NOT NULL, - "configuration" jsonb DEFAULT '{}'::jsonb, - "installed_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "installed_by" uuid NOT NULL, - CONSTRAINT "hs_study_plugin_study_id_plugin_id_unique" UNIQUE("study_id","plugin_id") -); ---> statement-breakpoint -CREATE TABLE "hs_system_setting" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "key" varchar(100) NOT NULL, - "value" jsonb NOT NULL, - "description" text, - "updated_by" uuid, - "updated_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - CONSTRAINT "hs_system_setting_key_unique" UNIQUE("key") -); ---> statement-breakpoint -CREATE TABLE "hs_trial_event" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "trial_id" uuid NOT NULL, - "event_type" varchar(50) NOT NULL, - "action_id" uuid, - "timestamp" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "data" jsonb DEFAULT '{}'::jsonb, - "created_by" uuid -); ---> statement-breakpoint -CREATE TABLE "hs_trial" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "experiment_id" uuid NOT NULL, - "participant_id" uuid, - "wizard_id" uuid, - "session_number" integer DEFAULT 1 NOT NULL, - "status" "trial_status" DEFAULT 'scheduled' NOT NULL, - "scheduled_at" timestamp with time zone, - "started_at" timestamp with time zone, - "completed_at" timestamp with time zone, - "duration" integer, - "notes" text, - "parameters" jsonb DEFAULT '{}'::jsonb, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "updated_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "metadata" jsonb DEFAULT '{}'::jsonb -); ---> statement-breakpoint -CREATE TABLE "hs_user_system_role" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "user_id" uuid NOT NULL, - "role" "system_role" NOT NULL, - "granted_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "granted_by" uuid, - CONSTRAINT "hs_user_system_role_user_id_role_unique" UNIQUE("user_id","role") -); ---> statement-breakpoint -CREATE TABLE "hs_user" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "email" varchar(255) NOT NULL, - "email_verified" timestamp with time zone, - "name" varchar(255), - "image" text, - "password" varchar(255), - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "updated_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "deleted_at" timestamp with time zone, - CONSTRAINT "hs_user_email_unique" UNIQUE("email") -); ---> statement-breakpoint -CREATE TABLE "hs_verification_token" ( - "identifier" varchar(255) NOT NULL, - "token" varchar(255) NOT NULL, - "expires" timestamp with time zone NOT NULL, - "created_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - CONSTRAINT "hs_verification_token_identifier_token_pk" PRIMARY KEY("identifier","token"), - CONSTRAINT "hs_verification_token_token_unique" UNIQUE("token") -); ---> statement-breakpoint -CREATE TABLE "hs_wizard_intervention" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "trial_id" uuid NOT NULL, - "wizard_id" uuid NOT NULL, - "intervention_type" varchar(100) NOT NULL, - "description" text, - "timestamp" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - "parameters" jsonb DEFAULT '{}'::jsonb, - "reason" text -); ---> statement-breakpoint -ALTER TABLE "hs_account" ADD CONSTRAINT "hs_account_user_id_hs_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."hs_user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_action" ADD CONSTRAINT "hs_action_step_id_hs_step_id_fk" FOREIGN KEY ("step_id") REFERENCES "public"."hs_step"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_activity_log" ADD CONSTRAINT "hs_activity_log_study_id_hs_study_id_fk" FOREIGN KEY ("study_id") REFERENCES "public"."hs_study"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_activity_log" ADD CONSTRAINT "hs_activity_log_user_id_hs_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."hs_user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_annotation" ADD CONSTRAINT "hs_annotation_trial_id_hs_trial_id_fk" FOREIGN KEY ("trial_id") REFERENCES "public"."hs_trial"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_annotation" ADD CONSTRAINT "hs_annotation_annotator_id_hs_user_id_fk" FOREIGN KEY ("annotator_id") REFERENCES "public"."hs_user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_attachment" ADD CONSTRAINT "hs_attachment_uploaded_by_hs_user_id_fk" FOREIGN KEY ("uploaded_by") REFERENCES "public"."hs_user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_audit_log" ADD CONSTRAINT "hs_audit_log_user_id_hs_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."hs_user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_block_registry" ADD CONSTRAINT "hs_block_registry_plugin_id_hs_robot_plugin_id_fk" FOREIGN KEY ("plugin_id") REFERENCES "public"."hs_robot_plugin"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_comment" ADD CONSTRAINT "hs_comment_author_id_hs_user_id_fk" FOREIGN KEY ("author_id") REFERENCES "public"."hs_user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_consent_form" ADD CONSTRAINT "hs_consent_form_study_id_hs_study_id_fk" FOREIGN KEY ("study_id") REFERENCES "public"."hs_study"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_consent_form" ADD CONSTRAINT "hs_consent_form_created_by_hs_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."hs_user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_experiment" ADD CONSTRAINT "hs_experiment_study_id_hs_study_id_fk" FOREIGN KEY ("study_id") REFERENCES "public"."hs_study"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_experiment" ADD CONSTRAINT "hs_experiment_robot_id_hs_robot_id_fk" FOREIGN KEY ("robot_id") REFERENCES "public"."hs_robot"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_experiment" ADD CONSTRAINT "hs_experiment_created_by_hs_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."hs_user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_export_job" ADD CONSTRAINT "hs_export_job_study_id_hs_study_id_fk" FOREIGN KEY ("study_id") REFERENCES "public"."hs_study"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_export_job" ADD CONSTRAINT "hs_export_job_requested_by_hs_user_id_fk" FOREIGN KEY ("requested_by") REFERENCES "public"."hs_user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_media_capture" ADD CONSTRAINT "hs_media_capture_trial_id_hs_trial_id_fk" FOREIGN KEY ("trial_id") REFERENCES "public"."hs_trial"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_participant_consent" ADD CONSTRAINT "hs_participant_consent_participant_id_hs_participant_id_fk" FOREIGN KEY ("participant_id") REFERENCES "public"."hs_participant"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_participant_consent" ADD CONSTRAINT "hs_participant_consent_consent_form_id_hs_consent_form_id_fk" FOREIGN KEY ("consent_form_id") REFERENCES "public"."hs_consent_form"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_participant_document" ADD CONSTRAINT "hs_participant_document_participant_id_hs_participant_id_fk" FOREIGN KEY ("participant_id") REFERENCES "public"."hs_participant"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_participant_document" ADD CONSTRAINT "hs_participant_document_uploaded_by_hs_user_id_fk" FOREIGN KEY ("uploaded_by") REFERENCES "public"."hs_user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_participant" ADD CONSTRAINT "hs_participant_study_id_hs_study_id_fk" FOREIGN KEY ("study_id") REFERENCES "public"."hs_study"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_plugin_repository" ADD CONSTRAINT "hs_plugin_repository_created_by_hs_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."hs_user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_plugin" ADD CONSTRAINT "hs_plugin_robot_id_hs_robot_id_fk" FOREIGN KEY ("robot_id") REFERENCES "public"."hs_robot"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_robot_plugin" ADD CONSTRAINT "hs_robot_plugin_robot_id_hs_robot_id_fk" FOREIGN KEY ("robot_id") REFERENCES "public"."hs_robot"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_role_permission" ADD CONSTRAINT "hs_role_permission_permission_id_hs_permission_id_fk" FOREIGN KEY ("permission_id") REFERENCES "public"."hs_permission"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_sensor_data" ADD CONSTRAINT "hs_sensor_data_trial_id_hs_trial_id_fk" FOREIGN KEY ("trial_id") REFERENCES "public"."hs_trial"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_session" ADD CONSTRAINT "hs_session_user_id_hs_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."hs_user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_shared_resource" ADD CONSTRAINT "hs_shared_resource_study_id_hs_study_id_fk" FOREIGN KEY ("study_id") REFERENCES "public"."hs_study"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_shared_resource" ADD CONSTRAINT "hs_shared_resource_shared_by_hs_user_id_fk" FOREIGN KEY ("shared_by") REFERENCES "public"."hs_user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_step" ADD CONSTRAINT "hs_step_experiment_id_hs_experiment_id_fk" FOREIGN KEY ("experiment_id") REFERENCES "public"."hs_experiment"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_study" ADD CONSTRAINT "hs_study_created_by_hs_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."hs_user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_study_member" ADD CONSTRAINT "hs_study_member_study_id_hs_study_id_fk" FOREIGN KEY ("study_id") REFERENCES "public"."hs_study"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_study_member" ADD CONSTRAINT "hs_study_member_user_id_hs_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."hs_user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_study_member" ADD CONSTRAINT "hs_study_member_invited_by_hs_user_id_fk" FOREIGN KEY ("invited_by") REFERENCES "public"."hs_user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_study_plugin" ADD CONSTRAINT "hs_study_plugin_study_id_hs_study_id_fk" FOREIGN KEY ("study_id") REFERENCES "public"."hs_study"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_study_plugin" ADD CONSTRAINT "hs_study_plugin_plugin_id_hs_plugin_id_fk" FOREIGN KEY ("plugin_id") REFERENCES "public"."hs_plugin"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_study_plugin" ADD CONSTRAINT "hs_study_plugin_installed_by_hs_user_id_fk" FOREIGN KEY ("installed_by") REFERENCES "public"."hs_user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_system_setting" ADD CONSTRAINT "hs_system_setting_updated_by_hs_user_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."hs_user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_trial_event" ADD CONSTRAINT "hs_trial_event_trial_id_hs_trial_id_fk" FOREIGN KEY ("trial_id") REFERENCES "public"."hs_trial"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_trial_event" ADD CONSTRAINT "hs_trial_event_action_id_hs_action_id_fk" FOREIGN KEY ("action_id") REFERENCES "public"."hs_action"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_trial_event" ADD CONSTRAINT "hs_trial_event_created_by_hs_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."hs_user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_trial" ADD CONSTRAINT "hs_trial_experiment_id_hs_experiment_id_fk" FOREIGN KEY ("experiment_id") REFERENCES "public"."hs_experiment"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_trial" ADD CONSTRAINT "hs_trial_participant_id_hs_participant_id_fk" FOREIGN KEY ("participant_id") REFERENCES "public"."hs_participant"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_trial" ADD CONSTRAINT "hs_trial_wizard_id_hs_user_id_fk" FOREIGN KEY ("wizard_id") REFERENCES "public"."hs_user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_user_system_role" ADD CONSTRAINT "hs_user_system_role_user_id_hs_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."hs_user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_user_system_role" ADD CONSTRAINT "hs_user_system_role_granted_by_hs_user_id_fk" FOREIGN KEY ("granted_by") REFERENCES "public"."hs_user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_wizard_intervention" ADD CONSTRAINT "hs_wizard_intervention_trial_id_hs_trial_id_fk" FOREIGN KEY ("trial_id") REFERENCES "public"."hs_trial"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "hs_wizard_intervention" ADD CONSTRAINT "hs_wizard_intervention_wizard_id_hs_user_id_fk" FOREIGN KEY ("wizard_id") REFERENCES "public"."hs_user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -CREATE INDEX "account_user_id_idx" ON "hs_account" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX "activity_logs_study_created_idx" ON "hs_activity_log" USING btree ("study_id","created_at");--> statement-breakpoint -CREATE INDEX "audit_logs_created_idx" ON "hs_audit_log" USING btree ("created_at");--> statement-breakpoint -CREATE INDEX "block_registry_category_idx" ON "hs_block_registry" USING btree ("category");--> statement-breakpoint -CREATE INDEX "experiment_visual_design_idx" ON "hs_experiment" USING gin ("visual_design");--> statement-breakpoint -CREATE INDEX "participant_document_participant_idx" ON "hs_participant_document" USING btree ("participant_id");--> statement-breakpoint -CREATE INDEX "sensor_data_trial_timestamp_idx" ON "hs_sensor_data" USING btree ("trial_id","timestamp");--> statement-breakpoint -CREATE INDEX "session_user_id_idx" ON "hs_session" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX "trial_events_trial_timestamp_idx" ON "hs_trial_event" USING btree ("trial_id","timestamp"); \ No newline at end of file diff --git a/middleware.ts b/middleware.ts index 714a011..58664d0 100755 --- a/middleware.ts +++ b/middleware.ts @@ -1,55 +1,27 @@ -import type { Session } from "next-auth"; import type { NextRequest } from "next/server"; import { NextResponse } from "next/server"; -import { auth } from "./src/server/auth"; -export default auth((req: NextRequest & { auth: Session | null }) => { - const { nextUrl } = req; - const isLoggedIn = !!req.auth; +export default async function middleware(request: NextRequest) { + const { nextUrl } = request; - // Define route patterns - const isApiAuthRoute = nextUrl.pathname.startsWith("/api/auth"); - const isPublicRoute = ["/", "/auth/signin", "/auth/signup"].includes( - nextUrl.pathname, - ); + // Skip session checks for now to debug the auth issue + const isApiRoute = nextUrl.pathname.startsWith("/api"); const isAuthRoute = nextUrl.pathname.startsWith("/auth"); - // Allow API auth routes to pass through - if (isApiAuthRoute) { + if (isApiRoute) { return NextResponse.next(); } - // If user is on auth pages and already logged in, redirect to dashboard - if (isAuthRoute && isLoggedIn) { - return NextResponse.redirect(new URL("/", nextUrl)); - } - - // If user is not logged in and trying to access protected routes - if (!isLoggedIn && !isPublicRoute && !isAuthRoute) { - let callbackUrl = nextUrl.pathname; - if (nextUrl.search) { - callbackUrl += nextUrl.search; - } - - const encodedCallbackUrl = encodeURIComponent(callbackUrl); - return NextResponse.redirect( - new URL(`/auth/signin?callbackUrl=${encodedCallbackUrl}`, nextUrl), - ); + // Allow auth routes through for now + if (isAuthRoute) { + return NextResponse.next(); } return NextResponse.next(); -}); +} -// Configure which routes the middleware should run on export const config = { matcher: [ - /* - * Match all request paths except for the ones starting with: - * - _next/static (static files) - * - _next/image (image optimization files) - * - favicon.ico (favicon file) - * - public files (images, etc.) - */ "/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)", ], }; diff --git a/package.json b/package.json index eb6c6bb..c9e2058 100755 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "@auth/drizzle-adapter": "^1.11.1", "@aws-sdk/client-s3": "^3.989.0", "@aws-sdk/s3-request-presigner": "^3.989.0", + "@better-auth/drizzle-adapter": "^1.5.5", "@dnd-kit/core": "^6.3.1", "@dnd-kit/sortable": "^10.0.0", "@dnd-kit/utilities": "^3.2.2", @@ -67,6 +68,7 @@ "@types/js-cookie": "^3.0.6", "@types/ws": "^8.18.1", "bcryptjs": "^3.0.3", + "better-auth": "^1.5.5", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "cmdk": "^1.1.1", diff --git a/robot-plugins b/robot-plugins index d772aec..ff48567 160000 --- a/robot-plugins +++ b/robot-plugins @@ -1 +1 @@ -Subproject commit d772aecc54306b211cd97ff6f720936d38a6b8a9 +Subproject commit ff485679181377f208c59a754095784b2ee9ac31 diff --git a/scripts/seed-dev.ts b/scripts/seed-dev.ts index 2e00b4c..c925b24 100755 --- a/scripts/seed-dev.ts +++ b/scripts/seed-dev.ts @@ -76,6 +76,9 @@ async function main() { // 1. Clean existing data (Full Wipe) console.log("🧹 Cleaning existing data..."); + await db.delete(schema.sessions).where(sql`1=1`); + await db.delete(schema.accounts).where(sql`1=1`); + await db.delete(schema.verificationTokens).where(sql`1=1`); await db.delete(schema.mediaCaptures).where(sql`1=1`); await db.delete(schema.trialEvents).where(sql`1=1`); await db.delete(schema.trials).where(sql`1=1`); @@ -93,20 +96,24 @@ async function main() { await db.delete(schema.users).where(sql`1=1`); await db.delete(schema.robots).where(sql`1=1`); - // 2. Create Users + // 2. Create Users (Better Auth manages credentials) console.log("👥 Creating users..."); const hashedPassword = await bcrypt.hash("password123", 12); const gravatarUrl = (email: string) => `https://www.gravatar.com/avatar/${createHash("md5").update(email.toLowerCase().trim()).digest("hex")}?d=identicon`; + // Generate text IDs (Better Auth uses text-based IDs) + const adminId = `admin_${randomUUID()}`; + const researcherId = `researcher_${randomUUID()}`; + const [adminUser] = await db .insert(schema.users) .values({ + id: adminId, name: "Sean O'Connor", email: "sean@soconnor.dev", - password: hashedPassword, - emailVerified: new Date(), + emailVerified: true, image: gravatarUrl("sean@soconnor.dev"), }) .returning(); @@ -114,16 +121,39 @@ async function main() { const [researcherUser] = await db .insert(schema.users) .values({ + id: researcherId, name: "Dr. Felipe Perrone", email: "felipe.perrone@bucknell.edu", - password: hashedPassword, - emailVerified: new Date(), + emailVerified: true, image: "https://api.dicebear.com/7.x/avataaars/svg?seed=Felipe", }) .returning(); if (!adminUser) throw new Error("Failed to create admin user"); + // Create credential accounts for Better Auth (accountId = userId for credential provider) + await db.insert(schema.accounts).values({ + id: `acc_${randomUUID()}`, + userId: adminUser.id, + providerId: "credential", + accountId: adminUser.id, + password: hashedPassword, + }); + + if (researcherUser) { + await db.insert(schema.accounts).values({ + id: `acc_${randomUUID()}`, + userId: researcherUser.id, + providerId: "credential", + accountId: researcherUser.id, + password: hashedPassword, + }); + + await db + .insert(schema.userSystemRoles) + .values({ userId: researcherUser.id, role: "researcher" }); + } + await db .insert(schema.userSystemRoles) .values({ userId: adminUser.id, role: "administrator" }); diff --git a/src/app/(dashboard)/layout.tsx b/src/app/(dashboard)/layout.tsx index 830f52a..62c5e17 100755 --- a/src/app/(dashboard)/layout.tsx +++ b/src/app/(dashboard)/layout.tsx @@ -1,5 +1,5 @@ import { redirect } from "next/navigation"; -import { cookies } from "next/headers"; +import { cookies, headers } from "next/headers"; import { SidebarInset, SidebarProvider, @@ -7,7 +7,7 @@ import { } from "~/components/ui/sidebar"; import { Separator } from "~/components/ui/separator"; import { AppSidebar } from "~/components/dashboard/app-sidebar"; -import { auth } from "~/server/auth"; +import { auth } from "~/lib/auth"; import { BreadcrumbProvider, BreadcrumbDisplay, @@ -22,16 +22,15 @@ interface DashboardLayoutProps { export default async function DashboardLayout({ children, }: DashboardLayoutProps) { - const session = await auth(); + const session = await auth.api.getSession({ + headers: await headers(), + }); if (!session?.user) { redirect("/auth/signin"); } - const userRole = - typeof session.user.roles?.[0] === "string" - ? session.user.roles[0] - : (session.user.roles?.[0]?.role ?? "observer"); + const userRole = "researcher"; // Default role for dashboard access const cookieStore = await cookies(); const defaultOpen = cookieStore.get("sidebar_state")?.value === "true"; diff --git a/src/app/(dashboard)/profile/page.tsx b/src/app/(dashboard)/profile/page.tsx index 36a2e76..1edfd7b 100755 --- a/src/app/(dashboard)/profile/page.tsx +++ b/src/app/(dashboard)/profile/page.tsx @@ -16,19 +16,10 @@ import { Separator } from "~/components/ui/separator"; import { PageHeader } from "~/components/ui/page-header"; import { useBreadcrumbsEffect } from "~/components/ui/breadcrumb-provider"; import { formatRole, getRoleDescription } from "~/lib/auth-client"; -import { - User, - Shield, - Download, - Trash2, - ExternalLink, - Lock, - UserCog, - Mail, - Fingerprint, -} from "lucide-react"; -import { useSession } from "next-auth/react"; +import { User, Shield, Download, Trash2, Lock, UserCog } from "lucide-react"; +import { useSession } from "~/lib/auth-client"; import { cn } from "~/lib/utils"; +import { api } from "~/trpc/react"; interface ProfileUser { id: string; @@ -37,7 +28,8 @@ interface ProfileUser { image: string | null; roles?: Array<{ role: "administrator" | "researcher" | "wizard" | "observer"; - grantedAt: string | Date; + grantedAt: Date; + grantedBy: string | null; }>; } @@ -213,14 +205,20 @@ function ProfileContent({ user }: { user: ProfileUser }) { } export default function ProfilePage() { - const { data: session, status } = useSession(); + const { data: session, isPending } = useSession(); + const { data: userData, isPending: isUserPending } = api.auth.me.useQuery( + undefined, + { + enabled: !!session?.user, + }, + ); useBreadcrumbsEffect([ { label: "Dashboard", href: "/dashboard" }, { label: "Profile" }, ]); - if (status === "loading") { + if (isPending || isUserPending) { return (
Currently signed in as:{" "} - {session.user.name ?? session.user.email} + {session.user?.name ?? session.user?.email}
- © 2024 HRIStudio. A platform for Human-Robot Interaction research. + © {new Date().getFullYear()} HRIStudio. A platform for Human-Robot + Interaction research.
Current User:
{session.user.name ?? session.user.email}
- {session.user.roles && session.user.roles.length > 0 ? ( -- Roles: {session.user.roles.map((r) => r.role).join(", ")} -
- ) : ( -No roles assigned
- )}