saferx-pharma-sdk 0.0.9 → 0.0.10

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.
@@ -5,8 +5,6 @@ export type BaseClientOptions = {
5
5
  environment?: core.Supplier<environments.SafeRxEnvironment | string>;
6
6
  /** Specify a custom URL to connect the client to. */
7
7
  baseUrl?: core.Supplier<string>;
8
- /** Override the X-SafeRx-API-Key header */
9
- safeRxApiKey: core.Supplier<string>;
10
8
  /** Additional headers to include in requests. */
11
9
  headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
12
10
  /** The default maximum time to wait for a response in seconds. */
@@ -25,8 +23,6 @@ export interface BaseRequestOptions {
25
23
  maxRetries?: number;
26
24
  /** A hook to abort the request. */
27
25
  abortSignal?: AbortSignal;
28
- /** Override the X-SafeRx-API-Key header */
29
- safeRxApiKey?: string;
30
26
  /** Additional query string parameters to include in the request. */
31
27
  queryParams?: Record<string, unknown>;
32
28
  /** Additional headers to include in the request. */
@@ -43,11 +43,10 @@ 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.9",
47
- "User-Agent": "saferx-pharma-sdk/0.0.9",
46
+ "X-Fern-SDK-Version": "0.0.10",
47
+ "User-Agent": "saferx-pharma-sdk/0.0.10",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
- "X-SafeRx-API-Key": options === null || options === void 0 ? void 0 : options.safeRxApiKey,
51
50
  }, options === null || options === void 0 ? void 0 : options.headers);
52
51
  return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
53
52
  }
@@ -11,7 +11,7 @@ export declare class SafeRxClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<SafeRxClient.Options>;
12
12
  protected _drugSafety: DrugSafetyClient | undefined;
13
13
  protected _developers: DevelopersClient | undefined;
14
- constructor(options: SafeRxClient.Options);
14
+ constructor(options?: SafeRxClient.Options);
15
15
  get drugSafety(): DrugSafetyClient;
16
16
  get developers(): DevelopersClient;
17
17
  }
@@ -6,7 +6,7 @@ const Client_js_1 = require("./api/resources/developers/client/Client.js");
6
6
  const Client_js_2 = require("./api/resources/drugSafety/client/Client.js");
7
7
  const BaseClient_js_1 = require("./BaseClient.js");
