@sassoftware/restaf 5.5.1-1 → 5.5.1-3

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/restaf.js CHANGED
@@ -1740,7 +1740,7 @@ eval("{/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* har
1740
1740
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1741
1741
 
1742
1742
  "use strict";
1743
- eval("{/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ keepAlive: () => (/* binding */ keepAlive),\n/* harmony export */ request: () => (/* binding */ request),\n/* harmony export */ trustedGrant: () => (/* binding */ trustedGrant)\n/* harmony export */ });\n/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ \"../../../node_modules/@babel/runtime/helpers/esm/typeof.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js\");\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! axios */ \"../../../node_modules/axios/lib/axios.js\");\n/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! qs */ \"../../../node_modules/qs/lib/index.js\");\n/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(qs__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _fixResponse__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./fixResponse */ \"./serverCalls/fixResponse.js\");\n\n\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\n/* eslint-disable no-prototype-builtins */\n/*------------------------------------------------------------------------------------\r\n Copyright © 2023, SAS Institute Inc., Cary, NC, USA. All Rights reserved Licensed under the Apache License, Version 2.0 (the \"License\");\r\n you may not use this file except in compliance with the License.\r\n You may obtain a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n Unless required by applicable law or agreed to in writing, software\r\n distributed under the License is distributed on an \"AS IS\" BASIS,\r\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n See the License for the specific language governing permissions and\r\n limitations under the License.\r\n ---------------------------------------------------------------------------------------*/\n\n\n\n\nvar Https = null;\nif (false) // removed by dead control flow\n{}\n\n// axios.defaults.withCredentials = true\naxios__WEBPACK_IMPORTED_MODULE_2__[\"default\"].interceptors.response.use(function (response) {\n return response;\n}, function (error) {\n return Promise.reject(error);\n});\n\n/* X-Uaa-Csrf */\nfunction trustedGrant(iconfig) {\n var link = iconfig.link;\n var auth1 = Buffer.from(iconfig.clientID + \":\" + iconfig.clientSecret).toString(\"base64\");\n debugger;\n auth1 = \"Basic \" + auth1;\n var baseUrl = patchURL4ns(iconfig, link.href);\n var config = {\n method: link.method,\n baseURL: baseUrl,\n url: link.href,\n /*iconfig.host + link.href,*/\n\n headers: {\n Accept: link.responseType,\n \"Content-Type\": link.type /* Axios seems to be case sensitive */,\n Authorization: auth1\n },\n withCredentials: false,\n data: {\n grant_type: \"password\",\n username: iconfig.user,\n password: iconfig.password\n },\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n transformResponse: function transformResponse(data) {\n return data;\n },\n transformRequest: function transformRequest(data) {\n return qs__WEBPACK_IMPORTED_MODULE_3___default().stringify(data);\n }\n };\n var storeConfig = {\n protocol: 'https://',\n sslOption: {}\n };\n //TBD: Need to update the whole flow to be consistent with the storeConfig\n return makeCall(config, iconfig, config);\n}\nfunction request(iconfig) {\n \"use strict\";\n\n var link = iconfig.link,\n logonInfo = iconfig.logonInfo;\n var iLink = _objectSpread({}, link);\n var payload = iconfig.hasOwnProperty(\"payload\") ? iconfig.payload : null;\n var iqs = null;\n var idata = null;\n var iheaders = null;\n var ixsrf = null;\n var casAction = null;\n debugger;\n if (payload !== null) {\n casAction = hasItem(payload, \"action\");\n iqs = hasItem(payload, \"qs\");\n idata = hasItem(payload, \"data\");\n iheaders = hasItem(payload, \"headers\");\n ixsrf = hasItem(payload, \"xsrf\");\n }\n var baseUrl = patchURL4ns(logonInfo, iLink.href);\n // let url = `${l}${iLink.href}`;\n\n // handle casaction upload\n casAction = casAction != null ? casAction.toLowerCase() : null;\n var url = casAction !== null ? \"\".concat(iLink.href, \"/\").concat(casAction) : \"\".concat(iLink.href);\n if (iLink.hasOwnProperty(\"customHandling\") && casAction !== null) {\n // casAction = casAction.toLowerCase();\n if (casAction === \"table.upload\") {\n iLink.method = \"PUT\";\n iLink.type = \"application/octet-stream\";\n iLink.responseType = \"application/json\";\n }\n }\n var config = {\n method: iLink.method,\n baseURL: baseUrl,\n url: url,\n transformResponse: function transformResponse(data) {\n return data;\n },\n validateStatus: function validateStatus(status) {\n /* 304 for state calls */\n debugger;\n return status === 302 || status === 304 || status >= 200 && status < 300;\n }\n };\n config.headers = {};\n if (logonInfo.token !== null) {\n config.headers['Authorization'] = logonInfo.tokenType + \" \" + logonInfo.token;\n } else {\n config.withCredentials = iconfig.withCredentials == null ? true : iconfig.withCredentials;\n }\n var type = fullType(iLink.type);\n if (iLink.hasOwnProperty(\"responseType\")) {\n if (type !== null) {\n config.headers[\"Content-Type\"] = type;\n }\n config.headers.Accept = fullType(iLink.responseType);\n } else if (type !== null) {\n config.headers.Accept = type;\n if (iLink.method === \"PUT\" || iLink.method === \"POST\" || iLink.method === \"PATCH\") {\n config.headers[\"Content-Type\"] = type;\n }\n }\n if (iheaders !== null) {\n for (var ih in iheaders) {\n //noinspection JSUnfilteredForInLoop\n if (ih.toLowerCase() === \"json-parameters\") {\n //noinspection JSUnfilteredForInLoop\n config.headers[ih] = (0,_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(iheaders[ih]) === \"object\" ? JSON.stringify(iheaders[ih]) : iheaders[ih];\n } else {\n //noinspection JSUnfilteredForInLoop\n config.headers[ih] = iheaders[ih];\n }\n }\n }\n if (ixsrf !== null) {\n /* TBD: fix parallel calls to get of this conditional */\n var xsrfHeaderName = ixsrf[\"x-csrf-header\"];\n if (xsrfHeaderName != null) {\n config.xsrfCookieName = null;\n config.xsrfHeaderName = xsrfHeaderName;\n // https://github.com/axios/axios/issues/2024\n config.headers[xsrfHeaderName] = ixsrf[xsrfHeaderName];\n }\n if (ixsrf[\"tkhttp-id\"] != null) {\n config.headers[\"tkhttp-id\"] = ixsrf[\"tkhttp-id\"];\n }\n } else {\n if (config.type === 'ADD_SERVICE') {\n config.xsrfHeaderName = 'X_CSRF_TOKEN';\n config.headers['X-CSRF-TOKEN'] = \"Fetch\";\n }\n }\n if (iqs !== null) {\n config.params = _objectSpread({}, iqs);\n }\n config.data = idata === null ? {} : idata;\n config.maxContentLength = 2 * 10063256;\n // let httpOptions = (iconfig.storeConfig.config != null ? iconfig.storeConfig.config.httpOptions : null);\n\n /*\r\n let httpOptions = iconfig.storeConfig.httpOptions;\r\n if (httpOptions != null) {\r\n for (let k in httpOptions) {\r\n config[k] = httpOptions[k];\r\n }\r\n }\r\n */\n\n setupProxy(iconfig, config);\n return makeCall(config, iconfig, logonInfo);\n}\n// setup if using reverse proxy server\nfunction setupProxy(iconfig, config) {\n var options = iconfig.logonInfo.options;\n if (options != null && options.proxyServer != null) {\n var proxy = options.proxy;\n if (proxy.pathname != null && proxy.pathname.trim().length > 0) {\n config.url = \"\".concat(proxy.pathname).concat(config.url); //prepend url with proxy path\n }\n config.baseURL = \"\".concat(proxy.protocol, \"//\").concat(proxy.host); //override base url\n }\n}\n// patch the url for namespace - useful for k8s to make calls into another namespace\nfunction patchURL4ns(logInfo, link) {\n var host = logInfo.host;\n if (logInfo.options != null && logInfo.options.ns != null) {\n var service = link.split(\"/\")[1];\n host = \"\".concat(logInfo.protocol).concat(service, \".{logInfo.options.ns}.svc.cluster.local\");\n }\n return host;\n}\nfunction makeCall(config, iconfig, storeConfig) {\n if (storeConfig.protocol === \"https://\" && config.agent == null) {\n var opts = iconfig.storeConfig.httpsOptions != null ? iconfig.storeConfig.httpsOptions : {};\n if (Https !== null) {\n var agent = new Https.Agent(opts);\n config.httpsAgent = agent;\n }\n }\n return new Promise(function (resolve, reject) {\n (0,axios__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(config).then(function (response) {\n parseJSON(response.data).then(function (data) {\n iconfig.data = null; /* get rid of the payload*/\n response.data = {\n results: data,\n iconfig: Object.assign({}, iconfig)\n };\n if (data.hasOwnProperty(\"errorCode\")) {\n //noinspection JSUnresolvedVariable\n response.status = response.data.results.httpStatusCode;\n response.statusText = \"errorCode: \".concat(response.data.results.errorCode);\n reject({\n response: response\n });\n } else {\n resolve((0,_fixResponse__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(response));\n }\n }).catch(function () {\n iconfig.data = null;\n response.data = {\n results: response.data,\n iconfig: Object.assign({}, iconfig)\n };\n resolve((0,_fixResponse__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(response));\n });\n }).catch(function (error) {\n reject(error);\n });\n });\n}\nfunction parseJSON(data) {\n //noinspection JSUnusedLocalSymbols\n return new Promise(function (resolve, reject) {\n if ((0,_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(data) === \"object\") {\n resolve(data);\n } else {\n var temp = data.replace(/\\r?\\n|\\r/g, \" \");\n try {\n var odata = JSON.parse(temp);\n resolve(odata);\n } catch (err) {\n resolve(data);\n }\n }\n });\n}\nfunction hasItem(payload, name) {\n for (var _i = 0, _Object$keys = Object.keys(payload); _i < _Object$keys.length; _i++) {\n var k = _Object$keys[_i];\n if (k.toUpperCase() === name.toUpperCase()) {\n return payload[k];\n }\n }\n return null;\n}\nfunction fullType(type) {\n var ntype = type;\n if (ntype === undefined || ntype === null) {\n ntype = null;\n } else {\n if (ntype.indexOf(\"application/vnd\") !== -1) {\n if (ntype.indexOf(\"+json\") === -1) {\n ntype = ntype + \"+json\";\n }\n }\n }\n return ntype;\n}\n\n// Code below is for experimenting.\n\nfunction keepAlive(action) {\n return (0,axios__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(action.payload);\n}\n\n\n//# sourceURL=webpack://restaf/./serverCalls/index.js?\n}");
1743
+ eval("{/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ keepAlive: () => (/* binding */ keepAlive),\n/* harmony export */ request: () => (/* binding */ request),\n/* harmony export */ trustedGrant: () => (/* binding */ trustedGrant)\n/* harmony export */ });\n/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ \"../../../node_modules/@babel/runtime/helpers/esm/typeof.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js\");\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! axios */ \"../../../node_modules/axios/lib/axios.js\");\n/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! qs */ \"../../../node_modules/qs/lib/index.js\");\n/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(qs__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _fixResponse__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./fixResponse */ \"./serverCalls/fixResponse.js\");\n\n\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\n/* eslint-disable no-prototype-builtins */\n/*------------------------------------------------------------------------------------\r\n Copyright © 2023, SAS Institute Inc., Cary, NC, USA. All Rights reserved Licensed under the Apache License, Version 2.0 (the \"License\");\r\n you may not use this file except in compliance with the License.\r\n You may obtain a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n Unless required by applicable law or agreed to in writing, software\r\n distributed under the License is distributed on an \"AS IS\" BASIS,\r\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n See the License for the specific language governing permissions and\r\n limitations under the License.\r\n ---------------------------------------------------------------------------------------*/\n\n\n\n\nvar Https = null;\nif (false) // removed by dead control flow\n{}\n\n// axios.defaults.withCredentials = true\naxios__WEBPACK_IMPORTED_MODULE_2__[\"default\"].interceptors.response.use(function (response) {\n return response;\n}, function (error) {\n return Promise.reject(error);\n});\n\n/* X-Uaa-Csrf */\nfunction trustedGrant(iconfig) {\n var link = iconfig.link;\n var auth1 = Buffer.from(iconfig.clientID + \":\" + iconfig.clientSecret).toString(\"base64\");\n auth1 = \"Basic \" + auth1;\n var baseUrl = patchURL4ns(iconfig, link.href);\n var config = {\n method: link.method,\n baseURL: baseUrl,\n url: link.href,\n /*iconfig.host + link.href,*/\n\n headers: {\n Accept: link.responseType,\n \"Content-Type\": link.type /* Axios seems to be case sensitive */,\n Authorization: auth1\n },\n withCredentials: false,\n data: {\n grant_type: \"password\",\n username: iconfig.user,\n password: iconfig.password\n },\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n transformResponse: function transformResponse(data) {\n return data;\n },\n transformRequest: function transformRequest(data) {\n return qs__WEBPACK_IMPORTED_MODULE_3___default().stringify(data);\n }\n };\n var storeConfig = {\n protocol: 'https://',\n sslOption: {}\n };\n //TBD: Need to update the whole flow to be consistent with the storeConfig\n return makeCall(config, iconfig, config);\n}\nfunction request(iconfig) {\n \"use strict\";\n\n var link = iconfig.link,\n logonInfo = iconfig.logonInfo;\n var iLink = _objectSpread({}, link);\n var payload = iconfig.hasOwnProperty(\"payload\") ? iconfig.payload : null;\n var iqs = null;\n var idata = null;\n var iheaders = null;\n var ixsrf = null;\n var casAction = null;\n if (payload !== null) {\n casAction = hasItem(payload, \"action\");\n iqs = hasItem(payload, \"qs\");\n idata = hasItem(payload, \"data\");\n iheaders = hasItem(payload, \"headers\");\n ixsrf = hasItem(payload, \"xsrf\");\n }\n var baseUrl = patchURL4ns(logonInfo, iLink.href);\n // let url = `${l}${iLink.href}`;\n\n // handle casaction upload\n casAction = casAction != null ? casAction.toLowerCase() : null;\n var url = casAction !== null ? \"\".concat(iLink.href, \"/\").concat(casAction) : \"\".concat(iLink.href);\n if (iLink.hasOwnProperty(\"customHandling\") && casAction !== null) {\n // casAction = casAction.toLowerCase();\n if (casAction === \"table.upload\") {\n iLink.method = \"PUT\";\n iLink.type = \"application/octet-stream\";\n iLink.responseType = \"application/json\";\n }\n }\n var config = {\n method: iLink.method,\n baseURL: baseUrl,\n url: url,\n transformResponse: function transformResponse(data) {\n return data;\n },\n validateStatus: function validateStatus(status) {\n /* 304 for state calls */\n\n return status === 302 || status === 304 || status >= 200 && status < 300;\n }\n };\n config.headers = {};\n if (logonInfo.token !== null) {\n config.headers['Authorization'] = logonInfo.tokenType + \" \" + logonInfo.token;\n } else {\n config.withCredentials = iconfig.withCredentials == null ? true : iconfig.withCredentials;\n }\n var type = fullType(iLink.type);\n if (iLink.hasOwnProperty(\"responseType\")) {\n if (type !== null) {\n config.headers[\"Content-Type\"] = type;\n }\n config.headers.Accept = fullType(iLink.responseType);\n } else if (type !== null) {\n config.headers.Accept = type;\n if (iLink.method === \"PUT\" || iLink.method === \"POST\" || iLink.method === \"PATCH\") {\n config.headers[\"Content-Type\"] = type;\n }\n }\n if (iheaders !== null) {\n for (var ih in iheaders) {\n //noinspection JSUnfilteredForInLoop\n if (ih.toLowerCase() === \"json-parameters\") {\n //noinspection JSUnfilteredForInLoop\n config.headers[ih] = (0,_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(iheaders[ih]) === \"object\" ? JSON.stringify(iheaders[ih]) : iheaders[ih];\n } else {\n //noinspection JSUnfilteredForInLoop\n config.headers[ih] = iheaders[ih];\n }\n }\n }\n if (ixsrf !== null) {\n /* TBD: fix parallel calls to get of this conditional */\n var xsrfHeaderName = ixsrf[\"x-csrf-header\"];\n if (xsrfHeaderName != null) {\n config.xsrfCookieName = null;\n config.xsrfHeaderName = xsrfHeaderName;\n // https://github.com/axios/axios/issues/2024\n config.headers[xsrfHeaderName] = ixsrf[xsrfHeaderName];\n }\n if (ixsrf[\"tkhttp-id\"] != null) {\n config.headers[\"tkhttp-id\"] = ixsrf[\"tkhttp-id\"];\n }\n } else {\n if (config.type === 'ADD_SERVICE') {\n config.xsrfHeaderName = 'X_CSRF_TOKEN';\n config.headers['X-CSRF-TOKEN'] = \"Fetch\";\n }\n }\n if (iqs !== null) {\n config.params = _objectSpread({}, iqs);\n }\n config.data = idata === null ? {} : idata;\n config.maxContentLength = 2 * 10063256;\n // let httpOptions = (iconfig.storeConfig.config != null ? iconfig.storeConfig.config.httpOptions : null);\n\n /*\r\n let httpOptions = iconfig.storeConfig.httpOptions;\r\n if (httpOptions != null) {\r\n for (let k in httpOptions) {\r\n config[k] = httpOptions[k];\r\n }\r\n }\r\n */\n\n setupProxy(iconfig, config);\n return makeCall(config, iconfig, logonInfo);\n}\n// setup if using reverse proxy server\nfunction setupProxy(iconfig, config) {\n var options = iconfig.logonInfo.options;\n if (options != null && options.proxyServer != null) {\n var proxy = options.proxy;\n if (proxy.pathname != null && proxy.pathname.trim().length > 0) {\n config.url = \"\".concat(proxy.pathname).concat(config.url); //prepend url with proxy path\n }\n config.baseURL = \"\".concat(proxy.protocol, \"//\").concat(proxy.host); //override base url\n }\n}\n// patch the url for namespace - useful for k8s to make calls into another namespace\nfunction patchURL4ns(logInfo, link) {\n var host = logInfo.host;\n if (logInfo.options != null && logInfo.options.ns != null) {\n var service = link.split(\"/\")[1];\n host = \"\".concat(logInfo.protocol).concat(service, \".{logInfo.options.ns}.svc.cluster.local\");\n }\n return host;\n}\nfunction makeCall(config, iconfig, storeConfig) {\n if (storeConfig.protocol === \"https://\" && config.agent == null) {\n var opts = iconfig.storeConfig.httpsOptions != null ? iconfig.storeConfig.httpsOptions : {};\n if (Https !== null) {\n var agent = new Https.Agent(opts);\n config.httpsAgent = agent;\n }\n }\n return new Promise(function (resolve, reject) {\n (0,axios__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(config).then(function (response) {\n parseJSON(response.data).then(function (data) {\n iconfig.data = null; /* get rid of the payload*/\n response.data = {\n results: data,\n iconfig: Object.assign({}, iconfig)\n };\n if (data.hasOwnProperty(\"errorCode\")) {\n //noinspection JSUnresolvedVariable\n response.status = response.data.results.httpStatusCode;\n response.statusText = \"errorCode: \".concat(response.data.results.errorCode);\n reject({\n response: response\n });\n } else {\n resolve((0,_fixResponse__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(response));\n }\n }).catch(function () {\n iconfig.data = null;\n response.data = {\n results: response.data,\n iconfig: Object.assign({}, iconfig)\n };\n resolve((0,_fixResponse__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(response));\n });\n }).catch(function (error) {\n reject(error);\n });\n });\n}\nfunction parseJSON(data) {\n //noinspection JSUnusedLocalSymbols\n return new Promise(function (resolve, reject) {\n if ((0,_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(data) === \"object\") {\n resolve(data);\n } else {\n var temp = data.replace(/\\r?\\n|\\r/g, \" \");\n try {\n var odata = JSON.parse(temp);\n resolve(odata);\n } catch (err) {\n resolve(data);\n }\n }\n });\n}\nfunction hasItem(payload, name) {\n for (var _i = 0, _Object$keys = Object.keys(payload); _i < _Object$keys.length; _i++) {\n var k = _Object$keys[_i];\n if (k.toUpperCase() === name.toUpperCase()) {\n return payload[k];\n }\n }\n return null;\n}\nfunction fullType(type) {\n var ntype = type;\n if (ntype === undefined || ntype === null) {\n ntype = null;\n } else {\n if (ntype.indexOf(\"application/vnd\") !== -1) {\n if (ntype.indexOf(\"+json\") === -1) {\n ntype = ntype + \"+json\";\n }\n }\n }\n return ntype;\n}\n\n// Code below is for experimenting.\n\nfunction keepAlive(action) {\n return (0,axios__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(action.payload);\n}\n\n\n//# sourceURL=webpack://restaf/./serverCalls/index.js?\n}");
1744
1744
 
1745
1745
  /***/ }),
