diff --git a/package.json b/package.json index f139b786..0c13a1c3 100644 --- a/package.json +++ b/package.json @@ -79,11 +79,11 @@ "fs-extra": "^11.3.0", "fumadocs-core": "16.18.0", "fumadocs-mdx": "15.4.7", - "fumadocs-openapi": "12.6.0", + "fumadocs-openapi": "12.6.5", "fumadocs-ui": "16.18.0", "get-port": "^7.1.0", "is-in-ci": "^2.0.0", - "lucide-react": "1.69.0", + "lucide-react": "1.71.0", "mustache": "^4.2.0", "neverthrow": "^8.2.0", "open": "^8.4.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3cdaea16..926829c1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,6 +18,7 @@ overrides: browserslist: 4.24.4 fumadocs-openapi>chokidar: ^5.0.0 fumadocs-openapi>undici: 7.30.1 + fumadocs-openapi>@scalar/json-magic: ^0.16.1 '@types/node': 22.14.1 importers: @@ -41,7 +42,7 @@ importers: version: 5.3.0 '@fumadocs/api-docs': specifier: 0.2.8 - version: 0.2.8(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(fumadocs-ui@16.18.0(@types/mdx@2.0.14)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(tailwindcss@4.3.3))(react-dom@19.2.8(react@19.2.8))(react@19.2.8) + version: 0.2.8(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(fumadocs-ui@16.18.0(@types/mdx@2.0.14)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(tailwindcss@4.3.3))(react-dom@19.2.8(react@19.2.8))(react@19.2.8) '@oclif/core': specifier: 4.11.0 version: 4.11.0 @@ -95,16 +96,16 @@ importers: version: 11.3.5 fumadocs-core: specifier: 16.18.0 - version: 16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5) + version: 16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5) fumadocs-mdx: specifier: 15.4.7 - version: 15.4.7(@types/mdast@4.0.4)(@types/mdx@2.0.14)(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react@19.2.8)(rolldown@1.2.8)(vite@8.2.2(@types/node@22.14.1)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.1)) + version: 15.4.7(@types/mdast@4.0.4)(@types/mdx@2.0.14)(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react@19.2.8)(rolldown@1.2.8)(vite@8.2.2(@types/node@22.14.1)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.1)) fumadocs-openapi: - specifier: 12.6.0 - version: 12.6.0(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(fumadocs-ui@16.18.0(@types/mdx@2.0.14)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(tailwindcss@4.3.3))(react-dom@19.2.8(react@19.2.8))(react@19.2.8) + specifier: 12.6.5 + version: 12.6.5(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(fumadocs-ui@16.18.0(@types/mdx@2.0.14)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(tailwindcss@4.3.3))(react-dom@19.2.8(react@19.2.8))(react@19.2.8) fumadocs-ui: specifier: 16.18.0 - version: 16.18.0(@types/mdx@2.0.14)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(tailwindcss@4.3.3) + version: 16.18.0(@types/mdx@2.0.14)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(tailwindcss@4.3.3) get-port: specifier: ^7.1.0 version: 7.2.0 @@ -112,8 +113,8 @@ importers: specifier: ^2.0.0 version: 2.0.0 lucide-react: - specifier: 1.69.0 - version: 1.69.0(@types/react@19.3.0)(react@19.2.8) + specifier: 1.71.0 + version: 1.71.0(@types/react@19.3.0)(react@19.2.8) mustache: specifier: ^4.2.0 version: 4.2.0 @@ -1975,6 +1976,10 @@ packages: resolution: {integrity: sha512-9eILWzUcAkHEuYMMvijpSIy69t+Vkq+NudLB/7lgARFTWqXfQpIxW1L3VH7ogKyRie5+E4CNZ3PSvlw6IIfLGw==} engines: {node: '>=22'} + '@scalar/helpers@0.17.1': + resolution: {integrity: sha512-zkVpcxCzaQfZ0GrPPbqXZUH4N2sHubFyW+aIRln7Ovv1P6jAN3we3O0/LD5qCRAROalA14pEqplp6eOtc7BWlA==} + engines: {node: '>=22'} + '@scalar/json-magic@0.13.4': resolution: {integrity: sha512-pOZdlzkgLB+/4OlIlzMToV/cr4vsvWy/MtbtJoRcNHIzDnT8sfNtv/cH8MR2pNDg/29sPpTV1HaE4SZ8b9jUOQ==} engines: {node: '>=22'} @@ -1983,12 +1988,12 @@ packages: resolution: {integrity: sha512-yWQJUrkufUsShizF+rGKO4BoZ/ijMpnrgwRjtCA2cYqjxkQOYaQCd+WVF+b3ihmXE7amr768pLItFCx5UV/ObQ==} engines: {node: '>=22'} - '@scalar/openapi-types@0.9.8': - resolution: {integrity: sha512-pGcpkZObsGBC7nRKYte+6gstoe0C4hp7B2UWQYjg5To1wE68s3OHVvin+muL3tn3ZAoahXeJAkn1+aEcMi802w==} + '@scalar/openapi-types@0.9.9': + resolution: {integrity: sha512-Z2NfKMNhtWJaEiYVU1pzVS+BT53ygotVA6y9reCx0jTcwqml9WPrNPumgjlgoZnBdP9pZU3+u86RNwwVAyArvA==} engines: {node: '>=22'} - '@scalar/openapi-upgrader@0.4.6': - resolution: {integrity: sha512-wkTbowGZAlDA5AhCAnBVft6y3veoE17P+okH/zrwM/BZWBSzPghGpa4BPTCg3+IzRmRP/8ZeaYO7LfxCDAEmcA==} + '@scalar/openapi-upgrader@0.4.8': + resolution: {integrity: sha512-HsOVdONiIwUm2Rwx6t8XY0uFqBRJrUmXWSi5aA3lhT5j1kwGVAbH3c3NC42Ku87/EC3KHVD1TwTosr8XULsjPQ==} engines: {node: '>=22'} '@sec-ant/readable-stream@0.4.1': @@ -4059,8 +4064,8 @@ packages: vite: optional: true - fumadocs-openapi@12.6.0: - resolution: {integrity: sha512-N0dsXKwpbMQVQ4BICy/XqO0EGkAYshL6kDssEBAofsm2ogT9/4HXtgPxNE8ipuCrEs3rpOqqm+nQJV/savfGZA==} + fumadocs-openapi@12.6.5: + resolution: {integrity: sha512-N80kkgij2KuzUIHxQE8hGVNrksXosOjdf3KPHyL/GCDBnBHFmxHosbfZfPa7SJqmBQFNh/38dSP1izUAEef4Gg==} peerDependencies: '@scalar/api-client-react': ^2.0.20 '@types/react': '*' @@ -4997,8 +5002,8 @@ packages: lru-cache@5.1.1: resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} - lucide-react@1.69.0: - resolution: {integrity: sha512-UTFECm4yEgkgMN0kfLuxWcmlk+4u02Jrqehgk3ZXRx/Ud68OpP7hjkp67bvkBHmIpMaZCIveF1QDYeupO7XmYQ==} + lucide-react@1.71.0: + resolution: {integrity: sha512-8YtvF+bqT/EMqAXU7kWvYdRu+TV9j4kS1eIS7IbN1j1Z1DgupbrTL0nDIygdqgBDTD7AJPP607VdVgzDTar4zA==} peerDependencies: '@types/react': '*' react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0 @@ -7934,7 +7939,7 @@ snapshots: optionalDependencies: '@types/react': 19.3.0 - '@fumadocs/api-docs@0.2.8(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(fumadocs-ui@16.18.0(@types/mdx@2.0.14)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(tailwindcss@4.3.3))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)': + '@fumadocs/api-docs@0.2.8(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(fumadocs-ui@16.18.0(@types/mdx@2.0.14)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(tailwindcss@4.3.3))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)': dependencies: '@base-ui/react': 1.9.0(@types/react@19.3.0)(react-dom@19.2.8(react@19.2.8))(react@19.2.8) '@fuma-translate/react': 1.0.2(@types/react@19.3.0)(react-dom@19.2.8(react@19.2.8))(react@19.2.8) @@ -7942,10 +7947,10 @@ snapshots: '@scalar/json-magic': 0.13.4 class-variance-authority: 0.7.1 cn: 0.2.6 - fumadocs-core: 16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5) - fumadocs-ui: 16.18.0(@types/mdx@2.0.14)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(tailwindcss@4.3.3) + fumadocs-core: 16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5) + fumadocs-ui: 16.18.0(@types/mdx@2.0.14)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(tailwindcss@4.3.3) github-slugger: 2.0.0 - lucide-react: 1.69.0(@types/react@19.3.0)(react@19.2.8) + lucide-react: 1.71.0(@types/react@19.3.0)(react@19.2.8) react: 19.2.8 react-dom: 19.2.8(react@19.2.8) optionalDependencies: @@ -8820,6 +8825,8 @@ snapshots: '@scalar/helpers@0.16.4': {} + '@scalar/helpers@0.17.1': {} + '@scalar/json-magic@0.13.4': dependencies: '@scalar/helpers': 0.11.3 @@ -8833,12 +8840,12 @@ snapshots: undici: 7.30.1 yaml: 2.9.1 - '@scalar/openapi-types@0.9.8': {} + '@scalar/openapi-types@0.9.9': {} - '@scalar/openapi-upgrader@0.4.6': + '@scalar/openapi-upgrader@0.4.8': dependencies: - '@scalar/helpers': 0.16.4 - '@scalar/openapi-types': 0.9.8 + '@scalar/helpers': 0.17.1 + '@scalar/openapi-types': 0.9.9 '@sec-ant/readable-stream@0.4.1': {} @@ -11087,7 +11094,7 @@ snapshots: fsevents@2.3.3: optional: true - fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5): + fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5): dependencies: '@fumari/image-size': 0.1.1 estree-util-value-to-estree: 3.5.0 @@ -11115,21 +11122,21 @@ snapshots: '@types/hast': 3.0.5 '@types/mdast': 4.0.4 '@types/react': 19.3.0 - lucide-react: 1.69.0(@types/react@19.3.0)(react@19.2.8) + lucide-react: 1.71.0(@types/react@19.3.0)(react@19.2.8) react: 19.2.8 react-dom: 19.2.8(react@19.2.8) zod: 4.6.5 transitivePeerDependencies: - supports-color - fumadocs-mdx@15.4.7(@types/mdast@4.0.4)(@types/mdx@2.0.14)(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react@19.2.8)(rolldown@1.2.8)(vite@8.2.2(@types/node@22.14.1)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.1)): + fumadocs-mdx@15.4.7(@types/mdast@4.0.4)(@types/mdx@2.0.14)(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react@19.2.8)(rolldown@1.2.8)(vite@8.2.2(@types/node@22.14.1)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.21.0)(yaml@2.9.1)): dependencies: '@mdx-js/mdx': 3.1.1 '@standard-schema/spec': 1.1.0 chokidar: 5.0.0 esbuild: 0.28.2 estree-util-value-to-estree: 3.5.0 - fumadocs-core: 16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5) + fumadocs-core: 16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5) github-slugger: 2.0.0 magic-string: 1.4.3 mdast-util-mdx: 3.0.0 @@ -11153,7 +11160,7 @@ snapshots: transitivePeerDependencies: - supports-color - fumadocs-openapi@12.6.0(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(fumadocs-ui@16.18.0(@types/mdx@2.0.14)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(tailwindcss@4.3.3))(react-dom@19.2.8(react@19.2.8))(react@19.2.8): + fumadocs-openapi@12.6.5(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(fumadocs-ui@16.18.0(@types/mdx@2.0.14)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(tailwindcss@4.3.3))(react-dom@19.2.8(react@19.2.8))(react@19.2.8): dependencies: '@base-ui/react': 1.9.0(@types/react@19.3.0)(react-dom@19.2.8(react@19.2.8))(react@19.2.8) '@fuma-translate/react': 1.0.2(@types/react@19.3.0)(react-dom@19.2.8(react@19.2.8))(react@19.2.8) @@ -11161,14 +11168,14 @@ snapshots: '@fumari/json-schema-ts': 1.0.2 '@fumari/stf': 1.1.2(@types/react@19.3.0)(react-dom@19.2.8(react@19.2.8))(react@19.2.8) '@scalar/json-magic': 0.16.1 - '@scalar/openapi-upgrader': 0.4.6 + '@scalar/openapi-upgrader': 0.4.8 chokidar: 5.0.0 class-variance-authority: 0.7.1 cn: 0.5.2 - fumadocs-core: 16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5) - fumadocs-ui: 16.18.0(@types/mdx@2.0.14)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(tailwindcss@4.3.3) + fumadocs-core: 16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5) + fumadocs-ui: 16.18.0(@types/mdx@2.0.14)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(tailwindcss@4.3.3) github-slugger: 2.0.0 - lucide-react: 1.69.0(@types/react@19.3.0)(react@19.2.8) + lucide-react: 1.71.0(@types/react@19.3.0)(react@19.2.8) react: 19.2.8 react-dom: 19.2.8(react@19.2.8) remark: 15.0.1 @@ -11183,7 +11190,7 @@ snapshots: - date-fns - supports-color - fumadocs-ui@16.18.0(@types/mdx@2.0.14)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(tailwindcss@4.3.3): + fumadocs-ui@16.18.0(@types/mdx@2.0.14)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(fumadocs-core@16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(tailwindcss@4.3.3): dependencies: '@fuma-translate/react': 1.0.2(@types/react@19.3.0)(react-dom@19.2.8(react@19.2.8))(react@19.2.8) '@fumadocs/tailwind': 0.1.5(tailwindcss@4.3.3) @@ -11199,8 +11206,8 @@ snapshots: '@radix-ui/react-tabs': 1.2.1(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(react-dom@19.2.8(react@19.2.8))(react@19.2.8) class-variance-authority: 0.7.1 cn: 0.5.2 - fumadocs-core: 16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5) - lucide-react: 1.69.0(@types/react@19.3.0)(react@19.2.8) + fumadocs-core: 16.18.0(@mdx-js/mdx@3.1.1)(@tanstack/react-router@1.170.33(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@types/estree-jsx@1.0.5)(@types/hast@3.0.5)(@types/mdast@4.0.4)(@types/react@19.3.0)(lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(zod@4.6.5) + lucide-react: 1.71.0(@types/react@19.3.0)(react@19.2.8) motion: 14.9.1(react-dom@19.2.8(react@19.2.8))(react@19.2.8) next-themes: 0.4.6(react-dom@19.2.8(react@19.2.8))(react@19.2.8) react: 19.2.8 @@ -12121,7 +12128,7 @@ snapshots: dependencies: yallist: 3.1.1 - lucide-react@1.69.0(@types/react@19.3.0)(react@19.2.8): + lucide-react@1.71.0(@types/react@19.3.0)(react@19.2.8): dependencies: react: 19.2.8 optionalDependencies: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 4a7ea299..854df503 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -25,4 +25,10 @@ overrides: # the two on Node 22.14, and installs all the same. 'fumadocs-openapi>chokidar': ^5.0.0 'fumadocs-openapi>undici': 7.30.1 + # 12.6.5 asks for @scalar/json-magic 0.19 as well, whose floor is Node 22.19 for the undici 8 it pins. + # Held at 0.16, which 12.6.0 shipped with. Unlike the two above, the CLI loads this one: fumadocs-openapi + # reads a specification through its magic proxy, which 0.19 rewrote. So the tests here run 0.16's proxy + # and an `npm install -g` runs 0.19's, with two more EBADENGINE warnings on Node 22.14, for it and for + # that undici; the portal tests install the packed CLI as npm does. + 'fumadocs-openapi>@scalar/json-magic': ^0.16.1 '@types/node': $@types/node diff --git a/portal-template/src/components/playground.tsx b/portal-template/src/components/playground.tsx index 0908ea9a..9c8918cb 100644 --- a/portal-template/src/components/playground.tsx +++ b/portal-template/src/components/playground.tsx @@ -39,8 +39,6 @@ export default function Playground() { }), [] ); - // Fumadocs takes a returned sign-in's answer out of the address in the effects of the playground below this one. - useEffect(() => analytics.loadTags(), []); return ( diff --git a/portal-template/src/components/usage-tabs.tsx b/portal-template/src/components/usage-tabs.tsx index 02dd2528..f7225b0f 100644 --- a/portal-template/src/components/usage-tabs.tsx +++ b/portal-template/src/components/usage-tabs.tsx @@ -68,7 +68,7 @@ function SampleCode({ sample }: Readonly<{ sample: CodeSample }>) { return ; } -// Follows the playground's edits, typed credentials included, so it carries the playground's replay markers. +// Follows the playground's edits, so it carries its replay markers; Fumadocs writes a credential as `********`. function CurlCode() { const { CodeBlock } = useComponents(); const code = useCodeUsage(CURL_USAGE_ID); diff --git a/portal-template/src/lib/analytics.ts b/portal-template/src/lib/analytics.ts index 10e59cff..5d5a9b92 100644 --- a/portal-template/src/lib/analytics.ts +++ b/portal-template/src/lib/analytics.ts @@ -83,11 +83,6 @@ export class Analytics { insertTags(this.live); } - /** The tags held back while the address held an OAuth answer, once something has taken it out. */ - public loadTags(): void { - insertTags(this.live); - } - /** `href` is the page the event belongs to, when the caller saw the address move on first. */ public report(name: E, params: PortalEvents[E], href = window.location.href): void { if (isOAuthCallbackPath(new URL(href).pathname)) return; @@ -101,7 +96,8 @@ export class Analytics { public reportPageView(): void { if (isOAuthCallbackPath(window.location.pathname)) return; - this.loadTags(); + // The tags a start on the OAuth callback left out, now that the reader has moved on from it. + insertTags(this.live); const page = pageLocation(window.location.href, this.settings.keepQueryParams); if (page === this.lastPageView) return; this.previousPageView = this.lastPageView; diff --git a/portal-template/src/lib/oauth-callback.ts b/portal-template/src/lib/oauth-callback.ts index ad878ec7..7b0ac8aa 100644 --- a/portal-template/src/lib/oauth-callback.ts +++ b/portal-template/src/lib/oauth-callback.ts @@ -12,22 +12,15 @@ export function isOAuthCallbackPath(pathname: string, base?: string): boolean { return pathname.replace(/\/$/, '') === withBasePath(oauthCallbackPath, base); } -/** The callback's address always holds a provider's answer; a page a sign-in returned to does until the playground reads it. */ -export function holdsOAuthAnswer({ pathname, search, hash }: Pick): boolean { - // Fumadocs sends a `state` with every authorization, and the answer carries it back in the query or the `#` part. - return ( - isOAuthCallbackPath(pathname) || - new URLSearchParams(search).has('state') || - new URLSearchParams(hash.slice(1)).has('state') - ); -} - /** Where the playground notes the path of the page that started the flow before it leaves: this tab's session storage. */ const STARTING_PAGE_KEY = 'fumadocs-openapi-oauth'; +/** Where the playground looks for the callback's address, the provider's answer in it, once its page loads again. */ +const ANSWER_KEY = 'fumadocs-openapi-oauth-returned'; + /** What the callback does with the browser that lands on it. */ export type OAuthCallback = - /** Sends it back to the page that started the flow, with the provider's answer still attached. */ + /** Sends it back to the page that started the flow, at its own address: the answer goes through the session. */ | { kind: 'return'; url: string } /** Stays, to show the error the provider ended the authorization with, and a link back to that page. */ | { kind: 'providerError'; error: string; description: string | null; page: string } @@ -56,7 +49,7 @@ export function oauthCallback( } catch { return { kind: 'unknownPage' }; } - // Anything else is an open redirect, carrying the authorization code to another site. + // Anything else is an open redirect. if (page.origin !== location.origin) return { kind: 'unknownPage' }; const query = new URLSearchParams(location.search); @@ -67,8 +60,6 @@ export function oauthCallback( } // Whole, not as a path: a path of `//evil.test/x` would be read as another site's address. - page.search = location.search; - page.hash = location.hash; return { kind: 'return', url: page.href }; } @@ -82,3 +73,8 @@ export function takeStartingPage(): string | null { sessionStorage.removeItem(STARTING_PAGE_KEY); return page; } + +/** Leaves the callback's address for the playground, as Fumadocs' handler does: no page's address holds the answer. */ +export function leaveAnswer(callbackAddress: string): void { + sessionStorage.setItem(ANSWER_KEY, callbackAddress); +} diff --git a/portal-template/src/lib/vendor-tags.ts b/portal-template/src/lib/vendor-tags.ts index 76f7922e..bd0d9212 100644 --- a/portal-template/src/lib/vendor-tags.ts +++ b/portal-template/src/lib/vendor-tags.ts @@ -1,4 +1,4 @@ -import { holdsOAuthAnswer } from './oauth-callback'; +import { isOAuthCallbackPath } from './oauth-callback'; import type { PortalAnalytics } from './portal-types'; type Gtag = (...command: unknown[]) => void; @@ -54,9 +54,14 @@ export const adapters: { [V in Vendor]: (settings: PortalAnalytics) => Adapter | } }; -/** None while the address holds an OAuth answer, which the tags read for themselves; each once, so a later call adds the rest. */ +/** + * None on the OAuth callback, whose address holds the provider's answer; each once, so a later call adds the rest. + * The page a sign-in returns to loads them at once, although the answer waits in the tab's session storage until + * a playground reads it: tags read the address, not the storage, so that window is accepted. On a page that mounts + * no playground the answer stays until one mounts in the tab or the tab closes, as with Fumadocs' own handler. + */ export function insertTags(live: Adapter[]): void { - if (holdsOAuthAnswer(window.location)) return; + if (isOAuthCallbackPath(window.location.pathname)) return; for (const { script: src } of live) { if (document.head.querySelector(`script[src="${src}"]`) !== null) continue; const script = document.createElement('script'); diff --git a/portal-template/src/routes/oauth.callback.tsx b/portal-template/src/routes/oauth.callback.tsx index 7a56c71c..1fb8d5a8 100644 --- a/portal-template/src/routes/oauth.callback.tsx +++ b/portal-template/src/routes/oauth.callback.tsx @@ -3,7 +3,13 @@ import { HomeLayout } from 'fumadocs-ui/layouts/home'; import { useEffect, useState } from 'react'; import { AuthorizationFailure } from '@/components/authorization-failure'; import { baseOptions } from '@/lib/layout.shared'; -import { oauthCallback, takeStartingPage, type OAuthCallback, type OAuthCallbackFailure } from '@/lib/oauth-callback'; +import { + leaveAnswer, + oauthCallback, + takeStartingPage, + type OAuthCallback, + type OAuthCallbackFailure +} from '@/lib/oauth-callback'; import { portal } from '@/lib/portal'; // Published portals are static, so this page does in the browser what Fumadocs' @@ -32,7 +38,10 @@ let completion: OAuthCallback | undefined; function completeAuthorization(): OAuthCallback { if (completion === undefined) { completion = oauthCallback(takeStartingPage(), window.location); - if (completion.kind === 'return') window.location.replace(completion.url); + if (completion.kind === 'return') { + leaveAnswer(window.location.href); + window.location.replace(completion.url); + } } return completion; } diff --git a/test/portal-template/analytics.test.ts b/test/portal-template/analytics.test.ts index 8b04e005..b4b0fc99 100644 --- a/test/portal-template/analytics.test.ts +++ b/test/portal-template/analytics.test.ts @@ -415,8 +415,8 @@ describe('Analytics', () => { }); }); - describe('after a playground sign-in', () => { - it('reports with the OAuth answer stripped from page_location', () => { + describe('at an address that holds an OAuth answer', () => { + it('reports with the answer stripped from page_location', () => { const page = browser('https://docs.test/api/pets/listPets#access_token=xyz&state=123', 'List pets'); const analytics = new Analytics(withBoth); @@ -432,26 +432,17 @@ describe('Analytics', () => { }); }); - describe('on the page a playground sign-in returned to', () => { - const answered = 'https://docs.test/api/pets/listPets?code=abc&state=123'; - - it('holds the tags back while the answer is in the address, and loads them once the playground took it out', () => { - const page = browser(answered, 'List pets'); + // A sign-in's answer reaches the playground through the tab's session, so no page but the callback waits for one. + describe('on a page whose own link carries a state parameter', () => { + it('loads the tags at once, and reports the page without the parameter', () => { + const page = browser(`${quickstart}?state=CA`); const analytics = new Analytics(withBoth); analytics.start(); analytics.reportPageView(); - analytics.loadTags(); - - expect(page.scripts).to.be.empty; - expect(pageViews(page.dataLayer())).to.have.length(1); - - page.go('https://docs.test/api/pets/listPets'); - analytics.loadTags(); - analytics.reportPageView(); expect(page.scripts.map((script) => script.src)).to.deep.equal([GTM_SCRIPT, GA4_SCRIPT]); - expect(pageViews(page.dataLayer())).to.have.length(1); + expect(pageViews(page.dataLayer())).to.deep.equal([quickstartView]); }); }); diff --git a/test/portal-template/oauth-callback.test.ts b/test/portal-template/oauth-callback.test.ts index 7d016570..ea978bed 100644 --- a/test/portal-template/oauth-callback.test.ts +++ b/test/portal-template/oauth-callback.test.ts @@ -1,9 +1,11 @@ +import { runInNewContext } from 'node:vm'; import { expect } from 'chai'; import type { SecuritySchemeObject } from 'fumadocs-openapi'; import { requestOAuthToken } from 'fumadocs-openapi/playground'; +import { createOpenAPI } from 'fumadocs-openapi/server'; import { - holdsOAuthAnswer, isOAuthCallbackPath, + leaveAnswer, oauthCallback, oauthCallbackPath, takeStartingPage @@ -41,26 +43,6 @@ describe('isOAuthCallbackPath', () => { }); }); -describe('holdsOAuthAnswer', () => { - const at = (href: string) => holdsOAuthAnswer(new URL(href)); - - it('holds on the callback, with or without an answer', () => { - expect(at('https://docs.test/oauth/callback')).to.be.true; - expect(at('https://docs.test/oauth/callback?code=abc&state=123')).to.be.true; - }); - - it('holds on a page a sign-in returned to, with a code, a token or an error', () => { - expect(at('https://docs.test/api/pets/listPets?code=abc&state=123')).to.be.true; - expect(at('https://docs.test/api/pets/listPets#access_token=xyz&token_type=Bearer&state=123')).to.be.true; - expect(at('https://docs.test/api/pets/listPets?error=access_denied&state=123')).to.be.true; - }); - - it('does not hold on any other address, a query or a # part of its own included', () => { - expect(at('https://docs.test/api/pets/listPets')).to.be.false; - expect(at('https://docs.test/guides/quickstart?utm_source=mail&code=SAVE10#install')).to.be.false; - }); -}); - describe('takeStartingPage', () => { const origin = 'https://docs.test'; const pathname = '/api/pets/pets/listPets'; @@ -107,7 +89,7 @@ describe('takeStartingPage', () => { } }); - it("sends the provider's answer back to the page the playground noted before it left", async () => { + it('sends the browser back to the page the playground noted before it left', async () => { await requestOAuthToken(scheme, 'authorizationCode', flow); expect(leftFor?.origin, 'left for the provider').to.equal('https://provider.test'); expect(leftFor?.searchParams.get('redirect_uri')).to.equal(`${origin}${oauthCallbackPath}`); @@ -115,7 +97,7 @@ describe('takeStartingPage', () => { const callback = oauthCallback(takeStartingPage(), { origin, search: `?code=abc&state=${state}`, hash: '' }); - expect(callback).to.deep.equal({ kind: 'return', url: `${origin}${pathname}?code=abc&state=${state}` }); + expect(callback).to.deep.equal({ kind: 'return', url: `${origin}${pathname}` }); }); it('takes the note once', async () => { @@ -126,41 +108,76 @@ describe('takeStartingPage', () => { }); }); -describe('oauthCallback', () => { - const origin = 'https://docs.test'; - const answered = (search: string, hash = '') => ({ origin, search, hash }); - - it("sends the authorization code back to the page that started the flow, in the provider's query", () => { - const callback = oauthCallback('/api/pets/pets/listPets', answered('?code=abc&state=123')); +// Fumadocs' handler is a server route. Inlined, its page carries the script a static site would serve. +describe('leaveAnswer', () => { + const tab = globalThis as { sessionStorage?: unknown }; + const callbackAddress = 'https://docs.test/oauth/callback?code=abc&state=123'; + /** A tab's session in which the playground has noted its page, as the test above holds it does. */ + const session = () => { + const storage = new Map([['fumadocs-openapi-oauth', '/api/pets/pets/listPets']]); + return { + // What a callback left for the playground, the note aside: Fumadocs' handler keeps it, ours takes it. + left: () => [...storage].filter(([key]) => key !== 'fumadocs-openapi-oauth'), + getItem: (key: string) => storage.get(key) ?? null, + setItem: (key: string, value: string) => void storage.set(key, value), + removeItem: (key: string) => void storage.delete(key) + }; + }; - expect(callback).to.deep.equal({ - kind: 'return', - url: 'https://docs.test/api/pets/pets/listPets?code=abc&state=123' + afterEach(() => { + delete tab.sessionStorage; + }); + + it("leaves what Fumadocs' own handler leaves for the playground, and goes to the same page", async () => { + const handler = createOpenAPI().createOAuthHandler({ inline: true }); + const script = + /