{"version":3,"sources":["../src/types/index.ts","../src/utils/http.ts","../src/utils/validation.ts","../src/client.ts","../src/index.ts"],"names":[],"mappings":";AAkPO,IAAM,kBAAN,MAAM,yBAAwB,MAAM;AAAA,EAKzC,YAAY,SAAiB,MAAc,YAAqB,SAAe;AAC7E,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,aAAa;AAClB,SAAK,UAAU;AAGf,QAAI,MAAM,mBAAmB;AAC3B,YAAM,kBAAkB,MAAM,gBAAe;AAAA,IAC/C;AAAA,EACF;AACF;AAKO,IAAM,kBAAN,cAA8B,gBAAgB;AAAA,EACnD,YAAY,SAAiB,SAAe;AAC1C,UAAM,SAAS,oBAAoB,KAAK,OAAO;AAC/C,SAAK,OAAO;AAAA,EACd;AACF;AAKO,IAAM,eAAN,cAA2B,gBAAgB;AAAA,EAChD,YAAY,SAAiB,SAAe;AAC1C,UAAM,SAAS,iBAAiB,QAAW,OAAO;AAClD,SAAK,OAAO;AAAA,EACd;AACF;;;ACvPA,SAAS,MAAM,IAA2B;AACxC,SAAO,IAAI,QAAQ,aAAW,WAAW,SAAS,EAAE,CAAC;AACvD;AAKA,SAAS,eAAe,UAA4C;AAClE,QAAM,UAAkC,CAAC;AACzC,WAAS,QAAQ,QAAQ,CAAC,OAAO,QAAQ;AACvC,YAAQ,GAAG,IAAI;AAAA,EACjB,CAAC;AACD,SAAO;AACT;AAKO,IAAM,aAAN,MAAiB;AAAA,EAGtB,YAAY,QAAoB;AAC9B,SAAK,SAAS;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QACJ,UACA,UAAuB,CAAC,GACE;AAC1B,UAAM,MAAM,GAAG,KAAK,OAAO,OAAO,GAAG,QAAQ;AAC7C,QAAI;AAEJ,aAAS,UAAU,GAAG,WAAW,KAAK,OAAO,eAAe,WAAW;AACrE,UAAI;AACF,YAAI,KAAK,OAAO,SAAS,UAAU,GAAG;AACpC,kBAAQ,IAAI,iCAAiC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,MACpB,SAAS,KAAK,OAAO;AAAA,MACrB,eAAe,KAAK,OAAO;AAAA,MAC3B,YAAY,KAAK,OAAO;AAAA,MACxB,OAAO,KAAK,OAAO;AAAA,IACrB,CAAC;AAAA,EACH;AACF;;;AChSO,SAAS,aACd,QACA,SACkB;AAClB,SAAO,IAAI,iBAAiB;AAAA,IAC1B;AAAA,IACA,GAAG;AAAA,EACL,CAAC;AACH;AAKA,IAAO,cAAQ;AAGR,IAAM,cAAc;AACpB,IAAM,WAAW;AAKjB,IAAM,WAAW;AAAA,EACtB,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,eAAe;AACjB","sourcesContent":["/**\n * AgentMeter SDK TypeScript Type Definitions\n * Contains all interfaces and types for the AgentMeter API integration\n */\n\n/**\n * Standard API response wrapper used by all AgentMeter endpoints\n */\nexport interface ApiResponse<T = any> {\n  success: boolean;\n  data?: T;\n  error?: {\n    code: string;\n    message: string;\n    details?: any;\n  };\n  meta?: {\n    page?: number;\n    limit?: number;\n    total?: number;\n  };\n}\n\n/**\n * Application entity representing a registered app in AgentMeter\n */\nexport interface App {\n  id: string;\n  merchant_id: string;\n  name: string;\n  description?: string;\n  api_key: string;\n  webhook_url?: string;\n  created_at: string;\n  updated_at: string;\n  status: 'active' | 'inactive';\n  meters?: { count: number }[];\n  app_users?: { count: number }[];\n}\n\n/**\n * Meter entity defining how events are aggregated and billed\n */\nexport interface Meter {\n  id: string;\n  app_id: string;\n  name: string;\n  description?: string;\n  event_name: string;\n  aggregation_method: 'SUM' | 'COUNT' | 'UNIQUE_COUNT' | 'AVG' | 'MAX' | 'MIN';\n  aggregation_key?: string;\n  group_by?: string[];\n  price_per_unit: number;\n  currency: 'USD' | 'EUR' | 'GBP' | 'CNY';\n  billing_cycle: 'hourly' | 'daily' | 'weekly' | 'monthly';\n  created_at: string;\n  updated_at: string;\n  status: 'active' | 'inactive';\n}\n\n/**\n * Event entity representing a tracked user action or API call\n */\nexport interface Event {\n  id: string;\n  app_id: string;\n  event_name: string;\n  user_id?: string;\n  properties: Record<string, any>;\n  value?: number;\n  timestamp: string;\n  created_at: string;\n}\n\n/**\n * Usage entity representing aggregated usage data for billing\n */\nexport interface Usage {\n  id: string;\n  meter_id: string;\n  app_id: string;\n  user_id?: string;\n  period_start: string;\n  period_end: string;\n  aggregated_value: number;\n  group_values?: Record<string, any>;\n  cost: number;\n  created_at: string;\n}\n\n/**\n * Usage summary providing comprehensive billing overview\n */\nexport interface UsageSummary {\n  app_id: string;\n  meters: {\n    meter: Meter;\n    total_usage: number;\n    total_cost: number;\n    usage_records: number;\n  }[];\n  summary: {\n    total_cost: number;\n    total_meters: number;\n    active_users: number;\n    total_events: number;\n  };\n}\n\n/**\n * Time series usage data for charts and analytics\n */\nexport interface UsageTimeSeries {\n  meter_id: string;\n  interval: 'hour' | 'day' | 'week' | 'month';\n  data_points: {\n    timestamp: string;\n    value: number;\n    cost: number;\n    user_count?: number;\n  }[];\n}\n\n// Request Types\n\n/**\n * Request payload for creating a new application\n */\nexport interface CreateAppRequest {\n  name: string;\n  description?: string;\n  webhook_url?: string;\n}\n\n/**\n * Request payload for updating an existing application\n */\nexport interface UpdateAppRequest {\n  name?: string;\n  description?: string;\n  webhook_url?: string;\n  status?: 'active' | 'inactive';\n}\n\n/**\n * Request payload for creating a new meter\n */\nexport interface CreateMeterRequest {\n  name: string;\n  description?: string;\n  event_name: string;\n  aggregation_method: 'SUM' | 'COUNT' | 'UNIQUE_COUNT' | 'AVG' | 'MAX' | 'MIN';\n  aggregation_key?: string;\n  group_by?: string[];\n  price_per_unit: number;\n  currency: 'USD' | 'EUR' | 'GBP' | 'CNY';\n  billing_cycle: 'hourly' | 'daily' | 'weekly' | 'monthly';\n  app_id?: string;\n}\n\n/**\n * Request payload for updating an existing meter\n */\nexport interface UpdateMeterRequest {\n  name?: string;\n  description?: string;\n  aggregation_method?: 'SUM' | 'COUNT' | 'UNIQUE_COUNT' | 'AVG' | 'MAX' | 'MIN';\n  aggregation_key?: string;\n  group_by?: string[];\n  price_per_unit?: number;\n  currency?: 'USD' | 'EUR' | 'GBP' | 'CNY';\n  billing_cycle?: 'hourly' | 'daily' | 'weekly' | 'monthly';\n  status?: 'active' | 'inactive';\n}\n\n/**\n * Request payload for tracking a single event\n */\nexport interface CreateEventRequest {\n  event_name: string;\n  user_id?: string;\n  properties?: Record<string, any>;\n  value?: number;\n  timestamp?: string;\n}\n\n// Query Parameter Types\n\n/**\n * Query parameters for fetching events\n */\nexport interface EventsQueryParams {\n  app_id?: string;\n  event_name?: string;\n  user_id?: string;\n  start_date?: string;\n  end_date?: string;\n  page?: number;\n  limit?: number;\n}\n\n/**\n * Query parameters for fetching usage data\n */\nexport interface UsageQueryParams {\n  app_id: string;\n  meter_id?: string;\n  user_id?: string;\n  period_start?: string;\n  period_end?: string;\n  group_by?: string;\n}\n\n/**\n * Query parameters for fetching usage timeseries\n */\nexport interface UsageTimeSeriesParams {\n  meter_id: string;\n  interval?: 'hour' | 'day' | 'week' | 'month';\n  start_date?: string;\n  end_date?: string;\n}\n\n// Configuration Types\n\n/**\n * SDK configuration options\n */\nexport interface AgentMeterConfig {\n  apiKey: string;\n  baseUrl?: string;\n  timeout?: number;\n  retryAttempts?: number;\n  retryDelay?: number;\n  debug?: boolean;\n}\n\n// Error Types\n\n/**\n * Custom error class for AgentMeter API errors\n */\nexport class AgentMeterError extends Error {\n  public readonly code: string;\n  public readonly statusCode?: number;\n  public readonly details?: any;\n\n  constructor(message: string, code: string, statusCode?: number, details?: any) {\n    super(message);\n    this.name = 'AgentMeterError';\n    this.code = code;\n    this.statusCode = statusCode;\n    this.details = details;\n    \n    // Maintains proper stack trace for where our error was thrown (only available on V8)\n    if (Error.captureStackTrace) {\n      Error.captureStackTrace(this, AgentMeterError);\n    }\n  }\n}\n\n/**\n * Validation error for request parameters\n */\nexport class ValidationError extends AgentMeterError {\n  constructor(message: string, details?: any) {\n    super(message, 'VALIDATION_ERROR', 400, details);\n    this.name = 'ValidationError';\n  }\n}\n\n/**\n * Network error for connection issues\n */\nexport class NetworkError extends AgentMeterError {\n  constructor(message: string, details?: any) {\n    super(message, 'NETWORK_ERROR', undefined, details);\n    this.name = 'NetworkError';\n  }\n}","/**\n * HTTP utilities for AgentMeter SDK\n * HTTP request utilities with retry logic and error handling\n */\n\nimport { AgentMeterError, NetworkError } from '../types';\n\n/**\n * HTTP client configuration\n */\nexport interface HttpConfig {\n  baseUrl: string;\n  apiKey: string;\n  timeout: number;\n  retryAttempts: number;\n  retryDelay: number;\n  debug: boolean;\n}\n\n/**\n * HTTP response interface\n */\nexport interface HttpResponse<T = any> {\n  data: T;\n  status: number;\n  statusText: string;\n  headers: Record<string, string>;\n}\n\n/**\n * Sleep utility for retry delays\n */\nfunction sleep(ms: number): Promise<void> {\n  return new Promise(resolve => setTimeout(resolve, ms));\n}\n\n/**\n * Extract headers from Response object\n */\nfunction extractHeaders(response: Response): Record<string, string> {\n  const headers: Record<string, string> = {};\n  response.headers.forEach((value, key) => {\n    headers[key] = value;\n  });\n  return headers;\n}\n\n/**\n * HTTP client with automatic retries and error handling\n */\nexport class HttpClient {\n  private config: HttpConfig;\n\n  constructor(config: HttpConfig) {\n    this.config = config;\n  }\n\n  /**\n   * Make HTTP request with retries\n   */\n  async request<T>(\n    endpoint: string,\n    options: RequestInit = {}\n  ): Promise<HttpResponse<T>> {\n    const url = `${this.config.baseUrl}${endpoint}`;\n    let lastError: Error;\n\n    for (let attempt = 0; attempt <= this.config.retryAttempts; attempt++) {\n      try {\n        if (this.config.debug && attempt > 0) {\n          console.log(`AgentMeter SDK: Retry attempt ${attempt} for ${url}`);\n        }\n\n        const response = await this.makeRequest<T>(url, options);\n        \n        if (this.config.debug) {\n          console.log(`AgentMeter SDK: ${options.method || 'GET'} ${url} -> ${response.status}`);\n        }\n\n        return response;\n      } catch (error) {\n        lastError = error as Error;\n        \n        if (this.config.debug) {\n          console.error(`AgentMeter SDK: Request failed (attempt ${attempt + 1}):`, error);\n        }\n\n        // Don't retry for client errors (4xx) except 429 (rate limit)\n        if (error instanceof AgentMeterError && error.statusCode) {\n          if (error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429) {\n            throw error;\n          }\n        }\n\n        // Don't retry on the last attempt\n        if (attempt === this.config.retryAttempts) {\n          break;\n        }\n\n        // Calculate delay with exponential backoff\n        const delay = this.config.retryDelay * Math.pow(2, attempt);\n        await sleep(delay);\n      }\n    }\n\n    throw lastError!;\n  }\n\n  /**\n   * Make a single HTTP request\n   */\n  private async makeRequest<T>(\n    url: string,\n    options: RequestInit\n  ): Promise<HttpResponse<T>> {\n    const controller = new AbortController();\n    const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);\n\n    try {\n      const response = await fetch(url, {\n        ...options,\n        headers: {\n          'Authorization': `Bearer ${this.config.apiKey}`,\n          'Content-Type': 'application/json',\n          'User-Agent': 'AgentMeter-SDK-TypeScript/1.0.0',\n          ...options.headers,\n        },\n        signal: controller.signal,\n      });\n\n      clearTimeout(timeoutId);\n\n      const headers = extractHeaders(response);\n      let data: T;\n\n      try {\n        const responseText = await response.text();\n        data = responseText ? JSON.parse(responseText) : null;\n      } catch (parseError) {\n        throw new AgentMeterError(\n          'Failed to parse response JSON',\n          'PARSE_ERROR',\n          response.status,\n          { parseError }\n        );\n      }\n\n      if (!response.ok) {\n        // Try to extract error information from response\n        let errorCode = 'HTTP_ERROR';\n        let errorMessage = `HTTP ${response.status}: ${response.statusText}`;\n        let errorDetails = data;\n\n        if (data && typeof data === 'object') {\n          const errorData = data as any;\n          if (errorData.error) {\n            errorCode = errorData.error.code || errorCode;\n            errorMessage = errorData.error.message || errorMessage;\n            errorDetails = errorData.error.details || errorDetails;\n          }\n        }\n\n        throw new AgentMeterError(\n          errorMessage,\n          errorCode,\n          response.status,\n          errorDetails\n        );\n      }\n\n      return {\n        data,\n        status: response.status,\n        statusText: response.statusText,\n        headers,\n      };\n    } catch (error) {\n      clearTimeout(timeoutId);\n\n      if (error instanceof AgentMeterError) {\n        throw error;\n      }\n\n      if ((error as Error).name === 'AbortError') {\n        throw new NetworkError(\n          `Request timeout after ${this.config.timeout}ms`,\n          { timeout: this.config.timeout }\n        );\n      }\n\n      throw new NetworkError(\n        `Network request failed: ${(error as Error).message}`,\n        { originalError: error }\n      );\n    }\n  }\n\n  /**\n   * Helper method for GET requests\n   */\n  async get<T>(endpoint: string, params?: Record<string, any>): Promise<HttpResponse<T>> {\n    let url = endpoint;\n    if (params) {\n      const searchParams = new URLSearchParams();\n      Object.entries(params).forEach(([key, value]) => {\n        if (value !== undefined && value !== null) {\n          searchParams.append(key, String(value));\n        }\n      });\n      const queryString = searchParams.toString();\n      if (queryString) {\n        url += `?${queryString}`;\n      }\n    }\n\n    return this.request<T>(url, { method: 'GET' });\n  }\n\n  /**\n   * Helper method for POST requests\n   */\n  async post<T>(endpoint: string, body?: any): Promise<HttpResponse<T>> {\n    return this.request<T>(endpoint, {\n      method: 'POST',\n      body: body ? JSON.stringify(body) : undefined,\n    });\n  }\n\n  /**\n   * Helper method for PUT requests\n   */\n  async put<T>(endpoint: string, body?: any): Promise<HttpResponse<T>> {\n    return this.request<T>(endpoint, {\n      method: 'PUT',\n      body: body ? JSON.stringify(body) : undefined,\n    });\n  }\n\n  /**\n   * Helper method for DELETE requests\n   */\n  async delete<T>(endpoint: string): Promise<HttpResponse<T>> {\n    return this.request<T>(endpoint, { method: 'DELETE' });\n  }\n}","/**\n * Validation utilities for AgentMeter SDK\n */\n\nimport { ValidationError } from '../types';\nimport type {\n  CreateAppRequest,\n  CreateMeterRequest,\n  CreateEventRequest,\n  UpdateAppRequest,\n  UpdateMeterRequest,\n} from '../types';\n\n/**\n * Validates that a value is a non-empty string\n */\nexport function validateRequiredString(value: any, fieldName: string): void {\n  if (typeof value !== 'string' || value.trim().length === 0) {\n    throw new ValidationError(`${fieldName} must be a non-empty string`);\n  }\n}\n\n/**\n * Validates that a value is a positive number\n */\nexport function validatePositiveNumber(value: any, fieldName: string): void {\n  if (typeof value !== 'number' || value <= 0 || !isFinite(value)) {\n    throw new ValidationError(`${fieldName} must be a positive number`);\n  }\n}\n\n/**\n * Validates an email format\n */\nexport function validateEmail(email: string): boolean {\n  const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n  return emailRegex.test(email);\n}\n\n/**\n * Validates a URL format\n */\nexport function validateUrl(url: string): boolean {\n  try {\n    new URL(url);\n    return true;\n  } catch {\n    return false;\n  }\n}\n\n/**\n * Validates ISO date string format\n */\nexport function validateISODate(date: string): boolean {\n  const isoDateRegex = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3})?Z?$/;\n  return isoDateRegex.test(date) && !isNaN(Date.parse(date));\n}\n\n/**\n * Validates CreateAppRequest payload\n */\nexport function validateCreateAppRequest(request: CreateAppRequest): void {\n  validateRequiredString(request.name, 'name');\n  \n  if (request.webhook_url && !validateUrl(request.webhook_url)) {\n    throw new ValidationError('webhook_url must be a valid URL');\n  }\n}\n\n/**\n * Validates UpdateAppRequest payload\n */\nexport function validateUpdateAppRequest(request: UpdateAppRequest): void {\n  if (request.name !== undefined) {\n    validateRequiredString(request.name, 'name');\n  }\n  \n  if (request.webhook_url && !validateUrl(request.webhook_url)) {\n    throw new ValidationError('webhook_url must be a valid URL');\n  }\n  \n  if (request.status && !['active', 'inactive'].includes(request.status)) {\n    throw new ValidationError('status must be either \"active\" or \"inactive\"');\n  }\n}\n\n/**\n * Validates CreateMeterRequest payload\n */\nexport function validateCreateMeterRequest(request: CreateMeterRequest): void {\n  validateRequiredString(request.name, 'name');\n  validateRequiredString(request.event_name, 'event_name');\n  validatePositiveNumber(request.price_per_unit, 'price_per_unit');\n  \n  const validAggregationMethods = ['SUM', 'COUNT', 'UNIQUE_COUNT', 'AVG', 'MAX', 'MIN'];\n  if (!validAggregationMethods.includes(request.aggregation_method)) {\n    throw new ValidationError(`aggregation_method must be one of: ${validAggregationMethods.join(', ')}`);\n  }\n  \n  const validCurrencies = ['USD', 'EUR', 'GBP', 'CNY'];\n  if (!validCurrencies.includes(request.currency)) {\n    throw new ValidationError(`currency must be one of: ${validCurrencies.join(', ')}`);\n  }\n  \n  const validBillingCycles = ['hourly', 'daily', 'weekly', 'monthly'];\n  if (!validBillingCycles.includes(request.billing_cycle)) {\n    throw new ValidationError(`billing_cycle must be one of: ${validBillingCycles.join(', ')}`);\n  }\n  \n  // Validate aggregation_key is required for certain methods\n  if (['SUM', 'AVG', 'MAX', 'MIN'].includes(request.aggregation_method) && !request.aggregation_key) {\n    throw new ValidationError(`aggregation_key is required for aggregation_method: ${request.aggregation_method}`);\n  }\n}\n\n/**\n * Validates UpdateMeterRequest payload\n */\nexport function validateUpdateMeterRequest(request: UpdateMeterRequest): void {\n  if (request.name !== undefined) {\n    validateRequiredString(request.name, 'name');\n  }\n  \n  if (request.price_per_unit !== undefined) {\n    validatePositiveNumber(request.price_per_unit, 'price_per_unit');\n  }\n  \n  if (request.aggregation_method) {\n    const validAggregationMethods = ['SUM', 'COUNT', 'UNIQUE_COUNT', 'AVG', 'MAX', 'MIN'];\n    if (!validAggregationMethods.includes(request.aggregation_method)) {\n      throw new ValidationError(`aggregation_method must be one of: ${validAggregationMethods.join(', ')}`);\n    }\n  }\n  \n  if (request.currency) {\n    const validCurrencies = ['USD', 'EUR', 'GBP', 'CNY'];\n    if (!validCurrencies.includes(request.currency)) {\n      throw new ValidationError(`currency must be one of: ${validCurrencies.join(', ')}`);\n    }\n  }\n  \n  if (request.billing_cycle) {\n    const validBillingCycles = ['hourly', 'daily', 'weekly', 'monthly'];\n    if (!validBillingCycles.includes(request.billing_cycle)) {\n      throw new ValidationError(`billing_cycle must be one of: ${validBillingCycles.join(', ')}`);\n    }\n  }\n  \n  if (request.status && !['active', 'inactive'].includes(request.status)) {\n    throw new ValidationError('status must be either \"active\" or \"inactive\"');\n  }\n}\n\n/**\n * Validates CreateEventRequest payload\n */\nexport function validateCreateEventRequest(request: CreateEventRequest): void {\n  validateRequiredString(request.event_name, 'event_name');\n  \n  if (request.value !== undefined && (typeof request.value !== 'number' || !isFinite(request.value))) {\n    throw new ValidationError('value must be a finite number');\n  }\n  \n  if (request.timestamp && !validateISODate(request.timestamp)) {\n    throw new ValidationError('timestamp must be a valid ISO date string');\n  }\n  \n  if (request.properties && typeof request.properties !== 'object') {\n    throw new ValidationError('properties must be an object');\n  }\n}\n\n/**\n * Validates API key format\n */\nexport function validateApiKey(apiKey: string): void {\n  if (typeof apiKey !== 'string' || apiKey.trim().length === 0) {\n    throw new ValidationError('API key must be a non-empty string');\n  }\n  \n  // Basic format validation - you might want to adjust this based on actual key format\n  if (apiKey.length < 10) {\n    throw new ValidationError('API key appears to be too short');\n  }\n}\n\n/**\n * Validates pagination parameters\n */\nexport function validatePaginationParams(page?: number, limit?: number): void {\n  if (page !== undefined && (!Number.isInteger(page) || page < 1)) {\n    throw new ValidationError('page must be a positive integer');\n  }\n  \n  if (limit !== undefined && (!Number.isInteger(limit) || limit < 1 || limit > 1000)) {\n    throw new ValidationError('limit must be an integer between 1 and 1000');\n  }\n}","/**\n * AgentMeter SDK Main Client\n * Main client class providing all AgentMeter API functionality\n */\n\nimport { HttpClient } from './utils/http';\nimport { validateApiKey, validatePaginationParams } from './utils/validation';\nimport {\n  validateCreateAppRequest,\n  validateUpdateAppRequest,\n  validateCreateMeterRequest,\n  validateUpdateMeterRequest,\n  validateCreateEventRequest,\n} from './utils/validation';\n\nimport type {\n  AgentMeterConfig,\n  ApiResponse,\n  App,\n  Meter,\n  Event,\n  Usage,\n  UsageSummary,\n  UsageTimeSeries,\n  CreateAppRequest,\n  UpdateAppRequest,\n  CreateMeterRequest,\n  UpdateMeterRequest,\n  CreateEventRequest,\n  EventsQueryParams,\n  UsageQueryParams,\n  UsageTimeSeriesParams,\n} from './types';\n\n/**\n * Default configuration values\n */\nconst DEFAULT_CONFIG = {\n  baseUrl: 'https://tcwvgqbyyboxnbrsbchx.functions.supabase.co',\n  timeout: 30000, // 30 seconds\n  retryAttempts: 3,\n  retryDelay: 1000, // 1 second\n  debug: false,\n};\n\n/**\n * Main AgentMeter SDK client\n */\nexport class AgentMeterClient {\n  private httpClient: HttpClient;\n  private config: Required<AgentMeterConfig>;\n\n  /**\n   * Create a new AgentMeter client instance\n   * \n   * @param config - Configuration object containing API key and optional settings\n   */\n  constructor(config: AgentMeterConfig) {\n    validateApiKey(config.apiKey);\n\n    this.config = {\n      ...DEFAULT_CONFIG,\n      ...config,\n    };\n\n    this.httpClient = new HttpClient({\n      baseUrl: this.config.baseUrl,\n      apiKey: this.config.apiKey,\n      timeout: this.config.timeout,\n      retryAttempts: this.config.retryAttempts,\n      retryDelay: this.config.retryDelay,\n      debug: this.config.debug,\n    });\n  }\n\n  // ===================\n  // Apps API Methods\n  // ===================\n\n  /**\n   * Create a new application\n   */\n  async createApp(request: CreateAppRequest): Promise<ApiResponse<App>> {\n    validateCreateAppRequest(request);\n    const response = await this.httpClient.post<ApiResponse<App>>('/apps', request);\n    return response.data;\n  }\n\n  /**\n   * Get all applications\n   */\n  async getApps(): Promise<ApiResponse<App[]>> {\n    const response = await this.httpClient.get<ApiResponse<App[]>>('/apps');\n    return response.data;\n  }\n\n  /**\n   * Get a specific application by ID\n   */\n  async getApp(id: string): Promise<ApiResponse<App>> {\n    if (!id || typeof id !== 'string') {\n      throw new Error('App ID is required and must be a string');\n    }\n\n    const response = await this.httpClient.get<ApiResponse<App>>(`/apps/${id}`);\n    return response.data;\n  }\n\n  /**\n   * Update an existing application\n   */\n  async updateApp(id: string, request: UpdateAppRequest): Promise<ApiResponse<App>> {\n    if (!id || typeof id !== 'string') {\n      throw new Error('App ID is required and must be a string');\n    }\n\n    validateUpdateAppRequest(request);\n    const response = await this.httpClient.put<ApiResponse<App>>(`/apps/${id}`, request);\n    return response.data;\n  }\n\n  /**\n   * Delete an application\n   */\n  async deleteApp(id: string): Promise<ApiResponse<void>> {\n    if (!id || typeof id !== 'string') {\n      throw new Error('App ID is required and must be a string');\n    }\n\n    const response = await this.httpClient.delete<ApiResponse<void>>(`/apps/${id}`);\n    return response.data;\n  }\n\n  // ===================\n  // Meters API Methods\n  // ===================\n\n  /**\n   * Create a new meter\n   */\n  async createMeter(request: CreateMeterRequest): Promise<ApiResponse<Meter>> {\n    validateCreateMeterRequest(request);\n    const response = await this.httpClient.post<ApiResponse<Meter>>('/meters', request);\n    return response.data;\n  }\n\n  /**\n   * Get meters for a specific app\n   */\n  async getMeters(appId: string): Promise<ApiResponse<Meter[]>> {\n    if (!appId || typeof appId !== 'string') {\n      throw new Error('App ID is required and must be a string');\n    }\n\n    const response = await this.httpClient.get<ApiResponse<Meter[]>>('/meters', { app_id: appId });\n    return response.data;\n  }\n\n  /**\n   * Get a specific meter by ID with statistics\n   */\n  async getMeter(id: string): Promise<ApiResponse<Meter>> {\n    if (!id || typeof id !== 'string') {\n      throw new Error('Meter ID is required and must be a string');\n    }\n\n    const response = await this.httpClient.get<ApiResponse<Meter>>(`/meters/${id}`);\n    return response.data;\n  }\n\n  /**\n   * Update an existing meter\n   */\n  async updateMeter(id: string, request: UpdateMeterRequest): Promise<ApiResponse<Meter>> {\n    if (!id || typeof id !== 'string') {\n      throw new Error('Meter ID is required and must be a string');\n    }\n\n    validateUpdateMeterRequest(request);\n    const response = await this.httpClient.put<ApiResponse<Meter>>(`/meters/${id}`, request);\n    return response.data;\n  }\n\n  /**\n   * Delete a meter\n   */\n  async deleteMeter(id: string): Promise<ApiResponse<void>> {\n    if (!id || typeof id !== 'string') {\n      throw new Error('Meter ID is required and must be a string');\n    }\n\n    const response = await this.httpClient.delete<ApiResponse<void>>(`/meters/${id}`);\n    return response.data;\n  }\n\n  // ===================\n  // Events API Methods\n  // ===================\n\n  /**\n   * Track a single event\n   */\n  async trackEvent(request: CreateEventRequest): Promise<ApiResponse<Event>> {\n    validateCreateEventRequest(request);\n    const response = await this.httpClient.post<ApiResponse<Event>>('/events', request);\n    return response.data;\n  }\n\n  /**\n   * Track multiple events in batch\n   */\n  async trackEvents(events: CreateEventRequest[]): Promise<ApiResponse<Event[]>> {\n    if (!Array.isArray(events) || events.length === 0) {\n      throw new Error('Events array is required and must not be empty');\n    }\n\n    // Validate each event\n    events.forEach((event, index) => {\n      try {\n        validateCreateEventRequest(event);\n      } catch (error) {\n        throw new Error(`Event at index ${index} is invalid: ${(error as Error).message}`);\n      }\n    });\n\n    const response = await this.httpClient.post<ApiResponse<Event[]>>('/events/batch', { events });\n    return response.data;\n  }\n\n  /**\n   * Query events with filters\n   */\n  async getEvents(params: EventsQueryParams = {}): Promise<ApiResponse<Event[]>> {\n    validatePaginationParams(params.page, params.limit);\n\n    const response = await this.httpClient.get<ApiResponse<Event[]>>('/events', params);\n    return response.data;\n  }\n\n  // ===================\n  // Usage API Methods\n  // ===================\n\n  /**\n   * Get usage summary for billing\n   */\n  async getUsage(params: UsageQueryParams): Promise<ApiResponse<UsageSummary>> {\n    if (!params.app_id || typeof params.app_id !== 'string') {\n      throw new Error('app_id is required and must be a string');\n    }\n\n    const response = await this.httpClient.get<ApiResponse<UsageSummary>>('/usage', params);\n    return response.data;\n  }\n\n  /**\n   * Get usage data over time for analytics\n   */\n  async getUsageTimeSeries(params: UsageTimeSeriesParams): Promise<ApiResponse<UsageTimeSeries>> {\n    if (!params.meter_id || typeof params.meter_id !== 'string') {\n      throw new Error('meter_id is required and must be a string');\n    }\n\n    if (params.interval && !['hour', 'day', 'week', 'month'].includes(params.interval)) {\n      throw new Error('interval must be one of: hour, day, week, month');\n    }\n\n    const response = await this.httpClient.get<ApiResponse<UsageTimeSeries>>('/usage/timeseries', params);\n    return response.data;\n  }\n\n  // ===================\n  // Convenience Methods\n  // ===================\n\n  /**\n   * Quick method to track API calls with user info\n   */\n  async trackApiCall(\n    userId: string,\n    endpoint: string,\n    method: string = 'GET',\n    properties?: Record<string, any>\n  ): Promise<ApiResponse<Event>> {\n    return this.trackEvent({\n      event_name: 'api_call',\n      user_id: userId,\n      properties: {\n        endpoint,\n        method,\n        ...properties,\n      },\n      timestamp: new Date().toISOString(),\n    });\n  }\n\n  /**\n   * Quick method to track feature usage\n   */\n  async trackFeatureUsage(\n    userId: string,\n    featureName: string,\n    value: number = 1,\n    properties?: Record<string, any>\n  ): Promise<ApiResponse<Event>> {\n    return this.trackEvent({\n      event_name: 'feature_usage',\n      user_id: userId,\n      value,\n      properties: {\n        feature: featureName,\n        ...properties,\n      },\n      timestamp: new Date().toISOString(),\n    });\n  }\n\n  /**\n   * Get billing summary for a specific period\n   */\n  async getBillingSummary(\n    appId: string,\n    periodStart: string,\n    periodEnd: string,\n    groupByUser: boolean = false\n  ): Promise<ApiResponse<UsageSummary>> {\n    return this.getUsage({\n      app_id: appId,\n      period_start: periodStart,\n      period_end: periodEnd,\n      group_by: groupByUser ? 'user_id' : undefined,\n    });\n  }\n\n  /**\n   * Get current configuration\n   */\n  getConfig(): Readonly<Required<AgentMeterConfig>> {\n    return { ...this.config };\n  }\n\n  /**\n   * Update API key\n   */\n  updateApiKey(newApiKey: string): void {\n    validateApiKey(newApiKey);\n    this.config.apiKey = newApiKey;\n    this.httpClient = new HttpClient({\n      baseUrl: this.config.baseUrl,\n      apiKey: this.config.apiKey,\n      timeout: this.config.timeout,\n      retryAttempts: this.config.retryAttempts,\n      retryDelay: this.config.retryDelay,\n      debug: this.config.debug,\n    });\n  }\n}","/**\n * AgentMeter SDK for TypeScript\n * TypeScript SDK for AgentMeter usage-based billing API integration\n */\n\n// Export main client\nexport { AgentMeterClient } from './client';\n\n// Import types and classes for internal use\nimport type { AgentMeterConfig } from './types';\nimport { AgentMeterClient } from './client';\n\n// Export all types and interfaces\nexport type {\n  // Configuration\n  AgentMeterConfig,\n  \n  // Core entities\n  ApiResponse,\n  App,\n  Meter,\n  Event,\n  Usage,\n  UsageSummary,\n  UsageTimeSeries,\n  \n  // Request types\n  CreateAppRequest,\n  UpdateAppRequest,\n  CreateMeterRequest,\n  UpdateMeterRequest,\n  CreateEventRequest,\n  \n  // Query parameter types\n  EventsQueryParams,\n  UsageQueryParams,\n  UsageTimeSeriesParams,\n} from './types';\n\n// Export error classes\nexport {\n  AgentMeterError,\n  ValidationError,\n  NetworkError,\n} from './types';\n\n// Export validation utilities\nexport {\n  validateRequiredString,\n  validatePositiveNumber,\n  validateEmail,\n  validateUrl,\n  validateISODate,\n  validateApiKey,\n  validatePaginationParams,\n} from './utils/validation';\n\n// Export HTTP utilities (for advanced users)\nexport { HttpClient } from './utils/http';\nexport type { HttpConfig, HttpResponse } from './utils/http';\n\n/**\n * Create a new AgentMeter client instance with API key\n * \n * @param apiKey - Your AgentMeter API key\n * @param options - Optional configuration settings\n * @returns Configured AgentMeter client\n */\nexport function createClient(\n  apiKey: string,\n  options?: Omit<AgentMeterConfig, 'apiKey'>\n): AgentMeterClient {\n  return new AgentMeterClient({\n    apiKey,\n    ...options,\n  });\n}\n\n/**\n * Default export for convenience\n */\nexport default AgentMeterClient;\n\n// Version information\nexport const SDK_VERSION = '1.0.0';\nexport const SDK_NAME = 'agentmeter';\n\n/**\n * SDK Information\n */\nexport const SDK_INFO = {\n  name: SDK_NAME,\n  version: SDK_VERSION,\n  description: 'TypeScript SDK for AgentMeter usage-based billing API',\n  repository: 'https://github.com/agentmeter/agentmeter-sdk-typescript',\n  documentation: 'https://docs.agentmeter.com',\n} as const;"]}