{"version":3,"sources":["../src/index.ts","../package.json"],"sourcesContent":["import { version } from '../package.json';\n\nconst PACKAGE_NAME = '@iocium/throwaway-lookup';\nconst USER_AGENT = `${PACKAGE_NAME}/${version}`;\nconst BASE_URL = 'https://throwaway.cloud/api/v2/';\n\n/**\n * Optional settings for the lookup request.\n */\nexport interface LookupOptions {\n  /**\n   * Custom headers to include in the request.\n   * Note: `User-Agent` will always be overridden by the library.\n   */\n  headers?: Record<string, string>;\n}\n\n/**\n * Response returned from the throwaway.cloud API.\n */\nexport interface LookupResult {\n  /** Indicates the request succeeded. */\n  success: boolean;\n\n  /** Whether the subject is considered disposable. */\n  isDisposable?: boolean;\n\n  /** Any additional fields returned by the API. */\n  [key: string]: any;\n}\n\n/**\n * Looks up an email address or domain against the throwaway.cloud API.\n *\n * @param subject - The email address or domain to look up.\n * @param options - Optional request headers (excluding `User-Agent`).\n * @returns A promise resolving to the API response.\n * @throws If the subject is empty or the API returns a non-2xx response.\n */\nexport async function lookup(subject: string, options: LookupOptions = {}): Promise<LookupResult> {\n  if (!subject) {\n    throw new Error('Subject (email or domain) is required');\n  }\n\n  const headers = new Headers(options.headers || {});\n  headers.set('User-Agent', USER_AGENT);\n\n  const response = await fetch(`${BASE_URL}${encodeURIComponent(subject)}`, {\n    method: 'GET',\n    headers\n  });\n\n  if (!response.ok) {\n    throw new Error(`API error: ${response.status} ${response.statusText}`);\n  }\n\n  return await response.json();\n}\n","{\n  \"name\": \"@iocium/throwaway-lookup\",\n  \"version\": \"1.0.1\",\n  \"description\": \"Cross-platform client for throwaway.cloud API\",\n  \"main\": \"dist/index.js\",\n  \"module\": \"./dist/index.mjs\",\n  \"browser\": \"./dist/index.global.js\",\n  \"types\": \"dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"import\": \"./dist/index.js\",\n      \"require\": \"./dist/index.cjs\",\n      \"types\": \"./dist/index.d.ts\"\n    }\n  },\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"build:tsup\": \"tsup\",\n    \"test\": \"jest\",\n    \"test:coverage\": \"jest --coverage\",\n    \"docs\": \"typedoc\"\n  },\n  \"type\": \"module\",\n  \"keywords\": [\n    \"disposable\",\n    \"email\",\n    \"lookup\",\n    \"cloudflare\",\n    \"browser\",\n    \"node\"\n  ],\n  \"author\": \"Iocium\",\n  \"license\": \"MIT\",\n  \"devDependencies\": {\n    \"@types/jest\": \"^29.5.14\",\n    \"auto-changelog\": \"^2.5.0\",\n    \"jest\": \"^29.0.0\",\n    \"ts-jest\": \"^29.0.0\",\n    \"tsup\": \"^8.4.0\",\n    \"typedoc\": \"^0.28.4\",\n    \"typescript\": \"^5.8.3\"\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEE,cAAW;;;ADAb,IAAM,eAAe;AACrB,IAAM,aAAa,GAAG,YAAY,IAAI,OAAO;AAC7C,IAAM,WAAW;AAmCjB,eAAsB,OAAO,SAAiB,UAAyB,CAAC,GAA0B;AAChG,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,uCAAuC;AAAA,EACzD;AAEA,QAAM,UAAU,IAAI,QAAQ,QAAQ,WAAW,CAAC,CAAC;AACjD,UAAQ,IAAI,cAAc,UAAU;AAEpC,QAAM,WAAW,MAAM,MAAM,GAAG,QAAQ,GAAG,mBAAmB,OAAO,CAAC,IAAI;AAAA,IACxE,QAAQ;AAAA,IACR;AAAA,EACF,CAAC;AAED,MAAI,CAAC,SAAS,IAAI;AAChB,UAAM,IAAI,MAAM,cAAc,SAAS,MAAM,IAAI,SAAS,UAAU,EAAE;AAAA,EACxE;AAEA,SAAO,MAAM,SAAS,KAAK;AAC7B;","names":[]}