Comparing version 1.3.0 to 1.4.0
@@ -0,1 +1,8 @@ | ||
# [1.4.0](https://github.com/philips-software/javascript-hsdp-sdk/compare/v1.3.0...v1.4.0) (2023-09-18) | ||
### Features | ||
* implement x-validate-resource header for bundles ([a3c10da](https://github.com/philips-software/javascript-hsdp-sdk/commit/a3c10da1cc4fa4249cc8f161b231a0e1ffbf1ac2)) | ||
# [1.3.0](https://github.com/philips-software/javascript-hsdp-sdk/compare/v1.2.0...v1.3.0) (2023-09-18) | ||
@@ -2,0 +9,0 @@ |
@@ -1,4 +0,5 @@ | ||
import { AuthParams, ClientOptions } from './common'; | ||
import { AuthParams, ClientOptions, ParamOptions } from './common'; | ||
declare type BatchParams = AuthParams & { | ||
bundle: fhir4.Bundle; | ||
options: ParamOptions; | ||
}; | ||
@@ -5,0 +6,0 @@ export declare function createBatchClient(options: ClientOptions): { |
@@ -10,2 +10,3 @@ export declare type ClientOptions = { | ||
}>; | ||
export declare function getHeadersFromOptions(options: ParamOptions): Record<string, string>; | ||
//# sourceMappingURL=common.d.ts.map |
{ | ||
"name": "hsdp-sdk", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "author": "Gertjan Maas <gertjan.maas@philips.com>", |
import axios from 'axios'; | ||
import { AuthParams, ClientOptions } from './common'; | ||
import { AuthParams, ClientOptions, ParamOptions, getHeadersFromOptions } from './common'; | ||
type BatchParams = AuthParams & { | ||
bundle: fhir4.Bundle; | ||
options: ParamOptions; | ||
}; | ||
@@ -15,2 +16,3 @@ | ||
headers: { | ||
...getHeadersFromOptions(params.options), | ||
Authorization: `Bearer ${params.accessToken}`, | ||
@@ -17,0 +19,0 @@ 'API-Version': 1, |
@@ -12,1 +12,9 @@ export type ClientOptions = { | ||
}>; | ||
export function getHeadersFromOptions(options: ParamOptions) { | ||
const headers: Record<string, string> = {}; | ||
if (options?.validateResource !== undefined) { | ||
headers['X-validate-resource'] = options.validateResource ? 'true' : 'false'; | ||
} | ||
return headers; | ||
} |
import axios from 'axios'; | ||
import { AuthParams, ClientOptions, ParamOptions } from './common'; | ||
import { AuthParams, ClientOptions, ParamOptions, getHeadersFromOptions } from './common'; | ||
import { R4ResourceType, ResourceByType, R4Bundle } from './resource-types'; | ||
@@ -31,10 +31,2 @@ import fhir4, { Reference } from 'fhir/r4'; | ||
function getHeadersFromOptions(options: ParamOptions) { | ||
const headers: Record<string, string> = {}; | ||
if (options?.validateResource !== undefined) { | ||
headers['X-validate-resource'] = options.validateResource ? 'true' : 'false'; | ||
} | ||
return headers; | ||
} | ||
export function createResourceClient<ResourceType extends R4ResourceType>( | ||
@@ -41,0 +33,0 @@ resource: ResourceType, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
447258
6811