diff --git a/.prettierrc b/.prettierrc index c2e595e..7bfb669 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,6 +1,7 @@ { - "tabWidth": 2, - "semi": false, - "singleQuote": false, - "insertFinalNewline": true -} \ No newline at end of file + "tabWidth": 2, + "semi": false, + "singleQuote": false, + "insertFinalNewline": true, + "useTabs": false +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..c83e263 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["esbenp.prettier-vscode"] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 8771d74..3fed363 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,5 +8,6 @@ "tailwindCSS.experimental.classRegex": [ ["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"], ["cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"] - ] + ], + "editor.defaultFormatter": "esbenp.prettier-vscode" } diff --git a/README.md b/README.md index 33085f6..d7b1fa1 100644 --- a/README.md +++ b/README.md @@ -198,11 +198,13 @@ DOKKU_KEY= Anyone can contribute a custom template for integration in Sandbox. Since Sandbox is built on E2B, there is no limitation to what langauge or runtime a Sandbox can use. -Currently there are four templates: +Currently there are five templates: + - [jamesmurdza/dokku-reactjs-template](https://github.com/jamesmurdza/dokku-reactjs-template) - [jamesmurdza/dokku-vanillajs-template](https://github.com/jamesmurdza/dokku-vanillajs-template) - [jamesmurdza/dokku-nextjs-template](https://github.com/jamesmurdza/dokku-nextjs-template) - [jamesmurdza/dokku-streamlit-template](https://github.com/jamesmurdza/dokku-streamlit-template) +- [omarrwd/dokku-php-template](https://github.com/omarrwd/dokku-php-template) To create your own template, you can fork one of the above templates or start with a new blank repository. The template should have at least an `e2b.Dockerfile`, which is used by E2B to create the development environment. Optionally, a `Dockerfile` can be added which will be used to create the project build when it is deployed. @@ -236,6 +238,7 @@ If you've done this and it works, let us know and we'll add your template to San Note: In the future, we will add a way to specify the command triggered by the "Run" button (e.g. "npm run dev"). For more information, see: + - [Custom E2B Sandboxes](https://e2b.dev/docs/sandbox-template) - [Dokku Builders](https://dokku.com/docs/deployment/builders/builder-management/) @@ -260,13 +263,13 @@ backend/ └── ai ``` -| Path | Description | -| ------------------ | ------------------------------------------------------------ | -| `frontend` | The Next.js application for the frontend. | -| `backend/server` | The Express websocket server. | -| `backend/database` | API for interfacing with the D1 database (SQLite). | +| Path | Description | +| ------------------ | -------------------------------------------------------------------------- | +| `frontend` | The Next.js application for the frontend. | +| `backend/server` | The Express websocket server. | +| `backend/database` | API for interfacing with the D1 database (SQLite). | | `backend/storage` | API for interfacing with R2 storage. Service-bound to `/backend/database`. | -| `backend/ai` | API for making requests to Workers AI . | +| `backend/ai` | API for making requests to Workers AI . | ### Development @@ -287,6 +290,10 @@ cd sandbox git checkout -b my-new-branch ``` +### Code formatting + +This repository uses [Prettier](https://marketplace.cursorapi.com/items?itemName=esbenp.prettier-vscode) for code formatting, which you will be prompted to install when you open the project. The formatting rules are specified in [.prettierrc](.prettierrc). + ### Commit convention Before you create a Pull Request, please check that you use the [Conventional Commits format](https://www.conventionalcommits.org/en/v1.0.0/) diff --git a/backend/ai/.editorconfig b/backend/ai/.editorconfig deleted file mode 100644 index a727df3..0000000 --- a/backend/ai/.editorconfig +++ /dev/null @@ -1,12 +0,0 @@ -# http://editorconfig.org -root = true - -[*] -indent_style = tab -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.yml] -indent_style = space diff --git a/backend/ai/.gitignore b/backend/ai/.gitignore deleted file mode 100644 index 3b0fe33..0000000 --- a/backend/ai/.gitignore +++ /dev/null @@ -1,172 +0,0 @@ -# Logs - -logs -_.log -npm-debug.log_ -yarn-debug.log* -yarn-error.log* -lerna-debug.log* -.pnpm-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) - -report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json - -# Runtime data - -pids -_.pid -_.seed -\*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover - -lib-cov - -# Coverage directory used by tools like istanbul - -coverage -\*.lcov - -# nyc test coverage - -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) - -.grunt - -# Bower dependency directory (https://bower.io/) - -bower_components - -# node-waf configuration - -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) - -build/Release - -# Dependency directories - -node_modules/ -jspm_packages/ - -# Snowpack dependency directory (https://snowpack.dev/) - -web_modules/ - -# TypeScript cache - -\*.tsbuildinfo - -# Optional npm cache directory - -.npm - -# Optional eslint cache - -.eslintcache - -# Optional stylelint cache - -.stylelintcache - -# Microbundle cache - -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history - -.node_repl_history - -# Output of 'npm pack' - -\*.tgz - -# Yarn Integrity file - -.yarn-integrity - -# dotenv environment variable files - -.env -.env.development.local -.env.test.local -.env.production.local -.env.local - -# parcel-bundler cache (https://parceljs.org/) - -.cache -.parcel-cache - -# Next.js build output - -.next -out - -# Nuxt.js build / generate output - -.nuxt -dist - -# Gatsby files - -.cache/ - -# Comment in the public line in if your project uses Gatsby and not Next.js - -# https://nextjs.org/blog/next-9-1#public-directory-support - -# public - -# vuepress build output - -.vuepress/dist - -# vuepress v2.x temp and cache directory - -.temp -.cache - -# Docusaurus cache and generated files - -.docusaurus - -# Serverless directories - -.serverless/ - -# FuseBox cache - -.fusebox/ - -# DynamoDB Local files - -.dynamodb/ - -# TernJS port file - -.tern-port - -# Stores VSCode versions used for testing VSCode extensions - -.vscode-test - -# yarn v2 - -.yarn/cache -.yarn/unplugged -.yarn/build-state.yml -.yarn/install-state.gz -.pnp.\* - -# wrangler project - -.dev.vars -.wrangler/ diff --git a/backend/ai/package-lock.json b/backend/ai/package-lock.json deleted file mode 100644 index 7a8583a..0000000 --- a/backend/ai/package-lock.json +++ /dev/null @@ -1,3319 +0,0 @@ -{ - "name": "ai", - "version": "0.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "ai", - "version": "0.0.0", - "dependencies": { - "@anthropic-ai/sdk": "^0.27.2" - }, - "devDependencies": { - "@cloudflare/vitest-pool-workers": "^0.1.0", - "@cloudflare/workers-types": "^4.20240512.0", - "typescript": "^5.0.4", - "vitest": "1.3.0", - "wrangler": "^3.0.0" - } - }, - "node_modules/@anthropic-ai/sdk": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-0.27.2.tgz", - "integrity": "sha512-Q6gOx4fyHQ+NCSaVeXEKFZfoFWCR3ctUA+sK5oGB7RKUkzUvK64aYM7v1T9ekJKwn8TwRq6IGjqS31n9PbjCIA==", - "dependencies": { - "@types/node": "^18.11.18", - "@types/node-fetch": "^2.6.4", - "abort-controller": "^3.0.0", - "agentkeepalive": "^4.2.1", - "form-data-encoder": "1.7.2", - "formdata-node": "^4.3.2", - "node-fetch": "^2.6.7" - } - }, - "node_modules/@anthropic-ai/sdk/node_modules/@types/node": { - "version": "18.19.50", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.50.tgz", - "integrity": "sha512-xonK+NRrMBRtkL1hVCc3G+uXtjh1Al4opBLjqVmipe5ZAaBYWW6cNAiBVZ1BvmkBhep698rP3UM3aRAdSALuhg==", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/@cloudflare/kv-asset-handler": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.3.2.tgz", - "integrity": "sha512-EeEjMobfuJrwoctj7FA1y1KEbM0+Q1xSjobIEyie9k4haVEBB7vkDvsasw1pM3rO39mL2akxIAzLMUAtrMHZhA==", - "dev": true, - "dependencies": { - "mime": "^3.0.0" - }, - "engines": { - "node": ">=16.13" - } - }, - "node_modules/@cloudflare/vitest-pool-workers": { - "version": "0.1.19", - "resolved": "https://registry.npmjs.org/@cloudflare/vitest-pool-workers/-/vitest-pool-workers-0.1.19.tgz", - "integrity": "sha512-fb3rxrihwd4OsBf4mALlezo6nnuL5p/BopGu47MeV5LlTjP3sGFT1QYbXsdv6rfNsxBGSP7uAahCWBhTsNFy0w==", - "dev": true, - "dependencies": { - "birpc": "0.2.14", - "cjs-module-lexer": "^1.2.3", - "devalue": "^4.3.0", - "esbuild": "0.17.19", - "miniflare": "3.20240405.1", - "wrangler": "3.50.0", - "zod": "^3.20.6" - }, - "peerDependencies": { - "@vitest/runner": "1.3.0", - "@vitest/snapshot": "1.3.0", - "vitest": "1.3.0" - } - }, - "node_modules/@cloudflare/vitest-pool-workers/node_modules/@cloudflare/kv-asset-handler": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.3.1.tgz", - "integrity": "sha512-lKN2XCfKCmpKb86a1tl4GIwsJYDy9TGuwjhDELLmpKygQhw8X2xR4dusgpC5Tg7q1pB96Eb0rBo81kxSILQMwA==", - "dev": true, - "dependencies": { - "mime": "^3.0.0" - } - }, - "node_modules/@cloudflare/vitest-pool-workers/node_modules/wrangler": { - "version": "3.50.0", - "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.50.0.tgz", - "integrity": "sha512-JlLuch+6DtaC5HGp8YD9Au++XvMv34g3ySdlB5SyPbaObELi8P9ZID5vgyf9AA75djzxL7cuNOk1YdKCJEuq0w==", - "dev": true, - "dependencies": { - "@cloudflare/kv-asset-handler": "0.3.1", - "@esbuild-plugins/node-globals-polyfill": "^0.2.3", - "@esbuild-plugins/node-modules-polyfill": "^0.2.2", - "blake3-wasm": "^2.1.5", - "chokidar": "^3.5.3", - "esbuild": "0.17.19", - "miniflare": "3.20240405.1", - "nanoid": "^3.3.3", - "path-to-regexp": "^6.2.0", - "resolve": "^1.22.8", - "resolve.exports": "^2.0.2", - "selfsigned": "^2.0.1", - "source-map": "0.6.1", - "ts-json-schema-generator": "^1.5.0", - "xxhash-wasm": "^1.0.1" - }, - "bin": { - "wrangler": "bin/wrangler.js", - "wrangler2": "bin/wrangler.js" - }, - "engines": { - "node": ">=16.17.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - }, - "peerDependencies": { - "@cloudflare/workers-types": "^4.20240405.0" - }, - "peerDependenciesMeta": { - "@cloudflare/workers-types": { - "optional": true - } - } - }, - "node_modules/@cloudflare/workerd-darwin-64": { - "version": "1.20240405.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20240405.0.tgz", - "integrity": "sha512-ut8kwpHmlz9dNSjoov6v1b6jS50J46Mj9QcMA0t1Hne36InaQk/qqPSd12fN5p2GesZ9OOBJvBdDsTblVdyJ1w==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=16" - } - }, - "node_modules/@cloudflare/workerd-darwin-arm64": { - "version": "1.20240405.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20240405.0.tgz", - "integrity": "sha512-x3A3Ym+J2DH1uYnw0aedeKOTnUebEo312+Aladv7bFri97pjRJcqVbYhMtOHLkHjwYn7bpKSY2eL5iM+0XT29A==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=16" - } - }, - "node_modules/@cloudflare/workerd-linux-64": { - "version": "1.20240405.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20240405.0.tgz", - "integrity": "sha512-3tYpfjtxEQ0R30Pna7OF3Bz0CTx30hc0QNtH61KnkvXtaeYMkWutSKQKXIuVlPa/7v1MHp+8ViBXMflmS7HquA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=16" - } - }, - "node_modules/@cloudflare/workerd-linux-arm64": { - "version": "1.20240405.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20240405.0.tgz", - "integrity": "sha512-NpKZlvmdgcX/m4tP5zM91AfJpZrue2/GRA+Sl3szxAivu2uE5jDVf5SS9dzqzCVfPrdhylqH7yeL4U/cafFNOg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=16" - } - }, - "node_modules/@cloudflare/workerd-windows-64": { - "version": "1.20240405.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20240405.0.tgz", - "integrity": "sha512-REBeJMxvUCjwuEVzSSIBtzAyM69QjToab8qBst0S9vdih+9DObym4dw8CevdBQhDbFrHiyL9E6pAZpLPNHVgCw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=16" - } - }, - "node_modules/@cloudflare/workers-types": { - "version": "4.20240512.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20240512.0.tgz", - "integrity": "sha512-o2yTEWg+YK/I1t/Me+dA0oarO0aCbjibp6wSeaw52DSE9tDyKJ7S+Qdyw/XsMrKn4t8kF6f/YOba+9O4MJfW9w==", - "dev": true - }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dev": true, - "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-plugins/node-globals-polyfill": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-globals-polyfill/-/node-globals-polyfill-0.2.3.tgz", - "integrity": "sha512-r3MIryXDeXDOZh7ih1l/yE9ZLORCd5e8vWg02azWRGj5SPTuoh69A2AIyn0Z31V/kHBfZ4HgWJ+OK3GTTwLmnw==", - "dev": true, - "peerDependencies": { - "esbuild": "*" - } - }, - "node_modules/@esbuild-plugins/node-modules-polyfill": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-modules-polyfill/-/node-modules-polyfill-0.2.2.tgz", - "integrity": "sha512-LXV7QsWJxRuMYvKbiznh+U1ilIop3g2TeKRzUxOG5X3YITc8JyyTa90BmLwqqv0YnX4v32CSlG+vsziZp9dMvA==", - "dev": true, - "dependencies": { - "escape-string-regexp": "^4.0.0", - "rollup-plugin-node-polyfills": "^0.2.1" - }, - "peerDependencies": { - "esbuild": "*" - } - }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz", - "integrity": "sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.19.tgz", - "integrity": "sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz", - "integrity": "sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.19.tgz", - "integrity": "sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz", - "integrity": "sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz", - "integrity": "sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz", - "integrity": "sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz", - "integrity": "sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz", - "integrity": "sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz", - "integrity": "sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz", - "integrity": "sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz", - "integrity": "sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==", - "cpu": [ - "loong64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz", - "integrity": "sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==", - "cpu": [ - "mips64el" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz", - "integrity": "sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz", - "integrity": "sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==", - "cpu": [ - "riscv64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz", - "integrity": "sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz", - "integrity": "sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz", - "integrity": "sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz", - "integrity": "sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz", - "integrity": "sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz", - "integrity": "sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz", - "integrity": "sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz", - "integrity": "sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@fastify/busboy": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", - "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", - "dev": true, - "engines": { - "node": ">=14" - } - }, - "node_modules/@jest/schemas": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", - "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", - "dev": true, - "dependencies": { - "@sinclair/typebox": "^0.27.8" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, - "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.17.2.tgz", - "integrity": "sha512-NM0jFxY8bB8QLkoKxIQeObCaDlJKewVlIEkuyYKm5An1tdVZ966w2+MPQ2l8LBZLjR+SgyV+nRkTIunzOYBMLQ==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.17.2.tgz", - "integrity": "sha512-yeX/Usk7daNIVwkq2uGoq2BYJKZY1JfyLTaHO/jaiSwi/lsf8fTFoQW/n6IdAsx5tx+iotu2zCJwz8MxI6D/Bw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.17.2.tgz", - "integrity": "sha512-kcMLpE6uCwls023+kknm71ug7MZOrtXo+y5p/tsg6jltpDtgQY1Eq5sGfHcQfb+lfuKwhBmEURDga9N0ol4YPw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.17.2.tgz", - "integrity": "sha512-AtKwD0VEx0zWkL0ZjixEkp5tbNLzX+FCqGG1SvOu993HnSz4qDI6S4kGzubrEJAljpVkhRSlg5bzpV//E6ysTQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.17.2.tgz", - "integrity": "sha512-3reX2fUHqN7sffBNqmEyMQVj/CKhIHZd4y631duy0hZqI8Qoqf6lTtmAKvJFYa6bhU95B1D0WgzHkmTg33In0A==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.17.2.tgz", - "integrity": "sha512-uSqpsp91mheRgw96xtyAGP9FW5ChctTFEoXP0r5FAzj/3ZRv3Uxjtc7taRQSaQM/q85KEKjKsZuiZM3GyUivRg==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.17.2.tgz", - "integrity": "sha512-EMMPHkiCRtE8Wdk3Qhtciq6BndLtstqZIroHiiGzB3C5LDJmIZcSzVtLRbwuXuUft1Cnv+9fxuDtDxz3k3EW2A==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.17.2.tgz", - "integrity": "sha512-NMPylUUZ1i0z/xJUIx6VUhISZDRT+uTWpBcjdv0/zkp7b/bQDF+NfnfdzuTiB1G6HTodgoFa93hp0O1xl+/UbA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.17.2.tgz", - "integrity": "sha512-T19My13y8uYXPw/L/k0JYaX1fJKFT/PWdXiHr8mTbXWxjVF1t+8Xl31DgBBvEKclw+1b00Chg0hxE2O7bTG7GQ==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.17.2.tgz", - "integrity": "sha512-BOaNfthf3X3fOWAB+IJ9kxTgPmMqPPH5f5k2DcCsRrBIbWnaJCgX2ll77dV1TdSy9SaXTR5iDXRL8n7AnoP5cg==", - "cpu": [ - "riscv64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.17.2.tgz", - "integrity": "sha512-W0UP/x7bnn3xN2eYMql2T/+wpASLE5SjObXILTMPUBDB/Fg/FxC+gX4nvCfPBCbNhz51C+HcqQp2qQ4u25ok6g==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.17.2.tgz", - "integrity": "sha512-Hy7pLwByUOuyaFC6mAr7m+oMC+V7qyifzs/nW2OJfC8H4hbCzOX07Ov0VFk/zP3kBsELWNFi7rJtgbKYsav9QQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.17.2.tgz", - "integrity": "sha512-h1+yTWeYbRdAyJ/jMiVw0l6fOOm/0D1vNLui9iPuqgRGnXA0u21gAqOyB5iHjlM9MMfNOm9RHCQ7zLIzT0x11Q==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.17.2.tgz", - "integrity": "sha512-tmdtXMfKAjy5+IQsVtDiCfqbynAQE/TQRpWdVataHmhMb9DCoJxp9vLcCBjEQWMiUYxO1QprH/HbY9ragCEFLA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.17.2.tgz", - "integrity": "sha512-7II/QCSTAHuE5vdZaQEwJq2ZACkBpQDOmQsE6D6XUbnBHW8IAhm4eTufL6msLJorzrHDFv3CF8oCA/hSIRuZeQ==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.17.2.tgz", - "integrity": "sha512-TGGO7v7qOq4CYmSBVEYpI1Y5xDuCEnbVC5Vth8mOsW0gDSzxNrVERPc790IGHsrT2dQSimgMr9Ub3Y1Jci5/8w==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@sinclair/typebox": { - "version": "0.27.8", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", - "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", - "dev": true - }, - "node_modules/@types/estree": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", - "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", - "dev": true - }, - "node_modules/@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true - }, - "node_modules/@types/node": { - "version": "20.12.11", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.11.tgz", - "integrity": "sha512-vDg9PZ/zi+Nqp6boSOT7plNuthRugEKixDv5sFTIpkE89MmNtEArAShI4mxuX2+UrLEe9pxC1vm2cjm9YlWbJw==", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/@types/node-fetch": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.11.tgz", - "integrity": "sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==", - "dependencies": { - "@types/node": "*", - "form-data": "^4.0.0" - } - }, - "node_modules/@types/node-forge": { - "version": "1.3.11", - "resolved": "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.11.tgz", - "integrity": "sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@vitest/expect": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.3.0.tgz", - "integrity": "sha512-7bWt0vBTZj08B+Ikv70AnLRicohYwFgzNjFqo9SxxqHHxSlUJGSXmCRORhOnRMisiUryKMdvsi1n27Bc6jL9DQ==", - "dev": true, - "dependencies": { - "@vitest/spy": "1.3.0", - "@vitest/utils": "1.3.0", - "chai": "^4.3.10" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/runner": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.3.0.tgz", - "integrity": "sha512-1Jb15Vo/Oy7mwZ5bXi7zbgszsdIBNjc4IqP8Jpr/8RdBC4nF1CTzIAn2dxYvpF1nGSseeL39lfLQ2uvs5u1Y9A==", - "dev": true, - "dependencies": { - "@vitest/utils": "1.3.0", - "p-limit": "^5.0.0", - "pathe": "^1.1.1" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/snapshot": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.3.0.tgz", - "integrity": "sha512-swmktcviVVPYx9U4SEQXLV6AEY51Y6bZ14jA2yo6TgMxQ3h+ZYiO0YhAHGJNp0ohCFbPAis1R9kK0cvN6lDPQA==", - "dev": true, - "dependencies": { - "magic-string": "^0.30.5", - "pathe": "^1.1.1", - "pretty-format": "^29.7.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/spy": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.3.0.tgz", - "integrity": "sha512-AkCU0ThZunMvblDpPKgjIi025UxR8V7MZ/g/EwmAGpjIujLVV2X6rGYGmxE2D4FJbAy0/ijdROHMWa2M/6JVMw==", - "dev": true, - "dependencies": { - "tinyspy": "^2.2.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/utils": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.3.0.tgz", - "integrity": "sha512-/LibEY/fkaXQufi4GDlQZhikQsPO2entBKtfuyIpr1jV4DpaeasqkeHjhdOhU24vSHshcSuEyVlWdzvv2XmYCw==", - "dev": true, - "dependencies": { - "diff-sequences": "^29.6.3", - "estree-walker": "^3.0.3", - "loupe": "^2.3.7", - "pretty-format": "^29.7.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/abort-controller": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", - "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", - "dependencies": { - "event-target-shim": "^5.0.0" - }, - "engines": { - "node": ">=6.5" - } - }, - "node_modules/acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-walk": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", - "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/agentkeepalive": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", - "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", - "dependencies": { - "humanize-ms": "^1.2.1" - }, - "engines": { - "node": ">= 8.0.0" - } - }, - "node_modules/ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/as-table": { - "version": "1.0.55", - "resolved": "https://registry.npmjs.org/as-table/-/as-table-1.0.55.tgz", - "integrity": "sha512-xvsWESUJn0JN421Xb9MQw6AsMHRCUknCe0Wjlxvjud80mU4E6hQf1A6NzQKcYNmYw62MfzEtXc+badstZP3JpQ==", - "dev": true, - "dependencies": { - "printable-characters": "^1.0.42" - } - }, - "node_modules/assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "node_modules/binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/birpc": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/birpc/-/birpc-0.2.14.tgz", - "integrity": "sha512-37FHE8rqsYM5JEKCnXFyHpBCzvgHEExwVVTq+nUmloInU7l8ezD1TpOhKpS8oe1DTYFqEK27rFZVKG43oTqXRA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/blake3-wasm": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/blake3-wasm/-/blake3-wasm-2.1.5.tgz", - "integrity": "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==", - "dev": true - }, - "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cac": { - "version": "6.7.14", - "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", - "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/capnp-ts": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/capnp-ts/-/capnp-ts-0.7.0.tgz", - "integrity": "sha512-XKxXAC3HVPv7r674zP0VC3RTXz+/JKhfyw94ljvF80yynK6VkTnqE3jMuN8b3dUVmmc43TjyxjW4KTsmB3c86g==", - "dev": true, - "dependencies": { - "debug": "^4.3.1", - "tslib": "^2.2.0" - } - }, - "node_modules/chai": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", - "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", - "dev": true, - "dependencies": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.3", - "deep-eql": "^4.1.3", - "get-func-name": "^2.0.2", - "loupe": "^2.3.6", - "pathval": "^1.1.1", - "type-detect": "^4.0.8" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/check-error": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", - "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", - "dev": true, - "dependencies": { - "get-func-name": "^2.0.2" - }, - "engines": { - "node": "*" - } - }, - "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", - "dev": true, - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/cjs-module-lexer": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.3.1.tgz", - "integrity": "sha512-a3KdPAANPbNE4ZUv9h6LckSl9zLsYOP4MBmhIPkRaeyybt+r4UghLvq+xw/YwUcC1gqylCkL4rdVs3Lwupjm4Q==", - "dev": true - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/commander": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-12.0.0.tgz", - "integrity": "sha512-MwVNWlYjDTtOjX5PiD7o5pK0UrFU/OYgcJfjjK4RaHZETNtjJqrZa9Y9ds88+A+f+d5lv+561eZ+yCKoS3gbAA==", - "dev": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/confbox": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.7.tgz", - "integrity": "sha512-uJcB/FKZtBMCJpK8MQji6bJHgu1tixKPxRLeGkNzBoOZzpnZUJm0jm2/sBDWcuBx1dYgxV4JU+g5hmNxCyAmdA==", - "dev": true - }, - "node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/data-uri-to-buffer": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-2.0.2.tgz", - "integrity": "sha512-ND9qDTLc6diwj+Xe5cdAgVTbLVdXbtxTJRXRhli8Mowuaan+0EJOtdqJ0QCHNSSPyoXGx9HX2/VMnKeC34AChA==", - "dev": true - }, - "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/deep-eql": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", - "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", - "dev": true, - "dependencies": { - "type-detect": "^4.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/devalue": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/devalue/-/devalue-4.3.3.tgz", - "integrity": "sha512-UH8EL6H2ifcY8TbD2QsxwCC/pr5xSwPvv85LrLXVihmHVC3T3YqTCIwnR5ak0yO1KYqlxrPVOA/JVZJYPy2ATg==", - "dev": true - }, - "node_modules/diff-sequences": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", - "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", - "dev": true, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/esbuild": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz", - "integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==", - "dev": true, - "hasInstallScript": true, - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=12" - }, - "optionalDependencies": { - "@esbuild/android-arm": "0.17.19", - "@esbuild/android-arm64": "0.17.19", - "@esbuild/android-x64": "0.17.19", - "@esbuild/darwin-arm64": "0.17.19", - "@esbuild/darwin-x64": "0.17.19", - "@esbuild/freebsd-arm64": "0.17.19", - "@esbuild/freebsd-x64": "0.17.19", - "@esbuild/linux-arm": "0.17.19", - "@esbuild/linux-arm64": "0.17.19", - "@esbuild/linux-ia32": "0.17.19", - "@esbuild/linux-loong64": "0.17.19", - "@esbuild/linux-mips64el": "0.17.19", - "@esbuild/linux-ppc64": "0.17.19", - "@esbuild/linux-riscv64": "0.17.19", - "@esbuild/linux-s390x": "0.17.19", - "@esbuild/linux-x64": "0.17.19", - "@esbuild/netbsd-x64": "0.17.19", - "@esbuild/openbsd-x64": "0.17.19", - "@esbuild/sunos-x64": "0.17.19", - "@esbuild/win32-arm64": "0.17.19", - "@esbuild/win32-ia32": "0.17.19", - "@esbuild/win32-x64": "0.17.19" - } - }, - "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/estree-walker": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", - "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", - "dev": true, - "dependencies": { - "@types/estree": "^1.0.0" - } - }, - "node_modules/event-target-shim": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", - "engines": { - "node": ">=6" - } - }, - "node_modules/execa": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", - "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^8.0.1", - "human-signals": "^5.0.0", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^4.1.0", - "strip-final-newline": "^3.0.0" - }, - "engines": { - "node": ">=16.17" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/exit-hook": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-2.2.1.tgz", - "integrity": "sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw==", - "dev": true, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/form-data-encoder": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz", - "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==" - }, - "node_modules/formdata-node": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", - "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==", - "dependencies": { - "node-domexception": "1.0.0", - "web-streams-polyfill": "4.0.0-beta.3" - }, - "engines": { - "node": ">= 12.20" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-func-name": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", - "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/get-source": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/get-source/-/get-source-2.0.12.tgz", - "integrity": "sha512-X5+4+iD+HoSeEED+uwrQ07BOQr0kEDFMVqqpBuI+RaZBpBpHCuXxo70bjar6f0b0u/DQJsJ7ssurpP0V60Az+w==", - "dev": true, - "dependencies": { - "data-uri-to-buffer": "^2.0.0", - "source-map": "^0.6.1" - } - }, - "node_modules/get-stream": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", - "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", - "dev": true, - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/glob-to-regexp": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", - "dev": true - }, - "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/human-signals": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", - "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", - "dev": true, - "engines": { - "node": ">=16.17.0" - } - }, - "node_modules/humanize-ms": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", - "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", - "dependencies": { - "ms": "^2.0.0" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-core-module": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", - "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", - "dev": true, - "dependencies": { - "hasown": "^2.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true - }, - "node_modules/js-tokens": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.0.tgz", - "integrity": "sha512-WriZw1luRMlmV3LGJaR6QOJjWwgLUTf89OwT2lUOyjX2dJGBwgmIkbcz+7WFZjrZM635JOIR517++e/67CP9dQ==", - "dev": true - }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/local-pkg": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.5.0.tgz", - "integrity": "sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg==", - "dev": true, - "dependencies": { - "mlly": "^1.4.2", - "pkg-types": "^1.0.3" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/loupe": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", - "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", - "dev": true, - "dependencies": { - "get-func-name": "^2.0.1" - } - }, - "node_modules/magic-string": { - "version": "0.30.10", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.10.tgz", - "integrity": "sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ==", - "dev": true, - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.4.15" - } - }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, - "node_modules/mime": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", - "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", - "dev": true, - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mimic-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", - "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/miniflare": { - "version": "3.20240405.1", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20240405.1.tgz", - "integrity": "sha512-oShOR/ckr9JTO1bkPQH0nXvuSgJjoE+E5+M1tvP01Q8Z+Q0GJnzU2+FDYUH8yIK/atHv7snU8yy0X6KWVn1YdQ==", - "dev": true, - "dependencies": { - "@cspotcode/source-map-support": "0.8.1", - "acorn": "^8.8.0", - "acorn-walk": "^8.2.0", - "capnp-ts": "^0.7.0", - "exit-hook": "^2.2.1", - "glob-to-regexp": "^0.4.1", - "stoppable": "^1.1.0", - "undici": "^5.28.2", - "workerd": "1.20240405.0", - "ws": "^8.11.0", - "youch": "^3.2.2", - "zod": "^3.20.6" - }, - "bin": { - "miniflare": "bootstrap.js" - }, - "engines": { - "node": ">=16.13" - } - }, - "node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/mlly": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.0.tgz", - "integrity": "sha512-U9SDaXGEREBYQgfejV97coK0UL1r+qnF2SyO9A3qcI8MzKnsIFKHNVEkrDyNncQTKQQumsasmeq84eNMdBfsNQ==", - "dev": true, - "dependencies": { - "acorn": "^8.11.3", - "pathe": "^1.1.2", - "pkg-types": "^1.1.0", - "ufo": "^1.5.3" - } - }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/mustache": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", - "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==", - "dev": true, - "bin": { - "mustache": "bin/mustache" - } - }, - "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/node-domexception": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "github", - "url": "https://paypal.me/jimmywarting" - } - ], - "engines": { - "node": ">=10.5.0" - } - }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/node-forge": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", - "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", - "dev": true, - "engines": { - "node": ">= 6.13.0" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/npm-run-path": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", - "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", - "dev": true, - "dependencies": { - "path-key": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/npm-run-path/node_modules/path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/onetime": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", - "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", - "dev": true, - "dependencies": { - "mimic-fn": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-limit": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-5.0.0.tgz", - "integrity": "sha512-/Eaoq+QyLSiXQ4lyYV23f14mZRQcXnxfHrN0vCai+ak9G0pp9iEQukIIZq5NccEvwRB8PUnZT0KsOoDCINS1qQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^1.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "node_modules/path-to-regexp": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.2.tgz", - "integrity": "sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==", - "dev": true - }, - "node_modules/pathe": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", - "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", - "dev": true - }, - "node_modules/pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/picocolors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", - "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", - "dev": true - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pkg-types": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.1.1.tgz", - "integrity": "sha512-ko14TjmDuQJ14zsotODv7dBlwxKhUKQEhuhmbqo1uCi9BB0Z2alo/wAXg6q1dTR5TyuqYyWhjtfe/Tsh+X28jQ==", - "dev": true, - "dependencies": { - "confbox": "^0.1.7", - "mlly": "^1.7.0", - "pathe": "^1.1.2" - } - }, - "node_modules/postcss": { - "version": "8.4.38", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz", - "integrity": "sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "dependencies": { - "nanoid": "^3.3.7", - "picocolors": "^1.0.0", - "source-map-js": "^1.2.0" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/pretty-format": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", - "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", - "dev": true, - "dependencies": { - "@jest/schemas": "^29.6.3", - "ansi-styles": "^5.0.0", - "react-is": "^18.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/printable-characters": { - "version": "1.0.42", - "resolved": "https://registry.npmjs.org/printable-characters/-/printable-characters-1.0.42.tgz", - "integrity": "sha512-dKp+C4iXWK4vVYZmYSd0KBH5F/h1HoZRsbJ82AVKRO3PEo8L4lBS/vLwhVtpwwuYcoIsVY+1JYKR268yn480uQ==", - "dev": true - }, - "node_modules/react-is": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", - "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", - "dev": true - }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/resolve": { - "version": "1.22.8", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", - "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", - "dev": true, - "dependencies": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/resolve.exports": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", - "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/rollup": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.17.2.tgz", - "integrity": "sha512-/9ClTJPByC0U4zNLowV1tMBe8yMEAxewtR3cUNX5BoEpGH3dQEWpJLr6CLp0fPdYRF/fzVOgvDb1zXuakwF5kQ==", - "dev": true, - "dependencies": { - "@types/estree": "1.0.5" - }, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.17.2", - "@rollup/rollup-android-arm64": "4.17.2", - "@rollup/rollup-darwin-arm64": "4.17.2", - "@rollup/rollup-darwin-x64": "4.17.2", - "@rollup/rollup-linux-arm-gnueabihf": "4.17.2", - "@rollup/rollup-linux-arm-musleabihf": "4.17.2", - "@rollup/rollup-linux-arm64-gnu": "4.17.2", - "@rollup/rollup-linux-arm64-musl": "4.17.2", - "@rollup/rollup-linux-powerpc64le-gnu": "4.17.2", - "@rollup/rollup-linux-riscv64-gnu": "4.17.2", - "@rollup/rollup-linux-s390x-gnu": "4.17.2", - "@rollup/rollup-linux-x64-gnu": "4.17.2", - "@rollup/rollup-linux-x64-musl": "4.17.2", - "@rollup/rollup-win32-arm64-msvc": "4.17.2", - "@rollup/rollup-win32-ia32-msvc": "4.17.2", - "@rollup/rollup-win32-x64-msvc": "4.17.2", - "fsevents": "~2.3.2" - } - }, - "node_modules/rollup-plugin-inject": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rollup-plugin-inject/-/rollup-plugin-inject-3.0.2.tgz", - "integrity": "sha512-ptg9PQwzs3orn4jkgXJ74bfs5vYz1NCZlSQMBUA0wKcGp5i5pA1AO3fOUEte8enhGUC+iapTCzEWw2jEFFUO/w==", - "deprecated": "This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.", - "dev": true, - "dependencies": { - "estree-walker": "^0.6.1", - "magic-string": "^0.25.3", - "rollup-pluginutils": "^2.8.1" - } - }, - "node_modules/rollup-plugin-inject/node_modules/estree-walker": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", - "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", - "dev": true - }, - "node_modules/rollup-plugin-inject/node_modules/magic-string": { - "version": "0.25.9", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", - "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", - "dev": true, - "dependencies": { - "sourcemap-codec": "^1.4.8" - } - }, - "node_modules/rollup-plugin-node-polyfills": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/rollup-plugin-node-polyfills/-/rollup-plugin-node-polyfills-0.2.1.tgz", - "integrity": "sha512-4kCrKPTJ6sK4/gLL/U5QzVT8cxJcofO0OU74tnB19F40cmuAKSzH5/siithxlofFEjwvw1YAhPmbvGNA6jEroA==", - "dev": true, - "dependencies": { - "rollup-plugin-inject": "^3.0.0" - } - }, - "node_modules/rollup-pluginutils": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", - "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", - "dev": true, - "dependencies": { - "estree-walker": "^0.6.1" - } - }, - "node_modules/rollup-pluginutils/node_modules/estree-walker": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", - "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", - "dev": true - }, - "node_modules/safe-stable-stringify": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", - "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/selfsigned": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.4.1.tgz", - "integrity": "sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q==", - "dev": true, - "dependencies": { - "@types/node-forge": "^1.3.0", - "node-forge": "^1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/siginfo": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", - "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", - "dev": true - }, - "node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-js": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", - "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sourcemap-codec": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", - "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", - "deprecated": "Please use @jridgewell/sourcemap-codec instead", - "dev": true - }, - "node_modules/stackback": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", - "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", - "dev": true - }, - "node_modules/stacktracey": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/stacktracey/-/stacktracey-2.1.8.tgz", - "integrity": "sha512-Kpij9riA+UNg7TnphqjH7/CzctQ/owJGNbFkfEeve4Z4uxT5+JapVLFXcsurIfN34gnTWZNJ/f7NMG0E8JDzTw==", - "dev": true, - "dependencies": { - "as-table": "^1.0.36", - "get-source": "^2.0.12" - } - }, - "node_modules/std-env": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.7.0.tgz", - "integrity": "sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==", - "dev": true - }, - "node_modules/stoppable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz", - "integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==", - "dev": true, - "engines": { - "node": ">=4", - "npm": ">=6" - } - }, - "node_modules/strip-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", - "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/strip-literal": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-2.1.0.tgz", - "integrity": "sha512-Op+UycaUt/8FbN/Z2TWPBLge3jWrP3xj10f3fnYxf052bKuS3EKs1ZQcVGjnEMdsNVAM+plXRdmjrZ/KgG3Skw==", - "dev": true, - "dependencies": { - "js-tokens": "^9.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/tinybench": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.8.0.tgz", - "integrity": "sha512-1/eK7zUnIklz4JUUlL+658n58XO2hHLQfSk1Zf2LKieUjxidN16eKFEoDEfjHc3ohofSSqK3X5yO6VGb6iW8Lw==", - "dev": true - }, - "node_modules/tinypool": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.8.4.tgz", - "integrity": "sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ==", - "dev": true, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/tinyspy": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.2.1.tgz", - "integrity": "sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==", - "dev": true, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, - "node_modules/ts-json-schema-generator": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/ts-json-schema-generator/-/ts-json-schema-generator-1.5.1.tgz", - "integrity": "sha512-apX5qG2+NA66j7b4AJm8q/DpdTeOsjfh7A3LpKsUiil0FepkNwtN28zYgjrsiiya2/OPhsr/PSjX5FUYg79rCg==", - "dev": true, - "dependencies": { - "@types/json-schema": "^7.0.15", - "commander": "^12.0.0", - "glob": "^8.0.3", - "json5": "^2.2.3", - "normalize-path": "^3.0.0", - "safe-stable-stringify": "^2.4.3", - "typescript": "~5.4.2" - }, - "bin": { - "ts-json-schema-generator": "bin/ts-json-schema-generator" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true - }, - "node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/typescript": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/ufo": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.3.tgz", - "integrity": "sha512-Y7HYmWaFwPUmkoQCUIAYpKqkOf+SbVj/2fJJZ4RJMCfZp0rTGwRbzQD+HghfnhKOjL9E01okqz+ncJskGYfBNw==", - "dev": true - }, - "node_modules/undici": { - "version": "5.28.4", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", - "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", - "dev": true, - "dependencies": { - "@fastify/busboy": "^2.0.0" - }, - "engines": { - "node": ">=14.0" - } - }, - "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" - }, - "node_modules/vite": { - "version": "5.2.11", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.11.tgz", - "integrity": "sha512-HndV31LWW05i1BLPMUCE1B9E9GFbOu1MbenhS58FuK6owSO5qHm7GiCotrNY1YE5rMeQSFBGmT5ZaLEjFizgiQ==", - "dev": true, - "dependencies": { - "esbuild": "^0.20.1", - "postcss": "^8.4.38", - "rollup": "^4.13.0" - }, - "bin": { - "vite": "bin/vite.js" - }, - "engines": { - "node": "^18.0.0 || >=20.0.0" - }, - "funding": { - "url": "https://github.com/vitejs/vite?sponsor=1" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - }, - "peerDependencies": { - "@types/node": "^18.0.0 || >=20.0.0", - "less": "*", - "lightningcss": "^1.21.0", - "sass": "*", - "stylus": "*", - "sugarss": "*", - "terser": "^5.4.0" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "less": { - "optional": true - }, - "lightningcss": { - "optional": true - }, - "sass": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - } - } - }, - "node_modules/vite-node": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.3.0.tgz", - "integrity": "sha512-D/oiDVBw75XMnjAXne/4feCkCEwcbr2SU1bjAhCcfI5Bq3VoOHji8/wCPAfUkDIeohJ5nSZ39fNxM3dNZ6OBOA==", - "dev": true, - "dependencies": { - "cac": "^6.7.14", - "debug": "^4.3.4", - "pathe": "^1.1.1", - "picocolors": "^1.0.0", - "vite": "^5.0.0" - }, - "bin": { - "vite-node": "vite-node.mjs" - }, - "engines": { - "node": "^18.0.0 || >=20.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/vite/node_modules/@esbuild/android-arm": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.2.tgz", - "integrity": "sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/android-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.2.tgz", - "integrity": "sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/android-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.2.tgz", - "integrity": "sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/darwin-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.2.tgz", - "integrity": "sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/darwin-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.2.tgz", - "integrity": "sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/freebsd-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.2.tgz", - "integrity": "sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/freebsd-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.2.tgz", - "integrity": "sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-arm": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.2.tgz", - "integrity": "sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.2.tgz", - "integrity": "sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-ia32": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.2.tgz", - "integrity": "sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-loong64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.2.tgz", - "integrity": "sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ==", - "cpu": [ - "loong64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-mips64el": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.2.tgz", - "integrity": "sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA==", - "cpu": [ - "mips64el" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-ppc64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.2.tgz", - "integrity": "sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-riscv64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.2.tgz", - "integrity": "sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg==", - "cpu": [ - "riscv64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-s390x": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.2.tgz", - "integrity": "sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.2.tgz", - "integrity": "sha512-1MdwI6OOTsfQfek8sLwgyjOXAu+wKhLEoaOLTjbijk6E2WONYpH9ZU2mNtR+lZ2B4uwr+usqGuVfFT9tMtGvGw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/netbsd-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.2.tgz", - "integrity": "sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/openbsd-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz", - "integrity": "sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/sunos-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.2.tgz", - "integrity": "sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/win32-arm64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.2.tgz", - "integrity": "sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/win32-ia32": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.2.tgz", - "integrity": "sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/win32-x64": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.2.tgz", - "integrity": "sha512-N49X4lJX27+l9jbLKSqZ6bKNjzQvHaT8IIFUy+YIqmXQdjYCToGWwOItDrfby14c78aDd5NHQl29xingXfCdLQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/esbuild": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.2.tgz", - "integrity": "sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g==", - "dev": true, - "hasInstallScript": true, - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=12" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.20.2", - "@esbuild/android-arm": "0.20.2", - "@esbuild/android-arm64": "0.20.2", - "@esbuild/android-x64": "0.20.2", - "@esbuild/darwin-arm64": "0.20.2", - "@esbuild/darwin-x64": "0.20.2", - "@esbuild/freebsd-arm64": "0.20.2", - "@esbuild/freebsd-x64": "0.20.2", - "@esbuild/linux-arm": "0.20.2", - "@esbuild/linux-arm64": "0.20.2", - "@esbuild/linux-ia32": "0.20.2", - "@esbuild/linux-loong64": "0.20.2", - "@esbuild/linux-mips64el": "0.20.2", - "@esbuild/linux-ppc64": "0.20.2", - "@esbuild/linux-riscv64": "0.20.2", - "@esbuild/linux-s390x": "0.20.2", - "@esbuild/linux-x64": "0.20.2", - "@esbuild/netbsd-x64": "0.20.2", - "@esbuild/openbsd-x64": "0.20.2", - "@esbuild/sunos-x64": "0.20.2", - "@esbuild/win32-arm64": "0.20.2", - "@esbuild/win32-ia32": "0.20.2", - "@esbuild/win32-x64": "0.20.2" - } - }, - "node_modules/vitest": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.3.0.tgz", - "integrity": "sha512-V9qb276J1jjSx9xb75T2VoYXdO1UKi+qfflY7V7w93jzX7oA/+RtYE6TcifxksxsZvygSSMwu2Uw6di7yqDMwg==", - "dev": true, - "dependencies": { - "@vitest/expect": "1.3.0", - "@vitest/runner": "1.3.0", - "@vitest/snapshot": "1.3.0", - "@vitest/spy": "1.3.0", - "@vitest/utils": "1.3.0", - "acorn-walk": "^8.3.2", - "chai": "^4.3.10", - "debug": "^4.3.4", - "execa": "^8.0.1", - "local-pkg": "^0.5.0", - "magic-string": "^0.30.5", - "pathe": "^1.1.1", - "picocolors": "^1.0.0", - "std-env": "^3.5.0", - "strip-literal": "^2.0.0", - "tinybench": "^2.5.1", - "tinypool": "^0.8.2", - "vite": "^5.0.0", - "vite-node": "1.3.0", - "why-is-node-running": "^2.2.2" - }, - "bin": { - "vitest": "vitest.mjs" - }, - "engines": { - "node": "^18.0.0 || >=20.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - }, - "peerDependencies": { - "@edge-runtime/vm": "*", - "@types/node": "^18.0.0 || >=20.0.0", - "@vitest/browser": "1.3.0", - "@vitest/ui": "1.3.0", - "happy-dom": "*", - "jsdom": "*" - }, - "peerDependenciesMeta": { - "@edge-runtime/vm": { - "optional": true - }, - "@types/node": { - "optional": true - }, - "@vitest/browser": { - "optional": true - }, - "@vitest/ui": { - "optional": true - }, - "happy-dom": { - "optional": true - }, - "jsdom": { - "optional": true - } - } - }, - "node_modules/web-streams-polyfill": { - "version": "4.0.0-beta.3", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", - "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==", - "engines": { - "node": ">= 14" - } - }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/why-is-node-running": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", - "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", - "dev": true, - "dependencies": { - "siginfo": "^2.0.0", - "stackback": "0.0.2" - }, - "bin": { - "why-is-node-running": "cli.js" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/workerd": { - "version": "1.20240405.0", - "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20240405.0.tgz", - "integrity": "sha512-AWrOSBh4Ll7sBWHuh0aywm8hDkKqsZmcwnDB0PVGszWZM5mndNBI5iJ/8haXVpdoyqkJQEVdhET9JDi4yU8tRg==", - "dev": true, - "hasInstallScript": true, - "bin": { - "workerd": "bin/workerd" - }, - "engines": { - "node": ">=16" - }, - "optionalDependencies": { - "@cloudflare/workerd-darwin-64": "1.20240405.0", - "@cloudflare/workerd-darwin-arm64": "1.20240405.0", - "@cloudflare/workerd-linux-64": "1.20240405.0", - "@cloudflare/workerd-linux-arm64": "1.20240405.0", - "@cloudflare/workerd-windows-64": "1.20240405.0" - } - }, - "node_modules/wrangler": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.55.0.tgz", - "integrity": "sha512-VhtCioKxOdVqkHa8jQ6C6bX3by2Ko0uM0DKzrA+6lBZvfDUlGDWSOPiG+1fOHBHj2JTVBntxWCztXP6L+Udr8w==", - "dev": true, - "dependencies": { - "@cloudflare/kv-asset-handler": "0.3.2", - "@esbuild-plugins/node-globals-polyfill": "^0.2.3", - "@esbuild-plugins/node-modules-polyfill": "^0.2.2", - "blake3-wasm": "^2.1.5", - "chokidar": "^3.5.3", - "esbuild": "0.17.19", - "miniflare": "3.20240419.1", - "nanoid": "^3.3.3", - "path-to-regexp": "^6.2.0", - "resolve": "^1.22.8", - "resolve.exports": "^2.0.2", - "selfsigned": "^2.0.1", - "source-map": "0.6.1", - "xxhash-wasm": "^1.0.1" - }, - "bin": { - "wrangler": "bin/wrangler.js", - "wrangler2": "bin/wrangler.js" - }, - "engines": { - "node": ">=16.17.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - }, - "peerDependencies": { - "@cloudflare/workers-types": "^4.20240419.0" - }, - "peerDependenciesMeta": { - "@cloudflare/workers-types": { - "optional": true - } - } - }, - "node_modules/wrangler/node_modules/@cloudflare/workerd-darwin-64": { - "version": "1.20240419.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20240419.0.tgz", - "integrity": "sha512-PGVe9sYWULHfvGhN0IZh8MsskNG/ufnBSqPbgFCxJHCTrVXLPuC35EoVaforyqjKRwj3U35XMyGo9KHcGnTeHQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=16" - } - }, - "node_modules/wrangler/node_modules/@cloudflare/workerd-darwin-arm64": { - "version": "1.20240419.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20240419.0.tgz", - "integrity": "sha512-z4etQSPiD5Gcjs962LiC7ZdmXnN6SGof5KrYoFiSI9X9kUvpuGH/lnjVVPd+NnVNeDU2kzmcAIgyZjkjTaqVXQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=16" - } - }, - "node_modules/wrangler/node_modules/@cloudflare/workerd-linux-64": { - "version": "1.20240419.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20240419.0.tgz", - "integrity": "sha512-lBwhg0j3sYTFMsEb4bOClbVje8nqrYOu0H3feQlX+Eks94JIhWPkf8ywK4at/BUc1comPMhCgzDHwc2OMPUGgg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=16" - } - }, - "node_modules/wrangler/node_modules/@cloudflare/workerd-linux-arm64": { - "version": "1.20240419.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20240419.0.tgz", - "integrity": "sha512-ZMY6wwWkxL+WPq8ydOp/irSYjAnMhBz1OC1+4z+OANtDs2beaZODmq7LEB3hb5WUAaTPY7DIjZh3DfDfty0nYg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=16" - } - }, - "node_modules/wrangler/node_modules/@cloudflare/workerd-windows-64": { - "version": "1.20240419.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20240419.0.tgz", - "integrity": "sha512-YJjgaJN2yGTkV7Cr4K3i8N4dUwVQTclT3Pr3NpRZCcLjTszwlE53++XXDnHMKGXBbSguIizaVbmcU2EtmIXyeQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=16" - } - }, - "node_modules/wrangler/node_modules/miniflare": { - "version": "3.20240419.1", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20240419.1.tgz", - "integrity": "sha512-Q9n0W07uUD/u0c/b03E4iogeXOAMjZnE3P7B5Yi8sPaZAx6TYWwjurGBja+Pg2yILN2iMaliEobfVyAKss33cA==", - "dev": true, - "dependencies": { - "@cspotcode/source-map-support": "0.8.1", - "acorn": "^8.8.0", - "acorn-walk": "^8.2.0", - "capnp-ts": "^0.7.0", - "exit-hook": "^2.2.1", - "glob-to-regexp": "^0.4.1", - "stoppable": "^1.1.0", - "undici": "^5.28.2", - "workerd": "1.20240419.0", - "ws": "^8.11.0", - "youch": "^3.2.2", - "zod": "^3.20.6" - }, - "bin": { - "miniflare": "bootstrap.js" - }, - "engines": { - "node": ">=16.13" - } - }, - "node_modules/wrangler/node_modules/workerd": { - "version": "1.20240419.0", - "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20240419.0.tgz", - "integrity": "sha512-9yV98KpkQgG+bdEsKEW8i1AYZgxns6NVSfdOVEB2Ue1pTMtIEYfUyqUE+O2amisRrfaC3Pw4EvjtTmVaoetfeg==", - "dev": true, - "hasInstallScript": true, - "bin": { - "workerd": "bin/workerd" - }, - "engines": { - "node": ">=16" - }, - "optionalDependencies": { - "@cloudflare/workerd-darwin-64": "1.20240419.0", - "@cloudflare/workerd-darwin-arm64": "1.20240419.0", - "@cloudflare/workerd-linux-64": "1.20240419.0", - "@cloudflare/workerd-linux-arm64": "1.20240419.0", - "@cloudflare/workerd-windows-64": "1.20240419.0" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, - "node_modules/ws": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz", - "integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==", - "dev": true, - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/xxhash-wasm": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.0.2.tgz", - "integrity": "sha512-ibF0Or+FivM9lNrg+HGJfVX8WJqgo+kCLDc4vx6xMeTce7Aj+DLttKbxxRR/gNLSAelRc1omAPlJ77N/Jem07A==", - "dev": true - }, - "node_modules/yocto-queue": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", - "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", - "dev": true, - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/youch": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/youch/-/youch-3.3.3.tgz", - "integrity": "sha512-qSFXUk3UZBLfggAW3dJKg0BMblG5biqSF8M34E06o5CSsZtH92u9Hqmj2RzGiHDi64fhe83+4tENFP2DB6t6ZA==", - "dev": true, - "dependencies": { - "cookie": "^0.5.0", - "mustache": "^4.2.0", - "stacktracey": "^2.1.8" - } - }, - "node_modules/zod": { - "version": "3.23.8", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", - "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/colinhacks" - } - } - } -} diff --git a/backend/ai/package.json b/backend/ai/package.json deleted file mode 100644 index c5c2216..0000000 --- a/backend/ai/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "ai", - "version": "0.0.0", - "private": true, - "scripts": { - "deploy": "wrangler deploy", - "dev": "wrangler dev", - "start": "wrangler dev", - "test": "vitest", - "cf-typegen": "wrangler types" - }, - "devDependencies": { - "@cloudflare/vitest-pool-workers": "^0.1.0", - "@cloudflare/workers-types": "^4.20240512.0", - "typescript": "^5.0.4", - "vitest": "1.3.0", - "wrangler": "^3.0.0" - }, - "dependencies": { - "@anthropic-ai/sdk": "^0.27.2" - } -} \ No newline at end of file diff --git a/backend/ai/src/index.ts b/backend/ai/src/index.ts deleted file mode 100644 index cd9bd4a..0000000 --- a/backend/ai/src/index.ts +++ /dev/null @@ -1,128 +0,0 @@ -import { Anthropic } from "@anthropic-ai/sdk" -import { MessageParam } from "@anthropic-ai/sdk/src/resources/messages.js" - -export interface Env { - ANTHROPIC_API_KEY: string -} - -export default { - async fetch(request: Request, env: Env): Promise { - // Handle CORS preflight requests - if (request.method === "OPTIONS") { - return new Response(null, { - headers: { - "Access-Control-Allow-Origin": "*", - "Access-Control-Allow-Methods": "GET, POST, OPTIONS", - "Access-Control-Allow-Headers": "Content-Type", - }, - }) - } - - if (request.method !== "GET" && request.method !== "POST") { - return new Response("Method Not Allowed", { status: 405 }) - } - - let body - let isEditCodeWidget = false - if (request.method === "POST") { - body = (await request.json()) as { - messages: unknown - context: unknown - activeFileContent: string - } - } else { - const url = new URL(request.url) - const fileName = url.searchParams.get("fileName") || "" - const code = url.searchParams.get("code") || "" - const line = url.searchParams.get("line") || "" - const instructions = url.searchParams.get("instructions") || "" - - body = { - messages: [{ role: "human", content: instructions }], - context: `File: ${fileName}\nLine: ${line}\nCode:\n${code}`, - activeFileContent: code, - } - isEditCodeWidget = true - } - - const messages = body.messages - const context = body.context - const activeFileContent = body.activeFileContent - - if (!Array.isArray(messages) || messages.length === 0) { - return new Response("Invalid or empty messages", { status: 400 }) - } - - let systemMessage - if (isEditCodeWidget) { - systemMessage = `You are an AI code editor. Your task is to modify the given code based on the user's instructions. Only output the modified code, without any explanations or markdown formatting. The code should be a direct replacement for the existing code. - -Context: -${context} - -Active File Content: -${activeFileContent} - -Instructions: ${messages[0].content} - -Respond only with the modified code that can directly replace the existing code.` - } else { - systemMessage = `You are an intelligent programming assistant. Please respond to the following request concisely. If your response includes code, please format it using triple backticks (\`\`\`) with the appropriate language identifier. For example: - -\`\`\`python -print("Hello, World!") -\`\`\` - -Provide a clear and concise explanation along with any code snippets. Keep your response brief and to the point. - -${context ? `Context:\n${context}\n` : ""} -${activeFileContent ? `Active File Content:\n${activeFileContent}\n` : ""}` - } - - const anthropicMessages = messages.map((msg) => ({ - role: msg.role === "human" ? "user" : "assistant", - content: msg.content, - })) as MessageParam[] - - try { - const anthropic = new Anthropic({ apiKey: env.ANTHROPIC_API_KEY }) - - const stream = await anthropic.messages.create({ - model: "claude-3-5-sonnet-20240620", - max_tokens: 1024, - system: systemMessage, - messages: anthropicMessages, - stream: true, - }) - - const encoder = new TextEncoder() - - const streamResponse = new ReadableStream({ - async start(controller) { - for await (const chunk of stream) { - if ( - chunk.type === "content_block_delta" && - chunk.delta.type === "text_delta" - ) { - const bytes = encoder.encode(chunk.delta.text) - controller.enqueue(bytes) - } - } - controller.close() - }, - }) - - return new Response(streamResponse, { - headers: { - "Content-Type": "text/plain; charset=utf-8", - "Access-Control-Allow-Origin": "*", - "Cache-Control": "no-cache", - Connection: "keep-alive", - }, - }) - } catch (error) { - console.error("Error:", error) - return new Response("Internal Server Error", { status: 500 }) - } - }, -} diff --git a/backend/ai/test/index.spec.ts b/backend/ai/test/index.spec.ts deleted file mode 100644 index 706f17c..0000000 --- a/backend/ai/test/index.spec.ts +++ /dev/null @@ -1,30 +0,0 @@ -// test/index.spec.ts -import { - createExecutionContext, - env, - SELF, - waitOnExecutionContext, -} from "cloudflare:test" -import { describe, expect, it } from "vitest" -import worker from "../src/index" - -// For now, you'll need to do something like this to get a correctly-typed -// `Request` to pass to `worker.fetch()`. -const IncomingRequest = Request - -describe("Hello World worker", () => { - it("responds with Hello World! (unit style)", async () => { - const request = new IncomingRequest("http://example.com") - // Create an empty context to pass to `worker.fetch()`. - const ctx = createExecutionContext() - const response = await worker.fetch(request, env, ctx) - // Wait for all `Promise`s passed to `ctx.waitUntil()` to settle before running test assertions - await waitOnExecutionContext(ctx) - expect(await response.text()).toMatchInlineSnapshot(`"Hello World!"`) - }) - - it("responds with Hello World! (integration style)", async () => { - const response = await SELF.fetch("https://example.com") - expect(await response.text()).toMatchInlineSnapshot(`"Hello World!"`) - }) -}) diff --git a/backend/ai/test/tsconfig.json b/backend/ai/test/tsconfig.json deleted file mode 100644 index 339ee9b..0000000 --- a/backend/ai/test/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "types": [ - "@cloudflare/workers-types/experimental", - "@cloudflare/vitest-pool-workers" - ] - }, - "include": ["./**/*.ts", "../src/env.d.ts"], - "exclude": [] -} diff --git a/backend/ai/tsconfig.json b/backend/ai/tsconfig.json deleted file mode 100644 index 8b55b9c..0000000 --- a/backend/ai/tsconfig.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Projects */ - // "incremental": true, /* Enable incremental compilation */ - // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ - // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */ - // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ - // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ - - /* Language and Environment */ - "target": "es2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, - "lib": [ - "es2021" - ] /* Specify a set of bundled library declaration files that describe the target runtime environment. */, - "jsx": "react" /* Specify what JSX code is generated. */, - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ - // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ - // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */ - // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ - // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */ - // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */ - // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ - // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ - - /* Modules */ - "module": "es2022" /* Specify what module code is generated. */, - // "rootDir": "./", /* Specify the root folder within your source files. */ - "moduleResolution": "Bundler" /* Specify how TypeScript looks up a file from a given module specifier. */, - // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ - // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ - // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ - // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ - "types": [ - "@cloudflare/workers-types/2023-07-01" - ] /* Specify type package names to be included without being referenced in a source file. */, - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - "resolveJsonModule": true /* Enable importing .json files */, - // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */ - - /* JavaScript Support */ - "allowJs": true /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */, - "checkJs": false /* Enable error reporting in type-checked JavaScript files. */, - // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ - - /* Emit */ - // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - // "declarationMap": true, /* Create sourcemaps for d.ts files. */ - // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ - // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ - // "outDir": "./", /* Specify an output folder for all emitted files. */ - // "removeComments": true, /* Disable emitting comments. */ - "noEmit": true /* Disable emitting files from a compilation. */, - // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ - // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ - // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ - // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Set the newline character for emitting files. */ - // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */ - // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */ - // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ - // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */ - // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ - // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ - - /* Interop Constraints */ - "isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */, - "allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */, - // "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */, - // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ - "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, - - /* Type Checking */ - "strict": true /* Enable all strict type-checking options. */, - // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ - // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */ - // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ - // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */ - // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ - // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */ - // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */ - // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ - // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */ - // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */ - // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ - // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ - // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */ - // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ - // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */ - }, - "exclude": ["test"] -} diff --git a/backend/ai/vitest.config.ts b/backend/ai/vitest.config.ts deleted file mode 100644 index 5643ba3..0000000 --- a/backend/ai/vitest.config.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { defineWorkersConfig } from "@cloudflare/vitest-pool-workers/config" - -export default defineWorkersConfig({ - test: { - poolOptions: { - workers: { - wrangler: { configPath: "./wrangler.toml" }, - }, - }, - }, -}) diff --git a/backend/ai/worker-configuration.d.ts b/backend/ai/worker-configuration.d.ts deleted file mode 100644 index a3f43d2..0000000 --- a/backend/ai/worker-configuration.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -// Generated by Wrangler -// After adding bindings to `wrangler.toml`, regenerate this interface via `npm run cf-typegen` -interface Env {} diff --git a/backend/ai/wrangler.example.toml b/backend/ai/wrangler.example.toml deleted file mode 100644 index 8dcd480..0000000 --- a/backend/ai/wrangler.example.toml +++ /dev/null @@ -1,10 +0,0 @@ -name = "ai" -main = "src/index.ts" -compatibility_date = "2024-05-12" -compatibility_flags = ["nodejs_compat"] - -[ai] -binding = "AI" - -[vars] -ANTHROPIC_API_KEY = "" diff --git a/backend/database/drizzle/meta/0000_snapshot.json b/backend/database/drizzle/meta/0000_snapshot.json index bdc4138..775f00c 100644 --- a/backend/database/drizzle/meta/0000_snapshot.json +++ b/backend/database/drizzle/meta/0000_snapshot.json @@ -1,7 +1,7 @@ { "version": "5", "dialect": "sqlite", - "id": "afe10bff-362b-402c-bdb5-038341692f35", + "id": "1288b006-6410-4b1c-8c96-d9797878a116", "prevId": "00000000-0000-0000-0000-000000000000", "tables": { "sandbox": { @@ -140,13 +140,6 @@ "autoincrement": false, "default": "CURRENT_TIMESTAMP" }, - "image": { - "name": "image", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, "generations": { "name": "generations", "type": "integer", @@ -154,6 +147,28 @@ "notNull": false, "autoincrement": false, "default": 0 + }, + "tier": { + "name": "tier", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'FREE'" + }, + "tierExpiresAt": { + "name": "tierExpiresAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lastResetDate": { + "name": "lastResetDate", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false } }, "indexes": { diff --git a/backend/database/drizzle/meta/0001_snapshot.json b/backend/database/drizzle/meta/0001_snapshot.json deleted file mode 100644 index 9d8f7d3..0000000 --- a/backend/database/drizzle/meta/0001_snapshot.json +++ /dev/null @@ -1,236 +0,0 @@ -{ - "version": "5", - "dialect": "sqlite", - "id": "e570d5ac-700d-4e62-8a46-482b21ae1fe1", - "prevId": "afe10bff-362b-402c-bdb5-038341692f35", - "tables": { - "sandbox": { - "name": "sandbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "createdAt": { - "name": "createdAt", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "CURRENT_TIMESTAMP" - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "likeCount": { - "name": "likeCount", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 0 - }, - "viewCount": { - "name": "viewCount", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "sandbox_id_unique": { - "name": "sandbox_id_unique", - "columns": [ - "id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "sandbox_user_id_user_id_fk": { - "name": "sandbox_user_id_user_id_fk", - "tableFrom": "sandbox", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "user": { - "name": "user", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "username": { - "name": "username", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "avatarUrl": { - "name": "avatarUrl", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "createdAt": { - "name": "createdAt", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "CURRENT_TIMESTAMP" - }, - "generations": { - "name": "generations", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "user_id_unique": { - "name": "user_id_unique", - "columns": [ - "id" - ], - "isUnique": true - }, - "user_username_unique": { - "name": "user_username_unique", - "columns": [ - "username" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "users_to_sandboxes": { - "name": "users_to_sandboxes", - "columns": { - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sandboxId": { - "name": "sandboxId", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sharedOn": { - "name": "sharedOn", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "users_to_sandboxes_userId_user_id_fk": { - "name": "users_to_sandboxes_userId_user_id_fk", - "tableFrom": "users_to_sandboxes", - "tableTo": "user", - "columnsFrom": [ - "userId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "users_to_sandboxes_sandboxId_sandbox_id_fk": { - "name": "users_to_sandboxes_sandboxId_sandbox_id_fk", - "tableFrom": "users_to_sandboxes", - "tableTo": "sandbox", - "columnsFrom": [ - "sandboxId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - } -} \ No newline at end of file diff --git a/backend/database/drizzle/meta/_journal.json b/backend/database/drizzle/meta/_journal.json index 1f095d0..a26196c 100644 --- a/backend/database/drizzle/meta/_journal.json +++ b/backend/database/drizzle/meta/_journal.json @@ -5,29 +5,8 @@ { "idx": 0, "version": "5", - "when": 1731288423588, - "tag": "0000_cuddly_patriot", - "breakpoints": true - }, - { - "idx": 1, - "version": "5", - "when": 1731290863632, - "tag": "0001_opposite_newton_destine", - "breakpoints": true - }, - { - "idx": 2, - "version": "5", - "when": 1731296235880, - "tag": "0002_rainy_fantastic_four", - "breakpoints": true - }, - { - "idx": 3, - "version": "5", - "when": 1731297339306, - "tag": "0003_lying_snowbird", + "when": 1732568535771, + "tag": "0000_rapid_korath", "breakpoints": true } ] diff --git a/backend/database/src/index.ts b/backend/database/src/index.ts index ff3b095..5fd6f50 100644 --- a/backend/database/src/index.ts +++ b/backend/database/src/index.ts @@ -245,114 +245,6 @@ export default { return success } else return methodNotAllowed - } else if (path === "/api/sandbox/generate" && method === "POST") { - const generateSchema = z.object({ - userId: z.string(), - }) - const body = await request.json() - const { userId } = generateSchema.parse(body) - - const dbUser = await db.query.user.findFirst({ - where: (user, { eq }) => eq(user.id, userId), - }) - if (!dbUser) { - return new Response("User not found.", { status: 400 }) - } - if (dbUser.generations !== null && dbUser.generations >= 10) { - return new Response("You reached the maximum # of generations.", { - status: 400, - }) - } - - await db - .update(user) - .set({ generations: sql`${user.generations} + 1` }) - .where(eq(user.id, userId)) - .get() - - return success - } else if (path === "/api/sandbox/like") { - if (method === "POST") { - const likeSchema = z.object({ - sandboxId: z.string(), - userId: z.string(), - }) - - try { - const body = await request.json() - const { sandboxId, userId } = likeSchema.parse(body) - - // Check if user has already liked - const existingLike = await db.query.sandboxLikes.findFirst({ - where: (likes, { and, eq }) => - and(eq(likes.sandboxId, sandboxId), eq(likes.userId, userId)), - }) - - if (existingLike) { - // Unlike - await db - .delete(sandboxLikes) - .where( - and( - eq(sandboxLikes.sandboxId, sandboxId), - eq(sandboxLikes.userId, userId) - ) - ) - - await db - .update(sandbox) - .set({ - likeCount: sql`${sandbox.likeCount} - 1`, - }) - .where(eq(sandbox.id, sandboxId)) - - return json({ - message: "Unlike successful", - liked: false, - }) - } else { - // Like - await db.insert(sandboxLikes).values({ - sandboxId, - userId, - createdAt: new Date(), - }) - - await db - .update(sandbox) - .set({ - likeCount: sql`${sandbox.likeCount} + 1`, - }) - .where(eq(sandbox.id, sandboxId)) - - return json({ - message: "Like successful", - liked: true, - }) - } - } catch (error) { - return new Response("Invalid request format", { status: 400 }) - } - } else if (method === "GET") { - const params = url.searchParams - const sandboxId = params.get("sandboxId") - const userId = params.get("userId") - - if (!sandboxId || !userId) { - return invalidRequest - } - - const like = await db.query.sandboxLikes.findFirst({ - where: (likes, { and, eq }) => - and(eq(likes.sandboxId, sandboxId), eq(likes.userId, userId)), - }) - - return json({ - liked: !!like, - }) - } else { - return methodNotAllowed - } } else if (path === "/api/user") { if (method === "GET") { const params = url.searchParams @@ -426,12 +318,14 @@ export default { avatarUrl: z.string().optional(), createdAt: z.string().optional(), generations: z.number().optional(), + tier: z.enum(["FREE", "PRO", "ENTERPRISE"]).optional(), + tierExpiresAt: z.number().optional(), + lastResetDate: z.number().optional(), }) const body = await request.json() - const { id, name, email, username, avatarUrl, createdAt, generations } = - userSchema.parse(body) + const { id, name, email, username, avatarUrl, createdAt, generations, tier, tierExpiresAt, lastResetDate } = userSchema.parse(body) const res = await db .insert(user) .values({ @@ -442,6 +336,9 @@ export default { avatarUrl, createdAt: createdAt ? new Date(createdAt) : new Date(), generations, + tier, + tierExpiresAt, + lastResetDate, }) .returning() .get() @@ -521,6 +418,76 @@ export default { return json({ exists: !!exists }) } return methodNotAllowed + } else if (path === "/api/user/increment-generations" && method === "POST") { + const schema = z.object({ + userId: z.string(), + }) + + const body = await request.json() + const { userId } = schema.parse(body) + + await db + .update(user) + .set({ generations: sql`${user.generations} + 1` }) + .where(eq(user.id, userId)) + .get() + + return success + } else if (path === "/api/user/update-tier" && method === "POST") { + const schema = z.object({ + userId: z.string(), + tier: z.enum(["FREE", "PRO", "ENTERPRISE"]), + tierExpiresAt: z.date(), + }) + + const body = await request.json() + const { userId, tier, tierExpiresAt } = schema.parse(body) + + await db + .update(user) + .set({ + tier, + tierExpiresAt: tierExpiresAt.getTime(), + // Reset generations when upgrading tier + generations: 0 + }) + .where(eq(user.id, userId)) + .get() + + return success + } else if (path === "/api/user/check-reset" && method === "POST") { + const schema = z.object({ + userId: z.string(), + }) + + const body = await request.json() + const { userId } = schema.parse(body) + + const dbUser = await db.query.user.findFirst({ + where: (user, { eq }) => eq(user.id, userId), + }) + + if (!dbUser) { + return new Response("User not found", { status: 404 }) + } + + const now = new Date() + const lastReset = dbUser.lastResetDate ? new Date(dbUser.lastResetDate) : new Date(0) + + if (now.getMonth() !== lastReset.getMonth() || now.getFullYear() !== lastReset.getFullYear()) { + await db + .update(user) + .set({ + generations: 0, + lastResetDate: now.getTime() + }) + .where(eq(user.id, userId)) + .get() + + return new Response("Reset successful", { status: 200 }) + } + + return new Response("No reset needed", { status: 200 }) } else return notFound }, } diff --git a/backend/database/src/schema.ts b/backend/database/src/schema.ts index 5d40a97..655c897 100644 --- a/backend/database/src/schema.ts +++ b/backend/database/src/schema.ts @@ -16,6 +16,9 @@ export const user = sqliteTable("user", { sql`CURRENT_TIMESTAMP` ), generations: integer("generations").default(0), + tier: text("tier", { enum: ["FREE", "PRO", "ENTERPRISE"] }).default("FREE"), + tierExpiresAt: integer("tierExpiresAt"), + lastResetDate: integer("lastResetDate"), }) export type User = typeof user.$inferSelect diff --git a/backend/server/package-lock.json b/backend/server/package-lock.json index dd284cb..0013c2a 100644 --- a/backend/server/package-lock.json +++ b/backend/server/package-lock.json @@ -12,8 +12,9 @@ "concurrently": "^8.2.2", "cors": "^2.8.5", "dotenv": "^16.4.5", - "e2b": "^0.16.2-beta.47", + "e2b": "^1.0.5", "express": "^4.19.2", + "jzip": "^1.0.0", "rate-limiter-flexible": "^5.0.3", "simple-git": "^3.25.0", "socket.io": "^4.7.5", @@ -23,6 +24,7 @@ "devDependencies": { "@types/cors": "^2.8.17", "@types/express": "^4.17.21", + "@types/jszip": "^3.4.1", "@types/node": "^20.12.7", "@types/ssh2": "^1.15.0", "nodemon": "^3.1.0", @@ -31,9 +33,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.0.tgz", - "integrity": "sha512-7dRy4DwXwtzBrPbZflqxnvfxLF8kdZXPkhymtDeFoFqE6ldzjQFgYTtYIFARcLEYDrqfBfYcZt1WqFxRoyC9Rw==", + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.0.tgz", + "integrity": "sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==", "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -42,25 +44,25 @@ } }, "node_modules/@bufbuild/protobuf": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.10.0.tgz", - "integrity": "sha512-QDdVFLoN93Zjg36NoQPZfsVH9tZew7wKDKyV5qRdj8ntT4wQCOradQjRaTdwMhWUYsgKsvCINKKm87FdEk96Ag==" + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.2.2.tgz", + "integrity": "sha512-UNtPCbrwrenpmrXuRwn9jYpPoweNXj8X5sMvYgsqYyaH8jQ6LfUJSk3dJLnBK+6sfYPrF4iAIo5sd5HQ+tg75A==" }, "node_modules/@connectrpc/connect": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@connectrpc/connect/-/connect-1.4.0.tgz", - "integrity": "sha512-vZeOkKaAjyV4+RH3+rJZIfDFJAfr+7fyYr6sLDKbYX3uuTVszhFe9/YKf5DNqrDb5cKdKVlYkGn6DTDqMitAnA==", + "version": "2.0.0-rc.3", + "resolved": "https://registry.npmjs.org/@connectrpc/connect/-/connect-2.0.0-rc.3.tgz", + "integrity": "sha512-ARBt64yEyKbanyRETTjcjJuHr2YXorzQo0etyS5+P6oSeW8xEuzajA9g+zDnMcj1hlX2dQE93foIWQGfpru7gQ==", "peerDependencies": { - "@bufbuild/protobuf": "^1.4.2" + "@bufbuild/protobuf": "^2.2.0" } }, "node_modules/@connectrpc/connect-web": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@connectrpc/connect-web/-/connect-web-1.4.0.tgz", - "integrity": "sha512-13aO4psFbbm7rdOFGV0De2Za64DY/acMspgloDlcOKzLPPs0yZkhp1OOzAQeiAIr7BM/VOHIA3p8mF0inxCYTA==", + "version": "2.0.0-rc.3", + "resolved": "https://registry.npmjs.org/@connectrpc/connect-web/-/connect-web-2.0.0-rc.3.tgz", + "integrity": "sha512-w88P8Lsn5CCsA7MFRl2e6oLY4J/5toiNtJns/YJrlyQaWOy3RO8pDgkz+iIkG98RPMhj2thuBvsd3Cn4DKKCkw==", "peerDependencies": { - "@bufbuild/protobuf": "^1.4.2", - "@connectrpc/connect": "1.4.0" + "@bufbuild/protobuf": "^2.2.0", + "@connectrpc/connect": "2.0.0-rc.3" } }, "node_modules/@cspotcode/source-map-support": { @@ -109,11 +111,11 @@ } }, "node_modules/@kwsites/file-exists/node_modules/debug": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", - "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -125,9 +127,9 @@ } }, "node_modules/@kwsites/file-exists/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "node_modules/@kwsites/promise-deferred": { "version": "1.1.1", @@ -208,9 +210,9 @@ } }, "node_modules/@types/express-serve-static-core": { - "version": "4.19.5", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.5.tgz", - "integrity": "sha512-y6W03tvrACO72aijJ5uF02FRq5cgDR9lUxddQ8vyF+GvmjJQqbzDcJngEjURc+ZsG31VI3hODNZJ2URj86pzmg==", + "version": "4.19.6", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.6.tgz", + "integrity": "sha512-N4LZ2xG7DatVqhCZzOGb1Yi5lMbXSZcmdLDe9EzSndPV2HpWYWzRbaerl2n27irrm94EPpprqa8KpskPT085+A==", "dev": true, "dependencies": { "@types/node": "*", @@ -225,6 +227,16 @@ "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==", "dev": true }, + "node_modules/@types/jszip": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/@types/jszip/-/jszip-3.4.1.tgz", + "integrity": "sha512-TezXjmf3lj+zQ651r6hPqvSScqBLvyPI9FxdXBqpEwBijNGQ2NXpaFW/7joGzveYkKQUil7iiDHLo6LV71Pc0A==", + "deprecated": "This is a stub types definition. jszip provides its own type definitions, so you do not need this installed.", + "dev": true, + "dependencies": { + "jszip": "*" + } + }, "node_modules/@types/mime": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", @@ -232,17 +244,17 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.14.15", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.15.tgz", - "integrity": "sha512-Fz1xDMCF/B00/tYSVMlmK7hVeLh7jE5f3B7X1/hmV0MJBwE27KlS7EvD/Yp+z1lm8mVhwV5w+n8jOZG8AfTlKw==", + "version": "20.17.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.6.tgz", + "integrity": "sha512-VEI7OdvK2wP7XHnsuXbAJnEpEkF6NjSN45QJlL4VGqZSXsnicpesdTWsg9RISeSdYd3yeRj/y3k5KGjUXYnFwQ==", "dependencies": { - "undici-types": "~5.26.4" + "undici-types": "~6.19.2" } }, "node_modules/@types/qs": { - "version": "6.9.15", - "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.15.tgz", - "integrity": "sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg==", + "version": "6.9.17", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.17.tgz", + "integrity": "sha512-rX4/bPcfmvxHDv0XjfJELTTr+iB+tn032nPILqHm5wbthUUUuVtNGGqzhya9XUxjTP8Fpr0qYgSZZKxGY++svQ==", "dev": true }, "node_modules/@types/range-parser": { @@ -282,14 +294,20 @@ } }, "node_modules/@types/ssh2/node_modules/@types/node": { - "version": "18.19.44", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.44.tgz", - "integrity": "sha512-ZsbGerYg72WMXUIE9fYxtvfzLEuq6q8mKERdWFnqTmOvudMxnz+CBNRoOwJ2kNpFOncrKjT1hZwxjlFgQ9qvQA==", + "version": "18.19.64", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.64.tgz", + "integrity": "sha512-955mDqvO2vFf/oL7V3WiUtiz+BugyX8uVbaT2H8oj3+8dRyH2FLiNdowe7eNqRM7IOIZvzDH76EoAT+gwm6aIQ==", "dev": true, "dependencies": { "undici-types": "~5.26.4" } }, + "node_modules/@types/ssh2/node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", @@ -303,9 +321,9 @@ } }, "node_modules/acorn": { - "version": "8.12.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", - "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -315,9 +333,9 @@ } }, "node_modules/acorn-walk": { - "version": "8.3.3", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.3.tgz", - "integrity": "sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw==", + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", "dev": true, "dependencies": { "acorn": "^8.11.0" @@ -415,9 +433,9 @@ } }, "node_modules/body-parser": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", "dependencies": { "bytes": "3.1.2", "content-type": "~1.0.5", @@ -427,7 +445,7 @@ "http-errors": "2.0.0", "iconv-lite": "0.4.24", "on-finished": "2.4.1", - "qs": "6.11.0", + "qs": "6.13.0", "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" @@ -459,20 +477,6 @@ "node": ">=8" } }, - "node_modules/bufferutil": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.8.tgz", - "integrity": "sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==", - "hasInstallScript": true, - "optional": true, - "peer": true, - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } - }, "node_modules/buildcheck": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/buildcheck/-/buildcheck-0.0.6.tgz", @@ -644,9 +648,9 @@ } }, "node_modules/cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", "engines": { "node": ">= 0.6" } @@ -656,6 +660,12 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true + }, "node_modules/cors": { "version": "2.8.5", "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", @@ -765,13 +775,13 @@ } }, "node_modules/e2b": { - "version": "0.16.2-beta.47", - "resolved": "https://registry.npmjs.org/e2b/-/e2b-0.16.2-beta.47.tgz", - "integrity": "sha512-tMPDYLMD+8+JyLPrsWft3NHBhK5YKOFOXzKMwpOKR5KvXOkd1silkArDwplmBUzN/eG/uRzWdtHZs9mHUQ5b9g==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/e2b/-/e2b-1.0.5.tgz", + "integrity": "sha512-0c2xqNQfVcVBmETsd1bXWCYaN3iVl7m81dJVcjB7O2/c15A7t0s/FkydcZGzVvfZchj40/1f09AdjGX6nk1eNQ==", "dependencies": { - "@bufbuild/protobuf": "^1.10.0", - "@connectrpc/connect": "^1.4.0", - "@connectrpc/connect-web": "^1.4.0", + "@bufbuild/protobuf": "^2.2.2", + "@connectrpc/connect": "2.0.0-rc.3", + "@connectrpc/connect-web": "2.0.0-rc.3", "compare-versions": "^6.1.0", "openapi-fetch": "^0.9.7", "platform": "^1.3.6" @@ -791,24 +801,24 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", "engines": { "node": ">= 0.8" } }, "node_modules/engine.io": { - "version": "6.5.5", - "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.5.5.tgz", - "integrity": "sha512-C5Pn8Wk+1vKBoHghJODM63yk8MvrO9EWZUfkAt5HAqIgPE4/8FF0PEGHXtEd40l223+cE5ABWuPzm38PHFXfMA==", + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.6.2.tgz", + "integrity": "sha512-gmNvsYi9C8iErnZdVcJnvCpSKbWTt1E8+JZo8b+daLninywUWi5NQ5STSHZ9rFjFO7imNcvb8Pc5pe/wMR5xEw==", "dependencies": { "@types/cookie": "^0.4.1", "@types/cors": "^2.8.12", "@types/node": ">=10.0.0", "accepts": "~1.3.4", "base64id": "2.0.0", - "cookie": "~0.4.1", + "cookie": "~0.7.2", "cors": "~2.8.5", "debug": "~4.3.1", "engine.io-parser": "~5.2.1", @@ -827,19 +837,19 @@ } }, "node_modules/engine.io/node_modules/cookie": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", - "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", "engines": { "node": ">= 0.6" } }, "node_modules/engine.io/node_modules/debug": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", - "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -851,29 +861,9 @@ } }, "node_modules/engine.io/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/engine.io/node_modules/ws": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", - "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "node_modules/es-define-property": { "version": "1.0.0", @@ -895,9 +885,9 @@ } }, "node_modules/escalade": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", - "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "engines": { "node": ">=6" } @@ -916,36 +906,36 @@ } }, "node_modules/express": { - "version": "4.19.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", - "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", + "version": "4.21.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.1.tgz", + "integrity": "sha512-YSFlK1Ee0/GC8QaO91tHcDxJiE/X4FbpAyQWkxAvG6AXCuR65YzK8ua6D9hvi/TzUfZMpc+BwuM1IPw8fmQBiQ==", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.2", + "body-parser": "1.20.3", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.6.0", + "cookie": "0.7.1", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", - "finalhandler": "1.2.0", + "finalhandler": "1.3.1", "fresh": "0.5.2", "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", + "merge-descriptors": "1.0.3", "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", + "path-to-regexp": "0.1.10", "proxy-addr": "~2.0.7", - "qs": "6.11.0", + "qs": "6.13.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", + "send": "0.19.0", + "serve-static": "1.16.2", "setprototypeof": "1.2.0", "statuses": "2.0.1", "type-is": "~1.6.18", @@ -969,12 +959,12 @@ } }, "node_modules/finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", "dependencies": { "debug": "2.6.9", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "on-finished": "2.4.1", "parseurl": "~1.3.3", @@ -1156,6 +1146,12 @@ "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", "dev": true }, + "node_modules/immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", + "dev": true + }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -1219,6 +1215,38 @@ "node": ">=0.12.0" } }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, + "node_modules/jszip": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz", + "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", + "dev": true, + "dependencies": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "setimmediate": "^1.0.5" + } + }, + "node_modules/jzip": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/jzip/-/jzip-1.0.0.tgz", + "integrity": "sha512-pyDHf5zvxE5DC47ftNff2AU3UdJe0TYSFki0Ji6GapuZC7p2EizIbPHV7dkLj43RPv2Vj3p1xwC11kDv6dyCrA==" + }, + "node_modules/lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "dev": true, + "dependencies": { + "immediate": "~3.0.5" + } + }, "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", @@ -1239,9 +1267,12 @@ } }, "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/methods": { "version": "1.1.2", @@ -1299,9 +1330,9 @@ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, "node_modules/nan": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.20.0.tgz", - "integrity": "sha512-bk3gXBZDGILuuo/6sKtr0DQmSThYHLtNCdSdXk9YkxD/jK6X2vmCyyXBBxyqZ4XcnzTyYEAThfX3DCEnLf6igw==", + "version": "2.22.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.22.0.tgz", + "integrity": "sha512-nbajikzWTMwsW+eSsNm3QwlOs7het9gGJU5dDZzRTQGk03vyBOauxgI4VakDzE0PtsGTmXPsXTbbjVhRwR5mpw==", "optional": true }, "node_modules/negotiator": { @@ -1312,22 +1343,10 @@ "node": ">= 0.6" } }, - "node_modules/node-gyp-build": { - "version": "4.8.1", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.1.tgz", - "integrity": "sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw==", - "optional": true, - "peer": true, - "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" - } - }, "node_modules/nodemon": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.4.tgz", - "integrity": "sha512-wjPBbFhtpJwmIeY2yP7QF+UKzPfltVGtfce1g/bB15/8vCGZj8uxD62b/b9M9/WVgme0NZudpownKN+c0plXlQ==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.7.tgz", + "integrity": "sha512-hLj7fuMow6f0lbB0cD14Lz2xNjwsyruH251Pk4t/yIitCFJbmY1myuLlHm/q06aST4jg6EgAh74PIBBrRqpVAQ==", "dev": true, "dependencies": { "chokidar": "^3.5.2", @@ -1353,12 +1372,12 @@ } }, "node_modules/nodemon/node_modules/debug": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", - "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dev": true, "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -1379,9 +1398,9 @@ } }, "node_modules/nodemon/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, "node_modules/nodemon/node_modules/supports-color": { @@ -1414,9 +1433,9 @@ } }, "node_modules/object-inspect": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", - "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "version": "1.13.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.3.tgz", + "integrity": "sha512-kDCGIbxkDSXE3euJZZXzc6to7fCrKHNI/hSRQnRuQ+BWjFNzZwiFF8fj/6o2t2G9/jTj8PSIYTfCLelLZEeRpA==", "engines": { "node": ">= 0.4" }, @@ -1448,6 +1467,12 @@ "resolved": "https://registry.npmjs.org/openapi-typescript-helpers/-/openapi-typescript-helpers-0.0.8.tgz", "integrity": "sha512-1eNjQtbfNi5Z/kFhagDIaIRj6qqDzhjNJKz8cmMW0CVdGwT6e1GLbAfgI0d28VTJa1A8jz82jm/4dG8qNoNS8g==" }, + "node_modules/pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "dev": true + }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -1457,9 +1482,9 @@ } }, "node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz", + "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==" }, "node_modules/picomatch": { "version": "2.3.1", @@ -1478,6 +1503,12 @@ "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -1497,11 +1528,11 @@ "dev": true }, "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", "dependencies": { - "side-channel": "^1.0.4" + "side-channel": "^1.0.6" }, "engines": { "node": ">=0.6" @@ -1519,9 +1550,9 @@ } }, "node_modules/rate-limiter-flexible": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/rate-limiter-flexible/-/rate-limiter-flexible-5.0.3.tgz", - "integrity": "sha512-lWx2y8NBVlTOLPyqs+6y7dxfEpT6YFqKy3MzWbCy95sTTOhOuxufP2QvRyOHpfXpB9OUJPbVLybw3z3AVAS5fA==" + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/rate-limiter-flexible/-/rate-limiter-flexible-5.0.4.tgz", + "integrity": "sha512-ftYHrIfSqWYDIJZ4yPTrgOduByAp+86gUS9iklv0JoXVM8eQCAjTnydCj1hAT4MmhmkSw86NaFEJ28m/LC1pKA==" }, "node_modules/raw-body": { "version": "2.5.2", @@ -1537,6 +1568,27 @@ "node": ">= 0.8" } }, + "node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -1607,9 +1659,9 @@ } }, "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", "dependencies": { "debug": "2.6.9", "depd": "2.0.0", @@ -1629,20 +1681,28 @@ "node": ">= 0.8.0" } }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/send/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "node_modules/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", "dependencies": { - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.18.0" + "send": "0.19.0" }, "engines": { "node": ">= 0.8.0" @@ -1664,6 +1724,12 @@ "node": ">= 0.4" } }, + "node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", + "dev": true + }, "node_modules/setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", @@ -1695,9 +1761,9 @@ } }, "node_modules/simple-git": { - "version": "3.25.0", - "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.25.0.tgz", - "integrity": "sha512-KIY5sBnzc4yEcJXW7Tdv4viEz8KyG+nU0hay+DWZasvdFOYKeUZ6Xc25LUHHjw0tinPT7O1eY6pzX7pRT1K8rw==", + "version": "3.27.0", + "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.27.0.tgz", + "integrity": "sha512-ivHoFS9Yi9GY49ogc6/YAi3Fl9ROnF4VyubNylgCkA+RVqLaKWnDSzXOVzya8csELIaWaYNutsEuAhZrtOjozA==", "dependencies": { "@kwsites/file-exists": "^1.1.1", "@kwsites/promise-deferred": "^1.1.1", @@ -1709,11 +1775,11 @@ } }, "node_modules/simple-git/node_modules/debug": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", - "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -1725,9 +1791,9 @@ } }, "node_modules/simple-git/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "node_modules/simple-update-notifier": { "version": "2.0.0", @@ -1742,15 +1808,15 @@ } }, "node_modules/socket.io": { - "version": "4.7.5", - "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.7.5.tgz", - "integrity": "sha512-DmeAkF6cwM9jSfmp6Dr/5/mfMwb5Z5qRrSXLpo3Fq5SqyU8CMF15jIN4ZhfSwu35ksM1qmHZDQ/DK5XTccSTvA==", + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.8.1.tgz", + "integrity": "sha512-oZ7iUCxph8WYRHHcjBEc9unw3adt5CmSNlppj/5Q4k2RIrhl8Z5yY2Xr4j9zj0+wzVZ0bxmYoGSzKJnRl6A4yg==", "dependencies": { "accepts": "~1.3.4", "base64id": "~2.0.0", "cors": "~2.8.5", "debug": "~4.3.2", - "engine.io": "~6.5.2", + "engine.io": "~6.6.0", "socket.io-adapter": "~2.5.2", "socket.io-parser": "~4.2.4" }, @@ -1768,11 +1834,11 @@ } }, "node_modules/socket.io-adapter/node_modules/debug": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", - "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -1784,29 +1850,9 @@ } }, "node_modules/socket.io-adapter/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/socket.io-adapter/node_modules/ws": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", - "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "node_modules/socket.io-parser": { "version": "4.2.4", @@ -1821,11 +1867,11 @@ } }, "node_modules/socket.io-parser/node_modules/debug": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", - "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -1837,16 +1883,16 @@ } }, "node_modules/socket.io-parser/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "node_modules/socket.io/node_modules/debug": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", - "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -1858,9 +1904,9 @@ } }, "node_modules/socket.io/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "node_modules/spawn-command": { "version": "0.0.2", @@ -1868,9 +1914,9 @@ "integrity": "sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ==" }, "node_modules/ssh2": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.15.0.tgz", - "integrity": "sha512-C0PHgX4h6lBxYx7hcXwu3QWdh4tg6tZZsTfXcdvc5caW/EMxaB4H9dWsl7qk+F7LAW762hp8VbXOX7x4xUYvEw==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.16.0.tgz", + "integrity": "sha512-r1X4KsBGedJqo7h8F5c4Ybpcr5RjyP+aWIG007uBPRjmdQWfEiVLzSK71Zji1B9sKxwaCvD8y8cwSkYrlLiRRg==", "hasInstallScript": true, "dependencies": { "asn1": "^0.2.6", @@ -1880,8 +1926,8 @@ "node": ">=10.16.0" }, "optionalDependencies": { - "cpu-features": "~0.0.9", - "nan": "^2.18.0" + "cpu-features": "~0.0.10", + "nan": "^2.20.0" } }, "node_modules/statuses": { @@ -1892,6 +1938,21 @@ "node": ">= 0.8" } }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -2011,9 +2072,9 @@ } }, "node_modules/tslib": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", - "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" }, "node_modules/tweetnacl": { "version": "0.14.5", @@ -2033,9 +2094,9 @@ } }, "node_modules/typescript": { - "version": "5.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", - "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", + "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -2052,9 +2113,9 @@ "dev": true }, "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" }, "node_modules/unpipe": { "version": "1.0.0", @@ -2064,19 +2125,11 @@ "node": ">= 0.8" } }, - "node_modules/utf-8-validate": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-6.0.4.tgz", - "integrity": "sha512-xu9GQDeFp+eZ6LnCywXN/zBancWvOpUMzgjLPSjy4BRHSmTelvn2E0DG0o1sTiw5hkCKBHo8rwSKncfRfv2EEQ==", - "hasInstallScript": true, - "optional": true, - "peer": true, - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true }, "node_modules/utils-merge": { "version": "1.0.1", @@ -2116,6 +2169,26 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/ws": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", diff --git a/backend/server/package.json b/backend/server/package.json index 435cd1b..2d09280 100644 --- a/backend/server/package.json +++ b/backend/server/package.json @@ -14,8 +14,9 @@ "concurrently": "^8.2.2", "cors": "^2.8.5", "dotenv": "^16.4.5", - "e2b": "^0.16.2-beta.47", + "e2b": "^1.0.5", "express": "^4.19.2", + "jzip": "^1.0.0", "rate-limiter-flexible": "^5.0.3", "simple-git": "^3.25.0", "socket.io": "^4.7.5", @@ -25,10 +26,11 @@ "devDependencies": { "@types/cors": "^2.8.17", "@types/express": "^4.17.21", + "@types/jszip": "^3.4.1", "@types/node": "^20.12.7", "@types/ssh2": "^1.15.0", "nodemon": "^3.1.0", "ts-node": "^10.9.2", "typescript": "^5.4.5" } -} \ No newline at end of file +} diff --git a/backend/server/src/AIWorker.ts b/backend/server/src/AIWorker.ts deleted file mode 100644 index f5c06e9..0000000 --- a/backend/server/src/AIWorker.ts +++ /dev/null @@ -1,90 +0,0 @@ -// AIWorker class for handling AI-related operations -export class AIWorker { - private aiWorkerUrl: string - private cfAiKey: string - private databaseWorkerUrl: string - private workersKey: string - - // Constructor to initialize AIWorker with necessary URLs and keys - constructor( - aiWorkerUrl: string, - cfAiKey: string, - databaseWorkerUrl: string, - workersKey: string - ) { - this.aiWorkerUrl = aiWorkerUrl - this.cfAiKey = cfAiKey - this.databaseWorkerUrl = databaseWorkerUrl - this.workersKey = workersKey - } - - // Method to generate code based on user input - async generateCode( - userId: string, - fileName: string, - code: string, - line: number, - instructions: string - ): Promise<{ response: string; success: boolean }> { - try { - const fetchPromise = fetch( - `${process.env.DATABASE_WORKER_URL}/api/sandbox/generate`, - { - method: "POST", - headers: { - "Content-Type": "application/json", - Authorization: `${process.env.WORKERS_KEY}`, - }, - body: JSON.stringify({ - userId: userId, - }), - } - ) - - // Generate code from cloudflare workers AI - const generateCodePromise = fetch( - `${process.env.AI_WORKER_URL}/api?fileName=${encodeURIComponent( - fileName - )}&code=${encodeURIComponent(code)}&line=${encodeURIComponent( - line - )}&instructions=${encodeURIComponent(instructions)}`, - { - headers: { - "Content-Type": "application/json", - Authorization: `${process.env.CF_AI_KEY}`, - }, - } - ) - - const [fetchResponse, generateCodeResponse] = await Promise.all([ - fetchPromise, - generateCodePromise, - ]) - - if (!generateCodeResponse.ok) { - throw new Error(`HTTP error! status: ${generateCodeResponse.status}`) - } - - const reader = generateCodeResponse.body?.getReader() - const decoder = new TextDecoder() - let result = "" - - if (reader) { - while (true) { - const { done, value } = await reader.read() - if (done) break - result += decoder.decode(value, { stream: true }) - } - } - - // The result should now contain only the modified code - return { response: result.trim(), success: true } - } catch (e: any) { - console.error("Error generating code:", e) - return { - response: "Error generating code. Please try again.", - success: false, - } - } - } -} diff --git a/backend/server/src/ConnectionManager.ts b/backend/server/src/ConnectionManager.ts index 45b5432..a95f82e 100644 --- a/backend/server/src/ConnectionManager.ts +++ b/backend/server/src/ConnectionManager.ts @@ -1,58 +1,61 @@ import { Socket } from "socket.io" class Counter { - private count: number = 0 + private count: number = 0 - increment() { - this.count++ - } + increment() { + this.count++ + } - decrement() { - this.count = Math.max(0, this.count - 1) - } + decrement() { + this.count = Math.max(0, this.count - 1) + } - getValue(): number { - return this.count - } + getValue(): number { + return this.count + } } // Owner Connection Management export class ConnectionManager { - // Counts how many times the owner is connected to a sandbox - private ownerConnections: Record = {} - // Stores all sockets connected to a given sandbox - private sockets: Record> = {} + // Counts how many times the owner is connected to a sandbox + private ownerConnections: Record = {} + // Stores all sockets connected to a given sandbox + private sockets: Record> = {} - // Checks if the owner of a sandbox is connected - ownerIsConnected(sandboxId: string): boolean { - return this.ownerConnections[sandboxId]?.getValue() > 0 + // Checks if the owner of a sandbox is connected + ownerIsConnected(sandboxId: string): boolean { + return this.ownerConnections[sandboxId]?.getValue() > 0 + } + + // Adds a connection for a sandbox + addConnectionForSandbox(socket: Socket, sandboxId: string, isOwner: boolean) { + this.sockets[sandboxId] ??= new Set() + this.sockets[sandboxId].add(socket) + + // If the connection is for the owner, increments the owner connection counter + if (isOwner) { + this.ownerConnections[sandboxId] ??= new Counter() + this.ownerConnections[sandboxId].increment() } + } - // Adds a connection for a sandbox - addConnectionForSandbox(socket: Socket, sandboxId: string, isOwner: boolean) { - this.sockets[sandboxId] ??= new Set() - this.sockets[sandboxId].add(socket) + // Removes a connection for a sandbox + removeConnectionForSandbox( + socket: Socket, + sandboxId: string, + isOwner: boolean + ) { + this.sockets[sandboxId]?.delete(socket) - // If the connection is for the owner, increments the owner connection counter - if (isOwner) { - this.ownerConnections[sandboxId] ??= new Counter() - this.ownerConnections[sandboxId].increment() - } + // If the connection being removed is for the owner, decrements the owner connection counter + if (isOwner) { + this.ownerConnections[sandboxId]?.decrement() } + } - // Removes a connection for a sandbox - removeConnectionForSandbox(socket: Socket, sandboxId: string, isOwner: boolean) { - this.sockets[sandboxId]?.delete(socket) - - // If the connection being removed is for the owner, decrements the owner connection counter - if (isOwner) { - this.ownerConnections[sandboxId]?.decrement() - } - } - - // Returns the set of sockets connected to a given sandbox - connectionsForSandbox(sandboxId: string): Set { - return this.sockets[sandboxId] ?? new Set(); - } - -} \ No newline at end of file + // Returns the set of sockets connected to a given sandbox + connectionsForSandbox(sandboxId: string): Set { + return this.sockets[sandboxId] ?? new Set() + } +} diff --git a/backend/server/src/FileManager.ts b/backend/server/src/FileManager.ts index abc48f2..86c003d 100644 --- a/backend/server/src/FileManager.ts +++ b/backend/server/src/FileManager.ts @@ -1,4 +1,5 @@ import { FilesystemEvent, Sandbox, WatchHandle } from "e2b" +import JSZip from "jszip" import path from "path" import RemoteFileStorage from "./RemoteFileStorage" import { MAX_BODY_SIZE } from "./ratelimit" @@ -23,7 +24,11 @@ function generateFileStructure(paths: string[]): (TFolder | TFile)[] { } } else { if (isFile) { - const file: TFile = { id: `/${parts.join("/")}`, type: "file", name: part } + const file: TFile = { + id: `/${parts.join("/")}`, + type: "file", + name: part, + } current.children.push(file) } else { const folder: TFolder = { @@ -75,7 +80,9 @@ export class FileManager { if (isFile) { const fileId = `/${parts.join("/")}` - const data = await RemoteFileStorage.fetchFileContent(`projects/${this.sandboxId}${fileId}`) + const data = await RemoteFileStorage.fetchFileContent( + `projects/${this.sandboxId}${fileId}` + ) fileData.push({ id: fileId, data }) } } @@ -91,7 +98,7 @@ export class FileManager { // Convert remote file path to local file path private getLocalFileId(remoteId: string): string | undefined { const allParts = remoteId.split("/") - if (allParts[1] !== this.sandboxId) return undefined; + if (allParts[1] !== this.sandboxId) return undefined return allParts.slice(2).join("/") } @@ -99,7 +106,7 @@ export class FileManager { private getLocalFileIds(remoteIds: string[]): string[] { return remoteIds .map(this.getLocalFileId.bind(this)) - .filter((id) => id !== undefined); + .filter((id) => id !== undefined) } // Download files from remote storage @@ -118,9 +125,21 @@ export class FileManager { return this.files } + private async loadLocalFiles() { + // Reload file list from the container to include template files + const result = await this.sandbox.commands.run( + `find "${this.dirName}" -type f` + ) // List all files recursively + + const localPaths = result.stdout.split("\n").filter((path) => path) // Split the output into an array and filter out empty strings + const relativePaths = localPaths.map((filePath) => + path.posix.relative(this.dirName, filePath) + ) // Convert absolute paths to relative paths + this.files = generateFileStructure(relativePaths) + } + // Initialize the FileManager async initialize() { - // Download files from remote file storage await this.updateFileStructure() await this.updateFileData() @@ -140,11 +159,7 @@ export class FileManager { }) await Promise.all(promises) - // Reload file list from the container to include template files - const result = await this.sandbox.commands.run(`find "${this.dirName}" -type f`); // List all files recursively - const localPaths = result.stdout.split('\n').filter(path => path); // Split the output into an array and filter out empty strings - const relativePaths = localPaths.map(filePath => path.posix.relative(this.dirName, filePath)); // Convert absolute paths to relative paths - this.files = generateFileStructure(relativePaths); + await this.loadLocalFiles() // Make the logged in user the owner of all project files this.fixPermissions() @@ -169,9 +184,7 @@ export class FileManager { // Change the owner of the project directory to user private async fixPermissions() { try { - await this.sandbox.commands.run( - `sudo chown -R user "${this.dirName}"` - ) + await this.sandbox.commands.run(`sudo chown -R user "${this.dirName}"`) } catch (e: any) { console.log("Failed to fix permissions: " + e) } @@ -180,7 +193,7 @@ export class FileManager { // Watch a directory for changes async watchDirectory(directory: string): Promise { try { - const handle = await this.sandbox.files.watch( + const handle = await this.sandbox.files.watchDir( directory, async (event: FilesystemEvent) => { try { @@ -193,7 +206,10 @@ export class FileManager { // This is the absolute file path in the container const containerFilePath = path.posix.join(directory, event.name) // This is the file path relative to the project directory - const sandboxFilePath = removeDirName(containerFilePath, this.dirName) + const sandboxFilePath = removeDirName( + containerFilePath, + this.dirName + ) // This is the directory being watched relative to the project directory const sandboxDirectory = removeDirName(directory, this.dirName) @@ -210,77 +226,13 @@ export class FileManager { // Handle file/directory creation event if (event.type === "create") { - const folder = findFolderById( - this.files, - sandboxDirectory - ) as TFolder - const isDir = await this.isDirectory(containerFilePath) - - const newItem = isDir - ? ({ - id: sandboxFilePath, - name: event.name, - type: "folder", - children: [], - } as TFolder) - : ({ - id: sandboxFilePath, - name: event.name, - type: "file", - } as TFile) - - if (folder) { - // If the folder exists, add the new item (file/folder) as a child - folder.children.push(newItem) - } else { - // If folder doesn't exist, add the new item to the root - this.files.push(newItem) - } - - if (!isDir) { - const fileData = await this.sandbox.files.read( - containerFilePath - ) - const fileContents = - typeof fileData === "string" ? fileData : "" - this.fileData.push({ - id: sandboxFilePath, - data: fileContents, - }) - } - + await this.loadLocalFiles() console.log(`Create ${sandboxFilePath}`) } // Handle file/directory removal or rename event else if (event.type === "remove" || event.type == "rename") { - const folder = findFolderById( - this.files, - sandboxDirectory - ) as TFolder - const isDir = await this.isDirectory(containerFilePath) - - const isFileMatch = (file: TFolder | TFile | TFileData) => - file.id === sandboxFilePath || - file.id.startsWith(containerFilePath + "/") - - if (folder) { - // Remove item from its parent folder - folder.children = folder.children.filter( - (file: TFolder | TFile) => !isFileMatch(file) - ) - } else { - // Remove from the root if it's not inside a folder - this.files = this.files.filter( - (file: TFolder | TFile) => !isFileMatch(file) - ) - } - - // Also remove any corresponding file data - this.fileData = this.fileData.filter( - (file: TFileData) => !isFileMatch(file) - ) - + await this.loadLocalFiles() console.log(`Removed: ${sandboxFilePath}`) } @@ -330,7 +282,7 @@ export class FileManager { ) } }, - { timeout: 0 } + { timeoutMs: 0 } ) this.fileWatchers.push(handle) return handle @@ -361,7 +313,9 @@ export class FileManager { // Get folder content async getFolder(folderId: string): Promise { - const remotePaths = await RemoteFileStorage.getFolder(this.getRemoteFileId(folderId)) + const remotePaths = await RemoteFileStorage.getFolder( + this.getRemoteFileId(folderId) + ) return this.getLocalFileIds(remotePaths) } @@ -373,11 +327,20 @@ export class FileManager { throw new Error("File size too large. Please reduce the file size.") } await RemoteFileStorage.saveFile(this.getRemoteFileId(fileId), body) - const file = this.fileData.find((f) => f.id === fileId) - if (!file) return - file.data = body - await this.sandbox.files.write(path.posix.join(this.dirName, file.id), body) + let file = this.fileData.find((f) => f.id === fileId) + if (file) { + file.data = body + } else { + // If the file wasn't in our cache, add it + file = { + id: fileId, + data: body, + } + this.fileData.push(file) + } + + await this.sandbox.files.write(path.posix.join(this.dirName, fileId), body) this.fixPermissions() } @@ -400,7 +363,11 @@ export class FileManager { fileData.id = newFileId file.id = newFileId - await RemoteFileStorage.renameFile(this.getRemoteFileId(fileId), this.getRemoteFileId(newFileId), fileData.data) + await RemoteFileStorage.renameFile( + this.getRemoteFileId(fileId), + this.getRemoteFileId(newFileId), + fileData.data + ) return this.updateFileStructure() } @@ -432,22 +399,88 @@ export class FileManager { await this.sandbox.files.write(path.posix.join(this.dirName, id), "") await this.fixPermissions() - this.files.push({ - id, - name, - type: "file", - }) - - this.fileData.push({ - id, - data: "", - }) - await RemoteFileStorage.createFile(this.getRemoteFileId(id)) return true } + public async loadFileContent(): Promise { + // Get all file paths, excluding node_modules + const result = await this.sandbox.commands.run( + `find "${this.dirName}" -path "${this.dirName}/node_modules" -prune -o -type f -print` + ) + const filePaths = result.stdout.split("\n").filter((path) => path) ?? [] + + console.log("Paths found for download (excluding node_modules):", filePaths) + + // Add files to zip with synchronized content + for (const filePath of filePaths) { + const relativePath = filePath.replace(this.dirName, "") // Remove base directory from path + try { + // Read the file content from the sandbox + const content = await this.sandbox.files.read(filePath) + + // Find the existing file data entry or create a new one + const fileDataEntry = this.fileData.find( + (f) => f.id === relativePath + ) || { + id: relativePath, + data: typeof content === "string" ? content : "", + } + + // Update the file data entry if it already exists, otherwise add it to the list + if (!this.fileData.includes(fileDataEntry)) { + this.fileData.push(fileDataEntry) + } else { + fileDataEntry.data = typeof content === "string" ? content : "" + } + } catch (error) { + console.error(`Failed to read content for ${relativePath}:`, error) + } + } + + return this.fileData + } + + public async getFilesForDownload(): Promise { + // Create new JSZip instance + const zip = new JSZip() + + await this.loadFileContent() + + if (this.fileData.length === 0) { + console.error( + "No files found in the sandbox project directory for download." + ) + return "" + } + + // Add files to zip with synchronized content + for (const fileDataEntry of this.fileData) { + const relativePath = fileDataEntry.id + const content = fileDataEntry.data + zip.file(relativePath, content) + console.log(`Added file to ZIP: ${relativePath}`) + } + + // Generate zip file + const zipBlob = await zip.generateAsync({ + type: "blob", + compression: "DEFLATE", + compressionOptions: { + level: 6, + }, + }) + + // Convert Blob to Base64 + const zipBlobArrayBuffer = await zipBlob.arrayBuffer() + const zipBlobBase64 = btoa( + String.fromCharCode(...new Uint8Array(zipBlobArrayBuffer)) + ) + + return zipBlobBase64 + } + // Create a new folder async createFolder(name: string): Promise { const id = `/${name}` @@ -465,7 +498,11 @@ export class FileManager { await this.moveFileInContainer(fileId, newFileId) await this.fixPermissions() - await RemoteFileStorage.renameFile(this.getRemoteFileId(fileId), this.getRemoteFileId(newFileId), fileData.data) + await RemoteFileStorage.renameFile( + this.getRemoteFileId(fileId), + this.getRemoteFileId(newFileId), + fileData.data + ) fileData.id = newFileId file.id = newFileId @@ -477,9 +514,6 @@ export class FileManager { if (!file) return this.files await this.sandbox.files.remove(path.posix.join(this.dirName, fileId)) - this.fileData = this.fileData.filter( - (f) => f.id !== fileId - ) await RemoteFileStorage.deleteFile(this.getRemoteFileId(fileId)) return this.updateFileStructure() @@ -487,14 +521,13 @@ export class FileManager { // Delete a folder async deleteFolder(folderId: string): Promise<(TFolder | TFile)[]> { - const files = await RemoteFileStorage.getFolder(this.getRemoteFileId(folderId)) + const files = await RemoteFileStorage.getFolder( + this.getRemoteFileId(folderId) + ) await Promise.all( files.map(async (file) => { await this.sandbox.files.remove(path.posix.join(this.dirName, file)) - this.fileData = this.fileData.filter( - (f) => f.id !== file - ) await RemoteFileStorage.deleteFile(this.getRemoteFileId(file)) }) ) @@ -506,7 +539,7 @@ export class FileManager { async closeWatchers() { await Promise.all( this.fileWatchers.map(async (handle: WatchHandle) => { - await handle.close() + await handle.stop() }) ) } diff --git a/backend/server/src/RemoteFileStorage.ts b/backend/server/src/RemoteFileStorage.ts index e5ed4b2..ff705d2 100644 --- a/backend/server/src/RemoteFileStorage.ts +++ b/backend/server/src/RemoteFileStorage.ts @@ -61,11 +61,7 @@ export const RemoteFileStorage = { return res.ok }, - renameFile: async ( - fileId: string, - newFileId: string, - data: string - ) => { + renameFile: async (fileId: string, newFileId: string, data: string) => { const res = await fetch(`${process.env.STORAGE_WORKER_URL}/api/rename`, { method: "POST", headers: { @@ -111,7 +107,7 @@ export const RemoteFileStorage = { } ) return (await res.json()).size - } + }, } -export default RemoteFileStorage \ No newline at end of file +export default RemoteFileStorage diff --git a/backend/server/src/Sandbox.ts b/backend/server/src/Sandbox.ts index 5de7754..085135d 100644 --- a/backend/server/src/Sandbox.ts +++ b/backend/server/src/Sandbox.ts @@ -1,262 +1,269 @@ import { Sandbox as E2BSandbox } from "e2b" import { Socket } from "socket.io" -import { AIWorker } from "./AIWorker" import { CONTAINER_TIMEOUT } from "./constants" import { DokkuClient } from "./DokkuClient" import { FileManager } from "./FileManager" import { - createFileRL, - createFolderRL, - deleteFileRL, - renameFileRL, - saveFileRL, + createFileRL, + createFolderRL, + deleteFileRL, + renameFileRL, + saveFileRL, } from "./ratelimit" import { SecureGitClient } from "./SecureGitClient" import { TerminalManager } from "./TerminalManager" -import { TFile, TFileData, TFolder } from "./types" +import { TFile, TFolder } from "./types" import { LockManager } from "./utils" const lockManager = new LockManager() // Define a type for SocketHandler functions -type SocketHandler> = (args: T) => any; +type SocketHandler> = (args: T) => any // Extract port number from a string function extractPortNumber(inputString: string): number | null { - const cleanedString = inputString.replace(/\x1B\[[0-9;]*m/g, "") - const regex = /http:\/\/localhost:(\d+)/ - const match = cleanedString.match(regex) - return match ? parseInt(match[1]) : null + const cleanedString = inputString.replace(/\x1B\[[0-9;]*m/g, "") + const regex = /http:\/\/localhost:(\d+)/ + const match = cleanedString.match(regex) + return match ? parseInt(match[1]) : null } type ServerContext = { - aiWorker: AIWorker; - dokkuClient: DokkuClient | null; - gitClient: SecureGitClient | null; -}; + dokkuClient: DokkuClient | null + gitClient: SecureGitClient | null +} export class Sandbox { + // Sandbox properties: + sandboxId: string + type: string + fileManager: FileManager | null + terminalManager: TerminalManager | null + container: E2BSandbox | null + // Server context: + dokkuClient: DokkuClient | null + gitClient: SecureGitClient | null + + constructor( + sandboxId: string, + type: string, + { dokkuClient, gitClient }: ServerContext + ) { // Sandbox properties: - sandboxId: string; - type: string; - fileManager: FileManager | null; - terminalManager: TerminalManager | null; - container: E2BSandbox | null; + this.sandboxId = sandboxId + this.type = type + this.fileManager = null + this.terminalManager = null + this.container = null // Server context: - dokkuClient: DokkuClient | null; - gitClient: SecureGitClient | null; - aiWorker: AIWorker; + this.dokkuClient = dokkuClient + this.gitClient = gitClient + } - constructor(sandboxId: string, type: string, { aiWorker, dokkuClient, gitClient }: ServerContext) { - // Sandbox properties: - this.sandboxId = sandboxId; - this.type = type; - this.fileManager = null; - this.terminalManager = null; - this.container = null; - // Server context: - this.aiWorker = aiWorker; - this.dokkuClient = dokkuClient; - this.gitClient = gitClient; - } - - // Initializes the container for the sandbox environment - async initialize( - fileWatchCallback: ((files: (TFolder | TFile)[]) => void) | undefined - ) { - // Acquire a lock to ensure exclusive access to the sandbox environment - await lockManager.acquireLock(this.sandboxId, async () => { - // Check if a container already exists and is running - if (this.container && await this.container.isRunning()) { - console.log(`Found existing container ${this.sandboxId}`) - } else { - console.log("Creating container", this.sandboxId) - // Create a new container with a specified template and timeout - const templateTypes = ["vanillajs", "reactjs", "nextjs", "streamlit"]; - const template = templateTypes.includes(this.type) - ? `gitwit-${this.type}` - : `base`; - this.container = await E2BSandbox.create(template, { - timeoutMs: CONTAINER_TIMEOUT, - }) - } + // Initializes the container for the sandbox environment + async initialize( + fileWatchCallback: ((files: (TFolder | TFile)[]) => void) | undefined + ) { + // Acquire a lock to ensure exclusive access to the sandbox environment + await lockManager.acquireLock(this.sandboxId, async () => { + // Check if a container already exists and is running + if (this.container && (await this.container.isRunning())) { + console.log(`Found existing container ${this.sandboxId}`) + } else { + console.log("Creating container", this.sandboxId) + // Create a new container with a specified template and timeout + const templateTypes = [ + "vanillajs", + "reactjs", + "nextjs", + "streamlit", + "php", + ] + const template = templateTypes.includes(this.type) + ? `gitwit-${this.type}` + : `base` + this.container = await E2BSandbox.create(template, { + timeoutMs: CONTAINER_TIMEOUT, }) - // Ensure a container was successfully created - if (!this.container) throw new Error("Failed to create container") + } + }) + // Ensure a container was successfully created + if (!this.container) throw new Error("Failed to create container") - // Initialize the terminal manager if it hasn't been set up yet - if (!this.terminalManager) { - this.terminalManager = new TerminalManager(this.container) - console.log(`Terminal manager set up for ${this.sandboxId}`) - } - - // Initialize the file manager if it hasn't been set up yet - if (!this.fileManager) { - this.fileManager = new FileManager( - this.sandboxId, - this.container, - fileWatchCallback ?? null - ) - // Initialize the file manager and emit the initial files - await this.fileManager.initialize() - } + // Initialize the terminal manager if it hasn't been set up yet + if (!this.terminalManager) { + this.terminalManager = new TerminalManager(this.container) + console.log(`Terminal manager set up for ${this.sandboxId}`) } - // Called when the client disconnects from the Sandbox - async disconnect() { - // Close all terminals managed by the terminal manager - await this.terminalManager?.closeAllTerminals() - // This way the terminal manager will be set up again if we reconnect - this.terminalManager = null; - // Close all file watchers managed by the file manager - await this.fileManager?.closeWatchers() - // This way the file manager will be set up again if we reconnect - this.fileManager = null; + // Initialize the file manager if it hasn't been set up yet + if (!this.fileManager) { + this.fileManager = new FileManager( + this.sandboxId, + this.container, + fileWatchCallback ?? null + ) + // Initialize the file manager and emit the initial files + await this.fileManager.initialize() + } + } + + // Called when the client disconnects from the Sandbox + async disconnect() { + // Close all terminals managed by the terminal manager + await this.terminalManager?.closeAllTerminals() + // This way the terminal manager will be set up again if we reconnect + this.terminalManager = null + // Close all file watchers managed by the file manager + await this.fileManager?.closeWatchers() + // This way the file manager will be set up again if we reconnect + this.fileManager = null + } + + handlers(connection: { userId: string; isOwner: boolean; socket: Socket }) { + // Handle heartbeat from a socket connection + const handleHeartbeat: SocketHandler = (_: any) => { + // Only keep the sandbox alive if the owner is still connected + if (connection.isOwner) { + this.container?.setTimeout(CONTAINER_TIMEOUT) + } } - handlers(connection: { userId: string, isOwner: boolean, socket: Socket }) { + // Handle getting a file + const handleGetFile: SocketHandler = ({ fileId }: any) => { + return this.fileManager?.getFile(fileId) + } - // Handle heartbeat from a socket connection - const handleHeartbeat: SocketHandler = (_: any) => { - // Only keep the sandbox alive if the owner is still connected - if (connection.isOwner) { - this.container?.setTimeout(CONTAINER_TIMEOUT) - } - } + // Handle getting a folder + const handleGetFolder: SocketHandler = ({ folderId }: any) => { + return this.fileManager?.getFolder(folderId) + } - // Handle getting a file - const handleGetFile: SocketHandler = ({ fileId }: any) => { - return this.fileManager?.getFile(fileId) - } + // Handle saving a file + const handleSaveFile: SocketHandler = async ({ fileId, body }: any) => { + await saveFileRL.consume(connection.userId, 1) + return this.fileManager?.saveFile(fileId, body) + } - // Handle getting a folder - const handleGetFolder: SocketHandler = ({ folderId }: any) => { - return this.fileManager?.getFolder(folderId) - } + // Handle moving a file + const handleMoveFile: SocketHandler = ({ fileId, folderId }: any) => { + return this.fileManager?.moveFile(fileId, folderId) + } - // Handle saving a file - const handleSaveFile: SocketHandler = async ({ fileId, body }: any) => { - await saveFileRL.consume(connection.userId, 1); - return this.fileManager?.saveFile(fileId, body) - } + // Handle listing apps + const handleListApps: SocketHandler = async (_: any) => { + if (!this.dokkuClient) + throw Error("Failed to retrieve apps list: No Dokku client") + return { success: true, apps: await this.dokkuClient.listApps() } + } - // Handle moving a file - const handleMoveFile: SocketHandler = ({ fileId, folderId }: any) => { - return this.fileManager?.moveFile(fileId, folderId) - } + // Handle deploying code + const handleDeploy: SocketHandler = async (_: any) => { + if (!this.gitClient) throw Error("No git client") + if (!this.fileManager) throw Error("No file manager") + await this.gitClient.pushFiles( + await this.fileManager?.loadFileContent(), + this.sandboxId + ) + return { success: true } + } - // Handle listing apps - const handleListApps: SocketHandler = async (_: any) => { - if (!this.dokkuClient) throw Error("Failed to retrieve apps list: No Dokku client") - return { success: true, apps: await this.dokkuClient.listApps() } - } + // Handle creating a file + const handleCreateFile: SocketHandler = async ({ name }: any) => { + await createFileRL.consume(connection.userId, 1) + return { success: await this.fileManager?.createFile(name) } + } - // Handle deploying code - const handleDeploy: SocketHandler = async (_: any) => { - if (!this.gitClient) throw Error("No git client") - if (!this.fileManager) throw Error("No file manager") - await this.gitClient.pushFiles(this.fileManager?.fileData, this.sandboxId) - return { success: true } - } + // Handle creating a folder + const handleCreateFolder: SocketHandler = async ({ name }: any) => { + await createFolderRL.consume(connection.userId, 1) + return { success: await this.fileManager?.createFolder(name) } + } - // Handle creating a file - const handleCreateFile: SocketHandler = async ({ name }: any) => { - await createFileRL.consume(connection.userId, 1); - return { "success": await this.fileManager?.createFile(name) } - } + // Handle renaming a file + const handleRenameFile: SocketHandler = async ({ + fileId, + newName, + }: any) => { + await renameFileRL.consume(connection.userId, 1) + return this.fileManager?.renameFile(fileId, newName) + } - // Handle creating a folder - const handleCreateFolder: SocketHandler = async ({ name }: any) => { - await createFolderRL.consume(connection.userId, 1); - return { "success": await this.fileManager?.createFolder(name) } - } + // Handle deleting a file + const handleDeleteFile: SocketHandler = async ({ fileId }: any) => { + await deleteFileRL.consume(connection.userId, 1) + return this.fileManager?.deleteFile(fileId) + } - // Handle renaming a file - const handleRenameFile: SocketHandler = async ({ fileId, newName }: any) => { - await renameFileRL.consume(connection.userId, 1) - return this.fileManager?.renameFile(fileId, newName) - } + // Handle deleting a folder + const handleDeleteFolder: SocketHandler = ({ folderId }: any) => { + return this.fileManager?.deleteFolder(folderId) + } - // Handle deleting a file - const handleDeleteFile: SocketHandler = async ({ fileId }: any) => { - await deleteFileRL.consume(connection.userId, 1) - return this.fileManager?.deleteFile(fileId) - } - - // Handle deleting a folder - const handleDeleteFolder: SocketHandler = ({ folderId }: any) => { - return this.fileManager?.deleteFolder(folderId) - } - - // Handle creating a terminal session - const handleCreateTerminal: SocketHandler = async ({ id }: any) => { - await lockManager.acquireLock(this.sandboxId, async () => { - await this.terminalManager?.createTerminal(id, (responseString: string) => { - connection.socket.emit("terminalResponse", { id, data: responseString }) - const port = extractPortNumber(responseString) - if (port) { - connection.socket.emit( - "previewURL", - "https://" + this.container?.getHost(port) - ) - } - }) + // Handle creating a terminal session + const handleCreateTerminal: SocketHandler = async ({ id }: any) => { + await lockManager.acquireLock(this.sandboxId, async () => { + await this.terminalManager?.createTerminal( + id, + (responseString: string) => { + connection.socket.emit("terminalResponse", { + id, + data: responseString, }) - } - - // Handle resizing a terminal - const handleResizeTerminal: SocketHandler = ({ dimensions }: any) => { - this.terminalManager?.resizeTerminal(dimensions) - } - - // Handle sending data to a terminal - const handleTerminalData: SocketHandler = ({ id, data }: any) => { - return this.terminalManager?.sendTerminalData(id, data) - } - - // Handle closing a terminal - const handleCloseTerminal: SocketHandler = ({ id }: any) => { - return this.terminalManager?.closeTerminal(id) - } - - // Handle generating code - const handleGenerateCode: SocketHandler = ({ fileName, code, line, instructions }: any) => { - return this.aiWorker.generateCode(connection.userId, fileName, code, line, instructions) - } - - // Handle downloading files by download button - const handleDownloadFiles: SocketHandler = async () => { - if (!this.fileManager) throw Error("No file manager") - - // Get all files with their data through fileManager - const files = this.fileManager.fileData.map((file: TFileData) => ({ - path: file.id.startsWith('/') ? file.id.slice(1) : file.id, - content: file.data - })) - - return { files } - } - - return { - "heartbeat": handleHeartbeat, - "getFile": handleGetFile, - "downloadFiles": handleDownloadFiles, - "getFolder": handleGetFolder, - "saveFile": handleSaveFile, - "moveFile": handleMoveFile, - "list": handleListApps, - "deploy": handleDeploy, - "createFile": handleCreateFile, - "createFolder": handleCreateFolder, - "renameFile": handleRenameFile, - "deleteFile": handleDeleteFile, - "deleteFolder": handleDeleteFolder, - "createTerminal": handleCreateTerminal, - "resizeTerminal": handleResizeTerminal, - "terminalData": handleTerminalData, - "closeTerminal": handleCloseTerminal, - "generateCode": handleGenerateCode, - }; - + const port = extractPortNumber(responseString) + if (port) { + connection.socket.emit( + "previewURL", + "https://" + this.container?.getHost(port) + ) + } + } + ) + }) } -} \ No newline at end of file + // Handle resizing a terminal + const handleResizeTerminal: SocketHandler = ({ dimensions }: any) => { + this.terminalManager?.resizeTerminal(dimensions) + } + + // Handle sending data to a terminal + const handleTerminalData: SocketHandler = ({ id, data }: any) => { + return this.terminalManager?.sendTerminalData(id, data) + } + + // Handle closing a terminal + const handleCloseTerminal: SocketHandler = ({ id }: any) => { + return this.terminalManager?.closeTerminal(id) + } + + // Handle downloading files by download button + const handleDownloadFiles: SocketHandler = async () => { + if (!this.fileManager) throw Error("No file manager") + + // Get the Base64 encoded ZIP string + const zipBase64 = await this.fileManager.getFilesForDownload() + + return { zipBlob: zipBase64 } + } + + return { + heartbeat: handleHeartbeat, + getFile: handleGetFile, + downloadFiles: handleDownloadFiles, + getFolder: handleGetFolder, + saveFile: handleSaveFile, + moveFile: handleMoveFile, + list: handleListApps, + deploy: handleDeploy, + createFile: handleCreateFile, + createFolder: handleCreateFolder, + renameFile: handleRenameFile, + deleteFile: handleDeleteFile, + deleteFolder: handleDeleteFolder, + createTerminal: handleCreateTerminal, + resizeTerminal: handleResizeTerminal, + terminalData: handleTerminalData, + closeTerminal: handleCloseTerminal, + } + } +} diff --git a/backend/server/src/SecureGitClient.ts b/backend/server/src/SecureGitClient.ts index 34f5322..faf8f14 100644 --- a/backend/server/src/SecureGitClient.ts +++ b/backend/server/src/SecureGitClient.ts @@ -57,7 +57,7 @@ export class SecureGitClient { // Add files to the repository for (const { id, data } of fileData) { - await git.add(id) + await git.add(id.startsWith("/") ? id.slice(1) : id) } // Commit the changes diff --git a/backend/server/src/Terminal.ts b/backend/server/src/Terminal.ts index 482b8a4..588112d 100644 --- a/backend/server/src/Terminal.ts +++ b/backend/server/src/Terminal.ts @@ -1,8 +1,8 @@ -import { ProcessHandle, Sandbox } from "e2b" +import { CommandHandle, Sandbox } from "e2b" // Terminal class to manage a pseudo-terminal (PTY) in a sandbox environment export class Terminal { - private pty: ProcessHandle | undefined // Holds the PTY process handle + private pty: CommandHandle | undefined // Holds the PTY process handle private sandbox: Sandbox // Reference to the sandbox environment // Constructor initializes the Terminal with a sandbox @@ -24,7 +24,7 @@ export class Terminal { this.pty = await this.sandbox.pty.create({ rows, cols, - timeout: 0, + timeoutMs: 0, onData: (data: Uint8Array) => { onData(new TextDecoder().decode(data)) // Convert received data to string and pass to handler }, diff --git a/backend/server/src/constants.ts b/backend/server/src/constants.ts index dfd5ce3..3c7dcfb 100644 --- a/backend/server/src/constants.ts +++ b/backend/server/src/constants.ts @@ -1,2 +1,2 @@ // The amount of time in ms that a container will stay alive without a hearbeat. -export const CONTAINER_TIMEOUT = 120_000 \ No newline at end of file +export const CONTAINER_TIMEOUT = 120_000 diff --git a/backend/server/src/index.ts b/backend/server/src/index.ts index e1e5eda..873ab8c 100644 --- a/backend/server/src/index.ts +++ b/backend/server/src/index.ts @@ -4,20 +4,19 @@ import express, { Express } from "express" import fs from "fs" import { createServer } from "http" import { Server, Socket } from "socket.io" -import { AIWorker } from "./AIWorker" import { ConnectionManager } from "./ConnectionManager" import { DokkuClient } from "./DokkuClient" import { Sandbox } from "./Sandbox" import { SecureGitClient } from "./SecureGitClient" -import { socketAuth } from "./socketAuth"; // Import the new socketAuth middleware +import { socketAuth } from "./socketAuth" // Import the new socketAuth middleware import { TFile, TFolder } from "./types" // Log errors and send a notification to the client export const handleErrors = (message: string, error: any, socket: Socket) => { - console.error(message, error); - socket.emit("error", `${message} ${error.message ?? error}`); -}; + console.error(message, error) + socket.emit("error", `${message} ${error.message ?? error}`) +} // Handle uncaught exceptions process.on("uncaughtException", (error) => { @@ -64,10 +63,10 @@ if (!process.env.DOKKU_KEY) const dokkuClient = process.env.DOKKU_HOST && process.env.DOKKU_KEY && process.env.DOKKU_USERNAME ? new DokkuClient({ - host: process.env.DOKKU_HOST, - username: process.env.DOKKU_USERNAME, - privateKey: fs.readFileSync(process.env.DOKKU_KEY), - }) + host: process.env.DOKKU_HOST, + username: process.env.DOKKU_USERNAME, + privateKey: fs.readFileSync(process.env.DOKKU_KEY), + }) : null dokkuClient?.connect() @@ -75,19 +74,11 @@ dokkuClient?.connect() const gitClient = process.env.DOKKU_HOST && process.env.DOKKU_KEY ? new SecureGitClient( - `dokku@${process.env.DOKKU_HOST}`, - process.env.DOKKU_KEY - ) + `dokku@${process.env.DOKKU_HOST}`, + process.env.DOKKU_KEY + ) : null -// Add this near the top of the file, after other initializations -const aiWorker = new AIWorker( - process.env.AI_WORKER_URL!, - process.env.CF_AI_KEY!, - process.env.DATABASE_WORKER_URL!, - process.env.WORKERS_KEY! -) - // Handle a client connecting to the server io.on("connection", async (socket) => { try { @@ -110,21 +101,22 @@ io.on("connection", async (socket) => { try { // Create or retrieve the sandbox manager for the given sandbox ID - const sandbox = sandboxes[data.sandboxId] ?? new Sandbox( - data.sandboxId, - data.type, - { - aiWorker, dokkuClient, gitClient, - } - ) + const sandbox = + sandboxes[data.sandboxId] ?? + new Sandbox(data.sandboxId, data.type, { + dokkuClient, + gitClient, + }) sandboxes[data.sandboxId] = sandbox // This callback recieves an update when the file list changes, and notifies all relevant connections. const sendFileNotifications = (files: (TFolder | TFile)[]) => { - connections.connectionsForSandbox(data.sandboxId).forEach((socket: Socket) => { - socket.emit("loaded", files); - }); - }; + connections + .connectionsForSandbox(data.sandboxId) + .forEach((socket: Socket) => { + socket.emit("loaded", files) + }) + } // Initialize the sandbox container // The file manager and terminal managers will be set up if they have been closed @@ -134,26 +126,35 @@ io.on("connection", async (socket) => { // Register event handlers for the sandbox // For each event handler, listen on the socket for that event // Pass connection-specific information to the handlers - Object.entries(sandbox.handlers({ - userId: data.userId, - isOwner: data.isOwner, - socket - })).forEach(([event, handler]) => { - socket.on(event, async (options: any, callback?: (response: any) => void) => { - try { - const result = await handler(options) - callback?.(result); - } catch (e: any) { - handleErrors(`Error processing event "${event}":`, e, socket); + Object.entries( + sandbox.handlers({ + userId: data.userId, + isOwner: data.isOwner, + socket, + }) + ).forEach(([event, handler]) => { + socket.on( + event, + async (options: any, callback?: (response: any) => void) => { + try { + const result = await handler(options) + callback?.(result) + } catch (e: any) { + handleErrors(`Error processing event "${event}":`, e, socket) + } } - }); - }); + ) + }) // Handle disconnection event socket.on("disconnect", async () => { try { // Deregister the connection - connections.removeConnectionForSandbox(socket, data.sandboxId, data.isOwner) + connections.removeConnectionForSandbox( + socket, + data.sandboxId, + data.isOwner + ) // If the owner has disconnected from all sockets, close open terminals and file watchers.o // The sandbox itself will timeout after the heartbeat stops. @@ -165,20 +166,18 @@ io.on("connection", async (socket) => { ) } } catch (e: any) { - handleErrors("Error disconnecting:", e, socket); + handleErrors("Error disconnecting:", e, socket) } }) - } catch (e: any) { - handleErrors(`Error initializing sandbox ${data.sandboxId}:`, e, socket); + handleErrors(`Error initializing sandbox ${data.sandboxId}:`, e, socket) } - } catch (e: any) { - handleErrors("Error connecting:", e, socket); + handleErrors("Error connecting:", e, socket) } }) // Start the server httpServer.listen(port, () => { console.log(`Server running on port ${port}`) -}) \ No newline at end of file +}) diff --git a/backend/server/src/socketAuth.ts b/backend/server/src/socketAuth.ts index 030a89b..532e462 100644 --- a/backend/server/src/socketAuth.ts +++ b/backend/server/src/socketAuth.ts @@ -4,72 +4,72 @@ import { Sandbox, User } from "./types" // Middleware for socket authentication export const socketAuth = async (socket: Socket, next: Function) => { - // Define the schema for handshake query validation - const handshakeSchema = z.object({ - userId: z.string(), - sandboxId: z.string(), - EIO: z.string(), - transport: z.string(), - }) + // Define the schema for handshake query validation + const handshakeSchema = z.object({ + userId: z.string(), + sandboxId: z.string(), + EIO: z.string(), + transport: z.string(), + }) - const q = socket.handshake.query - const parseQuery = handshakeSchema.safeParse(q) + const q = socket.handshake.query + const parseQuery = handshakeSchema.safeParse(q) - // Check if the query is valid according to the schema - if (!parseQuery.success) { - next(new Error("Invalid request.")) - return + // Check if the query is valid according to the schema + if (!parseQuery.success) { + next(new Error("Invalid request.")) + return + } + + const { sandboxId, userId } = parseQuery.data + // Fetch user data from the database + const dbUser = await fetch( + `${process.env.DATABASE_WORKER_URL}/api/user?id=${userId}`, + { + headers: { + Authorization: `${process.env.WORKERS_KEY}`, + }, } + ) + const dbUserJSON = (await dbUser.json()) as User - const { sandboxId, userId } = parseQuery.data - // Fetch user data from the database - const dbUser = await fetch( - `${process.env.DATABASE_WORKER_URL}/api/user?id=${userId}`, - { - headers: { - Authorization: `${process.env.WORKERS_KEY}`, - }, - } - ) - const dbUserJSON = (await dbUser.json()) as User - - // Fetch sandbox data from the database - const dbSandbox = await fetch( - `${process.env.DATABASE_WORKER_URL}/api/sandbox?id=${sandboxId}`, - { - headers: { - Authorization: `${process.env.WORKERS_KEY}`, - }, - } - ) - const dbSandboxJSON = (await dbSandbox.json()) as Sandbox - - // Check if user data was retrieved successfully - if (!dbUserJSON) { - next(new Error("DB error.")) - return + // Fetch sandbox data from the database + const dbSandbox = await fetch( + `${process.env.DATABASE_WORKER_URL}/api/sandbox?id=${sandboxId}`, + { + headers: { + Authorization: `${process.env.WORKERS_KEY}`, + }, } + ) + const dbSandboxJSON = (await dbSandbox.json()) as Sandbox - // Check if the user owns the sandbox or has shared access - const sandbox = dbUserJSON.sandbox.find((s) => s.id === sandboxId) - const sharedSandboxes = dbUserJSON.usersToSandboxes.find( - (uts) => uts.sandboxId === sandboxId - ) + // Check if user data was retrieved successfully + if (!dbUserJSON) { + next(new Error("DB error.")) + return + } - // If user doesn't own or have shared access to the sandbox, deny access - if (!sandbox && !sharedSandboxes) { - next(new Error("Invalid credentials.")) - return - } + // Check if the user owns the sandbox or has shared access + const sandbox = dbUserJSON.sandbox.find((s) => s.id === sandboxId) + const sharedSandboxes = dbUserJSON.usersToSandboxes.find( + (uts) => uts.sandboxId === sandboxId + ) - // Set socket data with user information - socket.data = { - userId, - sandboxId: sandboxId, - isOwner: sandbox !== undefined, - type: dbSandboxJSON.type - } + // If user doesn't own or have shared access to the sandbox, deny access + if (!sandbox && !sharedSandboxes) { + next(new Error("Invalid credentials.")) + return + } - // Allow the connection - next() + // Set socket data with user information + socket.data = { + userId, + sandboxId: sandboxId, + isOwner: sandbox !== undefined, + type: dbSandboxJSON.type, + } + + // Allow the connection + next() } diff --git a/backend/server/src/utils.ts b/backend/server/src/utils.ts index dd33984..5ae1377 100644 --- a/backend/server/src/utils.ts +++ b/backend/server/src/utils.ts @@ -20,4 +20,4 @@ export class LockManager { } return await this.locks[key] } -} \ No newline at end of file +} diff --git a/frontend/app/(app)/code/[id]/page.tsx b/frontend/app/(app)/code/[id]/page.tsx index b4aa09d..9ec40a5 100644 --- a/frontend/app/(app)/code/[id]/page.tsx +++ b/frontend/app/(app)/code/[id]/page.tsx @@ -1,4 +1,4 @@ -import { Room } from "@/components/editor/live/room" +// import { Room } from "@/components/editor/live/room" import Loading from "@/components/editor/loading" import Navbar from "@/components/editor/navbar" import { TerminalProvider } from "@/context/TerminalContext" @@ -51,7 +51,11 @@ const getSharedUsers = async (usersToSandboxes: UsersToSandboxes[]) => { } ) const userData: User = await userRes.json() - return { id: userData.id, name: userData.name, avatarUrl: userData.avatarUrl } + return { + id: userData.id, + name: userData.name, + avatarUrl: userData.avatarUrl, + } }) ) @@ -89,18 +93,20 @@ export default async function CodePage({ params }: { params: { id: string } }) { return ( <>
- + {/* */}
-
+ {/*
*/}
) diff --git a/frontend/app/api/ai/route.ts b/frontend/app/api/ai/route.ts new file mode 100644 index 0000000..7a95a8b --- /dev/null +++ b/frontend/app/api/ai/route.ts @@ -0,0 +1,171 @@ +import { currentUser } from "@clerk/nextjs" +import { Anthropic } from "@anthropic-ai/sdk" +import { TIERS } from "@/lib/tiers" +import { templateConfigs } from "@/lib/templates" + +const anthropic = new Anthropic({ + apiKey: process.env.ANTHROPIC_API_KEY!, +}) + +export async function POST(request: Request) { + try { + const user = await currentUser() + if (!user) { + return new Response("Unauthorized", { status: 401 }) + } + + // Check and potentially reset monthly usage + const resetResponse = await fetch( + `${process.env.NEXT_PUBLIC_DATABASE_WORKER_URL}/api/user/check-reset`, + { + method: "POST", + headers: { + Authorization: `${process.env.NEXT_PUBLIC_WORKERS_KEY}`, + "Content-Type": "application/json", + }, + body: JSON.stringify({ userId: user.id }), + } + ) + + if (!resetResponse.ok) { + console.error("Failed to check usage reset") + } + + // Get user data and check tier + const dbUser = await fetch( + `${process.env.NEXT_PUBLIC_DATABASE_WORKER_URL}/api/user?id=${user.id}`, + { + headers: { + Authorization: `${process.env.NEXT_PUBLIC_WORKERS_KEY}`, + }, + } + ) + const userData = await dbUser.json() + + // Get tier settings + const tierSettings = TIERS[userData.tier as keyof typeof TIERS] || TIERS.FREE + if (userData.generations >= tierSettings.generations) { + return new Response( + `AI generation limit reached for your ${userData.tier || "FREE"} tier`, + { status: 429 } + ) + } + + const { + messages, + context, + activeFileContent, + isEditMode, + fileName, + line, + templateType + } = await request.json() + + // Get template configuration + const templateConfig = templateConfigs[templateType] + + // Create template context + const templateContext = templateConfig ? ` +Project Template: ${templateConfig.name} + +File Structure: +${Object.entries(templateConfig.fileStructure) + .map(([path, info]) => `${path} - ${info.description}`) + .join('\n')} + +Conventions: +${templateConfig.conventions.join('\n')} + +Dependencies: +${JSON.stringify(templateConfig.dependencies, null, 2)} +` : '' + + // Create system message based on mode + let systemMessage + if (isEditMode) { + systemMessage = `You are an AI code editor working in a ${templateType} project. Your task is to modify the given code based on the user's instructions. Only output the modified code, without any explanations or markdown formatting. The code should be a direct replacement for the existing code. If there is no code to modify, refer to the active file content and only output the code that is relevant to the user's instructions. + +${templateContext} + +File: ${fileName} +Line: ${line} + +Context: +${context || "No additional context provided"} + +Active File Content: +${activeFileContent} + +Instructions: ${messages[0].content} + +Respond only with the modified code that can directly replace the existing code.` + } else { + systemMessage = `You are an intelligent programming assistant for a ${templateType} project. Please respond to the following request concisely. If your response includes code, please format it using triple backticks (\`\`\`) with the appropriate language identifier. For example: + + \`\`\`python + print("Hello, World!") + \`\`\` + + Provide a clear and concise explanation along with any code snippets. Keep your response brief and to the point. + +This is the project template: +${templateContext} + +${context ? `Context:\n${context}\n` : ""} +${activeFileContent ? `Active File Content:\n${activeFileContent}\n` : ""}` + } + + // Create stream response + const stream = await anthropic.messages.create({ + model: tierSettings.model, + max_tokens: tierSettings.maxTokens, + system: systemMessage, + messages: messages.map((msg: { role: string; content: string }) => ({ + role: msg.role === "human" ? "user" : "assistant", + content: msg.content, + })), + stream: true, + }) + + // Increment user's generation count + await fetch( + `${process.env.NEXT_PUBLIC_DATABASE_WORKER_URL}/api/user/increment-generations`, + { + method: "POST", + headers: { + Authorization: `${process.env.NEXT_PUBLIC_WORKERS_KEY}`, + "Content-Type": "application/json", + }, + body: JSON.stringify({ userId: user.id }), + } + ) + + // Return streaming response + const encoder = new TextEncoder() + return new Response( + new ReadableStream({ + async start(controller) { + for await (const chunk of stream) { + if (chunk.type === "content_block_delta" && chunk.delta.type === "text_delta") { + controller.enqueue(encoder.encode(chunk.delta.text)) + } + } + controller.close() + }, + }), + { + headers: { + "Content-Type": "text/plain; charset=utf-8", + "Cache-Control": "no-cache", + Connection: "keep-alive", + }, + } + ) + } catch (error) { + console.error("AI generation error:", error) + return new Response( + error instanceof Error ? error.message : "Internal Server Error", + { status: 500 } + ) + } +} \ No newline at end of file diff --git a/frontend/app/api/lb-auth/route.ts b/frontend/app/api/lb-auth/route.ts index 409ea87..d415055 100644 --- a/frontend/app/api/lb-auth/route.ts +++ b/frontend/app/api/lb-auth/route.ts @@ -1,57 +1,61 @@ -import { colors } from "@/lib/colors" -import { User } from "@/lib/types" +// import { colors } from "@/lib/colors" +// import { User } from "@/lib/types" import { currentUser } from "@clerk/nextjs" -import { Liveblocks } from "@liveblocks/node" +// import { Liveblocks } from "@liveblocks/node" import { NextRequest } from "next/server" -const API_KEY = process.env.LIVEBLOCKS_SECRET_KEY! +// const API_KEY = process.env.LIVEBLOCKS_SECRET_KEY! -const liveblocks = new Liveblocks({ - secret: API_KEY!, -}) +// const liveblocks = new Liveblocks({ +// secret: API_KEY!, +// }) export async function POST(request: NextRequest) { - const clerkUser = await currentUser() + // Temporarily return unauthorized while Liveblocks is disabled + return new Response("Liveblocks collaboration temporarily disabled", { status: 503 }) - if (!clerkUser) { - return new Response("Unauthorized", { status: 401 }) - } - - const res = await fetch( - `${process.env.NEXT_PUBLIC_DATABASE_WORKER_URL}/api/user?id=${clerkUser.id}`, - { - headers: { - Authorization: `${process.env.NEXT_PUBLIC_WORKERS_KEY}`, - }, - } - ) - const user = (await res.json()) as User - - const colorNames = Object.keys(colors) - const randomColor = colorNames[ - Math.floor(Math.random() * colorNames.length) - ] as keyof typeof colors - const code = colors[randomColor] - - // Create a session for the current user - // userInfo is made available in Liveblocks presence hooks, e.g. useOthers - const session = liveblocks.prepareSession(user.id, { - userInfo: { - name: user.name, - email: user.email, - color: randomColor, - }, - }) - - // Give the user access to the room - user.sandbox.forEach((sandbox) => { - session.allow(`${sandbox.id}`, session.FULL_ACCESS) - }) - user.usersToSandboxes.forEach((userToSandbox) => { - session.allow(`${userToSandbox.sandboxId}`, session.FULL_ACCESS) - }) - - // Authorize the user and return the result - const { body, status } = await session.authorize() - return new Response(body, { status }) + // Original implementation commented out: + // const clerkUser = await currentUser() + // + // if (!clerkUser) { + // return new Response("Unauthorized", { status: 401 }) + // } + // + // const res = await fetch( + // `${process.env.NEXT_PUBLIC_DATABASE_WORKER_URL}/api/user?id=${clerkUser.id}`, + // { + // headers: { + // Authorization: `${process.env.NEXT_PUBLIC_WORKERS_KEY}`, + // }, + // } + // ) + // const user = (await res.json()) as User + // + // const colorNames = Object.keys(colors) + // const randomColor = colorNames[ + // Math.floor(Math.random() * colorNames.length) + // ] as keyof typeof colors + // const code = colors[randomColor] + // + // // Create a session for the current user + // // userInfo is made available in Liveblocks presence hooks, e.g. useOthers + // const session = liveblocks.prepareSession(user.id, { + // userInfo: { + // name: user.name, + // email: user.email, + // color: randomColor, + // }, + // }) + // + // // Give the user access to the room + // user.sandbox.forEach((sandbox) => { + // session.allow(`${sandbox.id}`, session.FULL_ACCESS) + // }) + // user.usersToSandboxes.forEach((userToSandbox) => { + // session.allow(`${userToSandbox.sandboxId}`, session.FULL_ACCESS) + // }) + // + // // Authorize the user and return the result + // const { body, status } = await session.authorize() + // return new Response(body, { status }) } diff --git a/frontend/app/api/user/upgrade-tier/route.ts b/frontend/app/api/user/upgrade-tier/route.ts new file mode 100644 index 0000000..20bc728 --- /dev/null +++ b/frontend/app/api/user/upgrade-tier/route.ts @@ -0,0 +1,42 @@ +import { currentUser } from "@clerk/nextjs" + +export async function POST(request: Request) { + try { + const user = await currentUser() + if (!user) { + return new Response("Unauthorized", { status: 401 }) + } + + const { tier } = await request.json() + + // handle payment processing here + + const response = await fetch( + `${process.env.NEXT_PUBLIC_DATABASE_WORKER_URL}/api/user/update-tier`, + { + method: "POST", + headers: { + Authorization: `${process.env.NEXT_PUBLIC_WORKERS_KEY}`, + "Content-Type": "application/json", + }, + body: JSON.stringify({ + userId: user.id, + tier, + tierExpiresAt: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000), // 30 days + }), + } + ) + + if (!response.ok) { + throw new Error("Failed to upgrade tier") + } + + return new Response("Tier upgraded successfully") + } catch (error) { + console.error("Tier upgrade error:", error) + return new Response( + error instanceof Error ? error.message : "Internal Server Error", + { status: 500 } + ) + } +} \ No newline at end of file diff --git a/frontend/app/layout.tsx b/frontend/app/layout.tsx index 494079e..57f5c17 100644 --- a/frontend/app/layout.tsx +++ b/frontend/app/layout.tsx @@ -1,7 +1,7 @@ import { Toaster } from "@/components/ui/sonner" import { ThemeProvider } from "@/components/ui/theme-provider" import { PreviewProvider } from "@/context/PreviewContext" -import { SocketProvider } from '@/context/SocketContext' +import { SocketProvider } from "@/context/SocketContext" import { ClerkProvider } from "@clerk/nextjs" import { Analytics } from "@vercel/analytics/react" import { GeistMono } from "geist/font/mono" diff --git a/frontend/components.json b/frontend/components.json index 05f9e72..bd85d8a 100644 --- a/frontend/components.json +++ b/frontend/components.json @@ -14,4 +14,4 @@ "components": "@/components", "utils": "@/lib/utils" } -} \ No newline at end of file +} diff --git a/frontend/components/dashboard/about.tsx b/frontend/components/dashboard/about.tsx index 7accef0..7975039 100644 --- a/frontend/components/dashboard/about.tsx +++ b/frontend/components/dashboard/about.tsx @@ -18,11 +18,38 @@ export default function AboutModal({ - About this project + Help & Support -
- Sandbox is an open-source cloud-based code editing environment with - custom AI code autocompletion and real-time collaboration. +
+ {/*
+ Sandbox is an open-source cloud-based code editing environment with + custom AI code autocompletion and real-time collaboration. +
*/} +
+ Get help and support through our Discord community or by creating issues on GitHub: +
+
diff --git a/frontend/components/dashboard/index.tsx b/frontend/components/dashboard/index.tsx index ecd3837..ced6e66 100644 --- a/frontend/components/dashboard/index.tsx +++ b/frontend/components/dashboard/index.tsx @@ -25,6 +25,7 @@ export default function Dashboard({ type: "react" | "node" author: string sharedOn: Date + authorAvatarUrl?: string }[] }) { const [screen, setScreen] = useState("projects") @@ -77,14 +78,14 @@ export default function Dashboard({ My Projects - + */} {/* @@ -121,7 +122,12 @@ export default function Dashboard({ ) : null} ) : screen === "shared" ? ( - + ({ + ...item, + authorAvatarUrl: item.authorAvatarUrl || "", + }))} + /> ) : screen === "settings" ? null : null} diff --git a/frontend/components/dashboard/shared.tsx b/frontend/components/dashboard/shared.tsx index 262d985..b65c89f 100644 --- a/frontend/components/dashboard/shared.tsx +++ b/frontend/components/dashboard/shared.tsx @@ -6,6 +6,7 @@ import { TableHeader, TableRow, } from "@/components/ui/table" +import { projectTemplates } from "@/lib/data" import { ChevronRight } from "lucide-react" import Image from "next/image" import Link from "next/link" @@ -18,7 +19,7 @@ export default function DashboardSharedWithMe({ shared: { id: string name: string - type: "react" | "node" + type: string author: string authorAvatarUrl: string sharedOn: Date @@ -46,9 +47,8 @@ export default function DashboardSharedWithMe({ p.id === sandbox.type) + ?.icon ?? "/project-icons/node.svg" } width={20} height={20} @@ -59,7 +59,7 @@ export default function DashboardSharedWithMe({
- { if (textareaRef.current) { - textareaRef.current.style.height = 'auto' - textareaRef.current.style.height = textareaRef.current.scrollHeight + 'px' + textareaRef.current.style.height = "auto" + textareaRef.current.style.height = textareaRef.current.scrollHeight + "px" } }, [input]) @@ -40,7 +38,11 @@ export default function ChatInput({ e.preventDefault() handleSend(false) } - } else if (e.key === "Backspace" && input === "" && contextTabs.length > 0) { + } else if ( + e.key === "Backspace" && + input === "" && + contextTabs.length > 0 + ) { e.preventDefault() // Remove the last context tab const lastTab = contextTabs[contextTabs.length - 1] @@ -51,89 +53,92 @@ export default function ChatInput({ // Handle paste events for image and code const handlePaste = async (e: React.ClipboardEvent) => { // Handle image paste - const items = Array.from(e.clipboardData.items); + const items = Array.from(e.clipboardData.items) for (const item of items) { - if (item.type.startsWith('image/')) { - e.preventDefault(); - - const file = item.getAsFile(); - if (!file) continue; + if (item.type.startsWith("image/")) { + e.preventDefault() + + const file = item.getAsFile() + if (!file) continue try { // Convert image to base64 string for context tab title and timestamp - const reader = new FileReader(); + const reader = new FileReader() reader.onload = () => { - const base64String = reader.result as string; + const base64String = reader.result as string addContextTab( "image", - `Image ${new Date().toLocaleTimeString('en-US', { - hour12: true, - hour: '2-digit', - minute: '2-digit' - }).replace(/(\d{2}):(\d{2})/, '$1:$2')}`, + `Image ${new Date() + .toLocaleTimeString("en-US", { + hour12: true, + hour: "2-digit", + minute: "2-digit", + }) + .replace(/(\d{2}):(\d{2})/, "$1:$2")}`, base64String - ); - }; - reader.readAsDataURL(file); + ) + } + reader.readAsDataURL(file) } catch (error) { - console.error('Error processing pasted image:', error); + console.error("Error processing pasted image:", error) } - return; + return } } - - // Get text from clipboard - const text = e.clipboardData.getData('text'); + + // Get text from clipboard + const text = e.clipboardData.getData("text") // If text doesn't contain newlines or doesn't look like code, let it paste normally - if (!text || !text.includes('\n') || !looksLikeCode(text)) { - return; + if (!text || !text.includes("\n") || !looksLikeCode(text)) { + return } - e.preventDefault(); - const editor = editorRef.current; - const currentSelection = editor?.getSelection(); - const lines = text.split('\n'); + e.preventDefault() + const editor = editorRef.current + const currentSelection = editor?.getSelection() + const lines = text.split("\n") // TODO: FIX THIS: even when i paste the outside code, it shows the active file name,it works when no tabs are open, just does not work when the tab is open - + // If selection exists in editor, use file name and line numbers if (currentSelection && !currentSelection.isEmpty()) { addContextTab( "code", `${activeFileName} (${currentSelection.startLineNumber}-${currentSelection.endLineNumber})`, text, - { start: currentSelection.startLineNumber, end: currentSelection.endLineNumber } - ); - return; + { + start: currentSelection.startLineNumber, + end: currentSelection.endLineNumber, + } + ) + return } - + // If we have stored line range from a copy operation in the editor if (lastCopiedRangeRef.current) { - const range = lastCopiedRangeRef.current; + const range = lastCopiedRangeRef.current addContextTab( "code", `${activeFileName} (${range.startLine}-${range.endLine})`, text, { start: range.startLine, end: range.endLine } - ); - return; + ) + return } - + // For code pasted from outside the editor - addContextTab( - "code", - `Pasted Code (1-${lines.length})`, - text, - { start: 1, end: lines.length } - ); - }; + addContextTab("code", `Pasted Code (1-${lines.length})`, text, { + start: 1, + end: lines.length, + }) + } // Handle image upload from local machine via input const handleImageUpload = () => { - const input = document.createElement('input') - input.type = 'file' - input.accept = 'image/*' + const input = document.createElement("input") + input.type = "file" + input.accept = "image/*" input.onchange = (e) => { const file = (e.target as HTMLInputElement).files?.[0] if (file) onImageUpload(file) @@ -155,14 +160,16 @@ export default function ChatInput({ // Handle file upload from local machine via input const handleFileUpload = () => { - const input = document.createElement('input') - input.type = 'file' - input.accept = '.txt,.md,.csv,.json,.js,.ts,.html,.css,.pdf' + const input = document.createElement("input") + input.type = "file" + input.accept = ".txt,.md,.csv,.json,.js,.ts,.html,.css,.pdf" input.onchange = (e) => { const file = (e.target as HTMLInputElement).files?.[0] if (file) { if (!(file.type in ALLOWED_FILE_TYPES)) { - alert('Unsupported file type. Please upload text, code, or PDF files.') + alert( + "Unsupported file type. Please upload text, code, or PDF files." + ) return } @@ -223,17 +230,16 @@ export default function ChatInput({ File {/* Render image upload button */} -
) } - diff --git a/frontend/components/editor/AIChat/ChatMessage.tsx b/frontend/components/editor/AIChat/ChatMessage.tsx index ef8ec0c..f64679e 100644 --- a/frontend/components/editor/AIChat/ChatMessage.tsx +++ b/frontend/components/editor/AIChat/ChatMessage.tsx @@ -3,9 +3,9 @@ import React, { useState } from "react" import ReactMarkdown from "react-markdown" import remarkGfm from "remark-gfm" import { Button } from "../../ui/button" -import { copyToClipboard, stringifyContent } from "./lib/chatUtils" import ContextTabs from "./ContextTabs" -import { createMarkdownComponents } from './lib/markdownComponents' +import { copyToClipboard, stringifyContent } from "./lib/chatUtils" +import { createMarkdownComponents } from "./lib/markdownComponents" import { MessageProps } from "./types" export default function ChatMessage({ @@ -14,7 +14,6 @@ export default function ChatMessage({ setIsContextExpanded, socket, }: MessageProps) { - // State for expanded message index const [expandedMessageIndex, setExpandedMessageIndex] = useState< number | null @@ -23,7 +22,7 @@ export default function ChatMessage({ // State for copied text const [copiedText, setCopiedText] = useState(null) - // Render copy button for text content + // Render copy button for text content const renderCopyButton = (text: any) => ( @@ -143,20 +145,23 @@ export default function ContextTabs({ {previewTab && (
{previewTab.type === "image" ? ( - {previewTab.name} - ) : previewTab.lineRange && ( - <> -
- Lines {previewTab.lineRange.start}-{previewTab.lineRange.end} -
-
-                  {previewTab.content}
-                
- + ) : ( + previewTab.lineRange && ( + <> +
+ Lines {previewTab.lineRange.start}- + {previewTab.lineRange.end} +
+
+                    {previewTab.content}
+                  
+ + ) )} {/* Render file context tab */} {previewTab.type === "file" && ( @@ -169,4 +174,4 @@ export default function ContextTabs({
) -} \ No newline at end of file +} diff --git a/frontend/components/editor/AIChat/index.tsx b/frontend/components/editor/AIChat/index.tsx index 444e576..bb6db27 100644 --- a/frontend/components/editor/AIChat/index.tsx +++ b/frontend/components/editor/AIChat/index.tsx @@ -1,14 +1,14 @@ -import { X } from "lucide-react" +import { useSocket } from "@/context/SocketContext" +import { TFile } from "@/lib/types" +import { X, ChevronDown } from "lucide-react" +import { nanoid } from "nanoid" import { useEffect, useRef, useState } from "react" import LoadingDots from "../../ui/LoadingDots" import ChatInput from "./ChatInput" import ChatMessage from "./ChatMessage" import ContextTabs from "./ContextTabs" import { handleSend, handleStopGeneration } from "./lib/chatUtils" -import { nanoid } from 'nanoid' -import { TFile } from "@/lib/types" -import { useSocket } from "@/context/SocketContext" -import { Message, ContextTab, AIChatProps } from './types' +import { AIChatProps, ContextTab, Message } from "./types" export default function AIChat({ activeFileContent, @@ -17,6 +17,7 @@ export default function AIChat({ editorRef, lastCopiedRangeRef, files, + templateType, }: AIChatProps) { // Initialize socket and messages const { socket } = useSocket() @@ -38,65 +39,96 @@ export default function AIChat({ // Initialize textarea ref const textareaRef = useRef(null) - // Scroll to bottom of chat when messages change - useEffect(() => { - scrollToBottom() - }, [messages]) + // state variables for auto scroll and scroll button + const [autoScroll, setAutoScroll] = useState(true) + const [showScrollButton, setShowScrollButton] = useState(false) - // Scroll to bottom of chat when messages change - const scrollToBottom = () => { - if (chatContainerRef.current) { - setTimeout(() => { - chatContainerRef.current?.scrollTo({ - top: chatContainerRef.current.scrollHeight, - behavior: "smooth", - }) - }, 100) + // scroll to bottom of chat when messages change + useEffect(() => { + if (autoScroll) { + scrollToBottom() } + }, [messages, autoScroll]) + + // scroll to bottom of chat when messages change + const scrollToBottom = (force: boolean = false) => { + if (!chatContainerRef.current || (!autoScroll && !force)) return + + chatContainerRef.current.scrollTo({ + top: chatContainerRef.current.scrollHeight, + behavior: force ? "smooth" : "auto", + }) } + // function to handle scroll events + const handleScroll = () => { + if (!chatContainerRef.current) return + + const { scrollTop, scrollHeight, clientHeight } = chatContainerRef.current + const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) < 50 + + setAutoScroll(isAtBottom) + setShowScrollButton(!isAtBottom) + } + + // scroll event listener + useEffect(() => { + const container = chatContainerRef.current + if (container) { + container.addEventListener('scroll', handleScroll) + return () => container.removeEventListener('scroll', handleScroll) + } + }, []) + // Add context tab to context tabs - const addContextTab = (type: string, name: string, content: string, lineRange?: { start: number; end: number }) => { + const addContextTab = ( + type: string, + name: string, + content: string, + lineRange?: { start: number; end: number } + ) => { const newTab = { id: nanoid(), type: type as "file" | "code" | "image", name, content, - lineRange + lineRange, } - setContextTabs(prev => [...prev, newTab]) + setContextTabs((prev) => [...prev, newTab]) } // Remove context tab from context tabs const removeContextTab = (id: string) => { - setContextTabs(prev => prev.filter(tab => tab.id !== id)) + setContextTabs((prev) => prev.filter((tab) => tab.id !== id)) } // Add file to context tabs const handleAddFile = (tab: ContextTab) => { - setContextTabs(prev => [...prev, tab]) + setContextTabs((prev) => [...prev, tab]) } // Format code content to remove starting and ending code block markers if they exist const formatCodeContent = (content: string) => { - return content.replace(/^```[\w-]*\n/, '').replace(/\n```$/, '') + return content.replace(/^```[\w-]*\n/, "").replace(/\n```$/, "") } // Get combined context from context tabs const getCombinedContext = () => { - if (contextTabs.length === 0) return '' - - return contextTabs.map(tab => { - if (tab.type === 'file') { - const fileExt = tab.name.split('.').pop() || 'txt' - const cleanContent = formatCodeContent(tab.content) - return `File ${tab.name}:\n\`\`\`${fileExt}\n${cleanContent}\n\`\`\`` - } else if (tab.type === 'code') { - const cleanContent = formatCodeContent(tab.content) - return `Code from ${tab.name}:\n\`\`\`typescript\n${cleanContent}\n\`\`\`` - } - return `${tab.name}:\n${tab.content}` - }).join('\n\n') + if (contextTabs.length === 0) return "" + + return contextTabs + .map((tab) => { + if (tab.type === "file") { + const fileExt = tab.name.split(".").pop() || "txt" + const cleanContent = formatCodeContent(tab.content) + return `File ${tab.name}:\n\`\`\`${fileExt}\n${cleanContent}\n\`\`\`` + } else if (tab.type === "code") { + const cleanContent = formatCodeContent(tab.content) + return `Code from ${tab.name}:\n\`\`\`typescript\n${cleanContent}\n\`\`\`` + } + return `${tab.name}:\n${tab.content}` + }) + .join("\n\n") } // Handle sending message with context @@ -112,7 +144,9 @@ export default function AIChat({ setIsGenerating, setIsLoading, abortControllerRef, - activeFileContent + activeFileContent, + false, + templateType ) // Clear context tabs after sending setContextTabs([]) @@ -120,9 +154,9 @@ export default function AIChat({ // Set context for the chat const setContext = ( - context: string | null, - name: string, - range?: { start: number, end: number } + context: string | null, + name: string, + range?: { start: number; end: number } ) => { if (!context) { setContextTabs([]) @@ -130,7 +164,7 @@ export default function AIChat({ } // Always add a new tab instead of updating existing ones - addContextTab('code', name, context, range) + addContextTab("code", name, context, range) } return ( @@ -153,10 +187,10 @@ export default function AIChat({
{messages.map((message, messageIndex) => ( - // Render chat message component for each message + // Render chat message component for each message ))} {isLoading && } + + {/* Add scroll to bottom button */} + {showScrollButton && ( + + )}
{/* Render context tabs component */} @@ -180,9 +225,9 @@ export default function AIChat({ socket={socket} onFileSelect={(file: TFile) => { socket?.emit("getFile", { fileId: file.id }, (response: string) => { - const fileExt = file.name.split('.').pop() || 'txt' + const fileExt = file.name.split(".").pop() || "txt" const formattedContent = `\`\`\`${fileExt}\n${response}\n\`\`\`` - addContextTab('file', file.name, formattedContent) + addContextTab("file", file.name, formattedContent) if (textareaRef.current) { textareaRef.current.focus() } @@ -210,9 +255,9 @@ export default function AIChat({ }} lastCopiedRangeRef={lastCopiedRangeRef} activeFileName={activeFileName} - contextTabs={contextTabs.map(tab => ({ + contextTabs={contextTabs.map((tab) => ({ ...tab, - title: tab.id + title: tab.id, }))} onRemoveTab={removeContextTab} /> diff --git a/frontend/components/editor/AIChat/lib/chatUtils.ts b/frontend/components/editor/AIChat/lib/chatUtils.ts index d02c91e..d453783 100644 --- a/frontend/components/editor/AIChat/lib/chatUtils.ts +++ b/frontend/components/editor/AIChat/lib/chatUtils.ts @@ -1,6 +1,6 @@ import React from "react" -// Stringify content for chat message component +// Stringify content for chat message component export const stringifyContent = ( content: any, seen = new WeakSet() @@ -66,19 +66,19 @@ export const stringifyContent = ( return String(content) } -// Copy to clipboard for chat message component +// Copy to clipboard for chat message component export const copyToClipboard = ( text: string, setCopiedText: (text: string | null) => void ) => { - // Copy text to clipboard for chat message component + // Copy text to clipboard for chat message component navigator.clipboard.writeText(text).then(() => { setCopiedText(text) setTimeout(() => setCopiedText(null), 2000) }) } -// Handle send for chat message component +// Handle send for chat message component export const handleSend = async ( input: string, context: string | null, @@ -89,27 +89,31 @@ export const handleSend = async ( setIsGenerating: React.Dispatch>, setIsLoading: React.Dispatch>, abortControllerRef: React.MutableRefObject, - activeFileContent: string + activeFileContent: string, + isEditMode: boolean = false, + templateType: string ) => { // Return if input is empty and context is null - if (input.trim() === "" && !context) return + if (input.trim() === "" && !context) return - // Get timestamp for chat message component - const timestamp = new Date().toLocaleTimeString('en-US', { - hour12: true, - hour: '2-digit', - minute: '2-digit' - }).replace(/(\d{2}):(\d{2})/, '$1:$2') + // Get timestamp for chat message component + const timestamp = new Date() + .toLocaleTimeString("en-US", { + hour12: true, + hour: "2-digit", + minute: "2-digit", + }) + .replace(/(\d{2}):(\d{2})/, "$1:$2") - // Create user message for chat message component + // Create user message for chat message component const userMessage = { role: "user" as const, content: input, context: context || undefined, - timestamp: timestamp + timestamp: timestamp, } - // Update messages for chat message component + // Update messages for chat message component const updatedMessages = [...messages, userMessage] setMessages(updatedMessages) setInput("") @@ -120,24 +124,25 @@ export const handleSend = async ( abortControllerRef.current = new AbortController() try { - // Create anthropic messages for chat message component + // Create anthropic messages for chat message component const anthropicMessages = updatedMessages.map((msg) => ({ role: msg.role === "user" ? "human" : "assistant", content: msg.content, })) - // Fetch AI response for chat message component - const response = await fetch( - `${process.env.NEXT_PUBLIC_AI_WORKER_URL}/api`, - { - method: "POST", - headers: { - "Content-Type": "application/json", + // Fetch AI response for chat message component + const response = await fetch("/api/ai", + { + method: "POST", + headers: { + "Content-Type": "application/json", }, body: JSON.stringify({ messages: anthropicMessages, context: context || undefined, activeFileContent: activeFileContent, + isEditMode: isEditMode, + templateType: templateType, }), signal: abortControllerRef.current.signal, } @@ -145,22 +150,23 @@ export const handleSend = async ( // Throw error if response is not ok if (!response.ok) { - throw new Error("Failed to get AI response") + const error = await response.text() + throw new Error(error) } - // Get reader for chat message component + // Get reader for chat message component const reader = response.body?.getReader() const decoder = new TextDecoder() const assistantMessage = { role: "assistant" as const, content: "" } setMessages([...updatedMessages, assistantMessage]) setIsLoading(false) - // Initialize buffer for chat message component + // Initialize buffer for chat message component let buffer = "" const updateInterval = 100 let lastUpdateTime = Date.now() - // Read response from reader for chat message component + // Read response from reader for chat message component if (reader) { while (true) { const { done, value } = await reader.read() @@ -179,7 +185,7 @@ export const handleSend = async ( } } - // Update messages for chat message component + // Update messages for chat message component setMessages((prev) => { const updatedMessages = [...prev] const lastMessage = updatedMessages[updatedMessages.length - 1] @@ -188,14 +194,14 @@ export const handleSend = async ( }) } } catch (error: any) { - // Handle abort error for chat message component + // Handle abort error for chat message component if (error.name === "AbortError") { console.log("Generation aborted") } else { console.error("Error fetching AI response:", error) const errorMessage = { role: "assistant" as const, - content: "Sorry, I encountered an error. Please try again.", + content: error.message || "Sorry, I encountered an error. Please try again.", } setMessages((prev) => [...prev, errorMessage]) } @@ -206,7 +212,7 @@ export const handleSend = async ( } } -// Handle stop generation for chat message component +// Handle stop generation for chat message component export const handleStopGeneration = ( abortControllerRef: React.MutableRefObject ) => { @@ -215,21 +221,21 @@ export const handleStopGeneration = ( } } -// Check if text looks like code for chat message component +// Check if text looks like code for chat message component export const looksLikeCode = (text: string): boolean => { const codeIndicators = [ - /^import\s+/m, // import statements - /^function\s+/m, // function declarations - /^class\s+/m, // class declarations - /^const\s+/m, // const declarations - /^let\s+/m, // let declarations - /^var\s+/m, // var declarations - /[{}\[\]();]/, // common code syntax - /^\s*\/\//m, // comments - /^\s*\/\*/m, // multi-line comments - /=>/, // arrow functions - /^export\s+/m, // export statements - ]; + /^import\s+/m, // import statements + /^function\s+/m, // function declarations + /^class\s+/m, // class declarations + /^const\s+/m, // const declarations + /^let\s+/m, // let declarations + /^var\s+/m, // var declarations + /[{}\[\]();]/, // common code syntax + /^\s*\/\//m, // comments + /^\s*\/\*/m, // multi-line comments + /=>/, // arrow functions + /^export\s+/m, // export statements + ] - return codeIndicators.some(pattern => pattern.test(text)); -}; + return codeIndicators.some((pattern) => pattern.test(text)) +} diff --git a/frontend/components/editor/AIChat/lib/ignored-paths.ts b/frontend/components/editor/AIChat/lib/ignored-paths.ts index 75d8f2b..0e6da33 100644 --- a/frontend/components/editor/AIChat/lib/ignored-paths.ts +++ b/frontend/components/editor/AIChat/lib/ignored-paths.ts @@ -1,102 +1,102 @@ -// Ignore certain folders and files from the file tree +// Ignore certain folders and files from the file tree export const ignoredFolders = [ - // Package managers - 'node_modules', - 'venv', - '.env', - 'env', - '.venv', - 'virtualenv', - 'pip-wheel-metadata', - - // Build outputs - '.next', - 'dist', - 'build', - 'out', - '__pycache__', - '.webpack', - '.serverless', - 'storybook-static', - - // Version control - '.git', - '.svn', - '.hg', // Mercurial - - // Cache and temp files - '.cache', - 'coverage', - 'tmp', - '.temp', - '.npm', - '.pnpm', - '.yarn', - '.eslintcache', - '.stylelintcache', - - // IDE specific - '.idea', - '.vscode', - '.vs', - '.sublime', - - // Framework specific - '.streamlit', - '.next', - 'static', - '.pytest_cache', - '.nuxt', - '.docusaurus', - '.remix', - '.parcel-cache', - 'public/build', // Remix/Rails - '.turbo', // Turborepo - - // Logs - 'logs', - '*.log', - 'npm-debug.log*', - 'yarn-debug.log*', - 'yarn-error.log*', - 'pnpm-debug.log*', - ] as const; - - export const ignoredFiles = [ - '.DS_Store', - '.env.local', - '.env.development', - '.env.production', - '.env.test', - '.env*.local', - '.gitignore', - '.npmrc', - '.yarnrc', - '.editorconfig', - '.prettierrc', - '.eslintrc', - '.browserslistrc', - 'tsconfig.tsbuildinfo', - '*.pyc', - '*.pyo', - '*.pyd', - '*.so', - '*.dll', - '*.dylib', - '*.class', - '*.exe', - 'package-lock.json', - 'yarn.lock', - 'pnpm-lock.yaml', - 'composer.lock', - 'poetry.lock', - 'Gemfile.lock', - '*.min.js', - '*.min.css', - '*.map', - '*.chunk.*', - '*.hot-update.*', - '.vercel', - '.netlify' - ] as const; \ No newline at end of file + // Package managers + "node_modules", + "venv", + ".env", + "env", + ".venv", + "virtualenv", + "pip-wheel-metadata", + + // Build outputs + ".next", + "dist", + "build", + "out", + "__pycache__", + ".webpack", + ".serverless", + "storybook-static", + + // Version control + ".git", + ".svn", + ".hg", // Mercurial + + // Cache and temp files + ".cache", + "coverage", + "tmp", + ".temp", + ".npm", + ".pnpm", + ".yarn", + ".eslintcache", + ".stylelintcache", + + // IDE specific + ".idea", + ".vscode", + ".vs", + ".sublime", + + // Framework specific + ".streamlit", + ".next", + "static", + ".pytest_cache", + ".nuxt", + ".docusaurus", + ".remix", + ".parcel-cache", + "public/build", // Remix/Rails + ".turbo", // Turborepo + + // Logs + "logs", + "*.log", + "npm-debug.log*", + "yarn-debug.log*", + "yarn-error.log*", + "pnpm-debug.log*", +] as const + +export const ignoredFiles = [ + ".DS_Store", + ".env.local", + ".env.development", + ".env.production", + ".env.test", + ".env*.local", + ".gitignore", + ".npmrc", + ".yarnrc", + ".editorconfig", + ".prettierrc", + ".eslintrc", + ".browserslistrc", + "tsconfig.tsbuildinfo", + "*.pyc", + "*.pyo", + "*.pyd", + "*.so", + "*.dll", + "*.dylib", + "*.class", + "*.exe", + "package-lock.json", + "yarn.lock", + "pnpm-lock.yaml", + "composer.lock", + "poetry.lock", + "Gemfile.lock", + "*.min.js", + "*.min.css", + "*.map", + "*.chunk.*", + "*.hot-update.*", + ".vercel", + ".netlify", +] as const diff --git a/frontend/components/editor/AIChat/lib/markdownComponents.tsx b/frontend/components/editor/AIChat/lib/markdownComponents.tsx index 03009ae..c5cbbf3 100644 --- a/frontend/components/editor/AIChat/lib/markdownComponents.tsx +++ b/frontend/components/editor/AIChat/lib/markdownComponents.tsx @@ -1,21 +1,26 @@ +import { CornerUpLeft } from "lucide-react" import { Components } from "react-markdown" import { Prism as SyntaxHighlighter } from "react-syntax-highlighter" import { vscDarkPlus } from "react-syntax-highlighter/dist/esm/styles/prism" import { Button } from "../../../ui/button" -import { CornerUpLeft } from "lucide-react" import { stringifyContent } from "./chatUtils" -// Create markdown components for chat message component +// Create markdown components for chat message component export const createMarkdownComponents = ( renderCopyButton: (text: any) => JSX.Element, renderMarkdownElement: (props: any) => JSX.Element, askAboutCode: (code: any) => void ): Components => ({ - code: ({ node, className, children, ...props }: { - node?: import('hast').Element, - className?: string, - children?: React.ReactNode, - [key: string]: any, + code: ({ + node, + className, + children, + ...props + }: { + node?: import("hast").Element + className?: string + children?: React.ReactNode + [key: string]: any }) => { const match = /language-(\w+)/.exec(className || "") @@ -55,25 +60,30 @@ export const createMarkdownComponents = (
) : ( - {children} + + {children} + ) }, - // Render markdown elements - p: ({ node, children, ...props }) => renderMarkdownElement({ node, children, ...props }), - h1: ({ node, children, ...props }) => renderMarkdownElement({ node, children, ...props }), - h2: ({ node, children, ...props }) => renderMarkdownElement({ node, children, ...props }), - h3: ({ node, children, ...props }) => renderMarkdownElement({ node, children, ...props }), - h4: ({ node, children, ...props }) => renderMarkdownElement({ node, children, ...props }), - h5: ({ node, children, ...props }) => renderMarkdownElement({ node, children, ...props }), - h6: ({ node, children, ...props }) => renderMarkdownElement({ node, children, ...props }), + // Render markdown elements + p: ({ node, children, ...props }) => + renderMarkdownElement({ node, children, ...props }), + h1: ({ node, children, ...props }) => + renderMarkdownElement({ node, children, ...props }), + h2: ({ node, children, ...props }) => + renderMarkdownElement({ node, children, ...props }), + h3: ({ node, children, ...props }) => + renderMarkdownElement({ node, children, ...props }), + h4: ({ node, children, ...props }) => + renderMarkdownElement({ node, children, ...props }), + h5: ({ node, children, ...props }) => + renderMarkdownElement({ node, children, ...props }), + h6: ({ node, children, ...props }) => + renderMarkdownElement({ node, children, ...props }), ul: (props) => ( -
    - {props.children} -
+
    {props.children}
), ol: (props) => ( -
    - {props.children} -
+
    {props.children}
), }) diff --git a/frontend/components/editor/AIChat/types/index.ts b/frontend/components/editor/AIChat/types/index.ts index 40978b8..d8c1373 100644 --- a/frontend/components/editor/AIChat/types/index.ts +++ b/frontend/components/editor/AIChat/types/index.ts @@ -1,28 +1,29 @@ -import * as monaco from 'monaco-editor' +import { TemplateConfig } from "@/lib/templates" import { TFile, TFolder } from "@/lib/types" -import { Socket } from 'socket.io-client'; +import * as monaco from "monaco-editor" +import { Socket } from "socket.io-client" // Allowed file types for context tabs export const ALLOWED_FILE_TYPES = { // Text files - 'text/plain': true, - 'text/markdown': true, - 'text/csv': true, + "text/plain": true, + "text/markdown": true, + "text/csv": true, // Code files - 'application/json': true, - 'text/javascript': true, - 'text/typescript': true, - 'text/html': true, - 'text/css': true, + "application/json": true, + "text/javascript": true, + "text/typescript": true, + "text/html": true, + "text/css": true, // Documents - 'application/pdf': true, + "application/pdf": true, // Images - 'image/jpeg': true, - 'image/png': true, - 'image/gif': true, - 'image/webp': true, - 'image/svg+xml': true, -} as const; + "image/jpeg": true, + "image/png": true, + "image/gif": true, + "image/webp": true, + "image/svg+xml": true, +} as const // Message interface export interface Message { @@ -45,9 +46,16 @@ export interface AIChatProps { activeFileContent: string activeFileName: string onClose: () => void - editorRef: React.MutableRefObject - lastCopiedRangeRef: React.MutableRefObject<{ startLine: number; endLine: number } | null> + editorRef: React.MutableRefObject< + monaco.editor.IStandaloneCodeEditor | undefined + > + lastCopiedRangeRef: React.MutableRefObject<{ + startLine: number + endLine: number + } | null> files: (TFile | TFolder)[] + templateType: string + templateConfig?: TemplateConfig } // Chat input props interface @@ -58,11 +66,27 @@ export interface ChatInputProps { handleSend: (useFullContext?: boolean) => void handleStopGeneration: () => void onImageUpload: (file: File) => void - addContextTab: (type: string, title: string, content: string, lineRange?: { start: number, end: number }) => void + addContextTab: ( + type: string, + title: string, + content: string, + lineRange?: { start: number; end: number } + ) => void activeFileName?: string - editorRef: React.MutableRefObject - lastCopiedRangeRef: React.MutableRefObject<{ startLine: number; endLine: number } | null> - contextTabs: { id: string; type: string; title: string; content: string; lineRange?: { start: number; end: number } }[] + editorRef: React.MutableRefObject< + monaco.editor.IStandaloneCodeEditor | undefined + > + lastCopiedRangeRef: React.MutableRefObject<{ + startLine: number + endLine: number + } | null> + contextTabs: { + id: string + type: string + title: string + content: string + lineRange?: { start: number; end: number } + }[] onRemoveTab: (id: string) => void textareaRef: React.RefObject } @@ -74,7 +98,11 @@ export interface MessageProps { content: string context?: string } - setContext: (context: string | null, name: string, range?: { start: number, end: number }) => void + setContext: ( + context: string | null, + name: string, + range?: { start: number; end: number } + ) => void setIsContextExpanded: (isExpanded: boolean) => void socket: Socket | null } diff --git a/frontend/components/editor/generate.tsx b/frontend/components/editor/generate.tsx index 0b5ff39..9ca5754 100644 --- a/frontend/components/editor/generate.tsx +++ b/frontend/components/editor/generate.tsx @@ -5,14 +5,12 @@ import { Editor } from "@monaco-editor/react" import { Check, Loader2, RotateCw, Sparkles, X } from "lucide-react" import { usePathname, useRouter } from "next/navigation" import { useCallback, useEffect, useRef, useState } from "react" -import { Socket } from "socket.io-client" import { toast } from "sonner" import { Button } from "../ui/button" // import monaco from "monaco-editor" export default function GenerateInput({ user, - socket, width, data, editor, @@ -21,7 +19,6 @@ export default function GenerateInput({ onClose, }: { user: User - socket: Socket width: number data: { fileName: string @@ -59,32 +56,54 @@ export default function GenerateInput({ }: { regenerate?: boolean }) => { - if (user.generations >= 1000) { - toast.error("You reached the maximum # of generations.") - return - } + try { + setLoading({ generate: !regenerate, regenerate }) + setCurrentPrompt(input) - setLoading({ generate: !regenerate, regenerate }) - setCurrentPrompt(input) - socket.emit( - "generateCode", - { - fileName: data.fileName, - code: data.code, - line: data.line, - instructions: regenerate ? currentPrompt : input - }, - (res: { response: string; success: boolean }) => { - console.log("Generated code", res.response, res.success) - // if (!res.success) { - // toast.error("Failed to generate code."); - // return; - // } + const response = await fetch("/api/ai", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + messages: [{ + role: "user", + content: regenerate ? currentPrompt : input + }], + context: null, + activeFileContent: data.code, + isEditMode: true, + fileName: data.fileName, + line: data.line + }), + }) - setCode(res.response) - router.refresh() + if (!response.ok) { + const error = await response.text() + toast.error(error) + return } - ) + + const reader = response.body?.getReader() + const decoder = new TextDecoder() + let result = "" + + if (reader) { + while (true) { + const { done, value } = await reader.read() + if (done) break + result += decoder.decode(value, { stream: true }) + } + } + + setCode(result.trim()) + router.refresh() + } catch (error) { + console.error("Generation error:", error) + toast.error("Failed to generate code") + } finally { + setLoading({ generate: false, regenerate: false }) + } } const handleGenerateForm = useCallback( (e: React.FormEvent) => { diff --git a/frontend/components/editor/index.tsx b/frontend/components/editor/index.tsx index a516114..b8fd2a9 100644 --- a/frontend/components/editor/index.tsx +++ b/frontend/components/editor/index.tsx @@ -7,11 +7,11 @@ import * as monaco from "monaco-editor" import { useCallback, useEffect, useRef, useState } from "react" import { toast } from "sonner" -import { TypedLiveblocksProvider, useRoom, useSelf } from "@/liveblocks.config" -import LiveblocksProvider from "@liveblocks/yjs" -import { MonacoBinding } from "y-monaco" -import { Awareness } from "y-protocols/awareness" -import * as Y from "yjs" +// import { TypedLiveblocksProvider, useRoom, useSelf } from "@/liveblocks.config" +// import LiveblocksProvider from "@liveblocks/yjs" +// import { MonacoBinding } from "y-monaco" +// import { Awareness } from "y-protocols/awareness" +// import * as Y from "yjs" import { ResizableHandle, @@ -23,7 +23,6 @@ import { useSocket } from "@/context/SocketContext" import { parseTSConfigToMonacoOptions } from "@/lib/tsconfig" import { Sandbox, TFile, TFolder, TTab, User } from "@/lib/types" import { - addNew, cn, debounce, deepMerge, @@ -46,7 +45,7 @@ import { Button } from "../ui/button" import Tab from "../ui/tab" import AIChat from "./AIChat" import GenerateInput from "./generate" -import { Cursors } from "./live/cursors" +// import { Cursors } from "./live/cursors" import DisableAccessModal from "./live/disableModal" import Loading from "./loading" import PreviewWindow from "./preview" @@ -147,20 +146,20 @@ export default function CodeEditor({ const isOwner = sandboxData.userId === userData.id const clerk = useClerk() - // Liveblocks hooks - const room = useRoom() - const [provider, setProvider] = useState() - const userInfo = useSelf((me) => me.info) + // // Liveblocks hooks + // const room = useRoom() + // const [provider, setProvider] = useState() + // const userInfo = useSelf((me) => me.info) - // Liveblocks providers map to prevent reinitializing providers - type ProviderData = { - provider: LiveblocksProvider - yDoc: Y.Doc - yText: Y.Text - binding?: MonacoBinding - onSync: (isSynced: boolean) => void - } - const providersMap = useRef(new Map()) + // // Liveblocks providers map to prevent reinitializing providers + // type ProviderData = { + // provider: LiveblocksProvider + // yDoc: Y.Doc + // yText: Y.Text + // binding?: MonacoBinding + // onSync: (isSynced: boolean) => void + // } + // const providersMap = useRef(new Map()) // Refs for libraries / features const editorContainerRef = useRef(null) @@ -173,7 +172,10 @@ export default function CodeEditor({ const previewWindowRef = useRef<{ refreshIframe: () => void }>(null) // Ref to store the last copied range in the editor to be used in the AIChat component - const lastCopiedRangeRef = useRef<{ startLine: number; endLine: number } | null>(null); + const lastCopiedRangeRef = useRef<{ + startLine: number + endLine: number + } | null>(null) const debouncedSetIsSelected = useRef( debounce((value: boolean) => { @@ -260,14 +262,14 @@ export default function CodeEditor({ // Store the last copied range in the editor to be used in the AIChat component editor.onDidChangeCursorSelection((e) => { - const selection = editor.getSelection(); + const selection = editor.getSelection() if (selection) { lastCopiedRangeRef.current = { startLine: selection.startLineNumber, - endLine: selection.endLineNumber - }; + endLine: selection.endLineNumber, + } } - }); + }) } // Call the function with your file structure @@ -571,82 +573,82 @@ export default function CodeEditor({ } }, [activeFileId, tabs, debouncedSaveData, setIsAIChatOpen, editorRef]) - // Liveblocks live collaboration setup effect - useEffect(() => { - const tab = tabs.find((t) => t.id === activeFileId) - const model = editorRef?.getModel() + // // Liveblocks live collaboration setup effect + // useEffect(() => { + // const tab = tabs.find((t) => t.id === activeFileId) + // const model = editorRef?.getModel() - if (!editorRef || !tab || !model) return + // if (!editorRef || !tab || !model) return - let providerData: ProviderData + // let providerData: ProviderData - // When a file is opened for the first time, create a new provider and store in providersMap. - if (!providersMap.current.has(tab.id)) { - const yDoc = new Y.Doc() - const yText = yDoc.getText(tab.id) - const yProvider = new LiveblocksProvider(room, yDoc) + // // When a file is opened for the first time, create a new provider and store in providersMap. + // if (!providersMap.current.has(tab.id)) { + // const yDoc = new Y.Doc() + // const yText = yDoc.getText(tab.id) + // const yProvider = new LiveblocksProvider(room, yDoc) - // Inserts the file content into the editor once when the tab is changed. - const onSync = (isSynced: boolean) => { - if (isSynced) { - const text = yText.toString() - if (text === "") { - if (activeFileContent) { - yText.insert(0, activeFileContent) - } else { - setTimeout(() => { - yText.insert(0, editorRef.getValue()) - }, 0) - } - } - } - } + // // Inserts the file content into the editor once when the tab is changed. + // const onSync = (isSynced: boolean) => { + // if (isSynced) { + // const text = yText.toString() + // if (text === "") { + // if (activeFileContent) { + // yText.insert(0, activeFileContent) + // } else { + // setTimeout(() => { + // yText.insert(0, editorRef.getValue()) + // }, 0) + // } + // } + // } + // } - yProvider.on("sync", onSync) + // yProvider.on("sync", onSync) - // Save the provider to the map. - providerData = { provider: yProvider, yDoc, yText, onSync } - providersMap.current.set(tab.id, providerData) - } else { - // When a tab is opened that has been open before, reuse the existing provider. - providerData = providersMap.current.get(tab.id)! - } + // // Save the provider to the map. + // providerData = { provider: yProvider, yDoc, yText, onSync } + // providersMap.current.set(tab.id, providerData) + // } else { + // // When a tab is opened that has been open before, reuse the existing provider. + // providerData = providersMap.current.get(tab.id)! + // } - const binding = new MonacoBinding( - providerData.yText, - model, - new Set([editorRef]), - providerData.provider.awareness as unknown as Awareness - ) + // const binding = new MonacoBinding( + // providerData.yText, + // model, + // new Set([editorRef]), + // providerData.provider.awareness as unknown as Awareness + // ) - providerData.binding = binding - setProvider(providerData.provider) + // providerData.binding = binding + // setProvider(providerData.provider) - return () => { - // Cleanup logic - if (binding) { - binding.destroy() - } - if (providerData.binding) { - providerData.binding = undefined - } - } - }, [room, activeFileContent]) + // return () => { + // // Cleanup logic + // if (binding) { + // binding.destroy() + // } + // if (providerData.binding) { + // providerData.binding = undefined + // } + // } + // }, [room, activeFileContent]) - // Added this effect to clean up when the component unmounts - useEffect(() => { - return () => { - // Clean up all providers when the component unmounts - providersMap.current.forEach((data) => { - if (data.binding) { - data.binding.destroy() - } - data.provider.disconnect() - data.yDoc.destroy() - }) - providersMap.current.clear() - } - }, []) + // // Added this effect to clean up when the component unmounts + // useEffect(() => { + // return () => { + // // Clean up all providers when the component unmounts + // providersMap.current.forEach((data) => { + // if (data.binding) { + // data.binding.destroy() + // } + // data.provider.disconnect() + // data.yDoc.destroy() + // }) + // providersMap.current.clear() + // } + // }, []) // Connection/disconnection effect useEffect(() => { @@ -658,7 +660,7 @@ export default function CodeEditor({ // Socket event listener effect useEffect(() => { - const onConnect = () => { } + const onConnect = () => {} const onDisconnect = () => { setTerminals([]) @@ -786,8 +788,8 @@ export default function CodeEditor({ ? numTabs === 1 ? null : index < numTabs - 1 - ? tabs[index + 1].id - : tabs[index - 1].id + ? tabs[index + 1].id + : tabs[index - 1].id : activeFileId setTabs((prev) => prev.filter((t) => t.id !== id)) @@ -853,9 +855,7 @@ export default function CodeEditor({ } const handleDeleteFile = (file: TFile) => { - socket?.emit("deleteFile", { fileId: file.id }, (response: (TFolder | TFile)[]) => { - setFiles(response) - }) + socket?.emit("deleteFile", { fileId: file.id }) closeTab(file.id) } @@ -867,10 +867,13 @@ export default function CodeEditor({ closeTabs(response) ) - socket?.emit("deleteFolder", { folderId: folder.id }, (response: (TFolder | TFile)[]) => { - setFiles(response) - setDeletingFolderId("") - }) + socket?.emit( + "deleteFolder", + { folderId: folder.id }, + (response: (TFolder | TFile)[]) => { + setDeletingFolderId("") + } + ) } const togglePreviewPanel = () => { @@ -911,7 +914,7 @@ export default function CodeEditor({ { }} + setOpen={() => {}} /> @@ -946,15 +949,14 @@ export default function CodeEditor({ {generate.show ? ( t.id === activeFileId)?.name ?? "", code: (isSelected && editorRef?.getSelection() ? editorRef - ?.getModel() - ?.getValueInRange(editorRef?.getSelection()!) + ?.getModel() + ?.getValueInRange(editorRef?.getSelection()!) : editorRef?.getValue()) ?? "", line: generate.line, }} @@ -1036,7 +1038,6 @@ export default function CodeEditor({ handleDeleteFolder={handleDeleteFolder} socket={socket!} setFiles={setFiles} - addNew={(name, type) => addNew(name, type, setFiles, sandboxData)} deletingFolderId={deletingFolderId} toggleAIChat={toggleAIChat} isAIChatOpen={isAIChatOpen} @@ -1088,9 +1089,9 @@ export default function CodeEditor({ ) : // Note clerk.loaded is required here due to a bug: https://github.com/clerk/javascript/issues/1643 clerk.loaded ? ( <> - {provider && userInfo ? ( + {/* {provider && userInfo ? ( - ) : null} + ) : null} */} diff --git a/frontend/components/editor/navbar/downloadButton.tsx b/frontend/components/editor/navbar/downloadButton.tsx index c036ffc..6a58511 100644 --- a/frontend/components/editor/navbar/downloadButton.tsx +++ b/frontend/components/editor/navbar/downloadButton.tsx @@ -1,29 +1,36 @@ -import JSZip from 'jszip' -import { useSocket } from "@/context/SocketContext" +// React component for download button import { Button } from "@/components/ui/button" +import { useSocket } from "@/context/SocketContext" import { Download } from "lucide-react" export default function DownloadButton({ name }: { name: string }) { const { socket } = useSocket() const handleDownload = async () => { - socket?.emit("downloadFiles", {}, async (response: {files: {path: string, content: string}[]}) => { - const zip = new JSZip() - - response.files.forEach(file => { - zip.file(file.path, file.content) - }) - - const blob = await zip.generateAsync({type: "blob"}) - const url = window.URL.createObjectURL(blob) - const a = document.createElement('a') - a.href = url - a.download = `${name}.zip` - a.click() - window.URL.revokeObjectURL(url) - }) - } + socket?.emit( + "downloadFiles", + { timestamp: Date.now() }, + async (response: { zipBlob: string }) => { + const { zipBlob } = response + // Decode Base64 back to binary data + const binary = atob(zipBlob) + const bytes = new Uint8Array(binary.length) + for (let i = 0; i < binary.length; i++) { + bytes[i] = binary.charCodeAt(i) + } + const blob = new Blob([bytes], { type: "application/zip" }) + + // Create URL and download + const url = window.URL.createObjectURL(blob) + const a = document.createElement("a") + a.href = url + a.download = `${name}.zip` + a.click() + window.URL.revokeObjectURL(url) + } + ) + } return ( + */} ) : null} diff --git a/frontend/components/editor/navbar/run.tsx b/frontend/components/editor/navbar/run.tsx index c6020aa..0e6d05c 100644 --- a/frontend/components/editor/navbar/run.tsx +++ b/frontend/components/editor/navbar/run.tsx @@ -7,6 +7,7 @@ import { Sandbox } from "@/lib/types" import { Play, StopCircle } from "lucide-react" import { useEffect, useRef } from "react" import { toast } from "sonner" +import { templateConfigs } from "@/lib/templates" export default function RunButtonModal({ isRunning, @@ -34,7 +35,12 @@ export default function RunButtonModal({ } } }, [terminals, isRunning]) - + // commands to run in the terminal + const COMMANDS = { + streamlit: "./venv/bin/streamlit run main.py --server.runOnSave true", + php: "echo http://localhost:80 && npx vite", + default: "npm run dev", + } as const const handleRun = async () => { if (isRunning && lastCreatedTerminalRef.current) { await closeTerminal(lastCreatedTerminalRef.current) @@ -42,10 +48,7 @@ export default function RunButtonModal({ setIsPreviewCollapsed(true) previewPanelRef.current?.collapse() } else if (!isRunning && terminals.length < 4) { - const command = - sandboxData.type === "streamlit" - ? "./venv/bin/streamlit run main.py --server.runOnSave true" - : "npm run dev" + const command = templateConfigs[sandboxData.type]?.runCommand || "npm run dev" try { // Create a new terminal with the appropriate command diff --git a/frontend/components/editor/navbar/share.tsx b/frontend/components/editor/navbar/share.tsx index 88a2854..748c78d 100644 --- a/frontend/components/editor/navbar/share.tsx +++ b/frontend/components/editor/navbar/share.tsx @@ -143,11 +143,7 @@ export default function ShareSandboxModal({
{shared.map((user) => ( - + ))}
diff --git a/frontend/components/editor/sidebar/index.tsx b/frontend/components/editor/sidebar/index.tsx index c68ec48..6d2a2af 100644 --- a/frontend/components/editor/sidebar/index.tsx +++ b/frontend/components/editor/sidebar/index.tsx @@ -25,7 +25,6 @@ export default function Sidebar({ handleDeleteFolder, socket, setFiles, - addNew, deletingFolderId, toggleAIChat, isAIChatOpen, @@ -43,7 +42,6 @@ export default function Sidebar({ handleDeleteFolder: (folder: TFolder) => void socket: Socket setFiles: (files: (TFile | TFolder)[]) => void - addNew: (name: string, type: "file" | "folder") => void deletingFolderId: string toggleAIChat: () => void isAIChatOpen: boolean @@ -93,7 +91,7 @@ export default function Sidebar({ "moveFile", { fileId, - folderId + folderId, }, (response: (TFolder | TFile)[]) => { setFiles(response) @@ -176,7 +174,6 @@ export default function Sidebar({ stopEditing={() => { setCreatingNew(null) }} - addNew={addNew} /> ) : null} @@ -203,20 +200,18 @@ export default function Sidebar({ variant="ghost" className={cn( "w-full justify-start text-sm font-normal h-8 px-2 mb-2 border-t", - isAIChatOpen - ? "bg-muted-foreground/25 text-foreground" + isAIChatOpen + ? "bg-muted-foreground/25 text-foreground" : "text-muted-foreground" )} onClick={toggleAIChat} aria-disabled={false} style={{ opacity: 1 }} > - AI Chat diff --git a/frontend/components/editor/sidebar/new.tsx b/frontend/components/editor/sidebar/new.tsx index ca7dbc9..43334a4 100644 --- a/frontend/components/editor/sidebar/new.tsx +++ b/frontend/components/editor/sidebar/new.tsx @@ -9,12 +9,10 @@ export default function New({ socket, type, stopEditing, - addNew, }: { socket: Socket type: "file" | "folder" stopEditing: () => void - addNew: (name: string, type: "file" | "folder") => void }) { const inputRef = useRef(null) @@ -25,19 +23,9 @@ export default function New({ const valid = validateName(name, "", type) if (valid.status) { if (type === "file") { - socket.emit( - "createFile", - { name }, - ({ success }: { success: boolean }) => { - if (success) { - addNew(name, type) - } - } - ) + socket.emit("createFile", { name }) } else { - socket.emit("createFolder", { name }, () => { - addNew(name, type) - }) + socket.emit("createFolder", { name }) } } } diff --git a/frontend/components/editor/theme.json b/frontend/components/editor/theme.json index a0a8f03..d15b024 100644 --- a/frontend/components/editor/theme.json +++ b/frontend/components/editor/theme.json @@ -694,4 +694,4 @@ } ], "encodedTokensColors": [] -} \ No newline at end of file +} diff --git a/frontend/components/landing/index.tsx b/frontend/components/landing/index.tsx index af18866..d3c67e8 100644 --- a/frontend/components/landing/index.tsx +++ b/frontend/components/landing/index.tsx @@ -45,9 +45,14 @@ export default function Landing() {

A Collaborative + AI-Powered Code Environment

-

+ {/*

Sandbox is an open-source cloud-based code editing environment with custom AI code autocompletion and real-time collaboration. +

*/} +

+ A cloud-based code editor featuring real-time collaboration, + intelligent code autocompletion, and an AI assistant to help you code + faster and smarter.

diff --git a/frontend/components/ui/alert.tsx b/frontend/components/ui/alert.tsx index 5afd41d..2674ae7 100644 --- a/frontend/components/ui/alert.tsx +++ b/frontend/components/ui/alert.tsx @@ -1,5 +1,5 @@ -import * as React from "react" import { cva, type VariantProps } from "class-variance-authority" +import * as React from "react" import { cn } from "@/lib/utils" @@ -56,4 +56,4 @@ const AlertDescription = React.forwardRef< )) AlertDescription.displayName = "AlertDescription" -export { Alert, AlertTitle, AlertDescription } +export { Alert, AlertDescription, AlertTitle } diff --git a/frontend/components/ui/theme-provider.tsx b/frontend/components/ui/theme-provider.tsx index 5135dd0..19dfaa9 100644 --- a/frontend/components/ui/theme-provider.tsx +++ b/frontend/components/ui/theme-provider.tsx @@ -6,4 +6,3 @@ import { type ThemeProviderProps } from "next-themes/dist/types" export function ThemeProvider({ children, ...props }: ThemeProviderProps) { return {children} } - \ No newline at end of file diff --git a/frontend/components/ui/tooltip.tsx b/frontend/components/ui/tooltip.tsx index a66b3f2..e6cde1b 100644 --- a/frontend/components/ui/tooltip.tsx +++ b/frontend/components/ui/tooltip.tsx @@ -1,7 +1,7 @@ "use client" -import * as React from "react" import * as TooltipPrimitive from "@radix-ui/react-tooltip" +import * as React from "react" import { cn } from "@/lib/utils" @@ -29,4 +29,4 @@ const TooltipContent = React.forwardRef< )) TooltipContent.displayName = TooltipPrimitive.Content.displayName -export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } +export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } diff --git a/frontend/components/ui/userButton.tsx b/frontend/components/ui/userButton.tsx index f79d387..3abf8d6 100644 --- a/frontend/components/ui/userButton.tsx +++ b/frontend/components/ui/userButton.tsx @@ -11,27 +11,85 @@ import { MAX_FREE_GENERATION } from "@/lib/constant" import { User } from "@/lib/types" import { useClerk } from "@clerk/nextjs" import { + Crown, LayoutDashboard, LogOut, Sparkles, User as UserIcon, } from "lucide-react" import Link from "next/link" + import { useRouter } from "next/navigation" +import { useEffect, useState } from "react" import Avatar from "./avatar" +import { Button } from "./button" +import { TIERS } from "@/lib/tiers" -export default function UserButton({ userData }: { userData: User }) { - if (!userData) return null +// TODO: Remove this once we have a proper tier system +const TIER_INFO = { + FREE: { + color: "text-gray-500", + icon: Sparkles, + limit: TIERS.FREE.generations, + }, + PRO: { + color: "text-blue-500", + icon: Crown, + limit: TIERS.PRO.generations, + }, + ENTERPRISE: { + color: "text-purple-500", + icon: Crown, + limit: TIERS.ENTERPRISE.generations, + }, +} as const +export default function UserButton({ userData: initialUserData }: { userData: User }) { + const [userData, setUserData] = useState(initialUserData) + const [isOpen, setIsOpen] = useState(false) const { signOut } = useClerk() const router = useRouter() + const fetchUserData = async () => { + try { + const res = await fetch( + `${process.env.NEXT_PUBLIC_DATABASE_WORKER_URL}/api/user?id=${userData.id}`, + { + headers: { + Authorization: `${process.env.NEXT_PUBLIC_WORKERS_KEY}`, + }, + cache: 'no-store' + } + ) + if (res.ok) { + const updatedUserData = await res.json() + setUserData(updatedUserData) + } + } catch (error) { + console.error("Failed to fetch user data:", error) + } + } + + useEffect(() => { + if (isOpen) { + fetchUserData() + } + }, [isOpen]) + + const tierInfo = TIER_INFO[userData.tier as keyof typeof TIER_INFO] || TIER_INFO.FREE + const TierIcon = tierInfo.icon + const usagePercentage = Math.floor((userData.generations || 0) * 100 / tierInfo.limit) + + const handleUpgrade = async () => { + router.push('/upgrade') + } + return ( - + - +
{userData.name}
@@ -40,20 +98,8 @@ export default function UserButton({ userData }: { userData: User }) {
- - -
- {`AI Usage: ${userData.generations}/${MAX_FREE_GENERATION}`} -
-
-
-
- + + @@ -68,6 +114,52 @@ export default function UserButton({ userData }: { userData: User }) { + + +
+
+
+ + {userData.tier || "FREE"} Plan +
+ {/* {(userData.tier === "FREE" || userData.tier === "PRO") && ( + + )} */} +
+
+ + + + +
+
+ AI Usage + {userData.generations}/{tierInfo.limit} +
+ +
+
90 ? 'bg-red-500' : + usagePercentage > 75 ? 'bg-yellow-500' : + tierInfo.color.replace('text-', 'bg-') + }`} + style={{ + width: `${Math.min(usagePercentage, 100)}%`, + }} + /> +
+
+ + + {/* Edit Profile @@ -83,3 +175,4 @@ export default function UserButton({ userData }: { userData: User }) { ) } + diff --git a/frontend/context/TerminalContext.tsx b/frontend/context/TerminalContext.tsx index 5af74a8..1dd00c2 100644 --- a/frontend/context/TerminalContext.tsx +++ b/frontend/context/TerminalContext.tsx @@ -63,7 +63,7 @@ export const TerminalProvider: React.FC<{ children: React.ReactNode }> = ({ terminals, setTerminals, setActiveTerminalId, - setClosingTerminal: () => { }, + setClosingTerminal: () => {}, socket, activeTerminalId, }) diff --git a/frontend/lib/data/index.ts b/frontend/lib/data/index.ts index 3877c03..bdf1a8a 100644 --- a/frontend/lib/data/index.ts +++ b/frontend/lib/data/index.ts @@ -16,7 +16,7 @@ export const projectTemplates: { id: "vanillajs", name: "HTML/JS", icon: "/project-icons/more.svg", - description: "More coming soon, feel free to contribute on GitHub", + description: "A simple HTML/JS project for building web apps", disabled: false, }, { @@ -33,4 +33,11 @@ export const projectTemplates: { description: "A faster way to build and share data apps", disabled: false, }, + { + id: "php", + name: "PHP", + description: "PHP development environment", + icon: "/project-icons/php.svg", + disabled: false + }, ] diff --git a/frontend/lib/file-extension-to-language.json b/frontend/lib/file-extension-to-language.json index 7aff12b..ed584a5 100644 --- a/frontend/lib/file-extension-to-language.json +++ b/frontend/lib/file-extension-to-language.json @@ -38,7 +38,7 @@ "csl": "xml", "cson": "coffeescript", "csproj": "xml", - "css":"css", + "css": "css", "ct": "xml", "ctp": "php", "cxx": "cpp", diff --git a/frontend/lib/templates/index.ts b/frontend/lib/templates/index.ts new file mode 100644 index 0000000..1b38d9e --- /dev/null +++ b/frontend/lib/templates/index.ts @@ -0,0 +1,248 @@ +export interface TemplateConfig { + id: string + name: string, + runCommand: string, + fileStructure: { + [key: string]: { + purpose: string + description: string + } + } + conventions: string[] + dependencies?: { + [key: string]: string + } + scripts?: { + [key: string]: string + } + } + + export const templateConfigs: { [key: string]: TemplateConfig } = { + reactjs: { + id: "reactjs", + name: "React", + runCommand: "npm run dev", + fileStructure: { + "src/": { + purpose: "source", + description: "Contains all React components and application logic" + }, + "src/components/": { + purpose: "components", + description: "Reusable React components" + }, + "src/lib/": { + purpose: "utilities", + description: "Utility functions and shared code" + }, + "src/App.tsx": { + purpose: "entry", + description: "Main application component" + }, + "src/index.tsx": { + purpose: "entry", + description: "Application entry point" + }, + "src/index.css": { + purpose: "styles", + description: "Global CSS styles" + }, + "public/": { + purpose: "static", + description: "Static assets and index.html" + }, + "tsconfig.json": { + purpose: "config", + description: "TypeScript configuration" + }, + "vite.config.ts": { + purpose: "config", + description: "Vite bundler configuration" + }, + "package.json": { + purpose: "config", + description: "Project dependencies and scripts" + } + }, + conventions: [ + "Use functional components with hooks", + "Follow React naming conventions (PascalCase for components)", + "Keep components small and focused", + "Use TypeScript for type safety" + ], + dependencies: { + "@radix-ui/react-icons": "^1.3.0", + "@radix-ui/react-slot": "^1.1.0", + "class-variance-authority": "^0.7.0", + "clsx": "^2.1.1", + "lucide-react": "^0.441.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "tailwind-merge": "^2.5.2", + "tailwindcss-animate": "^1.0.7" + }, + scripts: { + "dev": "vite", + "build": "tsc && vite build", + "preview": "vite preview", + } + }, + // Next.js template config + nextjs: { + id: "nextjs", + name: "NextJS", + runCommand: "npm run dev", + fileStructure: { + "pages/": { + purpose: "routing", + description: "Page components and API routes" + }, + "pages/api/": { + purpose: "api", + description: "API route handlers" + }, + "pages/_app.tsx": { + purpose: "entry", + description: "Application wrapper component" + }, + "pages/index.tsx": { + purpose: "page", + description: "Homepage component" + }, + "public/": { + purpose: "static", + description: "Static assets and files" + }, + "styles/": { + purpose: "styles", + description: "CSS modules and global styles" + }, + "styles/globals.css": { + purpose: "styles", + description: "Global CSS styles" + }, + "styles/Home.module.css": { + purpose: "styles", + description: "Homepage-specific styles" + }, + "next.config.js": { + purpose: "config", + description: "Next.js configuration" + }, + "next-env.d.ts": { + purpose: "types", + description: "Next.js TypeScript declarations" + }, + "tsconfig.json": { + purpose: "config", + description: "TypeScript configuration" + }, + "package.json": { + purpose: "config", + description: "Project dependencies and scripts" + } + }, + conventions: [ + "Use file-system based routing", + "Keep API routes in pages/api", + "Use CSS Modules for component styles", + "Follow Next.js data fetching patterns" + ], + dependencies: { + "next": "^14.1.0", + "react": "^18.2.0", + "react-dom": "18.2.0", + "tailwindcss": "^3.4.1" + }, + scripts: { + "dev": "next dev", + "build": "next build", + "start": "next start", + "lint": "next lint", + } + }, + // Streamlit template config + streamlit: { + id: "streamlit", + name: "Streamlit", + runCommand: "./venv/bin/streamlit run main.py --server.runOnSave true", + fileStructure: { + "main.py": { + purpose: "entry", + description: "Main Streamlit application file" + }, + "requirements.txt": { + purpose: "dependencies", + description: "Python package dependencies" + }, + "Procfile": { + purpose: "deployment", + description: "Deployment configuration for hosting platforms" + }, + "venv/": { + purpose: "environment", + description: "Python virtual environment directory" + } + }, + conventions: [ + "Use Streamlit components for UI", + "Follow PEP 8 style guide", + "Keep dependencies in requirements.txt", + "Use virtual environment for isolation" + ], + dependencies: { + "streamlit": "^1.40.0", + "altair": "^5.5.0" + }, + scripts: { + "start": "streamlit run main.py", + "dev": "./venv/bin/streamlit run main.py --server.runOnSave true" + } + }, + // HTML template config + vanillajs: { + id: "vanillajs", + name: "HTML/JS", + runCommand: "npm run dev", + fileStructure: { + "index.html": { + purpose: "entry", + description: "Main HTML entry point" + }, + "style.css": { + purpose: "styles", + description: "Global CSS styles" + }, + "script.js": { + purpose: "scripts", + description: "JavaScript application logic" + }, + "package.json": { + purpose: "config", + description: "Project dependencies and scripts" + }, + "package-lock.json": { + purpose: "config", + description: "Locked dependency versions" + }, + "vite.config.js": { + purpose: "config", + description: "Vite bundler configuration" + } + }, + conventions: [ + "Use semantic HTML elements", + "Keep CSS modular and organized", + "Write clean, modular JavaScript", + "Follow modern ES6+ practices" + ], + dependencies: { + "vite": "^5.0.12" + }, + scripts: { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + } + } +} diff --git a/frontend/lib/terminal.ts b/frontend/lib/terminal.ts index 1d0edbc..253f3c2 100644 --- a/frontend/lib/terminal.ts +++ b/frontend/lib/terminal.ts @@ -83,8 +83,8 @@ export const closeTerminal = ({ ? numTerminals === 1 ? null : index < numTerminals - 1 - ? terminals[index + 1].id - : terminals[index - 1].id + ? terminals[index + 1].id + : terminals[index - 1].id : activeTerminalId setTerminals((prev) => prev.filter((t) => t.id !== term.id)) diff --git a/frontend/lib/tiers.ts b/frontend/lib/tiers.ts new file mode 100644 index 0000000..eedd34f --- /dev/null +++ b/frontend/lib/tiers.ts @@ -0,0 +1,19 @@ +export const TIERS = { + FREE: { + // generations: 100, + // maxTokens: 1024, + generations: 1000, + maxTokens: 4096, + model: "claude-3-5-sonnet-20240620", + }, + PRO: { + generations: 500, + maxTokens: 2048, + model: "claude-3-5-sonnet-20240620", + }, + ENTERPRISE: { + generations: 1000, + maxTokens: 4096, + model: "claude-3-5-sonnet-20240620", + }, +} \ No newline at end of file diff --git a/frontend/lib/tsconfig.ts b/frontend/lib/tsconfig.ts index f1d35ce..5986d42 100644 --- a/frontend/lib/tsconfig.ts +++ b/frontend/lib/tsconfig.ts @@ -74,10 +74,10 @@ function mapModule(module: string): monaco.languages.typescript.ModuleKind { } function mapJSX(jsx: string | undefined): monaco.languages.typescript.JsxEmit { - if (!jsx || typeof jsx !== 'string') { + if (!jsx || typeof jsx !== "string") { return monaco.languages.typescript.JsxEmit.React // Default value } - + const jsxMap: { [key: string]: monaco.languages.typescript.JsxEmit } = { preserve: monaco.languages.typescript.JsxEmit.Preserve, react: monaco.languages.typescript.JsxEmit.React, diff --git a/frontend/lib/types.ts b/frontend/lib/types.ts index 9f588c1..2e8bdcd 100644 --- a/frontend/lib/types.ts +++ b/frontend/lib/types.ts @@ -10,6 +10,9 @@ export type User = { generations: number sandbox: Sandbox[] usersToSandboxes: UsersToSandboxes[] + tier: "FREE" | "PRO" | "ENTERPRISE" + tierExpiresAt: Date + lastResetDate?: number } export type Sandbox = { diff --git a/frontend/lib/username-generator.ts b/frontend/lib/username-generator.ts index f2d4192..a625ece 100644 --- a/frontend/lib/username-generator.ts +++ b/frontend/lib/username-generator.ts @@ -1,82 +1,181 @@ // Constants for username generation const WORDS = { - adjectives: [ - "azure", "crimson", "golden", "silver", "violet", "emerald", "cobalt", "amber", "coral", "jade", - "cyber", "digital", "quantum", "neural", "binary", "cosmic", "stellar", "atomic", "crypto", "nano", - "swift", "brave", "clever", "wise", "noble", "rapid", "bright", "sharp", "keen", "bold", - "dynamic", "epic", "mega", "ultra", "hyper", "super", "prime", "elite", "alpha", "omega", - "pixel", "vector", "sonic", "laser", "matrix", "nexus", "proxy", "cloud", "data", "tech", - ], - nouns: [ - "coder", "hacker", "dev", "ninja", "guru", "wizard", "admin", "mod", "chief", "boss", - "wolf", "eagle", "phoenix", "dragon", "tiger", "falcon", "shark", "lion", "hawk", "bear", - "byte", "bit", "node", "stack", "cache", "chip", "core", "net", "web", "app", - "star", "nova", "pulsar", "comet", "nebula", "quasar", "cosmos", "orbit", "astro", "solar", - "mind", "soul", "spark", "pulse", "force", "power", "wave", "storm", "flash", "surge", - ], - prefixes: [ - "the", "mr", "ms", "dr", "pro", "master", "lord", "captain", "chief", "agent", - ], - } as const; - - // Helper function to get random element from array - const getRandomElement = (array: readonly T[]): T => { - return array[Math.floor(Math.random() * array.length)]; - }; - - // Username pattern generators - const usernamePatterns = { - basic: (): string => { - const adjective = getRandomElement(WORDS.adjectives); - const noun = getRandomElement(WORDS.nouns); - const number = Math.floor(Math.random() * 10000); - return `${adjective}${noun}${number}`; - }, - - prefixed: (): string => { - const prefix = getRandomElement(WORDS.prefixes); - const noun = getRandomElement(WORDS.nouns); - const number = Math.floor(Math.random() * 100); - return `${prefix}${noun}${number}`; - }, - - doubleAdjective: (): string => { - const adj1 = getRandomElement(WORDS.adjectives); - const adj2 = getRandomElement(WORDS.adjectives); - const noun = getRandomElement(WORDS.nouns); - return `${adj1}${adj2}${noun}`; - }, - - doubleNoun: (): string => { - const noun1 = getRandomElement(WORDS.nouns); - const noun2 = getRandomElement(WORDS.nouns); - const number = Math.floor(Math.random() * 100); - return `${noun1}${number}${noun2}`; - }, - }; - - export function generateUsername(): string { - const patterns = Object.values(usernamePatterns); - const selectedPattern = getRandomElement(patterns); - return selectedPattern(); + adjectives: [ + "azure", + "crimson", + "golden", + "silver", + "violet", + "emerald", + "cobalt", + "amber", + "coral", + "jade", + "cyber", + "digital", + "quantum", + "neural", + "binary", + "cosmic", + "stellar", + "atomic", + "crypto", + "nano", + "swift", + "brave", + "clever", + "wise", + "noble", + "rapid", + "bright", + "sharp", + "keen", + "bold", + "dynamic", + "epic", + "mega", + "ultra", + "hyper", + "super", + "prime", + "elite", + "alpha", + "omega", + "pixel", + "vector", + "sonic", + "laser", + "matrix", + "nexus", + "proxy", + "cloud", + "data", + "tech", + ], + nouns: [ + "coder", + "hacker", + "dev", + "ninja", + "guru", + "wizard", + "admin", + "mod", + "chief", + "boss", + "wolf", + "eagle", + "phoenix", + "dragon", + "tiger", + "falcon", + "shark", + "lion", + "hawk", + "bear", + "byte", + "bit", + "node", + "stack", + "cache", + "chip", + "core", + "net", + "web", + "app", + "star", + "nova", + "pulsar", + "comet", + "nebula", + "quasar", + "cosmos", + "orbit", + "astro", + "solar", + "mind", + "soul", + "spark", + "pulse", + "force", + "power", + "wave", + "storm", + "flash", + "surge", + ], + prefixes: [ + "the", + "mr", + "ms", + "dr", + "pro", + "master", + "lord", + "captain", + "chief", + "agent", + ], +} as const + +// Helper function to get random element from array +const getRandomElement = (array: readonly T[]): T => { + return array[Math.floor(Math.random() * array.length)] +} + +// Username pattern generators +const usernamePatterns = { + basic: (): string => { + const adjective = getRandomElement(WORDS.adjectives) + const noun = getRandomElement(WORDS.nouns) + const number = Math.floor(Math.random() * 10000) + return `${adjective}${noun}${number}` + }, + + prefixed: (): string => { + const prefix = getRandomElement(WORDS.prefixes) + const noun = getRandomElement(WORDS.nouns) + const number = Math.floor(Math.random() * 100) + return `${prefix}${noun}${number}` + }, + + doubleAdjective: (): string => { + const adj1 = getRandomElement(WORDS.adjectives) + const adj2 = getRandomElement(WORDS.adjectives) + const noun = getRandomElement(WORDS.nouns) + return `${adj1}${adj2}${noun}` + }, + + doubleNoun: (): string => { + const noun1 = getRandomElement(WORDS.nouns) + const noun2 = getRandomElement(WORDS.nouns) + const number = Math.floor(Math.random() * 100) + return `${noun1}${number}${noun2}` + }, +} + +export function generateUsername(): string { + const patterns = Object.values(usernamePatterns) + const selectedPattern = getRandomElement(patterns) + return selectedPattern() +} + +export async function generateUniqueUsername( + checkExists: (username: string) => Promise +): Promise { + const MAX_ATTEMPTS = 10 + let attempts = 0 + let username = generateUsername() + + while ((await checkExists(username)) && attempts < MAX_ATTEMPTS) { + username = generateUsername() + attempts++ } - - export async function generateUniqueUsername( - checkExists: (username: string) => Promise - ): Promise { - const MAX_ATTEMPTS = 10; - let attempts = 0; - let username = generateUsername(); - - while (await checkExists(username) && attempts < MAX_ATTEMPTS) { - username = generateUsername(); - attempts++; - } - - if (attempts >= MAX_ATTEMPTS) { - // Add a large random number to ensure uniqueness - username = generateUsername() + Math.floor(Math.random() * 1000000); - } - - return username; - } \ No newline at end of file + + if (attempts >= MAX_ATTEMPTS) { + // Add a large random number to ensure uniqueness + username = generateUsername() + Math.floor(Math.random() * 1000000) + } + + return username +} diff --git a/frontend/lib/utils.ts b/frontend/lib/utils.ts index 7414be4..194f71b 100644 --- a/frontend/lib/utils.ts +++ b/frontend/lib/utils.ts @@ -2,7 +2,7 @@ import { type ClassValue, clsx } from "clsx" // import { toast } from "sonner" import { twMerge } from "tailwind-merge" import fileExtToLang from "./file-extension-to-language.json" -import { Sandbox, TFile, TFolder } from "./types" +import { TFile, TFolder } from "./types" export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) @@ -38,31 +38,6 @@ export function validateName( return { status: true, message: "" } } -export function addNew( - name: string, - type: "file" | "folder", - setFiles: React.Dispatch>, - sandboxData: Sandbox -) { - if (type === "file") { - setFiles((prev) => [ - ...prev, - { id: `projects/${sandboxData.id}/${name}`, name, type: "file" }, - ]) - } else { - console.log("adding folder") - setFiles((prev) => [ - ...prev, - { - id: `projects/${sandboxData.id}/${name}`, - name, - type: "folder", - children: [], - }, - ]) - } -} - export function debounce void>( func: T, wait: number diff --git a/frontend/liveblocks.config.ts b/frontend/liveblocks.config.ts index df22c32..e71427d 100644 --- a/frontend/liveblocks.config.ts +++ b/frontend/liveblocks.config.ts @@ -1,5 +1,5 @@ import { createClient } from "@liveblocks/client" -import { createRoomContext, createLiveblocksContext } from "@liveblocks/react" +import { createLiveblocksContext, createRoomContext } from "@liveblocks/react" import YLiveblocksProvider from "@liveblocks/yjs" import { colors } from "./lib/colors" diff --git a/frontend/package-lock.json b/frontend/package-lock.json index b56cedd..8934cf6 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -8,6 +8,7 @@ "name": "sandbox", "version": "0.1.0", "dependencies": { + "@anthropic-ai/sdk": "^0.32.1", "@atlaskit/pragmatic-drag-and-drop": "^1.1.7", "@clerk/nextjs": "^4.29.12", "@clerk/themes": "^1.7.12", @@ -127,6 +128,54 @@ "nun": "bin/nun.mjs" } }, + "node_modules/@anthropic-ai/sdk": { + "version": "0.32.1", + "resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-0.32.1.tgz", + "integrity": "sha512-U9JwTrDvdQ9iWuABVsMLj8nJVwAyQz6QXvgLsVhryhCEPkLsbcP/MXxm+jYcAwLoV8ESbaTTjnD4kuAFa+Hyjg==", + "license": "MIT", + "dependencies": { + "@types/node": "^18.11.18", + "@types/node-fetch": "^2.6.4", + "abort-controller": "^3.0.0", + "agentkeepalive": "^4.2.1", + "form-data-encoder": "1.7.2", + "formdata-node": "^4.3.2", + "node-fetch": "^2.6.7" + } + }, + "node_modules/@anthropic-ai/sdk/node_modules/@types/node": { + "version": "18.19.65", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.65.tgz", + "integrity": "sha512-Ay5BZuO1UkTmVHzZJNvZKw/E+iB3GQABb6kijEz89w2JrfhNA+M/ebp18pfz9Gqe9ywhMC8AA8yC01lZq48J+Q==", + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@anthropic-ai/sdk/node_modules/@types/node-fetch": { + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.12.tgz", + "integrity": "sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA==", + "license": "MIT", + "dependencies": { + "@types/node": "*", + "form-data": "^4.0.0" + } + }, + "node_modules/@anthropic-ai/sdk/node_modules/form-data": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", + "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/@atlaskit/pragmatic-drag-and-drop": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/@atlaskit/pragmatic-drag-and-drop/-/pragmatic-drag-and-drop-1.1.7.tgz", @@ -4165,6 +4214,18 @@ "resolved": "https://registry.npmjs.org/@xterm/xterm/-/xterm-5.5.0.tgz", "integrity": "sha512-hqJHYaQb5OptNunnyAnkHyM8aCjZ1MEIDTQu1iIbbTD/xops91NB5yq1ZK/dC2JDbVWtF23zUtl9JE2NqwT87A==" }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "license": "MIT", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, "node_modules/agent-base": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", @@ -4177,6 +4238,18 @@ "node": ">= 14" } }, + "node_modules/agentkeepalive": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", + "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", + "license": "MIT", + "dependencies": { + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, "node_modules/ansi-regex": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", @@ -5093,6 +5166,15 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/execa": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", @@ -5253,6 +5335,12 @@ "node": ">= 6" } }, + "node_modules/form-data-encoder": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz", + "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==", + "license": "MIT" + }, "node_modules/format": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", @@ -5261,6 +5349,28 @@ "node": ">=0.4.x" } }, + "node_modules/formdata-node": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", + "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==", + "license": "MIT", + "dependencies": { + "node-domexception": "1.0.0", + "web-streams-polyfill": "4.0.0-beta.3" + }, + "engines": { + "node": ">= 12.20" + } + }, + "node_modules/formdata-node/node_modules/web-streams-polyfill": { + "version": "4.0.0-beta.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", + "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, "node_modules/formdata-polyfill": { "version": "4.0.10", "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", @@ -5617,6 +5727,15 @@ "node": ">=14.18.0" } }, + "node_modules/humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.0.0" + } + }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", diff --git a/frontend/package.json b/frontend/package.json index d48b936..2877932 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -9,6 +9,7 @@ "lint": "next lint" }, "dependencies": { + "@anthropic-ai/sdk": "^0.32.1", "@atlaskit/pragmatic-drag-and-drop": "^1.1.7", "@clerk/nextjs": "^4.29.12", "@clerk/themes": "^1.7.12", diff --git a/frontend/public/project-icons/php.svg b/frontend/public/project-icons/php.svg new file mode 100644 index 0000000..357eb48 --- /dev/null +++ b/frontend/public/project-icons/php.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/frontend/react-syntax-highlighter.d.ts b/frontend/react-syntax-highlighter.d.ts index 5415aa9..4e92fd6 100644 --- a/frontend/react-syntax-highlighter.d.ts +++ b/frontend/react-syntax-highlighter.d.ts @@ -1,3 +1,2 @@ -declare module 'react-syntax-highlighter'; -declare module 'react-syntax-highlighter/dist/esm/styles/prism'; - +declare module "react-syntax-highlighter" +declare module "react-syntax-highlighter/dist/esm/styles/prism"