phenoml 11.4.0 → 12.0.0

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 (70) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +12 -0
  3. package/dist/cjs/Client.js +67 -0
  4. package/dist/cjs/api/resources/authtoken/resources/auth/client/Client.d.ts +0 -17
  5. package/dist/cjs/api/resources/authtoken/resources/auth/client/Client.js +0 -60
  6. package/dist/cjs/api/resources/authtoken/resources/auth/client/requests/index.d.ts +0 -1
  7. package/dist/cjs/api/resources/authtoken/resources/auth/index.d.ts +0 -1
  8. package/dist/cjs/api/resources/authtoken/resources/auth/index.js +0 -1
  9. package/dist/cjs/api/resources/authtoken/resources/index.d.ts +0 -1
  10. package/dist/cjs/api/resources/authtoken/resources/index.js +0 -1
  11. package/dist/cjs/api/resources/authtoken/types/index.d.ts +0 -2
  12. package/dist/cjs/api/resources/authtoken/types/index.js +0 -2
  13. package/dist/cjs/api/resources/fhir/client/Client.d.ts +2 -23
  14. package/dist/cjs/api/resources/fhir/client/Client.js +2 -23
  15. package/dist/cjs/api/resources/fhir/client/requests/FhirCreateRequest.d.ts +1 -11
  16. package/dist/cjs/api/resources/fhir/client/requests/FhirSearchRequest.d.ts +1 -1
  17. package/dist/cjs/api/resources/fhir/client/requests/FhirUpsertRequest.d.ts +1 -12
  18. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +1 -1
  19. package/dist/cjs/core/fetcher/index.d.ts +2 -0
  20. package/dist/cjs/core/fetcher/index.js +3 -1
  21. package/dist/cjs/core/fetcher/makePassthroughRequest.d.ts +49 -0
  22. package/dist/cjs/core/fetcher/makePassthroughRequest.js +135 -0
  23. package/dist/cjs/version.d.ts +1 -1
  24. package/dist/cjs/version.js +1 -1
  25. package/dist/esm/BaseClient.mjs +2 -2
  26. package/dist/esm/Client.d.mts +12 -0
  27. package/dist/esm/Client.mjs +34 -0
  28. package/dist/esm/api/resources/authtoken/resources/auth/client/Client.d.mts +0 -17
  29. package/dist/esm/api/resources/authtoken/resources/auth/client/Client.mjs +0 -60
  30. package/dist/esm/api/resources/authtoken/resources/auth/client/requests/index.d.mts +0 -1
  31. package/dist/esm/api/resources/authtoken/resources/auth/index.d.mts +0 -1
  32. package/dist/esm/api/resources/authtoken/resources/auth/index.mjs +0 -1
  33. package/dist/esm/api/resources/authtoken/resources/index.d.mts +0 -1
  34. package/dist/esm/api/resources/authtoken/resources/index.mjs +0 -1
  35. package/dist/esm/api/resources/authtoken/types/index.d.mts +0 -2
  36. package/dist/esm/api/resources/authtoken/types/index.mjs +0 -2
  37. package/dist/esm/api/resources/fhir/client/Client.d.mts +2 -23
  38. package/dist/esm/api/resources/fhir/client/Client.mjs +2 -23
  39. package/dist/esm/api/resources/fhir/client/requests/FhirCreateRequest.d.mts +1 -11
  40. package/dist/esm/api/resources/fhir/client/requests/FhirSearchRequest.d.mts +1 -1
  41. package/dist/esm/api/resources/fhir/client/requests/FhirUpsertRequest.d.mts +1 -12
  42. package/dist/esm/core/fetcher/BinaryResponse.d.mts +1 -1
  43. package/dist/esm/core/fetcher/index.d.mts +2 -0
  44. package/dist/esm/core/fetcher/index.mjs +1 -0
  45. package/dist/esm/core/fetcher/makePassthroughRequest.d.mts +49 -0
  46. package/dist/esm/core/fetcher/makePassthroughRequest.mjs +132 -0
  47. package/dist/esm/version.d.mts +1 -1
  48. package/dist/esm/version.mjs +1 -1
  49. package/package.json +7 -7
  50. package/reference.md +2 -89
  51. package/dist/cjs/api/resources/authtoken/resources/auth/client/requests/AuthGenerateTokenRequest.d.ts +0 -13
  52. package/dist/cjs/api/resources/authtoken/resources/auth/client/requests/AuthGenerateTokenRequest.js +0 -3
  53. package/dist/cjs/api/resources/authtoken/resources/auth/types/AuthGenerateTokenResponse.d.ts +0 -4
  54. package/dist/cjs/api/resources/authtoken/resources/auth/types/AuthGenerateTokenResponse.js +0 -3
  55. package/dist/cjs/api/resources/authtoken/resources/auth/types/index.d.ts +0 -1
  56. package/dist/cjs/api/resources/authtoken/resources/auth/types/index.js +0 -17
  57. package/dist/cjs/api/resources/authtoken/types/BadRequestErrorBody.d.ts +0 -5
  58. package/dist/cjs/api/resources/authtoken/types/BadRequestErrorBody.js +0 -3
  59. package/dist/cjs/api/resources/authtoken/types/UnauthorizedErrorBody.d.ts +0 -5
  60. package/dist/cjs/api/resources/authtoken/types/UnauthorizedErrorBody.js +0 -3
  61. package/dist/esm/api/resources/authtoken/resources/auth/client/requests/AuthGenerateTokenRequest.d.mts +0 -13
  62. package/dist/esm/api/resources/authtoken/resources/auth/client/requests/AuthGenerateTokenRequest.mjs +0 -2
  63. package/dist/esm/api/resources/authtoken/resources/auth/types/AuthGenerateTokenResponse.d.mts +0 -4
  64. package/dist/esm/api/resources/authtoken/resources/auth/types/AuthGenerateTokenResponse.mjs +0 -2
  65. package/dist/esm/api/resources/authtoken/resources/auth/types/index.d.mts +0 -1
  66. package/dist/esm/api/resources/authtoken/resources/auth/types/index.mjs +0 -1
  67. package/dist/esm/api/resources/authtoken/types/BadRequestErrorBody.d.mts +0 -5
  68. package/dist/esm/api/resources/authtoken/types/BadRequestErrorBody.mjs +0 -2
  69. package/dist/esm/api/resources/authtoken/types/UnauthorizedErrorBody.d.mts +0 -5
  70. package/dist/esm/api/resources/authtoken/types/UnauthorizedErrorBody.mjs +0 -2
