{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export interface HelixDBClient {\n  url: string;\n  apiKey: string | null;\n  /**\n   * Query the HelixDB API\n   * @param endpoint - The endpoint to query\n   * @param data - The data to send to the endpoint\n   * @returns The response from the endpoint\n   */\n  query: (endpoint: string, data: HelixDBInput) => Promise<HelixDBResponse>;\n}\n\nexport type HelixDBResponse = Record<string, any>;\nexport type HelixDBInput = Record<string, any>;\n\nexport class HelixDB implements HelixDBClient {\n  url: string;\n  apiKey: string | null;\n  /**\n   * Create a new HelixDB client\n   * @param url - The url of the HelixDB server (default: `http://localhost:6969`)\n   * @param apiKey - The api key of the HelixDB server (default: `null`)\n   */\n  constructor(url: string = \"http://localhost:6969\", apiKey: string | null = null) {\n    this.url = url;\n    this.apiKey = apiKey;\n  }\n\n  async query(endpoint: string, data: HelixDBInput): Promise<HelixDBResponse> {\n    const response = await fetch(`${this.url}/${endpoint}`, {\n      method: \"POST\",\n      headers: {\n        \"Content-Type\": \"application/json\",\n        ...(this.apiKey ? { \"x-api-key\": this.apiKey } : {}),\n      },\n      body: JSON.stringify(data),\n    });\n    return response.json();\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeO,IAAM,UAAN,MAAuC;AAAA,EAC5C;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,YAAY,MAAc,yBAAyB,SAAwB,MAAM;AAC/E,SAAK,MAAM;AACX,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,MAAM,MAAM,UAAkB,MAA8C;AAC1E,UAAM,WAAW,MAAM,MAAM,GAAG,KAAK,GAAG,IAAI,QAAQ,IAAI;AAAA,MACtD,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,gBAAgB;AAAA,QAChB,GAAI,KAAK,SAAS,EAAE,aAAa,KAAK,OAAO,IAAI,CAAC;AAAA,MACpD;AAAA,MACA,MAAM,KAAK,UAAU,IAAI;AAAA,IAC3B,CAAC;AACD,WAAO,SAAS,KAAK;AAAA,EACvB;AACF;","names":[]}