UNPKG

@eventcatalog/license

Version:

License verification for EventCatalog

38 lines 1.41 kB
import { hasOfflineLicenseKey, isFeatureEnabled as isOfflineFeatureEnabled, verifyOfflineLicense, verifyOnlineLicense, } from './verify.js'; export const isEventCatalogStarterEnabled = async () => { const FEATURE = '@eventcatalog/eventcatalog-starter'; const LICENSE_KEY = process.env.EVENTCATALOG_STARTER_LICENSE_KEY || null; // First check if the license key is offline if (hasOfflineLicenseKey()) { await verifyOfflineLicense(); return isOfflineFeatureEnabled(FEATURE); } if (!LICENSE_KEY) { return false; } return verifyOnlineLicense(LICENSE_KEY, FEATURE); }; export const isEventCatalogScaleEnabled = async () => { const FEATURE = '@eventcatalog/eventcatalog-scale'; const LICENSE_KEY = process.env.EVENTCATALOG_SCALE_LICENSE_KEY || null; if (hasOfflineLicenseKey()) { await verifyOfflineLicense(); return isOfflineFeatureEnabled(FEATURE); } if (!LICENSE_KEY) { return false; } console.log('Checking online license for', FEATURE); return verifyOnlineLicense(LICENSE_KEY, FEATURE); }; export const isFeatureEnabled = async (feature, key) => { if (hasOfflineLicenseKey()) { await verifyOfflineLicense(); return isOfflineFeatureEnabled(feature); } if (!key) { return false; } return verifyOnlineLicense(key, feature); }; //# sourceMappingURL=plans.js.map