phenoml 0.0.8 → 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.
Files changed (94) hide show
  1. package/dist/cjs/Client.js +2 -2
  2. package/dist/cjs/api/resources/agent/client/Client.d.ts +2 -0
  3. package/dist/cjs/api/resources/agent/client/Client.js +20 -2
  4. package/dist/cjs/api/resources/agent/client/requests/AgentChatRequest.d.ts +12 -0
  5. package/dist/cjs/api/resources/construe/client/Client.d.ts +0 -18
  6. package/dist/cjs/api/resources/construe/client/Client.js +0 -74
  7. package/dist/cjs/api/resources/construe/client/requests/index.d.ts +0 -1
  8. package/dist/cjs/api/resources/construe/types/ExtractRequestConfig.d.ts +28 -2
  9. package/dist/cjs/api/resources/construe/types/ExtractRequestConfig.js +14 -2
  10. package/dist/cjs/api/resources/construe/types/ExtractRequestSystem.d.ts +2 -0
  11. package/dist/cjs/api/resources/construe/types/index.d.ts +0 -4
  12. package/dist/cjs/api/resources/construe/types/index.js +0 -4
  13. package/dist/cjs/api/resources/fhir/client/Client.d.ts +18 -9
  14. package/dist/cjs/api/resources/fhir/client/Client.js +30 -15
  15. package/dist/cjs/api/resources/fhir/client/requests/FhirCreateRequest.d.ts +11 -2
  16. package/dist/cjs/api/resources/fhir/client/requests/FhirDeleteRequest.d.ts +11 -2
  17. package/dist/cjs/api/resources/fhir/client/requests/FhirExecuteBundleRequest.d.ts +11 -2
  18. package/dist/cjs/api/resources/fhir/client/requests/FhirPatchRequest.d.ts +17 -5
  19. package/dist/cjs/api/resources/fhir/client/requests/FhirSearchRequest.d.ts +13 -3
  20. package/dist/cjs/api/resources/fhir/client/requests/FhirUpsertRequest.d.ts +11 -2
  21. package/dist/cjs/api/resources/fhirProvider/client/Client.js +2 -2
  22. package/dist/cjs/api/resources/fhirProvider/client/requests/FhirProviderAddAuthConfigRequest.d.ts +2 -1
  23. package/dist/cjs/api/resources/fhirProvider/client/requests/FhirProviderCreateRequest.d.ts +2 -1
  24. package/dist/cjs/api/resources/fhirProvider/types/AuthMethod.d.ts +2 -1
  25. package/dist/cjs/api/resources/fhirProvider/types/AuthMethod.js +2 -1
  26. package/dist/cjs/api/resources/fhirProvider/types/Role.d.ts +22 -0
  27. package/dist/cjs/api/resources/fhirProvider/types/Role.js +25 -0
  28. package/dist/cjs/api/resources/fhirProvider/types/index.d.ts +1 -0
  29. package/dist/cjs/api/resources/fhirProvider/types/index.js +1 -0
  30. package/dist/cjs/api/resources/tools/client/Client.d.ts +6 -0
  31. package/dist/cjs/api/resources/tools/client/Client.js +38 -6
  32. package/dist/cjs/api/resources/tools/client/requests/CohortRequest.d.ts +12 -0
  33. package/dist/cjs/api/resources/tools/client/requests/Lang2FhirAndCreateRequest.d.ts +12 -0
  34. package/dist/cjs/api/resources/tools/client/requests/Lang2FhirAndSearchRequest.d.ts +12 -0
  35. package/dist/cjs/version.d.ts +1 -1
  36. package/dist/cjs/version.js +1 -1
  37. package/dist/esm/Client.mjs +2 -2
  38. package/dist/esm/api/resources/agent/client/Client.d.mts +2 -0
  39. package/dist/esm/api/resources/agent/client/Client.mjs +20 -2
  40. package/dist/esm/api/resources/agent/client/requests/AgentChatRequest.d.mts +12 -0
  41. package/dist/esm/api/resources/construe/client/Client.d.mts +0 -18
  42. package/dist/esm/api/resources/construe/client/Client.mjs +0 -74
  43. package/dist/esm/api/resources/construe/client/requests/index.d.mts +0 -1
  44. package/dist/esm/api/resources/construe/types/ExtractRequestConfig.d.mts +28 -2
  45. package/dist/esm/api/resources/construe/types/ExtractRequestConfig.mjs +14 -2
  46. package/dist/esm/api/resources/construe/types/ExtractRequestSystem.d.mts +2 -0
  47. package/dist/esm/api/resources/construe/types/index.d.mts +0 -4
  48. package/dist/esm/api/resources/construe/types/index.mjs +0 -4
  49. package/dist/esm/api/resources/fhir/client/Client.d.mts +18 -9
  50. package/dist/esm/api/resources/fhir/client/Client.mjs +30 -15
  51. package/dist/esm/api/resources/fhir/client/requests/FhirCreateRequest.d.mts +11 -2
  52. package/dist/esm/api/resources/fhir/client/requests/FhirDeleteRequest.d.mts +11 -2
  53. package/dist/esm/api/resources/fhir/client/requests/FhirExecuteBundleRequest.d.mts +11 -2
  54. package/dist/esm/api/resources/fhir/client/requests/FhirPatchRequest.d.mts +17 -5
  55. package/dist/esm/api/resources/fhir/client/requests/FhirSearchRequest.d.mts +13 -3
  56. package/dist/esm/api/resources/fhir/client/requests/FhirUpsertRequest.d.mts +11 -2
  57. package/dist/esm/api/resources/fhirProvider/client/Client.mjs +2 -2
  58. package/dist/esm/api/resources/fhirProvider/client/requests/FhirProviderAddAuthConfigRequest.d.mts +2 -1
  59. package/dist/esm/api/resources/fhirProvider/client/requests/FhirProviderCreateRequest.d.mts +2 -1
  60. package/dist/esm/api/resources/fhirProvider/types/AuthMethod.d.mts +2 -1
  61. package/dist/esm/api/resources/fhirProvider/types/AuthMethod.mjs +2 -1
  62. package/dist/esm/api/resources/fhirProvider/types/Role.d.mts +22 -0
  63. package/dist/esm/api/resources/fhirProvider/types/Role.mjs +22 -0
  64. package/dist/esm/api/resources/fhirProvider/types/index.d.mts +1 -0
  65. package/dist/esm/api/resources/fhirProvider/types/index.mjs +1 -0
  66. package/dist/esm/api/resources/tools/client/Client.d.mts +6 -0
  67. package/dist/esm/api/resources/tools/client/Client.mjs +38 -6
  68. package/dist/esm/api/resources/tools/client/requests/CohortRequest.d.mts +12 -0
  69. package/dist/esm/api/resources/tools/client/requests/Lang2FhirAndCreateRequest.d.mts +12 -0
  70. package/dist/esm/api/resources/tools/client/requests/Lang2FhirAndSearchRequest.d.mts +12 -0
  71. package/dist/esm/version.d.mts +1 -1
  72. package/dist/esm/version.mjs +1 -1
  73. package/package.json +1 -1
  74. package/reference.md +20 -72
  75. package/dist/cjs/api/resources/construe/client/requests/ConstrueCohortRequest.d.ts +0 -23
  76. package/dist/cjs/api/resources/construe/client/requests/ConstrueCohortRequest.js +0 -3
  77. package/dist/cjs/api/resources/construe/types/BadRequestErrorBody.d.ts +0 -6
  78. package/dist/cjs/api/resources/construe/types/BadRequestErrorBody.js +0 -3
  79. package/dist/cjs/api/resources/construe/types/ConstrueCohortResponse.d.ts +0 -46
  80. package/dist/cjs/api/resources/construe/types/ConstrueCohortResponse.js +0 -3
  81. package/dist/cjs/api/resources/construe/types/InternalServerErrorBody.d.ts +0 -6
  82. package/dist/cjs/api/resources/construe/types/InternalServerErrorBody.js +0 -3
  83. package/dist/cjs/api/resources/construe/types/UnauthorizedErrorBody.d.ts +0 -6
  84. package/dist/cjs/api/resources/construe/types/UnauthorizedErrorBody.js +0 -3
  85. package/dist/esm/api/resources/construe/client/requests/ConstrueCohortRequest.d.mts +0 -23
  86. package/dist/esm/api/resources/construe/client/requests/ConstrueCohortRequest.mjs +0 -2
  87. package/dist/esm/api/resources/construe/types/BadRequestErrorBody.d.mts +0 -6
  88. package/dist/esm/api/resources/construe/types/BadRequestErrorBody.mjs +0 -2
  89. package/dist/esm/api/resources/construe/types/ConstrueCohortResponse.d.mts +0 -46
  90. package/dist/esm/api/resources/construe/types/ConstrueCohortResponse.mjs +0 -2
  91. package/dist/esm/api/resources/construe/types/InternalServerErrorBody.d.mts +0 -6
  92. package/dist/esm/api/resources/construe/types/InternalServerErrorBody.mjs +0 -2
  93. package/dist/esm/api/resources/construe/types/UnauthorizedErrorBody.d.mts +0 -6
  94. package/dist/esm/api/resources/construe/types/UnauthorizedErrorBody.mjs +0 -2
