saferx-pharma-sdk 0.0.22 → 0.0.24

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 (95) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/errors/BadRequestError.d.ts +1 -2
  3. package/dist/cjs/api/errors/InternalServerError.d.ts +1 -2
  4. package/dist/cjs/api/errors/TooManyRequestsError.d.ts +1 -2
  5. package/dist/cjs/api/resources/developers/client/Client.d.ts +29 -6
  6. package/dist/cjs/api/resources/developers/client/Client.js +74 -7
  7. package/dist/cjs/api/resources/developers/client/requests/VerifyFreeKeyDevelopersRequest.d.ts +13 -0
  8. package/dist/cjs/api/resources/developers/client/requests/index.d.ts +1 -0
  9. package/dist/cjs/api/resources/developers/types/CreateFreeKeyDevelopersResponse.d.ts +15 -15
  10. package/dist/cjs/api/resources/developers/types/CreateFreeKeyDevelopersResponse.js +0 -7
  11. package/dist/cjs/api/resources/developers/types/VerifyFreeKeyDevelopersResponse.d.ts +12 -0
  12. package/dist/cjs/api/resources/{drugSafety/types/CheckDrugSafetyRequestXSafeRxSandbox.js → developers/types/VerifyFreeKeyDevelopersResponse.js} +0 -4
  13. package/dist/cjs/api/resources/developers/types/index.d.ts +1 -0
  14. package/dist/cjs/api/resources/developers/types/index.js +1 -0
  15. package/dist/cjs/api/resources/drugSafety/client/Client.d.ts +2 -3
  16. package/dist/cjs/api/resources/drugSafety/client/Client.js +8 -22
  17. package/dist/cjs/api/resources/drugSafety/client/requests/DrugSafetyCheckRequest.d.ts +0 -5
  18. package/dist/cjs/api/resources/drugSafety/client/requests/index.d.ts +0 -1
  19. package/dist/cjs/api/resources/drugSafety/types/index.d.ts +0 -2
  20. package/dist/cjs/api/resources/drugSafety/types/index.js +0 -2
  21. package/dist/cjs/api/types/Alert.d.ts +3 -1
  22. package/dist/cjs/api/types/BadRequestErrorBody.d.ts +3 -0
  23. package/dist/cjs/api/{resources/drugSafety/types/GetMetadataDrugSafetyRequestXSafeRxSandbox.js → types/BadRequestErrorBody.js} +0 -4
  24. package/dist/cjs/api/types/ClinicalAlert.d.ts +1 -1
  25. package/dist/cjs/api/types/ClinicalData.d.ts +1 -1
  26. package/dist/cjs/api/types/Condition.d.ts +11 -11
  27. package/dist/cjs/api/types/Condition.js +11 -11
  28. package/dist/cjs/api/types/DrugSafetyCheckResponse.d.ts +1 -1
  29. package/dist/cjs/api/types/FoodConflict.d.ts +11 -3
  30. package/dist/cjs/api/types/Interaction.d.ts +34 -9
  31. package/dist/cjs/api/types/InternalServerErrorBody.d.ts +3 -0
  32. package/dist/cjs/api/types/InternalServerErrorBody.js +3 -0
  33. package/dist/cjs/api/types/ReproductiveSafetyData.d.ts +30 -2
  34. package/dist/cjs/api/types/ReproductiveWarning.d.ts +5 -3
  35. package/dist/cjs/api/types/ResolvedDrug.d.ts +19 -4
  36. package/dist/cjs/api/types/SafetyData.d.ts +4 -4
  37. package/dist/cjs/api/types/TooManyRequestsErrorBody.d.ts +3 -0
  38. package/dist/cjs/api/types/TooManyRequestsErrorBody.js +3 -0
  39. package/dist/cjs/api/types/index.d.ts +3 -0
  40. package/dist/cjs/api/types/index.js +3 -0
  41. package/dist/cjs/version.d.ts +1 -1
  42. package/dist/cjs/version.js +1 -1
  43. package/dist/esm/BaseClient.mjs +2 -2
  44. package/dist/esm/api/errors/BadRequestError.d.mts +1 -2
  45. package/dist/esm/api/errors/InternalServerError.d.mts +1 -2
  46. package/dist/esm/api/errors/TooManyRequestsError.d.mts +1 -2
  47. package/dist/esm/api/resources/developers/client/Client.d.mts +29 -6
  48. package/dist/esm/api/resources/developers/client/Client.mjs +74 -7
  49. package/dist/esm/api/resources/developers/client/requests/VerifyFreeKeyDevelopersRequest.d.mts +13 -0
  50. package/dist/esm/api/resources/developers/client/requests/index.d.mts +1 -0
  51. package/dist/esm/api/resources/developers/types/CreateFreeKeyDevelopersResponse.d.mts +15 -15
  52. package/dist/esm/api/resources/developers/types/CreateFreeKeyDevelopersResponse.mjs +1 -6
  53. package/dist/esm/api/resources/developers/types/VerifyFreeKeyDevelopersResponse.d.mts +12 -0
  54. package/dist/esm/api/resources/developers/types/VerifyFreeKeyDevelopersResponse.mjs +2 -0
  55. package/dist/esm/api/resources/developers/types/index.d.mts +1 -0
  56. package/dist/esm/api/resources/developers/types/index.mjs +1 -0
  57. package/dist/esm/api/resources/drugSafety/client/Client.d.mts +2 -3
  58. package/dist/esm/api/resources/drugSafety/client/Client.mjs +9 -23
  59. package/dist/esm/api/resources/drugSafety/client/requests/DrugSafetyCheckRequest.d.mts +0 -5
  60. package/dist/esm/api/resources/drugSafety/client/requests/index.d.mts +0 -1
  61. package/dist/esm/api/resources/drugSafety/types/index.d.mts +0 -2
  62. package/dist/esm/api/resources/drugSafety/types/index.mjs +0 -2
  63. package/dist/esm/api/types/Alert.d.mts +3 -1
  64. package/dist/esm/api/types/BadRequestErrorBody.d.mts +3 -0
  65. package/dist/esm/api/types/BadRequestErrorBody.mjs +2 -0
  66. package/dist/esm/api/types/ClinicalAlert.d.mts +1 -1
  67. package/dist/esm/api/types/ClinicalData.d.mts +1 -1
  68. package/dist/esm/api/types/Condition.d.mts +11 -11
  69. package/dist/esm/api/types/Condition.mjs +11 -11
  70. package/dist/esm/api/types/DrugSafetyCheckResponse.d.mts +1 -1
  71. package/dist/esm/api/types/FoodConflict.d.mts +11 -3
  72. package/dist/esm/api/types/Interaction.d.mts +34 -9
  73. package/dist/esm/api/types/InternalServerErrorBody.d.mts +3 -0
  74. package/dist/esm/api/types/InternalServerErrorBody.mjs +2 -0
  75. package/dist/esm/api/types/ReproductiveSafetyData.d.mts +30 -2
  76. package/dist/esm/api/types/ReproductiveWarning.d.mts +5 -3
  77. package/dist/esm/api/types/ResolvedDrug.d.mts +19 -4
  78. package/dist/esm/api/types/SafetyData.d.mts +4 -4
  79. package/dist/esm/api/types/TooManyRequestsErrorBody.d.mts +3 -0
  80. package/dist/esm/api/types/TooManyRequestsErrorBody.mjs +2 -0
  81. package/dist/esm/api/types/index.d.mts +3 -0
  82. package/dist/esm/api/types/index.mjs +3 -0
  83. package/dist/esm/version.d.mts +1 -1
  84. package/dist/esm/version.mjs +1 -1
  85. package/package.json +1 -1
  86. package/dist/cjs/api/resources/drugSafety/client/requests/GetMetadataDrugSafetyRequest.d.ts +0 -9
  87. package/dist/cjs/api/resources/drugSafety/types/CheckDrugSafetyRequestXSafeRxSandbox.d.ts +0 -4
  88. package/dist/cjs/api/resources/drugSafety/types/GetMetadataDrugSafetyRequestXSafeRxSandbox.d.ts +0 -4
  89. package/dist/esm/api/resources/drugSafety/client/requests/GetMetadataDrugSafetyRequest.d.mts +0 -9
  90. package/dist/esm/api/resources/drugSafety/types/CheckDrugSafetyRequestXSafeRxSandbox.d.mts +0 -4
  91. package/dist/esm/api/resources/drugSafety/types/CheckDrugSafetyRequestXSafeRxSandbox.mjs +0 -4
  92. package/dist/esm/api/resources/drugSafety/types/GetMetadataDrugSafetyRequestXSafeRxSandbox.d.mts +0 -4
  93. package/dist/esm/api/resources/drugSafety/types/GetMetadataDrugSafetyRequestXSafeRxSandbox.mjs +0 -4
  94. /package/dist/cjs/api/resources/{drugSafety/client/requests/GetMetadataDrugSafetyRequest.js → developers/client/requests/VerifyFreeKeyDevelopersRequest.js} +0 -0
  95. /package/dist/esm/api/resources/{drugSafety/client/requests/GetMetadataDrugSafetyRequest.mjs → developers/client/requests/VerifyFreeKeyDevelopersRequest.mjs} +0 -0
