working on get api cus feature
This commit is contained in:
@@ -1,38 +1,35 @@
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export enum APIFeatureType {
|
||||
export enum ApiFeatureType {
|
||||
Static = "static", // legacy (will deprecate)
|
||||
Boolean = "boolean",
|
||||
SingleUsage = "single_use",
|
||||
ContinuousUse = "continuous_use",
|
||||
CreditSystem = "credit_system",
|
||||
}
|
||||
|
||||
export const APIFeatureSchema = z
|
||||
.object({
|
||||
id: z.string(),
|
||||
name: z.string().nullish(),
|
||||
type: z.nativeEnum(APIFeatureType),
|
||||
display: z
|
||||
.object({
|
||||
singular: z.string(),
|
||||
plural: z.string(),
|
||||
})
|
||||
.nullish(),
|
||||
// Base schema without .meta() to avoid side effects during imports
|
||||
export const ApiFeatureSchema = z.object({
|
||||
id: z.string(),
|
||||
name: z.string().nullish(),
|
||||
type: z.enum(ApiFeatureType),
|
||||
display: z
|
||||
.object({
|
||||
singular: z.string(),
|
||||
plural: z.string(),
|
||||
})
|
||||
.nullish(),
|
||||
|
||||
credit_schema: z
|
||||
.array(
|
||||
z.object({
|
||||
metered_feature_id: z.string(),
|
||||
credit_cost: z.number(),
|
||||
}),
|
||||
)
|
||||
.nullish(),
|
||||
credit_schema: z
|
||||
.array(
|
||||
z.object({
|
||||
metered_feature_id: z.string(),
|
||||
credit_cost: z.number(),
|
||||
}),
|
||||
)
|
||||
.nullish(),
|
||||
|
||||
archived: z.boolean().nullish(),
|
||||
})
|
||||
.meta({
|
||||
id: "Feature",
|
||||
description: "Feature object returned by the API",
|
||||
});
|
||||
archived: z.boolean().nullish(),
|
||||
});
|
||||
|
||||
export type APIFeature = z.infer<typeof APIFeatureSchema>;
|
||||
export type ApiFeature = z.infer<typeof ApiFeatureSchema>;
|
||||
|
||||
Reference in New Issue
Block a user