@@ -2,7 +2,8 @@ import type * as phenoml from "../../../../index.js";
2
2
  /**
3
3
  * @example
4
4
  * {
5
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
5
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
6
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
6
7
  * body: {
7
8
  * resourceType: "Bundle",
8
9
  * entry: [{
@@ -38,7 +39,15 @@ import type * as phenoml from "../../../../index.js";
38
39
  * }
39
40
  */
40
41
  export interface FhirExecuteBundleRequest {
41
- /** Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. */
42
+ /**
43
+ * Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
44
+ * Must be in the format: Patient/{uuid} or Practitioner/{uuid}
45
+ */
42
46
  "X-Phenoml-On-Behalf-Of"?: string;
47
+ /**
48
+ * Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
49
+ * Multiple FHIR provider integrations can be provided as comma-separated values.
50
+ */
51
+ "X-Phenoml-Fhir-Provider"?: string;
43
52
  body: phenoml.fhir.FhirBundle;
44
53
  }
@@ -2,7 +2,8 @@ import type * as phenoml from "../../../../index.js";
2
2
  /**
3
3
  * @example
4
4
  * {
5
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
5
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
6
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
6
7
  * body: [{
7
8
  * op: "replace",
8
9
  * path: "/name/0/family",
@@ -12,7 +13,8 @@ import type * as phenoml from "../../../../index.js";
12
13
  *
13
14
  * @example
14
15
  * {
15
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
16
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
17
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
16
18
  * body: [{
17
19
  * op: "add",
18
20
  * path: "/telecom/-",
@@ -26,7 +28,8 @@ import type * as phenoml from "../../../../index.js";
26
28
  *
27
29
  * @example
28
30
  * {
29
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
31
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
32
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
30
33
  * body: [{
31
34
  * op: "replace",
32
35
  * path: "/name/0/family",
@@ -46,7 +49,8 @@ import type * as phenoml from "../../../../index.js";
46
49
  *
47
50
  * @example
48
51
  * {
49
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
52
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
53
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
50
54
  * body: [{
51
55
  * op: "test",
52
56
  * path: "/gender",
@@ -59,8 +63,16 @@ import type * as phenoml from "../../../../index.js";
59
63
  * }
60
64
  */
