@nsshunt/stsfhirclient 2.0.4 → 2.0.5
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.
package/dist/stsfhirclient.mjs
CHANGED
|
@@ -9249,7 +9249,7 @@ var FhirRESTClient = class {
|
|
|
9249
9249
|
* @param resource
|
|
9250
9250
|
* @returns
|
|
9251
9251
|
*/
|
|
9252
|
-
#InvokeResourceAPI = async (url, httpVerb, versionIdETag, resource) => {
|
|
9252
|
+
#InvokeResourceAPI = async (url, httpVerb, versionIdETag, resource, contentType) => {
|
|
9253
9253
|
const accessToken = await this.#options.GetAccessToken();
|
|
9254
9254
|
let requestConfig;
|
|
9255
9255
|
const headers = {
|
|
@@ -9257,9 +9257,13 @@ var FhirRESTClient = class {
|
|
|
9257
9257
|
Accept: "application/fhir+json"
|
|
9258
9258
|
};
|
|
9259
9259
|
if (versionIdETag && versionIdETag !== "") headers["If-Match"] = versionIdETag;
|
|
9260
|
-
if (httpVerb === "patch")
|
|
9261
|
-
|
|
9262
|
-
|
|
9260
|
+
if (httpVerb === "patch") {
|
|
9261
|
+
requestConfig = new STSAxiosConfig(url, httpVerb).withApplicationMergePatchAndJsonContentTypeHeaders();
|
|
9262
|
+
if (resource && contentType) {
|
|
9263
|
+
if (contentType.localeCompare("application/merge-patch+json") === 0) requestConfig = new STSAxiosConfig(url, httpVerb).withApplicationMergePatchAndJsonContentTypeHeaders();
|
|
9264
|
+
else if (contentType.localeCompare("application/json-patch+json") === 0) requestConfig = new STSAxiosConfig(url, httpVerb).withApplicationJsonPatchAndJsonContentTypeHeaders();
|
|
9265
|
+
}
|
|
9266
|
+
} else requestConfig = new STSAxiosConfig(url, httpVerb).withApplicationFhirAndJsonContentTypeHeaders();
|
|
9263
9267
|
requestConfig.withAuthHeaders(accessToken, this.#options.user).withHeaders(headers);
|
|
9264
9268
|
if (resource) requestConfig.withData(resource);
|
|
9265
9269
|
if (this.#options.agentManager) requestConfig.withAgentManager(this.#options.agentManager);
|
|
@@ -9361,7 +9365,7 @@ var FhirRESTClient = class {
|
|
|
9361
9365
|
PatchResource = async (resourceType, resourceId, domainResource, contentType, versionIdETag) => {
|
|
9362
9366
|
try {
|
|
9363
9367
|
let url = `${`${this.BaseUrl()}/${resourceType}`}/${resourceId}`;
|
|
9364
|
-
const retVal = await this.#InvokeResourceAPI(url, "patch", versionIdETag, domainResource);
|
|
9368
|
+
const retVal = await this.#InvokeResourceAPI(url, "patch", versionIdETag, domainResource, contentType);
|
|
9365
9369
|
if (retVal) return {
|
|
9366
9370
|
status: retVal.status,
|
|
9367
9371
|
body: retVal.data
|