UNPKG

@coursebuilder/core

Version:

Core package for Course Builder

650 lines (647 loc) 25.4 kB
import { z } from 'zod'; declare const purchaseSchema: z.ZodObject<{ id: z.ZodString; userId: z.ZodNullable<z.ZodOptional<z.ZodString>>; createdAt: z.ZodDate; totalAmount: z.ZodEffects<z.ZodNumber, number, number>; ipAddress: z.ZodNullable<z.ZodOptional<z.ZodString>>; city: z.ZodNullable<z.ZodOptional<z.ZodString>>; state: z.ZodNullable<z.ZodOptional<z.ZodString>>; country: z.ZodNullable<z.ZodOptional<z.ZodString>>; couponId: z.ZodNullable<z.ZodOptional<z.ZodString>>; productId: z.ZodString; merchantChargeId: z.ZodNullable<z.ZodOptional<z.ZodString>>; upgradedFromId: z.ZodNullable<z.ZodOptional<z.ZodString>>; status: z.ZodDefault<z.ZodString>; bulkCouponId: z.ZodNullable<z.ZodOptional<z.ZodString>>; merchantSessionId: z.ZodNullable<z.ZodOptional<z.ZodString>>; redeemedBulkCouponId: z.ZodNullable<z.ZodOptional<z.ZodString>>; fields: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>; user: z.ZodNullable<z.ZodOptional<z.ZodObject<{ id: z.ZodString; name: z.ZodNullable<z.ZodOptional<z.ZodString>>; role: z.ZodDefault<z.ZodEnum<["user", "admin"]>>; email: z.ZodString; emailVerified: z.ZodOptional<z.ZodNullable<z.ZodDate>>; image: z.ZodNullable<z.ZodOptional<z.ZodString>>; createdAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>; memberships: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{ id: z.ZodString; organizationId: z.ZodString; }, "strip", z.ZodTypeAny, { id: string; organizationId: string; }, { id: string; organizationId: string; }>, "many">>>>; roles: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{ id: z.ZodString; name: z.ZodString; description: z.ZodNullable<z.ZodString>; active: z.ZodBoolean; createdAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>; updatedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>; deletedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>; }, "strip", z.ZodTypeAny, { name: string; id: string; description: string | null; active: boolean; createdAt?: Date | null | undefined; updatedAt?: Date | null | undefined; deletedAt?: Date | null | undefined; }, { name: string; id: string; description: string | null; active: boolean; createdAt?: Date | null | undefined; updatedAt?: Date | null | undefined; deletedAt?: Date | null | undefined; }>, "many">>>; organizationRoles: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{ id: z.ZodString; organizationId: z.ZodString; name: z.ZodString; description: z.ZodNullable<z.ZodString>; active: z.ZodBoolean; createdAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>; updatedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>; deletedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>; }, "strip", z.ZodTypeAny, { name: string; id: string; organizationId: string; description: string | null; active: boolean; createdAt?: Date | null | undefined; updatedAt?: Date | null | undefined; deletedAt?: Date | null | undefined; }, { name: string; id: string; organizationId: string; description: string | null; active: boolean; createdAt?: Date | null | undefined; updatedAt?: Date | null | undefined; deletedAt?: Date | null | undefined; }>, "many">>>; }, "strip", z.ZodTypeAny, { id: string; role: "user" | "admin"; email: string; memberships: { id: string; organizationId: string; }[] | null; roles: { name: string; id: string; description: string | null; active: boolean; createdAt?: Date | null | undefined; updatedAt?: Date | null | undefined; deletedAt?: Date | null | undefined; }[]; organizationRoles: { name: string; id: string; organizationId: string; description: string | null; active: boolean; createdAt?: Date | null | undefined; updatedAt?: Date | null | undefined; deletedAt?: Date | null | undefined; }[]; name?: string | null | undefined; createdAt?: Date | null | undefined; image?: string | null | undefined; emailVerified?: Date | null | undefined; }, { id: string; email: string; name?: string | null | undefined; createdAt?: Date | null | undefined; image?: string | null | undefined; role?: "user" | "admin" | undefined; emailVerified?: Date | null | undefined; memberships?: { id: string; organizationId: string; }[] | null | undefined; roles?: { name: string; id: string; description: string | null; active: boolean; createdAt?: Date | null | undefined; updatedAt?: Date | null | undefined; deletedAt?: Date | null | undefined; }[] | undefined; organizationRoles?: { name: string; id: string; organizationId: string; description: string | null; active: boolean; createdAt?: Date | null | undefined; updatedAt?: Date | null | undefined; deletedAt?: Date | null | undefined; }[] | undefined; }>>>; bulkCoupon: z.ZodNullable<z.ZodOptional<z.ZodObject<{ id: z.ZodString; code: z.ZodNullable<z.ZodOptional<z.ZodString>>; createdAt: z.ZodNullable<z.ZodDate>; expires: z.ZodNullable<z.ZodDate>; fields: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>; maxUses: z.ZodDefault<z.ZodNumber>; default: z.ZodDefault<z.ZodBoolean>; merchantCouponId: z.ZodNullable<z.ZodOptional<z.ZodString>>; status: z.ZodDefault<z.ZodNumber>; usedCount: z.ZodDefault<z.ZodNumber>; percentageDiscount: z.ZodEffects<z.ZodNumber, number, number>; restrictedToProductId: z.ZodNullable<z.ZodOptional<z.ZodString>>; bulkPurchases: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>; redeemedBulkCouponPurchases: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>; bulkPurchaseId: z.ZodNullable<z.ZodOptional<z.ZodString>>; organizationId: z.ZodNullable<z.ZodOptional<z.ZodString>>; }, "strip", z.ZodTypeAny, { id: string; createdAt: Date | null; expires: Date | null; fields: Record<string, any>; maxUses: number; default: boolean; status: number; usedCount: number; percentageDiscount: number; bulkPurchases: any[]; redeemedBulkCouponPurchases: any[]; code?: string | null | undefined; merchantCouponId?: string | null | undefined; restrictedToProductId?: string | null | undefined; bulkPurchaseId?: string | null | undefined; organizationId?: string | null | undefined; }, { id: string; createdAt: Date | null; expires: Date | null; percentageDiscount: number; code?: string | null | undefined; fields?: Record<string, any> | undefined; maxUses?: number | undefined; default?: boolean | undefined; merchantCouponId?: string | null | undefined; status?: number | undefined; usedCount?: number | undefined; restrictedToProductId?: string | null | undefined; bulkPurchases?: any[] | undefined; redeemedBulkCouponPurchases?: any[] | undefined; bulkPurchaseId?: string | null | undefined; organizationId?: string | null | undefined; }>>>; product: z.ZodNullable<z.ZodOptional<z.ZodObject<{ id: z.ZodString; organizationId: z.ZodNullable<z.ZodOptional<z.ZodString>>; name: z.ZodString; key: z.ZodNullable<z.ZodOptional<z.ZodString>>; type: z.ZodDefault<z.ZodEnum<["live", "self-paced", "membership", "cohort"]>>; fields: z.ZodObject<{ body: z.ZodOptional<z.ZodNullable<z.ZodString>>; description: z.ZodOptional<z.ZodNullable<z.ZodString>>; slug: z.ZodString; image: z.ZodNullable<z.ZodOptional<z.ZodObject<{ url: z.ZodString; alt: z.ZodNullable<z.ZodOptional<z.ZodString>>; width: z.ZodNullable<z.ZodOptional<z.ZodNumber>>; height: z.ZodNullable<z.ZodOptional<z.ZodNumber>>; }, "strip", z.ZodTypeAny, { url: string; alt?: string | null | undefined; width?: number | null | undefined; height?: number | null | undefined; }, { url: string; alt?: string | null | undefined; width?: number | null | undefined; height?: number | null | undefined; }>>>; action: z.ZodDefault<z.ZodNullable<z.ZodOptional<z.ZodString>>>; state: z.ZodDefault<z.ZodEnum<["draft", "published", "archived", "deleted"]>>; visibility: z.ZodDefault<z.ZodEnum<["public", "private", "unlisted"]>>; }, "strip", z.ZodTypeAny, { slug: string; action: string | null; state: "draft" | "published" | "archived" | "deleted"; visibility: "public" | "private" | "unlisted"; body?: string | null | undefined; description?: string | null | undefined; image?: { url: string; alt?: string | null | undefined; width?: number | null | undefined; height?: number | null | undefined; } | null | undefined; }, { slug: string; body?: string | null | undefined; description?: string | null | undefined; image?: { url: string; alt?: string | null | undefined; width?: number | null | undefined; height?: number | null | undefined; } | null | undefined; action?: string | null | undefined; state?: "draft" | "published" | "archived" | "deleted" | undefined; visibility?: "public" | "private" | "unlisted" | undefined; }>; createdAt: z.ZodNullable<z.ZodDate>; status: z.ZodDefault<z.ZodNumber>; quantityAvailable: z.ZodDefault<z.ZodNumber>; price: z.ZodOptional<z.ZodNullable<z.ZodObject<{ id: z.ZodString; productId: z.ZodNullable<z.ZodOptional<z.ZodString>>; organizationId: z.ZodNullable<z.ZodOptional<z.ZodString>>; nickname: z.ZodNullable<z.ZodOptional<z.ZodString>>; status: z.ZodDefault<z.ZodNumber>; unitAmount: z.ZodEffects<z.ZodNumber, number, number>; createdAt: z.ZodNullable<z.ZodDate>; fields: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>; }, "strip", z.ZodTypeAny, { id: string; createdAt: Date | null; fields: Record<string, any>; status: number; unitAmount: number; organizationId?: string | null | undefined; productId?: string | null | undefined; nickname?: string | null | undefined; }, { id: string; createdAt: Date | null; unitAmount: number; fields?: Record<string, any> | undefined; status?: number | undefined; organizationId?: string | null | undefined; productId?: string | null | undefined; nickname?: string | null | undefined; }>>>; resources: z.ZodNullable<z.ZodDefault<z.ZodArray<z.ZodObject<{ resourceId: z.ZodString; productId: z.ZodString; position: z.ZodDefault<z.ZodNumber>; metadata: z.ZodNullable<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>>; createdAt: z.ZodNullable<z.ZodDate>; updatedAt: z.ZodNullable<z.ZodDate>; deletedAt: z.ZodNullable<z.ZodDate>; resource: z.ZodAny; product: z.ZodAny; }, "strip", z.ZodTypeAny, { createdAt: Date | null; productId: string; resourceId: string; position: number; metadata: Record<string, any> | null; updatedAt: Date | null; deletedAt: Date | null; resource?: any; product?: any; }, { createdAt: Date | null; productId: string; resourceId: string; updatedAt: Date | null; deletedAt: Date | null; position?: number | undefined; metadata?: Record<string, any> | null | undefined; resource?: any; product?: any; }>, "many">>>; }, "strip", z.ZodTypeAny, { type: "live" | "self-paced" | "membership" | "cohort"; name: string; id: string; createdAt: Date | null; fields: { slug: string; action: string | null; state: "draft" | "published" | "archived" | "deleted"; visibility: "public" | "private" | "unlisted"; body?: string | null | undefined; description?: string | null | undefined; image?: { url: string; alt?: string | null | undefined; width?: number | null | undefined; height?: number | null | undefined; } | null | undefined; }; status: number; resources: { createdAt: Date | null; productId: string; resourceId: string; position: number; metadata: Record<string, any> | null; updatedAt: Date | null; deletedAt: Date | null; resource?: any; product?: any; }[] | null; quantityAvailable: number; organizationId?: string | null | undefined; key?: string | null | undefined; price?: { id: string; createdAt: Date | null; fields: Record<string, any>; status: number; unitAmount: number; organizationId?: string | null | undefined; productId?: string | null | undefined; nickname?: string | null | undefined; } | null | undefined; }, { name: string; id: string; createdAt: Date | null; fields: { slug: string; body?: string | null | undefined; description?: string | null | undefined; image?: { url: string; alt?: string | null | undefined; width?: number | null | undefined; height?: number | null | undefined; } | null | undefined; action?: string | null | undefined; state?: "draft" | "published" | "archived" | "deleted" | undefined; visibility?: "public" | "private" | "unlisted" | undefined; }; type?: "live" | "self-paced" | "membership" | "cohort" | undefined; status?: number | undefined; organizationId?: string | null | undefined; resources?: { createdAt: Date | null; productId: string; resourceId: string; updatedAt: Date | null; deletedAt: Date | null; position?: number | undefined; metadata?: Record<string, any> | null | undefined; resource?: any; product?: any; }[] | null | undefined; key?: string | null | undefined; quantityAvailable?: number | undefined; price?: { id: string; createdAt: Date | null; unitAmount: number; fields?: Record<string, any> | undefined; status?: number | undefined; organizationId?: string | null | undefined; productId?: string | null | undefined; nickname?: string | null | undefined; } | null | undefined; }>>>; purchasedByorganizationMembershipId: z.ZodNullable<z.ZodOptional<z.ZodString>>; organizationId: z.ZodNullable<z.ZodOptional<z.ZodString>>; }, "strip", z.ZodTypeAny, { id: string; createdAt: Date; fields: Record<string, any>; status: string; productId: string; totalAmount: number; organizationId?: string | null | undefined; userId?: string | null | undefined; product?: { type: "live" | "self-paced" | "membership" | "cohort"; name: string; id: string; createdAt: Date | null; fields: { slug: string; action: string | null; state: "draft" | "published" | "archived" | "deleted"; visibility: "public" | "private" | "unlisted"; body?: string | null | undefined; description?: string | null | undefined; image?: { url: string; alt?: string | null | undefined; width?: number | null | undefined; height?: number | null | undefined; } | null | undefined; }; status: number; resources: { createdAt: Date | null; productId: string; resourceId: string; position: number; metadata: Record<string, any> | null; updatedAt: Date | null; deletedAt: Date | null; resource?: any; product?: any; }[] | null; quantityAvailable: number; organizationId?: string | null | undefined; key?: string | null | undefined; price?: { id: string; createdAt: Date | null; fields: Record<string, any>; status: number; unitAmount: number; organizationId?: string | null | undefined; productId?: string | null | undefined; nickname?: string | null | undefined; } | null | undefined; } | null | undefined; state?: string | null | undefined; user?: { id: string; role: "user" | "admin"; email: string; memberships: { id: string; organizationId: string; }[] | null; roles: { name: string; id: string; description: string | null; active: boolean; createdAt?: Date | null | undefined; updatedAt?: Date | null | undefined; deletedAt?: Date | null | undefined; }[]; organizationRoles: { name: string; id: string; organizationId: string; description: string | null; active: boolean; createdAt?: Date | null | undefined; updatedAt?: Date | null | undefined; deletedAt?: Date | null | undefined; }[]; name?: string | null | undefined; createdAt?: Date | null | undefined; image?: string | null | undefined; emailVerified?: Date | null | undefined; } | null | undefined; ipAddress?: string | null | undefined; city?: string | null | undefined; country?: string | null | undefined; couponId?: string | null | undefined; merchantChargeId?: string | null | undefined; upgradedFromId?: string | null | undefined; bulkCouponId?: string | null | undefined; merchantSessionId?: string | null | undefined; redeemedBulkCouponId?: string | null | undefined; bulkCoupon?: { id: string; createdAt: Date | null; expires: Date | null; fields: Record<string, any>; maxUses: number; default: boolean; status: number; usedCount: number; percentageDiscount: number; bulkPurchases: any[]; redeemedBulkCouponPurchases: any[]; code?: string | null | undefined; merchantCouponId?: string | null | undefined; restrictedToProductId?: string | null | undefined; bulkPurchaseId?: string | null | undefined; organizationId?: string | null | undefined; } | null | undefined; purchasedByorganizationMembershipId?: string | null | undefined; }, { id: string; createdAt: Date; productId: string; totalAmount: number; fields?: Record<string, any> | undefined; status?: string | undefined; organizationId?: string | null | undefined; userId?: string | null | undefined; product?: { name: string; id: string; createdAt: Date | null; fields: { slug: string; body?: string | null | undefined; description?: string | null | undefined; image?: { url: string; alt?: string | null | undefined; width?: number | null | undefined; height?: number | null | undefined; } | null | undefined; action?: string | null | undefined; state?: "draft" | "published" | "archived" | "deleted" | undefined; visibility?: "public" | "private" | "unlisted" | undefined; }; type?: "live" | "self-paced" | "membership" | "cohort" | undefined; status?: number | undefined; organizationId?: string | null | undefined; resources?: { createdAt: Date | null; productId: string; resourceId: string; updatedAt: Date | null; deletedAt: Date | null; position?: number | undefined; metadata?: Record<string, any> | null | undefined; resource?: any; product?: any; }[] | null | undefined; key?: string | null | undefined; quantityAvailable?: number | undefined; price?: { id: string; createdAt: Date | null; unitAmount: number; fields?: Record<string, any> | undefined; status?: number | undefined; organizationId?: string | null | undefined; productId?: string | null | undefined; nickname?: string | null | undefined; } | null | undefined; } | null | undefined; state?: string | null | undefined; user?: { id: string; email: string; name?: string | null | undefined; createdAt?: Date | null | undefined; image?: string | null | undefined; role?: "user" | "admin" | undefined; emailVerified?: Date | null | undefined; memberships?: { id: string; organizationId: string; }[] | null | undefined; roles?: { name: string; id: string; description: string | null; active: boolean; createdAt?: Date | null | undefined; updatedAt?: Date | null | undefined; deletedAt?: Date | null | undefined; }[] | undefined; organizationRoles?: { name: string; id: string; organizationId: string; description: string | null; active: boolean; createdAt?: Date | null | undefined; updatedAt?: Date | null | undefined; deletedAt?: Date | null | undefined; }[] | undefined; } | null | undefined; ipAddress?: string | null | undefined; city?: string | null | undefined; country?: string | null | undefined; couponId?: string | null | undefined; merchantChargeId?: string | null | undefined; upgradedFromId?: string | null | undefined; bulkCouponId?: string | null | undefined; merchantSessionId?: string | null | undefined; redeemedBulkCouponId?: string | null | undefined; bulkCoupon?: { id: string; createdAt: Date | null; expires: Date | null; percentageDiscount: number; code?: string | null | undefined; fields?: Record<string, any> | undefined; maxUses?: number | undefined; default?: boolean | undefined; merchantCouponId?: string | null | undefined; status?: number | undefined; usedCount?: number | undefined; restrictedToProductId?: string | null | undefined; bulkPurchases?: any[] | undefined; redeemedBulkCouponPurchases?: any[] | undefined; bulkPurchaseId?: string | null | undefined; organizationId?: string | null | undefined; } | null | undefined; purchasedByorganizationMembershipId?: string | null | undefined; }>; type Purchase = z.infer<typeof purchaseSchema>; export { type Purchase, purchaseSchema };