diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..f00accb --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,85 @@ +name: CI +on: + workflow_dispatch: + pull_request: + types: + - opened + - reopened + - synchronize + paths-ignore: + - '.github/**' + - '!.github/workflows/ci.yaml' + - '.gitignore' + - '**.md' + + push: + branches: + - main + - release@* + paths-ignore: + - '.github/**' + - '!.github/workflows/ci.yaml' + - '.gitignore' + - '**.md' + +concurrency: + # Documentation suggests ${{ github.head_ref }}, but that's only available on pull_request/pull_request_target triggers, so using ${{ github.ref }}. + # On main, we want all builds to complete even if merging happens faster to make it easier to discover at which point something broke. + group: ci-${{ github.ref_name == 'main' && format('ci-main-{0}', github.sha) || format('ci-{0}', github.ref) }} + cancel-in-progress: true + +permissions: + contents: read + id-token: write + +jobs: + code-style: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: Check Out + uses: actions/checkout@v4 + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Enable corepack + run: | + corepack enable + corepack prepare pnpm@latest --activate + + - name: Install deps + run: pnpm install --frozen-lockfile + + - name: Run Code Style Check + run: pnpm run lint + + tests: + runs-on: ubuntu-latest + timeout-minutes: 25 + steps: + - name: Check Out + uses: actions/checkout@v4 + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Enable corepack + run: | + corepack enable + corepack prepare pnpm@latest --activate + + - name: Install deps + run: pnpm install --frozen-lockfile + + - name: Start Docker Compose Services + shell: bash + run: | + docker compose up -d --no-build --no-deps --quiet-pull --wait + + - name: Run Test Suite + run: pnpm run test diff --git a/.gitignore b/.gitignore index fc175f8..2ee7fbf 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ node_modules # dist /dist + +**/*.tgz diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..a85cf43 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,15 @@ +services: + database: + image: postgres + restart: always + environment: + POSTGRES_USER: ${DATABASE_USER:-lucia} + POSTGRES_PASSWORD: ${DATABASE_PASSWORD:-lucia} + POSTGRES_DB: ${DATABASE_NAME:-lucia} + ports: + - "5432:5432" + volumes: + - database:/var/lib/postgresql/data - +volumes: + database: + driver: local \ No newline at end of file diff --git a/eslint.config.mjs b/eslint.config.mjs index 73012c8..559801f 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -3,6 +3,9 @@ import tseslint from 'typescript-eslint'; import stylistic from '@stylistic/eslint-plugin'; export default tseslint.config( + { + ignores: ['**/*.js'], + }, eslint.configs.recommended, ...tseslint.configs.recommended, stylistic.configs.customize({ diff --git a/package.json b/package.json index f9a3b78..3a10d4d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tony-stark-eth/lucia-mikro-orm-adapter", - "version": "1.0.0", + "version": "2.0.0", "description": "mikro-orm adapter for lucia auth", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -8,14 +8,26 @@ "type": "module", "packageManager": "pnpm@9.10.0", "engines": { + "node": "^20.0.0", "pnpm": "^9.0.0" }, "exports": { - ".": "./dist/index.js" + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js" + }, + "./*": { + "types": "./dist/*.d.ts", + "import": "./dist/*.js" + }, + "./**/*": { + "types": "./dist/**/*.d.ts", + "import": "./dist/**/*.js" + } }, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "build": "pnpm run lint:fix && tsc && tsc-alias", + "test": "tsx tests/mikro-orm-postgres.ts", + "build": "pnpm run lint:fix && tsc -p tsconfig.json", "release": "pnpm run lint:fix && release-it", "lint": "pnpm run lint:base -- .", "lint:base": "eslint --cache --cache-location='node_modules/.cache/eslint/'", @@ -44,16 +56,19 @@ }, "devDependencies": { "@eslint/js": "^9.11.1", - "@mikro-orm/core": "^6.3.10", + "@mikro-orm/core": "^6.3.11", + "@mikro-orm/postgresql": "^6.3.11", "@stylistic/eslint-plugin": "^2.8.0", "@types/eslint__js": "^8.42.3", - "@types/node": "^22.7.1", + "@types/node": "^20.0.0", "@types/uuid": "^10.0.0", "eslint": "^9.11.1", "lucia": "^3.2.0", + "npm-pkg-lint": "^3.9.0", "release-it": "^17.6.0", "release-it-pnpm": "^4.6.3", "tsc-alias": "^1.8.10", + "tsx": "^4.19.1", "typescript": "^5.6.2", "typescript-eslint": "^8.7.0" }, @@ -62,5 +77,11 @@ }, "publishConfig": { "access": "public" - } + }, + "files": [ + "dist", + "src", + "README.md", + "LICENSE" + ] } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 165fd79..3c8638b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,8 +16,11 @@ importers: specifier: ^9.11.1 version: 9.11.1 '@mikro-orm/core': - specifier: ^6.3.10 - version: 6.3.10 + specifier: ^6.3.11 + version: 6.3.11 + '@mikro-orm/postgresql': + specifier: ^6.3.11 + version: 6.3.11(@mikro-orm/core@6.3.11) '@stylistic/eslint-plugin': specifier: ^2.8.0 version: 2.8.0(eslint@9.11.1(jiti@1.21.6))(typescript@5.6.2) @@ -25,8 +28,8 @@ importers: specifier: ^8.42.3 version: 8.42.3 '@types/node': - specifier: ^22.7.1 - version: 22.7.1 + specifier: ^20.0.0 + version: 20.16.10 '@types/uuid': specifier: ^10.0.0 version: 10.0.0 @@ -36,6 +39,9 @@ importers: lucia: specifier: ^3.2.0 version: 3.2.0 + npm-pkg-lint: + specifier: ^3.9.0 + version: 3.9.0 release-it: specifier: ^17.6.0 version: 17.6.0(typescript@5.6.2) @@ -45,6 +51,9 @@ importers: tsc-alias: specifier: ^1.8.10 version: 1.8.10 + tsx: + specifier: ^4.19.1 + version: 4.19.1 typescript: specifier: ^5.6.2 version: 5.6.2 @@ -87,6 +96,150 @@ packages: '@emnapi/runtime@0.45.0': resolution: {integrity: sha512-Txumi3td7J4A/xTTwlssKieHKTGl3j4A1tglBx72auZ49YK7ePY6XZricgIg9mnZT4xPfA+UPCUdnhRuEFDL+w==} + '@esbuild/aix-ppc64@0.23.1': + resolution: {integrity: sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.23.1': + resolution: {integrity: sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.23.1': + resolution: {integrity: sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.23.1': + resolution: {integrity: sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.23.1': + resolution: {integrity: sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.23.1': + resolution: {integrity: sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.23.1': + resolution: {integrity: sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.23.1': + resolution: {integrity: sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.23.1': + resolution: {integrity: sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.23.1': + resolution: {integrity: sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.23.1': + resolution: {integrity: sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.23.1': + resolution: {integrity: sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.23.1': + resolution: {integrity: sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.23.1': + resolution: {integrity: sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.23.1': + resolution: {integrity: sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.23.1': + resolution: {integrity: sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.23.1': + resolution: {integrity: sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-x64@0.23.1': + resolution: {integrity: sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-arm64@0.23.1': + resolution: {integrity: sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.23.1': + resolution: {integrity: sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/sunos-x64@0.23.1': + resolution: {integrity: sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.23.1': + resolution: {integrity: sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.23.1': + resolution: {integrity: sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.23.1': + resolution: {integrity: sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + '@eslint-community/eslint-utils@4.4.0': resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -140,9 +293,31 @@ packages: resolution: {integrity: sha512-f5DRIOZf7wxogefH03RjMPMdBF7ADTWUMoOs9kaJo06EfwF+aFhMZMDZxHg/Xe12hptN9xoZjGso2fdjapBRIA==} engines: {node: '>=10'} - '@mikro-orm/core@6.3.10': - resolution: {integrity: sha512-Z41EbAYY3eESvJEV8V6jpFevGiy95qLUmII6iXGsQ3aU6yu3JLKilQ1xoP86q7raMXODWui1lhumdbCHD7KrRQ==} + '@mikro-orm/core@6.3.11': + resolution: {integrity: sha512-pNd74bIDwpWMC0TV4R3hPIddzaydDzvv5pRi7QvX6UdASDEUdWfp185cH6QRi1bbWqlI70GXOBR8Bnzj1bbtpA==} + engines: {node: '>= 18.12.0'} + + '@mikro-orm/knex@6.3.11': + resolution: {integrity: sha512-RDT3s+FTpB5rP81s7yVdgvTBwt4gRGUBsL08WPmlroJ8ADrLQVdywQPOIdXFhoDNDJPVD7Ht/KGvy2IyIpuOeg==} + engines: {node: '>= 18.12.0'} + peerDependencies: + '@mikro-orm/core': ^6.0.0 + better-sqlite3: '*' + libsql: '*' + mariadb: '*' + peerDependenciesMeta: + better-sqlite3: + optional: true + libsql: + optional: true + mariadb: + optional: true + + '@mikro-orm/postgresql@6.3.11': + resolution: {integrity: sha512-0SXVybnarlTOiO1wm77ZGTB9243u3WC2OXyKosTmJUoVRvrwMDZrbuiHjRdRNZQQH9zV7wuRNOY7JyMJ/HUaBQ==} engines: {node: '>= 18.12.0'} + peerDependencies: + '@mikro-orm/core': ^6.0.0 '@node-rs/argon2-android-arm-eabi@1.7.0': resolution: {integrity: sha512-udDqkr5P9E+wYX1SZwAVPdyfYvaF4ry9Tm+R9LkfSHbzWH0uhU6zjIwNRp7m+n4gx691rk+lqqDAIP8RLKwbhg==} @@ -440,8 +615,8 @@ packages: '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - '@types/node@22.7.1': - resolution: {integrity: sha512-adOMRLVmleuWs/5V/w5/l7o0chDK/az+5ncCsIapTKogsu/3MVWvSgP58qVTXi5IwpfGt8pMobNq9rOWtJyu5Q==} + '@types/node@20.16.10': + resolution: {integrity: sha512-vQUKgWTjEIRFCvK6CyriPH3MZYiYlNy0fKiEYHWbcoWLEgs4opurGGKlebrTLqdSMIbXImH6XExNiIyNUv3WpA==} '@types/semver@7.5.8': resolution: {integrity: sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==} @@ -736,9 +911,16 @@ packages: color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + colorette@2.0.19: + resolution: {integrity: sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==} + colorette@2.0.20: resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} + commander@10.0.1: + resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==} + engines: {node: '>=14'} + commander@9.5.0: resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==} engines: {node: ^12.20.0 || >=14} @@ -816,6 +998,15 @@ packages: dataloader@2.2.2: resolution: {integrity: sha512-8YnDaaf7N3k/q5HnTJVuzSyLETjoZjVmHc4AeKAzOvKHEFQKcn64OKBfzHYtE9zGjctNM7V9I0MfnUVLpi7M5g==} + debug@4.3.4: + resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + debug@4.3.7: resolution: {integrity: sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==} engines: {node: '>=6.0'} @@ -911,6 +1102,11 @@ packages: error-ex@1.3.2: resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==} + esbuild@0.23.1: + resolution: {integrity: sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==} + engines: {node: '>=18'} + hasBin: true + escalade@3.2.0: resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} engines: {node: '>=6'} @@ -954,6 +1150,10 @@ packages: jiti: optional: true + esm@3.2.25: + resolution: {integrity: sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==} + engines: {node: '>=6'} + espree@10.1.0: resolution: {integrity: sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1076,6 +1276,10 @@ packages: resolution: {integrity: sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==} engines: {node: '>=18'} + get-package-type@0.1.0: + resolution: {integrity: sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==} + engines: {node: '>=8.0.0'} + get-stream@6.0.1: resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} engines: {node: '>=10'} @@ -1088,10 +1292,16 @@ packages: resolution: {integrity: sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA==} engines: {node: '>=18'} + get-tsconfig@4.8.1: + resolution: {integrity: sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==} + get-uri@6.0.3: resolution: {integrity: sha512-BzUrJBS9EcUb4cFol8r4W3v1cPsSyajLSthNkz5BxbpDcHN5tIrM10E2eNvfnvBn3DaT3DUgx0OpsBKkaOpanw==} engines: {node: '>= 14'} + getopts@2.3.0: + resolution: {integrity: sha512-5eDf9fuSXwxBL6q5HX+dhDj+dslFGWzU5thZ9kNKUkcPtaPdatmUFKwHFrLb/uf/WpA4BHET+AX3Scl56cAjpA==} + giget@1.2.3: resolution: {integrity: sha512-8EHPljDvs7qKykr6uw8b+lqLiUc/vUg+KVTI0uND4s63TdsZM2Xus3mflvF0DDG9SiM4RlCkFGL+7aAjRmV7KA==} hasBin: true @@ -1235,6 +1445,10 @@ packages: resolution: {integrity: sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==} engines: {node: '>= 0.10'} + interpret@2.2.0: + resolution: {integrity: sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==} + engines: {node: '>= 0.10'} + ip-address@9.0.5: resolution: {integrity: sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==} engines: {node: '>= 12'} @@ -1406,6 +1620,34 @@ packages: resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} engines: {node: '>=6'} + knex@3.1.0: + resolution: {integrity: sha512-GLoII6hR0c4ti243gMs5/1Rb3B+AjwMOfjYm97pu0FOQa7JH56hgBxYf5WK2525ceSbBY1cjeZ9yk99GPMB6Kw==} + engines: {node: '>=16'} + hasBin: true + peerDependencies: + better-sqlite3: '*' + mysql: '*' + mysql2: '*' + pg: '*' + pg-native: '*' + sqlite3: '*' + tedious: '*' + peerDependenciesMeta: + better-sqlite3: + optional: true + mysql: + optional: true + mysql2: + optional: true + pg: + optional: true + pg-native: + optional: true + sqlite3: + optional: true + tedious: + optional: true + kolorist@1.8.0: resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==} @@ -1494,8 +1736,8 @@ packages: resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} engines: {node: '>=8.6'} - mikro-orm@6.3.10: - resolution: {integrity: sha512-IgVZ2HElW6hgG9P7IT5jvR7PE4CKk/PAQPlNV+mwf9j+m1OdpllW7sSBXgY5ZA8VMGoYAags2Jkvw/pXj5bspA==} + mikro-orm@6.3.11: + resolution: {integrity: sha512-RaOd6+3jm9TLtBAJ9vtgpzt6CnzARZwKZjLaNvXL65BLammDp8QWRBmUUqNPp0xwWYqdFgH8V7YFG/fyuMEJXQ==} engines: {node: '>= 18.12.0'} mime-db@1.52.0: @@ -1556,6 +1798,9 @@ packages: resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} engines: {node: '>=4'} + ms@2.1.2: + resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} @@ -1597,6 +1842,11 @@ packages: resolution: {integrity: sha512-IO9QvjUMWxPQQhs60oOu10CRkWCiZzSUkzbXGGV9pviYl1fXYcvkzQ5jV9z8Y6un8ARoVRl4EtC6v6jNqbaJ/w==} engines: {node: '>=14.16'} + npm-pkg-lint@3.9.0: + resolution: {integrity: sha512-6KNbUu+YSvJWv99pL5kOhACK8+8rWSIUohSG3cHxNxcJX57VQ44dXM1xVr8Ohf6pwaiq/IALqaBFAOtbv34bVQ==} + engines: {node: '>= 18.19'} + hasBin: true + npm-run-path@4.0.1: resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} engines: {node: '>=8'} @@ -1737,6 +1987,43 @@ packages: perfect-debounce@1.0.0: resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==} + pg-cloudflare@1.1.1: + resolution: {integrity: sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q==} + + pg-connection-string@2.6.2: + resolution: {integrity: sha512-ch6OwaeaPYcova4kKZ15sbJ2hKb/VP48ZD2gE7i1J+L4MspCtBMAx8nMgz7bksc7IojCIIWuEhHibSMFH8m8oA==} + + pg-connection-string@2.7.0: + resolution: {integrity: sha512-PI2W9mv53rXJQEOb8xNR8lH7Hr+EKa6oJa38zsK0S/ky2er16ios1wLKhZyxzD7jUReiWokc9WK5nxSnC7W1TA==} + + pg-int8@1.0.1: + resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==} + engines: {node: '>=4.0.0'} + + pg-pool@3.7.0: + resolution: {integrity: sha512-ZOBQForurqh4zZWjrgSwwAtzJ7QiRX0ovFkZr2klsen3Nm0aoh33Ls0fzfv3imeH/nw/O27cjdz5kzYJfeGp/g==} + peerDependencies: + pg: '>=8.0' + + pg-protocol@1.7.0: + resolution: {integrity: sha512-hTK/mE36i8fDDhgDFjy6xNOG+LCorxLG3WO17tku+ij6sVHXh1jQUJ8hYAnRhNla4QVD2H8er/FOjc/+EgC6yQ==} + + pg-types@2.2.0: + resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==} + engines: {node: '>=4'} + + pg@8.13.0: + resolution: {integrity: sha512-34wkUTh3SxTClfoHB3pQ7bIMvw9dpFU1audQQeZG837fmHfHpr14n/AELVDoOYVDW2h5RDWU78tFjkD+erSBsw==} + engines: {node: '>= 8.0.0'} + peerDependencies: + pg-native: '>=3.0.1' + peerDependenciesMeta: + pg-native: + optional: true + + pgpass@1.0.5: + resolution: {integrity: sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==} + picocolors@1.1.0: resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==} @@ -1755,6 +2042,34 @@ packages: resolution: {integrity: sha512-B7+VDyb8Tl6oMJT9oSO2CW8XC/T4UcJGrwOVoNGwOQsQYhlpfajmrMj5xeejqaASq3V/EqThyOeATEOMuSEXiA==} engines: {node: '>=12'} + postgres-array@2.0.0: + resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==} + engines: {node: '>=4'} + + postgres-array@3.0.2: + resolution: {integrity: sha512-6faShkdFugNQCLwucjPcY5ARoW1SlbnrZjmGl0IrrqewpvxvhSLHimCVzqeuULCbG0fQv7Dtk1yDbG3xv7Veog==} + engines: {node: '>=12'} + + postgres-bytea@1.0.0: + resolution: {integrity: sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==} + engines: {node: '>=0.10.0'} + + postgres-date@1.0.7: + resolution: {integrity: sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==} + engines: {node: '>=0.10.0'} + + postgres-date@2.1.0: + resolution: {integrity: sha512-K7Juri8gtgXVcDfZttFKVmhglp7epKb1K4pgrkLxehjqkrgPhfG6OO8LHLkfaqkbpjNRnra018XwAr1yQFWGcA==} + engines: {node: '>=12'} + + postgres-interval@1.2.0: + resolution: {integrity: sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==} + engines: {node: '>=0.10.0'} + + postgres-interval@4.0.2: + resolution: {integrity: sha512-EMsphSQ1YkQqKZL2cuG0zHkmjCCzQqQ71l2GXITqRwjhRleCdv00bDk/ktaSi0LnlaPzAc3535KTrjXsTdtx7A==} + engines: {node: '>=12'} + prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} @@ -1818,6 +2133,10 @@ packages: resolution: {integrity: sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==} engines: {node: '>= 0.10'} + rechoir@0.8.0: + resolution: {integrity: sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==} + engines: {node: '>= 10.13.0'} + reflect-metadata@0.2.2: resolution: {integrity: sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==} @@ -1846,6 +2165,13 @@ packages: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} engines: {node: '>=4'} + resolve-from@5.0.0: + resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} + engines: {node: '>=8'} + + resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + resolve@1.22.8: resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} hasBin: true @@ -1958,9 +2284,17 @@ packages: resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} engines: {node: '>=0.10.0'} + split2@4.2.0: + resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==} + engines: {node: '>= 10.x'} + sprintf-js@1.1.3: resolution: {integrity: sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==} + sqlstring@2.3.3: + resolution: {integrity: sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg==} + engines: {node: '>= 0.6'} + std-env@3.7.0: resolution: {integrity: sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==} @@ -2031,9 +2365,17 @@ packages: resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==} engines: {node: '>=10'} + tarn@3.0.2: + resolution: {integrity: sha512-51LAVKUSZSVfI05vjPESNc5vwqqZpbXCsU+/+wxlOrUjk2SnFTt97v9ZgQrD4YmxYW1Px6w2KjaDitCfkvgxMQ==} + engines: {node: '>=8.0.0'} + text-table@0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + tildify@2.0.0: + resolution: {integrity: sha512-Cc+OraorugtXNfs50hU9KS369rFXCfgGLpfCfvlc+Ud5u6VWmUQsOAa9HbTvheQdYnrdJqqv1e5oIqXppMYnSw==} + engines: {node: '>=8'} + titleize@3.0.0: resolution: {integrity: sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==} engines: {node: '>=12'} @@ -2059,6 +2401,11 @@ packages: tslib@2.7.0: resolution: {integrity: sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==} + tsx@4.19.1: + resolution: {integrity: sha512-0flMz1lh74BR4wOvBjuh9olbnwqCPc35OOlfyzHba0Dc+QNUeWX/Gq2YTbnwcWPO3BMd8fkzRVrHcsR+a7z7rA==} + engines: {node: '>=18.0.0'} + hasBin: true + type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} @@ -2188,6 +2535,10 @@ packages: resolution: {integrity: sha512-GCPAHLvrIH13+c0SuacwvRYj2SxJXQ4kaVTT5xgL3kPrz56XxkF21IGhjSE1+W0aw7gpBWRGXLCPnPby6lSpmQ==} engines: {node: '>=12'} + xtend@4.0.2: + resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} + engines: {node: '>=0.4'} + yallist@4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} @@ -2248,6 +2599,78 @@ snapshots: tslib: 2.7.0 optional: true + '@esbuild/aix-ppc64@0.23.1': + optional: true + + '@esbuild/android-arm64@0.23.1': + optional: true + + '@esbuild/android-arm@0.23.1': + optional: true + + '@esbuild/android-x64@0.23.1': + optional: true + + '@esbuild/darwin-arm64@0.23.1': + optional: true + + '@esbuild/darwin-x64@0.23.1': + optional: true + + '@esbuild/freebsd-arm64@0.23.1': + optional: true + + '@esbuild/freebsd-x64@0.23.1': + optional: true + + '@esbuild/linux-arm64@0.23.1': + optional: true + + '@esbuild/linux-arm@0.23.1': + optional: true + + '@esbuild/linux-ia32@0.23.1': + optional: true + + '@esbuild/linux-loong64@0.23.1': + optional: true + + '@esbuild/linux-mips64el@0.23.1': + optional: true + + '@esbuild/linux-ppc64@0.23.1': + optional: true + + '@esbuild/linux-riscv64@0.23.1': + optional: true + + '@esbuild/linux-s390x@0.23.1': + optional: true + + '@esbuild/linux-x64@0.23.1': + optional: true + + '@esbuild/netbsd-x64@0.23.1': + optional: true + + '@esbuild/openbsd-arm64@0.23.1': + optional: true + + '@esbuild/openbsd-x64@0.23.1': + optional: true + + '@esbuild/sunos-x64@0.23.1': + optional: true + + '@esbuild/win32-arm64@0.23.1': + optional: true + + '@esbuild/win32-ia32@0.23.1': + optional: true + + '@esbuild/win32-x64@0.23.1': + optional: true + '@eslint-community/eslint-utils@4.4.0(eslint@9.11.1(jiti@1.21.6))': dependencies: eslint: 9.11.1(jiti@1.21.6) @@ -2302,16 +2725,50 @@ snapshots: string-argv: 0.3.2 type-detect: 4.1.0 - '@mikro-orm/core@6.3.10': + '@mikro-orm/core@6.3.11': dependencies: dataloader: 2.2.2 dotenv: 16.4.5 esprima: 4.0.1 fs-extra: 11.2.0 globby: 11.1.0 - mikro-orm: 6.3.10 + mikro-orm: 6.3.11 reflect-metadata: 0.2.2 + '@mikro-orm/knex@6.3.11(@mikro-orm/core@6.3.11)(pg@8.13.0)': + dependencies: + '@mikro-orm/core': 6.3.11 + fs-extra: 11.2.0 + knex: 3.1.0(pg@8.13.0) + sqlstring: 2.3.3 + transitivePeerDependencies: + - mysql + - mysql2 + - pg + - pg-native + - sqlite3 + - supports-color + - tedious + + '@mikro-orm/postgresql@6.3.11(@mikro-orm/core@6.3.11)': + dependencies: + '@mikro-orm/core': 6.3.11 + '@mikro-orm/knex': 6.3.11(@mikro-orm/core@6.3.11)(pg@8.13.0) + pg: 8.13.0 + postgres-array: 3.0.2 + postgres-date: 2.1.0 + postgres-interval: 4.0.2 + transitivePeerDependencies: + - better-sqlite3 + - libsql + - mariadb + - mysql + - mysql2 + - pg-native + - sqlite3 + - supports-color + - tedious + '@node-rs/argon2-android-arm-eabi@1.7.0': optional: true @@ -2573,7 +3030,7 @@ snapshots: '@types/json-schema@7.0.15': {} - '@types/node@22.7.1': + '@types/node@20.16.10': dependencies: undici-types: 6.19.8 @@ -2927,8 +3384,12 @@ snapshots: color-name@1.1.4: {} + colorette@2.0.19: {} + colorette@2.0.20: {} + commander@10.0.1: {} + commander@9.5.0: {} compare-func@2.0.0: @@ -3002,6 +3463,10 @@ snapshots: dataloader@2.2.2: {} + debug@4.3.4: + dependencies: + ms: 2.1.2 + debug@4.3.7: dependencies: ms: 2.1.3 @@ -3081,6 +3546,33 @@ snapshots: dependencies: is-arrayish: 0.2.1 + esbuild@0.23.1: + optionalDependencies: + '@esbuild/aix-ppc64': 0.23.1 + '@esbuild/android-arm': 0.23.1 + '@esbuild/android-arm64': 0.23.1 + '@esbuild/android-x64': 0.23.1 + '@esbuild/darwin-arm64': 0.23.1 + '@esbuild/darwin-x64': 0.23.1 + '@esbuild/freebsd-arm64': 0.23.1 + '@esbuild/freebsd-x64': 0.23.1 + '@esbuild/linux-arm': 0.23.1 + '@esbuild/linux-arm64': 0.23.1 + '@esbuild/linux-ia32': 0.23.1 + '@esbuild/linux-loong64': 0.23.1 + '@esbuild/linux-mips64el': 0.23.1 + '@esbuild/linux-ppc64': 0.23.1 + '@esbuild/linux-riscv64': 0.23.1 + '@esbuild/linux-s390x': 0.23.1 + '@esbuild/linux-x64': 0.23.1 + '@esbuild/netbsd-x64': 0.23.1 + '@esbuild/openbsd-arm64': 0.23.1 + '@esbuild/openbsd-x64': 0.23.1 + '@esbuild/sunos-x64': 0.23.1 + '@esbuild/win32-arm64': 0.23.1 + '@esbuild/win32-ia32': 0.23.1 + '@esbuild/win32-x64': 0.23.1 + escalade@3.2.0: {} escape-goat@4.0.0: {} @@ -3150,6 +3642,8 @@ snapshots: transitivePeerDependencies: - supports-color + esm@3.2.25: {} + espree@10.1.0: dependencies: acorn: 8.12.1 @@ -3302,6 +3796,8 @@ snapshots: get-east-asian-width@1.2.0: {} + get-package-type@0.1.0: {} + get-stream@6.0.1: {} get-stream@8.0.1: {} @@ -3311,6 +3807,10 @@ snapshots: '@sec-ant/readable-stream': 0.4.1 is-stream: 4.0.1 + get-tsconfig@4.8.1: + dependencies: + resolve-pkg-maps: 1.0.0 + get-uri@6.0.3: dependencies: basic-ftp: 5.0.5 @@ -3320,6 +3820,8 @@ snapshots: transitivePeerDependencies: - supports-color + getopts@2.3.0: {} + giget@1.2.3: dependencies: citty: 0.1.6 @@ -3485,6 +3987,8 @@ snapshots: interpret@1.4.0: {} + interpret@2.2.0: {} + ip-address@9.0.5: dependencies: jsbn: 1.1.0 @@ -3611,6 +4115,27 @@ snapshots: kleur@3.0.3: {} + knex@3.1.0(pg@8.13.0): + dependencies: + colorette: 2.0.19 + commander: 10.0.1 + debug: 4.3.4 + escalade: 3.2.0 + esm: 3.2.25 + get-package-type: 0.1.0 + getopts: 2.3.0 + interpret: 2.2.0 + lodash: 4.17.21 + pg-connection-string: 2.6.2 + rechoir: 0.8.0 + resolve-from: 5.0.0 + tarn: 3.0.2 + tildify: 2.0.0 + optionalDependencies: + pg: 8.13.0 + transitivePeerDependencies: + - supports-color + kolorist@1.8.0: {} ky@1.7.2: {} @@ -3685,7 +4210,7 @@ snapshots: braces: 3.0.3 picomatch: 2.3.1 - mikro-orm@6.3.10: {} + mikro-orm@6.3.11: {} mime-db@1.52.0: {} @@ -3733,6 +4258,8 @@ snapshots: mri@1.2.0: {} + ms@2.1.2: {} + ms@2.1.3: {} mute-stream@1.0.0: {} @@ -3761,6 +4288,8 @@ snapshots: normalize-url@8.0.1: {} + npm-pkg-lint@3.9.0: {} + npm-run-path@4.0.1: dependencies: path-key: 3.1.1 @@ -3936,6 +4465,43 @@ snapshots: perfect-debounce@1.0.0: {} + pg-cloudflare@1.1.1: + optional: true + + pg-connection-string@2.6.2: {} + + pg-connection-string@2.7.0: {} + + pg-int8@1.0.1: {} + + pg-pool@3.7.0(pg@8.13.0): + dependencies: + pg: 8.13.0 + + pg-protocol@1.7.0: {} + + pg-types@2.2.0: + dependencies: + pg-int8: 1.0.1 + postgres-array: 2.0.0 + postgres-bytea: 1.0.0 + postgres-date: 1.0.7 + postgres-interval: 1.2.0 + + pg@8.13.0: + dependencies: + pg-connection-string: 2.7.0 + pg-pool: 3.7.0(pg@8.13.0) + pg-protocol: 1.7.0 + pg-types: 2.2.0 + pgpass: 1.0.5 + optionalDependencies: + pg-cloudflare: 1.1.1 + + pgpass@1.0.5: + dependencies: + split2: 4.2.0 + picocolors@1.1.0: {} picomatch@2.3.1: {} @@ -3952,6 +4518,22 @@ snapshots: dependencies: queue-lit: 1.5.2 + postgres-array@2.0.0: {} + + postgres-array@3.0.2: {} + + postgres-bytea@1.0.0: {} + + postgres-date@1.0.7: {} + + postgres-date@2.1.0: {} + + postgres-interval@1.2.0: + dependencies: + xtend: 4.0.2 + + postgres-interval@4.0.2: {} + prelude-ls@1.2.1: {} pretty-ms@9.1.0: @@ -4020,6 +4602,10 @@ snapshots: dependencies: resolve: 1.22.8 + rechoir@0.8.0: + dependencies: + resolve: 1.22.8 + reflect-metadata@0.2.2: {} registry-auth-token@5.0.2: @@ -4078,6 +4664,10 @@ snapshots: resolve-from@4.0.0: {} + resolve-from@5.0.0: {} + + resolve-pkg-maps@1.0.0: {} + resolve@1.22.8: dependencies: is-core-module: 2.15.1 @@ -4172,8 +4762,12 @@ snapshots: source-map@0.6.1: optional: true + split2@4.2.0: {} + sprintf-js@1.1.3: {} + sqlstring@2.3.3: {} + std-env@3.7.0: {} stdin-discarder@0.2.2: {} @@ -4239,8 +4833,12 @@ snapshots: mkdirp: 1.0.4 yallist: 4.0.0 + tarn@3.0.2: {} + text-table@0.2.0: {} + tildify@2.0.0: {} + titleize@3.0.0: {} tmp@0.0.33: @@ -4266,6 +4864,13 @@ snapshots: tslib@2.7.0: {} + tsx@4.19.1: + dependencies: + esbuild: 0.23.1 + get-tsconfig: 4.8.1 + optionalDependencies: + fsevents: 2.3.3 + type-check@0.4.0: dependencies: prelude-ls: 1.2.1 @@ -4383,6 +4988,8 @@ snapshots: xdg-basedir@5.1.0: {} + xtend@4.0.2: {} + yallist@4.0.0: {} yaml@2.5.1: {} diff --git a/src/MikroOrmAdapter.ts b/src/MikroOrmAdapter.ts index d27024f..d5048f7 100644 --- a/src/MikroOrmAdapter.ts +++ b/src/MikroOrmAdapter.ts @@ -1,8 +1,7 @@ import { EntityManager } from '@mikro-orm/core'; -import { Session } from './Session'; -import { User } from './User'; +import { Session } from './Session.js'; +import { User } from './User.js'; import { type Adapter, type UserId } from 'lucia'; -import * as console from 'node:console'; export class MikroOrmAdapter implements Adapter { entityManager: EntityManager; @@ -37,13 +36,11 @@ export class MikroOrmAdapter implements Adapter { const session = await this.entityManager.findOne(Session, { id: sessionId }); const user = await this.entityManager.findOne(User, { id: session?.userId }); - console.log(user); - - return [session, user]; + return structuredClone([session, user]); } async getUserSessions(userId: UserId): Promise { - return await this.entityManager.find(Session, { userId: userId }); + return structuredClone(await this.entityManager.find(Session, { userId: userId })); } async setSession(session: Session): Promise { diff --git a/src/Session.ts b/src/Session.ts index da362fb..f5ef17e 100644 --- a/src/Session.ts +++ b/src/Session.ts @@ -1,4 +1,4 @@ -import type { DatabaseSession } from 'lucia/dist/database'; +import type { DatabaseSession } from 'lucia'; import { Entity, PrimaryKey, Property, types } from '@mikro-orm/core'; import { v4 } from 'uuid'; diff --git a/src/User.ts b/src/User.ts index 5d5d3bf..5e745ad 100644 --- a/src/User.ts +++ b/src/User.ts @@ -1,6 +1,6 @@ -import type { DatabaseUser } from 'lucia/dist/database'; +import type { DatabaseUser } from 'lucia'; -import { OAuthProviderAttributes } from './embeddable/OAuthProviderAttributes'; +import { OAuthProviderAttributes } from './embeddable/OAuthProviderAttributes.js'; import { Embedded, Entity, PrimaryKey, Property, types } from '@mikro-orm/core'; import { v4 } from 'uuid'; diff --git a/src/index.ts b/src/index.ts index d96b0c1..bc07e5d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -export { MikroOrmAdapter } from './MikroOrmAdapter'; -export { Session } from './Session'; -export { User } from './User'; -export { OAuthProviderAttributes } from './embeddable/OAuthProviderAttributes'; +export { MikroOrmAdapter } from './MikroOrmAdapter.js'; +export { Session } from './Session.js'; +export { User } from './User.js'; +export { OAuthProviderAttributes } from './embeddable/OAuthProviderAttributes.js'; diff --git a/tests/db.ts b/tests/db.ts new file mode 100644 index 0000000..2fa2c78 --- /dev/null +++ b/tests/db.ts @@ -0,0 +1,14 @@ +import { MikroORM } from '@mikro-orm/postgresql'; +import process from 'node:process'; + +const ORM = await MikroORM.init({ + entities: ['./src'], + dbName: process.env.DATABASE_NAME || 'lucia', + user: process.env.DATABASE_USER || 'lucia', + password: process.env.DATABASE_PASSWORD || 'lucia', + schema: process.env.DATABASE_NAME || 'lucia', +}); + +await ORM.schema.refreshDatabase({ dropDb: true }); + +export { ORM }; diff --git a/tests/mikro-orm-postgres.ts b/tests/mikro-orm-postgres.ts new file mode 100644 index 0000000..798934c --- /dev/null +++ b/tests/mikro-orm-postgres.ts @@ -0,0 +1,21 @@ +// Use MikroORM for testing MikroORM Adapter +import { ORM } from './db'; +import { User } from '../src'; +import { testAdapter, databaseUser } from './testAdapter'; +import { MikroOrmAdapter } from '../src'; +import process from 'node:process'; + +const entityManager = ORM.em.fork(); + +const user = new User({ providerId: 'test-provider', providerUserId: 'test-provider-user' }); +const entity = entityManager.create(User, user); +entity.id = databaseUser.id; + +await entityManager.persistAndFlush(user); +entityManager.clear(); + +const adapter = new MikroOrmAdapter(entityManager); + +await testAdapter(adapter); + +process.exit(); diff --git a/tests/testAdapter.ts b/tests/testAdapter.ts new file mode 100644 index 0000000..4e10a55 --- /dev/null +++ b/tests/testAdapter.ts @@ -0,0 +1,97 @@ +import { Adapter, DatabaseSession, DatabaseUser } from 'lucia'; +import assert from 'node:assert'; +import { v4 } from 'uuid'; +import console from 'node:console'; + +export const databaseUser: DatabaseUser = { + id: v4(), + attributes: { + providerId: 'test-provider', + providerUserId: 'test-provider-user', + }, +}; + +export async function testAdapter(adapter: Adapter) { + console.log(`\n\x1B[38;5;63;1m[start] \x1B[0mRunning adapter tests\x1B[0m\n`); + const databaseSession: DatabaseSession = { + userId: databaseUser.id, + id: v4(), + // get random date with 0ms + expiresAt: new Date(Math.floor(Date.now() / 1000) * 1000 + 10_000), + attributes: { + country: 'us', + }, + }; + + await test('getSessionAndUser() returns [null, null] on invalid session id', async () => { + const result = await adapter.getSessionAndUser(databaseSession.id); + assert.deepStrictEqual(result, [null, null]); + }); + + await test('getUserSessions() returns empty array on invalid user id', async () => { + const result = await adapter.getUserSessions(databaseUser.id); + assert.deepStrictEqual(result, []); + }); + + await test('setSession() creates session and getSessionAndUser() returns created session and associated user', async () => { + await adapter.setSession(databaseSession); + const [adapterSession] = await adapter.getSessionAndUser(databaseSession.id); + + assert.equal(adapterSession.id, databaseSession.id); + assert.equal(adapterSession.userId, databaseSession.userId); + assert.equal(adapterSession.expiresAt.valueOf(), databaseSession.expiresAt.valueOf()); + assert.equal(adapterSession.attributes.country, databaseSession.attributes.country); + }); + + await test('deleteSession() deletes session', async () => { + await adapter.deleteSession(databaseSession.id); + const result = await adapter.getUserSessions(databaseSession.userId); + assert.deepStrictEqual(result, []); + }); + + await test('updateSessionExpiration() updates session', async () => { + await adapter.setSession(databaseSession); + databaseSession.expiresAt = new Date(databaseSession.expiresAt.getTime() + 10_000); + await adapter.updateSessionExpiration(databaseSession.id, databaseSession.expiresAt); + const [adapterSession] = await adapter.getSessionAndUser(databaseSession.id); + + assert.equal(adapterSession.id, databaseSession.id); + assert.equal(adapterSession.expiresAt.valueOf(), databaseSession.expiresAt.valueOf()); + }); + + await test('deleteExpiredSessions() deletes all expired sessions', async () => { + const expiredSession: DatabaseSession = { + userId: databaseUser.id, + id: v4(), + expiresAt: new Date(Math.floor(Date.now() / 1000) * 1000 - 10_000), + attributes: { + country: 'us', + }, + }; + await adapter.setSession(expiredSession); + await adapter.deleteExpiredSessions(); + const [adapterSession] = await adapter.getUserSessions(databaseSession.userId); + + assert.equal(adapterSession.id, databaseSession.id); + }); + + await test('deleteUserSessions() deletes all user sessions', async () => { + await adapter.deleteUserSessions(databaseSession.userId); + const result = await adapter.getUserSessions(databaseSession.userId); + assert.deepStrictEqual(result, []); + }); + + console.log(`\n\x1B[32;1m[success] \x1B[0mAdapter passed all tests\n`); +} + +async function test(name: string, runTest: () => Promise): Promise { + console.log(`\x1B[38;5;63;1m► \x1B[0m${name}\x1B[0m`); + try { + await runTest(); + console.log(' \x1B[32m✓ Passed\x1B[0m\n'); + } + catch (error) { + console.log(' \x1B[31m✓ Failed\x1B[0m\n'); + throw error; + } +} diff --git a/tsconfig.json b/tsconfig.json index a1550ac..e8040d3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,9 +10,9 @@ "emitDecoratorMetadata": true /* Emit design-type metadata for decorated declarations in source files. */, /* Modules */ - "module": "ESNext" /* Specify what module code is generated. */, + "module": "NodeNext" /* Specify what module code is generated. */, "rootDir": "./src/" /* Specify the root folder within your source files. */, - "moduleResolution": "Bundler" /* Specify how TypeScript looks up a file from a given module specifier. */, + "moduleResolution": "NodeNext" /* Specify how TypeScript looks up a file from a given module specifier. */, "baseUrl": "./src/" /* Specify the base directory to resolve non-relative module names. */, "types": [ "node", @@ -29,7 +29,10 @@ /* Type Checking */ "strict": true /* Enable all strict type-checking options. */, - "skipLibCheck": true /* Skip type checking all .d.ts files. */ + "skipLibCheck": true, /* Skip type checking all .d.ts files. */ + + "declaration": true, }, - "include": ["src"] + "exclude": ["node_modules"], + "include": ["src/**/*.ts"] }