Compare commits

...

6 Commits

Author SHA1 Message Date
3aabcd6442 fix: fix router navigateUrl
Some checks failed
Build, Lint & Test Lib / Build, Lint and Test Library (push) Has been cancelled
2025-02-21 05:30:31 +08:00
0d957dfb1c feat: support client_secret 2025-02-21 03:53:46 +08:00
144e4c2f97 fix: fix deps 2025-02-21 01:03:03 +08:00
de07175ff4 fix: fix building 2025-02-21 00:52:47 +08:00
41f2b04c45 refactor: switch from jsdom to happy-dom 2025-02-18 16:00:16 +08:00
ba13828093 feat: add more auth features and remove auth module 2025-02-07 16:59:58 +08:00
14 changed files with 455 additions and 134 deletions

View File

@ -1,5 +1,6 @@
{
"name": "oidc-client-rx",
"version": "0.1.0-alpha.6",
"homepage": "https://github.com/lonelyhentxi/oidc-client-rx",
"author": "lonelyhentxi",
"description": "ReactiveX enhanced OIDC and OAuth2 protocol support for browser-based JavaScript applications",
@ -10,7 +11,6 @@
"bugs": {
"url": "https://github.com/lonelyhentxi/oidc-client-rx/issues"
},
"version": "0.1.0",
"type": "module",
"exports": {
".": {
@ -32,21 +32,21 @@
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": ["dist"],
"files": ["dist", "licenses", "LICENSE", "README.md"],
"scripts": {
"build": "rslib build",
"dev": "rslib build --watch",
"test": "vitest --coverage",
"test-ci": "vitest --watch=false --coverage",
"pack": "npm run build && npm pack ./dist",
"publish": "npm run build && npm publish ./dist",
"prepublishOnly": "npm run build",
"lint": "ultracite lint",
"format": "ultracite format",
"cli": "tsx scripts/cli.ts"
},
"dependencies": {
"@ngify/http": "^2.0.4",
"@outposts/injection-js": "^2.5.1"
"@outposts/injection-js": "^2.5.1",
"rfc4648": "^1.5.0"
},
"peerDependencies": {
"@tanstack/react-router": "*",
@ -58,23 +58,21 @@
"@biomejs/js-api": "0.7.1",
"@biomejs/wasm-nodejs": "^1.9.4",
"@playwright/test": "^1.49.1",
"@rslib/core": "^0.4.0",
"@rslib/core": "^0.5.0",
"@swc/core": "^1.10.12",
"@tanstack/react-router": "^1.99.6",
"@types/jsdom": "^21.1.7",
"@types/lodash-es": "^4.17.12",
"@types/node": "^22.12.0",
"@types/react": "^19.0.8",
"@vitest/coverage-v8": "^3.0.4",
"commander": "^13.1.0",
"jsdom": "^26.0.0",
"happy-dom": "^17.1.0",
"lodash-es": "^4.17.21",
"oxc-parser": "^0.48.1",
"oxc-walker": "^0.2.2",
"playwright": "^1.50.0",
"react": "^19.0.0",
"reflect-metadata": "^0.2.2",
"rfc4648": "^1.5.0",
"rxjs": "^7.4.0",
"tsx": "^4.19.2",
"typescript": "^5.7.3",

412
pnpm-lock.yaml generated
View File

@ -14,6 +14,9 @@ importers:
'@outposts/injection-js':
specifier: ^2.5.1
version: 2.5.1
rfc4648:
specifier: ^1.5.0
version: 1.5.4
devDependencies:
'@biomejs/biome':
specifier: 1.9.4
@ -28,17 +31,14 @@ importers:
specifier: ^1.49.1
version: 1.49.1
'@rslib/core':
specifier: ^0.4.0
version: 0.4.0(@microsoft/api-extractor@7.49.2(@types/node@22.12.0))(typescript@5.7.3)
specifier: ^0.5.0
version: 0.5.0(@microsoft/api-extractor@7.49.2(@types/node@22.12.0))(typescript@5.7.3)
'@swc/core':
specifier: ^1.10.12
version: 1.10.12(@swc/helpers@0.5.15)
'@tanstack/react-router':
specifier: ^1.99.6
version: 1.99.6(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
'@types/jsdom':
specifier: ^21.1.7
version: 21.1.7
'@types/lodash-es':
specifier: ^4.17.12
version: 4.17.12
@ -54,9 +54,9 @@ importers:
commander:
specifier: ^13.1.0
version: 13.1.0
jsdom:
specifier: ^26.0.0
version: 26.0.0
happy-dom:
specifier: ^17.1.0
version: 17.1.0
lodash-es:
specifier: ^4.17.21
version: 4.17.21
@ -75,9 +75,6 @@ importers:
reflect-metadata:
specifier: ^0.2.2
version: 0.2.2
rfc4648:
specifier: ^1.5.0
version: 1.5.4
rxjs:
specifier: ^7.4.0
version: 7.8.1
@ -98,7 +95,7 @@ importers:
version: 5.1.4(typescript@5.7.3)(vite@6.0.7(@types/node@22.12.0)(jiti@2.4.2)(lightningcss@1.29.1)(tsx@4.19.2)(yaml@2.7.0))
vitest:
specifier: ^3.0.4
version: 3.0.4(@types/node@22.12.0)(@vitest/browser@3.0.4)(jiti@2.4.2)(jsdom@26.0.0)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.12.0)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0)
version: 3.0.4(@types/node@22.12.0)(@vitest/browser@3.0.4)(happy-dom@17.1.0)(jiti@2.4.2)(jsdom@26.0.0)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.12.0)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0)
examples/react-tanstack-router:
dependencies:
@ -171,6 +168,64 @@ packages:
'@asamuzakjp/css-color@2.8.3':
resolution: {integrity: sha512-GIc76d9UI1hCvOATjZPyHFmE5qhRccp3/zGfMPapK3jBi+yocEzp6BBB0UnfRYP9NP4FANqUZYb0hnfs3TM3hw==}
'@ast-grep/napi-darwin-arm64@0.35.0':
resolution: {integrity: sha512-T+MN4Oinc+sXjXCIHzfxDDWY7r2pKgPxM6zVeVlkMTrJV2mJtyKYBIS+CABhRM6kflps2T2I6l4DGaKV/8Ym9w==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [darwin]
'@ast-grep/napi-darwin-x64@0.35.0':
resolution: {integrity: sha512-pEYiN6JI1HY2uWhMYJ9+3yIMyVYKuYdFzeD+dL7odA3qzK0o9N9AM3/NOt4ynU2EhufaWCJr0P5NoQ636qN6MQ==}
engines: {node: '>= 10'}
cpu: [x64]
os: [darwin]
'@ast-grep/napi-linux-arm64-gnu@0.35.0':
resolution: {integrity: sha512-NBuzQngABGKz7lhG08IQb+7nPqUx81Ol37xmS3ZhVSdSgM0mtp93rCbgFTkJcAFE8IMfCHQSg7G4g0Iotz4ABQ==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
'@ast-grep/napi-linux-arm64-musl@0.35.0':
resolution: {integrity: sha512-1EcvHPwyWpCL/96LuItBYGfeI5FaMTRvL+dHbO/hL5q1npqbb5qn+ppJwtNOjTPz8tayvgggxVk9T4C2O7taYA==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
'@ast-grep/napi-linux-x64-gnu@0.35.0':
resolution: {integrity: sha512-FDzNdlqmQnsiWXhnLxusw5AOfEcEM+5xtmrnAf3SBRFr86JyWD9qsynnFYC2pnP9hlMfifNH2TTmMpyGJW49Xw==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
'@ast-grep/napi-linux-x64-musl@0.35.0':
resolution: {integrity: sha512-wlmndjfBafT8u5p4DBnoRQyoCSGNuVSz7rT3TqhvlHcPzUouRWMn95epU9B1LNLyjXvr9xHeRjSktyCN28w57Q==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
'@ast-grep/napi-win32-arm64-msvc@0.35.0':
resolution: {integrity: sha512-gkhJeYc4rrZLX2icLxalPikTLMR57DuIYLwLr9g+StHYXIsGHrbfrE6Nnbdd8Izfs34ArFCrcwdaMrGlvOPSeg==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [win32]
'@ast-grep/napi-win32-ia32-msvc@0.35.0':
resolution: {integrity: sha512-OdUuRa3chHCZ65y+qALfkUjz0W0Eg21YZ9TyPquV5why07M6HAK38mmYGzLxFH6294SvRQhs+FA/rAfbKeH0jA==}
engines: {node: '>= 10'}
cpu: [ia32]
os: [win32]
'@ast-grep/napi-win32-x64-msvc@0.35.0':
resolution: {integrity: sha512-pcQRUHqbroTN1oQ56V982a7IZTUUySQYWa2KEyksiifHGuBuitlzcyzFGjT96ThcqD9XW0UVJMvpoF2Qjh006Q==}
engines: {node: '>= 10'}
cpu: [x64]
os: [win32]
'@ast-grep/napi@0.35.0':
resolution: {integrity: sha512-3ucaaSxV6fxXoqHrE/rxAvP1THnDdY5jNzGlnvx+JvnY9C/dSRKc0jlRMRz59N3El572+/yNRUUpAV1T9aBJug==}
engines: {node: '>= 10'}
'@babel/code-frame@7.26.2':
resolution: {integrity: sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==}
engines: {node: '>=6.9.0'}
@ -945,6 +1000,11 @@ packages:
cpu: [x64]
os: [win32]
'@rsbuild/core@1.2.11':
resolution: {integrity: sha512-bsTtXlqJKoqnHwOZ05NePGpBf/neuwHTzJtQegQ9GA8YLyjow1wn8vPXFiRtYL0UqASEDtFtAm2bcaieg7r/TQ==}
engines: {node: '>=16.7.0'}
hasBin: true
'@rsbuild/core@1.2.4':
resolution: {integrity: sha512-GPn4TLW9nv7OgmbSBs9Col3dNr55CEDoeoGLl1B0pszyj9yI3s4ArVWVo/R5oXrRa9sDmA/T54rsb2r3trnttw==}
engines: {node: '>=16.7.0'}
@ -955,8 +1015,8 @@ packages:
peerDependencies:
'@rsbuild/core': 1.x
'@rslib/core@0.4.0':
resolution: {integrity: sha512-dONhz7PsooyGUdSQbJRzlsCXgOKrP5NyW1dzcNBvfLHr13nd2anCCZzFdQXb/g7772h5moj+EkTEo982AmUeJQ==}
'@rslib/core@0.5.0':
resolution: {integrity: sha512-zHgu9GmT/gvbuDoGLxMHxYbKRiARZsH4UXWFsezq7+KZ3PdEMBUNywmslExY/pk+xSpBUF6+peE6WCUOeW3mKQ==}
engines: {node: '>=16.0.0'}
hasBin: true
peerDependencies:
@ -973,49 +1033,97 @@ packages:
cpu: [arm64]
os: [darwin]
'@rspack/binding-darwin-arm64@1.2.3':
resolution: {integrity: sha512-xuwYzhPgNCr4BtKXCU3xe4249TFsXAZglIlbxv8Qs3PeIarrZMRddcqH2zUXi+nJavNw3yN12sCYEzk1f+O4FQ==}
cpu: [arm64]
os: [darwin]
'@rspack/binding-darwin-x64@1.2.2':
resolution: {integrity: sha512-vG5s7FkEvwrGLfksyDRHwKAHUkhZt1zHZZXJQn4gZKjTBonje8ezdc7IFlDiWpC4S+oBYp73nDWkUzkGRbSdcQ==}
cpu: [x64]
os: [darwin]
'@rspack/binding-darwin-x64@1.2.3':
resolution: {integrity: sha512-afiIN8elcrO2EtO27UN0qyZqu5FXGUdclud56DrhvEfnWS3GGxJEdjA8XUYVXkfCYakdXHucIJKlkkgaAjEvHg==}
cpu: [x64]
os: [darwin]
'@rspack/binding-linux-arm64-gnu@1.2.2':
resolution: {integrity: sha512-VykY/kiYOzO8E1nYzfJ9+gQEHxb5B6lt5wa8M6xFi5B6jEGU+OsaGskmAZB9/GFImeFDHxDPvhUalI4R9p8O2Q==}
cpu: [arm64]
os: [linux]
'@rspack/binding-linux-arm64-gnu@1.2.3':
resolution: {integrity: sha512-K2u/fPUmKujlKSWL3q2zaUu8/6ZK/bOGKcqJSib8jdanQQ/GFKwKtPAFOOa/vvqbzhDocqKOobFR10FhgJqCHg==}
cpu: [arm64]
os: [linux]
'@rspack/binding-linux-arm64-musl@1.2.2':
resolution: {integrity: sha512-Z5vAC4wGfXi8XXZ6hs8Q06TYjr3zHf819HB4DI5i4C1eQTeKdZSyoFD0NHFG23bP4NWJffp8KhmoObcy9jBT5Q==}
cpu: [arm64]
os: [linux]
'@rspack/binding-linux-arm64-musl@1.2.3':
resolution: {integrity: sha512-mgovdzGb6cH9hQsjTyzDbfZWCPhTcoHcLro1P7UbiqcLPMDJp/k3Io9xV2/EJhaDA1aynIdq7XfY0fuk4+6Irw==}
cpu: [arm64]
os: [linux]
'@rspack/binding-linux-x64-gnu@1.2.2':
resolution: {integrity: sha512-o3pDaL+cH5EeRbDE9gZcdZpBgp5iXvYZBBhe8vZQllYgI4zN5MJEuleV7WplG3UwTXlgZg3Kht4RORSOPn96vg==}
cpu: [x64]
os: [linux]
'@rspack/binding-linux-x64-gnu@1.2.3':
resolution: {integrity: sha512-542lwJzB1RMGuVdBdA3cOWTlmL9okpOppHUBWcNCjmJM+9zTI+0jwjVe8HaqOqtuR8XzNsoCwT9QonU/GLcuhg==}
cpu: [x64]
os: [linux]
'@rspack/binding-linux-x64-musl@1.2.2':
resolution: {integrity: sha512-RE3e0xe4DdchHssttKzryDwjLkbrNk/4H59TkkWeGYJcLw41tmcOZVFQUOwKLUvXWVyif/vjvV/w1SMlqB4wQg==}
cpu: [x64]
os: [linux]
'@rspack/binding-linux-x64-musl@1.2.3':
resolution: {integrity: sha512-dJromiREDcTWqzfCOI5y1IVoYmUnCv7vCp63AEq0+13fJJdk7+pcNN3VV2jOKpk9VECSvjg1c01wl+UzXAXFMw==}
cpu: [x64]
os: [linux]
'@rspack/binding-win32-arm64-msvc@1.2.2':
resolution: {integrity: sha512-R+PKBYn6uzTaDdVqTHvjqiJPBr5ZHg1wg5UmFDLNH9OklzVFyQh1JInSdJRb7lzfzTRz6bEkkwUFBPQK/CGScw==}
cpu: [arm64]
os: [win32]
'@rspack/binding-win32-arm64-msvc@1.2.3':
resolution: {integrity: sha512-S8ZKddMMQDGy8jx/R0i2m1XrmfY2CpI+t6lIEpsuZuKUR4MbOGKN2DuL4MDnT3m8JaYvC8ihsvQjBXQCy3SNxQ==}
cpu: [arm64]
os: [win32]
'@rspack/binding-win32-ia32-msvc@1.2.2':
resolution: {integrity: sha512-dBqz3sRAGZ2f31FgzKLDvIRfq2haRP3X3XVCT0PsiMcvt7QJng+26aYYMy2THatd/nM8IwExYeitHWeiMBoruw==}
cpu: [ia32]
os: [win32]
'@rspack/binding-win32-ia32-msvc@1.2.3':
resolution: {integrity: sha512-74lqSMKQJcJcgfFaxm+G9YVJSl2KK9/v4fRoMsWApztNy2qNgee+UguNBCOU6JLa3rVSj8Z5OVVDtJkGFrSvVg==}
cpu: [ia32]
os: [win32]
'@rspack/binding-win32-x64-msvc@1.2.2':
resolution: {integrity: sha512-eeAvaN831KG553cMSHkVldyk6YQn4ujgRHov6r1wtREq7CD3/ka9LMkJUepCN85K7XtwYT0N4KpFIQyf5GTGoA==}
cpu: [x64]
os: [win32]
'@rspack/binding-win32-x64-msvc@1.2.3':
resolution: {integrity: sha512-fcU532PgFdd5Bil8jwQW0Dcb/80oM6V0qSstGIxZ4M77t4t8e/PcukXfORTL71FfNQ64Rd4Dp6XRl1NHNJVxeg==}
cpu: [x64]
os: [win32]
'@rspack/binding@1.2.2':
resolution: {integrity: sha512-GCZwpGFYlLTdJ2soPLwjw9z4LSZ+GdpbHNfBt3Cm/f/bAF8n6mZc7dHUqN893RFh7MPU17HNEL3fMw7XR+6pHg==}
'@rspack/binding@1.2.3':
resolution: {integrity: sha512-enpOXZPQOJO800wdWcR7H5Dx5UZfwkaT0D0xsHD53WbpI09Z2KJbLX7I/i1FLLy3K1KQTB+2FIHLVdRikasXZA==}
'@rspack/core@1.2.2':
resolution: {integrity: sha512-EeHAmY65Uj62hSbUKesbrcWGE7jfUI887RD03G++Gj8jS4WPHEu1TFODXNOXg6pa7zyIvs2BK0Bm16Kwz8AEaQ==}
engines: {node: '>=16.0.0'}
@ -1028,6 +1136,18 @@ packages:
'@swc/helpers':
optional: true
'@rspack/core@1.2.3':
resolution: {integrity: sha512-BFgdUYf05/hjjY9Nlwq8DpWaRJN5w2kTl8ZJi20SRL60oAx+ZD2ABT+fsPhBiFSmfTZDdvGGIq5e3vfRzoIuqg==}
engines: {node: '>=16.0.0'}
peerDependencies:
'@rspack/tracing': ^1.x
'@swc/helpers': '>=0.5.1'
peerDependenciesMeta:
'@rspack/tracing':
optional: true
'@swc/helpers':
optional: true
'@rspack/lite-tapable@1.0.1':
resolution: {integrity: sha512-VynGOEsVw2s8TAlLf/uESfrgfrq2+rcXB1muPJYBWbsm1Oa6r5qVQhjA5ggM6z/coYPrsVMgovl3Ff7Q7OCp1w==}
engines: {node: '>=16.0.0'}
@ -1244,9 +1364,6 @@ packages:
'@types/estree@1.0.6':
resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==}
'@types/jsdom@21.1.7':
resolution: {integrity: sha512-yOriVnggzrnQ3a9OKOCxaVuSug3w3/SbOj5i7VwXWZEyUNl3bLF9V3MfxGbZKuwqJOQyRfqXyROBB1CoZLFWzA==}
'@types/lodash-es@4.17.12':
resolution: {integrity: sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==}
@ -1881,8 +1998,8 @@ packages:
fd-slicer@1.1.0:
resolution: {integrity: sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==}
fdir@6.4.2:
resolution: {integrity: sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==}
fdir@6.4.3:
resolution: {integrity: sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw==}
peerDependencies:
picomatch: ^3 || ^4
peerDependenciesMeta:
@ -1991,6 +2108,10 @@ packages:
resolution: {integrity: sha512-AjqGKbDGUFRKIRCP9tCKiIGHyriz2oHEbPIbEtcSLSs4YjReZOIPQQWek4+6hjw62H9QShXHyaGivGiYVLeYFQ==}
engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0}
happy-dom@17.1.0:
resolution: {integrity: sha512-9tUhXyePCjzUMycaHS/IzrIpF69xiq/laAT7golk4MtZ6t8ft5+Rv7U3lfrs2b4NMH0JTL3EhZzjfahrPmOnaQ==}
engines: {node: '>=18.0.0'}
has-flag@4.0.0:
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
engines: {node: '>=8'}
@ -2331,6 +2452,9 @@ packages:
resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==}
engines: {node: '>=16 || 14 >=14.17'}
minimist@1.2.8:
resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
minipass@7.1.2:
resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==}
engines: {node: '>=16 || 14 >=14.17'}
@ -2687,8 +2811,8 @@ packages:
rrweb-cssom@0.8.0:
resolution: {integrity: sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw==}
rsbuild-plugin-dts@0.4.0:
resolution: {integrity: sha512-Yjr+6iSY/TgV2jd+bY8J0wFe3RSBZaj766ygIMmILBacWUmaxnyIXnXjiIR3KDO7fxSwUYZzqqvpSgrRoVCk6g==}
rsbuild-plugin-dts@0.5.0:
resolution: {integrity: sha512-m9p53zzcKJ+dWJ/sQfI7jaF9UpmQigdMXQm96tvSpnzSp7WQvjTHAyV5iB6H/3lWTcRJXmLb6mxSzIiCVRnNNA==}
engines: {node: '>=16.0.0'}
peerDependencies:
'@microsoft/api-extractor': ^7
@ -2844,6 +2968,10 @@ packages:
resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==}
engines: {node: '>=12'}
strip-bom@3.0.0:
resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==}
engines: {node: '>=4'}
strip-json-comments@3.1.1:
resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==}
engines: {node: '>=8'}
@ -2911,8 +3039,8 @@ packages:
tinyexec@0.3.2:
resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==}
tinyglobby@0.2.10:
resolution: {integrity: sha512-Zc+8eJlFMvgatPZTl6A9L/yht8QqdmUNtURHaKZLmKBE12hNPSrqNkUp2cs3M/UKmNVVAMFQYSjYIVHDjW5zew==}
tinyglobby@0.2.12:
resolution: {integrity: sha512-qkf4trmKSIiMTs/E63cxH+ojC2unam7rJ0WrauAzpT3ECNTxGRMlaXxVbfxMUC/w0LaYk6jQ4y/nGR9uBO3tww==}
engines: {node: '>=12.0.0'}
tinypool@1.0.2:
@ -2967,6 +3095,10 @@ packages:
typescript:
optional: true
tsconfig-paths@4.2.0:
resolution: {integrity: sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==}
engines: {node: '>=6'}
tslib@2.8.1:
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
@ -3190,6 +3322,10 @@ packages:
resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==}
engines: {node: '>=18'}
whatwg-mimetype@3.0.0:
resolution: {integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==}
engines: {node: '>=12'}
whatwg-mimetype@4.0.0:
resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==}
engines: {node: '>=18'}
@ -3302,6 +3438,46 @@ snapshots:
'@csstools/css-parser-algorithms': 3.0.4(@csstools/css-tokenizer@3.0.3)
'@csstools/css-tokenizer': 3.0.3
lru-cache: 10.4.3
optional: true
'@ast-grep/napi-darwin-arm64@0.35.0':
optional: true
'@ast-grep/napi-darwin-x64@0.35.0':
optional: true
'@ast-grep/napi-linux-arm64-gnu@0.35.0':
optional: true
'@ast-grep/napi-linux-arm64-musl@0.35.0':
optional: true
'@ast-grep/napi-linux-x64-gnu@0.35.0':
optional: true
'@ast-grep/napi-linux-x64-musl@0.35.0':
optional: true
'@ast-grep/napi-win32-arm64-msvc@0.35.0':
optional: true
'@ast-grep/napi-win32-ia32-msvc@0.35.0':
optional: true
'@ast-grep/napi-win32-x64-msvc@0.35.0':
optional: true
'@ast-grep/napi@0.35.0':
optionalDependencies:
'@ast-grep/napi-darwin-arm64': 0.35.0
'@ast-grep/napi-darwin-x64': 0.35.0
'@ast-grep/napi-linux-arm64-gnu': 0.35.0
'@ast-grep/napi-linux-arm64-musl': 0.35.0
'@ast-grep/napi-linux-x64-gnu': 0.35.0
'@ast-grep/napi-linux-x64-musl': 0.35.0
'@ast-grep/napi-win32-arm64-msvc': 0.35.0
'@ast-grep/napi-win32-ia32-msvc': 0.35.0
'@ast-grep/napi-win32-x64-msvc': 0.35.0
'@babel/code-frame@7.26.2':
dependencies:
@ -3486,12 +3662,14 @@ snapshots:
tough-cookie: 4.1.4
optional: true
'@csstools/color-helpers@5.0.1': {}
'@csstools/color-helpers@5.0.1':
optional: true
'@csstools/css-calc@2.1.1(@csstools/css-parser-algorithms@3.0.4(@csstools/css-tokenizer@3.0.3))(@csstools/css-tokenizer@3.0.3)':
dependencies:
'@csstools/css-parser-algorithms': 3.0.4(@csstools/css-tokenizer@3.0.3)
'@csstools/css-tokenizer': 3.0.3
optional: true
'@csstools/css-color-parser@3.0.7(@csstools/css-parser-algorithms@3.0.4(@csstools/css-tokenizer@3.0.3))(@csstools/css-tokenizer@3.0.3)':
dependencies:
@ -3499,12 +3677,15 @@ snapshots:
'@csstools/css-calc': 2.1.1(@csstools/css-parser-algorithms@3.0.4(@csstools/css-tokenizer@3.0.3))(@csstools/css-tokenizer@3.0.3)
'@csstools/css-parser-algorithms': 3.0.4(@csstools/css-tokenizer@3.0.3)
'@csstools/css-tokenizer': 3.0.3
optional: true
'@csstools/css-parser-algorithms@3.0.4(@csstools/css-tokenizer@3.0.3)':
dependencies:
'@csstools/css-tokenizer': 3.0.3
optional: true
'@csstools/css-tokenizer@3.0.3': {}
'@csstools/css-tokenizer@3.0.3':
optional: true
'@esbuild/aix-ppc64@0.23.1':
optional: true
@ -3939,6 +4120,15 @@ snapshots:
'@rollup/rollup-win32-x64-msvc@4.30.1':
optional: true
'@rsbuild/core@1.2.11':
dependencies:
'@rspack/core': 1.2.3(@swc/helpers@0.5.15)
'@rspack/lite-tapable': 1.0.1
'@swc/helpers': 0.5.15
core-js: 3.40.0
transitivePeerDependencies:
- '@rspack/tracing'
'@rsbuild/core@1.2.4':
dependencies:
'@rspack/core': 1.2.2(@swc/helpers@0.5.15)
@ -3954,11 +4144,11 @@ snapshots:
'@rspack/plugin-react-refresh': 1.0.1(react-refresh@0.16.0)
react-refresh: 0.16.0
'@rslib/core@0.4.0(@microsoft/api-extractor@7.49.2(@types/node@22.12.0))(typescript@5.7.3)':
'@rslib/core@0.5.0(@microsoft/api-extractor@7.49.2(@types/node@22.12.0))(typescript@5.7.3)':
dependencies:
'@rsbuild/core': 1.2.4
rsbuild-plugin-dts: 0.4.0(@microsoft/api-extractor@7.49.2(@types/node@22.12.0))(@rsbuild/core@1.2.4)(typescript@5.7.3)
tinyglobby: 0.2.10
'@rsbuild/core': 1.2.11
rsbuild-plugin-dts: 0.5.0(@microsoft/api-extractor@7.49.2(@types/node@22.12.0))(@rsbuild/core@1.2.11)(typescript@5.7.3)
tinyglobby: 0.2.12
optionalDependencies:
'@microsoft/api-extractor': 7.49.2(@types/node@22.12.0)
typescript: 5.7.3
@ -3968,30 +4158,57 @@ snapshots:
'@rspack/binding-darwin-arm64@1.2.2':
optional: true
'@rspack/binding-darwin-arm64@1.2.3':
optional: true
'@rspack/binding-darwin-x64@1.2.2':
optional: true
'@rspack/binding-darwin-x64@1.2.3':
optional: true
'@rspack/binding-linux-arm64-gnu@1.2.2':
optional: true
'@rspack/binding-linux-arm64-gnu@1.2.3':
optional: true
'@rspack/binding-linux-arm64-musl@1.2.2':
optional: true
'@rspack/binding-linux-arm64-musl@1.2.3':
optional: true
'@rspack/binding-linux-x64-gnu@1.2.2':
optional: true
'@rspack/binding-linux-x64-gnu@1.2.3':
optional: true
'@rspack/binding-linux-x64-musl@1.2.2':
optional: true
'@rspack/binding-linux-x64-musl@1.2.3':
optional: true
'@rspack/binding-win32-arm64-msvc@1.2.2':
optional: true
'@rspack/binding-win32-arm64-msvc@1.2.3':
optional: true
'@rspack/binding-win32-ia32-msvc@1.2.2':
optional: true
'@rspack/binding-win32-ia32-msvc@1.2.3':
optional: true
'@rspack/binding-win32-x64-msvc@1.2.2':
optional: true
'@rspack/binding-win32-x64-msvc@1.2.3':
optional: true
'@rspack/binding@1.2.2':
optionalDependencies:
'@rspack/binding-darwin-arm64': 1.2.2
@ -4004,6 +4221,18 @@ snapshots:
'@rspack/binding-win32-ia32-msvc': 1.2.2
'@rspack/binding-win32-x64-msvc': 1.2.2
'@rspack/binding@1.2.3':
optionalDependencies:
'@rspack/binding-darwin-arm64': 1.2.3
'@rspack/binding-darwin-x64': 1.2.3
'@rspack/binding-linux-arm64-gnu': 1.2.3
'@rspack/binding-linux-arm64-musl': 1.2.3
'@rspack/binding-linux-x64-gnu': 1.2.3
'@rspack/binding-linux-x64-musl': 1.2.3
'@rspack/binding-win32-arm64-msvc': 1.2.3
'@rspack/binding-win32-ia32-msvc': 1.2.3
'@rspack/binding-win32-x64-msvc': 1.2.3
'@rspack/core@1.2.2(@swc/helpers@0.5.15)':
dependencies:
'@module-federation/runtime-tools': 0.8.4
@ -4013,6 +4242,15 @@ snapshots:
optionalDependencies:
'@swc/helpers': 0.5.15
'@rspack/core@1.2.3(@swc/helpers@0.5.15)':
dependencies:
'@module-federation/runtime-tools': 0.8.4
'@rspack/binding': 1.2.3
'@rspack/lite-tapable': 1.0.1
caniuse-lite: 1.0.30001692
optionalDependencies:
'@swc/helpers': 0.5.15
'@rspack/lite-tapable@1.0.1': {}
'@rspack/plugin-react-refresh@1.0.1(react-refresh@0.16.0)':
@ -4249,12 +4487,6 @@ snapshots:
'@types/estree@1.0.6': {}
'@types/jsdom@21.1.7':
dependencies:
'@types/node': 22.12.0
'@types/tough-cookie': 4.0.5
parse5: 7.2.1
'@types/lodash-es@4.17.12':
dependencies:
'@types/lodash': 4.17.15
@ -4284,7 +4516,8 @@ snapshots:
'@types/statuses@2.0.5':
optional: true
'@types/tough-cookie@4.0.5': {}
'@types/tough-cookie@4.0.5':
optional: true
'@types/which@2.0.2':
optional: true
@ -4309,7 +4542,7 @@ snapshots:
msw: 2.7.0(@types/node@22.12.0)(typescript@5.7.3)
sirv: 3.0.0
tinyrainbow: 2.0.0
vitest: 3.0.4(@types/node@22.12.0)(@vitest/browser@3.0.4)(jiti@2.4.2)(jsdom@26.0.0)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.12.0)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0)
vitest: 3.0.4(@types/node@22.12.0)(@vitest/browser@3.0.4)(happy-dom@17.1.0)(jiti@2.4.2)(jsdom@26.0.0)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.12.0)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0)
ws: 8.18.0
optionalDependencies:
playwright: 1.50.0
@ -4336,7 +4569,7 @@ snapshots:
std-env: 3.8.0
test-exclude: 7.0.1
tinyrainbow: 2.0.0
vitest: 3.0.4(@types/node@22.12.0)(@vitest/browser@3.0.4)(jiti@2.4.2)(jsdom@26.0.0)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.12.0)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0)
vitest: 3.0.4(@types/node@22.12.0)(@vitest/browser@3.0.4)(happy-dom@17.1.0)(jiti@2.4.2)(jsdom@26.0.0)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.12.0)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0)
optionalDependencies:
'@vitest/browser': 3.0.4(@types/node@22.12.0)(playwright@1.50.0)(typescript@5.7.3)(vite@6.0.7(@types/node@22.12.0)(jiti@2.4.2)(lightningcss@1.29.1)(tsx@4.19.2)(yaml@2.7.0))(vitest@3.0.4)(webdriverio@9.7.2)
transitivePeerDependencies:
@ -4447,7 +4680,8 @@ snapshots:
acorn@8.14.0: {}
agent-base@7.1.3: {}
agent-base@7.1.3:
optional: true
ajv-draft-04@1.0.0(ajv@8.13.0):
optionalDependencies:
@ -4546,7 +4780,8 @@ snapshots:
async@3.2.6:
optional: true
asynckit@0.4.0: {}
asynckit@0.4.0:
optional: true
autoprefixer@10.4.20(postcss@8.5.1):
dependencies:
@ -4732,6 +4967,7 @@ snapshots:
combined-stream@1.0.8:
dependencies:
delayed-stream: 1.0.0
optional: true
commander@12.1.0: {}
@ -4805,6 +5041,7 @@ snapshots:
dependencies:
'@asamuzakjp/css-color': 2.8.3
rrweb-cssom: 0.8.0
optional: true
csstype@3.1.3: {}
@ -4818,6 +5055,7 @@ snapshots:
dependencies:
whatwg-mimetype: 4.0.0
whatwg-url: 14.1.0
optional: true
debug@4.4.0:
dependencies:
@ -4826,7 +5064,8 @@ snapshots:
decamelize@6.0.0:
optional: true
decimal.js@10.5.0: {}
decimal.js@10.5.0:
optional: true
deep-eql@5.0.2: {}
@ -4840,7 +5079,8 @@ snapshots:
esprima: 4.0.1
optional: true
delayed-stream@1.0.0: {}
delayed-stream@1.0.0:
optional: true
dequal@2.0.3:
optional: true
@ -4919,7 +5159,8 @@ snapshots:
once: 1.4.0
optional: true
entities@4.5.0: {}
entities@4.5.0:
optional: true
error-stack-parser@2.1.4:
dependencies:
@ -5058,7 +5299,7 @@ snapshots:
pend: 1.2.0
optional: true
fdir@6.4.2(picomatch@4.0.2):
fdir@6.4.3(picomatch@4.0.2):
optionalDependencies:
picomatch: 4.0.2
@ -5082,6 +5323,7 @@ snapshots:
asynckit: 0.4.0
combined-stream: 1.0.8
mime-types: 2.1.35
optional: true
formdata-polyfill@4.0.10:
dependencies:
@ -5180,6 +5422,11 @@ snapshots:
graphql@16.10.0:
optional: true
happy-dom@17.1.0:
dependencies:
webidl-conversions: 7.0.0
whatwg-mimetype: 3.0.0
has-flag@4.0.0: {}
hasown@2.0.2:
@ -5192,6 +5439,7 @@ snapshots:
html-encoding-sniffer@4.0.0:
dependencies:
whatwg-encoding: 3.1.1
optional: true
html-entities@2.5.2: {}
@ -5214,6 +5462,7 @@ snapshots:
debug: 4.4.0
transitivePeerDependencies:
- supports-color
optional: true
https-proxy-agent@7.0.6:
dependencies:
@ -5221,10 +5470,12 @@ snapshots:
debug: 4.4.0
transitivePeerDependencies:
- supports-color
optional: true
iconv-lite@0.6.3:
dependencies:
safer-buffer: 2.1.2
optional: true
ieee754@1.2.1:
optional: true
@ -5271,7 +5522,8 @@ snapshots:
is-plain-obj@4.1.0:
optional: true
is-potential-custom-element-name@1.0.1: {}
is-potential-custom-element-name@1.0.1:
optional: true
is-stream@2.0.1:
optional: true
@ -5353,6 +5605,7 @@ snapshots:
- bufferutil
- supports-color
- utf-8-validate
optional: true
jsesc@3.1.0: {}
@ -5512,11 +5765,13 @@ snapshots:
braces: 3.0.3
picomatch: 2.3.1
mime-db@1.52.0: {}
mime-db@1.52.0:
optional: true
mime-types@2.1.35:
dependencies:
mime-db: 1.52.0
optional: true
minimatch@3.0.8:
dependencies:
@ -5532,6 +5787,8 @@ snapshots:
dependencies:
brace-expansion: 2.0.1
minimist@1.2.8: {}
minipass@7.1.2: {}
mlly@1.7.4:
@ -5607,7 +5864,8 @@ snapshots:
boolbase: 1.0.0
optional: true
nwsapi@2.2.16: {}
nwsapi@2.2.16:
optional: true
object-assign@4.1.1: {}
@ -5685,6 +5943,7 @@ snapshots:
parse5@7.2.1:
dependencies:
entities: 4.5.0
optional: true
path-key@3.1.1: {}
@ -5822,7 +6081,8 @@ snapshots:
once: 1.4.0
optional: true
punycode@2.3.1: {}
punycode@2.3.1:
optional: true
query-selector-shadow-dom@1.0.1:
optional: true
@ -5938,14 +6198,17 @@ snapshots:
'@rollup/rollup-win32-x64-msvc': 4.30.1
fsevents: 2.3.3
rrweb-cssom@0.8.0: {}
rrweb-cssom@0.8.0:
optional: true
rsbuild-plugin-dts@0.4.0(@microsoft/api-extractor@7.49.2(@types/node@22.12.0))(@rsbuild/core@1.2.4)(typescript@5.7.3):
rsbuild-plugin-dts@0.5.0(@microsoft/api-extractor@7.49.2(@types/node@22.12.0))(@rsbuild/core@1.2.11)(typescript@5.7.3):
dependencies:
'@rsbuild/core': 1.2.4
'@ast-grep/napi': 0.35.0
'@rsbuild/core': 1.2.11
magic-string: 0.30.17
picocolors: 1.1.1
tinyglobby: 0.2.10
tinyglobby: 0.2.12
tsconfig-paths: 4.2.0
optionalDependencies:
'@microsoft/api-extractor': 7.49.2(@types/node@22.12.0)
typescript: 5.7.3
@ -5967,11 +6230,13 @@ snapshots:
safe-buffer@5.2.1:
optional: true
safer-buffer@2.1.2: {}
safer-buffer@2.1.2:
optional: true
saxes@6.0.0:
dependencies:
xmlchars: 2.2.0
optional: true
scheduler@0.25.0: {}
@ -6097,6 +6362,8 @@ snapshots:
dependencies:
ansi-regex: 6.1.0
strip-bom@3.0.0: {}
strip-json-comments@3.1.1:
optional: true
@ -6124,7 +6391,8 @@ snapshots:
supports-preserve-symlinks-flag@1.0.0: {}
symbol-tree@3.2.4: {}
symbol-tree@3.2.4:
optional: true
tailwindcss@3.4.17:
dependencies:
@ -6201,9 +6469,9 @@ snapshots:
tinyexec@0.3.2: {}
tinyglobby@0.2.10:
tinyglobby@0.2.12:
dependencies:
fdir: 6.4.2(picomatch@4.0.2)
fdir: 6.4.3(picomatch@4.0.2)
picomatch: 4.0.2
tinypool@1.0.2: {}
@ -6212,11 +6480,13 @@ snapshots:
tinyspy@3.0.2: {}
tldts-core@6.1.75: {}
tldts-core@6.1.75:
optional: true
tldts@6.1.75:
dependencies:
tldts-core: 6.1.75
optional: true
to-regex-range@5.0.1:
dependencies:
@ -6236,10 +6506,12 @@ snapshots:
tough-cookie@5.1.0:
dependencies:
tldts: 6.1.75
optional: true
tr46@5.0.0:
dependencies:
punycode: 2.3.1
optional: true
ts-interface-checker@0.1.13: {}
@ -6247,6 +6519,12 @@ snapshots:
optionalDependencies:
typescript: 5.7.3
tsconfig-paths@4.2.0:
dependencies:
json5: 2.2.3
minimist: 1.2.8
strip-bom: 3.0.0
tslib@2.8.1: {}
tsx@4.19.2:
@ -6394,7 +6672,7 @@ snapshots:
tsx: 4.19.2
yaml: 2.7.0
vitest@3.0.4(@types/node@22.12.0)(@vitest/browser@3.0.4)(jiti@2.4.2)(jsdom@26.0.0)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.12.0)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0):
vitest@3.0.4(@types/node@22.12.0)(@vitest/browser@3.0.4)(happy-dom@17.1.0)(jiti@2.4.2)(jsdom@26.0.0)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.12.0)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0):
dependencies:
'@vitest/expect': 3.0.4
'@vitest/mocker': 3.0.4(msw@2.7.0(@types/node@22.12.0)(typescript@5.7.3))(vite@6.0.7(@types/node@22.12.0)(jiti@2.4.2)(lightningcss@1.29.1)(tsx@4.19.2)(yaml@2.7.0))
@ -6419,6 +6697,7 @@ snapshots:
optionalDependencies:
'@types/node': 22.12.0
'@vitest/browser': 3.0.4(@types/node@22.12.0)(playwright@1.50.0)(typescript@5.7.3)(vite@6.0.7(@types/node@22.12.0)(jiti@2.4.2)(lightningcss@1.29.1)(tsx@4.19.2)(yaml@2.7.0))(vitest@3.0.4)(webdriverio@9.7.2)
happy-dom: 17.1.0
jsdom: 26.0.0
transitivePeerDependencies:
- jiti
@ -6437,6 +6716,7 @@ snapshots:
w3c-xmlserializer@5.0.0:
dependencies:
xml-name-validator: 5.0.0
optional: true
wait-port@1.1.0:
dependencies:
@ -6512,13 +6792,18 @@ snapshots:
whatwg-encoding@3.1.1:
dependencies:
iconv-lite: 0.6.3
optional: true
whatwg-mimetype@4.0.0: {}
whatwg-mimetype@3.0.0: {}
whatwg-mimetype@4.0.0:
optional: true
whatwg-url@14.1.0:
dependencies:
tr46: 5.0.0
webidl-conversions: 7.0.0
optional: true
which@2.0.2:
dependencies:
@ -6556,11 +6841,14 @@ snapshots:
wrappy@1.0.2:
optional: true
ws@8.18.0: {}
ws@8.18.0:
optional: true
xml-name-validator@5.0.0: {}
xml-name-validator@5.0.0:
optional: true
xmlchars@2.2.0: {}
xmlchars@2.2.0:
optional: true
y18n@5.0.8:
optional: true