@@ -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.22",
47
- "User-Agent": "saferx-pharma-sdk/0.0.22",
46
+ "X-Fern-SDK-Version": "0.0.24",
47
+ "User-Agent": "saferx-pharma-sdk/0.0.24",
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: SafeRx.ErrorResponse, rawResponse?: core.RawResponse);
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: SafeRx.ErrorResponse, rawResponse?: core.RawResponse);
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: SafeRx.RateLimitResponse, rawResponse?: core.RawResponse);
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
- * Get a free-tier API key with just an email address. No registration required.
14
+ * Step 1 of 2: Request a verification code to get a free API key.
15
15
  *
16
- * - **Idempotent:** same email always returns the same key
17
- * - **Limit:** 1 key per email
18
- * - **Key format:** `sfx_free_<40 hex chars>`
19
- * - **Free tier limits:** 20 requests/minute, 60 requests/day
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.ForbiddenError}
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
- * Get a free-tier API key with just an email address. No registration required.
59
+ * Step 1 of 2: Request a verification code to get a free API key.
60
60
  *
61
- * - **Idempotent:** same email always returns the same key
62
- * - **Limit:** 1 key per email
63
- * - **Key format:** `sfx_free_<40 hex chars>`
64
- * - **Free tier limits:** 20 requests/minute, 60 requests/day
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.ForbiddenError}
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 +1,2 @@
1
1
  export type { CreateFreeKeyDevelopersRequest } from "./CreateFreeKeyDevelopersRequest.js";
