(
value: unknown,
)
| 271 | } |
| 272 | |
| 273 | function normalizePermissions( |
| 274 | value: unknown, |
| 275 | ): Record<string, string[]> | undefined { |
| 276 | if (!value || typeof value !== "object" || Array.isArray(value)) { |
| 277 | return undefined; |
| 278 | } |
| 279 | |
| 280 | const permissions: Record<string, string[]> = {}; |
| 281 | for (const [key, scopes] of Object.entries(value)) { |
| 282 | if (!Array.isArray(scopes)) continue; |
| 283 | const safeScopes = scopes.filter( |
| 284 | (scope): scope is string => typeof scope === "string", |
| 285 | ); |
| 286 | if (safeScopes.length) permissions[key] = safeScopes; |
| 287 | } |
| 288 | return Object.keys(permissions).length ? permissions : undefined; |
| 289 | } |
| 290 | |
| 291 | function normalizeMetadata( |
| 292 | value: unknown, |
no outgoing calls
no test coverage detected