Add extra comments above the validation schemas

This commit is contained in:
Mihovil Ilakovac 2025-02-20 10:46:35 +01:00
parent b7de40616a
commit ef496af27e
2 changed files with 8 additions and 0 deletions

View File

@ -43,6 +43,8 @@ const genericEventSchema = z.object({
data: z.unknown(),
});
// This is a subtype of Order type from "@lemonsqueezy/lemonsqueezy.js"
// specifically Order['data']
const orderDataSchema = z.object({
attributes: z.object({
customer_id: z.number(),
@ -54,6 +56,8 @@ const orderDataSchema = z.object({
}),
});
// This is a subtype of Subscription type from "@lemonsqueezy/lemonsqueezy.js"
// specifically Subscription['data']
const subscriptionDataSchema = z.object({
attributes: z.object({
customer_id: z.number(),

View File

@ -49,16 +49,19 @@ const genericStripeEventSchema = z.object({
}),
});
// This is a subtype of Stripe.Checkout.Session from "stripe"
const sessionCompletedDataSchema = z.object({
id: z.string(),
customer: z.string(),
});
// This is a subtype of Stripe.Invoice from "stripe"
const invoicePaidDataSchema = z.object({
customer: z.string(),
period_start: z.number(),
});
// This is a subtype of Stripe.Subscription from "stripe"
const subscriptionUpdatedDataSchema = z.object({
customer: z.string(),
status: z.string(),
@ -74,6 +77,7 @@ const subscriptionUpdatedDataSchema = z.object({
}),
});
// This is a subtype of Stripe.Subscription from "stripe"
const subscriptionDeletedDataSchema = z.object({
customer: z.string(),
});