2
+ export type { VerifyFreeKeyDevelopersRequest } from "./VerifyFreeKeyDevelopersRequest.js";
@@ -1,18 +1,18 @@
1
- export interface CreateFreeKeyDevelopersResponse {
2
- /** Your free-tier API key */
3
- api_key?: string | undefined;
4
- tier?: CreateFreeKeyDevelopersResponse.Tier | undefined;
5
- limits?: CreateFreeKeyDevelopersResponse.Limits | undefined;
6
- /** Present when returning existing key */
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
- export declare namespace CreateFreeKeyDevelopersResponse {
10
- const Tier: {
11
- readonly Free: "free";
12
- };
13
- type Tier = (typeof Tier)[keyof typeof Tier];
14
- interface Limits {
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
- };
@@ -1 +1,2 @@
1
1
  export * from "./CreateFreeKeyDevelopersResponse.js";
2
+ export * from "./VerifyFreeKeyDevelopersResponse.js";
@@ -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(request?: SafeRx.GetMetadataDrugSafetyRequest, requestOptions?: DrugSafetyClient.RequestOptions): core.HttpResponsePromise<SafeRx.MetadataResponse>;
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
- * database connectivity, safety module availability, and Redis status.
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, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "X-SafeRx-Sandbox": safeRxSandbox }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.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: _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(request = {}, requestOptions) {
188
- return core.HttpResponsePromise.fromPromise(this.__getMetadata(request, requestOptions));
174
+ getMetadata(requestOptions) {
175
+ return core.HttpResponsePromise.fromPromise(this.__getMetadata(requestOptions));
189
176
  }
190
- __getMetadata() {
191
- return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
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, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "X-SafeRx-Sandbox": safeRxSandbox }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.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
- * database connectivity, safety module availability, and Redis status.
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.
@@ -1,2 +1 @@
1
1
  export { DrugSafetyCheckRequest } from "./DrugSafetyCheckRequest.js";
2
- export type { GetMetadataDrugSafetyRequest } from "./GetMetadataDrugSafetyRequest.js";
@@ -1,3 +1 @@
1
- export * from "./CheckDrugSafetyRequestXSafeRxSandbox.js";
2
1
  export * from "./GetDrugSafetyHealthResponse.js";
3
- export * from "./GetMetadataDrugSafetyRequestXSafeRxSandbox.js";
@@ -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);
@@ -21,8 +21,10 @@ export interface Alert {
21
21
  * - `clinical_population` — Clinical population severity >= 4
22
22
  */
23
23
  type: Alert.Type;
24
- /** Human-readable alert message */
24
+ /** Human-readable alert message (English) */
25
25
  message: string;
26
+ /** Human-readable alert message (Arabic) */
27
+ message_ar?: string | undefined;
26
28
  /** Drug names involved in this alert */
27
29
  drugs_involved: string[];
28
30
  }
@@ -0,0 +1,3 @@
1
+ export interface BadRequestErrorBody {
2
+ error?: string | undefined;
3
+ }
@@ -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
- };
@@ -2,7 +2,7 @@
2
2
  * Clinical safety alert from cross-drug analysis