61
65
  export interface FhirPatchRequest {
62
- /** Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. */
66
+ /**
67
+ * Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
68
+ * Must be in the format: Patient/{uuid} or Practitioner/{uuid}
69
+ */
63
70
  "X-Phenoml-On-Behalf-Of"?: string;
71
+ /**
72
+ * Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
73
+ * Multiple FHIR provider integrations can be provided as comma-separated values.
74
+ */
75
+ "X-Phenoml-Fhir-Provider"?: string;
64
76
  /** Array of JSON Patch operations following RFC 6902 */
65
77
  body: phenoml.fhir.FhirPatchRequestBodyItem[];
66
78
  }
@@ -1,12 +1,14 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
- * "X-Phenoml-On-Behalf-Of": "user@example.com"
4
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
5
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c..."
5
6
  * }
6
7
  *
7
8
  * @example
8
9
  * {
9
- * "X-Phenoml-On-Behalf-Of": "user@example.com"
10
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
11
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c..."
10
12
  * }
11
13
  */
12
14
  export interface FhirSearchRequest {
@@ -18,6 +20,14 @@ export interface FhirSearchRequest {
18
20
  * - Search prefixes for dates, numbers, quantities (eq, ne, gt, ge, lt, le, sa, eb, ap)
19
21
  */
20
22
  query_parameters?: Record<string, string | undefined>;
21
- /** Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. */
23
+ /**
24
+ * Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
25
+ * Must be in the format: Patient/{uuid} or Practitioner/{uuid}
26
+ */
22
27
  "X-Phenoml-On-Behalf-Of"?: string;
28
+ /**
29
+ * Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
30
+ * Multiple FHIR provider integrations can be provided as comma-separated values.
31
+ */
32
+ "X-Phenoml-Fhir-Provider"?: string;
23
33
  }
@@ -2,7 +2,8 @@ import type * as phenoml from "../../../../index.js";
2
2
  /**
3
3
  * @example
4
4
  * {
5
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
5
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
6
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
6
7
  * body: {
7
8
  * resourceType: "Patient",
8
9
  * id: "123",
@@ -21,7 +22,15 @@ import type * as phenoml from "../../../../index.js";
21
22
  * }
22
23
  */
23
24
  export interface FhirUpsertRequest {
24
- /** Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. */
25
+ /**
26
+ * Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
27
+ * Must be in the format: Patient/{uuid} or Practitioner/{uuid}
28
+ */
25
29
  "X-Phenoml-On-Behalf-Of"?: string;
30
+ /**
31
+ * Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
32
+ * Multiple FHIR provider integrations can be provided as comma-separated values.
33
+ */
34
+ "X-Phenoml-Fhir-Provider"?: string;
26
35
  body: phenoml.fhir.FhirResource;
27
36
  }
@@ -80,7 +80,7 @@ class FhirProvider {
80
80
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
81
81
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
82
82
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
83
- 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, "fhir-provider/create"),
83
+ 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, "fhir-provider"),
84
84
  method: "POST",
