/ services / policyLimits / types.ts
types.ts
 1  import { z } from 'zod/v4'
 2  import { lazySchema } from '../../utils/lazySchema.js'
 3  
 4  /**
 5   * Schema for the policy limits API response
 6   * Only blocked policies are included. If a policy key is absent, it's allowed.
 7   */
 8  export const PolicyLimitsResponseSchema = lazySchema(() =>
 9    z.object({
10      restrictions: z.record(z.string(), z.object({ allowed: z.boolean() })),
11    }),
12  )
13  
14  export type PolicyLimitsResponse = z.infer<
15    ReturnType<typeof PolicyLimitsResponseSchema>
16  >
17  
18  /**
19   * Result of fetching policy limits
20   */
21  export type PolicyLimitsFetchResult = {
22    success: boolean
23    restrictions?: PolicyLimitsResponse['restrictions'] | null // null means 304 Not Modified (cache is valid)
24    etag?: string
25    error?: string
26    skipRetry?: boolean // If true, don't retry on failure (e.g., auth errors)
27  }