* Refactor core to use a flexible registry pattern - Introduce a new registry mechanism for mailer providers - Extract mailer provider enum to a separate file - Implement dynamic mailer loading using a registry - Update package dependencies and exports - Improve modularity and extensibility of mailer implementation * Refactor monitoring and billing services to use a flexible registry pattern - Introduce a shared registry mechanism for dynamic service loading - Replace static switch-based implementations with a registry-based approach - Update instrumentation, CMS, and monitoring services to use the new registry - Improve modularity and extensibility of service implementations - Add Zod-based type-safe provider validation * Simplify async registration in monitoring and billing services - Remove unnecessary async wrappers for no-op registrations - Update type definitions to support both async and sync registration functions - Standardize registration approach for Paddle and Sentry providers * Remove Tailwind package from packages where it is not being needed * Remove Tailwind config references from pnpm-lock.yaml * Update instrumentation registry to support dynamic monitoring providers - Modify type definition to use NonNullable MonitoringProvider - Import MonitoringProvider type from get-monitoring-provider - Enhance type safety for instrumentation registration
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import 'server-only';
|
|
|
|
import { z } from 'zod';
|
|
|
|
import {
|
|
type BillingProviderSchema,
|
|
BillingStrategyProviderService,
|
|
} from '@kit/billing';
|
|
import { createRegistry } from '@kit/shared/registry';
|
|
|
|
// Create a registry for billing strategy providers
|
|
export const billingStrategyRegistry = createRegistry<
|
|
BillingStrategyProviderService,
|
|
z.infer<typeof BillingProviderSchema>
|
|
>();
|
|
|
|
// Register the Stripe billing strategy
|
|
billingStrategyRegistry.register('stripe', async () => {
|
|
const { StripeBillingStrategyService } = await import('@kit/stripe');
|
|
return new StripeBillingStrategyService();
|
|
});
|
|
|
|
// Register the Lemon Squeezy billing strategy
|
|
billingStrategyRegistry.register('lemon-squeezy', async () => {
|
|
const { LemonSqueezyBillingStrategyService } = await import(
|
|
'@kit/lemon-squeezy'
|
|
);
|
|
return new LemonSqueezyBillingStrategyService();
|
|
});
|
|
|
|
// Register Paddle billing strategy (not implemented yet)
|
|
billingStrategyRegistry.register('paddle', () => {
|
|
throw new Error('Paddle is not supported yet');
|
|
});
|