UNPKG

autumn-js

Version:

Autumn JS Library

176 lines (170 loc) 7.76 kB
import { z } from 'zod'; declare const ProductSchema: z.ZodObject<{ id: z.ZodString; name: z.ZodString; is_add_on: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>; is_default: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>; items: z.ZodArray<z.ZodObject<{ type: z.ZodOptional<z.ZodNullable<z.ZodEnum<["feature", "priced_feature"]>>>; feature_id: z.ZodOptional<z.ZodNullable<z.ZodString>>; included_usage: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>>>; interval: z.ZodOptional<z.ZodNullable<z.ZodEnum<["minute", "hour", "day", "week", "month", "quarter", "semi_annual", "year"]>>>; usage_model: z.ZodOptional<z.ZodNullable<z.ZodEnum<["prepaid", "pay_per_use"]>>>; price: z.ZodOptional<z.ZodNullable<z.ZodNumber>>; billing_units: z.ZodOptional<z.ZodNullable<z.ZodNumber>>; }, "strip", z.ZodTypeAny, { type?: "feature" | "priced_feature" | null | undefined; feature_id?: string | null | undefined; included_usage?: number | "inf" | null | undefined; interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined; usage_model?: "prepaid" | "pay_per_use" | null | undefined; price?: number | null | undefined; billing_units?: number | null | undefined; }, { type?: "feature" | "priced_feature" | null | undefined; feature_id?: string | null | undefined; included_usage?: number | "inf" | null | undefined; interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined; usage_model?: "prepaid" | "pay_per_use" | null | undefined; price?: number | null | undefined; billing_units?: number | null | undefined; }>, "many">; }, "strip", z.ZodTypeAny, { id: string; name: string; items: { type?: "feature" | "priced_feature" | null | undefined; feature_id?: string | null | undefined; included_usage?: number | "inf" | null | undefined; interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined; usage_model?: "prepaid" | "pay_per_use" | null | undefined; price?: number | null | undefined; billing_units?: number | null | undefined; }[]; is_add_on?: boolean | undefined; is_default?: boolean | undefined; }, { id: string; name: string; items: { type?: "feature" | "priced_feature" | null | undefined; feature_id?: string | null | undefined; included_usage?: number | "inf" | null | undefined; interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined; usage_model?: "prepaid" | "pay_per_use" | null | undefined; price?: number | null | undefined; billing_units?: number | null | undefined; }[]; is_add_on?: boolean | undefined; is_default?: boolean | undefined; }>; declare const FeatureSchema: z.ZodObject<{ id: z.ZodString; name: z.ZodString; type: z.ZodEnum<["boolean", "single_use", "continuous_use", "credit_system"]>; credit_schema: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{ metered_feature_id: z.ZodString; credit_cost: z.ZodNumber; }, "strip", z.ZodTypeAny, { metered_feature_id: string; credit_cost: number; }, { metered_feature_id: string; credit_cost: number; }>, "many">>>; }, "strip", z.ZodTypeAny, { id: string; name: string; type: "boolean" | "single_use" | "continuous_use" | "credit_system"; credit_schema?: { metered_feature_id: string; credit_cost: number; }[] | null | undefined; }, { id: string; name: string; type: "boolean" | "single_use" | "continuous_use" | "credit_system"; credit_schema?: { metered_feature_id: string; credit_cost: number; }[] | null | undefined; }>; type Feature = z.infer<typeof FeatureSchema>; type Product = z.infer<typeof ProductSchema>; declare const ProductItemIntervalEnum: z.ZodEnum<["minute", "hour", "day", "week", "month", "quarter", "semi_annual", "year"]>; declare const UsageModelEnum: z.ZodEnum<["prepaid", "pay_per_use"]>; type ProductItemInterval = z.infer<typeof ProductItemIntervalEnum>; type UsageModel = z.infer<typeof UsageModelEnum>; declare const ProductItemSchema: z.ZodObject<{ type: z.ZodOptional<z.ZodNullable<z.ZodEnum<["feature", "priced_feature"]>>>; feature_id: z.ZodOptional<z.ZodNullable<z.ZodString>>; included_usage: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>>>; interval: z.ZodOptional<z.ZodNullable<z.ZodEnum<["minute", "hour", "day", "week", "month", "quarter", "semi_annual", "year"]>>>; usage_model: z.ZodOptional<z.ZodNullable<z.ZodEnum<["prepaid", "pay_per_use"]>>>; price: z.ZodOptional<z.ZodNullable<z.ZodNumber>>; billing_units: z.ZodOptional<z.ZodNullable<z.ZodNumber>>; }, "strip", z.ZodTypeAny, { type?: "feature" | "priced_feature" | null | undefined; feature_id?: string | null | undefined; included_usage?: number | "inf" | null | undefined; interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined; usage_model?: "prepaid" | "pay_per_use" | null | undefined; price?: number | null | undefined; billing_units?: number | null | undefined; }, { type?: "feature" | "priced_feature" | null | undefined; feature_id?: string | null | undefined; included_usage?: number | "inf" | null | undefined; interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined; usage_model?: "prepaid" | "pay_per_use" | null | undefined; price?: number | null | undefined; billing_units?: number | null | undefined; }>; type ProductItem = z.infer<typeof ProductItemSchema>; declare const product: (p: Product) => { id: string; name: string; items: { type?: "feature" | "priced_feature" | null | undefined; feature_id?: string | null | undefined; included_usage?: number | "inf" | null | undefined; interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined; usage_model?: "prepaid" | "pay_per_use" | null | undefined; price?: number | null | undefined; billing_units?: number | null | undefined; }[]; is_add_on?: boolean | undefined; is_default?: boolean | undefined; }; declare const feature: (f: Feature) => { id: string; name: string; type: "boolean" | "single_use" | "continuous_use" | "credit_system"; credit_schema?: { metered_feature_id: string; credit_cost: number; }[] | null | undefined; }; declare const featureItem: ({ feature_id, included_usage, interval, }: { feature_id: string; included_usage?: number; interval?: ProductItemInterval; }) => ProductItem; declare const priceItem: ({ price, interval, }: { price: number; interval?: ProductItemInterval; }) => ProductItem; declare const pricedFeatureItem: ({ feature_id, price, interval, included_usage, billing_units, usage_model, }: { feature_id: string; price: number; interval?: ProductItemInterval; included_usage?: number; billing_units?: number; usage_model?: UsageModel; }) => ProductItem; type Infinity = "infinity"; type AutumnConfig = { products: Product[]; features: Feature[]; }; export { type AutumnConfig, type Feature, type Infinity, type Product, type ProductItem, feature, featureItem, priceItem, pricedFeatureItem, product };