diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d186aa..01f234a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,17 +29,20 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile - - name: Build - run: pnpm build + - name: Check formatting + run: pnpm format:check - name: Lint run: pnpm lint + - name: Check types + run: pnpm typecheck + - name: Run tests with coverage run: pnpm test:coverage - name: Report test coverage uses: davelosert/vitest-coverage-report-action@v2 - - name: Run knip + - name: Check unused files and dependencies with knip run: pnpm run knip diff --git a/.oxlintrc.json b/.oxlintrc.json index 35a347f..b9b85fe 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -31,7 +31,9 @@ ], "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-unsafe-declaration-merging": "off", + "eslint/arrow-body-style": ["error", "as-needed"], "eslint/curly": "error", + "eslint/id-length": "off", "eslint/max-depth": "off", "eslint/max-lines": "off", "eslint/max-lines-per-function": "off", @@ -47,6 +49,7 @@ } ], "import/exports-last": "off", + "import/extensions": "off", "import/group-exports": "off", "import/max-dependencies": "off", "import/no-anonymous-default-export": [ @@ -56,6 +59,7 @@ } ], "import/no-default-export": "off", + "import/prefer-default-export": "off", "max-params": "off", "no-async-await": "off", "no-console": "off", diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..4980bce --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +pnpm-lock.yaml +pnpm-workspace.yaml \ No newline at end of file diff --git a/package.json b/package.json index af83df4..0e2f28d 100644 --- a/package.json +++ b/package.json @@ -47,30 +47,30 @@ "test": "vitest", "typecheck": "tsc --noEmit", "test:coverage": "vitest --coverage", - "format": "prettier . --write", - "format:check": "prettier . --check", + "format": "prettier . --write --experimental-cli", + "format:check": "prettier . --check --experimental-cli", "knip": "knip", "knip:fix": "knip --fix" }, "dependencies": { - "graphql": "^16.0.0", - "inflection": "^3.0.0", - "jsonld": "^8.3.2", + "graphql": "^16.11.0", + "inflection": "^3.0.2", + "jsonld": "^8.3.3", "jsonref": "^9.0.0" }, "devDependencies": { - "@types/jsonld": "^1.5.0", - "@types/node": "^22.0.0", - "@vitest/coverage-v8": "3.2.2", - "msw": "^2.9.0", - "openapi-types": "^12.0.0", - "oxlint": "^1.1.0", - "prettier": "^3.0.0", - "typescript": "^5.7.0", + "@types/jsonld": "^1.5.15", + "@types/node": "^22.15.34", + "@vitest/coverage-v8": "3.2.4", "knip": "^5.61.3", - "vitest": "^3.2.2" + "msw": "^2.10.2", + "openapi-types": "^12.1.3", + "oxlint": "^1.4.0", + "prettier": "^3.6.2", + "typescript": "^5.8.3", + "vitest": "^3.2.4" }, - "packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977", + "packageManager": "pnpm@10.12.4+sha512.5ea8b0deed94ed68691c9bad4c955492705c5eeb8a87ef86bc62c74a26b037b08ff9570f108b2e4dbd1dd1a9186fea925e527f141c648e85af45631074680184", "engines": { "node": ">=18" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2e1cc23..7339755 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,53 +4,56 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +overrides: + brace-expansion: ^2.0.2 + importers: .: dependencies: graphql: - specifier: ^16.0.0 + specifier: ^16.11.0 version: 16.11.0 inflection: - specifier: ^3.0.0 + specifier: ^3.0.2 version: 3.0.2 jsonld: - specifier: ^8.3.2 + specifier: ^8.3.3 version: 8.3.3(web-streams-polyfill@3.3.3) jsonref: specifier: ^9.0.0 version: 9.0.0 devDependencies: '@types/jsonld': - specifier: ^1.5.0 + specifier: ^1.5.15 version: 1.5.15 '@types/node': - specifier: ^22.0.0 - version: 22.15.29 + specifier: ^22.15.34 + version: 22.15.34 '@vitest/coverage-v8': - specifier: 3.2.2 - version: 3.2.2(vitest@3.2.2(@types/node@22.15.29)(jiti@2.4.2)(msw@2.9.0(@types/node@22.15.29)(typescript@5.8.3))) + specifier: 3.2.4 + version: 3.2.4(vitest@3.2.4(@types/node@22.15.34)(jiti@2.4.2)(msw@2.10.2(@types/node@22.15.34)(typescript@5.8.3))) knip: specifier: ^5.61.3 - version: 5.61.3(@types/node@22.15.29)(typescript@5.8.3) + version: 5.61.3(@types/node@22.15.34)(typescript@5.8.3) msw: - specifier: ^2.9.0 - version: 2.9.0(@types/node@22.15.29)(typescript@5.8.3) + specifier: ^2.10.2 + version: 2.10.2(@types/node@22.15.34)(typescript@5.8.3) openapi-types: - specifier: ^12.0.0 + specifier: ^12.1.3 version: 12.1.3 oxlint: - specifier: ^1.1.0 - version: 1.1.0 + specifier: ^1.4.0 + version: 1.4.0 prettier: - specifier: ^3.0.0 - version: 3.5.3 + specifier: ^3.6.2 + version: 3.6.2 typescript: - specifier: ^5.7.0 + specifier: ^5.8.3 version: 5.8.3 vitest: - specifier: ^3.2.2 - version: 3.2.2(@types/node@22.15.29)(jiti@2.4.2)(msw@2.9.0(@types/node@22.15.29)(typescript@5.8.3)) + specifier: ^3.2.4 + version: 3.2.4(@types/node@22.15.34)(jiti@2.4.2)(msw@2.10.2(@types/node@22.15.34)(typescript@5.8.3)) packages: @@ -312,8 +315,8 @@ packages: '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} - '@mswjs/interceptors@0.38.7': - resolution: {integrity: sha512-Jkb27iSn7JPdkqlTqKfhncFfnEZsIJVYxsFbUSWEkxdIPdsyngrhoDBk0/BGD2FQcRH99vlRrkHpNTyKqI+0/w==} + '@mswjs/interceptors@0.39.2': + resolution: {integrity: sha512-RuzCup9Ct91Y7V79xwCb146RaBRHZ7NBbrIUySumd1rpKqHL5OonaqrGIbug5hNwP/fRyxFMA6ISgw4FTtYFYg==} engines: {node: '>=18'} '@napi-rs/wasm-runtime@0.2.11': @@ -405,43 +408,43 @@ packages: cpu: [x64] os: [win32] - '@oxlint/darwin-arm64@1.1.0': - resolution: {integrity: sha512-sSnR3SOxIU/QfaqXrcQ0UVUkzJO0bcInQ7dMhHa102gVAgWjp1fBeMVCM0adEY0UNmEXrRkgD/rQtQgn9YAU+w==} + '@oxlint/darwin-arm64@1.4.0': + resolution: {integrity: sha512-G3UsDnZpykvQ5GDzDCAhgBMwM6SzbQyH1If/oH5e/CutUC7sq/QTY8a2l1Hu7liK/euvKiZtM3C/cKdUKy1DNw==} cpu: [arm64] os: [darwin] - '@oxlint/darwin-x64@1.1.0': - resolution: {integrity: sha512-Jvd3fHnzY2OYbmsg9NSGPoBkGViDGHSFnBKyJQ9LOIw7lxAyQBG2Quxc3GYPFR/f9OYho9C3p4+dIaAJfKhnsw==} + '@oxlint/darwin-x64@1.4.0': + resolution: {integrity: sha512-4AgFOkf88iG/nH/bR0i6WV/SKap2ZvBwxvZ9TvrF4Cxag3bVBViy36DgoZXr7AloEybtXZ0IRdrQEJstHkwbtg==} cpu: [x64] os: [darwin] - '@oxlint/linux-arm64-gnu@1.1.0': - resolution: {integrity: sha512-MgW4iskOdXuoR+wDXIJUfbdnTg2eo2FnQRaD6ZqhnDTDa7LnV+06rp/Cg3aGj2X9jSEcKDv/bMbYQuot7WRs6Q==} + '@oxlint/linux-arm64-gnu@1.4.0': + resolution: {integrity: sha512-9qZarfKyq6v56GhcN0IyejQsmv8GiSi+lJjjXQ/uaa50JrY4/2+i63uRJceUT7SBZbCj1PHvgZuqN+QXov6dWg==} cpu: [arm64] os: [linux] - '@oxlint/linux-arm64-musl@1.1.0': - resolution: {integrity: sha512-a+pkEKmDRdrW+y0gtZ/m68ElVW2VZgATGbMxDgDYFpdiMx9Y0pUPwTMZ2EX/17Aslop4c1BiDSFDK7aEBxKR2g==} + '@oxlint/linux-arm64-musl@1.4.0': + resolution: {integrity: sha512-Nfbvqi+o5wU/ZPOYUpM+QMzT6Or8Mog89IUsKRJBBmIPUvcwQhyCKp8B4CZswNJyXisJ3gZ3kdCaaKgnsLln4Q==} cpu: [arm64] os: [linux] - '@oxlint/linux-x64-gnu@1.1.0': - resolution: {integrity: sha512-wNBsXCKVZMvUTcFitrV1wTsdhUAv8l+XQxHxciZ2SO6dpNnWEb2YCxSAIOXeyzBLdO4pIODYcSy38CvGue7TwA==} + '@oxlint/linux-x64-gnu@1.4.0': + resolution: {integrity: sha512-z/71xdZpvudjZsaEDk+EJxEzDIcyCaKbvUtGjAfKv60jLuP83bDHD0VD8GI8FSPjhlLpDPmrbcXWbT690Q7NAA==} cpu: [x64] os: [linux] - '@oxlint/linux-x64-musl@1.1.0': - resolution: {integrity: sha512-pZD0lt6A5j2Wp70fgIYk4GoPfKTZ8mHWamWIpKFT7aSkFkiOi6nhLWDFvMEIHWRTK3LgkWUNcnWPp4brvin4wQ==} + '@oxlint/linux-x64-musl@1.4.0': + resolution: {integrity: sha512-D6C165X6/hjZ1yi2mNttzeihjL3IoW0s612VNyfW6KrV/lesSaIFTXqII3ThOOQezGTDhpz4xudemcv0g7iFlg==} cpu: [x64] os: [linux] - '@oxlint/win32-arm64@1.1.0': - resolution: {integrity: sha512-rT6uXQvE80+B+L04HJf30uF26426FPI9i9DAY2AxBUhrpNwhqkDEhQdd9ilFWVC7SSbpHgAs50lo+ImSAAkHPQ==} + '@oxlint/win32-arm64@1.4.0': + resolution: {integrity: sha512-wFa7ywGt0jnuukynANm5k/D189YwrQKHIdNgBjBsTvvJZNxGzVy8Q5dwsG0qwWS6RkVh9CMUpOTccPsKBdGHkQ==} cpu: [arm64] os: [win32] - '@oxlint/win32-x64@1.1.0': - resolution: {integrity: sha512-x6r5yvM3wEty93Bx0NuNK+kutUyS/K55itkUrxdExoK6GcmVDboGGuhju9HyU2cM/IWLEWO8RHcXSyaxr9GR5g==} + '@oxlint/win32-x64@1.4.0': + resolution: {integrity: sha512-B3ezHSEzQL6Enszl9i9wLwIhWt3lkJ5x2xmgvJ77RrzoaF46QciGvs4TeGU++kPRe5DKpRGlgsruig7GLNUaSg==} cpu: [x64] os: [win32] @@ -567,8 +570,8 @@ packages: '@types/jsonld@1.5.15': resolution: {integrity: sha512-PlAFPZjL+AuGYmwlqwKEL0IMP8M8RexH0NIPGfCVWSQ041H2rR/8OlyZSD7KsCVoN8vCfWdtWDBxX8yBVP+xow==} - '@types/node@22.15.29': - resolution: {integrity: sha512-LNdjOkUDlU1RZb8e1kOIUpN1qQUlzGkEtbVNo53vbrwDg5om6oduhm4SiUaPW5ASTXhAiP0jInWG8Qx9fVlOeQ==} + '@types/node@22.15.34': + resolution: {integrity: sha512-8Y6E5WUupYy1Dd0II32BsWAx5MWdcnRd8L84Oys3veg1YrYtNtzgO4CFhiBg6MDSjk7Ay36HYOnU7/tuOzIzcw==} '@types/statuses@2.0.5': resolution: {integrity: sha512-jmIUGWrAiwu3dZpxntxieC+1n/5c3mjrImkmOSQ2NC5uP6cYO4aAZDdSmRcI5C1oiTmqlZGHC+/NmJrKogbP5A==} @@ -576,20 +579,20 @@ packages: '@types/tough-cookie@4.0.5': resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==} - '@vitest/coverage-v8@3.2.2': - resolution: {integrity: sha512-RVAi5xnqedSKvaoQyCTWvncMk8eYZcTTOsLK7XmnfOEvdGP/O/upA0/MA8Ss+Qs++mj0GcSRi/whR0S5iBPpTQ==} + '@vitest/coverage-v8@3.2.4': + resolution: {integrity: sha512-EyF9SXU6kS5Ku/U82E259WSnvg6c8KTjppUncuNdm5QHpe17mwREHnjDzozC8x9MZ0xfBUFSaLkRv4TMA75ALQ==} peerDependencies: - '@vitest/browser': 3.2.2 - vitest: 3.2.2 + '@vitest/browser': 3.2.4 + vitest: 3.2.4 peerDependenciesMeta: '@vitest/browser': optional: true - '@vitest/expect@3.2.2': - resolution: {integrity: sha512-ipHw0z669vEMjzz3xQE8nJX1s0rQIb7oEl4jjl35qWTwm/KIHERIg/p/zORrjAaZKXfsv7IybcNGHwhOOAPMwQ==} + '@vitest/expect@3.2.4': + resolution: {integrity: sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==} - '@vitest/mocker@3.2.2': - resolution: {integrity: sha512-jKojcaRyIYpDEf+s7/dD3LJt53c0dPfp5zCPXz9H/kcGrSlovU/t1yEaNzM9oFME3dcd4ULwRI/x0Po1Zf+LTw==} + '@vitest/mocker@3.2.4': + resolution: {integrity: sha512-46ryTE9RZO/rfDd7pEqFl7etuyzekzEhUbTW3BvmeO/BcCMEgq59BKhek3dXDWgAj4oMK6OZi+vRr1wPW6qjEQ==} peerDependencies: msw: ^2.4.9 vite: ^5.0.0 || ^6.0.0 || ^7.0.0-0 @@ -599,20 +602,20 @@ packages: vite: optional: true - '@vitest/pretty-format@3.2.2': - resolution: {integrity: sha512-FY4o4U1UDhO9KMd2Wee5vumwcaHw7Vg4V7yR4Oq6uK34nhEJOmdRYrk3ClburPRUA09lXD/oXWZ8y/Sdma0aUQ==} + '@vitest/pretty-format@3.2.4': + resolution: {integrity: sha512-IVNZik8IVRJRTr9fxlitMKeJeXFFFN0JaB9PHPGQ8NKQbGpfjlTx9zO4RefN8gp7eqjNy8nyK3NZmBzOPeIxtA==} - '@vitest/runner@3.2.2': - resolution: {integrity: sha512-GYcHcaS3ejGRZYed2GAkvsjBeXIEerDKdX3orQrBJqLRiea4NSS9qvn9Nxmuy1IwIB+EjFOaxXnX79l8HFaBwg==} + '@vitest/runner@3.2.4': + resolution: {integrity: sha512-oukfKT9Mk41LreEW09vt45f8wx7DordoWUZMYdY/cyAk7w5TWkTRCNZYF7sX7n2wB7jyGAl74OxgwhPgKaqDMQ==} - '@vitest/snapshot@3.2.2': - resolution: {integrity: sha512-aMEI2XFlR1aNECbBs5C5IZopfi5Lb8QJZGGpzS8ZUHML5La5wCbrbhLOVSME68qwpT05ROEEOAZPRXFpxZV2wA==} + '@vitest/snapshot@3.2.4': + resolution: {integrity: sha512-dEYtS7qQP2CjU27QBC5oUOxLE/v5eLkGqPE0ZKEIDGMs4vKWe7IjgLOeauHsR0D5YuuycGRO5oSRXnwnmA78fQ==} - '@vitest/spy@3.2.2': - resolution: {integrity: sha512-6Utxlx3o7pcTxvp0u8kUiXtRFScMrUg28KjB3R2hon7w4YqOFAEA9QwzPVVS1QNL3smo4xRNOpNZClRVfpMcYg==} + '@vitest/spy@3.2.4': + resolution: {integrity: sha512-vAfasCOe6AIK70iP5UD11Ac4siNUNJ9i/9PZ3NKx07sG6sUxeag1LWdNrMWeKKYBLlzuK+Gn65Yd5nyL6ds+nw==} - '@vitest/utils@3.2.2': - resolution: {integrity: sha512-qJYMllrWpF/OYfWHP32T31QCaLa3BAzT/n/8mNGhPdVcjY+JYazQFO1nsJvXU12Kp1xMpNY4AGuljPTNjQve6A==} + '@vitest/utils@3.2.4': + resolution: {integrity: sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==} abort-controller@3.0.0: resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} @@ -651,8 +654,8 @@ packages: balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} - brace-expansion@2.0.1: - resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} + brace-expansion@2.0.2: + resolution: {integrity: sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==} braces@3.0.3: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} @@ -901,8 +904,8 @@ packages: resolution: {integrity: sha512-CasD9OCEQSFIam2U8efFK81Yeg8vNMTBUqtMOHlrcWQHqUX3HeCl9Dr31u4toV7emlH8Mymk5+9p0lL6mKb/Xw==} engines: {node: '>=14.16'} - loupe@3.1.3: - resolution: {integrity: sha512-kkIp7XSkP78ZxJEsSxW3712C6teJVoeHHwgo9zJ380de7IYyJ2ISlxojcH2pC5OFLewESmnRi/+XCDIEEVyoug==} + loupe@3.1.4: + resolution: {integrity: sha512-wJzkKwJrheKtknCOKNEtDK4iqg/MxmZheEMtSTYvnzRdEYaZzmgH976nenp8WdJRdx5Vc1X/9MO0Oszl6ezeXg==} lru-cache@10.4.3: resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} @@ -943,8 +946,8 @@ packages: ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - msw@2.9.0: - resolution: {integrity: sha512-fNyrJ11YNbe2zl64EwtxM5OFkInFPAw5vipOljMsf9lY2ep9B2BslqQrS8EC9pB9961K61FqTUi0wsdqk6hwow==} + msw@2.10.2: + resolution: {integrity: sha512-RCKM6IZseZQCWcSWlutdf590M8nVfRHG1ImwzOtwz8IYxgT4zhUO0rfTcTvDGiaFE0Rhcc+h43lcF3Jc9gFtwQ==} engines: {node: '>=18'} hasBin: true peerDependencies: @@ -980,8 +983,8 @@ packages: oxc-resolver@11.3.0: resolution: {integrity: sha512-Hd7oMoyyJrZyjNxXAhawmn+JQxUY0W3yK3kmoVZGJpY09g82ijRKKkqjKIbgly6Hc4WCfeb+2dQIKe7jO8j7/Q==} - oxlint@1.1.0: - resolution: {integrity: sha512-OVNpaoaQCUHHhCv5sYMPJ7Ts5k7ziw0QteH1gBSwF3elf/8GAew2Uh/0S7HsU1iGtjhlFy80+A8nwIb3Tq6m1w==} + oxlint@1.4.0: + resolution: {integrity: sha512-whu+lxSL9GCzO+b+X++tk81d5UoCeAq+plU5DWSoLqmwjCV0OyDkRlfGPDhbBHXm2z6GrepvF0d0Sb66z6SG4A==} engines: {node: '>=8.*'} hasBin: true @@ -1021,8 +1024,8 @@ packages: resolution: {integrity: sha512-QSa9EBe+uwlGTFmHsPKokv3B/oEMQZxfqW0QqNCyhpa6mB1afzulwn8hihglqAb2pOw+BJgNlmXQ8la2VeHB7w==} engines: {node: ^10 || ^12 || >=14} - prettier@3.5.3: - resolution: {integrity: sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==} + prettier@3.6.2: + resolution: {integrity: sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==} engines: {node: '>=14'} hasBin: true @@ -1126,6 +1129,9 @@ packages: resolution: {integrity: sha512-4X2FR3UwhNUE9G49aIsJW5hRRR3GXGTBTZRMfv568O60ojM8HcWjV/VxAxCDW3SUND33O6ZY66ZuRcdkj73q2g==} engines: {node: '>=14.16'} + strip-literal@3.0.0: + resolution: {integrity: sha512-TcccoMhJOM3OebGhSBEmp3UZ2SfDMZUEBdRA/9ynfLi8yYajyWX3JiXArcJt4Umh4vISpspkQIY8ZZoCqjbviA==} + supports-color@7.2.0: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} engines: {node: '>=8'} @@ -1144,8 +1150,8 @@ packages: resolution: {integrity: sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==} engines: {node: '>=12.0.0'} - tinypool@1.1.0: - resolution: {integrity: sha512-7CotroY9a8DKsKprEy/a14aCCm8jYVmR7aFy4fpkZM8sdpNJbKkixuNjgM50yCmip2ezc8z4N7k3oe2+rfRJCQ==} + tinypool@1.1.1: + resolution: {integrity: sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==} engines: {node: ^18.0.0 || >=20.0.0} tinyrainbow@2.0.0: @@ -1194,8 +1200,8 @@ packages: url-parse@1.5.10: resolution: {integrity: sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==} - vite-node@3.2.2: - resolution: {integrity: sha512-Xj/jovjZvDXOq2FgLXu8NsY4uHUMWtzVmMC2LkCu9HWdr9Qu1Is5sanX3Z4jOFKdohfaWDnEJWp9pRP0vVpAcA==} + vite-node@3.2.4: + resolution: {integrity: sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==} engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} hasBin: true @@ -1239,16 +1245,16 @@ packages: yaml: optional: true - vitest@3.2.2: - resolution: {integrity: sha512-fyNn/Rp016Bt5qvY0OQvIUCwW2vnaEBLxP42PmKbNIoasSYjML+8xyeADOPvBe+Xfl/ubIw4og7Lt9jflRsCNw==} + vitest@3.2.4: + resolution: {integrity: sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==} engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} hasBin: true peerDependencies: '@edge-runtime/vm': '*' '@types/debug': ^4.1.12 '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0 - '@vitest/browser': 3.2.2 - '@vitest/ui': 3.2.2 + '@vitest/browser': 3.2.4 + '@vitest/ui': 3.2.4 happy-dom: '*' jsdom: '*' peerDependenciesMeta: @@ -1461,17 +1467,17 @@ snapshots: '@fastify/busboy@2.1.1': {} - '@inquirer/confirm@5.1.12(@types/node@22.15.29)': + '@inquirer/confirm@5.1.12(@types/node@22.15.34)': dependencies: - '@inquirer/core': 10.1.13(@types/node@22.15.29) - '@inquirer/type': 3.0.7(@types/node@22.15.29) + '@inquirer/core': 10.1.13(@types/node@22.15.34) + '@inquirer/type': 3.0.7(@types/node@22.15.34) optionalDependencies: - '@types/node': 22.15.29 + '@types/node': 22.15.34 - '@inquirer/core@10.1.13(@types/node@22.15.29)': + '@inquirer/core@10.1.13(@types/node@22.15.34)': dependencies: '@inquirer/figures': 1.0.12 - '@inquirer/type': 3.0.7(@types/node@22.15.29) + '@inquirer/type': 3.0.7(@types/node@22.15.34) ansi-escapes: 4.3.2 cli-width: 4.1.0 mute-stream: 2.0.0 @@ -1479,13 +1485,13 @@ snapshots: wrap-ansi: 6.2.0 yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 22.15.29 + '@types/node': 22.15.34 '@inquirer/figures@1.0.12': {} - '@inquirer/type@3.0.7(@types/node@22.15.29)': + '@inquirer/type@3.0.7(@types/node@22.15.34)': optionalDependencies: - '@types/node': 22.15.29 + '@types/node': 22.15.34 '@isaacs/cliui@8.0.2': dependencies: @@ -1515,7 +1521,7 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 - '@mswjs/interceptors@0.38.7': + '@mswjs/interceptors@0.39.2': dependencies: '@open-draft/deferred-promise': 2.2.0 '@open-draft/logger': 0.3.0 @@ -1593,28 +1599,28 @@ snapshots: '@oxc-resolver/binding-win32-x64-msvc@11.3.0': optional: true - '@oxlint/darwin-arm64@1.1.0': + '@oxlint/darwin-arm64@1.4.0': optional: true - '@oxlint/darwin-x64@1.1.0': + '@oxlint/darwin-x64@1.4.0': optional: true - '@oxlint/linux-arm64-gnu@1.1.0': + '@oxlint/linux-arm64-gnu@1.4.0': optional: true - '@oxlint/linux-arm64-musl@1.1.0': + '@oxlint/linux-arm64-musl@1.4.0': optional: true - '@oxlint/linux-x64-gnu@1.1.0': + '@oxlint/linux-x64-gnu@1.4.0': optional: true - '@oxlint/linux-x64-musl@1.1.0': + '@oxlint/linux-x64-musl@1.4.0': optional: true - '@oxlint/win32-arm64@1.1.0': + '@oxlint/win32-arm64@1.4.0': optional: true - '@oxlint/win32-x64@1.1.0': + '@oxlint/win32-x64@1.4.0': optional: true '@pkgjs/parseargs@0.11.0': @@ -1697,7 +1703,7 @@ snapshots: '@types/jsonld@1.5.15': {} - '@types/node@22.15.29': + '@types/node@22.15.34': dependencies: undici-types: 6.21.0 @@ -1705,7 +1711,7 @@ snapshots: '@types/tough-cookie@4.0.5': {} - '@vitest/coverage-v8@3.2.2(vitest@3.2.2(@types/node@22.15.29)(jiti@2.4.2)(msw@2.9.0(@types/node@22.15.29)(typescript@5.8.3)))': + '@vitest/coverage-v8@3.2.4(vitest@3.2.4(@types/node@22.15.34)(jiti@2.4.2)(msw@2.10.2(@types/node@22.15.34)(typescript@5.8.3)))': dependencies: '@ampproject/remapping': 2.3.0 '@bcoe/v8-coverage': 1.0.2 @@ -1720,50 +1726,51 @@ snapshots: std-env: 3.9.0 test-exclude: 7.0.1 tinyrainbow: 2.0.0 - vitest: 3.2.2(@types/node@22.15.29)(jiti@2.4.2)(msw@2.9.0(@types/node@22.15.29)(typescript@5.8.3)) + vitest: 3.2.4(@types/node@22.15.34)(jiti@2.4.2)(msw@2.10.2(@types/node@22.15.34)(typescript@5.8.3)) transitivePeerDependencies: - supports-color - '@vitest/expect@3.2.2': + '@vitest/expect@3.2.4': dependencies: '@types/chai': 5.2.2 - '@vitest/spy': 3.2.2 - '@vitest/utils': 3.2.2 + '@vitest/spy': 3.2.4 + '@vitest/utils': 3.2.4 chai: 5.2.0 tinyrainbow: 2.0.0 - '@vitest/mocker@3.2.2(msw@2.9.0(@types/node@22.15.29)(typescript@5.8.3))(vite@6.3.5(@types/node@22.15.29)(jiti@2.4.2))': + '@vitest/mocker@3.2.4(msw@2.10.2(@types/node@22.15.34)(typescript@5.8.3))(vite@6.3.5(@types/node@22.15.34)(jiti@2.4.2))': dependencies: - '@vitest/spy': 3.2.2 + '@vitest/spy': 3.2.4 estree-walker: 3.0.3 magic-string: 0.30.17 optionalDependencies: - msw: 2.9.0(@types/node@22.15.29)(typescript@5.8.3) - vite: 6.3.5(@types/node@22.15.29)(jiti@2.4.2) + msw: 2.10.2(@types/node@22.15.34)(typescript@5.8.3) + vite: 6.3.5(@types/node@22.15.34)(jiti@2.4.2) - '@vitest/pretty-format@3.2.2': + '@vitest/pretty-format@3.2.4': dependencies: tinyrainbow: 2.0.0 - '@vitest/runner@3.2.2': + '@vitest/runner@3.2.4': dependencies: - '@vitest/utils': 3.2.2 + '@vitest/utils': 3.2.4 pathe: 2.0.3 + strip-literal: 3.0.0 - '@vitest/snapshot@3.2.2': + '@vitest/snapshot@3.2.4': dependencies: - '@vitest/pretty-format': 3.2.2 + '@vitest/pretty-format': 3.2.4 magic-string: 0.30.17 pathe: 2.0.3 - '@vitest/spy@3.2.2': + '@vitest/spy@3.2.4': dependencies: tinyspy: 4.0.3 - '@vitest/utils@3.2.2': + '@vitest/utils@3.2.4': dependencies: - '@vitest/pretty-format': 3.2.2 - loupe: 3.1.3 + '@vitest/pretty-format': 3.2.4 + loupe: 3.1.4 tinyrainbow: 2.0.0 abort-controller@3.0.0: @@ -1796,7 +1803,7 @@ snapshots: balanced-match@1.0.2: {} - brace-expansion@2.0.1: + brace-expansion@2.0.2: dependencies: balanced-match: 1.0.2 @@ -1813,7 +1820,7 @@ snapshots: assertion-error: 2.0.1 check-error: 2.1.1 deep-eql: 5.0.2 - loupe: 3.1.3 + loupe: 3.1.4 pathval: 2.0.0 check-error@2.1.1: {} @@ -2024,10 +2031,10 @@ snapshots: jsonref@9.0.0: {} - knip@5.61.3(@types/node@22.15.29)(typescript@5.8.3): + knip@5.61.3(@types/node@22.15.34)(typescript@5.8.3): dependencies: '@nodelib/fs.walk': 1.2.8 - '@types/node': 22.15.29 + '@types/node': 22.15.34 fast-glob: 3.3.3 formatly: 0.2.4 jiti: 2.4.2 @@ -2052,7 +2059,7 @@ snapshots: ky@0.33.3: {} - loupe@3.1.3: {} + loupe@3.1.4: {} lru-cache@10.4.3: {} @@ -2083,7 +2090,7 @@ snapshots: minimatch@9.0.5: dependencies: - brace-expansion: 2.0.1 + brace-expansion: 2.0.2 minimist@1.2.8: {} @@ -2091,13 +2098,13 @@ snapshots: ms@2.1.3: {} - msw@2.9.0(@types/node@22.15.29)(typescript@5.8.3): + msw@2.10.2(@types/node@22.15.34)(typescript@5.8.3): dependencies: '@bundled-es-modules/cookie': 2.0.1 '@bundled-es-modules/statuses': 1.0.1 '@bundled-es-modules/tough-cookie': 0.1.6 - '@inquirer/confirm': 5.1.12(@types/node@22.15.29) - '@mswjs/interceptors': 0.38.7 + '@inquirer/confirm': 5.1.12(@types/node@22.15.34) + '@mswjs/interceptors': 0.39.2 '@open-draft/deferred-promise': 2.2.0 '@open-draft/until': 2.1.0 '@types/cookie': 0.6.0 @@ -2148,16 +2155,16 @@ snapshots: '@oxc-resolver/binding-win32-arm64-msvc': 11.3.0 '@oxc-resolver/binding-win32-x64-msvc': 11.3.0 - oxlint@1.1.0: + oxlint@1.4.0: optionalDependencies: - '@oxlint/darwin-arm64': 1.1.0 - '@oxlint/darwin-x64': 1.1.0 - '@oxlint/linux-arm64-gnu': 1.1.0 - '@oxlint/linux-arm64-musl': 1.1.0 - '@oxlint/linux-x64-gnu': 1.1.0 - '@oxlint/linux-x64-musl': 1.1.0 - '@oxlint/win32-arm64': 1.1.0 - '@oxlint/win32-x64': 1.1.0 + '@oxlint/darwin-arm64': 1.4.0 + '@oxlint/darwin-x64': 1.4.0 + '@oxlint/linux-arm64-gnu': 1.4.0 + '@oxlint/linux-arm64-musl': 1.4.0 + '@oxlint/linux-x64-gnu': 1.4.0 + '@oxlint/linux-x64-musl': 1.4.0 + '@oxlint/win32-arm64': 1.4.0 + '@oxlint/win32-x64': 1.4.0 package-json-from-dist@1.0.1: {} @@ -2186,7 +2193,7 @@ snapshots: picocolors: 1.1.1 source-map-js: 1.2.1 - prettier@3.5.3: {} + prettier@3.6.2: {} psl@1.15.0: dependencies: @@ -2286,6 +2293,10 @@ snapshots: strip-json-comments@5.0.2: {} + strip-literal@3.0.0: + dependencies: + js-tokens: 9.0.1 + supports-color@7.2.0: dependencies: has-flag: 4.0.0 @@ -2305,7 +2316,7 @@ snapshots: fdir: 6.4.5(picomatch@4.0.2) picomatch: 4.0.2 - tinypool@1.1.0: {} + tinypool@1.1.1: {} tinyrainbow@2.0.0: {} @@ -2344,13 +2355,13 @@ snapshots: querystringify: 2.2.0 requires-port: 1.0.0 - vite-node@3.2.2(@types/node@22.15.29)(jiti@2.4.2): + vite-node@3.2.4(@types/node@22.15.34)(jiti@2.4.2): dependencies: cac: 6.7.14 debug: 4.4.1 es-module-lexer: 1.7.0 pathe: 2.0.3 - vite: 6.3.5(@types/node@22.15.29)(jiti@2.4.2) + vite: 6.3.5(@types/node@22.15.34)(jiti@2.4.2) transitivePeerDependencies: - '@types/node' - jiti @@ -2365,7 +2376,7 @@ snapshots: - tsx - yaml - vite@6.3.5(@types/node@22.15.29)(jiti@2.4.2): + vite@6.3.5(@types/node@22.15.34)(jiti@2.4.2): dependencies: esbuild: 0.25.5 fdir: 6.4.5(picomatch@4.0.2) @@ -2374,20 +2385,20 @@ snapshots: rollup: 4.41.1 tinyglobby: 0.2.14 optionalDependencies: - '@types/node': 22.15.29 + '@types/node': 22.15.34 fsevents: 2.3.3 jiti: 2.4.2 - vitest@3.2.2(@types/node@22.15.29)(jiti@2.4.2)(msw@2.9.0(@types/node@22.15.29)(typescript@5.8.3)): + vitest@3.2.4(@types/node@22.15.34)(jiti@2.4.2)(msw@2.10.2(@types/node@22.15.34)(typescript@5.8.3)): dependencies: '@types/chai': 5.2.2 - '@vitest/expect': 3.2.2 - '@vitest/mocker': 3.2.2(msw@2.9.0(@types/node@22.15.29)(typescript@5.8.3))(vite@6.3.5(@types/node@22.15.29)(jiti@2.4.2)) - '@vitest/pretty-format': 3.2.2 - '@vitest/runner': 3.2.2 - '@vitest/snapshot': 3.2.2 - '@vitest/spy': 3.2.2 - '@vitest/utils': 3.2.2 + '@vitest/expect': 3.2.4 + '@vitest/mocker': 3.2.4(msw@2.10.2(@types/node@22.15.34)(typescript@5.8.3))(vite@6.3.5(@types/node@22.15.34)(jiti@2.4.2)) + '@vitest/pretty-format': 3.2.4 + '@vitest/runner': 3.2.4 + '@vitest/snapshot': 3.2.4 + '@vitest/spy': 3.2.4 + '@vitest/utils': 3.2.4 chai: 5.2.0 debug: 4.4.1 expect-type: 1.2.1 @@ -2398,13 +2409,13 @@ snapshots: tinybench: 2.9.0 tinyexec: 0.3.2 tinyglobby: 0.2.14 - tinypool: 1.1.0 + tinypool: 1.1.1 tinyrainbow: 2.0.0 - vite: 6.3.5(@types/node@22.15.29)(jiti@2.4.2) - vite-node: 3.2.2(@types/node@22.15.29)(jiti@2.4.2) + vite: 6.3.5(@types/node@22.15.34)(jiti@2.4.2) + vite-node: 3.2.4(@types/node@22.15.34)(jiti@2.4.2) why-is-node-running: 2.3.0 optionalDependencies: - '@types/node': 22.15.29 + '@types/node': 22.15.34 transitivePeerDependencies: - jiti - less diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 8b90571..fd899ad 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -2,3 +2,6 @@ onlyBuiltDependencies: - esbuild - msw - unrs-resolver + +overrides: + brace-expansion: ^2.0.2 \ No newline at end of file diff --git a/src/hydra/fetchJsonLd.test.ts b/src/hydra/fetchJsonLd.test.ts index 31fe999..6c39cef 100644 --- a/src/hydra/fetchJsonLd.test.ts +++ b/src/hydra/fetchJsonLd.test.ts @@ -1,7 +1,7 @@ import { http, HttpResponse } from "msw"; +import { assert, expect, test } from "vitest"; import { server } from "../../vitest.setup.js"; import fetchJsonLd from "./fetchJsonLd.js"; -import { assert, expect, test } from "vitest"; const httpResponse = { "@context": "http://json-ld.org/contexts/person.jsonld", @@ -33,13 +33,15 @@ test("fetch a JSON-LD document", async () => { test("fetch a non JSON-LD document", async () => { server.use( - http.get("http://localhost/foo.jsonld", () => { - return new HttpResponse(`Hello`, { - headers: { "Content-Type": "text/html" }, - status: 200, - statusText: "OK", - }); - }), + http.get( + "http://localhost/foo.jsonld", + () => + new HttpResponse(`Hello`, { + headers: { "Content-Type": "text/html" }, + status: 200, + statusText: "OK", + }), + ), ); const promise = fetchJsonLd("http://localhost/foo.jsonld"); @@ -50,13 +52,13 @@ test("fetch a non JSON-LD document", async () => { test("fetch an error with Content-Type application/ld+json", async () => { server.use( - http.get("http://localhost/foo.jsonld", () => { - return HttpResponse.json(httpResponse, { + http.get("http://localhost/foo.jsonld", () => + HttpResponse.json(httpResponse, { status: 500, statusText: "Internal Server Error", headers: { "Content-Type": "application/ld+json" }, - }); - }), + }), + ), ); const rejectedResponse = await fetchJsonLd( @@ -72,13 +74,13 @@ test("fetch an error with Content-Type application/ld+json", async () => { test("fetch an error with Content-Type application/error+json", async () => { server.use( - http.get("http://localhost/foo.jsonld", () => { - return HttpResponse.json(httpResponse, { + http.get("http://localhost/foo.jsonld", () => + HttpResponse.json(httpResponse, { status: 400, statusText: "Bad Request", headers: { "Content-Type": "application/error+json" }, - }); - }), + }), + ), ); const rejectedResponse = await fetchJsonLd( @@ -94,13 +96,15 @@ test("fetch an error with Content-Type application/error+json", async () => { test("fetch an empty document", async () => { server.use( - http.get("http://localhost/foo.jsonld", () => { - return new HttpResponse(``, { - status: 204, - statusText: "No Content", - headers: { "Content-Type": "text/html" }, - }); - }), + http.get( + "http://localhost/foo.jsonld", + () => + new HttpResponse(``, { + status: 204, + statusText: "No Content", + headers: { "Content-Type": "text/html" }, + }), + ), ); const dataPromise = fetchJsonLd("http://localhost/foo.jsonld"); diff --git a/src/swagger/handleJson.ts b/src/swagger/handleJson.ts index 23b540d..ed4fce0 100644 --- a/src/swagger/handleJson.ts +++ b/src/swagger/handleJson.ts @@ -1,9 +1,9 @@ import inflection from "inflection"; +import type { OpenAPIV2 } from "openapi-types"; import { Field } from "../Field.js"; +import getType from "../openapi3/getType.js"; import { Resource } from "../Resource.js"; import getResourcePaths from "../utils/getResources.js"; -import getType from "../openapi3/getType.js"; -import type { OpenAPIV2 } from "openapi-types"; export function removeTrailingSlash(url: string): string { if (url.endsWith("/")) { @@ -48,30 +48,31 @@ export default function handleJson( const requiredFields = response.definitions?.[title]?.required ?? []; - const fields = Object.entries(properties).map(([fieldName, property]) => { - return new Field(fieldName, { - id: null, - range: null, - type: getType( - typeof property?.type === "string" ? property.type : "", - property?.["format"] ?? "", - ), - enum: property.enum - ? Object.fromEntries( - property.enum.map((enumValue: string | number) => [ - typeof enumValue === "string" - ? inflection.humanize(enumValue) - : enumValue, - enumValue, - ]), - ) - : null, - reference: null, - embedded: null, - required: requiredFields.some((value) => value === fieldName), - description: property.description || "", - }); - }); + const fields = Object.entries(properties).map( + ([fieldName, property]) => + new Field(fieldName, { + id: null, + range: null, + type: getType( + typeof property?.type === "string" ? property.type : "", + property?.["format"] ?? "", + ), + enum: property.enum + ? Object.fromEntries( + property.enum.map((enumValue: string | number) => [ + typeof enumValue === "string" + ? inflection.humanize(enumValue) + : enumValue, + enumValue, + ]), + ) + : null, + reference: null, + embedded: null, + required: requiredFields.some((value) => value === fieldName), + description: property.description || "", + }), + ); return new Resource(name, url, { id: null, diff --git a/src/utils/getResources.ts b/src/utils/getResources.ts index a1ee4c1..6eb2be8 100644 --- a/src/utils/getResources.ts +++ b/src/utils/getResources.ts @@ -5,9 +5,9 @@ export default function getResources( ): string[] { return [ ...new Set( - Object.keys(paths).filter((path) => { - return new RegExp("^[^{}]+/{[^{}]+}/?$").test(path); - }), + Object.keys(paths).filter((path) => + new RegExp("^[^{}]+/{[^{}]+}/?$").test(path), + ), ), ]; }