@farmart-tech/brave-admin-sdk
    Preparing search index...

    @farmart-tech/brave-admin-sdk

    @farmart-tech/brave-admin-sdk

    Administrative SDK for full management of Brave Ship feature flags, workspaces, and maintenance windows.

    @farmart-tech/brave-admin-sdk provides complete write access to the Brave Ship ecosystem via a secure REST API. It is designed for use in administrative dashboards, CI/CD pipelines, and internal management tools.

    • 🛠️ Full CRUD: Create, update, delete, and archive feature flags, segments, and conditions.
    • 🏢 Workspace Management: Programmatically manage workspaces (environments).
    • 📅 Maintenance Scheduling: Define and update complex downtime schedules and maintenance pages.
    • 🖼️ Media Uploads: Built-in support for uploading assets (banners, logos) for maintenance windows.
    • 🔐 Secure Auth: Seamless integration with Firebase Authentication for API security.
    npm install @farmart-tech/brave-admin-sdk
    # or
    pnpm add @farmart-tech/brave-admin-sdk
    • axios ^1.6.7
    • @farmart-tech/brave-feature-core
    • @farmart-tech/brave-window-core
    • @farmart-tech/brave-firebase-adapter (for reading logs/state)
    import { FeatureFlagWriter, WorkspaceAPI } from '@farmart-tech/brave-admin-sdk';
    import { getAuth } from 'firebase/auth';

    const config = {
    api: 'https://api.farmart.com/api/v1',
    getIdToken: async () => {
    const user = getAuth().currentUser;
    return await user.getIdToken();
    },
    workspace: 'production'
    };

    const writer = new FeatureFlagWriter(config);
    const workspaceApi = new WorkspaceAPI(config);
    import { FeatureBuilder } from '@farmart-tech/brave-admin-sdk';

    // Create a new flag
    const feature = new FeatureBuilder()
    .setFeatureName('new_checkout_flow')
    .setDescription('Enables the redesigned checkout experience')
    .setEnabled(true)
    .setReleaseDate('2024-12-01')
    .build();

    await writer.setFeatureFlag('new_checkout_flow', feature);

    // Update a flag
    await writer.updateFeatureFlag('new_checkout_flow', { enabled: false });

    // Archive a flag (safe deletion)
    const currentData = await reader.getFeatureFlag('old_experiment'); // Using a reader
    await writer.archiveFeatureFlag('old_experiment', currentData);
    // List all workspaces
    const workspaces = await workspaceApi.list();

    // Create a new staging workspace
    await workspaceApi.create({
    id: 'staging-q1',
    name: 'Staging Q1 2024',
    description: 'Environment for Q1 feature testing'
    });

    Comprehensive API documentation is available at: https://fmt-feature-management.web.app/docs/admin-sdk/

    MIT © FarMart