View File

@ -11,7 +11,7 @@ export default defineConfig({
bundle: false,
dts: {
bundle: false,
build: true,
build: false,
distPath: './dist',
},
},

View File

@ -1,9 +1,9 @@
import { InjectionToken, inject } from '@outposts/injection-js';
import type { Router } from '@tanstack/react-router';
import type { AnyRouter } from '@tanstack/react-router';
import type { AuthFeature } from '../../features';
import { AbstractRouter } from '../../router';
import { AbstractRouter, ROUTER_ABS_PATH_PATTERN } from '../../router';
export type TanStackRouter = Router<any, any, any, any, any, any>;
export type TanStackRouter = AnyRouter;
export const TANSTACK_ROUTER = new InjectionToken<TanStackRouter>(
'TANSTACK_ROUTER'
@ -14,7 +14,7 @@ export class TanStackRouterAdapter implements AbstractRouter<string> {
navigateByUrl(url: string): void {
this.router.navigate({
href: url,
href: ROUTER_ABS_PATH_PATTERN.test(url) ? url : `/${url}`,
});
}

View File

@ -1,6 +1,6 @@
import { Injectable, inject } from '@outposts/injection-js';
import type { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { type Observable, of } from 'rxjs';
import { switchMap } from 'rxjs/operators';
import type { AuthOptions } from '../auth-options';
import { AuthStateService } from '../auth-state/auth-state.service';
import { ConfigurationService } from '../config/config.service';
@ -126,7 +126,7 @@ function checkAuth(
configId?: string
): Observable<boolean> {
return configurationService.getOpenIDConfiguration(configId).pipe(
map((configuration) => {
switchMap((configuration) => {
const isAuthenticated =
authStateService.areAuthStorageTokensValid(configuration);
@ -137,13 +137,16 @@ function checkAuth(
if (!isAuthenticated) {
autoLoginService.saveRedirectRoute(configuration, url);
if (authOptions) {
loginService.login(configuration, authOptions);
} else {
loginService.login(configuration);
return loginService
.login(configuration, authOptions)
.pipe(switchMap(() => of(isAuthenticated)));
}
return loginService
.login(configuration)
.pipe(switchMap(() => of(isAuthenticated)));
}
return isAuthenticated;
return of(isAuthenticated);
})
);
}

View File

@ -40,6 +40,12 @@ export interface OpenIdConfiguration {
* or if it contains additional audiences not trusted by the Client.
*/
clientId?: string;
/**
* @dangerous
* @see [client secret is missing](https://github.com/damienbod/angular-auth-oidc-client/issues/399)
* The client secret. For some oidc service the must provide this.
*/
clientSecret?: string;
/**
* `code`, `id_token token` or `id_token`.
* Name of the flow which can be configured.

View File

@ -61,12 +61,11 @@ describe('RefreshSessionIframeService ', () => {
);
(refreshSessionIframeService as any).initSilentRenewRequest();
expect(dispatchEventSpy).toHaveBeenCalledExactlyOnceWith(
new CustomEvent('oidc-silent-renew-init', {
detail: expect.any(Number),
})
);
expect(dispatchEventSpy).toHaveBeenCalledOnce();
expect(dispatchEventSpy.mock.calls[0][0]).toBeInstanceOf(CustomEvent);
expect(
(dispatchEventSpy.mock.calls[0][0] as CustomEvent).detail
).toBeTypeOf('number');
});
});
});

View File

@ -1,5 +1,6 @@
import { Injectable, inject } from '@outposts/injection-js';
import { type Observable, of, throwError } from 'rxjs';
import { BehaviorSubject, type Observable, of, throwError } from 'rxjs';
import { MockUtil } from 'src/utils/reflect';
import type { AuthOptions } from '../auth-options';
import type { OpenIdConfiguration } from '../config/openid-configuration';
import { StoragePersistenceService } from '../storage/storage-persistence.service';
@ -24,6 +25,7 @@ export class LoginService {
private readonly popupService = inject(PopUpService);
@MockUtil({ implementation: () => new BehaviorSubject(undefined) })
login(
configuration: OpenIdConfiguration | null,
authOptions?: AuthOptions

View File

@ -30,8 +30,10 @@ export abstract class AbstractRouter<
abstract getCurrentNavigation(): NAVIGATION;
}
export class VanillaLocationRouter extends AbstractRouter {
private document = inject(DOCUMENT);
export const ROUTER_ABS_PATH_PATTERN = /^\//;
export class VanillaLocationRouter extends AbstractRouter<string> {
protected document = inject(DOCUMENT);
private get location(): Location {
const location = this.document.defaultView?.window?.location;
@ -42,7 +44,7 @@ export class VanillaLocationRouter extends AbstractRouter {
}
navigateByUrl(url: string): void {
this.location.href = url;
this.location.href = ROUTER_ABS_PATH_PATTERN.test(url) ? url : `/${url}`;
}
getCurrentNavigation() {
@ -72,7 +74,11 @@ export class VanillaHistoryRouter extends AbstractRouter<string> {
}
navigateByUrl(url: string): void {
this.history.pushState({}, '', url);
this.history.pushState(
{},
'',
ROUTER_ABS_PATH_PATTERN.test(url) ? url : `/${url}`
);
}
getCurrentNavigation() {

View File

@ -2,6 +2,10 @@ import { TestBed } from '@/testing';
import { vi } from 'vitest';
import { DefaultLocalStorageService } from './default-localstorage.service';
/**
* if use jsdom, then use Storage.prototype, https://github.com/jsdom/jsdom/issues/2318
*/
describe('DefaultLocalStorageService', () => {
let service: DefaultLocalStorageService;
@ -18,8 +22,7 @@ describe('DefaultLocalStorageService', () => {
describe('read', () => {
it('should call localstorage.getItem', () => {
// https://github.com/jsdom/jsdom/issues/2318
const spy = vi.spyOn(Storage.prototype, 'getItem');
const spy = vi.spyOn(localStorage, 'getItem');
service.read('henlo');
@ -29,8 +32,7 @@ describe('DefaultLocalStorageService', () => {
describe('write', () => {
it('should call localstorage.setItem', () => {
// https://github.com/jsdom/jsdom/issues/2318
const spy = vi.spyOn(Storage.prototype, 'setItem');
const spy = vi.spyOn(localStorage, 'setItem');
service.write('henlo', 'furiend');
@ -40,8 +42,7 @@ describe('DefaultLocalStorageService', () => {
describe('remove', () => {
it('should call localstorage.removeItem', () => {
// https://github.com/jsdom/jsdom/issues/2318
const spy = vi.spyOn(Storage.prototype, 'removeItem');
const spy = vi.spyOn(localStorage, 'removeItem');
service.remove('henlo');
@ -51,8 +52,7 @@ describe('DefaultLocalStorageService', () => {
describe('clear', () => {
it('should call localstorage.clear', () => {
// https://github.com/jsdom/jsdom/issues/2318
const spy = vi.spyOn(Storage.prototype, 'clear');
const spy = vi.spyOn(localStorage, 'clear');
service.clear();

View File

@ -2,6 +2,9 @@ import { TestBed } from '@/testing';
import { vi } from 'vitest';
import { DefaultSessionStorageService } from './default-sessionstorage.service';
/**
* if use jsdom, then use Storage.prototype, https://github.com/jsdom/jsdom/issues/2318
*/
describe('DefaultSessionStorageService', () => {
let service: DefaultSessionStorageService;
@ -18,8 +21,7 @@ describe('DefaultSessionStorageService', () => {
describe('read', () => {
it('should call sessionstorage.getItem', () => {
// https://github.com/jsdom/jsdom/issues/2318
const spy = vi.spyOn(Storage.prototype, 'getItem');
const spy = vi.spyOn(sessionStorage, 'getItem');
service.read('henlo');
@ -29,8 +31,7 @@ describe('DefaultSessionStorageService', () => {
describe('write', () => {
it('should call sessionstorage.setItem', () => {
// https://github.com/jsdom/jsdom/issues/2318
const spy = vi.spyOn(Storage.prototype, 'setItem');
const spy = vi.spyOn(sessionStorage, 'setItem');
service.write('henlo', 'furiend');
@ -40,8 +41,7 @@ describe('DefaultSessionStorageService', () => {
describe('remove', () => {
it('should call sessionstorage.removeItem', () => {
// https://github.com/jsdom/jsdom/issues/2318
const spy = vi.spyOn(Storage.prototype, 'removeItem');
const spy = vi.spyOn(sessionStorage, 'removeItem');
service.remove('henlo');
@ -51,8 +51,7 @@ describe('DefaultSessionStorageService', () => {
describe('clear', () => {
it('should call sessionstorage.clear', () => {
// https://github.com/jsdom/jsdom/issues/2318
const spy = vi.spyOn(Storage.prototype, 'clear');
const spy = vi.spyOn(sessionStorage, 'clear');
service.clear();

View File

@ -1,29 +1,13 @@
import type { Provider } from '@outposts/injection-js';
import { JSDOM } from 'jsdom';
import { AbstractRouter, type Navigation, type UrlTree } from 'oidc-client-rx';
import {
AbstractRouter,
type UrlTree,
VanillaLocationRouter,
} from 'oidc-client-rx';
export class MockRouter extends AbstractRouter {
dom = new JSDOM('', {
url: 'http://localhost',
});
navigation: Navigation = {
extractedUrl: this.parseUrl(this.dom.window.location.href),
};
navigateByUrl(url: string): void {
this.dom.reconfigure({
url: new URL(url, this.dom.window.location.href).href,
});
this.navigation = {
extractedUrl: this.parseUrl(this.dom.window.location.href),
};
}
getCurrentNavigation(): Navigation {
return this.navigation;
}
export class MockRouter extends VanillaLocationRouter {
parseUrl(url: string): UrlTree {
const u = new URL(url, this.dom.window.location.href);
const u = new URL(url, this.document.baseURI);
return `${u.pathname}${u.search}${u.hash}`;
}
}

View File

@ -249,6 +249,7 @@ export class UrlService {
configuration: OpenIdConfiguration
): string | null {
const clientId = this.getClientId(configuration);
const clientSecret = this.getClientSecret(configuration);
if (!clientId) {
return null;
@ -259,6 +260,9 @@ export class UrlService {
params = params.set('client_id', clientId);
params = params.set('token', token);
params = params.set('token_type_hint', 'access_token');
if (clientSecret) {
params = params.set('client_secret', clientSecret);
}
return params.toString();
}
@ -268,6 +272,7 @@ export class UrlService {
configuration: OpenIdConfiguration
): string | null {
const clientId = this.getClientId(configuration);
const clientSecret = this.getClientSecret(configuration);
if (!clientId) {
return null;
@ -278,6 +283,9 @@ export class UrlService {
params = params.set('client_id', clientId);
params = params.set('token', token);
params = params.set('token_type_hint', 'refresh_token');
if (clientSecret) {
params = params.set('client_secret', clientSecret);
}
return params.toString();
}
@ -304,6 +312,7 @@ export class UrlService {
customTokenParams?: { [p: string]: string | number | boolean }
): string | null {
const clientId = this.getClientId(configuration);
const clientSecret = this.getClientSecret(configuration);
if (!clientId) {
return null;
@ -313,6 +322,9 @@ export class UrlService {
params = params.set('grant_type', 'authorization_code');
params = params.set('client_id', clientId);
if (clientSecret) {
params = params.set('client_secret', clientSecret);
}
if (!configuration.disablePkce) {
const codeVerifier = this.flowsDataService.getCodeVerifier(configuration);
@ -364,6 +376,7 @@ export class UrlService {
customParamsRefresh?: { [key: string]: string | number | boolean }
): string | null {
const clientId = this.getClientId(configuration);
const clientSecret = this.getClientSecret(configuration);
if (!clientId) {
return null;
@ -374,6 +387,9 @@ export class UrlService {
params = params.set('grant_type', 'refresh_token');
params = params.set('client_id', clientId);
params = params.set('refresh_token', refreshToken);
if (clientSecret) {
params = params.set('client_secret', clientSecret);
}
if (customParamsRefresh) {
params = this.appendCustomParams({ ...customParamsRefresh }, params);
@ -851,6 +867,18 @@ export class UrlService {
return clientId;
}
private getClientSecret(configuration: OpenIdConfiguration): string | null {
const { clientSecret } = configuration;
if (!clientSecret) {
this.loggerService.logDebug(configuration, 'could not get clientSecret');
return null;
}
return clientSecret;
}
private appendCustomParams(
customParams: { [key: string]: string | number | boolean },
params: HttpParams

View File

@ -6,7 +6,7 @@ export default defineConfig({
cacheDir: '.vitest',
test: {
setupFiles: ['src/testing/init-test.ts'],
environment: 'jsdom',
environment: 'happy-dom',
include: ['src/**/*.spec.ts'],
globals: true,
restoreMocks: true,
@ -15,6 +15,14 @@ export default defineConfig({
reporter: ['text', 'json-summary', 'json'],
// If you want a coverage reports even if your tests are failing, include the reportOnFailure option
reportOnFailure: true,
exclude: [
'vitest.config.ts',
'playwright.config.ts',
'rslib.config.ts',
'scripts/**',
'examples/**',
'dist/**',
],
},
},
plugins: [