85
85
  headers: _headers,
86
86
  contentType: "application/json",
@@ -123,7 +123,7 @@ class FhirProvider {
123
123
  rawResponse: _response.rawResponse,
124
124
  });
125
125
  case "timeout":
126
- throw new errors.phenomlTimeoutError("Timeout exceeded when calling POST /fhir-provider/create.");
126
+ throw new errors.phenomlTimeoutError("Timeout exceeded when calling POST /fhir-provider.");
127
127
  case "unknown":
128
128
  throw new errors.phenomlError({
129
129
  message: _response.error.errorMessage,
@@ -12,6 +12,7 @@ export interface FhirProviderAddAuthConfigRequest {
12
12
  service_account_key?: phenoml.fhirProvider.ServiceAccountKey;
13
13
  /** Expiry time for JWT credentials (only applicable for JWT auth method) */
14
14
  credential_expiry?: string;
15
- /** OAuth scopes to request */
15
+ role?: phenoml.fhirProvider.Role;
16
+ /** OAuth scopes to request. Cannot be specified with role. If neither role nor scopes are specified, the provider-specific default role will be used. You are solely responsible for ensuring the scopes are valid options for the provider being created or updated. */
16
17
  scopes?: string;
17
18
  }
@@ -22,6 +22,7 @@ export interface FhirProviderCreateRequest {
22
22
  /** OAuth client secret (required for client_secret and on_behalf_of auth methods) */
23
23
  client_secret?: string;
24
24
  service_account_key?: phenoml.fhirProvider.ServiceAccountKey;
25
- /** OAuth scopes to request */
25
+ role?: phenoml.fhirProvider.Role;
26
+ /** OAuth scopes to request. Cannot be specified with role. If neither role nor scopes are specified, the provider-specific default role will be used. You are solely responsible for ensuring the scopes are valid options for the provider being created or updated. */
26
27
  scopes?: string;
27
28
  }
@@ -1,9 +1,10 @@
1
- /** Authentication method for the FHIR provider */
1
+ /** Authentication method for the FHIR provider. Only one authentication method can be used at a time, but these can be rotated on the FHIR Provider as needed. For the 'token_passthrough' authentication method, you must provide the token in the X-Phenoml-Fhir-Provider header in the format {fhir_provider_id}:{oauth2_token}. For the 'on_behalf_of' authentication method, you must provide the Patient or Practitioner reference in the X-Phenoml-On-Behalf-Of header in the format Patient/{uuid} or Practitioner/{uuid}. This only works for the medplum provider currently. More on the authentication headers and how to structure them can be found in the FHIR Proxy, Tools and Agent documentation. */
2
2
  export declare const AuthMethod: {
3
3
  readonly ClientSecret: "client_secret";
4
4
  readonly GoogleHealthcare: "google_healthcare";
5
5
  readonly Jwt: "jwt";
6
6
  readonly OnBehalfOf: "on_behalf_of";
7
+ readonly TokenPassthrough: "token_passthrough";
7
8
  readonly None: "none";
8
9
  };
9
10
  export type AuthMethod = (typeof AuthMethod)[keyof typeof AuthMethod];
@@ -2,11 +2,12 @@
2
2
  // This file was auto-generated by Fern from our API Definition.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.AuthMethod = void 0;
5
- /** Authentication method for the FHIR provider */
5
+ /** Authentication method for the FHIR provider. Only one authentication method can be used at a time, but these can be rotated on the FHIR Provider as needed. For the 'token_passthrough' authentication method, you must provide the token in the X-Phenoml-Fhir-Provider header in the format {fhir_provider_id}:{oauth2_token}. For the 'on_behalf_of' authentication method, you must provide the Patient or Practitioner reference in the X-Phenoml-On-Behalf-Of header in the format Patient/{uuid} or Practitioner/{uuid}. This only works for the medplum provider currently. More on the authentication headers and how to structure them can be found in the FHIR Proxy, Tools and Agent documentation. */
6
6
  exports.AuthMethod = {
7
7
  ClientSecret: "client_secret",
8
8
  GoogleHealthcare: "google_healthcare",
9
9
  Jwt: "jwt",
10
10
  OnBehalfOf: "on_behalf_of",
11
+ TokenPassthrough: "token_passthrough",
11
12
  None: "none",
12
13
  };
@@ -0,0 +1,22 @@
1
+ /** Predefined role that specifies OAuth scopes. Cannot be specified with scopes. Available roles depend on the provider being created or updated. */
2
+ export declare const Role: {
3
+ readonly SmartV1Admin: "SmartV1Admin";
4
+ readonly SmartV1Read: "SmartV1Read";
5
+ readonly SmartV1Write: "SmartV1Write";
6
+ readonly SmartV2Admin: "SmartV2Admin";
7
+ readonly SmartV2Read: "SmartV2Read";
8
+ readonly SmartV2Write: "SmartV2Write";
9
+ readonly UscdiSmartV1Admin: "USCDISmartV1Admin";
10
+ readonly UscdiSmartV1Read: "USCDISmartV1Read";
11
+ readonly UscdiSmartV1Write: "USCDISmartV1Write";
12
+ readonly UscdiSmartV2Admin: "USCDISmartV2Admin";
13
+ readonly UscdiSmartV2Read: "USCDISmartV2Read";
14
+ readonly UscdiSmartV2Write: "USCDISmartV2Write";
15
+ readonly CernerSmartV1Admin: "CernerSmartV1Admin";
16
+ readonly CernerSmartV1Read: "CernerSmartV1Read";
17
+ readonly CernerSmartV1Write: "CernerSmartV1Write";
18
+ readonly CernerSmartV2Admin: "CernerSmartV2Admin";
19
+ readonly CernerSmartV2Read: "CernerSmartV2Read";
20
+ readonly CernerSmartV2Write: "CernerSmartV2Write";
21
+ };
22
+ export type Role = (typeof Role)[keyof typeof Role];
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Role = void 0;
5
+ /** Predefined role that specifies OAuth scopes. Cannot be specified with scopes. Available roles depend on the provider being created or updated. */
6
+ exports.Role = {
7
+ SmartV1Admin: "SmartV1Admin",
8
+ SmartV1Read: "SmartV1Read",
9
+ SmartV1Write: "SmartV1Write",
10
+ SmartV2Admin: "SmartV2Admin",
11
+ SmartV2Read: "SmartV2Read",
12
+ SmartV2Write: "SmartV2Write",
13
+ UscdiSmartV1Admin: "USCDISmartV1Admin",
14
+ UscdiSmartV1Read: "USCDISmartV1Read",
15
+ UscdiSmartV1Write: "USCDISmartV1Write",
16
+ UscdiSmartV2Admin: "USCDISmartV2Admin",
17
+ UscdiSmartV2Read: "USCDISmartV2Read",
18
+ UscdiSmartV2Write: "USCDISmartV2Write",
19
+ CernerSmartV1Admin: "CernerSmartV1Admin",
20
+ CernerSmartV1Read: "CernerSmartV1Read",
21
+ CernerSmartV1Write: "CernerSmartV1Write",
22
+ CernerSmartV2Admin: "CernerSmartV2Admin",
23
+ CernerSmartV2Read: "CernerSmartV2Read",
24
+ CernerSmartV2Write: "CernerSmartV2Write",
25
+ };
@@ -9,5 +9,6 @@ export * from "./FhirProviderTemplate.js";
9
9
  export * from "./FhirQueryResponse.js";
10
10
  export * from "./JsonWebKey.js";
11
11
  export * from "./Provider.js";
12
+ export * from "./Role.js";
12
13
  export * from "./ServiceAccountKey.js";
13
14
  export * from "./SmartConfiguration.js";
@@ -25,5 +25,6 @@ __exportStar(require("./FhirProviderTemplate.js"), exports);
25
25
  __exportStar(require("./FhirQueryResponse.js"), exports);
26
26
  __exportStar(require("./JsonWebKey.js"), exports);
27
27
  __exportStar(require("./Provider.js"), exports);
28
+ __exportStar(require("./Role.js"), exports);
28
29
  __exportStar(require("./ServiceAccountKey.js"), exports);
29
30
  __exportStar(require("./SmartConfiguration.js"), exports);
@@ -27,6 +27,8 @@ export declare class Tools {
27
27
  *
28
28
  * @example
29
29
  * await client.tools.createFhirResource({
30
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
31
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
30
32
  * resource: "auto",
31
33
  * text: "Patient John Doe has severe asthma with acute exacerbation"
32
34
  * })
@@ -47,6 +49,8 @@ export declare class Tools {
47
49
  *
48
50
  * @example
49
51
  * await client.tools.searchFhirResources({
52
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
53
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
50
54
  * text: "Find all appointments for patient John Doe next week"
51
55
  * })
52
56
  */
@@ -65,6 +69,8 @@ export declare class Tools {
65
69
  *
66
70
  * @example
67
71
  * await client.tools.analyzeCohort({
72
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
73
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
68
74
  * text: "female patients over 20 with diabetes but not hypertension",
69
75
  * provider: "550e8400-e29b-41d4-a716-446655440000"
70
76
  * })
@@ -42,6 +42,17 @@ 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
+ };
45
56
  Object.defineProperty(exports, "__esModule", { value: true });
46
57
  exports.Tools = void 0;
47
58
  const headers_js_1 = require("../../../../core/headers.js");
@@ -72,6 +83,8 @@ class Tools {
72
83
  *
73
84
  * @example
74
85
  * await client.tools.createFhirResource({
86
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
87
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
75
88
  * resource: "auto",
76
89
  * text: "Patient John Doe has severe asthma with acute exacerbation"
77
90
  * })
@@ -82,7 +95,12 @@ class Tools {
82
95
  __createFhirResource(request, requestOptions) {
83
96
  return __awaiter(this, void 0, void 0, function* () {
84
97
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
85
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
98
+ const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf, "X-Phenoml-Fhir-Provider": phenomlFhirProvider } = request, _body = __rest(request, ["X-Phenoml-On-Behalf-Of", "X-Phenoml-Fhir-Provider"]);
99
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
100
+ Authorization: yield this._getAuthorizationHeader(),
101
+ "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
102
+ "X-Phenoml-Fhir-Provider": phenomlFhirProvider != null ? phenomlFhirProvider : undefined,
103
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
86
104
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
87
105
  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, "tools/lang2fhir-and-create"),
88
106
  method: "POST",
@@ -90,7 +108,7 @@ class Tools {
90
108
  contentType: "application/json",
91
109
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
92
110
  requestType: "json",
93
- body: request,
111
+ body: _body,
94
112
  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,
95
113
  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,
96
114
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -152,6 +170,8 @@ class Tools {
152
170
  *
153
171
  * @example
154
172
  * await client.tools.searchFhirResources({
173
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
174
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
155
175
  * text: "Find all appointments for patient John Doe next week"
156
176
  * })
157
177
  */
@@ -161,7 +181,12 @@ class Tools {
161
181
  __searchFhirResources(request, requestOptions) {
162
182
  return __awaiter(this, void 0, void 0, function* () {
163
183
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
164
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
184
+ const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf, "X-Phenoml-Fhir-Provider": phenomlFhirProvider } = request, _body = __rest(request, ["X-Phenoml-On-Behalf-Of", "X-Phenoml-Fhir-Provider"]);
185
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
186
+ Authorization: yield this._getAuthorizationHeader(),
187
+ "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
188
+ "X-Phenoml-Fhir-Provider": phenomlFhirProvider != null ? phenomlFhirProvider : undefined,
189
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
165
190
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
166
191
  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, "tools/lang2fhir-and-search"),
167
192
  method: "POST",
@@ -169,7 +194,7 @@ class Tools {
169
194
  contentType: "application/json",
170
195
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
171
196
  requestType: "json",
172
- body: request,
197
+ body: _body,
173
198
  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,
174
199
  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,
175
200
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -230,6 +255,8 @@ class Tools {
230
255
  *
231
256
  * @example
232
257
  * await client.tools.analyzeCohort({
258
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
259
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
233
260
  * text: "female patients over 20 with diabetes but not hypertension",
234
261
  * provider: "550e8400-e29b-41d4-a716-446655440000"
235
262
  * })
@@ -240,7 +267,12 @@ class Tools {
240
267
  __analyzeCohort(request, requestOptions) {
241
268
  return __awaiter(this, void 0, void 0, function* () {
242
269
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
243
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
270
+ const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf, "X-Phenoml-Fhir-Provider": phenomlFhirProvider } = request, _body = __rest(request, ["X-Phenoml-On-Behalf-Of", "X-Phenoml-Fhir-Provider"]);
271
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
272
+ Authorization: yield this._getAuthorizationHeader(),
273
+ "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
274
+ "X-Phenoml-Fhir-Provider": phenomlFhirProvider != null ? phenomlFhirProvider : undefined,
275
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
244
276
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
245
277
  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, "tools/cohort"),
246
278
  method: "POST",
@@ -248,7 +280,7 @@ class Tools {
248
280
  contentType: "application/json",
249
281
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
250
282
  requestType: "json",
251
- body: request,
283
+ body: _body,
252
284
  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,
253
285
  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,
254
286
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -1,11 +1,23 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
5
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
4
6
  * text: "female patients over 20 with diabetes but not hypertension",
5
7
  * provider: "550e8400-e29b-41d4-a716-446655440000"
6
8
  * }
7
9
  */
8
10
  export interface CohortRequest {
11
+ /**
12
+ * Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
13
+ * Must be in the format: Patient/{uuid} or Practitioner/{uuid}
14
+ */
15
+ "X-Phenoml-On-Behalf-Of"?: string;
16
+ /**
17
+ * Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
18
+ * Multiple FHIR provider integrations can be provided as comma-separated values.
19
+ */
20
+ "X-Phenoml-Fhir-Provider"?: string;
9
21
  /** Natural language text describing the patient cohort criteria */
10
22
  text: string;
11
23
  /** FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum) */
@@ -1,11 +1,23 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
5
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
4
6
  * resource: "auto",
5
7
  * text: "Patient John Doe has severe asthma with acute exacerbation"
6
8
  * }
7
9
  */
8
10
  export interface Lang2FhirAndCreateRequest {
11
+ /**
12
+ * Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
13
+ * Must be in the format: Patient/{uuid} or Practitioner/{uuid}
14
+ */
15
+ "X-Phenoml-On-Behalf-Of"?: string;
16
+ /**
17
+ * Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
18
+ * Multiple FHIR provider integrations can be provided as comma-separated values.
19
+ */
20
+ "X-Phenoml-Fhir-Provider"?: string;
9
21
  /** Type of FHIR resource to create. Use 'auto' for automatic resource type detection, or specify a supported US Core profile. */
10
22
  resource: Lang2FhirAndCreateRequest.Resource;
11
23
  /** Natural language text to convert to FHIR resource */
@@ -1,10 +1,22 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
5
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
4
6
  * text: "Find all appointments for patient John Doe next week"
5
7
  * }
6
8
  */
7
9
  export interface Lang2FhirAndSearchRequest {
10
+ /**
11
+ * Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
12
+ * Must be in the format: Patient/{uuid} or Practitioner/{uuid}
13
+ */
14
+ "X-Phenoml-On-Behalf-Of"?: string;
15
+ /**
16
+ * Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
17
+ * Multiple FHIR provider integrations can be provided as comma-separated values.
18
+ */
19
+ "X-Phenoml-Fhir-Provider"?: string;
8
20
  /** Natural language text to convert to FHIR search parameters */
9
21
  text: string;
10
22
  /** Patient ID to filter results */
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.8";
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.8";
4
+ exports.SDK_VERSION = "0.0.10";
@@ -16,8 +16,8 @@ export class phenomlClient {
16
16
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
17
17
  "X-Fern-Language": "JavaScript",
18
18
  "X-Fern-SDK-Name": "phenoml",
19
- "X-Fern-SDK-Version": "0.0.8",
20
- "User-Agent": "phenoml/0.0.8",
19
+ "X-Fern-SDK-Version": "0.0.10",
20
+ "User-Agent": "phenoml/AUTO",
21
21
  "X-Fern-Runtime": core.RUNTIME.type,
22
22
  "X-Fern-Runtime-Version": core.RUNTIME.version,
23
23
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -147,6 +147,8 @@ export declare class Agent {
147
147
  *
148
148
  * @example
149
149
  * await client.agent.chat({
150
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
151
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
150
152
  * message: "What is the patient's current condition?",
151
153
  * agent_id: "agent-123"
152
154
  * })
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
11
22
  import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
12
23
  import * as core from "../../../../core/index.mjs";
13
24
  import * as environments from "../../../../environments.mjs";
@@ -487,6 +498,8 @@ export class Agent {
487
498
  *
488
499
  * @example
489
500
  * await client.agent.chat({
501
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
502
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
490
503
  * message: "What is the patient's current condition?",
491
504
  * agent_id: "agent-123"
492
505
  * })
@@ -497,7 +510,12 @@ export class Agent {
497
510
  __chat(request, requestOptions) {
498
511
  return __awaiter(this, void 0, void 0, function* () {
499
512
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
500
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
513
+ const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf, "X-Phenoml-Fhir-Provider": phenomlFhirProvider } = request, _body = __rest(request, ["X-Phenoml-On-Behalf-Of", "X-Phenoml-Fhir-Provider"]);
514
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
515
+ Authorization: yield this._getAuthorizationHeader(),
516
+ "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
517
+ "X-Phenoml-Fhir-Provider": phenomlFhirProvider != null ? phenomlFhirProvider : undefined,
518
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
501
519
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
502
520
  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, "agent/chat"),
503
521
  method: "POST",
@@ -505,7 +523,7 @@ export class Agent {
505
523
  contentType: "application/json",
506
524
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
507
525
  requestType: "json",
508
- body: request,
526
+ body: _body,
509
527
  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,
510
528
  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,
511
529
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -1,11 +1,23 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
5
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
4
6
  * message: "What is the patient's current condition?",
5
7
  * agent_id: "agent-123"
6
8
  * }
7
9
  */
8
10
  export interface AgentChatRequest {
11
+ /**
12
+ * Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
13
+ * Must be in the format: Patient/{uuid} or Practitioner/{uuid}
14
+ */
15
+ "X-Phenoml-On-Behalf-Of"?: string;
16
+ /**
17
+ * Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
18
+ * Multiple FHIR provider integrations can be provided as comma-separated values.
19
+ */
20
+ "X-Phenoml-Fhir-Provider"?: string;
9
21
  /** The message to send to the agent */
10
22
  message: string;
11
23
  /** Optional context for the conversation */