MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / getValidOnlineLicense

Function getValidOnlineLicense

packages/shared/src/entitlements.ts:116–129  ·  view source on GitHub ↗
(_license: License | null)

Source from the content-addressed store, hash-verified

114export const STALE_ONLINE_LICENSE_WARNING_THRESHOLD_MS = 48 * 60 * 60 * 1000;
115
116const getValidOnlineLicense = (_license: License | null): License | null => {
117 if (
118 _license &&
119 _license.status &&
120 ACTIVE_ONLINE_LICENSE_STATUSES.includes(_license.status as LicenseStatus) &&
121 _license.lastSyncAt &&
122 (Date.now() - _license.lastSyncAt.getTime()) <= STALE_ONLINE_LICENSE_THRESHOLD_MS &&
123 _license.lastSyncErrorCode !== 'ACTIVATION_CODE_BOUND_TO_DIFFERENT_INSTANCE'
124 ) {
125 return _license;
126 }
127
128 return null;
129}
130
131export const isValidOfflineLicenseActive = (): boolean => {
132 return getValidOfflineLicense() !== null;

Callers 3

getEntitlementsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected