saferx-pharma-sdk 0.0.10 → 0.0.11
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/api/errors/BadRequestError.d.ts +1 -2
- package/dist/cjs/api/errors/InternalServerError.d.ts +1 -2
- package/dist/cjs/api/errors/TooManyRequestsError.d.ts +1 -2
- package/dist/cjs/api/resources/developers/client/Client.d.ts +29 -6
- package/dist/cjs/api/resources/developers/client/Client.js +74 -7
- package/dist/cjs/api/resources/developers/client/requests/VerifyFreeKeyDevelopersRequest.d.ts +13 -0
- package/dist/cjs/api/resources/developers/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/developers/types/CreateFreeKeyDevelopersResponse.d.ts +15 -15
- package/dist/cjs/api/resources/developers/types/CreateFreeKeyDevelopersResponse.js +0 -7
- package/dist/cjs/api/resources/developers/types/VerifyFreeKeyDevelopersResponse.d.ts +12 -0
- package/dist/cjs/api/resources/{drugSafety/types/CheckDrugSafetyRequestXSafeRxSandbox.js → developers/types/VerifyFreeKeyDevelopersResponse.js} +0 -4
- package/dist/cjs/api/resources/developers/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/developers/types/index.js +1 -0
- package/dist/cjs/api/resources/drugSafety/client/Client.d.ts +2 -3
- package/dist/cjs/api/resources/drugSafety/client/Client.js +8 -22
- package/dist/cjs/api/resources/drugSafety/client/requests/DrugSafetyCheckRequest.d.ts +0 -5
- package/dist/cjs/api/resources/drugSafety/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/resources/drugSafety/types/index.d.ts +0 -2
- package/dist/cjs/api/resources/drugSafety/types/index.js +0 -2
- package/dist/cjs/api/types/BadRequestErrorBody.d.ts +3 -0
- package/dist/cjs/api/{resources/drugSafety/types/GetMetadataDrugSafetyRequestXSafeRxSandbox.js → types/BadRequestErrorBody.js} +0 -4
- package/dist/cjs/api/types/Condition.d.ts +11 -11
- package/dist/cjs/api/types/Condition.js +11 -11
- package/dist/cjs/api/types/DrugSafetyCheckResponse.d.ts +1 -1
- package/dist/cjs/api/types/InternalServerErrorBody.d.ts +3 -0
- package/dist/cjs/api/types/InternalServerErrorBody.js +3 -0
- package/dist/cjs/api/types/TooManyRequestsErrorBody.d.ts +3 -0
- package/dist/cjs/api/types/TooManyRequestsErrorBody.js +3 -0
- package/dist/cjs/api/types/index.d.ts +3 -0
- package/dist/cjs/api/types/index.js +3 -0
- 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/api/errors/BadRequestError.d.mts +1 -2
- package/dist/esm/api/errors/InternalServerError.d.mts +1 -2
- package/dist/esm/api/errors/TooManyRequestsError.d.mts +1 -2
- package/dist/esm/api/resources/developers/client/Client.d.mts +29 -6
- package/dist/esm/api/resources/developers/client/Client.mjs +74 -7
- package/dist/esm/api/resources/developers/client/requests/VerifyFreeKeyDevelopersRequest.d.mts +13 -0
- package/dist/esm/api/resources/developers/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/developers/types/CreateFreeKeyDevelopersResponse.d.mts +15 -15
- package/dist/esm/api/resources/developers/types/CreateFreeKeyDevelopersResponse.mjs +1 -6
- package/dist/esm/api/resources/developers/types/VerifyFreeKeyDevelopersResponse.d.mts +12 -0
- package/dist/esm/api/resources/developers/types/VerifyFreeKeyDevelopersResponse.mjs +2 -0
- package/dist/esm/api/resources/developers/types/index.d.mts +1 -0
- package/dist/esm/api/resources/developers/types/index.mjs +1 -0
- package/dist/esm/api/resources/drugSafety/client/Client.d.mts +2 -3
- package/dist/esm/api/resources/drugSafety/client/Client.mjs +9 -23
- package/dist/esm/api/resources/drugSafety/client/requests/DrugSafetyCheckRequest.d.mts +0 -5
- package/dist/esm/api/resources/drugSafety/client/requests/index.d.mts +0 -1
- package/dist/esm/api/resources/drugSafety/types/index.d.mts +0 -2
- package/dist/esm/api/resources/drugSafety/types/index.mjs +0 -2
- package/dist/esm/api/types/BadRequestErrorBody.d.mts +3 -0
- package/dist/esm/api/types/BadRequestErrorBody.mjs +2 -0
- package/dist/esm/api/types/Condition.d.mts +11 -11
- package/dist/esm/api/types/Condition.mjs +11 -11
- package/dist/esm/api/types/DrugSafetyCheckResponse.d.mts +1 -1
- package/dist/esm/api/types/InternalServerErrorBody.d.mts +3 -0
- package/dist/esm/api/types/InternalServerErrorBody.mjs +2 -0
- package/dist/esm/api/types/TooManyRequestsErrorBody.d.mts +3 -0
- package/dist/esm/api/types/TooManyRequestsErrorBody.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +3 -0
- package/dist/esm/api/types/index.mjs +3 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/dist/cjs/api/resources/drugSafety/client/requests/GetMetadataDrugSafetyRequest.d.ts +0 -9
- package/dist/cjs/api/resources/drugSafety/types/CheckDrugSafetyRequestXSafeRxSandbox.d.ts +0 -4
- package/dist/cjs/api/resources/drugSafety/types/GetMetadataDrugSafetyRequestXSafeRxSandbox.d.ts +0 -4
- package/dist/esm/api/resources/drugSafety/client/requests/GetMetadataDrugSafetyRequest.d.mts +0 -9
- package/dist/esm/api/resources/drugSafety/types/CheckDrugSafetyRequestXSafeRxSandbox.d.mts +0 -4
- package/dist/esm/api/resources/drugSafety/types/CheckDrugSafetyRequestXSafeRxSandbox.mjs +0 -4
- package/dist/esm/api/resources/drugSafety/types/GetMetadataDrugSafetyRequestXSafeRxSandbox.d.mts +0 -4
- package/dist/esm/api/resources/drugSafety/types/GetMetadataDrugSafetyRequestXSafeRxSandbox.mjs +0 -4
- /package/dist/cjs/api/resources/{drugSafety/client/requests/GetMetadataDrugSafetyRequest.js → developers/client/requests/VerifyFreeKeyDevelopersRequest.js} +0 -0
- /package/dist/esm/api/resources/{drugSafety/client/requests/GetMetadataDrugSafetyRequest.mjs → developers/client/requests/VerifyFreeKeyDevelopersRequest.mjs} +0 -0
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "saferx-pharma-sdk",
|
|
46
|
-
"X-Fern-SDK-Version": "0.0.
|
|
47
|
-
"User-Agent": "saferx-pharma-sdk/0.0.
|
|
46
|
+
"X-Fern-SDK-Version": "0.0.11",
|
|
47
|
+
"User-Agent": "saferx-pharma-sdk/0.0.11",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type * as core from "../../core/index.js";
|
|
2
2
|
import * as errors from "../../errors/index.js";
|
|
3
|
-
import type * as SafeRx from "../index.js";
|
|
4
3
|
export declare class BadRequestError extends errors.SafeRxError {
|
|
5
|
-
constructor(body
|
|
4
|
+
constructor(body?: unknown, rawResponse?: core.RawResponse);
|
|
6
5
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type * as core from "../../core/index.js";
|
|
2
2
|
import * as errors from "../../errors/index.js";
|
|
3
|
-
import type * as SafeRx from "../index.js";
|
|
4
3
|
export declare class InternalServerError extends errors.SafeRxError {
|
|
5
|
-
constructor(body
|
|
4
|
+
constructor(body?: unknown, rawResponse?: core.RawResponse);
|
|
6
5
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type * as core from "../../core/index.js";
|
|
2
2
|
import * as errors from "../../errors/index.js";
|
|
3
|
-
import type * as SafeRx from "../index.js";
|
|
4
3
|
export declare class TooManyRequestsError extends errors.SafeRxError {
|
|
5
|
-
constructor(body
|
|
4
|
+
constructor(body?: unknown, rawResponse?: core.RawResponse);
|
|
6
5
|
}
|
|
@@ -11,17 +11,18 @@ export declare class DevelopersClient {
|
|
|
11
11
|
protected readonly _options: NormalizedClientOptions<DevelopersClient.Options>;
|
|
12
12
|
constructor(options?: DevelopersClient.Options);
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Step 1 of 2: Request a verification code to get a free API key.
|
|
15
15
|
*
|
|
16
|
-
* -
|
|
17
|
-
* -
|
|
18
|
-
* -
|
|
19
|
-
* -
|
|
16
|
+
* - Sends a 6-digit code to your email (expires in 30 minutes)
|
|
17
|
+
* - Max 5 codes per email per hour (anti-spam)
|
|
18
|
+
* - If email already has a verified key, returns it immediately
|
|
19
|
+
* - Use POST /api/developers/keys/free/verify with the code to receive your key
|
|
20
20
|
*
|
|
21
21
|
* @param {SafeRx.CreateFreeKeyDevelopersRequest} request
|
|
22
22
|
* @param {DevelopersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
23
23
|
*
|
|
24
|
-
* @throws {@link SafeRx.
|
|
24
|
+
* @throws {@link SafeRx.TooManyRequestsError}
|
|
25
|
+
* @throws {@link SafeRx.InternalServerError}
|
|
25
26
|
*
|
|
26
27
|
* @example
|
|
27
28
|
* await client.developers.createFreeKey({
|
|
@@ -30,4 +31,26 @@ export declare class DevelopersClient {
|
|
|
30
31
|
*/
|
|
31
32
|
createFreeKey(request: SafeRx.CreateFreeKeyDevelopersRequest, requestOptions?: DevelopersClient.RequestOptions): core.HttpResponsePromise<SafeRx.CreateFreeKeyDevelopersResponse>;
|
|
32
33
|
private __createFreeKey;
|
|
34
|
+
/**
|
|
35
|
+
* Step 2 of 2: Verify your email with the 6-digit code and receive your API key.
|
|
36
|
+
*
|
|
37
|
+
* - Code expires after 30 minutes
|
|
38
|
+
* - Max 5 wrong attempts per code (then must request new code)
|
|
39
|
+
* - On success: issues sfx_free_ key (persistent, 1 per email)
|
|
40
|
+
* - Free tier: 20 requests/minute, 60 requests/day
|
|
41
|
+
*
|
|
42
|
+
* @param {SafeRx.VerifyFreeKeyDevelopersRequest} request
|
|
43
|
+
* @param {DevelopersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
44
|
+
*
|
|
45
|
+
* @throws {@link SafeRx.BadRequestError}
|
|
46
|
+
* @throws {@link SafeRx.ForbiddenError}
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* await client.developers.verifyFreeKey({
|
|
50
|
+
* email: "developer@example.com",
|
|
51
|
+
* code: "123456"
|
|
52
|
+
* })
|
|
53
|
+
*/
|
|
54
|
+
verifyFreeKey(request: SafeRx.VerifyFreeKeyDevelopersRequest, requestOptions?: DevelopersClient.RequestOptions): core.HttpResponsePromise<SafeRx.VerifyFreeKeyDevelopersResponse>;
|
|
55
|
+
private __verifyFreeKey;
|
|
33
56
|
}
|
|
@@ -56,17 +56,18 @@ class DevelopersClient {
|
|
|
56
56
|
this._options = (0, BaseClient_js_1.normalizeClientOptions)(options);
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* Step 1 of 2: Request a verification code to get a free API key.
|
|
60
60
|
*
|
|
61
|
-
* -
|
|
62
|
-
* -
|
|
63
|
-
* -
|
|
64
|
-
* -
|
|
61
|
+
* - Sends a 6-digit code to your email (expires in 30 minutes)
|
|
62
|
+
* - Max 5 codes per email per hour (anti-spam)
|
|
63
|
+
* - If email already has a verified key, returns it immediately
|
|
64
|
+
* - Use POST /api/developers/keys/free/verify with the code to receive your key
|
|
65
65
|
*
|
|
66
66
|
* @param {SafeRx.CreateFreeKeyDevelopersRequest} request
|
|
67
67
|
* @param {DevelopersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
68
68
|
*
|
|
69
|
-
* @throws {@link SafeRx.
|
|
69
|
+
* @throws {@link SafeRx.TooManyRequestsError}
|
|
70
|
+
* @throws {@link SafeRx.InternalServerError}
|
|
70
71
|
*
|
|
71
72
|
* @example
|
|
72
73
|
* await client.developers.createFreeKey({
|
|
@@ -102,6 +103,72 @@ class DevelopersClient {
|
|
|
102
103
|
}
|
|
103
104
|
if (_response.error.reason === "status-code") {
|
|
104
105
|
switch (_response.error.statusCode) {
|
|
106
|
+
case 429:
|
|
107
|
+
throw new SafeRx.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
108
|
+
case 500:
|
|
109
|
+
throw new SafeRx.InternalServerError(_response.error.body, _response.rawResponse);
|
|
110
|
+
default:
|
|
111
|
+
throw new errors.SafeRxError({
|
|
112
|
+
statusCode: _response.error.statusCode,
|
|
113
|
+
body: _response.error.body,
|
|
114
|
+
rawResponse: _response.rawResponse,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/api/developers/keys/free");
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Step 2 of 2: Verify your email with the 6-digit code and receive your API key.
|
|
123
|
+
*
|
|
124
|
+
* - Code expires after 30 minutes
|
|
125
|
+
* - Max 5 wrong attempts per code (then must request new code)
|
|
126
|
+
* - On success: issues sfx_free_ key (persistent, 1 per email)
|
|
127
|
+
* - Free tier: 20 requests/minute, 60 requests/day
|
|
128
|
+
*
|
|
129
|
+
* @param {SafeRx.VerifyFreeKeyDevelopersRequest} request
|
|
130
|
+
* @param {DevelopersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
131
|
+
*
|
|
132
|
+
* @throws {@link SafeRx.BadRequestError}
|
|
133
|
+
* @throws {@link SafeRx.ForbiddenError}
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* await client.developers.verifyFreeKey({
|
|
137
|
+
* email: "developer@example.com",
|
|
138
|
+
* code: "123456"
|
|
139
|
+
* })
|
|
140
|
+
*/
|
|
141
|
+
verifyFreeKey(request, requestOptions) {
|
|
142
|
+
return core.HttpResponsePromise.fromPromise(this.__verifyFreeKey(request, requestOptions));
|
|
143
|
+
}
|
|
144
|
+
__verifyFreeKey(request, requestOptions) {
|
|
145
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
147
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
148
|
+
const _response = yield core.fetcher({
|
|
149
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SafeRxEnvironment.Production, "api/developers/keys/free/verify"),
|
|
150
|
+
method: "POST",
|
|
151
|
+
headers: _headers,
|
|
152
|
+
contentType: "application/json",
|
|
153
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
154
|
+
requestType: "json",
|
|
155
|
+
body: request,
|
|
156
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
157
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
158
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
159
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
160
|
+
logging: this._options.logging,
|
|
161
|
+
});
|
|
162
|
+
if (_response.ok) {
|
|
163
|
+
return {
|
|
164
|
+
data: _response.body,
|
|
165
|
+
rawResponse: _response.rawResponse,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
if (_response.error.reason === "status-code") {
|
|
169
|
+
switch (_response.error.statusCode) {
|
|
170
|
+
case 400:
|
|
171
|
+
throw new SafeRx.BadRequestError(_response.error.body, _response.rawResponse);
|
|
105
172
|
case 403:
|
|
106
173
|
throw new SafeRx.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
107
174
|
default:
|
|
@@ -112,7 +179,7 @@ class DevelopersClient {
|
|
|
112
179
|
});
|
|
113
180
|
}
|
|
114
181
|
}
|
|
115
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/api/developers/keys/free");
|
|
182
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/api/developers/keys/free/verify");
|
|
116
183
|
});
|
|
117
184
|
}
|
|
118
185
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* email: "developer@example.com",
|
|
5
|
+
* code: "123456"
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface VerifyFreeKeyDevelopersRequest {
|
|
9
|
+
/** The email you used in step 1 */
|
|
10
|
+
email: string;
|
|
11
|
+
/** 6-digit verification code from email */
|
|
12
|
+
code: string;
|
|
13
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
note?: string | undefined;
|
|
1
|
+
export type CreateFreeKeyDevelopersResponse =
|
|
2
|
+
/**
|
|
3
|
+
* New user - code sent */
|
|
4
|
+
{
|
|
5
|
+
message?: string | undefined;
|
|
6
|
+
email?: string | undefined;
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Existing verified user - key returned */
|
|
10
|
+
| {
|
|
11
|
+
api_key?: string | undefined;
|
|
12
|
+
tier?: string | undefined;
|
|
13
|
+
limits?: {
|
|
15
14
|
requests_per_minute?: number | undefined;
|
|
16
15
|
requests_per_day?: number | undefined;
|
|
17
|
-
}
|
|
18
|
-
|
|
16
|
+
} | undefined;
|
|
17
|
+
note?: string | undefined;
|
|
18
|
+
};
|
|
@@ -1,10 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.CreateFreeKeyDevelopersResponse = void 0;
|
|
5
|
-
var CreateFreeKeyDevelopersResponse;
|
|
6
|
-
(function (CreateFreeKeyDevelopersResponse) {
|
|
7
|
-
CreateFreeKeyDevelopersResponse.Tier = {
|
|
8
|
-
Free: "free",
|
|
9
|
-
};
|
|
10
|
-
})(CreateFreeKeyDevelopersResponse || (exports.CreateFreeKeyDevelopersResponse = CreateFreeKeyDevelopersResponse = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface VerifyFreeKeyDevelopersResponse {
|
|
2
|
+
/** Your persistent free-tier API key */
|
|
3
|
+
api_key?: string | undefined;
|
|
4
|
+
tier?: string | undefined;
|
|
5
|
+
limits?: VerifyFreeKeyDevelopersResponse.Limits | undefined;
|
|
6
|
+
}
|
|
7
|
+
export declare namespace VerifyFreeKeyDevelopersResponse {
|
|
8
|
+
interface Limits {
|
|
9
|
+
requests_per_minute?: number | undefined;
|
|
10
|
+
requests_per_day?: number | undefined;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.CheckDrugSafetyRequestXSafeRxSandbox = void 0;
|
|
5
|
-
exports.CheckDrugSafetyRequestXSafeRxSandbox = {
|
|
6
|
-
True: "true",
|
|
7
|
-
};
|
|
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./CreateFreeKeyDevelopersResponse.js"), exports);
|
|
18
|
+
__exportStar(require("./VerifyFreeKeyDevelopersResponse.js"), exports);
|
|
@@ -72,7 +72,6 @@ export declare class DrugSafetyClient {
|
|
|
72
72
|
* - Verify your tier and rate limits
|
|
73
73
|
* - Cache metadata locally (changes infrequently — safe to cache for 24 hours)
|
|
74
74
|
*
|
|
75
|
-
* @param {SafeRx.GetMetadataDrugSafetyRequest} request
|
|
76
75
|
* @param {DrugSafetyClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
77
76
|
*
|
|
78
77
|
* @throws {@link SafeRx.UnauthorizedError}
|
|
@@ -81,11 +80,11 @@ export declare class DrugSafetyClient {
|
|
|
81
80
|
* @example
|
|
82
81
|
* await client.drugSafety.getMetadata()
|
|
83
82
|
*/
|
|
84
|
-
getMetadata(
|
|
83
|
+
getMetadata(requestOptions?: DrugSafetyClient.RequestOptions): core.HttpResponsePromise<SafeRx.MetadataResponse>;
|
|
85
84
|
private __getMetadata;
|
|
86
85
|
/**
|
|
87
86
|
* Returns health status of the Drug Safety API subsystem including
|
|
88
|
-
*
|
|
87
|
+
* overall system health and availability.
|
|
89
88
|
*
|
|
90
89
|
* No authentication required. Designed for monitoring services.
|
|
91
90
|
*
|
|
@@ -42,17 +42,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
42
42
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
46
|
-
var t = {};
|
|
47
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
48
|
-
t[p] = s[p];
|
|
49
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
50
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
51
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
52
|
-
t[p[i]] = s[p[i]];
|
|
53
|
-
}
|
|
54
|
-
return t;
|
|
55
|
-
};
|
|
56
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
46
|
exports.DrugSafetyClient = void 0;
|
|
58
47
|
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
@@ -122,9 +111,8 @@ class DrugSafetyClient {
|
|
|
122
111
|
__check(request, requestOptions) {
|
|
123
112
|
return __awaiter(this, void 0, void 0, function* () {
|
|
124
113
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
125
|
-
const { "X-SafeRx-Sandbox": safeRxSandbox } = request, _body = __rest(request, ["X-SafeRx-Sandbox"]);
|
|
126
114
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
127
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
115
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
128
116
|
const _response = yield core.fetcher({
|
|
129
117
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SafeRxEnvironment.Production, "api/drug_safety/check"),
|
|
130
118
|
method: "POST",
|
|
@@ -132,7 +120,7 @@ class DrugSafetyClient {
|
|
|
132
120
|
contentType: "application/json",
|
|
133
121
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
134
122
|
requestType: "json",
|
|
135
|
-
body:
|
|
123
|
+
body: request,
|
|
136
124
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
137
125
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
138
126
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -175,7 +163,6 @@ class DrugSafetyClient {
|
|
|
175
163
|
* - Verify your tier and rate limits
|
|
176
164
|
* - Cache metadata locally (changes infrequently — safe to cache for 24 hours)
|
|
177
165
|
*
|
|
178
|
-
* @param {SafeRx.GetMetadataDrugSafetyRequest} request
|
|
179
166
|
* @param {DrugSafetyClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
180
167
|
*
|
|
181
168
|
* @throws {@link SafeRx.UnauthorizedError}
|
|
@@ -184,15 +171,14 @@ class DrugSafetyClient {
|
|
|
184
171
|
* @example
|
|
185
172
|
* await client.drugSafety.getMetadata()
|
|
186
173
|
*/
|
|
187
|
-
getMetadata(
|
|
188
|
-
return core.HttpResponsePromise.fromPromise(this.__getMetadata(
|
|
174
|
+
getMetadata(requestOptions) {
|
|
175
|
+
return core.HttpResponsePromise.fromPromise(this.__getMetadata(requestOptions));
|
|
189
176
|
}
|
|
190
|
-
__getMetadata() {
|
|
191
|
-
return __awaiter(this,
|
|
177
|
+
__getMetadata(requestOptions) {
|
|
178
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
192
179
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
193
|
-
const { "X-SafeRx-Sandbox": safeRxSandbox } = request;
|
|
194
180
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
195
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
181
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
196
182
|
const _response = yield core.fetcher({
|
|
197
183
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SafeRxEnvironment.Production, "api/drug_safety/metadata"),
|
|
198
184
|
method: "GET",
|
|
@@ -226,7 +212,7 @@ class DrugSafetyClient {
|
|
|
226
212
|
}
|
|
227
213
|
/**
|
|
228
214
|
* Returns health status of the Drug Safety API subsystem including
|
|
229
|
-
*
|
|
215
|
+
* overall system health and availability.
|
|
230
216
|
*
|
|
231
217
|
* No authentication required. Designed for monitoring services.
|
|
232
218
|
*
|
|
@@ -30,11 +30,6 @@ import type * as SafeRx from "../../../../index.js";
|
|
|
30
30
|
* }
|
|
31
31
|
*/
|
|
32
32
|
export interface DrugSafetyCheckRequest {
|
|
33
|
-
/**
|
|
34
|
-
* Set to `true` to use sandbox mode. Sandbox restricts drug resolution
|
|
35
|
-
* to a 500-product subset for safe testing. Response includes `"sandbox": true` in meta.
|
|
36
|
-
*/
|
|
37
|
-
"X-SafeRx-Sandbox"?: SafeRx.CheckDrugSafetyRequestXSafeRxSandbox;
|
|
38
33
|
/**
|
|
39
34
|
* Drug names to screen. Accepts trade names (e.g., "Augmentin 1g"),
|
|
40
35
|
* generic names (e.g., "amoxicillin"), or partial matches.
|
|
@@ -14,6 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./CheckDrugSafetyRequestXSafeRxSandbox.js"), exports);
|
|
18
17
|
__exportStar(require("./GetDrugSafetyHealthResponse.js"), exports);
|
|
19
|
-
__exportStar(require("./GetMetadataDrugSafetyRequestXSafeRxSandbox.js"), exports);
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.GetMetadataDrugSafetyRequestXSafeRxSandbox = void 0;
|
|
5
|
-
exports.GetMetadataDrugSafetyRequestXSafeRxSandbox = {
|
|
6
|
-
True: "true",
|
|
7
|
-
};
|
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
* with these conditions.
|
|
5
5
|
*/
|
|
6
6
|
export declare const Condition: {
|
|
7
|
+
readonly Arrhythmia: "arrhythmia";
|
|
8
|
+
readonly Asthma: "asthma";
|
|
9
|
+
readonly Bph: "bph";
|
|
10
|
+
readonly Coronary: "coronary";
|
|
11
|
+
readonly Depression: "depression";
|
|
7
12
|
readonly Diabetes: "diabetes";
|
|
8
|
-
readonly Hypertension: "hypertension";
|
|
9
13
|
readonly Epilepsy: "epilepsy";
|
|
14
|
+
readonly GiBleeding: "gi_bleeding";
|
|
15
|
+
readonly Glaucoma: "glaucoma";
|
|
10
16
|
readonly HeartFailure: "heart_failure";
|
|
11
|
-
readonly
|
|
12
|
-
readonly
|
|
13
|
-
readonly
|
|
14
|
-
readonly
|
|
15
|
-
readonly Depression: "depression";
|
|
16
|
-
readonly BloodDisorders: "blood_disorders";
|
|
17
|
-
readonly IschemicHeart: "ischemic_heart";
|
|
18
|
-
readonly Arrhythmia: "arrhythmia";
|
|
19
|
-
readonly Gout: "gout";
|
|
20
|
-
readonly Osteoporosis: "osteoporosis";
|
|
17
|
+
readonly Hypertension: "hypertension";
|
|
18
|
+
readonly Hyperthyroidism: "hyperthyroidism";
|
|
19
|
+
readonly Hypothyroidism: "hypothyroidism";
|
|
20
|
+
readonly Parkinsons: "parkinsons";
|
|
21
21
|
};
|
|
22
22
|
export type Condition = (typeof Condition)[keyof typeof Condition];
|
|
@@ -8,18 +8,18 @@ exports.Condition = void 0;
|
|
|
8
8
|
* with these conditions.
|
|
9
9
|
*/
|
|
10
10
|
exports.Condition = {
|
|
11
|
+
Arrhythmia: "arrhythmia",
|
|
12
|
+
Asthma: "asthma",
|
|
13
|
+
Bph: "bph",
|
|
14
|
+
Coronary: "coronary",
|
|
15
|
+
Depression: "depression",
|
|
11
16
|
Diabetes: "diabetes",
|
|
12
|
-
Hypertension: "hypertension",
|
|
13
17
|
Epilepsy: "epilepsy",
|
|
18
|
+
GiBleeding: "gi_bleeding",
|
|
19
|
+
Glaucoma: "glaucoma",
|
|
14
20
|
HeartFailure: "heart_failure",
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Depression: "depression",
|
|
20
|
-
BloodDisorders: "blood_disorders",
|
|
21
|
-
IschemicHeart: "ischemic_heart",
|
|
22
|
-
Arrhythmia: "arrhythmia",
|
|
23
|
-
Gout: "gout",
|
|
24
|
-
Osteoporosis: "osteoporosis",
|
|
21
|
+
Hypertension: "hypertension",
|
|
22
|
+
Hyperthyroidism: "hyperthyroidism",
|
|
23
|
+
Hypothyroidism: "hypothyroidism",
|
|
24
|
+
Parkinsons: "parkinsons",
|
|
25
25
|
};
|
|
@@ -7,7 +7,7 @@ export interface DrugSafetyCheckResponse {
|
|
|
7
7
|
/**
|
|
8
8
|
* Drug names that could not be resolved to a SafeRx product.
|
|
9
9
|
* These are not errors — they simply did not match any product
|
|
10
|
-
* with sufficient confidence
|
|
10
|
+
* with sufficient confidence.
|
|
11
11
|
*/
|
|
12
12
|
unresolved: string[];
|
|
13
13
|
safety: SafeRx.SafetyData;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./AdverseEffect.js";
|
|
2
2
|
export * from "./Alert.js";
|
|
3
|
+
export * from "./BadRequestErrorBody.js";
|
|
3
4
|
export * from "./BlackBoxWarning.js";
|
|
4
5
|
export * from "./BlockedResponse.js";
|
|
5
6
|
export * from "./ClinicalAlert.js";
|
|
@@ -20,6 +21,7 @@ export * from "./ForbiddenErrorBody.js";
|
|
|
20
21
|
export * from "./Interaction.js";
|
|
21
22
|
export * from "./InteractionSummary.js";
|
|
22
23
|
export * from "./InteractionsData.js";
|
|
24
|
+
export * from "./InternalServerErrorBody.js";
|
|
23
25
|
export * from "./MealTiming.js";
|
|
24
26
|
export * from "./Meta.js";
|
|
25
27
|
export * from "./MetadataResponse.js";
|
|
@@ -34,3 +36,4 @@ export * from "./ReproductiveWarning.js";
|
|
|
34
36
|
export * from "./ResolvedDrug.js";
|
|
35
37
|
export * from "./SafetyData.js";
|
|
36
38
|
export * from "./SideEffectsData.js";
|
|
39
|
+
export * from "./TooManyRequestsErrorBody.js";
|
|
@@ -16,6 +16,7 @@ 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("./BadRequestErrorBody.js"), exports);
|
|
19
20
|
__exportStar(require("./BlackBoxWarning.js"), exports);
|
|
20
21
|
__exportStar(require("./BlockedResponse.js"), exports);
|
|
21
22
|
__exportStar(require("./ClinicalAlert.js"), exports);
|
|
@@ -36,6 +37,7 @@ __exportStar(require("./ForbiddenErrorBody.js"), exports);
|
|
|
36
37
|
__exportStar(require("./Interaction.js"), exports);
|
|
37
38
|
__exportStar(require("./InteractionSummary.js"), exports);
|
|
38
39
|
__exportStar(require("./InteractionsData.js"), exports);
|
|
40
|
+
__exportStar(require("./InternalServerErrorBody.js"), exports);
|
|
39
41
|
__exportStar(require("./MealTiming.js"), exports);
|
|
40
42
|
__exportStar(require("./Meta.js"), exports);
|
|
41
43
|
__exportStar(require("./MetadataResponse.js"), exports);
|
|
@@ -50,3 +52,4 @@ __exportStar(require("./ReproductiveWarning.js"), exports);
|
|
|
50
52
|
__exportStar(require("./ResolvedDrug.js"), exports);
|
|
51
53
|
__exportStar(require("./SafetyData.js"), exports);
|
|
52
54
|
__exportStar(require("./SideEffectsData.js"), exports);
|
|
55
|
+
__exportStar(require("./TooManyRequestsErrorBody.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.
|
|
1
|
+
export declare const SDK_VERSION = "0.0.11";
|
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": "0.0.
|
|
10
|
-
"User-Agent": "saferx-pharma-sdk/0.0.
|
|
9
|
+
"X-Fern-SDK-Version": "0.0.11",
|
|
10
|
+
"User-Agent": "saferx-pharma-sdk/0.0.11",
|
|
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);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type * as core from "../../core/index.mjs";
|
|
2
2
|
import * as errors from "../../errors/index.mjs";
|
|
3
|
-
import type * as SafeRx from "../index.mjs";
|
|
4
3
|
export declare class BadRequestError extends errors.SafeRxError {
|
|
5
|
-
constructor(body
|
|
4
|
+
constructor(body?: unknown, rawResponse?: core.RawResponse);
|
|
6
5
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type * as core from "../../core/index.mjs";
|
|
2
2
|
import * as errors from "../../errors/index.mjs";
|
|
3
|
-
import type * as SafeRx from "../index.mjs";
|
|
4
3
|
export declare class InternalServerError extends errors.SafeRxError {
|
|
5
|
-
constructor(body
|
|
4
|
+
constructor(body?: unknown, rawResponse?: core.RawResponse);
|
|
6
5
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type * as core from "../../core/index.mjs";
|
|
2
2
|
import * as errors from "../../errors/index.mjs";
|
|
3
|
-
import type * as SafeRx from "../index.mjs";
|
|
4
3
|
export declare class TooManyRequestsError extends errors.SafeRxError {
|
|
5
|
-
constructor(body
|
|
4
|
+
constructor(body?: unknown, rawResponse?: core.RawResponse);
|
|
6
5
|
}
|