saferx-pharma-sdk 1.4.2 → 2.0.1

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.
Files changed (167) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +0 -12
  3. package/dist/cjs/Client.js +0 -67
  4. package/dist/cjs/api/resources/developers/client/Client.d.ts +1 -1
  5. package/dist/cjs/api/resources/developers/client/Client.js +1 -1
  6. package/dist/cjs/api/resources/drugSafety/client/Client.d.ts +5 -37
  7. package/dist/cjs/api/resources/drugSafety/client/Client.js +5 -37
  8. package/dist/cjs/api/resources/drugSafety/client/requests/DrugSafetyCheckRequest.d.ts +4 -38
  9. package/dist/cjs/api/resources/drugSafety/types/GetDrugSafetyHealthResponse.d.ts +14 -2
  10. package/dist/cjs/api/resources/drugSafety/types/GetDrugSafetyHealthResponse.js +11 -0
  11. package/dist/cjs/api/types/Alert.d.ts +2 -8
  12. package/dist/cjs/api/types/Alert.js +1 -5
  13. package/dist/cjs/api/types/ClinicalAlert.d.ts +0 -8
  14. package/dist/cjs/api/types/ClinicalData.d.ts +4 -7
  15. package/dist/cjs/api/types/DailyLimit.d.ts +1 -1
  16. package/dist/cjs/api/types/DomainCode.d.ts +2 -4
  17. package/dist/cjs/api/types/DomainCode.js +2 -4
  18. package/dist/cjs/api/types/DosingData.d.ts +12 -22
  19. package/dist/cjs/api/types/DosingData.js +3 -3
  20. package/dist/cjs/api/types/DrugSafetyCheckResponse.d.ts +0 -1
  21. package/dist/cjs/api/types/ErrorResponse.d.ts +0 -5
  22. package/dist/cjs/api/types/Interaction.d.ts +2 -0
  23. package/dist/cjs/api/types/InteractionSummary.d.ts +4 -4
  24. package/dist/cjs/api/types/Meta.d.ts +0 -2
  25. package/dist/cjs/api/types/Meta.js +0 -1
  26. package/dist/cjs/api/types/MetadataResponse.d.ts +6 -14
  27. package/dist/cjs/api/types/MetadataResponse.js +0 -1
  28. package/dist/cjs/api/types/PatientProfile.d.ts +0 -31
  29. package/dist/cjs/api/types/PatientProfile.js +0 -17
  30. package/dist/cjs/api/types/RateLimitResponse.d.ts +0 -11
  31. package/dist/cjs/api/types/RateLimitResponse.js +0 -1
  32. package/dist/cjs/api/types/ReproductiveSafetyData.d.ts +3 -3
  33. package/dist/cjs/api/types/ResolvedDrug.d.ts +0 -26
  34. package/dist/cjs/api/types/SafetyData.d.ts +0 -1
  35. package/dist/cjs/api/types/index.d.ts +0 -16
  36. package/dist/cjs/api/types/index.js +0 -16
  37. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +1 -1
  38. package/dist/cjs/core/fetcher/Fetcher.js +1 -1
  39. package/dist/cjs/core/fetcher/index.d.ts +0 -2
  40. package/dist/cjs/core/fetcher/index.js +1 -3
  41. package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -6
  42. package/dist/cjs/core/fetcher/makeRequest.js +9 -30
  43. package/dist/cjs/core/runtime/runtime.js +7 -8
  44. package/dist/cjs/version.d.ts +1 -1
  45. package/dist/cjs/version.js +1 -1
  46. package/dist/esm/BaseClient.mjs +2 -2
  47. package/dist/esm/Client.d.mts +0 -12
  48. package/dist/esm/Client.mjs +0 -34
  49. package/dist/esm/api/resources/developers/client/Client.d.mts +1 -1
  50. package/dist/esm/api/resources/developers/client/Client.mjs +1 -1
  51. package/dist/esm/api/resources/drugSafety/client/Client.d.mts +5 -37
  52. package/dist/esm/api/resources/drugSafety/client/Client.mjs +5 -37
  53. package/dist/esm/api/resources/drugSafety/client/requests/DrugSafetyCheckRequest.d.mts +4 -38
  54. package/dist/esm/api/resources/drugSafety/types/GetDrugSafetyHealthResponse.d.mts +14 -2
  55. package/dist/esm/api/resources/drugSafety/types/GetDrugSafetyHealthResponse.mjs +11 -0
  56. package/dist/esm/api/types/Alert.d.mts +2 -8
  57. package/dist/esm/api/types/Alert.mjs +1 -5
  58. package/dist/esm/api/types/ClinicalAlert.d.mts +0 -8
  59. package/dist/esm/api/types/ClinicalData.d.mts +4 -7
  60. package/dist/esm/api/types/DailyLimit.d.mts +1 -1
  61. package/dist/esm/api/types/DomainCode.d.mts +2 -4
  62. package/dist/esm/api/types/DomainCode.mjs +2 -4
  63. package/dist/esm/api/types/DosingData.d.mts +12 -22
  64. package/dist/esm/api/types/DosingData.mjs +3 -3
  65. package/dist/esm/api/types/DrugSafetyCheckResponse.d.mts +0 -1
  66. package/dist/esm/api/types/ErrorResponse.d.mts +0 -5
  67. package/dist/esm/api/types/Interaction.d.mts +2 -0
  68. package/dist/esm/api/types/InteractionSummary.d.mts +4 -4
  69. package/dist/esm/api/types/Meta.d.mts +0 -2
  70. package/dist/esm/api/types/Meta.mjs +0 -1
  71. package/dist/esm/api/types/MetadataResponse.d.mts +6 -14
  72. package/dist/esm/api/types/MetadataResponse.mjs +0 -1
  73. package/dist/esm/api/types/PatientProfile.d.mts +0 -31
  74. package/dist/esm/api/types/PatientProfile.mjs +1 -16
  75. package/dist/esm/api/types/RateLimitResponse.d.mts +0 -11
  76. package/dist/esm/api/types/RateLimitResponse.mjs +0 -1
  77. package/dist/esm/api/types/ReproductiveSafetyData.d.mts +3 -3
  78. package/dist/esm/api/types/ResolvedDrug.d.mts +0 -26
  79. package/dist/esm/api/types/SafetyData.d.mts +0 -1
  80. package/dist/esm/api/types/index.d.mts +0 -16
  81. package/dist/esm/api/types/index.mjs +0 -16
  82. package/dist/esm/core/fetcher/BinaryResponse.d.mts +1 -1
  83. package/dist/esm/core/fetcher/Fetcher.mjs +1 -1
  84. package/dist/esm/core/fetcher/index.d.mts +0 -2
  85. package/dist/esm/core/fetcher/index.mjs +0 -1
  86. package/dist/esm/core/fetcher/makeRequest.d.mts +1 -6
  87. package/dist/esm/core/fetcher/makeRequest.mjs +9 -28
  88. package/dist/esm/core/runtime/runtime.mjs +7 -8
  89. package/dist/esm/version.d.mts +1 -1
  90. package/dist/esm/version.mjs +1 -1
  91. package/package.json +9 -31
  92. package/dist/cjs/api/resources/developers/exports.d.ts +0 -2
  93. package/dist/cjs/api/resources/developers/exports.js +0 -21
  94. package/dist/cjs/api/resources/drugSafety/exports.d.ts +0 -2
  95. package/dist/cjs/api/resources/drugSafety/exports.js +0 -21
  96. package/dist/cjs/api/types/AllergyCrossReactivityReference.d.ts +0 -16
  97. package/dist/cjs/api/types/AllergyCrossReactivityReference.js +0 -3
  98. package/dist/cjs/api/types/AllergyData.d.ts +0 -24
  99. package/dist/cjs/api/types/AllergyData.js +0 -11
  100. package/dist/cjs/api/types/AllergyFamilyReference.d.ts +0 -10
  101. package/dist/cjs/api/types/AllergyFamilyReference.js +0 -3
  102. package/dist/cjs/api/types/AllergyInputEntry.d.ts +0 -10
  103. package/dist/cjs/api/types/AllergyInputEntry.js +0 -3
  104. package/dist/cjs/api/types/AllergyProductFamilyReference.d.ts +0 -9
  105. package/dist/cjs/api/types/AllergyProductFamilyReference.js +0 -3
  106. package/dist/cjs/api/types/AllergySummary.d.ts +0 -14
  107. package/dist/cjs/api/types/AllergySummary.js +0 -3
  108. package/dist/cjs/api/types/AllergyWarning.d.ts +0 -30
  109. package/dist/cjs/api/types/AllergyWarning.js +0 -11
  110. package/dist/cjs/api/types/ClinicalContextApplied.d.ts +0 -10
  111. package/dist/cjs/api/types/ClinicalContextApplied.js +0 -3
  112. package/dist/cjs/api/types/IdentityMatch.d.ts +0 -13
  113. package/dist/cjs/api/types/IdentityMatch.js +0 -3
  114. package/dist/cjs/api/types/IntelligenceClinicalProfile.d.ts +0 -24
  115. package/dist/cjs/api/types/IntelligenceClinicalProfile.js +0 -13
  116. package/dist/cjs/api/types/IntelligenceContext.d.ts +0 -17
  117. package/dist/cjs/api/types/IntelligenceContext.js +0 -3
  118. package/dist/cjs/api/types/IntelligenceProcessorError.d.ts +0 -4
  119. package/dist/cjs/api/types/IntelligenceProcessorError.js +0 -3
  120. package/dist/cjs/api/types/IntelligenceResult.d.ts +0 -16
  121. package/dist/cjs/api/types/IntelligenceResult.js +0 -3
  122. package/dist/cjs/api/types/IntelligenceSynthesis.d.ts +0 -6
  123. package/dist/cjs/api/types/IntelligenceSynthesis.js +0 -3
  124. package/dist/cjs/api/types/MedicationHistoryItem.d.ts +0 -22
  125. package/dist/cjs/api/types/MedicationHistoryItem.js +0 -15
  126. package/dist/cjs/api/types/QuotaMeta.d.ts +0 -11
  127. package/dist/cjs/api/types/QuotaMeta.js +0 -3
  128. package/dist/cjs/core/fetcher/makePassthroughRequest.d.ts +0 -49
  129. package/dist/cjs/core/fetcher/makePassthroughRequest.js +0 -135
  130. package/dist/esm/api/resources/developers/exports.d.mts +0 -2
  131. package/dist/esm/api/resources/developers/exports.mjs +0 -3
  132. package/dist/esm/api/resources/drugSafety/exports.d.mts +0 -2
  133. package/dist/esm/api/resources/drugSafety/exports.mjs +0 -3
  134. package/dist/esm/api/types/AllergyCrossReactivityReference.d.mts +0 -16
  135. package/dist/esm/api/types/AllergyCrossReactivityReference.mjs +0 -2
  136. package/dist/esm/api/types/AllergyData.d.mts +0 -24
  137. package/dist/esm/api/types/AllergyData.mjs +0 -8
  138. package/dist/esm/api/types/AllergyFamilyReference.d.mts +0 -10
  139. package/dist/esm/api/types/AllergyFamilyReference.mjs +0 -2
  140. package/dist/esm/api/types/AllergyInputEntry.d.mts +0 -10
  141. package/dist/esm/api/types/AllergyInputEntry.mjs +0 -2
  142. package/dist/esm/api/types/AllergyProductFamilyReference.d.mts +0 -9
  143. package/dist/esm/api/types/AllergyProductFamilyReference.mjs +0 -2
  144. package/dist/esm/api/types/AllergySummary.d.mts +0 -14
  145. package/dist/esm/api/types/AllergySummary.mjs +0 -2
  146. package/dist/esm/api/types/AllergyWarning.d.mts +0 -30
  147. package/dist/esm/api/types/AllergyWarning.mjs +0 -8
  148. package/dist/esm/api/types/ClinicalContextApplied.d.mts +0 -10
  149. package/dist/esm/api/types/ClinicalContextApplied.mjs +0 -2
  150. package/dist/esm/api/types/IdentityMatch.d.mts +0 -13
  151. package/dist/esm/api/types/IdentityMatch.mjs +0 -2
  152. package/dist/esm/api/types/IntelligenceClinicalProfile.d.mts +0 -24
  153. package/dist/esm/api/types/IntelligenceClinicalProfile.mjs +0 -10
  154. package/dist/esm/api/types/IntelligenceContext.d.mts +0 -17
  155. package/dist/esm/api/types/IntelligenceContext.mjs +0 -2
  156. package/dist/esm/api/types/IntelligenceProcessorError.d.mts +0 -4
  157. package/dist/esm/api/types/IntelligenceProcessorError.mjs +0 -2
  158. package/dist/esm/api/types/IntelligenceResult.d.mts +0 -16
  159. package/dist/esm/api/types/IntelligenceResult.mjs +0 -2
  160. package/dist/esm/api/types/IntelligenceSynthesis.d.mts +0 -6
  161. package/dist/esm/api/types/IntelligenceSynthesis.mjs +0 -2
  162. package/dist/esm/api/types/MedicationHistoryItem.d.mts +0 -22
  163. package/dist/esm/api/types/MedicationHistoryItem.mjs +0 -12
  164. package/dist/esm/api/types/QuotaMeta.d.mts +0 -11
  165. package/dist/esm/api/types/QuotaMeta.mjs +0 -2
  166. package/dist/esm/core/fetcher/makePassthroughRequest.d.mts +0 -49
  167. package/dist/esm/core/fetcher/makePassthroughRequest.mjs +0 -132