@@ -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": "phenoml",
46
- "X-Fern-SDK-Version": "11.4.0",
47
- "User-Agent": "phenoml/11.4.0",
46
+ "X-Fern-SDK-Version": "12.0.0",
47
+ "User-Agent": "phenoml/12.0.0",
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);
@@ -10,6 +10,7 @@ import { ToolsClient } from "./api/resources/tools/client/Client.js";
10
10
  import { WorkflowsClient } from "./api/resources/workflows/client/Client.js";
11
11
  import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
12
12
  import { type NormalizedClientOptionsWithAuth } from "./BaseClient.js";
13
+ import * as core from "./core/index.js";
13
14
  export declare namespace phenomlClient {
14
15
  type Options = BaseClientOptions;
15
16
  interface RequestOptions extends BaseRequestOptions {
@@ -38,4 +39,15 @@ export declare class phenomlClient {
38
39
  get summary(): SummaryClient;
39
40
  get tools(): ToolsClient;
40
41
  get workflows(): WorkflowsClient;
42
+ /**
43
+ * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
44
+ * This is useful for making requests to endpoints not yet supported in the SDK.
45
+ * The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
46
+ *
47
+ * @param {Request | string | URL} input - The URL, path, or Request object.
48
+ * @param {RequestInit} init - Standard fetch RequestInit options.
49
+ * @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
50
+ * @returns {Promise<Response>} A standard Response object.
51
+ */
52
+ fetch(input: Request | string | URL, init?: RequestInit, requestOptions?: core.PassthroughRequest.RequestOptions): Promise<Response>;
41
53
  }
@@ -1,5 +1,47 @@
1
1
  "use strict";
2
2
  // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
3
45
  Object.defineProperty(exports, "__esModule", { value: true });
4
46
  exports.phenomlClient = void 0;
5
47
  const Client_js_1 = require("./api/resources/agent/client/Client.js");
@@ -13,6 +55,7 @@ const Client_js_8 = require("./api/resources/summary/client/Client.js");
13
55
  const Client_js_9 = require("./api/resources/tools/client/Client.js");
14
56
  const Client_js_10 = require("./api/resources/workflows/client/Client.js");
15
57
  const BaseClient_js_1 = require("./BaseClient.js");
58
+ const core = __importStar(require("./core/index.js"));
16
59
  class phenomlClient {
17
60
  constructor(options = {}) {
18
61
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
@@ -57,5 +100,29 @@ class phenomlClient {
57
100
  var _a;
58
101
  return ((_a = this._workflows) !== null && _a !== void 0 ? _a : (this._workflows = new Client_js_10.WorkflowsClient(this._options)));
59
102
  }
103
+ /**
104
+ * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
105
+ * This is useful for making requests to endpoints not yet supported in the SDK.
106
+ * The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
107
+ *
108
+ * @param {Request | string | URL} input - The URL, path, or Request object.
109
+ * @param {RequestInit} init - Standard fetch RequestInit options.
110
+ * @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
111
+ * @returns {Promise<Response>} A standard Response object.
112
+ */
113
+ fetch(input, init, requestOptions) {
114
+ return __awaiter(this, void 0, void 0, function* () {
115
+ var _a;
116
+ return core.makePassthroughRequest(input, init, {
117
+ baseUrl: (_a = this._options.baseUrl) !== null && _a !== void 0 ? _a : this._options.environment,
118
+ headers: this._options.headers,
119
+ timeoutInSeconds: this._options.timeoutInSeconds,
120
+ maxRetries: this._options.maxRetries,
121
+ fetch: this._options.fetch,
122
+ logging: this._options.logging,
123
+ getAuthHeaders: () => __awaiter(this, void 0, void 0, function* () { return (yield this._options.authProvider.getAuthRequest()).headers; }),
124
+ }, requestOptions);
125
+ });
126
+ }
60
127
  }
61
128
  exports.phenomlClient = phenomlClient;
@@ -10,23 +10,6 @@ export declare namespace AuthClient {
10
10
  export declare class AuthClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<AuthClient.Options>;
12
12
  constructor(options?: AuthClient.Options);
13
- /**
14
- * Obtain an access token using client credentials
15
- *
16
- * @param {phenoml.authtoken.AuthGenerateTokenRequest} request
17
- * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
18
- *
19
- * @throws {@link phenoml.authtoken.BadRequestError}
20
- * @throws {@link phenoml.authtoken.UnauthorizedError}
21
- *
22
- * @example
23
- * await client.authtoken.auth.generateToken({
24
- * username: "username",
25
- * password: "password"
26
- * })
27
- */
28
- generateToken(request: phenoml.authtoken.AuthGenerateTokenRequest, requestOptions?: AuthClient.RequestOptions): core.HttpResponsePromise<phenoml.authtoken.AuthGenerateTokenResponse>;
29
- private __generateToken;
30
13
  /**
31
14
  * OAuth 2.0 client credentials token endpoint (RFC 6749 §4.4).
32
15
  * Accepts client_id and client_secret in the request body (JSON or
@@ -55,66 +55,6 @@ class AuthClient {
55
55
  constructor(options = {}) {
56
56
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
57
  }
58
- /**
59
- * Obtain an access token using client credentials
60
- *
61
- * @param {phenoml.authtoken.AuthGenerateTokenRequest} request
62
- * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
63
- *
64
- * @throws {@link phenoml.authtoken.BadRequestError}
65
- * @throws {@link phenoml.authtoken.UnauthorizedError}
66
- *
67
- * @example
68
- * await client.authtoken.auth.generateToken({
69
- * username: "username",
70
- * password: "password"
71
- * })
72
- */
73
- generateToken(request, requestOptions) {
74
- return core.HttpResponsePromise.fromPromise(this.__generateToken(request, requestOptions));
75
- }
76
- __generateToken(request, requestOptions) {
77
- return __awaiter(this, void 0, void 0, function* () {
78
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
79
- const _authRequest = yield this._options.authProvider.getAuthRequest();
80
- 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);
81
- const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
82
- url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, "auth/token"),
83
- method: "POST",
84
- headers: _headers,
85
- contentType: "application/json",
86
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
87
- requestType: "json",
88
- body: request,
89
- timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
90
- maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
91
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
92
- fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
93
- logging: this._options.logging,
94
- });
95
- if (_response.ok) {
96
- return {
97
- data: _response.body,
98
- rawResponse: _response.rawResponse,
99
- };
100
- }
101
- if (_response.error.reason === "status-code") {
102
- switch (_response.error.statusCode) {
103
- case 400:
104
- throw new phenoml.authtoken.BadRequestError(_response.error.body, _response.rawResponse);
105
- case 401:
106
- throw new phenoml.authtoken.UnauthorizedError(_response.error.body, _response.rawResponse);
107
- default:
108
- throw new errors.phenomlError({
109
- statusCode: _response.error.statusCode,
110
- body: _response.error.body,
111
- rawResponse: _response.rawResponse,
112
- });
113
- }
114
- }
115
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/auth/token");
116
- });
117
- }
118
58
  /**
119
59
  * OAuth 2.0 client credentials token endpoint (RFC 6749 §4.4).
120
60
  * Accepts client_id and client_secret in the request body (JSON or
@@ -1,2 +1 @@
1
- export type { AuthGenerateTokenRequest } from "./AuthGenerateTokenRequest.js";
2
1
  export type { ClientCredentialsRequest } from "./ClientCredentialsRequest.js";
@@ -1,2 +1 @@
1
1
  export * from "./client/index.js";
2
- export * from "./types/index.js";
@@ -15,4 +15,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./client/index.js"), exports);
18
- __exportStar(require("./types/index.js"), exports);
@@ -1,3 +1,2 @@
1
1
  export * from "./auth/client/requests/index.js";
2
2
  export * as auth from "./auth/index.js";
3
- export * from "./auth/types/index.js";
@@ -39,4 +39,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.auth = void 0;
40
40
  __exportStar(require("./auth/client/requests/index.js"), exports);
41
41
  exports.auth = __importStar(require("./auth/index.js"));
42
- __exportStar(require("./auth/types/index.js"), exports);
@@ -1,4 +1,2 @@
1
- export * from "./BadRequestErrorBody.js";
2
1
  export * from "./OAuthError.js";
3
2
  export * from "./TokenResponse.js";
4
- export * from "./UnauthorizedErrorBody.js";
@@ -14,7 +14,5 @@ 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("./BadRequestErrorBody.js"), exports);
18
17
  __exportStar(require("./OAuthError.js"), exports);
19
18
  __exportStar(require("./TokenResponse.js"), exports);
20
- __exportStar(require("./UnauthorizedErrorBody.js"), exports);
@@ -70,17 +70,7 @@ export declare class FhirClient {
70
70
  * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
71
71
  * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
72
72
  * body: {
73
- * resourceType: "Patient",
74
- * name: [
75
- * {
76
- * "family": "Doe",
77
- * "given": [
78
- * "Jane"
79
- * ]
80
- * }
81
- * ],
82
- * gender: "female",
83
- * birthDate: "1990-01-01"
73
+ * resourceType: "Patient"
84
74
  * }
85
75
  * })
86
76
  */
