杂务:新增声明级注释覆盖率

This commit is contained in:
xiaowang
2026-05-23 18:44:57 +08:00
parent 8f038894e7
commit 844516988b
234 changed files with 8356 additions and 0 deletions
@@ -1,3 +1,7 @@
/**
* Purpose: WEB_API_AUTH_FREE_PATHS supports auth-free-paths.ts by holding or executing the web api auth free paths page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const WEB_API_AUTH_FREE_PATHS = [
'/user/login',
'/user/register',
@@ -22,12 +26,20 @@ export const WEB_API_AUTH_FREE_PATHS = [
'/admin/auth/refresh'
] as const
/**
* Purpose: ADMIN_API_AUTH_FREE_PATHS supports auth-free-paths.ts by holding or executing the admin api auth free paths page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const ADMIN_API_AUTH_FREE_PATHS = [
'/auth/login',
'/auth/login-shops/',
'/auth/refresh'
] as const
/**
* Purpose: normalizePathname supports auth-free-paths.ts by holding or executing the normalize pathname page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const normalizePathname = (url?: string) => {
const raw = String(url || '')
const withoutHash = raw.split('#')[0] || ''
@@ -39,6 +51,10 @@ const normalizePathname = (url?: string) => {
}
}
/**
* Purpose: matchesAuthFreePath supports auth-free-paths.ts by holding or executing the matches auth free path page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const matchesAuthFreePath = (url: string | undefined, path: string) => {
const pathname = normalizePathname(url)
if (path.endsWith('/')) {
@@ -47,10 +63,18 @@ const matchesAuthFreePath = (url: string | undefined, path: string) => {
return pathname === path
}
/**
* Purpose: isApiAuthFreePath supports auth-free-paths.ts by holding or executing the is api auth free path page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const isApiAuthFreePath = (url?: string) => {
return WEB_API_AUTH_FREE_PATHS.some(path => matchesAuthFreePath(url, path))
}
/**
* Purpose: isAdminApiAuthFreePath supports auth-free-paths.ts by holding or executing the is admin api auth free path page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const isAdminApiAuthFreePath = (url?: string) => {
return ADMIN_API_AUTH_FREE_PATHS.some(path => matchesAuthFreePath(url, path))
}