Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/graphql / dist / src / bootstrapper / setup / requestMiddleware.js
Size: Mime:
"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