saferx-pharma-sdk 1.4.0 → 1.4.2
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/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +12 -0
- package/dist/cjs/Client.js +67 -0
- package/dist/cjs/api/resources/developers/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/developers/client/Client.js +1 -1
- package/dist/cjs/api/resources/developers/exports.d.ts +2 -0
- package/dist/cjs/api/resources/developers/exports.js +21 -0
- package/dist/cjs/api/resources/drugSafety/client/Client.d.ts +39 -5
- package/dist/cjs/api/resources/drugSafety/client/Client.js +39 -5
- package/dist/cjs/api/resources/drugSafety/client/requests/DrugSafetyCheckRequest.d.ts +38 -4
- package/dist/cjs/api/resources/drugSafety/exports.d.ts +2 -0
- package/dist/cjs/api/resources/drugSafety/exports.js +21 -0
- package/dist/cjs/api/resources/drugSafety/types/GetDrugSafetyHealthResponse.d.ts +2 -14
- package/dist/cjs/api/resources/drugSafety/types/GetDrugSafetyHealthResponse.js +0 -11
- package/dist/cjs/api/types/Alert.d.ts +8 -2
- package/dist/cjs/api/types/Alert.js +5 -1
- package/dist/cjs/api/types/AllergyCrossReactivityReference.d.ts +16 -0
- package/dist/cjs/api/types/AllergyCrossReactivityReference.js +3 -0
- package/dist/cjs/api/types/AllergyData.d.ts +24 -0
- package/dist/cjs/api/types/AllergyData.js +11 -0
- package/dist/cjs/api/types/AllergyFamilyReference.d.ts +10 -0
- package/dist/cjs/api/types/AllergyFamilyReference.js +3 -0
- package/dist/cjs/api/types/AllergyInputEntry.d.ts +10 -0
- package/dist/cjs/api/types/AllergyInputEntry.js +3 -0
- package/dist/cjs/api/types/AllergyProductFamilyReference.d.ts +9 -0
- package/dist/cjs/api/types/AllergyProductFamilyReference.js +3 -0
- package/dist/cjs/api/types/AllergySummary.d.ts +14 -0
- package/dist/cjs/api/types/AllergySummary.js +3 -0
- package/dist/cjs/api/types/AllergyWarning.d.ts +30 -0
- package/dist/cjs/api/types/AllergyWarning.js +11 -0
- package/dist/cjs/api/types/ClinicalAlert.d.ts +8 -0
- package/dist/cjs/api/types/ClinicalContextApplied.d.ts +10 -0
- package/dist/cjs/api/types/ClinicalContextApplied.js +3 -0
- package/dist/cjs/api/types/ClinicalData.d.ts +7 -4
- package/dist/cjs/api/types/DailyLimit.d.ts +1 -1
- package/dist/cjs/api/types/DomainCode.d.ts +4 -2
- package/dist/cjs/api/types/DomainCode.js +4 -2
- package/dist/cjs/api/types/DosingData.d.ts +22 -12
- package/dist/cjs/api/types/DosingData.js +3 -3
- package/dist/cjs/api/types/DrugSafetyCheckResponse.d.ts +1 -0
- package/dist/cjs/api/types/ErrorResponse.d.ts +5 -0
- package/dist/cjs/api/types/IdentityMatch.d.ts +13 -0
- package/dist/cjs/api/types/IdentityMatch.js +3 -0
- package/dist/cjs/api/types/IntelligenceClinicalProfile.d.ts +24 -0
- package/dist/cjs/api/types/IntelligenceClinicalProfile.js +13 -0
- package/dist/cjs/api/types/IntelligenceContext.d.ts +17 -0
- package/dist/cjs/api/types/IntelligenceContext.js +3 -0
- package/dist/cjs/api/types/IntelligenceProcessorError.d.ts +4 -0
- package/dist/cjs/api/types/IntelligenceProcessorError.js +3 -0
- package/dist/cjs/api/types/IntelligenceResult.d.ts +16 -0
- package/dist/cjs/api/types/IntelligenceResult.js +3 -0
- package/dist/cjs/api/types/IntelligenceSynthesis.d.ts +6 -0
- package/dist/cjs/api/types/IntelligenceSynthesis.js +3 -0
- package/dist/cjs/api/types/Interaction.d.ts +0 -2
- package/dist/cjs/api/types/InteractionSummary.d.ts +4 -4
- package/dist/cjs/api/types/MedicationHistoryItem.d.ts +22 -0
- package/dist/cjs/api/types/MedicationHistoryItem.js +15 -0
- package/dist/cjs/api/types/Meta.d.ts +2 -0
- package/dist/cjs/api/types/Meta.js +1 -0
- package/dist/cjs/api/types/MetadataResponse.d.ts +14 -6
- package/dist/cjs/api/types/MetadataResponse.js +1 -0
- package/dist/cjs/api/types/PatientProfile.d.ts +31 -0
- package/dist/cjs/api/types/PatientProfile.js +17 -0
- package/dist/cjs/api/types/QuotaMeta.d.ts +11 -0
- package/dist/cjs/api/types/QuotaMeta.js +3 -0
- package/dist/cjs/api/types/RateLimitResponse.d.ts +11 -0
- package/dist/cjs/api/types/RateLimitResponse.js +1 -0
- package/dist/cjs/api/types/ResolvedDrug.d.ts +26 -0
- package/dist/cjs/api/types/SafetyData.d.ts +1 -0
- package/dist/cjs/api/types/index.d.ts +16 -0
- package/dist/cjs/api/types/index.js +16 -0
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +1 -1
- package/dist/cjs/core/fetcher/Fetcher.js +1 -1
- package/dist/cjs/core/fetcher/index.d.ts +2 -0
- package/dist/cjs/core/fetcher/index.js +3 -1
- package/dist/cjs/core/fetcher/makePassthroughRequest.d.ts +49 -0
- package/dist/cjs/core/fetcher/makePassthroughRequest.js +135 -0
- package/dist/cjs/core/fetcher/makeRequest.d.ts +6 -1
- package/dist/cjs/core/fetcher/makeRequest.js +30 -9
- package/dist/cjs/core/runtime/runtime.js +8 -7
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +12 -0
- package/dist/esm/Client.mjs +34 -0
- package/dist/esm/api/resources/developers/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/developers/client/Client.mjs +1 -1
- package/dist/esm/api/resources/developers/exports.d.mts +2 -0
- package/dist/esm/api/resources/developers/exports.mjs +3 -0
- package/dist/esm/api/resources/drugSafety/client/Client.d.mts +39 -5
- package/dist/esm/api/resources/drugSafety/client/Client.mjs +39 -5
- package/dist/esm/api/resources/drugSafety/client/requests/DrugSafetyCheckRequest.d.mts +38 -4
- package/dist/esm/api/resources/drugSafety/exports.d.mts +2 -0
- package/dist/esm/api/resources/drugSafety/exports.mjs +3 -0
- package/dist/esm/api/resources/drugSafety/types/GetDrugSafetyHealthResponse.d.mts +2 -14
- package/dist/esm/api/resources/drugSafety/types/GetDrugSafetyHealthResponse.mjs +0 -11
- package/dist/esm/api/types/Alert.d.mts +8 -2
- package/dist/esm/api/types/Alert.mjs +5 -1
- package/dist/esm/api/types/AllergyCrossReactivityReference.d.mts +16 -0
- package/dist/esm/api/types/AllergyCrossReactivityReference.mjs +2 -0
- package/dist/esm/api/types/AllergyData.d.mts +24 -0
- package/dist/esm/api/types/AllergyData.mjs +8 -0
- package/dist/esm/api/types/AllergyFamilyReference.d.mts +10 -0
- package/dist/esm/api/types/AllergyFamilyReference.mjs +2 -0
- package/dist/esm/api/types/AllergyInputEntry.d.mts +10 -0
- package/dist/esm/api/types/AllergyInputEntry.mjs +2 -0
- package/dist/esm/api/types/AllergyProductFamilyReference.d.mts +9 -0
- package/dist/esm/api/types/AllergyProductFamilyReference.mjs +2 -0
- package/dist/esm/api/types/AllergySummary.d.mts +14 -0
- package/dist/esm/api/types/AllergySummary.mjs +2 -0
- package/dist/esm/api/types/AllergyWarning.d.mts +30 -0
- package/dist/esm/api/types/AllergyWarning.mjs +8 -0
- package/dist/esm/api/types/ClinicalAlert.d.mts +8 -0
- package/dist/esm/api/types/ClinicalContextApplied.d.mts +10 -0
- package/dist/esm/api/types/ClinicalContextApplied.mjs +2 -0
- package/dist/esm/api/types/ClinicalData.d.mts +7 -4
- package/dist/esm/api/types/DailyLimit.d.mts +1 -1
- package/dist/esm/api/types/DomainCode.d.mts +4 -2
- package/dist/esm/api/types/DomainCode.mjs +4 -2
- package/dist/esm/api/types/DosingData.d.mts +22 -12
- package/dist/esm/api/types/DosingData.mjs +3 -3
- package/dist/esm/api/types/DrugSafetyCheckResponse.d.mts +1 -0
- package/dist/esm/api/types/ErrorResponse.d.mts +5 -0
- package/dist/esm/api/types/IdentityMatch.d.mts +13 -0
- package/dist/esm/api/types/IdentityMatch.mjs +2 -0
- package/dist/esm/api/types/IntelligenceClinicalProfile.d.mts +24 -0
- package/dist/esm/api/types/IntelligenceClinicalProfile.mjs +10 -0
- package/dist/esm/api/types/IntelligenceContext.d.mts +17 -0
- package/dist/esm/api/types/IntelligenceContext.mjs +2 -0
- package/dist/esm/api/types/IntelligenceProcessorError.d.mts +4 -0
- package/dist/esm/api/types/IntelligenceProcessorError.mjs +2 -0
- package/dist/esm/api/types/IntelligenceResult.d.mts +16 -0
- package/dist/esm/api/types/IntelligenceResult.mjs +2 -0
- package/dist/esm/api/types/IntelligenceSynthesis.d.mts +6 -0
- package/dist/esm/api/types/IntelligenceSynthesis.mjs +2 -0
- package/dist/esm/api/types/Interaction.d.mts +0 -2
- package/dist/esm/api/types/InteractionSummary.d.mts +4 -4
- package/dist/esm/api/types/MedicationHistoryItem.d.mts +22 -0
- package/dist/esm/api/types/MedicationHistoryItem.mjs +12 -0
- package/dist/esm/api/types/Meta.d.mts +2 -0
- package/dist/esm/api/types/Meta.mjs +1 -0
- package/dist/esm/api/types/MetadataResponse.d.mts +14 -6
- package/dist/esm/api/types/MetadataResponse.mjs +1 -0
- package/dist/esm/api/types/PatientProfile.d.mts +31 -0
- package/dist/esm/api/types/PatientProfile.mjs +16 -1
- package/dist/esm/api/types/QuotaMeta.d.mts +11 -0
- package/dist/esm/api/types/QuotaMeta.mjs +2 -0
- package/dist/esm/api/types/RateLimitResponse.d.mts +11 -0
- package/dist/esm/api/types/RateLimitResponse.mjs +1 -0
- package/dist/esm/api/types/ResolvedDrug.d.mts +26 -0
- package/dist/esm/api/types/SafetyData.d.mts +1 -0
- package/dist/esm/api/types/index.d.mts +16 -0
- package/dist/esm/api/types/index.mjs +16 -0
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +1 -1
- package/dist/esm/core/fetcher/Fetcher.mjs +1 -1
- package/dist/esm/core/fetcher/index.d.mts +2 -0
- package/dist/esm/core/fetcher/index.mjs +1 -0
- package/dist/esm/core/fetcher/makePassthroughRequest.d.mts +49 -0
- package/dist/esm/core/fetcher/makePassthroughRequest.mjs +132 -0
- package/dist/esm/core/fetcher/makeRequest.d.mts +6 -1
- package/dist/esm/core/fetcher/makeRequest.mjs +28 -9
- package/dist/esm/core/runtime/runtime.mjs +8 -7
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +31 -9
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as SafeRx from "../index.js";
|
|
1
2
|
export interface ResolvedDrug {
|
|
2
3
|
/** The original drug name as submitted in the request */
|
|
3
4
|
input: string;
|
|
@@ -17,6 +18,10 @@ export interface ResolvedDrug {
|
|
|
17
18
|
brand_name: string;
|
|
18
19
|
/** Arabic trade name */
|
|
19
20
|
brand_name_ar?: string | undefined;
|
|
21
|
+
/** Concise registered name plus strength, useful for app display and local matching. */
|
|
22
|
+
display_name?: string | undefined;
|
|
23
|
+
/** Arabic concise registered name plus strength, when available. */
|
|
24
|
+
display_name_ar?: string | undefined;
|
|
20
25
|
/** Active pharmaceutical ingredient(s), pipe-separated for combinations */
|
|
21
26
|
active_ingredient: string;
|
|
22
27
|
/** Arabic active ingredient name */
|
|
@@ -29,10 +34,30 @@ export interface ResolvedDrug {
|
|
|
29
34
|
form: string;
|
|
30
35
|
/** Arabic dosage form */
|
|
31
36
|
form_ar?: string | undefined;
|
|
37
|
+
/** Registered strength text as listed for the product. */
|
|
38
|
+
strength?: string | undefined;
|
|
39
|
+
/** Administration route, when available. */
|
|
40
|
+
route?: string | undefined;
|
|
32
41
|
/** Marketing authorization holder */
|
|
33
42
|
manufacturer_en?: string | undefined;
|
|
34
43
|
/** ATC-based therapeutic classification, pipe-separated hierarchy */
|
|
35
44
|
therapeutic_class?: string | undefined;
|
|
45
|
+
/** Public therapeutic/pharmacology summary in English. */
|
|
46
|
+
therapeutic_class_detail?: string | undefined;
|
|
47
|
+
/** Public therapeutic/pharmacology summary in Arabic, when available. */
|
|
48
|
+
therapeutic_class_detail_ar?: string | undefined;
|
|
49
|
+
/** Registered pharmaceutical uses or indications in English, when available. */
|
|
50
|
+
pharma_uses?: string | undefined;
|
|
51
|
+
/** Registered pharmaceutical uses or indications in Arabic, when available. */
|
|
52
|
+
pharma_uses_ar?: string | undefined;
|
|
53
|
+
/** Patient/app-friendly product description in English, when available. */
|
|
54
|
+
description?: string | undefined;
|
|
55
|
+
/** Patient/app-friendly product description in Arabic, when available. */
|
|
56
|
+
description_ar?: string | undefined;
|
|
57
|
+
/** Mechanism of action summary in English, when available. */
|
|
58
|
+
mechanism?: string | undefined;
|
|
59
|
+
/** Public warning summary in English, when available. */
|
|
60
|
+
warnings?: string | undefined;
|
|
36
61
|
/** Primary prescribing specialty */
|
|
37
62
|
medical_specialty?: string | undefined;
|
|
38
63
|
/** Distribution/supply company (may be empty) */
|
|
@@ -41,4 +66,5 @@ export interface ResolvedDrug {
|
|
|
41
66
|
barcode?: string | undefined;
|
|
42
67
|
/** Current price in Egyptian Pounds (EGP) */
|
|
43
68
|
price_egp?: number | undefined;
|
|
69
|
+
identity_match?: SafeRx.IdentityMatch | undefined;
|
|
44
70
|
}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
export * from "./AdverseEffect.js";
|
|
2
2
|
export * from "./Alert.js";
|
|
3
|
+
export * from "./AllergyCrossReactivityReference.js";
|
|
4
|
+
export * from "./AllergyData.js";
|
|
5
|
+
export * from "./AllergyFamilyReference.js";
|
|
6
|
+
export * from "./AllergyInputEntry.js";
|
|
7
|
+
export * from "./AllergyProductFamilyReference.js";
|
|
8
|
+
export * from "./AllergySummary.js";
|
|
9
|
+
export * from "./AllergyWarning.js";
|
|
3
10
|
export * from "./BadRequestErrorBody.js";
|
|
4
11
|
export * from "./BlackBoxWarning.js";
|
|
5
12
|
export * from "./BlockedResponse.js";
|
|
6
13
|
export * from "./ClinicalAlert.js";
|
|
7
14
|
export * from "./ClinicalConcern.js";
|
|
15
|
+
export * from "./ClinicalContextApplied.js";
|
|
8
16
|
export * from "./ClinicalData.js";
|
|
9
17
|
export * from "./Condition.js";
|
|
10
18
|
export * from "./DailyLimit.js";
|
|
@@ -18,17 +26,25 @@ export * from "./ErrorResponse.js";
|
|
|
18
26
|
export * from "./FoodConflict.js";
|
|
19
27
|
export * from "./FoodData.js";
|
|
20
28
|
export * from "./ForbiddenErrorBody.js";
|
|
29
|
+
export * from "./IdentityMatch.js";
|
|
30
|
+
export * from "./IntelligenceClinicalProfile.js";
|
|
31
|
+
export * from "./IntelligenceContext.js";
|
|
32
|
+
export * from "./IntelligenceProcessorError.js";
|
|
33
|
+
export * from "./IntelligenceResult.js";
|
|
34
|
+
export * from "./IntelligenceSynthesis.js";
|
|
21
35
|
export * from "./Interaction.js";
|
|
22
36
|
export * from "./InteractionSummary.js";
|
|
23
37
|
export * from "./InteractionsData.js";
|
|
24
38
|
export * from "./InternalServerErrorBody.js";
|
|
25
39
|
export * from "./MealTiming.js";
|
|
40
|
+
export * from "./MedicationHistoryItem.js";
|
|
26
41
|
export * from "./Meta.js";
|
|
27
42
|
export * from "./MetadataResponse.js";
|
|
28
43
|
export * from "./Monitoring.js";
|
|
29
44
|
export * from "./PatientProfile.js";
|
|
30
45
|
export * from "./Population.js";
|
|
31
46
|
export * from "./PopulationMonitoring.js";
|
|
47
|
+
export * from "./QuotaMeta.js";
|
|
32
48
|
export * from "./RateLimitResponse.js";
|
|
33
49
|
export * from "./ReferenceDose.js";
|
|
34
50
|
export * from "./ReproductiveSafetyData.js";
|
|
@@ -16,11 +16,19 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./AdverseEffect.js"), exports);
|
|
18
18
|
__exportStar(require("./Alert.js"), exports);
|
|
19
|
+
__exportStar(require("./AllergyCrossReactivityReference.js"), exports);
|
|
20
|
+
__exportStar(require("./AllergyData.js"), exports);
|
|
21
|
+
__exportStar(require("./AllergyFamilyReference.js"), exports);
|
|
22
|
+
__exportStar(require("./AllergyInputEntry.js"), exports);
|
|
23
|
+
__exportStar(require("./AllergyProductFamilyReference.js"), exports);
|
|
24
|
+
__exportStar(require("./AllergySummary.js"), exports);
|
|
25
|
+
__exportStar(require("./AllergyWarning.js"), exports);
|
|
19
26
|
__exportStar(require("./BadRequestErrorBody.js"), exports);
|
|
20
27
|
__exportStar(require("./BlackBoxWarning.js"), exports);
|
|
21
28
|
__exportStar(require("./BlockedResponse.js"), exports);
|
|
22
29
|
__exportStar(require("./ClinicalAlert.js"), exports);
|
|
23
30
|
__exportStar(require("./ClinicalConcern.js"), exports);
|
|
31
|
+
__exportStar(require("./ClinicalContextApplied.js"), exports);
|
|
24
32
|
__exportStar(require("./ClinicalData.js"), exports);
|
|
25
33
|
__exportStar(require("./Condition.js"), exports);
|
|
26
34
|
__exportStar(require("./DailyLimit.js"), exports);
|
|
@@ -34,17 +42,25 @@ __exportStar(require("./ErrorResponse.js"), exports);
|
|
|
34
42
|
__exportStar(require("./FoodConflict.js"), exports);
|
|
35
43
|
__exportStar(require("./FoodData.js"), exports);
|
|
36
44
|
__exportStar(require("./ForbiddenErrorBody.js"), exports);
|
|
45
|
+
__exportStar(require("./IdentityMatch.js"), exports);
|
|
46
|
+
__exportStar(require("./IntelligenceClinicalProfile.js"), exports);
|
|
47
|
+
__exportStar(require("./IntelligenceContext.js"), exports);
|
|
48
|
+
__exportStar(require("./IntelligenceProcessorError.js"), exports);
|
|
49
|
+
__exportStar(require("./IntelligenceResult.js"), exports);
|
|
50
|
+
__exportStar(require("./IntelligenceSynthesis.js"), exports);
|
|
37
51
|
__exportStar(require("./Interaction.js"), exports);
|
|
38
52
|
__exportStar(require("./InteractionSummary.js"), exports);
|
|
39
53
|
__exportStar(require("./InteractionsData.js"), exports);
|
|
40
54
|
__exportStar(require("./InternalServerErrorBody.js"), exports);
|
|
41
55
|
__exportStar(require("./MealTiming.js"), exports);
|
|
56
|
+
__exportStar(require("./MedicationHistoryItem.js"), exports);
|
|
42
57
|
__exportStar(require("./Meta.js"), exports);
|
|
43
58
|
__exportStar(require("./MetadataResponse.js"), exports);
|
|
44
59
|
__exportStar(require("./Monitoring.js"), exports);
|
|
45
60
|
__exportStar(require("./PatientProfile.js"), exports);
|
|
46
61
|
__exportStar(require("./Population.js"), exports);
|
|
47
62
|
__exportStar(require("./PopulationMonitoring.js"), exports);
|
|
63
|
+
__exportStar(require("./QuotaMeta.js"), exports);
|
|
48
64
|
__exportStar(require("./RateLimitResponse.js"), exports);
|
|
49
65
|
__exportStar(require("./ReferenceDose.js"), exports);
|
|
50
66
|
__exportStar(require("./ReproductiveSafetyData.js"), exports);
|
|
@@ -14,6 +14,6 @@ export type BinaryResponse = {
|
|
|
14
14
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes)
|
|
15
15
|
* Some versions of the Fetch API may not support this method.
|
|
16
16
|
*/
|
|
17
|
-
bytes?():
|
|
17
|
+
bytes?(): Promise<Uint8Array>;
|
|
18
18
|
};
|
|
19
19
|
export declare function getBinaryResponse(response: Response): BinaryResponse;
|
|
@@ -206,7 +206,7 @@ function fetcherImpl(args) {
|
|
|
206
206
|
}
|
|
207
207
|
try {
|
|
208
208
|
const response = yield (0, requestWithRetries_js_1.requestWithRetries)(() => __awaiter(this, void 0, void 0, function* () {
|
|
209
|
-
return (0, makeRequest_js_1.makeRequest)(fetchFn, url, args.method, headers, requestBody, args.timeoutMs, args.abortSignal, args.withCredentials, args.duplex);
|
|
209
|
+
return (0, makeRequest_js_1.makeRequest)(fetchFn, url, args.method, headers, requestBody, args.timeoutMs, args.abortSignal, args.withCredentials, args.duplex, args.responseType === "streaming" || args.responseType === "sse");
|
|
210
210
|
}), args.maxRetries);
|
|
211
211
|
if (response.status >= 200 && response.status < 400) {
|
|
212
212
|
if (logger.isDebug()) {
|
|
@@ -6,6 +6,8 @@ export type { Fetcher, FetchFunction } from "./Fetcher.js";
|
|
|
6
6
|
export { fetcher } from "./Fetcher.js";
|
|
7
7
|
export { getHeader } from "./getHeader.js";
|
|
8
8
|
export { HttpResponsePromise } from "./HttpResponsePromise.js";
|
|
9
|
+
export type { PassthroughRequest } from "./makePassthroughRequest.js";
|
|
10
|
+
export { makePassthroughRequest } from "./makePassthroughRequest.js";
|
|
9
11
|
export type { RawResponse, WithRawResponse } from "./RawResponse.js";
|
|
10
12
|
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js";
|
|
11
13
|
export { Supplier } from "./Supplier.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Supplier = exports.unknownRawResponse = exports.toRawResponse = exports.abortRawResponse = exports.HttpResponsePromise = exports.getHeader = exports.fetcher = exports.EndpointSupplier = void 0;
|
|
3
|
+
exports.Supplier = exports.unknownRawResponse = exports.toRawResponse = exports.abortRawResponse = exports.makePassthroughRequest = exports.HttpResponsePromise = exports.getHeader = exports.fetcher = exports.EndpointSupplier = void 0;
|
|
4
4
|
var EndpointSupplier_js_1 = require("./EndpointSupplier.js");
|
|
5
5
|
Object.defineProperty(exports, "EndpointSupplier", { enumerable: true, get: function () { return EndpointSupplier_js_1.EndpointSupplier; } });
|
|
6
6
|
var Fetcher_js_1 = require("./Fetcher.js");
|
|
@@ -9,6 +9,8 @@ var getHeader_js_1 = require("./getHeader.js");
|
|
|
9
9
|
Object.defineProperty(exports, "getHeader", { enumerable: true, get: function () { return getHeader_js_1.getHeader; } });
|
|
10
10
|
var HttpResponsePromise_js_1 = require("./HttpResponsePromise.js");
|
|
11
11
|
Object.defineProperty(exports, "HttpResponsePromise", { enumerable: true, get: function () { return HttpResponsePromise_js_1.HttpResponsePromise; } });
|
|
12
|
+
var makePassthroughRequest_js_1 = require("./makePassthroughRequest.js");
|
|
13
|
+
Object.defineProperty(exports, "makePassthroughRequest", { enumerable: true, get: function () { return makePassthroughRequest_js_1.makePassthroughRequest; } });
|
|
12
14
|
var RawResponse_js_1 = require("./RawResponse.js");
|
|
13
15
|
Object.defineProperty(exports, "abortRawResponse", { enumerable: true, get: function () { return RawResponse_js_1.abortRawResponse; } });
|
|
14
16
|
Object.defineProperty(exports, "toRawResponse", { enumerable: true, get: function () { return RawResponse_js_1.toRawResponse; } });
|
|
@@ -0,0 +1,49 @@
|
|
|
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>;
|
|
@@ -0,0 +1,135 @@
|
|
|
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 +1,6 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function isCacheNoStoreSupported(): boolean;
|
|
2
|
+
/**
|
|
3
|
+
* Reset the cached result of `isCacheNoStoreSupported`. Exposed for testing only.
|
|
4
|
+
*/
|
|
5
|
+
export declare function resetCacheNoStoreSupported(): void;
|
|
6
|
+
export declare const makeRequest: (fetchFn: (url: string, init: RequestInit) => Promise<Response>, url: string, method: string, headers: Headers | Record<string, string>, requestBody: BodyInit | undefined, timeoutMs?: number, abortSignal?: AbortSignal, withCredentials?: boolean, duplex?: "half", disableCache?: boolean) => Promise<Response>;
|
|
@@ -10,8 +10,35 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.makeRequest = void 0;
|
|
13
|
+
exports.isCacheNoStoreSupported = isCacheNoStoreSupported;
|
|
14
|
+
exports.resetCacheNoStoreSupported = resetCacheNoStoreSupported;
|
|
13
15
|
const signals_js_1 = require("./signals.js");
|
|
14
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Cached result of checking whether the current runtime supports
|
|
18
|
+
* the `cache` option in `Request`. Some runtimes (e.g. Cloudflare Workers)
|
|
19
|
+
* throw a TypeError when this option is used.
|
|
20
|
+
*/
|
|
21
|
+
let _cacheNoStoreSupported;
|
|
22
|
+
function isCacheNoStoreSupported() {
|
|
23
|
+
if (_cacheNoStoreSupported != null) {
|
|
24
|
+
return _cacheNoStoreSupported;
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
new Request("http://localhost", { cache: "no-store" });
|
|
28
|
+
_cacheNoStoreSupported = true;
|
|
29
|
+
}
|
|
30
|
+
catch (_a) {
|
|
31
|
+
_cacheNoStoreSupported = false;
|
|
32
|
+
}
|
|
33
|
+
return _cacheNoStoreSupported;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Reset the cached result of `isCacheNoStoreSupported`. Exposed for testing only.
|
|
37
|
+
*/
|
|
38
|
+
function resetCacheNoStoreSupported() {
|
|
39
|
+
_cacheNoStoreSupported = undefined;
|
|
40
|
+
}
|
|
41
|
+
const makeRequest = (fetchFn, url, method, headers, requestBody, timeoutMs, abortSignal, withCredentials, duplex, disableCache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
42
|
const signals = [];
|
|
16
43
|
let timeoutAbortId;
|
|
17
44
|
if (timeoutMs != null) {
|
|
@@ -23,15 +50,9 @@ const makeRequest = (fetchFn, url, method, headers, requestBody, timeoutMs, abor
|
|
|
23
50
|
signals.push(abortSignal);
|
|
24
51
|
}
|
|
25
52
|
const newSignals = (0, signals_js_1.anySignal)(signals);
|
|
26
|
-
const response = yield fetchFn(url, {
|
|
27
|
-
method: method,
|
|
28
|
-
headers,
|
|
29
|
-
body: requestBody,
|
|
30
|
-
signal: newSignals,
|
|
31
|
-
credentials: withCredentials ? "include" : undefined,
|
|
53
|
+
const response = yield fetchFn(url, Object.assign({ method: method, headers, body: requestBody, signal: newSignals, credentials: withCredentials ? "include" : undefined,
|
|
32
54
|
// @ts-ignore
|
|
33
|
-
duplex,
|
|
34
|
-
});
|
|
55
|
+
duplex }, (disableCache && isCacheNoStoreSupported() ? { cache: "no-store" } : {})));
|
|
35
56
|
if (timeoutAbortId != null) {
|
|
36
57
|
clearTimeout(timeoutAbortId);
|
|
37
58
|
}
|
|
@@ -84,17 +84,18 @@ function evaluateRuntime() {
|
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
86
|
* A constant that indicates whether the environment the code is running is Node.JS.
|
|
87
|
+
*
|
|
88
|
+
* We assign `process` to a local variable first to avoid being flagged by
|
|
89
|
+
* bundlers that perform static analysis on `process.versions` (e.g. Next.js
|
|
90
|
+
* Edge Runtime warns about Node.js APIs even when they are guarded).
|
|
87
91
|
*/
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
!!process.version &&
|
|
91
|
-
"versions" in process &&
|
|
92
|
-
!!((_e = process.versions) === null || _e === void 0 ? void 0 : _e.node);
|
|
92
|
+
const _process = typeof process !== "undefined" ? process : undefined;
|
|
93
|
+
const isNode = typeof _process !== "undefined" && typeof ((_e = _process.versions) === null || _e === void 0 ? void 0 : _e.node) === "string";
|
|
93
94
|
if (isNode) {
|
|
94
95
|
return {
|
|
95
96
|
type: "node",
|
|
96
|
-
version:
|
|
97
|
-
parsedVersion: Number(
|
|
97
|
+
version: _process.versions.node,
|
|
98
|
+
parsedVersion: Number(_process.versions.node.split(".")[0]),
|
|
98
99
|
};
|
|
99
100
|
}
|
|
100
101
|
return {
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.4.
|
|
1
|
+
export declare const SDK_VERSION = "1.4.2";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "saferx-pharma-sdk",
|
|
9
|
-
"X-Fern-SDK-Version": "1.4.
|
|
10
|
-
"User-Agent": "saferx-pharma-sdk/1.4.
|
|
9
|
+
"X-Fern-SDK-Version": "1.4.2",
|
|
10
|
+
"User-Agent": "saferx-pharma-sdk/1.4.2",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
package/dist/esm/Client.d.mts
CHANGED
|
@@ -2,6 +2,7 @@ import { DevelopersClient } from "./api/resources/developers/client/Client.mjs";
|
|
|
2
2
|
import { DrugSafetyClient } from "./api/resources/drugSafety/client/Client.mjs";
|
|
3
3
|
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.mjs";
|
|
4
4
|
import { type NormalizedClientOptionsWithAuth } from "./BaseClient.mjs";
|
|
5
|
+
import * as core from "./core/index.mjs";
|
|
5
6
|
export declare namespace SafeRxClient {
|
|
6
7
|
type Options = BaseClientOptions;
|
|
7
8
|
interface RequestOptions extends BaseRequestOptions {
|
|
@@ -14,4 +15,15 @@ export declare class SafeRxClient {
|
|
|
14
15
|
constructor(options?: SafeRxClient.Options);
|
|
15
16
|
get drugSafety(): DrugSafetyClient;
|
|
16
17
|
get developers(): DevelopersClient;
|
|
18
|
+
/**
|
|
19
|
+
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
20
|
+
* This is useful for making requests to endpoints not yet supported in the SDK.
|
|
21
|
+
* The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
|
|
22
|
+
*
|
|
23
|
+
* @param {Request | string | URL} input - The URL, path, or Request object.
|
|
24
|
+
* @param {RequestInit} init - Standard fetch RequestInit options.
|
|
25
|
+
* @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
|
|
26
|
+
* @returns {Promise<Response>} A standard Response object.
|
|
27
|
+
*/
|
|
28
|
+
fetch(input: Request | string | URL, init?: RequestInit, requestOptions?: core.PassthroughRequest.RequestOptions): Promise<Response>;
|
|
17
29
|
}
|
package/dist/esm/Client.mjs
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
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
|
+
};
|
|
2
11
|
import { DevelopersClient } from "./api/resources/developers/client/Client.mjs";
|
|
3
12
|
import { DrugSafetyClient } from "./api/resources/drugSafety/client/Client.mjs";
|
|
4
13
|
import { normalizeClientOptionsWithAuth } from "./BaseClient.mjs";
|
|
14
|
+
import * as core from "./core/index.mjs";
|
|
5
15
|
export class SafeRxClient {
|
|
6
16
|
constructor(options = {}) {
|
|
7
17
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
@@ -14,4 +24,28 @@ export class SafeRxClient {
|
|
|
14
24
|
var _a;
|
|
15
25
|
return ((_a = this._developers) !== null && _a !== void 0 ? _a : (this._developers = new DevelopersClient(this._options)));
|
|
16
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
29
|
+
* This is useful for making requests to endpoints not yet supported in the SDK.
|
|
30
|
+
* The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
|
|
31
|
+
*
|
|
32
|
+
* @param {Request | string | URL} input - The URL, path, or Request object.
|
|
33
|
+
* @param {RequestInit} init - Standard fetch RequestInit options.
|
|
34
|
+
* @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
|
|
35
|
+
* @returns {Promise<Response>} A standard Response object.
|
|
36
|
+
*/
|
|
37
|
+
fetch(input, init, requestOptions) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
var _a;
|
|
40
|
+
return core.makePassthroughRequest(input, init, {
|
|
41
|
+
baseUrl: (_a = this._options.baseUrl) !== null && _a !== void 0 ? _a : this._options.environment,
|
|
42
|
+
headers: this._options.headers,
|
|
43
|
+
timeoutInSeconds: this._options.timeoutInSeconds,
|
|
44
|
+
maxRetries: this._options.maxRetries,
|
|
45
|
+
fetch: this._options.fetch,
|
|
46
|
+
logging: this._options.logging,
|
|
47
|
+
getAuthHeaders: () => __awaiter(this, void 0, void 0, function* () { return (yield this._options.authProvider.getAuthRequest()).headers; }),
|
|
48
|
+
}, requestOptions);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
17
51
|
}
|
|
@@ -37,7 +37,7 @@ export declare class DevelopersClient {
|
|
|
37
37
|
* - Code expires after 30 minutes
|
|
38
38
|
* - Max 5 wrong attempts per code (then must request new code)
|
|
39
39
|
* - On success: issues sfx_free_ key (persistent, 1 per email)
|
|
40
|
-
* - Free tier: 20 requests/minute, 60
|
|
40
|
+
* - Free tier: 100 checks/month, 20 requests/minute anti-abuse, 60/day safety cap
|
|
41
41
|
*
|
|
42
42
|
* @param {SafeRx.VerifyFreeKeyDevelopersRequest} request
|
|
43
43
|
* @param {DevelopersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -88,7 +88,7 @@ export class DevelopersClient {
|
|
|
88
88
|
* - Code expires after 30 minutes
|
|
89
89
|
* - Max 5 wrong attempts per code (then must request new code)
|
|
90
90
|
* - On success: issues sfx_free_ key (persistent, 1 per email)
|
|
91
|
-
* - Free tier: 20 requests/minute, 60
|
|
91
|
+
* - Free tier: 100 checks/month, 20 requests/minute anti-abuse, 60/day safety cap
|
|
92
92
|
*
|
|
93
93
|
* @param {SafeRx.VerifyFreeKeyDevelopersRequest} request
|
|
94
94
|
* @param {DevelopersClient.RequestOptions} requestOptions - Request-specific configuration.
|