@@ -115,18 +105,7 @@ export declare class FhirClient {
115
105
  * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
116
106
  * body: {
117
107
  * resourceType: "Patient",
118
- * id: "123",
119
- * name: [
120
- * {
121
- * "family": "Doe",
122
- * "given": [
123
- * "John",
124
- * "Updated"
125
- * ]
126
- * }
127
- * ],
128
- * gender: "male",
129
- * birthDate: "1985-05-15"
108
+ * id: "123"
130
109
  * }
131
110
  * })
132
111
  */
@@ -170,17 +170,7 @@ class FhirClient {
170
170
  * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
171
171
  * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
172
172
  * body: {
173
- * resourceType: "Patient",
174
- * name: [
175
- * {
176
- * "family": "Doe",
177
- * "given": [
178
- * "Jane"
179
- * ]
180
- * }
181
- * ],
182
- * gender: "female",
183
- * birthDate: "1990-01-01"
173
+ * resourceType: "Patient"
184
174
  * }
185
175
  * })
186
176
  */
@@ -267,18 +257,7 @@ class FhirClient {
267
257
  * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
268
258
  * body: {
269
259
  * resourceType: "Patient",
270
- * id: "123",
271
- * name: [
272
- * {
273
- * "family": "Doe",
274
- * "given": [
275
- * "John",
276
- * "Updated"
277
- * ]
278
- * }
279
- * ],
280
- * gender: "male",
281
- * birthDate: "1985-05-15"
260
+ * id: "123"
282
261
  * }
283
262
  * })
