summaryrefslogtreecommitdiffhomepage
path: root/packages/console/core/src/lite.ts
blob: d6679208d85651d311da3710d27fb280cb7f67a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { z } from "zod"
import { fn } from "./util/fn"
import { Resource } from "@opencode-ai/console-resource"

export namespace LiteData {
  const Schema = z.object({
    fixedLimit: z.number().int(),
    rollingLimit: z.number().int(),
    rollingWindow: z.number().int(),
  })

  export const validate = fn(Schema, (input) => {
    return input
  })

  export const getLimits = fn(z.void(), () => {
    const json = JSON.parse(Resource.ZEN_LITE_LIMITS.value)
    return Schema.parse(json)
  })

  export const planToPriceID = fn(z.void(), () => {
    return Resource.ZEN_LITE_PRICE.price
  })

  export const priceIDToPlan = fn(z.void(), () => {
    return "lite"
  })
}