8
8
  class SafeRxClient {
9
- constructor(options) {
9
+ constructor(options = {}) {
10
10
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
11
11
  }
12
12
  get drugSafety() {
@@ -9,7 +9,7 @@ export declare namespace DevelopersClient {
9
9
  }
10
10
  export declare class DevelopersClient {
11
11
  protected readonly _options: NormalizedClientOptions<DevelopersClient.Options>;
12
- constructor(options: DevelopersClient.Options);
12
+ constructor(options?: DevelopersClient.Options);
13
13
  /**
14
14
  * Get a free-tier API key with just an email address. No registration required.
15
15
  *
@@ -52,7 +52,7 @@ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatu
52
52
  const errors = __importStar(require("../../../../errors/index.js"));
53
53
  const SafeRx = __importStar(require("../../../index.js"));
54
54
  class DevelopersClient {
55
- constructor(options) {
55
+ constructor(options = {}) {
56
56
  this._options = (0, BaseClient_js_1.normalizeClientOptions)(options);
57
57
  }
58
58
  /**
@@ -78,22 +78,20 @@ class DevelopersClient {
78
78
  }
79
79
  __createFreeKey(request, requestOptions) {
80
80
  return __awaiter(this, void 0, void 0, function* () {
81
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
82
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
83
- "X-SafeRx-API-Key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.safeRxApiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.safeRxApiKey,
84
- }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
81
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
82
+ 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);
85
83
  const _response = yield core.fetcher({
86
- url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.SafeRxEnvironment.Production, "api/developers/keys/free"),
84
+ 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"),
87
85
  method: "POST",
88
86
  headers: _headers,
89
87
  contentType: "application/json",
90
88
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
91
89
  requestType: "json",
92
90
  body: request,
93
- timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
94
- maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
91
+ 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,
92
+ 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,
95
93
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
96
- fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
94
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
97
95
  logging: this._options.logging,
98
96
  });
99
97
  if (_response.ok) {
@@ -12,7 +12,7 @@ export declare namespace DrugSafetyClient {
12
12
  */
13
13
  export declare class DrugSafetyClient {
14
14
  protected readonly _options: NormalizedClientOptionsWithAuth<DrugSafetyClient.Options>;
15
- constructor(options: DrugSafetyClient.Options);
15
+ constructor(options?: DrugSafetyClient.Options);
16
16
  /**
17
17
  * Screen one or more drugs across six safety domains in a single request.
18
18
  *
@@ -66,7 +66,7 @@ const SafeRx = __importStar(require("../../../index.js"));
66
66
  * Unified drug safety screening endpoints
67
67
  */
68
68
  class DrugSafetyClient {
69
- constructor(options) {
69
+ constructor(options = {}) {
70
70
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
71
71
  }
72
72
  /**
@@ -121,25 +121,22 @@ class DrugSafetyClient {
121
121
  }
122
122
  __check(request, requestOptions) {
123
123
  return __awaiter(this, void 0, void 0, function* () {
124
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
124
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
125
125
  const { "X-SafeRx-Sandbox": safeRxSandbox } = request, _body = __rest(request, ["X-SafeRx-Sandbox"]);
126
126
  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)({
128
- "X-SafeRx-Sandbox": safeRxSandbox,
129
- "X-SafeRx-API-Key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.safeRxApiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.safeRxApiKey,
130
- }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
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);
131
128
  const _response = yield core.fetcher({
132
- url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.SafeRxEnvironment.Production, "api/drug_safety/check"),
129
+ 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"),
133
130
  method: "POST",
134
131
  headers: _headers,
135
132
  contentType: "application/json",
136
133
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
137
134
  requestType: "json",
138
135
  body: _body,
139
- timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
140
- maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
136
+ 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
+ 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,
141
138
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
142
- fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
139
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
143
140
  logging: this._options.logging,
144
141
  });
145
142
  if (_response.ok) {
@@ -192,22 +189,19 @@ class DrugSafetyClient {
192
189
  }
193
190
  __getMetadata() {
194
191
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
195
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
192
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
196
193
  const { "X-SafeRx-Sandbox": safeRxSandbox } = request;
197
194
  const _authRequest = yield this._options.authProvider.getAuthRequest();
198
- 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)({
199
- "X-SafeRx-Sandbox": safeRxSandbox,
200
- "X-SafeRx-API-Key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.safeRxApiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.safeRxApiKey,
201
- }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
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);
202
196
  const _response = yield core.fetcher({
203
- url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.SafeRxEnvironment.Production, "api/drug_safety/metadata"),
197
+ 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"),
204
198
  method: "GET",
205
199
  headers: _headers,
206
200
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
207
- timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
208
- maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
201
+ 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,
202
+ 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,
209
203
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
210
- fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
204
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
211
205
  logging: this._options.logging,
212
206
  });
213
207
  if (_response.ok) {
@@ -246,19 +240,17 @@ class DrugSafetyClient {
246
240
  }
247
241
  __getDrugSafetyHealth(requestOptions) {
248
242
  return __awaiter(this, void 0, void 0, function* () {
249
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
250
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
251
- "X-SafeRx-API-Key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.safeRxApiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.safeRxApiKey,
252
- }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
243
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
244
+ 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);
253
245
  const _response = yield core.fetcher({
254
- url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.SafeRxEnvironment.Production, "api/drug_safety/health"),
246
+ 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/health"),
255
247
  method: "GET",
256
248
  headers: _headers,
257
249
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
258
- timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
259
- maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
250
+ 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,
251
+ 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,
260
252
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
261
- fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
253
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
262
254
  logging: this._options.logging,
263
255
  });
264
256
  if (_response.ok) {
@@ -9,7 +9,7 @@ export declare class HeaderAuthProvider implements core.AuthProvider {
9
9
  }): Promise<core.AuthRequest>;
10
10
  }
11
11
  export declare namespace HeaderAuthProvider {
12
- const AUTH_SCHEME: "SafeRxToken";
12
+ const AUTH_SCHEME: "SafeRxAPIKey";
13
13
  const AUTH_CONFIG_ERROR_MESSAGE: string;
14
14
  type Options = AuthOptions;
15
15
  type AuthOptions = {
@@ -47,7 +47,7 @@ exports.HeaderAuthProvider = void 0;
47
47
  const core = __importStar(require("../core/index.js"));
48
48
  const errors = __importStar(require("../errors/index.js"));
49
49
  const PARAM_KEY = "apiKey";
50
- const HEADER_NAME = "X-SafeRx-Token";
50
+ const HEADER_NAME = "X-SafeRx-API-Key";
51
51
  class HeaderAuthProvider {
52
52
  constructor(options) {
53
53
  this.options = options;
@@ -71,7 +71,7 @@ class HeaderAuthProvider {
71
71
  }
72
72
  exports.HeaderAuthProvider = HeaderAuthProvider;
73
73
  (function (HeaderAuthProvider) {
74
- HeaderAuthProvider.AUTH_SCHEME = "SafeRxToken";
74
+ HeaderAuthProvider.AUTH_SCHEME = "SafeRxAPIKey";
75
75
  HeaderAuthProvider.AUTH_CONFIG_ERROR_MESSAGE = `Please provide '${PARAM_KEY}' when initializing the client`;
76
76
  function createInstance(options) {
77
77
  return new HeaderAuthProvider(options);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.9";
1
+ export declare const SDK_VERSION = "0.0.10";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.0.9";
4
+ exports.SDK_VERSION = "0.0.10";
@@ -5,8 +5,6 @@ export type BaseClientOptions = {
5
5
  environment?: core.Supplier<environments.SafeRxEnvironment | string>;
6
6
  /** Specify a custom URL to connect the client to. */
7
7
  baseUrl?: core.Supplier<string>;
8
- /** Override the X-SafeRx-API-Key header */
9
- safeRxApiKey: core.Supplier<string>;
10
8
  /** Additional headers to include in requests. */
11
9
  headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
12
10
  /** The default maximum time to wait for a response in seconds. */
@@ -25,8 +23,6 @@ export interface BaseRequestOptions {
25
23
  maxRetries?: number;
26
24
  /** A hook to abort the request. */
27
25
  abortSignal?: AbortSignal;
28
- /** Override the X-SafeRx-API-Key header */
29
- safeRxApiKey?: string;
30
26
  /** Additional query string parameters to include in the request. */
31
27
  queryParams?: Record<string, unknown>;
32
28
  /** Additional headers to include in the request. */
@@ -6,11 +6,10 @@ 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.9",
10
- "User-Agent": "saferx-pharma-sdk/0.0.9",
9
+ "X-Fern-SDK-Version": "0.0.10",
10
+ "User-Agent": "saferx-pharma-sdk/0.0.10",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
- "X-SafeRx-API-Key": options === null || options === void 0 ? void 0 : options.safeRxApiKey,
14
13
  }, options === null || options === void 0 ? void 0 : options.headers);
15
14
  return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
16
15
  }
@@ -11,7 +11,7 @@ export declare class SafeRxClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<SafeRxClient.Options>;
12
12
  protected _drugSafety: DrugSafetyClient | undefined;
13
13
  protected _developers: DevelopersClient | undefined;
14
- constructor(options: SafeRxClient.Options);
14
+ constructor(options?: SafeRxClient.Options);
15
15
  get drugSafety(): DrugSafetyClient;
16
16
  get developers(): DevelopersClient;
17
17
  }
@@ -3,7 +3,7 @@ import { DevelopersClient } from "./api/resources/developers/client/Client.mjs";
3
3
  import { DrugSafetyClient } from "./api/resources/drugSafety/client/Client.mjs";
4
4
  import { normalizeClientOptionsWithAuth } from "./BaseClient.mjs";
5
5
  export class SafeRxClient {
6
- constructor(options) {
6
+ constructor(options = {}) {
7
7
  this._options = normalizeClientOptionsWithAuth(options);
8
8
  }
9
9
  get drugSafety() {
@@ -9,7 +9,7 @@ export declare namespace DevelopersClient {
9
9
  }
10
10
  export declare class DevelopersClient {
11
11
  protected readonly _options: NormalizedClientOptions<DevelopersClient.Options>;
12
- constructor(options: DevelopersClient.Options);
12
+ constructor(options?: DevelopersClient.Options);
13
13
  /**
14
14
  * Get a free-tier API key with just an email address. No registration required.
15
15
  *
@@ -9,14 +9,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  import { normalizeClientOptions } from "../../../../BaseClient.mjs";
12
- import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
12
+ import { mergeHeaders } from "../../../../core/headers.mjs";
13
13
  import * as core from "../../../../core/index.mjs";
14
14
  import * as environments from "../../../../environments.mjs";
15
15
  import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
16
16
  import * as errors from "../../../../errors/index.mjs";
17
17
  import * as SafeRx from "../../../index.mjs";
18
18
  export class DevelopersClient {
19
- constructor(options) {
19
+ constructor(options = {}) {
20
20
  this._options = normalizeClientOptions(options);
21
21
  }
22
22
  /**
@@ -42,22 +42,20 @@ export class DevelopersClient {
42
42
  }
43
43
  __createFreeKey(request, requestOptions) {
44
44
  return __awaiter(this, void 0, void 0, function* () {
45
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
46
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
47
- "X-SafeRx-API-Key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.safeRxApiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.safeRxApiKey,
48
- }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
45
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
46
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
49
47
  const _response = yield core.fetcher({
50
- url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.SafeRxEnvironment.Production, "api/developers/keys/free"),
48
+ 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"),
51
49
  method: "POST",
52
50
  headers: _headers,
53
51
  contentType: "application/json",
54
52
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
55
53
  requestType: "json",
56
54
  body: request,
57
- timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
58
- maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
55
+ 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,
56
+ 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,
59
57
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
60
- fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
58
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
61
59
  logging: this._options.logging,
62
60
  });
63
61
  if (_response.ok) {
@@ -12,7 +12,7 @@ export declare namespace DrugSafetyClient {
12
12
  */
13
13
  export declare class DrugSafetyClient {
14
14
  protected readonly _options: NormalizedClientOptionsWithAuth<DrugSafetyClient.Options>;
15
- constructor(options: DrugSafetyClient.Options);
15
+ constructor(options?: DrugSafetyClient.Options);
16
16
  /**
17
17
  * Screen one or more drugs across six safety domains in a single request.
18
18
  *
@@ -30,7 +30,7 @@ import * as SafeRx from "../../../index.mjs";
30
30
  * Unified drug safety screening endpoints
31
31
  */
32
32
  export class DrugSafetyClient {
33
- constructor(options) {
33
+ constructor(options = {}) {
34
34
  this._options = normalizeClientOptionsWithAuth(options);
35
35
  }
36
36
  /**
@@ -85,25 +85,22 @@ export class DrugSafetyClient {
85
85
  }
86
86
  __check(request, requestOptions) {
87
87
  return __awaiter(this, void 0, void 0, function* () {
88
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
88
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
89
89
  const { "X-SafeRx-Sandbox": safeRxSandbox } = request, _body = __rest(request, ["X-SafeRx-Sandbox"]);
90
90
  const _authRequest = yield this._options.authProvider.getAuthRequest();
91
- const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
92
- "X-SafeRx-Sandbox": safeRxSandbox,
93
- "X-SafeRx-API-Key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.safeRxApiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.safeRxApiKey,
94
- }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
91
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "X-SafeRx-Sandbox": safeRxSandbox }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
95
92
  const _response = yield core.fetcher({
96
- url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.SafeRxEnvironment.Production, "api/drug_safety/check"),
93
+ 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"),
97
94
  method: "POST",
98
95
  headers: _headers,
99
96
  contentType: "application/json",
100
97
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
101
98
  requestType: "json",
102
99
  body: _body,
103
- timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
104
- maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
100
+ 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,
101
+ 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,
105
102
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
106
- fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
103
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
107
104
  logging: this._options.logging,
108
105
  });
109
106
  if (_response.ok) {
@@ -156,22 +153,19 @@ export class DrugSafetyClient {
156
153
  }
157
154
  __getMetadata() {
158
155
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
159
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
156
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
160
157
  const { "X-SafeRx-Sandbox": safeRxSandbox } = request;
161
158
  const _authRequest = yield this._options.authProvider.getAuthRequest();
162
- const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
163
- "X-SafeRx-Sandbox": safeRxSandbox,
164
- "X-SafeRx-API-Key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.safeRxApiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.safeRxApiKey,
165
- }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
159
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "X-SafeRx-Sandbox": safeRxSandbox }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
166
160
  const _response = yield core.fetcher({
167
- url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.SafeRxEnvironment.Production, "api/drug_safety/metadata"),
161
+ 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"),
168
162
  method: "GET",
169
163
  headers: _headers,
170
164
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
171
- timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
172
- maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
165
+ 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,
166
+ 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,
173
167
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
174
- fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
168
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
175
169
  logging: this._options.logging,
176
170
  });
177
171
  if (_response.ok) {
@@ -210,19 +204,17 @@ export class DrugSafetyClient {
210
204
  }
211
205
  __getDrugSafetyHealth(requestOptions) {
212
206
  return __awaiter(this, void 0, void 0, function* () {
213
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
214
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
215
- "X-SafeRx-API-Key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.safeRxApiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.safeRxApiKey,
216
- }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
207
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
208
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
217
209
  const _response = yield core.fetcher({
218
- url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.SafeRxEnvironment.Production, "api/drug_safety/health"),
210
+ 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/health"),
219
211
  method: "GET",
220
212
  headers: _headers,
221
213
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
222
- timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
223
- maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
214
+ 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,
215
+ 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,
224
216
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
225
- fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
217
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
226
218
  logging: this._options.logging,
227
219
  });
228
220
  if (_response.ok) {
@@ -9,7 +9,7 @@ export declare class HeaderAuthProvider implements core.AuthProvider {
9
9
  }): Promise<core.AuthRequest>;
10
10
  }
11
11
  export declare namespace HeaderAuthProvider {
12
- const AUTH_SCHEME: "SafeRxToken";
12
+ const AUTH_SCHEME: "SafeRxAPIKey";
13
13
  const AUTH_CONFIG_ERROR_MESSAGE: string;
14
14
  type Options = AuthOptions;
15
15
  type AuthOptions = {
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  import * as core from "../core/index.mjs";
12
12
  import * as errors from "../errors/index.mjs";
13
13
  const PARAM_KEY = "apiKey";
14
- const HEADER_NAME = "X-SafeRx-Token";
14
+ const HEADER_NAME = "X-SafeRx-API-Key";
15
15
  export class HeaderAuthProvider {
16
16
  constructor(options) {
17
17
  this.options = options;
@@ -34,7 +34,7 @@ export class HeaderAuthProvider {
34
34
  }
35
35
  }
36
36
  (function (HeaderAuthProvider) {
37
- HeaderAuthProvider.AUTH_SCHEME = "SafeRxToken";
37
+ HeaderAuthProvider.AUTH_SCHEME = "SafeRxAPIKey";
38
38
  HeaderAuthProvider.AUTH_CONFIG_ERROR_MESSAGE = `Please provide '${PARAM_KEY}' when initializing the client`;
39
39
  function createInstance(options) {
40
40
  return new HeaderAuthProvider(options);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.9";
1
+ export declare const SDK_VERSION = "0.0.10";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.0.9";
1
+ export const SDK_VERSION = "0.0.10";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saferx-pharma-sdk",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "main": "./dist/cjs/index.js",