@equinor/fusion-framework-module-services
Advanced tools
Comparing version 5.0.0 to 5.0.1
@@ -20,5 +20,4 @@ import { z } from 'zod'; | ||
const baseInit = { | ||
method: 'POST', | ||
method: 'HEAD', | ||
selector: headSelector, | ||
body: args, | ||
}; | ||
@@ -25,0 +24,0 @@ return Object.assign({}, baseInit, init); |
@@ -10,3 +10,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
import { HttpJsonResponseError } from '@equinor/fusion-framework-module-http'; | ||
import { HttpJsonResponseError, HttpResponseError } from '@equinor/fusion-framework-module-http'; | ||
/** | ||
@@ -46,15 +46,11 @@ * A response selector that checks the status of an HTTP response and throws an error if the response is not successful. | ||
*/ | ||
export const headSelector = (res) => { | ||
try { | ||
return statusSelector(res); | ||
export const headSelector = (res) => __awaiter(void 0, void 0, void 0, function* () { | ||
if (res.ok) { | ||
return true; | ||
} | ||
catch (error) { | ||
if (error instanceof HttpJsonResponseError) { | ||
if (error.response.status === 404) { | ||
return Promise.resolve(false); | ||
} | ||
} | ||
throw error; | ||
if (res.status === 404) { | ||
return false; | ||
} | ||
}; | ||
throw new HttpResponseError(`Failed to execute request. Status code: ${res.status}`, res); | ||
}); | ||
//# sourceMappingURL=selectors.js.map |
@@ -53,3 +53,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
const httpClient = yield this._createClientFn('bookmarks'); | ||
httpClient.responseHandler.add('validate_api_request', validateResponse); | ||
// TODO: update when new ResponseOperator is available | ||
// will fail because 'HEAD' will return 404 when no bookmarks are found | ||
// httpClient.responseHandler.add('validate_api_request', validateResponse); | ||
return new BookmarksApiClient(httpClient, method); | ||
@@ -56,0 +58,0 @@ }); |
// Generated by genversion. | ||
export const version = '5.0.0'; | ||
export const version = '5.0.1'; | ||
//# sourceMappingURL=version.js.map |
@@ -1,1 +0,1 @@ | ||
export declare const version = "5.0.0"; | ||
export declare const version = "5.0.1"; |
{ | ||
"name": "@equinor/fusion-framework-module-services", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "", | ||
@@ -120,5 +120,5 @@ "sideEffects": false, | ||
"typescript": "^5.5.4", | ||
"@equinor/fusion-framework-module-http": "^6.2.0", | ||
"@equinor/fusion-framework-module": "^4.3.5", | ||
"@equinor/fusion-framework-module-http": "^6.2.0", | ||
"@equinor/fusion-framework-module-service-discovery": "^8.0.2" | ||
"@equinor/fusion-framework-module-service-discovery": "^8.0.3" | ||
}, | ||
@@ -125,0 +125,0 @@ "peerDependencies": { |
@@ -60,5 +60,4 @@ import { z } from 'zod'; | ||
const baseInit: FetchRequestInit<ApiResponse<ApiVersion.v1>, JsonRequest> = { | ||
method: 'POST', | ||
method: 'HEAD', | ||
selector: headSelector, | ||
body: args, | ||
}; | ||
@@ -65,0 +64,0 @@ return Object.assign({}, baseInit, init); |
@@ -1,2 +0,2 @@ | ||
import { HttpJsonResponseError } from '@equinor/fusion-framework-module-http'; | ||
import { HttpJsonResponseError, HttpResponseError } from '@equinor/fusion-framework-module-http'; | ||
import { type ResponseSelector } from '@equinor/fusion-framework-module-http/selectors'; | ||
@@ -38,13 +38,10 @@ | ||
*/ | ||
export const headSelector: ResponseSelector<boolean> = (res) => { | ||
try { | ||
return statusSelector(res); | ||
} catch (error) { | ||
if (error instanceof HttpJsonResponseError) { | ||
if (error.response.status === 404) { | ||
return Promise.resolve(false); | ||
} | ||
} | ||
throw error; | ||
export const headSelector: ResponseSelector<boolean> = async (res) => { | ||
if (res.ok) { | ||
return true; | ||
} | ||
if (res.status === 404) { | ||
return false; | ||
} | ||
throw new HttpResponseError(`Failed to execute request. Status code: ${res.status}`, res); | ||
}; |
@@ -99,3 +99,5 @@ import { IHttpClient } from '@equinor/fusion-framework-module-http'; | ||
const httpClient = await this._createClientFn('bookmarks'); | ||
httpClient.responseHandler.add('validate_api_request', validateResponse); | ||
// TODO: update when new ResponseOperator is available | ||
// will fail because 'HEAD' will return 404 when no bookmarks are found | ||
// httpClient.responseHandler.add('validate_api_request', validateResponse); | ||
return new BookmarksApiClient(httpClient, method); | ||
@@ -102,0 +104,0 @@ } |
// Generated by genversion. | ||
export const version = '5.0.0'; | ||
export const version = '5.0.1'; |
Sorry, the diff of this file is too big to display
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 not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
689915
8939