1746
1746
 
package/lib/restaf.js CHANGED
@@ -2127,7 +2127,7 @@ eval("{/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* har
2127
2127
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2128
2128
 
2129
2129
  "use strict";
2130
- eval("{/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ keepAlive: () => (/* binding */ keepAlive),\n/* harmony export */ request: () => (/* binding */ request),\n/* harmony export */ trustedGrant: () => (/* binding */ trustedGrant)\n/* harmony export */ });\n/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ \"../../../node_modules/@babel/runtime/helpers/typeof.js\");\n/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"../../../node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! axios */ \"../../../node_modules/axios/lib/axios.js\");\n/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! qs */ \"../../../node_modules/qs/lib/index.js\");\n/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(qs__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _fixResponse__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./fixResponse */ \"./serverCalls/fixResponse.js\");\n\n\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1___default()(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\n/* eslint-disable no-prototype-builtins */\n/*------------------------------------------------------------------------------------\r\n Copyright © 2023, SAS Institute Inc., Cary, NC, USA. All Rights reserved Licensed under the Apache License, Version 2.0 (the \"License\");\r\n you may not use this file except in compliance with the License.\r\n You may obtain a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n Unless required by applicable law or agreed to in writing, software\r\n distributed under the License is distributed on an \"AS IS\" BASIS,\r\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n See the License for the specific language governing permissions and\r\n limitations under the License.\r\n ---------------------------------------------------------------------------------------*/\n\n\n\n\nvar Https = null;\nif (true) {\n Https = __webpack_require__(/*! node:https */ \"node:https\");\n}\n\n// axios.defaults.withCredentials = true\naxios__WEBPACK_IMPORTED_MODULE_2__[\"default\"].interceptors.response.use(function (response) {\n return response;\n}, function (error) {\n return Promise.reject(error);\n});\n\n/* X-Uaa-Csrf */\nfunction trustedGrant(iconfig) {\n var link = iconfig.link;\n var auth1 = Buffer.from(iconfig.clientID + \":\" + iconfig.clientSecret).toString(\"base64\");\n debugger;\n auth1 = \"Basic \" + auth1;\n var baseUrl = patchURL4ns(iconfig, link.href);\n var config = {\n method: link.method,\n baseURL: baseUrl,\n url: link.href,\n /*iconfig.host + link.href,*/\n\n headers: {\n Accept: link.responseType,\n \"Content-Type\": link.type /* Axios seems to be case sensitive */,\n Authorization: auth1\n },\n withCredentials: false,\n data: {\n grant_type: \"password\",\n username: iconfig.user,\n password: iconfig.password\n },\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n transformResponse: function transformResponse(data) {\n return data;\n },\n transformRequest: function transformRequest(data) {\n return qs__WEBPACK_IMPORTED_MODULE_3___default().stringify(data);\n }\n };\n var storeConfig = {\n protocol: 'https://',\n sslOption: {}\n };\n //TBD: Need to update the whole flow to be consistent with the storeConfig\n return makeCall(config, iconfig, config);\n}\nfunction request(iconfig) {\n \"use strict\";\n\n var link = iconfig.link,\n logonInfo = iconfig.logonInfo;\n var iLink = _objectSpread({}, link);\n var payload = iconfig.hasOwnProperty(\"payload\") ? iconfig.payload : null;\n var iqs = null;\n var idata = null;\n var iheaders = null;\n var ixsrf = null;\n var casAction = null;\n debugger;\n if (payload !== null) {\n casAction = hasItem(payload, \"action\");\n iqs = hasItem(payload, \"qs\");\n idata = hasItem(payload, \"data\");\n iheaders = hasItem(payload, \"headers\");\n ixsrf = hasItem(payload, \"xsrf\");\n }\n var baseUrl = patchURL4ns(logonInfo, iLink.href);\n // let url = `${l}${iLink.href}`;\n\n // handle casaction upload\n casAction = casAction != null ? casAction.toLowerCase() : null;\n var url = casAction !== null ? \"\".concat(iLink.href, \"/\").concat(casAction) : \"\".concat(iLink.href);\n if (iLink.hasOwnProperty(\"customHandling\") && casAction !== null) {\n // casAction = casAction.toLowerCase();\n if (casAction === \"table.upload\") {\n iLink.method = \"PUT\";\n iLink.type = \"application/octet-stream\";\n iLink.responseType = \"application/json\";\n }\n }\n var config = {\n method: iLink.method,\n baseURL: baseUrl,\n url: url,\n transformResponse: function transformResponse(data) {\n return data;\n },\n validateStatus: function validateStatus(status) {\n /* 304 for state calls */\n debugger;\n return status === 302 || status === 304 || status >= 200 && status < 300;\n }\n };\n config.headers = {};\n if (logonInfo.token !== null) {\n config.headers['Authorization'] = logonInfo.tokenType + \" \" + logonInfo.token;\n } else {\n config.withCredentials = iconfig.withCredentials == null ? true : iconfig.withCredentials;\n }\n var type = fullType(iLink.type);\n if (iLink.hasOwnProperty(\"responseType\")) {\n if (type !== null) {\n config.headers[\"Content-Type\"] = type;\n }\n config.headers.Accept = fullType(iLink.responseType);\n } else if (type !== null) {\n config.headers.Accept = type;\n if (iLink.method === \"PUT\" || iLink.method === \"POST\" || iLink.method === \"PATCH\") {\n config.headers[\"Content-Type\"] = type;\n }\n }\n if (iheaders !== null) {\n for (var ih in iheaders) {\n //noinspection JSUnfilteredForInLoop\n if (ih.toLowerCase() === \"json-parameters\") {\n //noinspection JSUnfilteredForInLoop\n config.headers[ih] = _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(iheaders[ih]) === \"object\" ? JSON.stringify(iheaders[ih]) : iheaders[ih];\n } else {\n //noinspection JSUnfilteredForInLoop\n config.headers[ih] = iheaders[ih];\n }\n }\n }\n if (ixsrf !== null) {\n /* TBD: fix parallel calls to get of this conditional */\n var xsrfHeaderName = ixsrf[\"x-csrf-header\"];\n if (xsrfHeaderName != null) {\n config.xsrfCookieName = null;\n config.xsrfHeaderName = xsrfHeaderName;\n // https://github.com/axios/axios/issues/2024\n config.headers[xsrfHeaderName] = ixsrf[xsrfHeaderName];\n }\n if (ixsrf[\"tkhttp-id\"] != null) {\n config.headers[\"tkhttp-id\"] = ixsrf[\"tkhttp-id\"];\n }\n } else {\n if (config.type === 'ADD_SERVICE') {\n config.xsrfHeaderName = 'X_CSRF_TOKEN';\n config.headers['X-CSRF-TOKEN'] = \"Fetch\";\n }\n }\n if (iqs !== null) {\n config.params = _objectSpread({}, iqs);\n }\n config.data = idata === null ? {} : idata;\n config.maxContentLength = 2 * 10063256;\n // let httpOptions = (iconfig.storeConfig.config != null ? iconfig.storeConfig.config.httpOptions : null);\n\n /*\r\n let httpOptions = iconfig.storeConfig.httpOptions;\r\n if (httpOptions != null) {\r\n for (let k in httpOptions) {\r\n config[k] = httpOptions[k];\r\n }\r\n }\r\n */\n\n setupProxy(iconfig, config);\n return makeCall(config, iconfig, logonInfo);\n}\n// setup if using reverse proxy server\nfunction setupProxy(iconfig, config) {\n var options = iconfig.logonInfo.options;\n if (options != null && options.proxyServer != null) {\n var proxy = options.proxy;\n if (proxy.pathname != null && proxy.pathname.trim().length > 0) {\n config.url = \"\".concat(proxy.pathname).concat(config.url); //prepend url with proxy path\n }\n config.baseURL = \"\".concat(proxy.protocol, \"//\").concat(proxy.host); //override base url\n }\n}\n// patch the url for namespace - useful for k8s to make calls into another namespace\nfunction patchURL4ns(logInfo, link) {\n var host = logInfo.host;\n if (logInfo.options != null && logInfo.options.ns != null) {\n var service = link.split(\"/\")[1];\n host = \"\".concat(logInfo.protocol).concat(service, \".{logInfo.options.ns}.svc.cluster.local\");\n }\n return host;\n}\nfunction makeCall(config, iconfig, storeConfig) {\n if (storeConfig.protocol === \"https://\" && config.agent == null) {\n var opts = iconfig.storeConfig.httpsOptions != null ? iconfig.storeConfig.httpsOptions : {};\n if (Https !== null) {\n var agent = new Https.Agent(opts);\n config.httpsAgent = agent;\n }\n }\n return new Promise(function (resolve, reject) {\n (0,axios__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(config).then(function (response) {\n parseJSON(response.data).then(function (data) {\n iconfig.data = null; /* get rid of the payload*/\n response.data = {\n results: data,\n iconfig: Object.assign({}, iconfig)\n };\n if (data.hasOwnProperty(\"errorCode\")) {\n //noinspection JSUnresolvedVariable\n response.status = response.data.results.httpStatusCode;\n response.statusText = \"errorCode: \".concat(response.data.results.errorCode);\n reject({\n response: response\n });\n } else {\n resolve((0,_fixResponse__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(response));\n }\n }).catch(function () {\n iconfig.data = null;\n response.data = {\n results: response.data,\n iconfig: Object.assign({}, iconfig)\n };\n resolve((0,_fixResponse__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(response));\n });\n }).catch(function (error) {\n reject(error);\n });\n });\n}\nfunction parseJSON(data) {\n //noinspection JSUnusedLocalSymbols\n return new Promise(function (resolve, reject) {\n if (_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(data) === \"object\") {\n resolve(data);\n } else {\n var temp = data.replace(/\\r?\\n|\\r/g, \" \");\n try {\n var odata = JSON.parse(temp);\n resolve(odata);\n } catch (err) {\n resolve(data);\n }\n }\n });\n}\nfunction hasItem(payload, name) {\n for (var _i = 0, _Object$keys = Object.keys(payload); _i < _Object$keys.length; _i++) {\n var k = _Object$keys[_i];\n if (k.toUpperCase() === name.toUpperCase()) {\n return payload[k];\n }\n }\n return null;\n}\nfunction fullType(type) {\n var ntype = type;\n if (ntype === undefined || ntype === null) {\n ntype = null;\n } else {\n if (ntype.indexOf(\"application/vnd\") !== -1) {\n if (ntype.indexOf(\"+json\") === -1) {\n ntype = ntype + \"+json\";\n }\n }\n }\n return ntype;\n}\n\n// Code below is for experimenting.\n\nfunction keepAlive(action) {\n return (0,axios__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(action.payload);\n}\n\n\n//# sourceURL=webpack://restaf/./serverCalls/index.js?\n}");
2130
+ eval("{/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ keepAlive: () => (/* binding */ keepAlive),\n/* harmony export */ request: () => (/* binding */ request),\n/* harmony export */ trustedGrant: () => (/* binding */ trustedGrant)\n/* harmony export */ });\n/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ \"../../../node_modules/@babel/runtime/helpers/typeof.js\");\n/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"../../../node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! axios */ \"../../../node_modules/axios/lib/axios.js\");\n/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! qs */ \"../../../node_modules/qs/lib/index.js\");\n/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(qs__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _fixResponse__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./fixResponse */ \"./serverCalls/fixResponse.js\");\n\n\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1___default()(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\n/* eslint-disable no-prototype-builtins */\n/*------------------------------------------------------------------------------------\r\n Copyright © 2023, SAS Institute Inc., Cary, NC, USA. All Rights reserved Licensed under the Apache License, Version 2.0 (the \"License\");\r\n you may not use this file except in compliance with the License.\r\n You may obtain a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n Unless required by applicable law or agreed to in writing, software\r\n distributed under the License is distributed on an \"AS IS\" BASIS,\r\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n See the License for the specific language governing permissions and\r\n limitations under the License.\r\n ---------------------------------------------------------------------------------------*/\n\n\n\n\nvar Https = null;\nif (true) {\n Https = __webpack_require__(/*! node:https */ \"node:https\");\n}\n\n// axios.defaults.withCredentials = true\naxios__WEBPACK_IMPORTED_MODULE_2__[\"default\"].interceptors.response.use(function (response) {\n return response;\n}, function (error) {\n return Promise.reject(error);\n});\n\n/* X-Uaa-Csrf */\nfunction trustedGrant(iconfig) {\n var link = iconfig.link;\n var auth1 = Buffer.from(iconfig.clientID + \":\" + iconfig.clientSecret).toString(\"base64\");\n auth1 = \"Basic \" + auth1;\n var baseUrl = patchURL4ns(iconfig, link.href);\n var config = {\n method: link.method,\n baseURL: baseUrl,\n url: link.href,\n /*iconfig.host + link.href,*/\n\n headers: {\n Accept: link.responseType,\n \"Content-Type\": link.type /* Axios seems to be case sensitive */,\n Authorization: auth1\n },\n withCredentials: false,\n data: {\n grant_type: \"password\",\n username: iconfig.user,\n password: iconfig.password\n },\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n transformResponse: function transformResponse(data) {\n return data;\n },\n transformRequest: function transformRequest(data) {\n return qs__WEBPACK_IMPORTED_MODULE_3___default().stringify(data);\n }\n };\n var storeConfig = {\n protocol: 'https://',\n sslOption: {}\n };\n //TBD: Need to update the whole flow to be consistent with the storeConfig\n return makeCall(config, iconfig, config);\n}\nfunction request(iconfig) {\n \"use strict\";\n\n var link = iconfig.link,\n logonInfo = iconfig.logonInfo;\n var iLink = _objectSpread({}, link);\n var payload = iconfig.hasOwnProperty(\"payload\") ? iconfig.payload : null;\n var iqs = null;\n var idata = null;\n var iheaders = null;\n var ixsrf = null;\n var casAction = null;\n if (payload !== null) {\n casAction = hasItem(payload, \"action\");\n iqs = hasItem(payload, \"qs\");\n idata = hasItem(payload, \"data\");\n iheaders = hasItem(payload, \"headers\");\n ixsrf = hasItem(payload, \"xsrf\");\n }\n var baseUrl = patchURL4ns(logonInfo, iLink.href);\n // let url = `${l}${iLink.href}`;\n\n // handle casaction upload\n casAction = casAction != null ? casAction.toLowerCase() : null;\n var url = casAction !== null ? \"\".concat(iLink.href, \"/\").concat(casAction) : \"\".concat(iLink.href);\n if (iLink.hasOwnProperty(\"customHandling\") && casAction !== null) {\n // casAction = casAction.toLowerCase();\n if (casAction === \"table.upload\") {\n iLink.method = \"PUT\";\n iLink.type = \"application/octet-stream\";\n iLink.responseType = \"application/json\";\n }\n }\n var config = {\n method: iLink.method,\n baseURL: baseUrl,\n url: url,\n transformResponse: function transformResponse(data) {\n return data;\n },\n validateStatus: function validateStatus(status) {\n /* 304 for state calls */\n\n return status === 302 || status === 304 || status >= 200 && status < 300;\n }\n };\n config.headers = {};\n if (logonInfo.token !== null) {\n config.headers['Authorization'] = logonInfo.tokenType + \" \" + logonInfo.token;\n } else {\n config.withCredentials = iconfig.withCredentials == null ? true : iconfig.withCredentials;\n }\n var type = fullType(iLink.type);\n if (iLink.hasOwnProperty(\"responseType\")) {\n if (type !== null) {\n config.headers[\"Content-Type\"] = type;\n }\n config.headers.Accept = fullType(iLink.responseType);\n } else if (type !== null) {\n config.headers.Accept = type;\n if (iLink.method === \"PUT\" || iLink.method === \"POST\" || iLink.method === \"PATCH\") {\n config.headers[\"Content-Type\"] = type;\n }\n }\n if (iheaders !== null) {\n for (var ih in iheaders) {\n //noinspection JSUnfilteredForInLoop\n if (ih.toLowerCase() === \"json-parameters\") {\n //noinspection JSUnfilteredForInLoop\n config.headers[ih] = _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(iheaders[ih]) === \"object\" ? JSON.stringify(iheaders[ih]) : iheaders[ih];\n } else {\n //noinspection JSUnfilteredForInLoop\n config.headers[ih] = iheaders[ih];\n }\n }\n }\n if (ixsrf !== null) {\n /* TBD: fix parallel calls to get of this conditional */\n var xsrfHeaderName = ixsrf[\"x-csrf-header\"];\n if (xsrfHeaderName != null) {\n config.xsrfCookieName = null;\n config.xsrfHeaderName = xsrfHeaderName;\n // https://github.com/axios/axios/issues/2024\n config.headers[xsrfHeaderName] = ixsrf[xsrfHeaderName];\n }\n if (ixsrf[\"tkhttp-id\"] != null) {\n config.headers[\"tkhttp-id\"] = ixsrf[\"tkhttp-id\"];\n }\n } else {\n if (config.type === 'ADD_SERVICE') {\n config.xsrfHeaderName = 'X_CSRF_TOKEN';\n config.headers['X-CSRF-TOKEN'] = \"Fetch\";\n }\n }\n if (iqs !== null) {\n config.params = _objectSpread({}, iqs);\n }\n config.data = idata === null ? {} : idata;\n config.maxContentLength = 2 * 10063256;\n // let httpOptions = (iconfig.storeConfig.config != null ? iconfig.storeConfig.config.httpOptions : null);\n\n /*\r\n let httpOptions = iconfig.storeConfig.httpOptions;\r\n if (httpOptions != null) {\r\n for (let k in httpOptions) {\r\n config[k] = httpOptions[k];\r\n }\r\n }\r\n */\n\n setupProxy(iconfig, config);\n return makeCall(config, iconfig, logonInfo);\n}\n// setup if using reverse proxy server\nfunction setupProxy(iconfig, config) {\n var options = iconfig.logonInfo.options;\n if (options != null && options.proxyServer != null) {\n var proxy = options.proxy;\n if (proxy.pathname != null && proxy.pathname.trim().length > 0) {\n config.url = \"\".concat(proxy.pathname).concat(config.url); //prepend url with proxy path\n }\n config.baseURL = \"\".concat(proxy.protocol, \"//\").concat(proxy.host); //override base url\n }\n}\n// patch the url for namespace - useful for k8s to make calls into another namespace\nfunction patchURL4ns(logInfo, link) {\n var host = logInfo.host;\n if (logInfo.options != null && logInfo.options.ns != null) {\n var service = link.split(\"/\")[1];\n host = \"\".concat(logInfo.protocol).concat(service, \".{logInfo.options.ns}.svc.cluster.local\");\n }\n return host;\n}\nfunction makeCall(config, iconfig, storeConfig) {\n if (storeConfig.protocol === \"https://\" && config.agent == null) {\n var opts = iconfig.storeConfig.httpsOptions != null ? iconfig.storeConfig.httpsOptions : {};\n if (Https !== null) {\n var agent = new Https.Agent(opts);\n config.httpsAgent = agent;\n }\n }\n return new Promise(function (resolve, reject) {\n (0,axios__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(config).then(function (response) {\n parseJSON(response.data).then(function (data) {\n iconfig.data = null; /* get rid of the payload*/\n response.data = {\n results: data,\n iconfig: Object.assign({}, iconfig)\n };\n if (data.hasOwnProperty(\"errorCode\")) {\n //noinspection JSUnresolvedVariable\n response.status = response.data.results.httpStatusCode;\n response.statusText = \"errorCode: \".concat(response.data.results.errorCode);\n reject({\n response: response\n });\n } else {\n resolve((0,_fixResponse__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(response));\n }\n }).catch(function () {\n iconfig.data = null;\n response.data = {\n results: response.data,\n iconfig: Object.assign({}, iconfig)\n };\n resolve((0,_fixResponse__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(response));\n });\n }).catch(function (error) {\n reject(error);\n });\n });\n}\nfunction parseJSON(data) {\n //noinspection JSUnusedLocalSymbols\n return new Promise(function (resolve, reject) {\n if (_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(data) === \"object\") {\n resolve(data);\n } else {\n var temp = data.replace(/\\r?\\n|\\r/g, \" \");\n try {\n var odata = JSON.parse(temp);\n resolve(odata);\n } catch (err) {\n resolve(data);\n }\n }\n });\n}\nfunction hasItem(payload, name) {\n for (var _i = 0, _Object$keys = Object.keys(payload); _i < _Object$keys.length; _i++) {\n var k = _Object$keys[_i];\n if (k.toUpperCase() === name.toUpperCase()) {\n return payload[k];\n }\n }\n return null;\n}\nfunction fullType(type) {\n var ntype = type;\n if (ntype === undefined || ntype === null) {\n ntype = null;\n } else {\n if (ntype.indexOf(\"application/vnd\") !== -1) {\n if (ntype.indexOf(\"+json\") === -1) {\n ntype = ntype + \"+json\";\n }\n }\n }\n return ntype;\n}\n\n// Code below is for experimenting.\n\nfunction keepAlive(action) {\n return (0,axios__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(action.payload);\n}\n\n\n//# sourceURL=webpack://restaf/./serverCalls/index.js?\n}");
2131
2131
 
2132
2132
  /***/ }),
2133
2133
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sassoftware/restaf",
3
- "version": "5.5.1-1",
3
+ "version": "5.5.1-3",
4
4
  "description": "Library for writing SAS Viya application using REST APIs",
5
5
  "author": "Deva Kumaraswamy <deva.kumar@sas.com>",
6
6
  "license": "Apache-2.0",