Repository URL to install this package:
|
Version:
2.0.14 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ENV_1 = require("./ENV");
const STREAMDAO_1 = require("./STREAMDAO");
// const cookieJar = new CookieJar()
// @TODO change the base url & config ^
// @NOTE we would want the proxies if we want the production
// so when we merge into master or when we have the flag
// then test on real api responses - best of both
// if (!ENV_TEST || ENV_API_PROD) {
// // change the config
// }
const apiConfig = { clientDomain: ENV_1.clientDomain, clientVersion: ENV_1.clientVersion };
exports.apiConfig = apiConfig;
const https = 'https';
exports.https = https;
const baseUrlPrefix = `${https}://${ENV_1.clientDomain}/skavastream`;
exports.baseUrlPrefix = baseUrlPrefix;
const getBaseTargetURL = (objectDAO, callType) => {
/* @TODO Sort this out properly as proxy is broken */
let targetUrl = '';
const version = objectDAO.clientVersion
? objectDAO.clientVersion
: apiConfig.clientVersion;
if (objectDAO.isProxyAPI) {
// console.log('isProxy API')
/* @TODO @Anto - Hardcoded for now will move it to config*/
targetUrl = 'http://encrypt-stg.skavaone.com/apiadmin/remote/skavakeystore/getKeyForToken';
}
else if (callType === 'GET') {
targetUrl = `${baseUrlPrefix}/${objectDAO.type}/${version}/${objectDAO.partner}`;
}
else {
targetUrl = `${baseUrlPrefix}/${objectDAO.type}/${version}/${objectDAO.partner}`;
}
console.log("proxypath", { objectDAO, callType, targetUrl });
return targetUrl;
};
exports.getBaseTargetURL = getBaseTargetURL;
const getURL = (route, callType) => {
const type = route.replace('/', '');
console.log("getURL", type);
const objectDAO = STREAMDAO_1.getStreamDataAccessObjType(type);
const target = getBaseTargetURL(objectDAO, callType);
return target;
};
exports.getURL = getURL;
const endpoints = [
'/productlist',
'/category',
'/product',
'/viewbag',
'/getlists',
'/profile',
'/search',
'/reviews',
'/getstores',
'/register',
'/createlist',
'/additem',
'/deleteitem',
'/getitems',
'/login',
'/profile',
'/logout',
'/setshippingaddress/update',
'/setpaymentmethod',
'/deletecard',
'/submitreview',
'/resetpassword',
'/orderdetails',
'/submitorder/return',
'/submitorder/cancel',
'/addtobag',
'/deletefrombag',
'/estimate',
'/updatebag',
'/updateshippingmethods',
'/payment',
'/submitorder',
'/setshippingaddress',
'/searchsuggestion',
'/updatepassword',
'/getsecurityquestion',
'/suspendcart',
'/user',
'/getCatalog',
'/getPages',
'/getKeyForToken',
'/loyalty',
'/checkoutauth',
'/useractivation',
'/accountinvite',
'/accountprofile',
'/accountinvite',
];
exports.endpoints = endpoints;
const callDetails = {
'/productlist': 'GET',
'/category': 'GET',
'/product': 'GET',
'/viewbag': 'GET',
'/getlists': 'POST',
'/profile': 'POST',
'/search': 'GET',
'/reviews': 'POST',
'/submitreview': 'POST',
'/getstores': 'POST',
'/register': 'POST',
'/additem': 'POST',
'/deleteitem': 'POST',
'/getitems': 'POST',
'/login': 'POST',
'/logout': 'POST',
'/setshippingaddress/update': 'POST',
'/setpaymentmethod': 'POST',
'/deletecard': 'POST',
'/resetpassword': 'POST',
'/orderdetails': 'POST',
'/submitorder/return': 'POST',
'/submitorder/cancel': 'POST',
'/addtobag': 'POST',
'/deletefrombag': 'POST',
'/estimate': 'POST',
'/updatebag': 'POST',
'/updateshippingmethods': 'POST',
'/payment': 'POST',
'/submitorder': 'POST',
'/setshippingaddress': 'POST',
'/searchsuggestion': 'GET',
'/suspendcart': 'POST',
'/user': 'GET',
'/getCatalog': 'GET',
'/getPages': 'GET',
'/getKeyForToken': 'GET',
'/loyalty': 'POST',
'/checkoutauth': 'POST',
'/useractivation': 'PATCH',
'/accountinvite': 'PATCH',
'/accountprofile': 'GET',
'/accountregister': 'POST',
};
exports.callDetails = callDetails;
Object.freeze(endpoints);
Object.freeze(callDetails);
//# sourceMappingURL=proxyPathConfigs.js.map