UNPKG

prisma-zod-generator

Version:

Prisma 2+ generator to emit Zod schemas from your Prisma schema

57 lines (56 loc) 1.96 kB
/** * PZG Pro License Validation * * Simple offline-capable license validation with local caching * Only checks license when Pro features are actually used */ type PlanSlug = 'starter' | 'professional' | 'business' | 'enterprise'; /** * Whether to skip licence enforcement for local Pro development. * * Requires BOTH an explicit opt-in and a submodule checkout. `NODE_ENV` is * deliberately not consulted: `NODE_ENV=development` is set by countless dev * setups and must never be enough to unlock paid features. */ export declare function isProDevBypassEnabled(): boolean; export declare function describePlan(plan: PlanSlug): string; export interface LicenseInfo { key: string; plan: PlanSlug; validUntil: string; maxSeats: number; cached: boolean; status?: 'active' | 'suspended' | 'expired'; valid_until?: Date; customerId?: string; } /** * Main license validation function * Returns license info if valid, null if invalid, throws if required but missing */ export declare function validateLicense(required?: boolean): Promise<LicenseInfo | null>; /** * Check if a specific plan feature is available */ export declare function hasFeature(license: LicenseInfo | null, feature: string): boolean; /** * Require a specific feature, throw if not available */ export declare function requireFeature(feature: string, context?: { userId?: string; sessionId?: string; }): Promise<LicenseInfo>; /** * Get license status for CLI commands */ export type LicenseFailureReason = 'missing_key' | 'invalid_key' | 'expired' | 'code_tampering_detected' | 'validation_failed'; export declare function getLicenseStatus(): Promise<{ valid: boolean; plan?: PlanSlug; cached?: boolean; /** Why validation failed, so callers can print the remedy that actually applies. */ reason?: LicenseFailureReason; /** Underlying error message, safe to show the user. */ detail?: string; }>; export {};