284
263
  */
@@ -5,17 +5,7 @@ import type * as phenoml from "../../../../index.js";
5
5
  * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
6
6
  * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
7
7
  * body: {
8
- * resourceType: "Patient",
9
- * name: [
10
- * {
11
- * "family": "Doe",
12
- * "given": [
13
- * "Jane"
14
- * ]
15
- * }
16
- * ],
17
- * gender: "female",
18
- * birthDate: "1990-01-01"
8
+ * resourceType: "Patient"
19
9
  * }
20
10
  * }
21
11
  */
@@ -13,7 +13,7 @@ export interface FhirSearchRequest {
13
13
  * - Result parameters (_count, _offset, _sort, _include, _revinclude, _summary, _elements)
14
14
  * - Search prefixes for dates, numbers, quantities (eq, ne, gt, ge, lt, le, sa, eb, ap)
15
15
  */
16
- query_parameters?: Record<string, string | undefined>;
16
+ query_parameters?: Record<string, string>;
17
17
  /**
18
18
  * Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
19
19
  * Must be in the format: Patient/{uuid} or Practitioner/{uuid}
@@ -6,18 +6,7 @@ import type * as phenoml from "../../../../index.js";
6
6
  * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
7
7
  * body: {
8
8
  * resourceType: "Patient",
9
- * id: "123",
10
- * name: [
11
- * {
12
- * "family": "Doe",
13
- * "given": [
14
- * "John",
15
- * "Updated"
16
- * ]
17
- * }
18
- * ],
19
- * gender: "male",
20
- * birthDate: "1985-05-15"
9
+ * id: "123"
21
10
  * }
22
11
  * }
23
12
  */
@@ -14,6 +14,6 @@ export type BinaryResponse = {
14
14
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes)
15
15
  * Some versions of the Fetch API may not support this method.
16
16
  */
17
- bytes?(): ReturnType<Response["bytes"]>;
17
+ bytes?(): Promise<Uint8Array>;
18
18
  };
