@farmart-tech/brave-window-core
    Preparing search index...

    @farmart-tech/brave-window-core

    @farmart-tech/brave-window-core

    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.

    • 🕒 Maintenance Scheduling: Define precise start and end times for system maintenance.
    • 🌐 Scoped Downtime: Apply maintenance windows to specific platforms (e.g., 'web', 'ios') or regions.
    • 📈 Progressive Maintenance: Support for 'auto' (show maintenance only during window) and 'always' (manual override) strategies.
    • 🛡️ Global Fallbacks: Inherit maintenance windows from a global workspace when local configurations are missing.
    • 🔍 Intelligent Lookups: Easily retrieve current active maintenance or next upcoming downtime.
    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