Pure, framework-agnostic maintenance window and downtime management for Brave Ship.
@farmart-tech/brave-window-core provides the core logic for managing scheduled maintenance, regional downtimes, and service availability windows. It is used to determine if an application or specific features should be accessible based on current and future release plans.
npm install @farmart-tech/brave-window-core
# or
pnpm add @farmart-tech/brave-window-core
import { FeatureConfig } from '@farmart-tech/brave-window-core';
// 1. Define configuration (usually fetched from Brave Ship API/Firebase)
const remoteConfig = {
version: '1.2.0',
plannedReleases: [
{
downtimeStartAt: '2024-12-25T10:00:00Z',
downtimeEndAt: '2024-12-25T12:00:00Z',
scopes: ['web', 'ios'],
maintenanceTitle: 'Christmas Maintenance',
maintenanceMessage: 'We are performing routine updates.'
}
]
};
// 2. Initialize
const config = new FeatureConfig('my-application', remoteConfig);
// 3. Check status
const isInMaintenance = config.getIsInMaintenance('web');
if (isInMaintenance) {
const activeRelease = config.getActiveRelease();
console.log(`Maintenance active: ${activeRelease.maintenanceTitle}`);
}
const nextRelease = config.getNextActiveRelease();
if (nextRelease) {
const startsAt = new Date(nextRelease.downtimeStartAt);
console.log(`System will be down at: ${startsAt.toLocaleString()}`);
}
Comprehensive API documentation is available at: https://fmt-feature-management.web.app/docs/window-core/
MIT © FarMart