chargebee
Version:
A library for integrating with Chargebee.
55 lines (54 loc) • 2.36 kB
JavaScript
"use strict";
// Generated Zod schemas: Entitlement
// Actions: list, create
// Do not edit manually – regenerate via sdk-generator
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateEntitlementBodySchema = exports.ListEntitlementBodySchema = void 0;
const zod_1 = require("zod");
//Entitlement.list
const ListEntitlementFeatureIdSchema = zod_1.z.object({
is: zod_1.z.string().min(1).optional(),
in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
});
const ListEntitlementEntityTypeSchema = zod_1.z.object({
is: zod_1.z
.enum(['plan', 'addon', 'charge', 'plan_price', 'addon_price'])
.optional(),
in: zod_1.z
.enum(['plan', 'addon', 'charge', 'plan_price', 'addon_price'])
.optional(),
});
const ListEntitlementEntityIdSchema = zod_1.z.object({
is: zod_1.z.string().min(1).optional(),
in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
});
const ListEntitlementBodySchema = zod_1.z.looseObject({
limit: zod_1.z.number().int().min(1).max(100).optional(),
offset: zod_1.z.string().max(1000).optional(),
feature_id: ListEntitlementFeatureIdSchema.optional(),
entity_type: ListEntitlementEntityTypeSchema.optional(),
entity_id: ListEntitlementEntityIdSchema.optional(),
include_drafts: zod_1.z.boolean().default(false).optional(),
embed: zod_1.z.string().max(1000).optional(),
});
exports.ListEntitlementBodySchema = ListEntitlementBodySchema;
//Entitlement.create
const CreateEntitlementEntitlementsSchema = zod_1.z.object({
entity_id: zod_1.z.array(zod_1.z.string().max(100).optional()),
feature_id: zod_1.z.array(zod_1.z.string().max(50).optional()),
entity_type: zod_1.z
.array(zod_1.z
.enum(['plan', 'addon', 'charge', 'plan_price', 'addon_price'])
.optional())
.optional(),
value: zod_1.z.array(zod_1.z.string().max(50).optional()).optional(),
apply_grandfathering: zod_1.z
.array(zod_1.z.boolean().default(false).optional())
.optional(),
});
const CreateEntitlementBodySchema = zod_1.z.looseObject({
action: zod_1.z.enum(['upsert', 'remove']),
change_reason: zod_1.z.string().max(100).optional(),
entitlements: CreateEntitlementEntitlementsSchema.optional(),
});
exports.CreateEntitlementBodySchema = CreateEntitlementBodySchema;