diff --git a/lib/db/Dockerfile b/lib/db/Dockerfile new file mode 100644 index 000000000..94be0b385 --- /dev/null +++ b/lib/db/Dockerfile @@ -0,0 +1,22 @@ +FROM postgres:16-alpine + +# Create a directory for initialization scripts +RUN mkdir -p /docker-entrypoint-initdb.d + +# Add any initialization scripts if needed +# COPY ./init-scripts/ /docker-entrypoint-initdb.d/ + +# Set environment defaults (these can be overridden in docker-compose.yml) +ENV POSTGRES_USER=postgres +ENV POSTGRES_PASSWORD=postgres +ENV POSTGRES_DB=mydb + +# Expose the PostgreSQL port +EXPOSE 5432 + +# Set the data directory +VOLUME ["/var/lib/postgresql/data"] + +# Set health check command +HEALTHCHECK --interval=5s --timeout=5s --retries=5 \ + CMD pg_isready -U postgres || exit 1 diff --git a/lib/db/README.md b/lib/db/README.md new file mode 100644 index 000000000..2e144cf31 --- /dev/null +++ b/lib/db/README.md @@ -0,0 +1,100 @@ +# PostgreSQL Docker Setup + +This directory contains scripts to easily start and stop a PostgreSQL database using Docker. + +## Prerequisites + +- [Docker](https://www.docker.com/products/docker-desktop/) +- [Docker Compose](https://docs.docker.com/compose/install/) (included in Docker Desktop) + +## Default Configuration + +- **PostgreSQL Version**: 16 (latest stable) +- **Port**: 5432 +- **Username**: postgres +- **Password**: postgres +- **Database**: mydb +- **Data Volume**: postgres_data (persisted between restarts) + +## Getting Started + +Make the scripts executable: + +```bash +chmod +x start-postgres.sh stop-postgres.sh status-postgres.sh +``` + +### Starting PostgreSQL + +```bash +./start-postgres.sh +``` + +This script will: +1. Start a PostgreSQL container +2. Wait for it to be ready +3. Display connection information + +### Checking Status + +```bash +./status-postgres.sh +``` + +This script will show if PostgreSQL is running and display connection details. + +### Stopping PostgreSQL + +```bash +./stop-postgres.sh +``` + +This script stops the PostgreSQL container while preserving your data. + +## Connection Information + +Once the database is running, you can connect to it using: + +- **Host**: localhost +- **Port**: 5432 +- **Username**: postgres +- **Password**: postgres +- **Database**: mydb + +### Connect with psql client: + +```bash +psql -h localhost -U postgres -d mydb +``` + +### Connect from applications: + +Connection string format: +``` +postgresql://postgres:postgres@localhost:5432/mydb +``` + +## Customizing the Setup + +You can modify the `docker-compose.yml` file to change: + +- Database name, username, and password +- Port mappings +- Volume configuration +- Add initialization scripts + +## Data Persistence + +The database data is stored in a Docker volume named `postgres_data` which persists between container restarts. To completely reset the data, you would need to remove this volume: + +```bash +docker volume rm db_postgres_data +``` + +## Troubleshooting + +If you encounter issues, check the container logs: + +```bash +docker-compose logs postgres +``` diff --git a/lib/db/docker-compose.yml b/lib/db/docker-compose.yml new file mode 100644 index 000000000..6cc588187 --- /dev/null +++ b/lib/db/docker-compose.yml @@ -0,0 +1,28 @@ +version: '3.8' + +services: + postgres: + build: + context: . + dockerfile: Dockerfile + container_name: 25q1_postgres_db + ports: + - "5432:5432" + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: mydb + volumes: + - postgres_data:/var/lib/postgresql/data + # Uncomment to add init scripts + # - ./init-scripts:/docker-entrypoint-initdb.d/ + restart: unless-stopped + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 10s + timeout: 5s + retries: 5 + +volumes: + postgres_data: + driver: local diff --git a/lib/db/init-scripts/01-init-sample.sql b/lib/db/init-scripts/01-init-sample.sql new file mode 100644 index 000000000..446ce7bb0 --- /dev/null +++ b/lib/db/init-scripts/01-init-sample.sql @@ -0,0 +1,30 @@ +-- Sample initialization script +-- This will run when the container first initializes + +-- Create a sample table +CREATE TABLE IF NOT EXISTS sample_table ( + id SERIAL PRIMARY KEY, + name VARCHAR(100) NOT NULL, + description TEXT, + created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP +); + +-- Insert some sample data +INSERT INTO sample_table (name, description) +VALUES + ('Sample 1', 'This is a sample record'), + ('Sample 2', 'Another sample record'); + +-- Create a sample user (with limited privileges) +-- Uncomment if needed +/* +CREATE USER sampleuser WITH PASSWORD 'samplepass'; +GRANT CONNECT ON DATABASE mydb TO sampleuser; +GRANT USAGE ON SCHEMA public TO sampleuser; +GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO sampleuser; +GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO sampleuser; +*/ + +-- Note: This script runs on database creation only. If you modify it, +-- you'll need to remove the postgres_data volume to see the changes: +-- docker volume rm db_postgres_data diff --git a/lib/db/package.json b/lib/db/package.json new file mode 100644 index 000000000..1dc316aa5 --- /dev/null +++ b/lib/db/package.json @@ -0,0 +1,21 @@ +{ + "name": "postgres-docker-setup", + "version": "1.0.0", + "description": "PostgreSQL Docker setup for development", + "main": "index.js", + "scripts": { + "start": "./start-postgres.sh", + "stop": "./stop-postgres.sh", + "status": "./status-postgres.sh", + "reset": "docker-compose down && docker volume rm db_postgres_data || true && ./start-postgres.sh", + "logs": "docker-compose logs -f postgres" + }, + "keywords": [ + "postgresql", + "postgres", + "docker", + "database" + ], + "author": "", + "license": "ISC" +} \ No newline at end of file diff --git a/lib/db/start-postgres.sh b/lib/db/start-postgres.sh new file mode 100755 index 000000000..7743cc93e --- /dev/null +++ b/lib/db/start-postgres.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# Print colorful message +echo -e "\033[0;32m[INFO] Starting PostgreSQL database...\033[0m" + +# Navigate to the script directory +cd "$(dirname "$0")" + +# Check if Docker is running +if ! docker info > /dev/null 2>&1; then + echo -e "\033[0;31m[ERROR] Docker is not running. Please start Docker and try again.\033[0m" + exit 1 +fi + +# Start the PostgreSQL container +docker-compose up -d + +# Wait for PostgreSQL to be healthy +echo -e "\033[0;33m[INFO] Waiting for PostgreSQL to be ready...\033[0m" +attempt=0 +max_attempts=30 + +while [ $attempt -lt $max_attempts ]; do + if docker-compose exec postgres pg_isready -U postgres > /dev/null 2>&1; then + echo -e "\033[0;32m[SUCCESS] PostgreSQL is ready!\033[0m" + echo -e "\033[0;34m +Connection Information: + Host: localhost + Port: 5432 + Username: postgres + Password: postgres + Database: mydb + +Connect with psql: psql -h localhost -U postgres -d mydb +\033[0m" + exit 0 + fi + + attempt=$((attempt+1)) + echo -e "\033[0;33m[INFO] Waiting for database to be ready... ($attempt/$max_attempts)\033[0m" + sleep 1 +done + +echo -e "\033[0;31m[ERROR] Failed to connect to PostgreSQL after $max_attempts attempts.\033[0m" +echo "Check container logs with: docker-compose logs postgres" +exit 1 diff --git a/lib/db/status-postgres.sh b/lib/db/status-postgres.sh new file mode 100755 index 000000000..13ac9ad13 --- /dev/null +++ b/lib/db/status-postgres.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# Print colorful message +echo -e "\033[0;34m[INFO] Checking PostgreSQL database status...\033[0m" + +# Navigate to the script directory +cd "$(dirname "$0")" + +# Check if Docker is running +if ! docker info > /dev/null 2>&1; then + echo -e "\033[0;31m[ERROR] Docker is not running. Please start Docker and try again.\033[0m" + exit 1 +fi + +# Get container status +CONTAINER_ID=$(docker-compose ps -q postgres) + +if [ -z "$CONTAINER_ID" ]; then + echo -e "\033[0;33m[INFO] PostgreSQL container is not running.\033[0m" + exit 0 +fi + +# Check if container is running +if docker ps -q --no-trunc | grep -q "$CONTAINER_ID"; then + echo -e "\033[0;32m[INFO] PostgreSQL container is running.\033[0m" + + # Check if PostgreSQL is responsive + if docker-compose exec postgres pg_isready -U postgres > /dev/null 2>&1; then + echo -e "\033[0;32m[SUCCESS] PostgreSQL server is accepting connections.\033[0m" + + # Display container info + echo -e "\033[0;34m\nContainer Information:\033[0m" + docker ps --filter "id=$CONTAINER_ID" --format "ID: {{.ID}}\nName: {{.Names}}\nStatus: {{.Status}}\nPorts: {{.Ports}}\n" + + echo -e "\033[0;34m\nConnection Information: + Host: localhost + Port: 5432 + Username: postgres + Password: postgres + Database: mydb + +Connect with psql: psql -h localhost -U postgres -d mydb\033[0m" + else + echo -e "\033[0;31m[WARNING] PostgreSQL container is running but the server is not accepting connections.\033[0m" + fi +else + echo -e "\033[0;31m[ERROR] PostgreSQL container exists but is not running.\033[0m" + echo "Container status:" + docker ps -a --filter "id=$CONTAINER_ID" --format "ID: {{.ID}}\nName: {{.Names}}\nStatus: {{.Status}}\n" +fi diff --git a/lib/db/stop-postgres.sh b/lib/db/stop-postgres.sh new file mode 100755 index 000000000..1c7cd67bd --- /dev/null +++ b/lib/db/stop-postgres.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Print colorful message +echo -e "\033[0;33m[INFO] Stopping PostgreSQL database...\033[0m" + +# Navigate to the script directory +cd "$(dirname "$0")" + +# Check if Docker is running +if ! docker info > /dev/null 2>&1; then + echo -e "\033[0;31m[ERROR] Docker is not running. Please start Docker and try again.\033[0m" + exit 1 +fi + +# Stop the PostgreSQL container +docker-compose down + +# Check if the stop was successful +if [ $? -eq 0 ]; then + echo -e "\033[0;32m[SUCCESS] PostgreSQL database stopped successfully.\033[0m" +else + echo -e "\033[0;31m[ERROR] Failed to stop PostgreSQL database.\033[0m" + exit 1 +fi diff --git a/lib/javascript/fullstack_demo/docs/database-seeding.md b/lib/javascript/fullstack_demo/docs/database-seeding.md new file mode 100644 index 000000000..67c64331e --- /dev/null +++ b/lib/javascript/fullstack_demo/docs/database-seeding.md @@ -0,0 +1,56 @@ +# Database Seeding Guide + +This guide explains how to use the seed script to populate your database with sample data for development and testing. + +## What is Database Seeding? + +Database seeding is the process of populating a database with initial data. It's particularly useful for: +- Development environments +- Testing +- Providing sample data for demonstrations +- Setting up initial state for applications + +## Seed Data Contents + +The seed script populates the database with: + +- **Todos**: 12 sample todo items spread across 3 different users +- **Logs**: A single log entry recording the seed script execution + +## How to Run the Seed Script + +You can run the seed script using npm: + +```bash +npm run db:seed +``` + +Or directly using ts-node: + +```bash +npx ts-node prisma/seed.ts +``` + +## When to Run the Seed Script + +You should run the seed script: + +1. After setting up a fresh database +2. After clearing your development database +3. When you want to reset your database to a known state + +## Modifying Seed Data + +If you need to modify the seed data, edit the `/prisma/seed.ts` file. The script is structured as follows: + +1. Define sample data in arrays +2. Use Prisma Client to insert the data into the database +3. Log the results + +Feel free to add more sample data or modify existing data to suit your development needs. + +## Important Notes + +- The seed script will delete all existing todos before adding new ones +- The script adds a log entry to record its execution +- User IDs are strings and do not need to exist in an authentication system for development purposes diff --git a/lib/javascript/fullstack_demo/package-lock.json b/lib/javascript/fullstack_demo/package-lock.json index 84a50fa5f..7725becd4 100644 --- a/lib/javascript/fullstack_demo/package-lock.json +++ b/lib/javascript/fullstack_demo/package-lock.json @@ -10,7 +10,7 @@ "hasInstallScript": true, "dependencies": { "@clerk/nextjs": "^6.9.2", - "@prisma/client": "^6.1.0", + "@prisma/client": "^6.9.0", "@upstash/redis": "^1.34.3", "lowdb": "^7.0.1", "lucide-react": "^0.468.0", @@ -34,10 +34,12 @@ "jsdom": "^25.0.1", "postcss": "^8", "prettier": "^3.4.2", - "prisma": "^6.1.0", + "prisma": "^6.9.0", "react": "^18.3.1", "react-dom": "^18.3.1", "tailwindcss": "^3.4.16", + "ts-node": "^10.9.2", + "tsx": "^4.19.4", "typescript": "^5", "vite-tsconfig-paths": "^5.1.4", "vitest": "^2.1.8", @@ -525,6 +527,30 @@ "node": ">=0.1.90" } }, + "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, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@cspotcode/source-map-support/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, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "node_modules/@cypress/request": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/@cypress/request/-/request-3.0.7.tgz", @@ -886,6 +912,23 @@ "node": ">=12" } }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.5.tgz", + "integrity": "sha512-pwHtMP9viAy1oHPvgxtOv+OkduK5ugofNTVDilIzBLpoWAM16r7b/mxBvfpuQDpRQFMfuVr5aLcn4yveGvBZvw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@esbuild/netbsd-x64": { "version": "0.21.5", "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", @@ -903,6 +946,23 @@ "node": ">=12" } }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.5.tgz", + "integrity": "sha512-7A208+uQKgTxHd0G0uqZO8UjK2R0DDb4fDmERtARjSHWxqMTye4Erz4zZafx7Di9Cv+lNHYuncAkiGFySoD+Mw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@esbuild/openbsd-x64": { "version": "0.21.5", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", @@ -1498,71 +1558,95 @@ } }, "node_modules/@prisma/client": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@prisma/client/-/client-6.1.0.tgz", - "integrity": "sha512-AbQYc5+EJKm1Ydfq3KxwcGiy7wIbm4/QbjCKWWoNROtvy7d6a3gmAGkKjK0iUCzh+rHV8xDhD5Cge8ke/kiy5Q==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-6.9.0.tgz", + "integrity": "sha512-Gg7j1hwy3SgF1KHrh0PZsYvAaykeR0PaxusnLXydehS96voYCGt1U5zVR31NIouYc63hWzidcrir1a7AIyCsNQ==", "hasInstallScript": true, "license": "Apache-2.0", "engines": { "node": ">=18.18" }, "peerDependencies": { - "prisma": "*" + "prisma": "*", + "typescript": ">=5.1.0" }, "peerDependenciesMeta": { "prisma": { "optional": true + }, + "typescript": { + "optional": true } } }, + "node_modules/@prisma/config": { + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@prisma/config/-/config-6.9.0.tgz", + "integrity": "sha512-Wcfk8/lN3WRJd5w4jmNQkUwhUw0eksaU/+BlAJwPQKW10k0h0LC9PD/6TQFmqKVbHQL0vG2z266r0S1MPzzhbA==", + "devOptional": true, + "license": "Apache-2.0", + "dependencies": { + "jiti": "2.4.2" + } + }, + "node_modules/@prisma/config/node_modules/jiti": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.4.2.tgz", + "integrity": "sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==", + "devOptional": true, + "license": "MIT", + "bin": { + "jiti": "lib/jiti-cli.mjs" + } + }, "node_modules/@prisma/debug": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.1.0.tgz", - "integrity": "sha512-0himsvcM4DGBTtvXkd2Tggv6sl2JyUYLzEGXXleFY+7Kp6rZeSS3hiTW9mwtUlXrwYbJP6pwlVNB7jYElrjWUg==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.9.0.tgz", + "integrity": "sha512-bFeur/qi/Q+Mqk4JdQ3R38upSYPebv5aOyD1RKywVD+rAMLtRkmTFn28ZuTtVOnZHEdtxnNOCH+bPIeSGz1+Fg==", "devOptional": true, "license": "Apache-2.0" }, "node_modules/@prisma/engines": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-6.1.0.tgz", - "integrity": "sha512-GnYJbCiep3Vyr1P/415ReYrgJUjP79fBNc1wCo7NP6Eia0CzL2Ot9vK7Infczv3oK7JLrCcawOSAxFxNFsAERQ==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-6.9.0.tgz", + "integrity": "sha512-im0X0bwDLA0244CDf8fuvnLuCQcBBdAGgr+ByvGfQY9wWl6EA+kRGwVk8ZIpG65rnlOwtaWIr/ZcEU5pNVvq9g==", "devOptional": true, "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "6.1.0", - "@prisma/engines-version": "6.1.0-21.11f085a2012c0f4778414c8db2651556ee0ef959", - "@prisma/fetch-engine": "6.1.0", - "@prisma/get-platform": "6.1.0" + "@prisma/debug": "6.9.0", + "@prisma/engines-version": "6.9.0-10.81e4af48011447c3cc503a190e86995b66d2a28e", + "@prisma/fetch-engine": "6.9.0", + "@prisma/get-platform": "6.9.0" } }, "node_modules/@prisma/engines-version": { - "version": "6.1.0-21.11f085a2012c0f4778414c8db2651556ee0ef959", - "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-6.1.0-21.11f085a2012c0f4778414c8db2651556ee0ef959.tgz", - "integrity": "sha512-PdJqmYM2Fd8K0weOOtQThWylwjsDlTig+8Pcg47/jszMuLL9iLIaygC3cjWJLda69siRW4STlCTMSgOjZzvKPQ==", + "version": "6.9.0-10.81e4af48011447c3cc503a190e86995b66d2a28e", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-6.9.0-10.81e4af48011447c3cc503a190e86995b66d2a28e.tgz", + "integrity": "sha512-Qp9gMoBHgqhKlrvumZWujmuD7q4DV/gooEyPCLtbkc13EZdSz2RsGUJ5mHb3RJgAbk+dm6XenqG7obJEhXcJ6Q==", "devOptional": true, "license": "Apache-2.0" }, "node_modules/@prisma/fetch-engine": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-6.1.0.tgz", - "integrity": "sha512-asdFi7TvPlEZ8CzSZ/+Du5wZ27q6OJbRSXh+S8ISZguu+S9KtS/gP7NeXceZyb1Jv1SM1S5YfiCv+STDsG6rrg==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-6.9.0.tgz", + "integrity": "sha512-PMKhJdl4fOdeE3J3NkcWZ+tf3W6rx3ht/rLU8w4SXFRcLhd5+3VcqY4Kslpdm8osca4ej3gTfB3+cSk5pGxgFg==", "devOptional": true, "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "6.1.0", - "@prisma/engines-version": "6.1.0-21.11f085a2012c0f4778414c8db2651556ee0ef959", - "@prisma/get-platform": "6.1.0" + "@prisma/debug": "6.9.0", + "@prisma/engines-version": "6.9.0-10.81e4af48011447c3cc503a190e86995b66d2a28e", + "@prisma/get-platform": "6.9.0" } }, "node_modules/@prisma/get-platform": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-6.1.0.tgz", - "integrity": "sha512-ia8bNjboBoHkmKGGaWtqtlgQOhCi7+f85aOkPJKgNwWvYrT6l78KgojLekE8zMhVk0R9lWcifV0Pf8l3/15V0Q==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-6.9.0.tgz", + "integrity": "sha512-/B4n+5V1LI/1JQcHp+sUpyRT1bBgZVPHbsC4lt4/19Xp4jvNIVcq5KYNtQDk5e/ukTSjo9PZVAxxy9ieFtlpTQ==", "devOptional": true, "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "6.1.0" + "@prisma/debug": "6.9.0" } }, "node_modules/@rollup/rollup-android-arm-eabi": { @@ -1919,6 +2003,34 @@ } } }, + "node_modules/@tsconfig/node10": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/aria-query": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", @@ -2510,6 +2622,19 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/acorn-walk": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/agent-base": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz", @@ -3566,6 +3691,13 @@ "dev": true, "license": "MIT" }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true, + "license": "MIT" + }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -3923,6 +4055,16 @@ "dev": true, "license": "Apache-2.0" }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/dlv": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", @@ -6911,6 +7053,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true, + "license": "ISC" + }, "node_modules/map-obj": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", @@ -7830,14 +7979,15 @@ "license": "MIT" }, "node_modules/prisma": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-6.1.0.tgz", - "integrity": "sha512-aFI3Yi+ApUxkwCJJwyQSwpyzUX7YX3ihzuHNHOyv4GJg3X5tQsmRaJEnZ+ZyfHpMtnyahhmXVfbTZ+lS8ZtfKw==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-6.9.0.tgz", + "integrity": "sha512-resJAwMyZREC/I40LF6FZ6rZTnlrlrYrb63oW37Gq+U+9xHwbyMSPJjKtM7VZf3gTO86t/Oyz+YeSXr3CmAY1Q==", "devOptional": true, "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@prisma/engines": "6.1.0" + "@prisma/config": "6.9.0", + "@prisma/engines": "6.9.0" }, "bin": { "prisma": "build/index.js" @@ -7845,8 +7995,13 @@ "engines": { "node": ">=18.18" }, - "optionalDependencies": { - "fsevents": "2.3.3" + "peerDependencies": { + "typescript": ">=5.1.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, "node_modules/process": { @@ -9238,6 +9393,57 @@ "dev": true, "license": "Apache-2.0" }, + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/ts-node/node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true, + "license": "MIT" + }, "node_modules/tsconfck": { "version": "3.1.4", "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-3.1.4.tgz", @@ -9278,6 +9484,458 @@ "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", "license": "0BSD" }, + "node_modules/tsx": { + "version": "4.19.4", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.4.tgz", + "integrity": "sha512-gK5GVzDkJK1SI1zwHf32Mqxf2tSJkNx+eYcNly5+nHvWqXUJYUkWBQtKauoESz3ymezAI++ZwT855x5p5eop+Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.25.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/tsx/node_modules/@esbuild/aix-ppc64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.5.tgz", + "integrity": "sha512-9o3TMmpmftaCMepOdA5k/yDw8SfInyzWWTjYTFCX3kPSDJMROQTb8jg+h9Cnwnmm1vOzvxN7gIfB5V2ewpjtGA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.5.tgz", + "integrity": "sha512-AdJKSPeEHgi7/ZhuIPtcQKr5RQdo6OO2IL87JkianiMYMPbCtot9fxPbrMiBADOWWm3T2si9stAiVsGbTQFkbA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.5.tgz", + "integrity": "sha512-VGzGhj4lJO+TVGV1v8ntCZWJktV7SGCs3Pn1GRWI1SBFtRALoomm8k5E9Pmwg3HOAal2VDc2F9+PM/rEY6oIDg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.5.tgz", + "integrity": "sha512-D2GyJT1kjvO//drbRT3Hib9XPwQeWd9vZoBJn+bu/lVsOZ13cqNdDeqIF/xQ5/VmWvMduP6AmXvylO/PIc2isw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.5.tgz", + "integrity": "sha512-GtaBgammVvdF7aPIgH2jxMDdivezgFu6iKpmT+48+F8Hhg5J/sfnDieg0aeG/jfSvkYQU2/pceFPDKlqZzwnfQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.5.tgz", + "integrity": "sha512-1iT4FVL0dJ76/q1wd7XDsXrSW+oLoquptvh4CLR4kITDtqi2e/xwXwdCVH8hVHU43wgJdsq7Gxuzcs6Iq/7bxQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.5.tgz", + "integrity": "sha512-nk4tGP3JThz4La38Uy/gzyXtpkPW8zSAmoUhK9xKKXdBCzKODMc2adkB2+8om9BDYugz+uGV7sLmpTYzvmz6Sw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.5.tgz", + "integrity": "sha512-PrikaNjiXdR2laW6OIjlbeuCPrPaAl0IwPIaRv+SMV8CiM8i2LqVUHFC1+8eORgWyY7yhQY+2U2fA55mBzReaw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.5.tgz", + "integrity": "sha512-cPzojwW2okgh7ZlRpcBEtsX7WBuqbLrNXqLU89GxWbNt6uIg78ET82qifUy3W6OVww6ZWobWub5oqZOVtwolfw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.5.tgz", + "integrity": "sha512-Z9kfb1v6ZlGbWj8EJk9T6czVEjjq2ntSYLY2cw6pAZl4oKtfgQuS4HOq41M/BcoLPzrUbNd+R4BXFyH//nHxVg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ia32": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.5.tgz", + "integrity": "sha512-sQ7l00M8bSv36GLV95BVAdhJ2QsIbCuCjh/uYrWiMQSUuV+LpXwIqhgJDcvMTj+VsQmqAHL2yYaasENvJ7CDKA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-loong64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.5.tgz", + "integrity": "sha512-0ur7ae16hDUC4OL5iEnDb0tZHDxYmuQyhKhsPBV8f99f6Z9KQM02g33f93rNH5A30agMS46u2HP6qTdEt6Q1kg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-mips64el": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.5.tgz", + "integrity": "sha512-kB/66P1OsHO5zLz0i6X0RxlQ+3cu0mkxS3TKFvkb5lin6uwZ/ttOkP3Z8lfR9mJOBk14ZwZ9182SIIWFGNmqmg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ppc64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.5.tgz", + "integrity": "sha512-UZCmJ7r9X2fe2D6jBmkLBMQetXPXIsZjQJCjgwpVDz+YMcS6oFR27alkgGv3Oqkv07bxdvw7fyB71/olceJhkQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-riscv64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.5.tgz", + "integrity": "sha512-kTxwu4mLyeOlsVIFPfQo+fQJAV9mh24xL+y+Bm6ej067sYANjyEw1dNHmvoqxJUCMnkBdKpvOn0Ahql6+4VyeA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-s390x": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.5.tgz", + "integrity": "sha512-K2dSKTKfmdh78uJ3NcWFiqyRrimfdinS5ErLSn3vluHNeHVnBAFWC8a4X5N+7FgVE1EjXS1QDZbpqZBjfrqMTQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.5.tgz", + "integrity": "sha512-uhj8N2obKTE6pSZ+aMUbqq+1nXxNjZIIjCjGLfsWvVpy7gKCOL6rsY1MhRh9zLtUtAI7vpgLMK6DxjO8Qm9lJw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/netbsd-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.5.tgz", + "integrity": "sha512-WOb5fKrvVTRMfWFNCroYWWklbnXH0Q5rZppjq0vQIdlsQKuw6mdSihwSo4RV/YdQ5UCKKvBy7/0ZZYLBZKIbwQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/openbsd-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.5.tgz", + "integrity": "sha512-G4hE405ErTWraiZ8UiSoesH8DaCsMm0Cay4fsFWOOUcz8b8rC6uCvnagr+gnioEjWn0wC+o1/TAHt+It+MpIMg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/sunos-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.5.tgz", + "integrity": "sha512-l+azKShMy7FxzY0Rj4RCt5VD/q8mG/e+mDivgspo+yL8zW7qEwctQ6YqKX34DTEleFAvCIUviCFX1SDZRSyMQA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.5.tgz", + "integrity": "sha512-O2S7SNZzdcFG7eFKgvwUEZ2VG9D/sn/eIiz8XRZ1Q/DO5a3s76Xv0mdBzVM5j5R639lXQmPmSo0iRpHqUUrsxw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-ia32": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.5.tgz", + "integrity": "sha512-onOJ02pqs9h1iMJ1PQphR+VZv8qBMQ77Klcsqv9CNW2w6yLqoURLcgERAIurY6QE63bbLuqgP9ATqajFLK5AMQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.5.tgz", + "integrity": "sha512-TXv6YnJ8ZMVdX+SXWVBo/0p8LTcrUYngpWjvm91TMjjBQii7Oz11Lw5lbDV5Y0TzuhSJHwiH4hEtC1I42mMS0g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/esbuild": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.5.tgz", + "integrity": "sha512-P8OtKZRv/5J5hhz0cUAdu/cLuPIKXpQl1R9pZtvmHWQvrAUVd0UNIPT4IB4W3rNOqVO0rlqHmCIbSwxh/c9yUQ==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.5", + "@esbuild/android-arm": "0.25.5", + "@esbuild/android-arm64": "0.25.5", + "@esbuild/android-x64": "0.25.5", + "@esbuild/darwin-arm64": "0.25.5", + "@esbuild/darwin-x64": "0.25.5", + "@esbuild/freebsd-arm64": "0.25.5", + "@esbuild/freebsd-x64": "0.25.5", + "@esbuild/linux-arm": "0.25.5", + "@esbuild/linux-arm64": "0.25.5", + "@esbuild/linux-ia32": "0.25.5", + "@esbuild/linux-loong64": "0.25.5", + "@esbuild/linux-mips64el": "0.25.5", + "@esbuild/linux-ppc64": "0.25.5", + "@esbuild/linux-riscv64": "0.25.5", + "@esbuild/linux-s390x": "0.25.5", + "@esbuild/linux-x64": "0.25.5", + "@esbuild/netbsd-arm64": "0.25.5", + "@esbuild/netbsd-x64": "0.25.5", + "@esbuild/openbsd-arm64": "0.25.5", + "@esbuild/openbsd-x64": "0.25.5", + "@esbuild/sunos-x64": "0.25.5", + "@esbuild/win32-arm64": "0.25.5", + "@esbuild/win32-ia32": "0.25.5", + "@esbuild/win32-x64": "0.25.5" + } + }, "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -9405,7 +10063,7 @@ "version": "5.7.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", - "dev": true, + "devOptional": true, "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", @@ -9534,6 +10192,13 @@ "uuid": "dist/esm/bin/uuid" } }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true, + "license": "MIT" + }, "node_modules/verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", @@ -10141,6 +10806,16 @@ "fd-slicer": "~1.1.0" } }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/lib/javascript/fullstack_demo/package.json b/lib/javascript/fullstack_demo/package.json index 8cf246b2b..1908007d0 100644 --- a/lib/javascript/fullstack_demo/package.json +++ b/lib/javascript/fullstack_demo/package.json @@ -11,11 +11,12 @@ "test": "vitest", "test:coverage": "vitest run --coverage", "postinstall": "prisma generate", - "cy:open": "cypress open" + "cy:open": "cypress open", + "db:seed": "tsx prisma/seed.ts" }, "dependencies": { "@clerk/nextjs": "^6.9.2", - "@prisma/client": "^6.1.0", + "@prisma/client": "^6.9.0", "@upstash/redis": "^1.34.3", "lowdb": "^7.0.1", "lucide-react": "^0.468.0", @@ -39,13 +40,15 @@ "jsdom": "^25.0.1", "postcss": "^8", "prettier": "^3.4.2", - "prisma": "^6.1.0", + "prisma": "^6.9.0", "react": "^18.3.1", "react-dom": "^18.3.1", "tailwindcss": "^3.4.16", + "ts-node": "^10.9.2", + "tsx": "^4.19.4", "typescript": "^5", "vite-tsconfig-paths": "^5.1.4", "vitest": "^2.1.8", "vitest-fetch-mock": "^0.4.3" } -} +} \ No newline at end of file diff --git a/lib/javascript/fullstack_demo/prisma/migrations/20250609182117_initial_schema/migration.sql b/lib/javascript/fullstack_demo/prisma/migrations/20250609182117_initial_schema/migration.sql new file mode 100644 index 000000000..8f4953f14 --- /dev/null +++ b/lib/javascript/fullstack_demo/prisma/migrations/20250609182117_initial_schema/migration.sql @@ -0,0 +1,22 @@ +-- CreateTable +CREATE TABLE "Todos" ( + "id" BIGSERIAL NOT NULL, + "user_id" VARCHAR NOT NULL, + "text" VARCHAR NOT NULL DEFAULT '', + "completed" BOOLEAN NOT NULL DEFAULT false, + "created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "Todos_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Logs" ( + "id" UUID NOT NULL DEFAULT gen_random_uuid(), + "level" VARCHAR NOT NULL, + "message" VARCHAR NOT NULL DEFAULT '', + "timestamp" TIMESTAMP(6) NOT NULL, + "meta" JSONB, + + CONSTRAINT "Logs_pkey" PRIMARY KEY ("id") +); diff --git a/lib/javascript/fullstack_demo/prisma/migrations/migration_lock.toml b/lib/javascript/fullstack_demo/prisma/migrations/migration_lock.toml new file mode 100644 index 000000000..044d57cdb --- /dev/null +++ b/lib/javascript/fullstack_demo/prisma/migrations/migration_lock.toml @@ -0,0 +1,3 @@ +# Please do not edit this file manually +# It should be added in your version-control system (e.g., Git) +provider = "postgresql" diff --git a/lib/javascript/fullstack_demo/prisma/schema.prisma b/lib/javascript/fullstack_demo/prisma/schema.prisma index c67f6a70f..24e860a88 100644 --- a/lib/javascript/fullstack_demo/prisma/schema.prisma +++ b/lib/javascript/fullstack_demo/prisma/schema.prisma @@ -2,6 +2,12 @@ generator client { provider = "prisma-client-js" } +// Define seed script +generator seeder { + provider = "ts-node" + output = "../prisma/seed.ts" +} + datasource db { provider = "postgresql" url = env("DATABASE_URL") diff --git a/lib/javascript/fullstack_demo/prisma/seed.ts b/lib/javascript/fullstack_demo/prisma/seed.ts new file mode 100644 index 000000000..bdc86efea --- /dev/null +++ b/lib/javascript/fullstack_demo/prisma/seed.ts @@ -0,0 +1,111 @@ +import { PrismaClient } from '@prisma/client'; + +const prisma = new PrismaClient(); + +async function main() { + console.log('Starting seed process...'); + + // Clean up existing records to avoid duplicates + await prisma.todos.deleteMany({}); + + // Sample todos for a couple of different users + const sampleTodos = [ + // User 1 todos + { + user_id: 'user1', + text: 'Complete project documentation', + completed: false, + }, + { + user_id: 'user1', + text: 'Review pull requests', + completed: true, + }, + { + user_id: 'user1', + text: 'Plan sprint meeting', + completed: false, + }, + { + user_id: 'user1', + text: 'Fix high priority bugs', + completed: false, + }, + { + user_id: 'user1', + text: 'Update dependencies', + completed: true, + }, + + // User 2 todos + { + user_id: 'user2', + text: 'Learn about Docker', + completed: false, + }, + { + user_id: 'user2', + text: 'Prepare presentation', + completed: true, + }, + { + user_id: 'user2', + text: 'Research new technologies', + completed: false, + }, + { + user_id: 'user2', + text: 'Set up CI/CD pipeline', + completed: false, + }, + + // User 3 todos + { + user_id: 'user3', + text: 'Design new interface', + completed: false, + }, + { + user_id: 'user3', + text: 'Create wireframes', + completed: true, + }, + { + user_id: 'user3', + text: 'Implement dark mode', + completed: true, + }, + ]; + + // Insert todos in batches + const createdTodos = await Promise.all( + sampleTodos.map(async (todo) => { + return prisma.todos.create({ + data: todo, + }); + }), + ); + + console.log(`Created ${createdTodos.length} todos`); + + // You can add sample logs as well if needed + await prisma.logs.create({ + data: { + level: 'info', + message: 'Seed script executed', + timestamp: new Date(), + meta: { action: 'seed', numberOfTodos: createdTodos.length }, + }, + }); + + console.log('Seed completed successfully!'); +} + +main() + .catch((e) => { + console.error('Error during seeding:', e); + process.exit(1); + }) + .finally(async () => { + await prisma.$disconnect(); + });