* Get restrictions synchronously from session cache or file
()
| 529 | * Get restrictions synchronously from session cache or file |
| 530 | */ |
| 531 | function getRestrictionsFromCache(): |
| 532 | | PolicyLimitsResponse['restrictions'] |
| 533 | | null { |
| 534 | if (!isPolicyLimitsEligible()) { |
| 535 | return null |
| 536 | } |
| 537 | |
| 538 | if (sessionCache) { |
| 539 | return sessionCache |
| 540 | } |
| 541 | |
| 542 | const cachedRestrictions = loadCachedRestrictions() |
| 543 | if (cachedRestrictions) { |
| 544 | sessionCache = cachedRestrictions |
| 545 | return cachedRestrictions |
| 546 | } |
| 547 | |
| 548 | return null |
| 549 | } |
| 550 | |
| 551 | /** |
| 552 | * Load policy limits during CLI initialization |
no test coverage detected