19
19
  export declare function getBinaryResponse(response: Response): BinaryResponse;
@@ -6,6 +6,8 @@ export type { Fetcher, FetchFunction } from "./Fetcher.js";
6
6
  export { fetcher } from "./Fetcher.js";
7
7
  export { getHeader } from "./getHeader.js";
8
8
  export { HttpResponsePromise } from "./HttpResponsePromise.js";
9
+ export type { PassthroughRequest } from "./makePassthroughRequest.js";
10
+ export { makePassthroughRequest } from "./makePassthroughRequest.js";
9
11
  export type { RawResponse, WithRawResponse } from "./RawResponse.js";
10
12
  export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js";
11
13
  export { Supplier } from "./Supplier.js";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Supplier = exports.unknownRawResponse = exports.toRawResponse = exports.abortRawResponse = exports.HttpResponsePromise = exports.getHeader = exports.fetcher = exports.EndpointSupplier = void 0;
3
+ exports.Supplier = exports.unknownRawResponse = exports.toRawResponse = exports.abortRawResponse = exports.makePassthroughRequest = exports.HttpResponsePromise = exports.getHeader = exports.fetcher = exports.EndpointSupplier = void 0;
4
4
  var EndpointSupplier_js_1 = require("./EndpointSupplier.js");
5
5
  Object.defineProperty(exports, "EndpointSupplier", { enumerable: true, get: function () { return EndpointSupplier_js_1.EndpointSupplier; } });
