# @bounded-sh/core

Core functionality for Tarobase SDKs. This package provides the shared functionality used by both the web and server SDKs.

## Installation

```bash
npm install @bounded-sh/core
```

## Usage

This package is typically not used directly, but is instead used as a dependency by `@bounded-sh/client` and `@bounded-sh/server`. If you're building a browser application, use `@bounded-sh/client`. If you're building a server application, use `@bounded-sh/server`.

## API Reference

### Core Types

```typescript
export interface ClientConfig {
  appId: string;
  apiUrl: string;
  authMethod: string;
  privyConfig?: any;
  chain?: string;
  useSessionStorage?: boolean;
}

export interface AuthProvider {
  login(): Promise<User | null>;
  signMessage(message: string): Promise<string>;
  restoreSession(): Promise<User | null>;
  logout(): Promise<void>;
  getNativeMethods(): Promise<any>;
}

export interface User {
  address: string;
  provider: AuthProvider;
}

export interface GetManyResult {
  path: string;
  data: any | null;
  error?: {
    code: 'NOT_FOUND' | 'UNAUTHORIZED' | 'INVALID_PATH';
    message: string;
  };
}
```

### Core Operations

```typescript
// Initialize the SDK
function configInit(newConfig: Partial<ClientConfig>, options?: SessionOptions): Promise<void>;

// Get the current configuration
function getConfig(): Promise<ClientConfig>;

// Data operations
function get(path: string): Promise<any>;
function getMany(paths: string[], options?: { bypassCache?: boolean }): Promise<GetManyResult[]>;
function set(path: string, data: any, options?: SetOptions): Promise<any>;
function setMany(many: { path: string; document: any }[], options?: SetOptions): Promise<any>;
function setFile(path: string, file: File, metadata?: any): Promise<any>;
function getFiles(path: string): Promise<any>;
function runQuery(queryString: string, variables?: any): Promise<any>;
function runQueryMany(queryString: string, variables?: any): Promise<any>;

// Subscription
function subscribe(path: string, options?: SubscriptionOptions): Promise<() => void>;
```

## Contributing

Please see the main repository for contribution guidelines.
