@fhirfly-io/terminology 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +213 -0
- package/dist/index.cjs +718 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +991 -0
- package/dist/index.d.ts +991 -0
- package/dist/index.js +706 -0
- package/dist/index.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts","../src/http.ts","../src/endpoints/ndc.ts","../src/endpoints/npi.ts","../src/endpoints/rxnorm.ts","../src/endpoints/loinc.ts","../src/endpoints/icd10.ts","../src/endpoints/cvx.ts","../src/endpoints/mvx.ts","../src/endpoints/fda-labels.ts","../src/client.ts"],"names":[],"mappings":";;;AAGO,IAAM,YAAA,GAAN,MAAM,aAAA,SAAqB,KAAA,CAAM;AAAA,EACtC,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,cAAA;AACZ,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,aAAA,CAAa,SAAS,CAAA;AAAA,EACpD;AACF;AAKO,IAAM,QAAA,GAAN,MAAM,SAAA,SAAiB,YAAA,CAAa;AAAA,EAChC,UAAA;AAAA,EACA,IAAA;AAAA,EACA,OAAA;AAAA,EAET,WAAA,CACE,OAAA,EACA,UAAA,EACA,IAAA,EACA,OAAA,EACA;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,UAAA;AACZ,IAAA,IAAA,CAAK,UAAA,GAAa,UAAA;AAClB,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AACZ,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AACf,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,SAAA,CAAS,SAAS,CAAA;AAAA,EAChD;AAC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AA,CAAO,OAAA;AAAA,MAChB,YAAY,MAAA,CAAO,UAAA;AAAA,MACnB,YAAY,MAAA,CAAO;AAAA,KACrB;AAEA,IAAA,IAAA,CAAK,IAAA,GAAO,IAAI,UAAA,CAAW,UAAU,CAAA;AAGrC,IAAA,IAAA,CAAK,GAAA,GAAM,IAAI,WAAA,CAAY,IAAA,CAAK,IAAI,CAAA;AACpC,IAAA,IAAA,CAAK,GAAA,GAAM,IAAI,WAAA,CAAY,IAAA,CAAK,IAAI,CAAA;AACpC,IAAA,IAAA,CAAK,MAAA,GAAS,IAAI,cAAA,CAAe,IAAA,CAAK,IAAI,CAAA;AAC1C,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAI,aAAA,CAAc,IAAA,CAAK,IAAI,CAAA;AACxC,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAI,aAAA,CAAc,IAAA,CAAK,IAAI,CAAA;AACxC,IAAA,IAAA,CAAK,GAAA,GAAM,IAAI,WAAA,CAAY,IAAA,CAAK,IAAI,CAAA;AACpC,IAAA,IAAA,CAAK,GAAA,GAAM,IAAI,WAAA,CAAY,IAAA,CAAK,IAAI,CAAA;AACpC,IAAA,IAAA,CAAK,SAAA,GAAY,IAAI,iBAAA,CAAkB,IAAA,CAAK,IAAI,CAAA;AAAA,EAClD;AACF","file":"index.cjs","sourcesContent":["/**\n * Base error class for all FHIRfly SDK errors.\n */\nexport class FhirflyError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"FhirflyError\";\n Object.setPrototypeOf(this, FhirflyError.prototype);\n }\n}\n\n/**\n * Error thrown when the API returns an error response.\n */\nexport class ApiError extends FhirflyError {\n readonly statusCode: number;\n readonly code?: string;\n readonly details?: unknown;\n\n constructor(\n message: string,\n statusCode: number,\n code?: string,\n details?: unknown\n ) {\n super(message);\n this.name = \"ApiError\";\n this.statusCode = statusCode;\n this.code = code;\n this.details = details;\n Object.setPrototypeOf(this, ApiError.prototype);\n }\n}\n\n/**\n * Error thrown when authentication fails (401).\n */\nexport class AuthenticationError extends ApiError {\n constructor(message = \"Authentication failed. Check your API key.\") {\n super(message, 401, \"AUTHENTICATION_ERROR\");\n this.name = \"AuthenticationError\";\n Object.setPrototypeOf(this, AuthenticationError.prototype);\n }\n}\n\n/**\n * Error thrown when a resource is not found (404).\n */\nexport class NotFoundError extends ApiError {\n readonly code_type: string;\n readonly code_value: string;\n\n constructor(codeType: string, codeValue: string) {\n super(`${codeType} not found: ${codeValue}`, 404, \"NOT_FOUND\");\n this.name = \"NotFoundError\";\n this.code_type = codeType;\n this.code_value = codeValue;\n Object.setPrototypeOf(this, NotFoundError.prototype);\n }\n}\n\n/**\n * Error thrown when the request is invalid (400).\n */\nexport class ValidationError extends ApiError {\n readonly field?: string;\n\n constructor(message: string, field?: string) {\n super(message, 400, \"VALIDATION_ERROR\");\n this.name = \"ValidationError\";\n this.field = field;\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n\n/**\n * Error thrown when rate limited (429).\n */\nexport class RateLimitError extends ApiError {\n readonly retryAfter?: number;\n readonly limit?: number;\n readonly remaining?: number;\n readonly reset?: Date;\n\n constructor(\n message = \"Rate limit exceeded\",\n retryAfter?: number,\n limit?: number,\n remaining?: number,\n reset?: Date\n ) {\n super(message, 429, \"RATE_LIMIT_EXCEEDED\");\n this.name = \"RateLimitError\";\n this.retryAfter = retryAfter;\n this.limit = limit;\n this.remaining = remaining;\n this.reset = reset;\n Object.setPrototypeOf(this, RateLimitError.prototype);\n }\n}\n\n/**\n * Error thrown when quota is exceeded (429 with quota context).\n */\nexport class QuotaExceededError extends ApiError {\n readonly quotaLimit?: number;\n readonly quotaUsed?: number;\n readonly quotaResetDate?: Date;\n\n constructor(\n message = \"Monthly quota exceeded\",\n quotaLimit?: number,\n quotaUsed?: number,\n quotaResetDate?: Date\n ) {\n super(message, 429, \"QUOTA_EXCEEDED\");\n this.name = \"QuotaExceededError\";\n this.quotaLimit = quotaLimit;\n this.quotaUsed = quotaUsed;\n this.quotaResetDate = quotaResetDate;\n Object.setPrototypeOf(this, QuotaExceededError.prototype);\n }\n}\n\n/**\n * Error thrown when the server returns a 5xx error.\n */\nexport class ServerError extends ApiError {\n constructor(message = \"Server error\", statusCode = 500) {\n super(message, statusCode, \"SERVER_ERROR\");\n this.name = \"ServerError\";\n Object.setPrototypeOf(this, ServerError.prototype);\n }\n}\n\n/**\n * Error thrown when a network error occurs.\n */\nexport class NetworkError extends FhirflyError {\n readonly cause?: Error;\n\n constructor(message = \"Network error\", cause?: Error) {\n super(message);\n this.name = \"NetworkError\";\n this.cause = cause;\n Object.setPrototypeOf(this, NetworkError.prototype);\n }\n}\n\n/**\n * Error thrown when a request times out.\n */\nexport class TimeoutError extends FhirflyError {\n readonly timeoutMs: number;\n\n constructor(timeoutMs: number) {\n super(`Request timed out after ${timeoutMs}ms`);\n this.name = \"TimeoutError\";\n this.timeoutMs = timeoutMs;\n Object.setPrototypeOf(this, TimeoutError.prototype);\n }\n}\n","import {\n ApiError,\n AuthenticationError,\n NetworkError,\n NotFoundError,\n QuotaExceededError,\n RateLimitError,\n ServerError,\n TimeoutError,\n ValidationError,\n} from \"./errors.js\";\nimport type { LookupOptions } from \"./types/common.js\";\n\n/**\n * HTTP client configuration.\n */\nexport interface HttpClientConfig {\n baseUrl: string;\n apiKey: string;\n timeout?: number;\n maxRetries?: number;\n retryDelay?: number;\n userAgent?: string;\n}\n\n/**\n * HTTP response from the API.\n */\ninterface HttpResponse<T> {\n data: T;\n status: number;\n headers: Headers;\n}\n\n/**\n * Internal HTTP client for making API requests.\n */\nexport class HttpClient {\n private readonly config: Required<HttpClientConfig>;\n\n constructor(config: HttpClientConfig) {\n this.config = {\n baseUrl: config.baseUrl,\n apiKey: config.apiKey,\n timeout: config.timeout ?? 30000,\n maxRetries: config.maxRetries ?? 3,\n retryDelay: config.retryDelay ?? 1000,\n userAgent: config.userAgent ?? `@fhirfly/sdk/0.1.0 Node.js/${process.version}`,\n };\n }\n\n /**\n * Build query string from options.\n */\n private buildQueryString(options?: LookupOptions): string {\n if (!options) return \"\";\n\n const params = new URLSearchParams();\n\n if (options.shape) {\n params.set(\"shape\", options.shape);\n }\n\n if (options.include?.length) {\n params.set(\"include\", options.include.join(\",\"));\n }\n\n const queryString = params.toString();\n return queryString ? `?${queryString}` : \"\";\n }\n\n /**\n * Parse error response from API.\n */\n private async parseErrorResponse(\n response: Response,\n endpoint: string\n ): Promise<never> {\n const status = response.status;\n let body: { message?: string; code?: string; error?: string; details?: unknown } = {};\n\n try {\n body = await response.json() as typeof body;\n } catch {\n // Response body is not JSON\n }\n\n const message = body.message || body.error || response.statusText;\n\n // Handle specific status codes\n switch (status) {\n case 401:\n throw new AuthenticationError(message);\n\n case 404: {\n // Extract code type and value from endpoint\n const match = endpoint.match(/\\/v1\\/(\\w+)\\/(.+)/);\n if (match) {\n throw new NotFoundError(match[1]!.toUpperCase(), match[2]!);\n }\n throw new NotFoundError(\"Resource\", endpoint);\n }\n\n case 400:\n throw new ValidationError(message);\n\n case 429: {\n const retryAfter = response.headers.get(\"retry-after\");\n const limit = response.headers.get(\"x-ratelimit-limit\");\n const remaining = response.headers.get(\"x-ratelimit-remaining\");\n const reset = response.headers.get(\"x-ratelimit-reset\");\n\n // Check if it's a quota error vs rate limit\n if (body.code === \"QUOTA_EXCEEDED\") {\n throw new QuotaExceededError(message);\n }\n\n throw new RateLimitError(\n message,\n retryAfter ? parseInt(retryAfter, 10) : undefined,\n limit ? parseInt(limit, 10) : undefined,\n remaining ? parseInt(remaining, 10) : undefined,\n reset ? new Date(parseInt(reset, 10) * 1000) : undefined\n );\n }\n\n default:\n if (status >= 500) {\n throw new ServerError(message, status);\n }\n throw new ApiError(message, status, body.code, body.details);\n }\n }\n\n /**\n * Sleep for a given number of milliseconds.\n */\n private sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n\n /**\n * Make an HTTP request with retries.\n */\n private async request<T>(\n method: \"GET\" | \"POST\",\n endpoint: string,\n body?: unknown\n ): Promise<HttpResponse<T>> {\n const url = `${this.config.baseUrl}${endpoint}`;\n let lastError: Error | undefined;\n\n for (let attempt = 0; attempt <= this.config.maxRetries; attempt++) {\n try {\n const controller = new AbortController();\n const timeoutId = setTimeout(\n () => controller.abort(),\n this.config.timeout\n );\n\n const response = await fetch(url, {\n method,\n headers: {\n \"Authorization\": `Bearer ${this.config.apiKey}`,\n \"Content-Type\": \"application/json\",\n \"User-Agent\": this.config.userAgent,\n \"Accept\": \"application/json\",\n },\n body: body ? JSON.stringify(body) : undefined,\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n\n if (!response.ok) {\n // Don't retry client errors (except rate limits)\n if (response.status < 500 && response.status !== 429) {\n await this.parseErrorResponse(response, endpoint);\n }\n\n // For rate limits, check retry-after header\n if (response.status === 429) {\n const retryAfter = response.headers.get(\"retry-after\");\n if (retryAfter && attempt < this.config.maxRetries) {\n await this.sleep(parseInt(retryAfter, 10) * 1000);\n continue;\n }\n await this.parseErrorResponse(response, endpoint);\n }\n\n // Retry server errors\n if (attempt < this.config.maxRetries) {\n await this.sleep(this.config.retryDelay * Math.pow(2, attempt));\n continue;\n }\n\n await this.parseErrorResponse(response, endpoint);\n }\n\n const data = await response.json() as T;\n return { data, status: response.status, headers: response.headers };\n } catch (error) {\n if (error instanceof ApiError) {\n throw error;\n }\n\n if (error instanceof Error) {\n if (error.name === \"AbortError\") {\n throw new TimeoutError(this.config.timeout);\n }\n\n lastError = error;\n\n // Retry on network errors\n if (attempt < this.config.maxRetries) {\n await this.sleep(this.config.retryDelay * Math.pow(2, attempt));\n continue;\n }\n }\n\n throw new NetworkError(\n lastError?.message || \"Unknown network error\",\n lastError\n );\n }\n }\n\n throw new NetworkError(\n lastError?.message || \"Request failed after retries\",\n lastError\n );\n }\n\n /**\n * Make a GET request.\n */\n async get<T>(endpoint: string, options?: LookupOptions): Promise<T> {\n const queryString = this.buildQueryString(options);\n const response = await this.request<T>(\"GET\", `${endpoint}${queryString}`);\n return response.data;\n }\n\n /**\n * Make a POST request.\n */\n async post<T>(endpoint: string, body: unknown, options?: LookupOptions): Promise<T> {\n const queryString = this.buildQueryString(options);\n const response = await this.request<T>(\"POST\", `${endpoint}${queryString}`, body);\n return response.data;\n }\n}\n","import type { HttpClient } from \"../http.js\";\nimport type {\n ApiResponse,\n BatchResponse,\n LookupOptions,\n BatchLookupOptions,\n} from \"../types/common.js\";\nimport type { NdcData } from \"../types/ndc.js\";\n\n/**\n * NDC (National Drug Code) API endpoint.\n */\nexport class NdcEndpoint {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Look up a single NDC code.\n *\n * @param code - NDC code (10-digit, 11-digit, or hyphenated format)\n * @param options - Response shape and include options\n * @returns NDC data\n *\n * @example\n * ```ts\n * const ndc = await client.ndc.lookup(\"0069-0151-01\");\n * console.log(ndc.data.product_name); // \"Lipitor\"\n * ```\n */\n async lookup(code: string, options?: LookupOptions): Promise<ApiResponse<NdcData>> {\n return this.http.get<ApiResponse<NdcData>>(`/v1/ndc/${encodeURIComponent(code)}`, options);\n }\n\n /**\n * Look up multiple NDC codes in a single request.\n *\n * @param codes - Array of NDC codes (max 500)\n * @param options - Response shape, include, and batch options\n * @returns Batch response with results for each code\n *\n * @example\n * ```ts\n * const results = await client.ndc.lookupMany([\n * \"0069-0151-01\",\n * \"0069-0151-02\",\n * \"invalid-code\"\n * ]);\n *\n * for (const item of results.results) {\n * if (item.found) {\n * console.log(item.data.product_name);\n * } else {\n * console.log(`Not found: ${item.code}`);\n * }\n * }\n * ```\n */\n async lookupMany(\n codes: string[],\n options?: BatchLookupOptions\n ): Promise<BatchResponse<NdcData>> {\n return this.http.post<BatchResponse<NdcData>>(\n \"/v1/ndc/_batch\",\n { codes },\n options\n );\n }\n}\n","import type { HttpClient } from \"../http.js\";\nimport type {\n ApiResponse,\n BatchResponse,\n LookupOptions,\n BatchLookupOptions,\n} from \"../types/common.js\";\nimport type { NpiData } from \"../types/npi.js\";\n\n/**\n * NPI (National Provider Identifier) API endpoint.\n */\nexport class NpiEndpoint {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Look up a single NPI.\n *\n * @param npi - 10-digit NPI number\n * @param options - Response shape and include options\n * @returns NPI data\n *\n * @example\n * ```ts\n * const npi = await client.npi.lookup(\"1234567890\");\n * console.log(npi.data.name);\n * ```\n */\n async lookup(npi: string, options?: LookupOptions): Promise<ApiResponse<NpiData>> {\n return this.http.get<ApiResponse<NpiData>>(`/v1/npi/${encodeURIComponent(npi)}`, options);\n }\n\n /**\n * Look up multiple NPIs in a single request.\n *\n * @param npis - Array of 10-digit NPI numbers (max 500)\n * @param options - Response shape, include, and batch options\n * @returns Batch response with results for each NPI\n *\n * @example\n * ```ts\n * const results = await client.npi.lookupMany([\n * \"1234567890\",\n * \"0987654321\"\n * ]);\n * ```\n */\n async lookupMany(\n npis: string[],\n options?: BatchLookupOptions\n ): Promise<BatchResponse<NpiData>> {\n return this.http.post<BatchResponse<NpiData>>(\n \"/v1/npi/_batch\",\n { codes: npis },\n options\n );\n }\n}\n","import type { HttpClient } from \"../http.js\";\nimport type {\n ApiResponse,\n BatchResponse,\n LookupOptions,\n BatchLookupOptions,\n} from \"../types/common.js\";\nimport type { RxNormData } from \"../types/rxnorm.js\";\n\n/**\n * RxNorm API endpoint.\n */\nexport class RxNormEndpoint {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Look up a single RxCUI.\n *\n * @param rxcui - RxNorm Concept Unique Identifier\n * @param options - Response shape and include options\n * @returns RxNorm data\n *\n * @example\n * ```ts\n * const rx = await client.rxnorm.lookup(\"213169\");\n * console.log(rx.data.name); // \"atorvastatin 10 MG Oral Tablet\"\n * ```\n */\n async lookup(rxcui: string, options?: LookupOptions): Promise<ApiResponse<RxNormData>> {\n return this.http.get<ApiResponse<RxNormData>>(`/v1/rxnorm/${encodeURIComponent(rxcui)}`, options);\n }\n\n /**\n * Look up multiple RxCUIs in a single request.\n *\n * @param rxcuis - Array of RxCUIs (max 500)\n * @param options - Response shape, include, and batch options\n * @returns Batch response with results for each RxCUI\n */\n async lookupMany(\n rxcuis: string[],\n options?: BatchLookupOptions\n ): Promise<BatchResponse<RxNormData>> {\n return this.http.post<BatchResponse<RxNormData>>(\n \"/v1/rxnorm/_batch\",\n { codes: rxcuis },\n options\n );\n }\n}\n","import type { HttpClient } from \"../http.js\";\nimport type {\n ApiResponse,\n BatchResponse,\n LookupOptions,\n BatchLookupOptions,\n} from \"../types/common.js\";\nimport type { LoincData } from \"../types/loinc.js\";\n\n/**\n * LOINC API endpoint.\n */\nexport class LoincEndpoint {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Look up a single LOINC code.\n *\n * @param loincNum - LOINC number (e.g., \"2345-7\")\n * @param options - Response shape and include options\n * @returns LOINC data\n *\n * @example\n * ```ts\n * const loinc = await client.loinc.lookup(\"2345-7\");\n * console.log(loinc.data.long_common_name); // \"Glucose [Mass/volume] in Serum or Plasma\"\n * ```\n */\n async lookup(loincNum: string, options?: LookupOptions): Promise<ApiResponse<LoincData>> {\n return this.http.get<ApiResponse<LoincData>>(`/v1/loinc/${encodeURIComponent(loincNum)}`, options);\n }\n\n /**\n * Look up multiple LOINC codes in a single request.\n *\n * @param loincNums - Array of LOINC numbers (max 500)\n * @param options - Response shape, include, and batch options\n * @returns Batch response with results for each LOINC\n */\n async lookupMany(\n loincNums: string[],\n options?: BatchLookupOptions\n ): Promise<BatchResponse<LoincData>> {\n return this.http.post<BatchResponse<LoincData>>(\n \"/v1/loinc/_batch\",\n { codes: loincNums },\n options\n );\n }\n}\n","import type { HttpClient } from \"../http.js\";\nimport type {\n ApiResponse,\n BatchResponse,\n LookupOptions,\n BatchLookupOptions,\n} from \"../types/common.js\";\nimport type { Icd10Data } from \"../types/icd10.js\";\n\n/**\n * ICD-10 API endpoint.\n */\nexport class Icd10Endpoint {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Look up a single ICD-10-CM code (diagnoses).\n *\n * @param code - ICD-10-CM code (e.g., \"E11.9\")\n * @param options - Response shape and include options\n * @returns ICD-10 data\n *\n * @example\n * ```ts\n * const icd = await client.icd10.lookupCm(\"E11.9\");\n * console.log(icd.data.description); // \"Type 2 diabetes mellitus without complications\"\n * ```\n */\n async lookupCm(code: string, options?: LookupOptions): Promise<ApiResponse<Icd10Data>> {\n return this.http.get<ApiResponse<Icd10Data>>(`/v1/icd10/cm/${encodeURIComponent(code)}`, options);\n }\n\n /**\n * Look up a single ICD-10-PCS code (procedures).\n *\n * @param code - ICD-10-PCS code (e.g., \"0BJ08ZZ\")\n * @param options - Response shape and include options\n * @returns ICD-10 data\n *\n * @example\n * ```ts\n * const icd = await client.icd10.lookupPcs(\"0BJ08ZZ\");\n * console.log(icd.data.description);\n * ```\n */\n async lookupPcs(code: string, options?: LookupOptions): Promise<ApiResponse<Icd10Data>> {\n return this.http.get<ApiResponse<Icd10Data>>(`/v1/icd10/pcs/${encodeURIComponent(code)}`, options);\n }\n\n /**\n * Look up multiple ICD-10-CM codes in a single request.\n *\n * @param codes - Array of ICD-10-CM codes (max 500)\n * @param options - Response shape, include, and batch options\n * @returns Batch response with results for each code\n */\n async lookupCmMany(\n codes: string[],\n options?: BatchLookupOptions\n ): Promise<BatchResponse<Icd10Data>> {\n return this.http.post<BatchResponse<Icd10Data>>(\n \"/v1/icd10/cm/_batch\",\n { codes },\n options\n );\n }\n\n /**\n * Look up multiple ICD-10-PCS codes in a single request.\n *\n * @param codes - Array of ICD-10-PCS codes (max 500)\n * @param options - Response shape, include, and batch options\n * @returns Batch response with results for each code\n */\n async lookupPcsMany(\n codes: string[],\n options?: BatchLookupOptions\n ): Promise<BatchResponse<Icd10Data>> {\n return this.http.post<BatchResponse<Icd10Data>>(\n \"/v1/icd10/pcs/_batch\",\n { codes },\n options\n );\n }\n}\n","import type { HttpClient } from \"../http.js\";\nimport type {\n ApiResponse,\n BatchResponse,\n LookupOptions,\n BatchLookupOptions,\n} from \"../types/common.js\";\nimport type { CvxData } from \"../types/cvx.js\";\n\n/**\n * CVX (Vaccine Codes) API endpoint.\n */\nexport class CvxEndpoint {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Look up a single CVX code.\n *\n * @param cvxCode - CVX vaccine code\n * @param options - Response shape and include options\n * @returns CVX data\n *\n * @example\n * ```ts\n * const cvx = await client.cvx.lookup(\"208\");\n * console.log(cvx.data.short_description); // \"COVID-19, mRNA, LNP-S, PF, 30 mcg/0.3 mL dose\"\n * ```\n */\n async lookup(cvxCode: string, options?: LookupOptions): Promise<ApiResponse<CvxData>> {\n return this.http.get<ApiResponse<CvxData>>(`/v1/cvx/${encodeURIComponent(cvxCode)}`, options);\n }\n\n /**\n * Look up multiple CVX codes in a single request.\n *\n * @param cvxCodes - Array of CVX codes (max 500)\n * @param options - Response shape, include, and batch options\n * @returns Batch response with results for each code\n */\n async lookupMany(\n cvxCodes: string[],\n options?: BatchLookupOptions\n ): Promise<BatchResponse<CvxData>> {\n return this.http.post<BatchResponse<CvxData>>(\n \"/v1/cvx/_batch\",\n { codes: cvxCodes },\n options\n );\n }\n}\n","import type { HttpClient } from \"../http.js\";\nimport type {\n ApiResponse,\n BatchResponse,\n LookupOptions,\n BatchLookupOptions,\n} from \"../types/common.js\";\nimport type { MvxData } from \"../types/mvx.js\";\n\n/**\n * MVX (Vaccine Manufacturer Codes) API endpoint.\n */\nexport class MvxEndpoint {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Look up a single MVX code.\n *\n * @param mvxCode - MVX manufacturer code\n * @param options - Response shape and include options\n * @returns MVX data\n *\n * @example\n * ```ts\n * const mvx = await client.mvx.lookup(\"PFR\");\n * console.log(mvx.data.manufacturer_name); // \"Pfizer, Inc\"\n * ```\n */\n async lookup(mvxCode: string, options?: LookupOptions): Promise<ApiResponse<MvxData>> {\n return this.http.get<ApiResponse<MvxData>>(`/v1/mvx/${encodeURIComponent(mvxCode)}`, options);\n }\n\n /**\n * Look up multiple MVX codes in a single request.\n *\n * @param mvxCodes - Array of MVX codes (max 500)\n * @param options - Response shape, include, and batch options\n * @returns Batch response with results for each code\n */\n async lookupMany(\n mvxCodes: string[],\n options?: BatchLookupOptions\n ): Promise<BatchResponse<MvxData>> {\n return this.http.post<BatchResponse<MvxData>>(\n \"/v1/mvx/_batch\",\n { codes: mvxCodes },\n options\n );\n }\n}\n","import type { HttpClient } from \"../http.js\";\nimport type {\n ApiResponse,\n BatchResponse,\n LookupOptions,\n BatchLookupOptions,\n} from \"../types/common.js\";\nimport type { FdaLabelData } from \"../types/fda-labels.js\";\n\n/**\n * FDA Labels API endpoint.\n */\nexport class FdaLabelsEndpoint {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Look up FDA label by Set ID.\n *\n * @param setId - FDA SPL Set ID\n * @param options - Response shape and include options\n * @returns FDA Label data\n *\n * @example\n * ```ts\n * const label = await client.fdaLabels.lookup(\"abc123-def456\");\n * console.log(label.data.indications_and_usage);\n * ```\n */\n async lookup(setId: string, options?: LookupOptions): Promise<ApiResponse<FdaLabelData>> {\n return this.http.get<ApiResponse<FdaLabelData>>(`/v1/fda-labels/${encodeURIComponent(setId)}`, options);\n }\n\n /**\n * Look up FDA label by NDC code.\n *\n * @param ndc - NDC code\n * @param options - Response shape and include options\n * @returns FDA Label data\n *\n * @example\n * ```ts\n * const label = await client.fdaLabels.lookupByNdc(\"0069-0151-01\");\n * console.log(label.data.product_name);\n * ```\n */\n async lookupByNdc(ndc: string, options?: LookupOptions): Promise<ApiResponse<FdaLabelData>> {\n return this.http.get<ApiResponse<FdaLabelData>>(`/v1/fda-labels/ndc/${encodeURIComponent(ndc)}`, options);\n }\n\n /**\n * Look up multiple FDA labels by Set IDs in a single request.\n *\n * @param setIds - Array of Set IDs (max 500)\n * @param options - Response shape, include, and batch options\n * @returns Batch response with results for each Set ID\n */\n async lookupMany(\n setIds: string[],\n options?: BatchLookupOptions\n ): Promise<BatchResponse<FdaLabelData>> {\n return this.http.post<BatchResponse<FdaLabelData>>(\n \"/v1/fda-labels/_batch\",\n { codes: setIds },\n options\n );\n }\n}\n","import { HttpClient, type HttpClientConfig } from \"./http.js\";\nimport { NdcEndpoint } from \"./endpoints/ndc.js\";\nimport { NpiEndpoint } from \"./endpoints/npi.js\";\nimport { RxNormEndpoint } from \"./endpoints/rxnorm.js\";\nimport { LoincEndpoint } from \"./endpoints/loinc.js\";\nimport { Icd10Endpoint } from \"./endpoints/icd10.js\";\nimport { CvxEndpoint } from \"./endpoints/cvx.js\";\nimport { MvxEndpoint } from \"./endpoints/mvx.js\";\nimport { FdaLabelsEndpoint } from \"./endpoints/fda-labels.js\";\n\n/**\n * Configuration options for the FHIRfly client.\n */\nexport interface FhirflyConfig {\n /**\n * Your FHIRfly API key.\n * Get one at https://fhirfly.io/dashboard\n */\n apiKey: string;\n\n /**\n * Base URL for the API.\n * @default \"https://api.fhirfly.io\"\n */\n baseUrl?: string;\n\n /**\n * Request timeout in milliseconds.\n * @default 30000\n */\n timeout?: number;\n\n /**\n * Maximum number of retry attempts for failed requests.\n * @default 3\n */\n maxRetries?: number;\n\n /**\n * Base delay between retries in milliseconds (exponential backoff).\n * @default 1000\n */\n retryDelay?: number;\n}\n\n/**\n * FHIRfly API client.\n *\n * Provides access to healthcare reference data including drug codes (NDC, RxNorm),\n * provider identifiers (NPI), lab codes (LOINC), diagnosis codes (ICD-10),\n * vaccine codes (CVX, MVX), and FDA drug labels.\n *\n * @example\n * ```ts\n * import { Fhirfly } from \"@fhirfly/sdk\";\n *\n * const client = new Fhirfly({ apiKey: \"your-api-key\" });\n *\n * // Look up a drug by NDC\n * const ndc = await client.ndc.lookup(\"0069-0151-01\");\n * console.log(ndc.data.product_name); // \"Lipitor\"\n *\n * // Look up a provider by NPI\n * const npi = await client.npi.lookup(\"1234567890\");\n * console.log(npi.data.name);\n *\n * // Batch lookups\n * const results = await client.ndc.lookupMany([\n * \"0069-0151-01\",\n * \"0069-0151-02\"\n * ]);\n * ```\n */\nexport class Fhirfly {\n private readonly http: HttpClient;\n\n /**\n * NDC (National Drug Code) lookups.\n */\n readonly ndc: NdcEndpoint;\n\n /**\n * NPI (National Provider Identifier) lookups.\n */\n readonly npi: NpiEndpoint;\n\n /**\n * RxNorm drug terminology lookups.\n */\n readonly rxnorm: RxNormEndpoint;\n\n /**\n * LOINC laboratory and clinical observation code lookups.\n */\n readonly loinc: LoincEndpoint;\n\n /**\n * ICD-10 diagnosis and procedure code lookups.\n */\n readonly icd10: Icd10Endpoint;\n\n /**\n * CVX vaccine code lookups.\n */\n readonly cvx: CvxEndpoint;\n\n /**\n * MVX vaccine manufacturer code lookups.\n */\n readonly mvx: MvxEndpoint;\n\n /**\n * FDA drug label lookups.\n */\n readonly fdaLabels: FdaLabelsEndpoint;\n\n /**\n * Create a new FHIRfly client.\n *\n * @param config - Client configuration\n * @throws {Error} If apiKey is not provided\n */\n constructor(config: FhirflyConfig) {\n if (!config.apiKey) {\n throw new Error(\n \"FHIRfly API key is required. Get one at https://fhirfly.io/dashboard\"\n );\n }\n\n const httpConfig: HttpClientConfig = {\n baseUrl: config.baseUrl ?? \"https://api.fhirfly.io\",\n apiKey: config.apiKey,\n timeout: config.timeout,\n maxRetries: config.maxRetries,\n retryDelay: config.retryDelay,\n };\n\n this.http = new HttpClient(httpConfig);\n\n // Initialize endpoints\n this.ndc = new NdcEndpoint(this.http);\n this.npi = new NpiEndpoint(this.http);\n this.rxnorm = new RxNormEndpoint(this.http);\n this.loinc = new LoincEndpoint(this.http);\n this.icd10 = new Icd10Endpoint(this.http);\n this.cvx = new CvxEndpoint(this.http);\n this.mvx = new MvxEndpoint(this.http);\n this.fdaLabels = new FdaLabelsEndpoint(this.http);\n }\n}\n"]}
|