@@ -1,30 +0,0 @@
1
- export interface AllergyWarning {
2
- sfrx_id?: string | undefined;
3
- drug_name?: string | undefined;
4
- generic_en?: string | undefined;
5
- dosage_form_en?: string | undefined;
6
- warning_type?: AllergyWarning.WarningType | undefined;
7
- allergen_family?: string | undefined;
8
- allergen_family_name_en?: string | undefined;
9
- patient_allergy?: string | undefined;
10
- patient_allergy_raw_input?: string | undefined;
11
- severity?: number | undefined;
12
- severity_label?: string | undefined;
13
- severity_label_ar?: string | undefined;
14
- frequency_category?: (number | null) | undefined;
15
- frequency_label?: (string | null) | undefined;
16
- frequency_min_pct?: (number | null) | undefined;
17
- frequency_max_pct?: (number | null) | undefined;
18
- mechanism_en?: (string | null) | undefined;
19
- mechanism_ar?: (string | null) | undefined;
20
- clinical_note_en?: (string | null) | undefined;
21
- clinical_note_ar?: (string | null) | undefined;
22
- evidence_level?: (string | null) | undefined;
23
- }
24
- export declare namespace AllergyWarning {
25
- const WarningType: {
26
- readonly Direct: "direct";
27
- readonly CrossReactivity: "cross_reactivity";
28
- };
29
- type WarningType = (typeof WarningType)[keyof typeof WarningType];
30
- }
@@ -1,11 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.AllergyWarning = void 0;
5
- var AllergyWarning;
6
- (function (AllergyWarning) {
7
- AllergyWarning.WarningType = {
8
- Direct: "direct",
9
- CrossReactivity: "cross_reactivity",
10
- };
11
- })(AllergyWarning || (exports.AllergyWarning = AllergyWarning = {}));
@@ -1,10 +0,0 @@
1
- export interface ClinicalContextApplied {
2
- /** Condition keys applied to clinical filtering. */
3
- conditions?: string[] | undefined;
4
- /** Population keys applied to clinical filtering after adding inferred populations. */
5
- populations?: string[] | undefined;
6
- /** Population keys explicitly supplied by the caller. */
7
- requested_populations?: string[] | undefined;
8
- /** Population keys inferred from patient values such as `crcl`, `child_pugh`, or `age`. */
9
- inferred_populations?: string[] | undefined;
10
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,13 +0,0 @@
1
- /**
2
- * Non-sensitive drug identity resolution metadata for auditability.
3
- */
4
- export interface IdentityMatch {
5
- /** Resolver path that produced the match. */
6
- method?: string | undefined;
7
- /** Match confidence score. */
8
- confidence?: number | undefined;
9
- /** Public drug field used for the match. */
10
- matched_field?: string | undefined;
11
- /** Public-safe value that matched the input. */
12
- matched_value?: string | undefined;
13
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,24 +0,0 @@
1
- /**
2
- * Patient profile fields used by intelligence processors.
3
- */
4
- export interface IntelligenceClinicalProfile {
5
- age?: number | undefined;
6
- /** Creatinine clearance in mL/min. */
7
- crcl?: number | undefined;
8
- hepatic_status?: IntelligenceClinicalProfile.HepaticStatus | undefined;
9
- pregnancy?: boolean | undefined;
10
- lactation?: boolean | undefined;
11
- conditions?: string[] | undefined;
12
- populations?: string[] | undefined;
13
- allergies?: string[] | undefined;
14
- diet_habits?: string[] | undefined;
15
- }
16
- export declare namespace IntelligenceClinicalProfile {
17
- const HepaticStatus: {
18
- readonly Normal: "normal";
19
- readonly Mild: "mild";
20
- readonly Moderate: "moderate";
21
- readonly Severe: "severe";
22
- };
23
- type HepaticStatus = (typeof HepaticStatus)[keyof typeof HepaticStatus];
24
- }
@@ -1,13 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.IntelligenceClinicalProfile = void 0;
5
- var IntelligenceClinicalProfile;
6
- (function (IntelligenceClinicalProfile) {
7
- IntelligenceClinicalProfile.HepaticStatus = {
8
- Normal: "normal",
9
- Mild: "mild",
10
- Moderate: "moderate",
11
- Severe: "severe",
12
- };
13
- })(IntelligenceClinicalProfile || (exports.IntelligenceClinicalProfile = IntelligenceClinicalProfile = {}));
@@ -1,17 +0,0 @@
1
- import type * as SafeRx from "../index.js";
2
- /**
3
- * Optional Medication Intelligence Platform context. When present and the
4
- * intelligence layer is enabled, SafeRx adds a top-level `intelligence`
5
- * block without changing the standard safety response.
6
- */
7
- export interface IntelligenceContext {
8
- /** Optional caller-side patient or profile identifier. */
9
- user_id?: string | undefined;
10
- clinical_profile?: SafeRx.IntelligenceClinicalProfile | undefined;
11
- /**
12
- * Longitudinal medication list used for active-medication cumulative
13
- * dose tracking. Items with `status: historical` are retained as
14
- * context but excluded from active overdose aggregation.
15
- */
16
- medication_history?: SafeRx.MedicationHistoryItem[] | undefined;
17
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +0,0 @@
1
- export interface IntelligenceProcessorError {
2
- processor?: string | undefined;
3
- error?: string | undefined;
4
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,16 +0,0 @@
1
- import type * as SafeRx from "../index.js";
2
- /**
3
- * Optional Medication Intelligence Platform post-processing output.
4
- */
5
- export interface IntelligenceResult {
6
- status?: string | undefined;
7
- /** Active-medication cumulative dose warnings. */
8
- cumulative_warnings?: Record<string, unknown>[] | undefined;
9
- synthesis?: SafeRx.IntelligenceSynthesis | undefined;
10
- /** Allergy/profile-filtered alternative candidates keyed by source `sfrx_id`. */
11
- safer_alternatives?: Record<string, unknown> | undefined;
12
- /** Best-effort processor errors; standard safety output remains valid. */
13
- processor_errors?: SafeRx.IntelligenceProcessorError[] | undefined;
14
- /** Top-level degradation reason when the whole intelligence layer fails. */
15
- error?: string | undefined;
16
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +0,0 @@
1
- export interface IntelligenceSynthesis {
2
- cross_domain_findings?: Record<string, unknown>[] | undefined;
3
- summary?: string | undefined;
4
- /** Condition-specific adverse effects elevated for the supplied context. */
5
- predictive_ae?: Record<string, unknown>[] | undefined;
6
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,22 +0,0 @@
1
- export interface MedicationHistoryItem {
2
- /** SafeRx product identifier. */
3
- sfrx_id: string;
4
- /** Caller-provided start date, preferably ISO 8601. */
5
- start_date?: string | undefined;
6
- /**
7
- * Active medications participate in cumulative dose checks.
8
- * Historical medications are retained as context only.
9
- */
10
- status?: MedicationHistoryItem.Status | undefined;
11
- }
12
- export declare namespace MedicationHistoryItem {
13
- /**
14
- * Active medications participate in cumulative dose checks.
15
- * Historical medications are retained as context only.
16
- */
17
- const Status: {
18
- readonly Active: "active";
19
- readonly Historical: "historical";
20
- };
21
- type Status = (typeof Status)[keyof typeof Status];
22
- }
@@ -1,15 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.MedicationHistoryItem = void 0;
5
- var MedicationHistoryItem;
6
- (function (MedicationHistoryItem) {
7
- /**
8
- * Active medications participate in cumulative dose checks.
9
- * Historical medications are retained as context only.
10
- */
11
- MedicationHistoryItem.Status = {
12
- Active: "active",
13
- Historical: "historical",
14
- };
15
- })(MedicationHistoryItem || (exports.MedicationHistoryItem = MedicationHistoryItem = {}));
@@ -1,11 +0,0 @@
1
- /**
2
- * Monthly quota accounting for the request.
3
- */
4
- export interface QuotaMeta {
5
- monthly_limit?: number | undefined;
6
- monthly_used?: number | undefined;
7
- monthly_remaining?: number | undefined;
8
- reset_at?: string | undefined;
9
- /** Units consumed by this response. Unresolved-only checks return 0. */
10
- billable_units?: number | undefined;
11
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,49 +0,0 @@
1
- import { type LogConfig, type Logger } from "../logging/logger.js";
2
- import { Supplier } from "./Supplier.js";
3
- export declare namespace PassthroughRequest {
4
- /**
5
- * Per-request options that can override the SDK client defaults.
6
- */
7
- interface RequestOptions {
8
- /** Override the default timeout for this request (in seconds). */
9
- timeoutInSeconds?: number;
10
- /** Override the default number of retries for this request. */
11
- maxRetries?: number;
12
- /** Additional headers to include in this request. */
13
- headers?: Record<string, string>;
14
- /** Abort signal for this request. */
15
- abortSignal?: AbortSignal;
16
- }
17
- /**
18
- * SDK client configuration used by the passthrough fetch method.
19
- */
20
- interface ClientOptions {
21
- /** The base URL or environment for the client. */
22
- environment?: Supplier<string>;
23
- /** Override the base URL. */
24
- baseUrl?: Supplier<string>;
25
- /** Default headers to include in requests. */
26
- headers?: Record<string, unknown>;
27
- /** Default maximum time to wait for a response in seconds. */
28
- timeoutInSeconds?: number;
29
- /** Default number of times to retry the request. Defaults to 2. */
30
- maxRetries?: number;
31
- /** A custom fetch function. */
32
- fetch?: typeof fetch;
33
- /** Logging configuration. */
34
- logging?: LogConfig | Logger;
35
- /** A function that returns auth headers. */
36
- getAuthHeaders?: () => Promise<Record<string, string>>;
37
- }
38
- }
39
- /**
40
- * Makes a passthrough HTTP request using the SDK's configuration (auth, retry, logging, etc.)
41
- * while mimicking the standard `fetch` API.
42
- *
43
- * @param input - The URL, path, or Request object. If a relative path, it will be resolved against the configured base URL.
44
- * @param init - Standard RequestInit options (method, headers, body, signal, etc.)
45
- * @param clientOptions - SDK client options (auth, default headers, logging, etc.)
46
- * @param requestOptions - Per-request overrides (timeout, retries, extra headers, abort signal).
47
- * @returns A standard Response object.
48
- */
49
- export declare function makePassthroughRequest(input: Request | string | URL, init: RequestInit | undefined, clientOptions: PassthroughRequest.ClientOptions, requestOptions?: PassthroughRequest.RequestOptions): Promise<Response>;
@@ -1,135 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.makePassthroughRequest = makePassthroughRequest;
13
- const logger_js_1 = require("../logging/logger.js");
14
- const join_js_1 = require("../url/join.js");
15
- const EndpointSupplier_js_1 = require("./EndpointSupplier.js");
16
- const getFetchFn_js_1 = require("./getFetchFn.js");
17
- const makeRequest_js_1 = require("./makeRequest.js");
18
- const requestWithRetries_js_1 = require("./requestWithRetries.js");
19
- const Supplier_js_1 = require("./Supplier.js");
20
- /**
21
- * Makes a passthrough HTTP request using the SDK's configuration (auth, retry, logging, etc.)
22
- * while mimicking the standard `fetch` API.
23
- *
24
- * @param input - The URL, path, or Request object. If a relative path, it will be resolved against the configured base URL.
25
- * @param init - Standard RequestInit options (method, headers, body, signal, etc.)
26
- * @param clientOptions - SDK client options (auth, default headers, logging, etc.)
27
- * @param requestOptions - Per-request overrides (timeout, retries, extra headers, abort signal).
28
- * @returns A standard Response object.
29
- */
30
- function makePassthroughRequest(input, init, clientOptions, requestOptions) {
31
- return __awaiter(this, void 0, void 0, function* () {
32
- var _a, _b, _c, _d, _e, _f, _g;
33
- const logger = (0, logger_js_1.createLogger)(clientOptions.logging);
34
- // Extract URL and default init properties from Request object if provided
35
- let url;
36
- let effectiveInit = init;
37
- if (input instanceof Request) {
38
- url = input.url;
39
- // If no explicit init provided, extract properties from the Request object
40
- if (init == null) {
41
- effectiveInit = {
42
- method: input.method,
43
- headers: Object.fromEntries(input.headers.entries()),
44
- body: input.body,
45
- signal: input.signal,
46
- credentials: input.credentials,
47
- cache: input.cache,
48
- redirect: input.redirect,
49
- referrer: input.referrer,
50
- integrity: input.integrity,
51
- mode: input.mode,
52
- };
53
- }
54
- }
55
- else {
56
- url = input instanceof URL ? input.toString() : input;
57
- }
58
- // Resolve the base URL
59
- const baseUrl = (_a = (clientOptions.baseUrl != null ? yield Supplier_js_1.Supplier.get(clientOptions.baseUrl) : undefined)) !== null && _a !== void 0 ? _a : (clientOptions.environment != null ? yield Supplier_js_1.Supplier.get(clientOptions.environment) : undefined);
60
- // Determine the full URL
61
- let fullUrl;
62
- if (url.startsWith("http://") || url.startsWith("https://")) {
63
- fullUrl = url;
64
- }
65
- else if (baseUrl != null) {
66
- fullUrl = (0, join_js_1.join)(baseUrl, url);
67
- }
68
- else {
69
- fullUrl = url;
70
- }
71
- // Merge headers: SDK default headers -> auth headers -> user-provided headers
72
- const mergedHeaders = {};
73
- // Apply SDK default headers (resolve suppliers)
74
- if (clientOptions.headers != null) {
75
- for (const [key, value] of Object.entries(clientOptions.headers)) {
76
- const resolved = yield EndpointSupplier_js_1.EndpointSupplier.get(value, { endpointMetadata: {} });
77
- if (resolved != null) {
78
- mergedHeaders[key.toLowerCase()] = `${resolved}`;
79
- }
80
- }
81
- }
82
- // Apply auth headers
83
- if (clientOptions.getAuthHeaders != null) {
84
- const authHeaders = yield clientOptions.getAuthHeaders();
85
- for (const [key, value] of Object.entries(authHeaders)) {
86
- mergedHeaders[key.toLowerCase()] = value;
87
- }
88
- }
89
- // Apply user-provided headers from init
90
- if ((effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.headers) != null) {
91
- const initHeaders = effectiveInit.headers instanceof Headers
92
- ? Object.fromEntries(effectiveInit.headers.entries())
93
- : Array.isArray(effectiveInit.headers)
94
- ? Object.fromEntries(effectiveInit.headers)
95
- : effectiveInit.headers;
96
- for (const [key, value] of Object.entries(initHeaders)) {
97
- if (value != null) {
98
- mergedHeaders[key.toLowerCase()] = value;
99
- }
100
- }
101
- }
102
- // Apply per-request option headers (highest priority)
103
- if ((requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers) != null) {
104
- for (const [key, value] of Object.entries(requestOptions.headers)) {
105
- mergedHeaders[key.toLowerCase()] = value;
106
- }
107
- }
108
- const method = (_b = effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.method) !== null && _b !== void 0 ? _b : "GET";
109
- const body = effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.body;
110
- const timeoutInSeconds = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _c !== void 0 ? _c : clientOptions.timeoutInSeconds;
111
- const timeoutMs = timeoutInSeconds != null ? timeoutInSeconds * 1000 : undefined;
112
- const maxRetries = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _d !== void 0 ? _d : clientOptions.maxRetries;
113
- const abortSignal = (_f = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal) !== null && _e !== void 0 ? _e : effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.signal) !== null && _f !== void 0 ? _f : undefined;
114
- const fetchFn = (_g = clientOptions.fetch) !== null && _g !== void 0 ? _g : (yield (0, getFetchFn_js_1.getFetchFn)());
115
- if (logger.isDebug()) {
116
- logger.debug("Making passthrough HTTP request", {
117
- method,
118
- url: fullUrl,
119
- hasBody: body != null,
120
- });
121
- }
122
- const response = yield (0, requestWithRetries_js_1.requestWithRetries)(() => __awaiter(this, void 0, void 0, function* () {
123
- return (0, makeRequest_js_1.makeRequest)(fetchFn, fullUrl, method, mergedHeaders, body !== null && body !== void 0 ? body : undefined, timeoutMs, abortSignal, (effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.credentials) === "include", undefined, // duplex
124
- false);
125
- }), maxRetries);
126
- if (logger.isDebug()) {
127
- logger.debug("Passthrough HTTP request completed", {
128
- method,
129
- url: fullUrl,
130
- statusCode: response.status,
131
- });
132
- }
133
- return response;
134
- });
135
- }
@@ -1,2 +0,0 @@
1
- export { DevelopersClient } from "./client/Client.mjs";
2
- export * from "./client/index.mjs";
@@ -1,3 +0,0 @@
1
- // This file was auto-generated by Fern from our API Definition.
2
- export { DevelopersClient } from "./client/Client.mjs";
3
- export * from "./client/index.mjs";
@@ -1,2 +0,0 @@
1
- export { DrugSafetyClient } from "./client/Client.mjs";
2
- export * from "./client/index.mjs";
@@ -1,3 +0,0 @@
1
- // This file was auto-generated by Fern from our API Definition.
2
- export { DrugSafetyClient } from "./client/Client.mjs";
3
- export * from "./client/index.mjs";
@@ -1,16 +0,0 @@
1
- export interface AllergyCrossReactivityReference {
2
- target_family?: string | undefined;
3
- target_family_name_en?: string | undefined;
4
- target_family_name_ar?: (string | null) | undefined;
5
- severity?: number | undefined;
6
- severity_label?: (string | null) | undefined;
7
- severity_label_ar?: (string | null) | undefined;
8
- frequency_category?: (number | null) | undefined;
9
- frequency_label?: (string | null) | undefined;
10
- frequency_label_ar?: (string | null) | undefined;
11
- mechanism_en?: (string | null) | undefined;
12
- mechanism_ar?: (string | null) | undefined;
13
- clinical_note_en?: (string | null) | undefined;
14
- clinical_note_ar?: (string | null) | undefined;
15
- evidence_level?: (string | null) | undefined;
16
- }
@@ -1,2 +0,0 @@
1
- // This file was auto-generated by Fern from our API Definition.
2
- export {};
@@ -1,24 +0,0 @@
1
- import type * as SafeRx from "../index.mjs";
2
- /**
3
- * Patient allergy matching results. Without `patient_profile.allergies`,
4
- * the domain returns reference-only summary data and no patient-specific
5
- * clearance should be inferred.
6
- */
7
- export interface AllergyData {
8
- mode?: AllergyData.Mode | undefined;
9
- warnings?: SafeRx.AllergyWarning[] | undefined;
10
- summary?: SafeRx.AllergySummary | undefined;
11
- /** Product-level allergy family and cross-reactivity reference data keyed by `sfrx_id`. */
12
- product_families?: Record<string, SafeRx.AllergyProductFamilyReference> | undefined;
13
- needs_review_entries?: SafeRx.AllergyInputEntry[] | undefined;
14
- unresolved_entries?: SafeRx.AllergyInputEntry[] | undefined;
15
- /** Resolved product IDs that had no allergy reference record. */
16
- missing_products?: string[] | undefined;
17
- }
18
- export declare namespace AllergyData {
19
- const Mode: {
20
- readonly ReferenceOnly: "reference_only";
21
- readonly PatientProfile: "patient_profile";
22
- };
23
- type Mode = (typeof Mode)[keyof typeof Mode];
24
- }
@@ -1,8 +0,0 @@
1
- // This file was auto-generated by Fern from our API Definition.
2
- export var AllergyData;
3
- (function (AllergyData) {
4
- AllergyData.Mode = {
5
- ReferenceOnly: "reference_only",
6
- PatientProfile: "patient_profile",
7
- };
8
- })(AllergyData || (AllergyData = {}));
@@ -1,10 +0,0 @@
1
- import type * as SafeRx from "../index.mjs";
2
- export interface AllergyFamilyReference {
3
- family_id?: string | undefined;
4
- name_en?: string | undefined;
5
- name_ar?: (string | null) | undefined;
6
- description_en?: (string | null) | undefined;
7
- description_ar?: (string | null) | undefined;
8
- clinical_significance?: (string | null) | undefined;
9
- cross_reactivity?: SafeRx.AllergyCrossReactivityReference[] | undefined;
10
- }
@@ -1,2 +0,0 @@
1
- // This file was auto-generated by Fern from our API Definition.
2
- export {};
@@ -1,10 +0,0 @@
1
- /**
2
- * Caller-provided allergy entry that could not be fully resolved or needs review.
3
- */
4
- export interface AllergyInputEntry {
5
- raw_input?: string | undefined;
6
- source_label?: string | undefined;
7
- family_id?: (string | null) | undefined;
8
- source_sfrx_id?: (string | null) | undefined;
9
- normalization_status?: (string | null) | undefined;
10
- }
@@ -1,2 +0,0 @@
1
- // This file was auto-generated by Fern from our API Definition.
2
- export {};
@@ -1,9 +0,0 @@
1
- import type * as SafeRx from "../index.mjs";
2
- export interface AllergyProductFamilyReference {
3
- tradename_en?: string | undefined;
4
- generic_en?: string | undefined;
5
- dosage_form_en?: string | undefined;
6
- route_type?: (string | null) | undefined;
7
- has_allergy_data?: boolean | undefined;
8
- families?: SafeRx.AllergyFamilyReference[] | undefined;
9
- }
@@ -1,2 +0,0 @@
1
- // This file was auto-generated by Fern from our API Definition.
2
- export {};
@@ -1,14 +0,0 @@
1
- export interface AllergySummary {
2
- check_mode?: string | undefined;
3
- products_checked?: number | undefined;
4
- patient_allergies_count?: number | undefined;
5
- resolved_patient_allergies_count?: number | undefined;
6
- resolved_family_count?: number | undefined;
7
- needs_review_count?: number | undefined;
8
- unresolved_patient_allergies_count?: number | undefined;
9
- direct_warnings?: number | undefined;
10
- cross_reactivity_warnings?: number | undefined;
11
- total_warnings?: number | undefined;
12
- contraindicated_count?: number | undefined;
13
- missing_products_count?: number | undefined;
14
- }
@@ -1,2 +0,0 @@
1
- // This file was auto-generated by Fern from our API Definition.
2
- export {};
@@ -1,30 +0,0 @@
1
- export interface AllergyWarning {
2
- sfrx_id?: string | undefined;
3
- drug_name?: string | undefined;
4
- generic_en?: string | undefined;
5
- dosage_form_en?: string | undefined;
6
- warning_type?: AllergyWarning.WarningType | undefined;
7
- allergen_family?: string | undefined;
8
- allergen_family_name_en?: string | undefined;
9
- patient_allergy?: string | undefined;
10
- patient_allergy_raw_input?: string | undefined;
11
- severity?: number | undefined;
12
- severity_label?: string | undefined;
13
- severity_label_ar?: string | undefined;
14
- frequency_category?: (number | null) | undefined;
15
- frequency_label?: (string | null) | undefined;
16
- frequency_min_pct?: (number | null) | undefined;
17
- frequency_max_pct?: (number | null) | undefined;
18
- mechanism_en?: (string | null) | undefined;
19
- mechanism_ar?: (string | null) | undefined;
20
- clinical_note_en?: (string | null) | undefined;
21
- clinical_note_ar?: (string | null) | undefined;
22
- evidence_level?: (string | null) | undefined;
23
- }
24
- export declare namespace AllergyWarning {
25
- const WarningType: {
26
- readonly Direct: "direct";
27
- readonly CrossReactivity: "cross_reactivity";
28
- };
29
- type WarningType = (typeof WarningType)[keyof typeof WarningType];
30
- }
@@ -1,8 +0,0 @@
1
- // This file was auto-generated by Fern from our API Definition.
2
- export var AllergyWarning;
3
- (function (AllergyWarning) {
4
- AllergyWarning.WarningType = {
5
- Direct: "direct",
6
- CrossReactivity: "cross_reactivity",
7
- };
8
- })(AllergyWarning || (AllergyWarning = {}));
@@ -1,10 +0,0 @@
1
- export interface ClinicalContextApplied {
2
- /** Condition keys applied to clinical filtering. */
3
- conditions?: string[] | undefined;
4
- /** Population keys applied to clinical filtering after adding inferred populations. */
5
- populations?: string[] | undefined;
6
- /** Population keys explicitly supplied by the caller. */
7
- requested_populations?: string[] | undefined;
8
- /** Population keys inferred from patient values such as `crcl`, `child_pugh`, or `age`. */
9
- inferred_populations?: string[] | undefined;
10
- }
@@ -1,2 +0,0 @@
1
- // This file was auto-generated by Fern from our API Definition.
2
- export {};