3
3
  */
4
4
  export interface ClinicalAlert {
5
- /** SFX_ID of the drug involved */
5
+ /** sfrx_id of the drug involved */
6
6
  drug_id?: string | undefined;
7
7
  /** Drug name (English) */
8
8
  drug?: string | undefined;
@@ -5,7 +5,7 @@ import type * as SafeRx from "../index.js";
5
5
  * is provided in the request.
6
6
  */
7
7
  export interface ClinicalData {
8
- /** Per-drug clinical data keyed by SFX_ID */
8
+ /** Per-drug clinical data keyed by sfrx_id */
9
9
  drug_specific?: Record<string, SafeRx.DrugClinicalData> | undefined;
10
10
  /** Cross-drug condition-related alerts (requires `patient_profile.conditions`) */
11
11
  condition_alerts?: SafeRx.ClinicalAlert[] | undefined;
@@ -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 Asthma: "asthma";
12
- readonly LiverDisease: "liver_disease";
13
- readonly KidneyDisease: "kidney_disease";
14
- readonly Thyroid: "thyroid";
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
- Asthma: "asthma",
16
- LiverDisease: "liver_disease",
17
- KidneyDisease: "kidney_disease",
18
- Thyroid: "thyroid",
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 (similarity score >= 0.5).
10
+ * with sufficient confidence.
11
11
  */
12
12
  unresolved: string[];
13
13
  safety: SafeRx.SafetyData;
@@ -1,13 +1,21 @@
1
1
  /**
2
- * A specific food-drug interaction
2
+ * A specific food-drug interaction (bilingual)
3
3
  */
4
4
  export interface FoodConflict {
5
5
  /** Food item or food category involved */
6
6
  food?: string | undefined;
7
+ /** Food category identifier */
8
+ food_category?: string | undefined;
9
+ /** Specific foods affected */
10
+ affected_foods?: string[] | undefined;
7
11
  /** Interaction severity (1-5) */
8
12
  severity?: number | undefined;
9
13
  /** Pharmacological interaction mechanism */
10
14
  interaction_type?: string | undefined;
11
- /** Dietary recommendation */
12
- recommendation?: string | undefined;
15
+ /** Patient guidance in English */
16
+ brief_en?: string | undefined;
17
+ /** Patient guidance in Arabic */
18
+ brief_ar?: string | undefined;
19
+ /** Required patient action */
20
+ action_required?: string | undefined;
13
21
  }
@@ -1,22 +1,47 @@
1
1
  export interface Interaction {
2
- /** SFX_ID of the first drug in the interaction pair */
3
- drug_1_id?: string | undefined;
4
- /** SFX_ID of the second drug in the interaction pair */
5
- drug_2_id?: string | undefined;
2
+ /** sfrx_id of the first drug in the interaction pair */
3
+ sfrx_id_1?: string | undefined;
4
+ /** sfrx_id of the second drug in the interaction pair */
5
+ sfrx_id_2?: string | undefined;
6
6
  /**
7
- * Interaction severity level.
8
- * - `2` — Minor: minimal clinical significance
9
- * - `3` — Moderate: may require monitoring or dose adjustment
10
- * - `4` — Major: avoid combination if possible, close monitoring required
11
- * - `5` — Contraindicated: do not use together
7
+ * Interaction severity level (clinical interactions only).
8
+ * - `1` — Minor: minimal clinical significance
9
+ * - `2` — Moderate: may require monitoring or dose adjustment
10
+ * - `3` — Major: avoid combination if possible, close monitoring required
11
+ * - `4` — Contraindicated: do not use together
12
+ *
13
+ * The API filters out noise interactions (severity ≤ 0) by default.
14
+ * The internal V8 scale extends to -3 (noise) and 0 (unknown),
15
+ * but these are never returned in the public response.
12
16
  */
13
17
  severity?: number | undefined;
18
+ /**
19
+ * Original severity before route-based or noise adjustments.
20
+ * Uses the full V8 scale: -3 (decreased efficacy), -2 (pharmacokinetic),
21
+ * -1 (metabolic), 0 (unknown), 1-4 (clinical). May differ from
22
+ * `severity` when route adjustments apply.
23
+ */
24
+ base_severity?: number | undefined;
14
25
  /** Human-readable severity label */
15
26
  severity_name?: Interaction.SeverityName | undefined;
27
+ /**
28
+ * Noise classification for this interaction, if applicable.
29
+ * Null for clinically significant interactions. Possible values:
30
+ * `"DECREASED_EFFICACY"`, `"PHARMACOKINETIC"`, `"METABOLIC"`.
31
+ */
32
+ noise_type?: (string | null) | undefined;
16
33
  /** Interaction mechanism or clinical description (English) */
17
34
  description?: string | undefined;
18
35
  /** Interaction description in Arabic */
19
36
  description_ar?: string | undefined;
37
+ /** Expected clinical effect of the interaction (English) */
38
+ clinical_effect?: (string | null) | undefined;
39
+ /** Expected clinical effect in Arabic */
40
+ clinical_effect_ar?: (string | null) | undefined;
41
+ /** Clinical management strategy (English) */
42
+ management?: (string | null) | undefined;
43
+ /** Clinical management strategy in Arabic */
44
+ management_ar?: (string | null) | undefined;
20
45
  /** Clinical recommendation for managing this interaction (English) */
21
46
  recommendation?: string | undefined;
22
47
  /** Clinical recommendation in Arabic */
@@ -0,0 +1,3 @@
1
+ export interface InternalServerErrorBody {
2
+ error?: string | undefined;
3
+ }