Repository URL to install this package:
|
Version:
3.3.0-graphql-modules.2 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const config_1 = require("@skava/request/dist/config");
const config_2 = require("../../bootstrapper/api/config");
// Todo isTruish is not available in uxui-module
const isTruish = x => x === true || x === 'true' || /^["|']?true["|']?$/.test(x);
const storeKey = isTruish(process.env.SHOULD_USE_LOWERCASE_STORE_ID)
? 'storeid'
: 'storeId';
const constantAndDefault = {
// Orchestration wont require these params
// partnerId,
// [storeKey]: storeId,
// appid,
// locale,
};
const constantHeaders = {
get skcid() {
return config_2.toCorrelationId();
},
// Orchestration API layer requires storeId, contentType and SessionId to be header params
'x-store-id': config_2.storeId,
'content-type': 'json',
'x-version': '8.0.0',
'x-skava': config_2.skavaHeaderSecret,
};
if (isTruish(config_2.shouldIncudeCampaignId)) {
constantAndDefault.campaignId = config_2.campaignId;
}
config_1.setConfig(Object.assign({}, constantHeaders, constantAndDefault));
config_1.config.set('constantParams', constantAndDefault);
config_1.config.set('constantHeaders', constantHeaders);
//# sourceMappingURL=requestMiddleware.js.map