npm package: @farmart-tech/brave-admin-sdk
Description: Admin SDK for Farmart Brave Ship feature flag system.
Latest version: 2.0.2

# @farmart-tech/brave-admin-sdk

Admin SDK for Farmart Brave Ship feature flag system.

## Overview

`@farmart-tech/brave-admin-sdk` provides full CRUD (Create, Read, Update, Delete) operations for managing feature flags, workspaces, and maintenance windows. This SDK is designed for admin dashboards, management tools, and automation scripts.

## Features

- Full CRUD operations for features and workspaces
- Maintenance window management
- Feature flag lifecycle management
- Workspace administration
- Audit log integration
- TypeScript support with complete type definitions
- Real-time synchronization
- Batch operations support

## Installation

```bash
npm install @farmart-tech/brave-admin-sdk @farmart-tech/brave-firebase-adapter firebase axios
```

## Peer Dependencies

- `firebase` ^11.5.0
- `axios` ^1.6.7

## Quick Start

```typescript
import { createAdminClient } from '@farmart-tech/brave-admin-sdk';
import { FirebaseAdapter } from '@farmart-tech/brave-firebase-adapter';
import { initializeApp } from 'firebase/app';

// Initialize Firebase
const firebaseApp = initializeApp({
  projectId: 'your-project-id',
  apiKey: 'your-api-key',
  // ... other config
});

// Create adapter
const adapter = new FirebaseAdapter({ app: firebaseApp });

// Create admin client
const admin = createAdminClient(adapter);

// Manage workspaces
await admin.createWorkspace({
  id: 'workspace-1',
  name: 'Production',
  description: 'Production environment',
});

// Manage features
await admin.createFeature('workspace-1', {
  id: 'feature-dark-mode',
  name: 'Dark Mode',
  description: 'Enable dark theme',
  enabled: true,
  rolloutPercentage: 50,
});

// Update feature
await admin.updateFeature('workspace-1', 'feature-dark-mode', {
  enabled: false,
  rolloutPercentage: 100,
});

// Delete feature
await admin.deleteFeature('workspace-1', 'feature-dark-mode');

// Manage maintenance windows
await admin.setWindowActive('workspace-1', false, {
  message: 'System under maintenance',
  showLogo: true,
});
```

## Documentation

For complete API documentation and usage examples, visit:

**[https://fmt-feature-management.web.app/docs/admin-sdk/index.html](https://fmt-feature-management.web.app/docs/admin-sdk/index.html)**

## API Methods

### Workspace Management
- `createWorkspace(workspace)` - Create new workspace
- `getWorkspace(workspaceId)` - Get workspace details
- `updateWorkspace(workspaceId, data)` - Update workspace
- `deleteWorkspace(workspaceId)` - Delete workspace
- `listWorkspaces()` - List all workspaces

### Feature Management
- `createFeature(workspaceId, feature)` - Create feature flag
- `getFeature(workspaceId, featureId)` - Get feature details
- `updateFeature(workspaceId, featureId, data)` - Update feature
- `deleteFeature(workspaceId, featureId)` - Delete feature
- `listFeatures(workspaceId)` - List all features in workspace

### Window Management
- `setWindowActive(workspaceId, active, config)` - Control maintenance mode
- `getWindowStatus(workspaceId)` - Get current window status
- `scheduleWindow(workspaceId, schedule)` - Schedule maintenance window

## Use Cases

- Admin dashboards
- CI/CD automation
- Feature flag management tools
- Automated testing environments
- DevOps tooling integration
- Maintenance mode control

## License

MIT

## Related Packages

- [@farmart-tech/brave-client-sdk](https://www.npmjs.com/package/@farmart-tech/brave-client-sdk) - Client SDK (read-only)
- [@farmart-tech/brave-firebase-adapter](https://www.npmjs.com/package/@farmart-tech/brave-firebase-adapter) - Firebase integration
- [@farmart-tech/brave-react-adapter](https://www.npmjs.com/package/@farmart-tech/brave-react-adapter) - React hooks

## Repository

[https://github.com/FarMart-Engineering/farmart-brave-ship](https://github.com/FarMart-Engineering/farmart-brave-ship)