6
6
  var Fetcher_js_1 = require("./Fetcher.js");
@@ -9,6 +9,8 @@ var getHeader_js_1 = require("./getHeader.js");
9
9
  Object.defineProperty(exports, "getHeader", { enumerable: true, get: function () { return getHeader_js_1.getHeader; } });
10
10
  var HttpResponsePromise_js_1 = require("./HttpResponsePromise.js");
11
11
  Object.defineProperty(exports, "HttpResponsePromise", { enumerable: true, get: function () { return HttpResponsePromise_js_1.HttpResponsePromise; } });
12
+ var makePassthroughRequest_js_1 = require("./makePassthroughRequest.js");
13
+ Object.defineProperty(exports, "makePassthroughRequest", { enumerable: true, get: function () { return makePassthroughRequest_js_1.makePassthroughRequest; } });
12
14
  var RawResponse_js_1 = require("./RawResponse.js");
13
15
  Object.defineProperty(exports, "abortRawResponse", { enumerable: true, get: function () { return RawResponse_js_1.abortRawResponse; } });
14
16
  Object.defineProperty(exports, "toRawResponse", { enumerable: true, get: function () { return RawResponse_js_1.toRawResponse; } });
@@ -0,0 +1,49 @@
1
+ import { type LogConfig, type Logger } from "../logging/logger.js";
2
+ import { Supplier } from "./Supplier.js";
3
+ export declare namespace PassthroughRequest {
4
+ /**
5
+ * Per-request options that can override the SDK client defaults.
6
+ */
7
+ interface RequestOptions {
8
+ /** Override the default timeout for this request (in seconds). */
9
+ timeoutInSeconds?: number;
10
+ /** Override the default number of retries for this request. */
11
+ maxRetries?: number;
12
+ /** Additional headers to include in this request. */
13
+ headers?: Record<string, string>;
14
+ /** Abort signal for this request. */
15
+ abortSignal?: AbortSignal;
16
+ }
17
+ /**
18
+ * SDK client configuration used by the passthrough fetch method.
19
+ */
20
+ interface ClientOptions {
21
+ /** The base URL or environment for the client. */
22
+ environment?: Supplier<string>;
23
+ /** Override the base URL. */
24
+ baseUrl?: Supplier<string>;
25
+ /** Default headers to include in requests. */
26
+ headers?: Record<string, unknown>;
27
+ /** Default maximum time to wait for a response in seconds. */
28
+ timeoutInSeconds?: number;
29
+ /** Default number of times to retry the request. Defaults to 2. */
30
+ maxRetries?: number;
31
+ /** A custom fetch function. */
32
+ fetch?: typeof fetch;
33
+ /** Logging configuration. */
34
+ logging?: LogConfig | Logger;
35
+ /** A function that returns auth headers. */
36
+ getAuthHeaders?: () => Promise<Record<string, string>>;
37
+ }
38
+ }
39
+ /**
40
+ * Makes a passthrough HTTP request using the SDK's configuration (auth, retry, logging, etc.)
41
+ * while mimicking the standard `fetch` API.
42
+ *
43
+ * @param input - The URL, path, or Request object. If a relative path, it will be resolved against the configured base URL.
44
+ * @param init - Standard RequestInit options (method, headers, body, signal, etc.)
45
+ * @param clientOptions - SDK client options (auth, default headers, logging, etc.)
46
+ * @param requestOptions - Per-request overrides (timeout, retries, extra headers, abort signal).
47
+ * @returns A standard Response object.
48
+ */
49
+ export declare function makePassthroughRequest(input: Request | string | URL, init: RequestInit | undefined, clientOptions: PassthroughRequest.ClientOptions, requestOptions?: PassthroughRequest.RequestOptions): Promise<Response>;
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.makePassthroughRequest = makePassthroughRequest;
13
+ const logger_js_1 = require("../logging/logger.js");
14
+ const join_js_1 = require("../url/join.js");
15
+ const EndpointSupplier_js_1 = require("./EndpointSupplier.js");
16
+ const getFetchFn_js_1 = require("./getFetchFn.js");
17
+ const makeRequest_js_1 = require("./makeRequest.js");
18
+ const requestWithRetries_js_1 = require("./requestWithRetries.js");
19
+ const Supplier_js_1 = require("./Supplier.js");
20
+ /**
21
+ * Makes a passthrough HTTP request using the SDK's configuration (auth, retry, logging, etc.)
22
+ * while mimicking the standard `fetch` API.
23
+ *
24
+ * @param input - The URL, path, or Request object. If a relative path, it will be resolved against the configured base URL.
25
+ * @param init - Standard RequestInit options (method, headers, body, signal, etc.)
26
+ * @param clientOptions - SDK client options (auth, default headers, logging, etc.)
27
+ * @param requestOptions - Per-request overrides (timeout, retries, extra headers, abort signal).
28
+ * @returns A standard Response object.
29
+ */
30
+ function makePassthroughRequest(input, init, clientOptions, requestOptions) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ var _a, _b, _c, _d, _e, _f, _g;
33
+ const logger = (0, logger_js_1.createLogger)(clientOptions.logging);
34
+ // Extract URL and default init properties from Request object if provided
35
+ let url;
36
+ let effectiveInit = init;
37
+ if (input instanceof Request) {
38
+ url = input.url;
39
+ // If no explicit init provided, extract properties from the Request object
40
+ if (init == null) {
41
+ effectiveInit = {
42
+ method: input.method,
43
+ headers: Object.fromEntries(input.headers.entries()),
44
+ body: input.body,
45
+ signal: input.signal,
46
+ credentials: input.credentials,
47
+ cache: input.cache,
48
+ redirect: input.redirect,
49
+ referrer: input.referrer,
50
+ integrity: input.integrity,
51
+ mode: input.mode,
52
+ };
53
+ }
54
+ }
55
+ else {
56
+ url = input instanceof URL ? input.toString() : input;
57
+ }
58
+ // Resolve the base URL
59
+ const baseUrl = (_a = (clientOptions.baseUrl != null ? yield Supplier_js_1.Supplier.get(clientOptions.baseUrl) : undefined)) !== null && _a !== void 0 ? _a : (clientOptions.environment != null ? yield Supplier_js_1.Supplier.get(clientOptions.environment) : undefined);
60
+ // Determine the full URL
61
+ let fullUrl;
62
+ if (url.startsWith("http://") || url.startsWith("https://")) {
63
+ fullUrl = url;
64
+ }
65
+ else if (baseUrl != null) {
66
+ fullUrl = (0, join_js_1.join)(baseUrl, url);
67
+ }
68
+ else {
69
+ fullUrl = url;
70
+ }
71
+ // Merge headers: SDK default headers -> auth headers -> user-provided headers
72
+ const mergedHeaders = {};
73
+ // Apply SDK default headers (resolve suppliers)
74
+ if (clientOptions.headers != null) {
75
+ for (const [key, value] of Object.entries(clientOptions.headers)) {
76
+ const resolved = yield EndpointSupplier_js_1.EndpointSupplier.get(value, { endpointMetadata: {} });
77
+ if (resolved != null) {
78
+ mergedHeaders[key.toLowerCase()] = `${resolved}`;
79
+ }
80
+ }
81
+ }
82
+ // Apply auth headers
83
+ if (clientOptions.getAuthHeaders != null) {
84
+ const authHeaders = yield clientOptions.getAuthHeaders();
85
+ for (const [key, value] of Object.entries(authHeaders)) {
86
+ mergedHeaders[key.toLowerCase()] = value;
87
+ }
88
+ }
89
+ // Apply user-provided headers from init
90
+ if ((effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.headers) != null) {
91
+ const initHeaders = effectiveInit.headers instanceof Headers
92
+ ? Object.fromEntries(effectiveInit.headers.entries())
93
+ : Array.isArray(effectiveInit.headers)
94
+ ? Object.fromEntries(effectiveInit.headers)
95
+ : effectiveInit.headers;
96
+ for (const [key, value] of Object.entries(initHeaders)) {
97
+ if (value != null) {
98
+ mergedHeaders[key.toLowerCase()] = value;
99
+ }
100
+ }
101
+ }
102
+ // Apply per-request option headers (highest priority)
103
+ if ((requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers) != null) {
104
+ for (const [key, value] of Object.entries(requestOptions.headers)) {
105
+ mergedHeaders[key.toLowerCase()] = value;
106
+ }
107
+ }
108
+ const method = (_b = effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.method) !== null && _b !== void 0 ? _b : "GET";
109
+ const body = effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.body;
110
+ const timeoutInSeconds = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _c !== void 0 ? _c : clientOptions.timeoutInSeconds;
111
+ const timeoutMs = timeoutInSeconds != null ? timeoutInSeconds * 1000 : undefined;
112
+ const maxRetries = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _d !== void 0 ? _d : clientOptions.maxRetries;
113
+ const abortSignal = (_f = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal) !== null && _e !== void 0 ? _e : effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.signal) !== null && _f !== void 0 ? _f : undefined;
114
+ const fetchFn = (_g = clientOptions.fetch) !== null && _g !== void 0 ? _g : (yield (0, getFetchFn_js_1.getFetchFn)());
115
+ if (logger.isDebug()) {
116
+ logger.debug("Making passthrough HTTP request", {
117
+ method,
118
+ url: fullUrl,
119
+ hasBody: body != null,
120
+ });
121
+ }
122
+ const response = yield (0, requestWithRetries_js_1.requestWithRetries)(() => __awaiter(this, void 0, void 0, function* () {
123
+ return (0, makeRequest_js_1.makeRequest)(fetchFn, fullUrl, method, mergedHeaders, body !== null && body !== void 0 ? body : undefined, timeoutMs, abortSignal, (effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.credentials) === "include", undefined, // duplex
124
+ false);
125
+ }), maxRetries);
126
+ if (logger.isDebug()) {
127
+ logger.debug("Passthrough HTTP request completed", {
128
+ method,
129
+ url: fullUrl,
130
+ statusCode: response.status,
131
+ });
132
+ }
133
+ return response;
134
+ });
135
+ }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "11.4.0";
1
+ export declare const SDK_VERSION = "12.0.0";
@@ -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 = "11.4.0";
4
+ exports.SDK_VERSION = "12.0.0";
@@ -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": "phenoml",
9
- "X-Fern-SDK-Version": "11.4.0",
10
- "User-Agent": "phenoml/11.4.0",
9
+ "X-Fern-SDK-Version": "12.0.0",
10
+ "User-Agent": "phenoml/12.0.0",
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);